eddev 0.2.67-beta1 → 0.3.0-beta1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (185) hide show
  1. package/admin/components/ImageWell.d.ts +2 -2
  2. package/admin/components/ImageWell.js +51 -39
  3. package/admin/defineField.d.ts +2 -2
  4. package/admin/defineWidget.d.ts +1 -1
  5. package/admin/defineWidget.js +2 -2
  6. package/admin/index.js +1 -5
  7. package/admin/installFieldTypes.js +26 -26
  8. package/admin/runWidgets.js +28 -17
  9. package/admin/selectMedia.d.ts +2 -2
  10. package/admin/selectMedia.js +1 -1
  11. package/blocks/ContentBlocks.d.ts +6 -6
  12. package/blocks/ContentBlocks.js +66 -58
  13. package/blocks/ErrorBoundaryEditor.d.ts +1 -1
  14. package/blocks/ErrorBoundaryEditor.js +45 -16
  15. package/blocks/ErrorBoundaryFrontend.d.ts +1 -1
  16. package/blocks/ErrorBoundaryFrontend.js +45 -16
  17. package/blocks/InspectorControls.d.ts +1 -1
  18. package/blocks/InspectorControls.js +3 -3
  19. package/blocks/blockAttributes.d.ts +2 -2
  20. package/blocks/blockAttributes.js +44 -24
  21. package/blocks/index.js +1 -5
  22. package/blocks/inlineEditing.d.ts +6 -6
  23. package/blocks/inlineEditing.js +55 -36
  24. package/blocks/installGutenbergHooks.js +68 -48
  25. package/build/babel/plugin-name-defined-components.js +16 -15
  26. package/build/build-favicon.js +62 -11
  27. package/build/clean.js +52 -5
  28. package/build/create-codegen-worker.js +33 -78
  29. package/build/create-serverless-dev-worker.js +39 -61
  30. package/build/create-webpack-worker.js +33 -65
  31. package/build/file-tree.d.ts +2 -2
  32. package/build/file-tree.js +12 -12
  33. package/build/get-webpack-config.js +395 -341
  34. package/build/graphql-codegen/graphql-codegen-files.js +25 -31
  35. package/build/graphql-codegen/graphql-codegen-no-duplicates.js +4 -4
  36. package/build/graphql-codegen/graphql-codegen-queries.js +99 -102
  37. package/build/manifests/manifest-blocks.d.ts +1 -1
  38. package/build/manifests/manifest-blocks.js +29 -37
  39. package/build/manifests/manifest-fields.d.ts +1 -1
  40. package/build/manifests/manifest-fields.js +21 -23
  41. package/build/manifests/manifest-views.d.ts +1 -1
  42. package/build/manifests/manifest-views.js +25 -32
  43. package/build/manifests/manifest-widgets.d.ts +1 -1
  44. package/build/manifests/manifest-widgets.js +20 -22
  45. package/build/manifests/manifest.d.ts +2 -2
  46. package/build/manifests/manifest.js +94 -30
  47. package/build/reporter.d.ts +1 -1
  48. package/build/reporter.js +32 -29
  49. package/build/serverless/create-next-app.d.ts +1 -1
  50. package/build/serverless/create-next-app.js +467 -245
  51. package/build/state/codegen-state.d.ts +4 -4
  52. package/build/state/compiler-state.d.ts +5 -5
  53. package/build/state/serverless-state.d.ts +3 -3
  54. package/build/workers/codegen-worker-script.js +519 -393
  55. package/build/workers/serverless-worker-dev-script.js +4 -4
  56. package/build/workers/webpack-worker-script.js +156 -90
  57. package/cli/build.dev.d.ts +1 -1
  58. package/cli/build.dev.js +126 -79
  59. package/cli/build.prod.d.ts +1 -1
  60. package/cli/build.prod.js +98 -42
  61. package/cli/cli.js +28 -19
  62. package/cli/display/components/BundleDisplay.d.ts +1 -1
  63. package/cli/display/components/BundleDisplay.js +24 -13
  64. package/cli/display/components/CodegenDisplay.d.ts +1 -1
  65. package/cli/display/components/CodegenDisplay.js +25 -14
  66. package/cli/display/components/DevCLIDisplay.d.ts +2 -2
  67. package/cli/display/components/DevCLIDisplay.js +25 -14
  68. package/cli/display/components/Fullscreen.js +20 -9
  69. package/cli/display/components/ServerlessDisplay.d.ts +2 -2
  70. package/cli/display/components/ServerlessDisplay.js +26 -15
  71. package/cli/display/components/StatusIcon.d.ts +2 -2
  72. package/cli/display/components/StatusIcon.js +3 -3
  73. package/cli/preinstall.js +5 -4
  74. package/cli/setup.js +73 -25
  75. package/components/AdminBar.d.ts +1 -1
  76. package/components/AdminBar.js +3 -37
  77. package/components/BrowserRouter.d.ts +2 -2
  78. package/components/BrowserRouter.js +54 -41
  79. package/components/InlinePage.d.ts +2 -2
  80. package/components/InlinePage.js +29 -17
  81. package/components/NextRouter.d.ts +2 -2
  82. package/components/NextRouter.js +29 -20
  83. package/components/index.js +1 -5
  84. package/config/config-schema.d.ts +1 -1
  85. package/config/config-schema.js +1 -1
  86. package/config/create-schema-file.js +6 -6
  87. package/config/get-config.js +13 -10
  88. package/config/index.js +1 -5
  89. package/config/parse-config.js +1 -1
  90. package/config/print-zod-errors.js +3 -3
  91. package/dev-ui/components/BreakpointColumnHeader.d.ts +2 -2
  92. package/dev-ui/components/BreakpointColumnHeader.js +18 -7
  93. package/dev-ui/components/BreakpointIndicator.d.ts +1 -1
  94. package/dev-ui/components/BreakpointIndicator.js +32 -25
  95. package/dev-ui/components/DevUI.d.ts +1 -1
  96. package/dev-ui/components/DevUI.js +13 -13
  97. package/dev-ui/components/Launcher.d.ts +2 -2
  98. package/dev-ui/components/Launcher.js +25 -13
  99. package/dev-ui/components/PanelWrapper.d.ts +2 -2
  100. package/dev-ui/components/PanelWrapper.js +8 -8
  101. package/dev-ui/components/ResponsiveLerpControl.d.ts +2 -2
  102. package/dev-ui/components/ResponsiveLerpControl.js +38 -27
  103. package/dev-ui/components/ResponsiveScaleEditor.d.ts +4 -4
  104. package/dev-ui/components/ResponsiveScaleEditor.js +78 -64
  105. package/dev-ui/components/atoms/Button.js +1 -1
  106. package/dev-ui/components/atoms/Dropdown.d.ts +3 -3
  107. package/dev-ui/components/atoms/Dropdown.js +9 -8
  108. package/dev-ui/components/atoms/NumberField.d.ts +2 -2
  109. package/dev-ui/components/atoms/NumberField.js +42 -29
  110. package/dev-ui/components/atoms/Spacer.js +1 -1
  111. package/dev-ui/components/atoms/Text.js +1 -1
  112. package/dev-ui/components/atoms/ToggleButton.d.ts +2 -2
  113. package/dev-ui/components/atoms/ToggleButton.js +16 -5
  114. package/dev-ui/components/atoms/Tooltip.d.ts +2 -2
  115. package/dev-ui/components/atoms/Tooltip.js +20 -8
  116. package/dev-ui/components/panels/AppDataDebugger.d.ts +1 -1
  117. package/dev-ui/components/panels/AppDataDebugger.js +19 -8
  118. package/dev-ui/components/panels/ColorEditor.d.ts +1 -1
  119. package/dev-ui/components/panels/ColorEditor.js +42 -35
  120. package/dev-ui/components/panels/PageDataDebugger.d.ts +1 -1
  121. package/dev-ui/components/panels/PageDataDebugger.js +20 -8
  122. package/dev-ui/components/panels/QueryDebugger.d.ts +1 -1
  123. package/dev-ui/components/panels/QueryDebugger.js +24 -12
  124. package/dev-ui/components/panels/SpacingEditor.d.ts +1 -1
  125. package/dev-ui/components/panels/SpacingEditor.js +48 -34
  126. package/dev-ui/components/panels/TypographyEditor.d.ts +1 -1
  127. package/dev-ui/components/panels/TypographyEditor.js +46 -38
  128. package/dev-ui/hooks/useBreakpoint.d.ts +1 -1
  129. package/dev-ui/hooks/useBreakpoint.js +13 -13
  130. package/dev-ui/hooks/usePersistState.js +7 -6
  131. package/dev-ui/hooks/useStylesheet.js +6 -6
  132. package/dev-ui/icons.d.ts +15 -15
  133. package/dev-ui/icons.js +27 -16
  134. package/dev-ui/index.js +1 -5
  135. package/dev-ui/loader.d.ts +1 -1
  136. package/dev-ui/loader.js +9 -13
  137. package/dev-ui/panels.d.ts +2 -2
  138. package/dev-ui/panels.js +7 -7
  139. package/dev-ui/theme.js +3 -3
  140. package/dynamic/dynamic-component.js +1 -1
  141. package/dynamic/index.js +1 -5
  142. package/entry/Root.d.ts +2 -2
  143. package/entry/Root.js +26 -16
  144. package/entry/entry.admin.dev.js +4 -4
  145. package/entry/entry.admin.prod.js +4 -4
  146. package/entry/entry.monolith.dev.js +5 -5
  147. package/entry/entry.monolith.prod.js +5 -5
  148. package/gravityforms/gravity-forms.d.ts +2 -2
  149. package/gravityforms/index.js +1 -5
  150. package/gravityforms/useGravityForm.d.ts +2 -2
  151. package/gravityforms/useGravityForm.js +130 -126
  152. package/hooks/index.js +1 -5
  153. package/hooks/queryUtils.d.ts +14 -14
  154. package/hooks/queryUtils.js +192 -101
  155. package/hooks/useAppData.d.ts +2 -2
  156. package/hooks/useAppData.js +9 -9
  157. package/hooks/usePageLoad.js +4 -4
  158. package/hooks/useQueryDebug.d.ts +1 -1
  159. package/hooks/useQueryDebug.js +7 -7
  160. package/hooks/useRPC.d.ts +4 -4
  161. package/hooks/useRPC.js +3 -3
  162. package/package.json +11 -11
  163. package/routing/index.js +1 -5
  164. package/routing/remoteProps.d.ts +1 -1
  165. package/routing/remoteProps.js +72 -31
  166. package/routing/routing.d.ts +25 -15
  167. package/routing/routing.js +200 -112
  168. package/routing/updateEditLink.js +1 -1
  169. package/serverless/define-api.d.ts +1 -1
  170. package/serverless/define-rpc-router.js +4 -8
  171. package/serverless/index.js +2 -6
  172. package/style/createStitches.js +142 -164
  173. package/style/index.js +1 -5
  174. package/tsconfig.json +1 -1
  175. package/utils/Observable.d.ts +2 -2
  176. package/utils/Observable.js +15 -12
  177. package/utils/getRepoName.js +3 -3
  178. package/utils/promptIfRepoNameIncorrect.js +64 -18
  179. package/utils/refreshOverlayInterop.js +1 -1
  180. package/utils/reportErrorStack.d.ts +1 -1
  181. package/utils/reportErrorStack.js +1 -1
  182. package/utils/serverlessAppContext.js +1 -1
  183. package/utils/updateEnvFile.js +69 -19
  184. package/utils/useObservable.js +3 -3
  185. package/views/index.js +1 -5
@@ -1,8 +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
+ };
2
13
  Object.defineProperty(exports, "__esModule", { value: true });
3
14
  exports.createStitches = exports.parseResponsiveTokens = exports.getResponsiveObjectStyles = exports.parseResponsiveObject = exports.parseBreakpoints = void 0;
4
- const react_1 = require("@stitches/react");
5
- const typeKeyMap = {
15
+ var react_1 = require("@stitches/react");
16
+ var typeKeyMap = {
6
17
  fontSize: "fontSizes",
7
18
  fontFamily: "fonts",
8
19
  lineHeight: "lineHeights",
@@ -10,29 +21,29 @@ const typeKeyMap = {
10
21
  fontWeight: "fontWeights",
11
22
  };
12
23
  function parseBreakpoints(names, medias) {
13
- const breakpoints = [];
24
+ var breakpoints = [];
14
25
  // Add an initial breakpoint
15
26
  breakpoints.push({ key: "initial", min: "0px", max: null });
16
27
  // Parse each breakpoint
17
- for (const key in medias) {
28
+ for (var key in medias) {
18
29
  if (!names.includes(key))
19
30
  continue;
20
- const media = medias[key];
21
- const minMatch = media.match(/min-width: ([0-9]+[a-z]+)/);
22
- const maxMatch = media.match(/max-width: ([0-9]+[a-z]+)/);
31
+ var media = medias[key];
32
+ var minMatch = media.match(/min-width: ([0-9]+[a-z]+)/);
33
+ var maxMatch = media.match(/max-width: ([0-9]+[a-z]+)/);
23
34
  if (!minMatch && !maxMatch)
24
35
  continue;
25
36
  breakpoints.push({
26
- key,
37
+ key: key,
27
38
  min: minMatch ? minMatch[1] : null,
28
39
  max: maxMatch ? maxMatch[1] : null,
29
40
  });
30
41
  }
31
42
  // Ensure each breakpoint has a min/max value (except for first and last)
32
- for (let i = 0; i < breakpoints.length; i++) {
33
- const bp = breakpoints[i];
34
- const prev = breakpoints[i - 1];
35
- const next = breakpoints[i + 1];
43
+ for (var i = 0; i < breakpoints.length; i++) {
44
+ var bp = breakpoints[i];
45
+ var prev = breakpoints[i - 1];
46
+ var next = breakpoints[i + 1];
36
47
  if (bp.min === null && prev && prev.max) {
37
48
  bp.min = prev.max;
38
49
  }
@@ -43,13 +54,13 @@ function parseBreakpoints(names, medias) {
43
54
  return breakpoints;
44
55
  }
45
56
  exports.parseBreakpoints = parseBreakpoints;
46
- const unitless = (value) => parseFloat(value);
57
+ var unitless = function (value) { return parseFloat(value); };
47
58
  function parseTypography(theme, breakpoints, typography) {
48
- const globals = {};
49
- const typeVariants = {};
50
- breakpoints.forEach((bp) => (globals["@" + bp.key] = {}));
59
+ var globals = {};
60
+ var typeVariants = {};
61
+ breakpoints.forEach(function (bp) { return (globals["@" + bp.key] = {}); });
51
62
  globals["@editor"] = {};
52
- const resolveValue = (scale, value) => {
63
+ var resolveValue = function (scale, value) {
53
64
  if (typeof value === "string" && value.match(/^\$[a-z0-9\-\_]+$/)) {
54
65
  // Single scale
55
66
  return theme[scale][value.replace("$", "")];
@@ -58,7 +69,7 @@ function parseTypography(theme, breakpoints, typography) {
58
69
  return value;
59
70
  }
60
71
  };
61
- const resolveThemeVar = (scale, value) => {
72
+ var resolveThemeVar = function (scale, value) {
62
73
  if (typeof value === "string" && value.match(/^\$[a-z0-9\-\_]+$/)) {
63
74
  // Single scale
64
75
  return "$" + scale + value;
@@ -67,25 +78,25 @@ function parseTypography(theme, breakpoints, typography) {
67
78
  return value;
68
79
  }
69
80
  };
70
- for (const name in typography) {
71
- const style = typography[name];
72
- const variant = {};
73
- typeVariants[name] = variant;
74
- for (const key in style) {
75
- const value = style[key];
76
- const varName = `--type-${name}-${key}`;
77
- variant[key] = `var(${varName})`;
78
- const tokenPrefix = typeKeyMap[key];
81
+ for (var name_1 in typography) {
82
+ var style = typography[name_1];
83
+ var variant = {};
84
+ typeVariants[name_1] = variant;
85
+ for (var key in style) {
86
+ var value = style[key];
87
+ var varName = "--type-".concat(name_1, "-").concat(key);
88
+ variant[key] = "var(".concat(varName, ")");
89
+ var tokenPrefix = typeKeyMap[key];
79
90
  if (typeof value === "string" || typeof value === "number") {
80
91
  // A simple string or number value is used
81
92
  globals["@initial"][varName] = resolveThemeVar(tokenPrefix, value);
82
93
  }
83
94
  else if (value && typeof value === "object") {
84
95
  // A responsive object value
85
- const unit = key === "lineHeight" ? "%" : "px";
86
- const [tokenGlobals, initial] = getResponsiveObjectStyles(breakpoints, value, varName, unit);
87
- for (const key in tokenGlobals) {
88
- globals[key] = { ...globals[key], ...tokenGlobals[key] };
96
+ var unit = key === "lineHeight" ? "%" : "px";
97
+ var _a = getResponsiveObjectStyles(breakpoints, value, varName, unit), tokenGlobals = _a[0], initial = _a[1];
98
+ for (var key_1 in tokenGlobals) {
99
+ globals[key_1] = __assign(__assign({}, globals[key_1]), tokenGlobals[key_1]);
89
100
  }
90
101
  // const entries = Object.entries(value)
91
102
  // entries.forEach(([bpName, responsiveValue], i) => {
@@ -113,11 +124,11 @@ function parseTypography(theme, breakpoints, typography) {
113
124
  }
114
125
  }
115
126
  // debugger
116
- return { globalTypography: globals, typeVariants };
127
+ return { globalTypography: globals, typeVariants: typeVariants };
117
128
  }
118
129
  function parseGrid(theme, media, grid) {
119
- const globalGrid = {};
120
- const resolveThemeVar = (scale, value) => {
130
+ var globalGrid = {};
131
+ var resolveThemeVar = function (scale, value) {
121
132
  if (typeof value === "string" && value.match(/^\$[a-z0-9\-\_]+$/)) {
122
133
  // Single scale
123
134
  return "$" + scale + value;
@@ -126,24 +137,22 @@ function parseGrid(theme, media, grid) {
126
137
  return value;
127
138
  }
128
139
  };
129
- for (let [bpName, breakpoint] of Object.entries(grid.breakpoints)) {
140
+ for (var _i = 0, _a = Object.entries(grid.breakpoints); _i < _a.length; _i++) {
141
+ var _b = _a[_i], bpName = _b[0], breakpoint = _b[1];
130
142
  globalGrid[bpName] = {
131
143
  "--grid-columns": grid.columns,
132
144
  "--grid-outer-width": breakpoint.container,
133
- "--grid-inner-width": `calc(${breakpoint.container} - ${resolveThemeVar("spaces", breakpoint.margin)} * 2)`,
145
+ "--grid-inner-width": "calc(".concat(breakpoint.container, " - ").concat(resolveThemeVar("spaces", breakpoint.margin), " * 2)"),
134
146
  "--grid-gutter": breakpoint.gutter,
135
147
  "--grid-margin": breakpoint.margin,
136
- "--grid-col-width": `calc((var(--grid-inner-width) - (${grid.columns - 1} * var(--grid-gutter))) / ${grid.columns})`,
148
+ "--grid-col-width": "calc((var(--grid-inner-width) - (".concat(grid.columns - 1, " * var(--grid-gutter))) / ").concat(grid.columns, ")"),
137
149
  };
138
150
  }
139
- return { gridVariants: {}, globalGrid };
151
+ return { gridVariants: {}, globalGrid: globalGrid };
140
152
  }
141
153
  function parseResponsiveValue(val) {
142
154
  if (Array.isArray(val)) {
143
- return {
144
- ...parseResponsiveValue(val[0]),
145
- lerpStart: true,
146
- };
155
+ return __assign(__assign({}, parseResponsiveValue(val[0])), { lerpStart: true });
147
156
  }
148
157
  else if (typeof val === "string") {
149
158
  if (val.match(/^x[0-9\.]+$/)) {
@@ -189,21 +198,23 @@ function parseResponsiveValue(val) {
189
198
  }
190
199
  function parseResponsiveObject(breakpoints, object) {
191
200
  // Breakpoint hash
192
- const breakpointHash = {};
193
- for (let bp of breakpoints) {
201
+ var breakpointHash = {};
202
+ for (var _i = 0, breakpoints_1 = breakpoints; _i < breakpoints_1.length; _i++) {
203
+ var bp = breakpoints_1[_i];
194
204
  breakpointHash[bp.key] = {
195
205
  min: bp.min ? parseFloat(bp.min) : null,
196
206
  max: bp.max ? parseFloat(bp.max) : null,
197
207
  };
198
208
  }
199
- const result = [];
200
- let lerpStart = "initial";
201
- let lastDefined = "initial";
202
- let concreteValues = {};
203
- for (let bp of breakpoints) {
204
- const value = parseResponsiveValue(object["@" + bp.key]);
205
- const defined = value.type !== "undefined";
206
- let base = !defined || value.type === "multiplier" ? lastDefined : bp.key;
209
+ var result = [];
210
+ var lerpStart = "initial";
211
+ var lastDefined = "initial";
212
+ var concreteValues = {};
213
+ for (var _a = 0, breakpoints_2 = breakpoints; _a < breakpoints_2.length; _a++) {
214
+ var bp = breakpoints_2[_a];
215
+ var value = parseResponsiveValue(object["@" + bp.key]);
216
+ var defined = value.type !== "undefined";
217
+ var base = !defined || value.type === "multiplier" ? lastDefined : bp.key;
207
218
  lerpStart = value.lerpStart ? bp.key : lerpStart && !defined ? lerpStart : null;
208
219
  if (value.type === "px" || value.type === "number") {
209
220
  concreteValues[bp.key] = value.value;
@@ -214,13 +225,7 @@ function parseResponsiveObject(breakpoints, object) {
214
225
  else if (value.type === "percent") {
215
226
  concreteValues[bp.key] = value.value;
216
227
  }
217
- result.push({
218
- ...value,
219
- defined: defined,
220
- breakpoint: bp.key,
221
- lastBreakpoint: lastDefined,
222
- baseBreakpoint: base,
223
- lerping: lerpStart
228
+ result.push(__assign(__assign({}, value), { defined: defined, breakpoint: bp.key, lastBreakpoint: lastDefined, baseBreakpoint: base, lerping: lerpStart
224
229
  ? {
225
230
  fromBP: lerpStart,
226
231
  toBP: null,
@@ -229,91 +234,90 @@ function parseResponsiveObject(breakpoints, object) {
229
234
  minValue: 0,
230
235
  maxValue: 0,
231
236
  }
232
- : undefined,
233
- concreteValue: concreteValues[bp.key],
234
- });
237
+ : undefined, concreteValue: concreteValues[bp.key] }));
235
238
  if (defined) {
236
239
  lastDefined = bp.key;
237
240
  }
238
241
  }
239
- let nextBreakpoints = [];
240
- let lastBreakpoint = null;
241
- for (let i = breakpoints.length - 1; i >= 0; i--) {
242
- const bp = breakpoints[i];
242
+ var nextBreakpoints = [];
243
+ var lastBreakpoint = null;
244
+ for (var i = breakpoints.length - 1; i >= 0; i--) {
245
+ var bp = breakpoints[i];
243
246
  nextBreakpoints[i] = lastBreakpoint;
244
247
  if (result[i].defined) {
245
248
  lastBreakpoint = bp.key;
246
249
  }
247
250
  }
248
- result.forEach((item, i) => {
251
+ result.forEach(function (item, i) {
249
252
  if (item.lerping) {
250
253
  item.lerping.toBP = nextBreakpoints[i];
251
254
  }
252
255
  });
253
- result.forEach((item, i) => {
254
- const lerp = item.lerping;
256
+ result.forEach(function (item, i) {
257
+ var lerp = item.lerping;
255
258
  if (lerp) {
256
- const fromBP = lerp.fromBP ? breakpointHash[lerp.fromBP] : null;
257
- const toBP = lerp.toBP ? breakpointHash[lerp.toBP] : null;
259
+ var fromBP = lerp.fromBP ? breakpointHash[lerp.fromBP] : null;
260
+ var toBP = lerp.toBP ? breakpointHash[lerp.toBP] : null;
258
261
  if (!fromBP || fromBP.min === null) {
259
- throw new Error(`Cannot create responsive style for first breakpoint`);
262
+ throw new Error("Cannot create responsive style for first breakpoint");
260
263
  }
261
264
  if (!toBP || toBP.min === null) {
262
- throw new Error(`Cannot create responsive style for last breakpoint`);
265
+ throw new Error("Cannot create responsive style for last breakpoint");
263
266
  }
264
267
  lerp.minMedia = fromBP.min;
265
268
  lerp.maxMedia = toBP.min;
266
269
  lerp.minValue = item.concreteValue;
267
- lerp.maxValue = result.find((o) => o.breakpoint === lerp.toBP).concreteValue;
270
+ lerp.maxValue = result.find(function (o) { return o.breakpoint === lerp.toBP; }).concreteValue;
268
271
  }
269
272
  });
270
273
  return result;
271
274
  }
272
275
  exports.parseResponsiveObject = parseResponsiveObject;
273
- function getResponsiveObjectStyles(breakpoints, object, varName, unit = "px") {
276
+ function getResponsiveObjectStyles(breakpoints, object, varName, unit) {
277
+ var _a, _b, _c;
278
+ var _d;
279
+ if (unit === void 0) { unit = "px"; }
274
280
  // Prescale object
275
- object = { ...object };
276
- const parsed = parseResponsiveObject(breakpoints, object);
277
- const globals = {};
278
- for (let atom of parsed) {
281
+ object = __assign({}, object);
282
+ var parsed = parseResponsiveObject(breakpoints, object);
283
+ var globals = {};
284
+ for (var _i = 0, parsed_1 = parsed; _i < parsed_1.length; _i++) {
285
+ var atom = parsed_1[_i];
279
286
  if (atom.lerpStart && atom.lerping) {
280
- const lerp = atom.lerping;
281
- globals["@" + atom.breakpoint] = {
282
- [varName]: `calc(${lerp.minValue}${unit} + (100vw - ${lerp.minMedia}${unit}) / (${lerp.maxMedia} - ${lerp.minMedia}) * (${lerp.maxValue} - ${lerp.minValue}))`,
283
- };
287
+ var lerp = atom.lerping;
288
+ globals["@" + atom.breakpoint] = (_a = {},
289
+ _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, "))"),
290
+ _a);
284
291
  }
285
292
  else if (atom.concreteValue) {
286
- globals["@" + atom.breakpoint] = {
287
- [varName]: atom.concreteValue + unit,
288
- };
293
+ globals["@" + atom.breakpoint] = (_b = {},
294
+ _b[varName] = atom.concreteValue + unit,
295
+ _b);
289
296
  }
290
297
  else if (atom.defined) {
291
- globals["@" + atom.breakpoint] = {
292
- [varName]: atom.value,
293
- };
298
+ globals["@" + atom.breakpoint] = (_c = {},
299
+ _c[varName] = atom.value,
300
+ _c);
294
301
  }
295
302
  }
296
- return [globals, globals["@initial"]?.[varName]];
303
+ return [globals, (_d = globals["@initial"]) === null || _d === void 0 ? void 0 : _d[varName]];
297
304
  }
298
305
  exports.getResponsiveObjectStyles = getResponsiveObjectStyles;
299
306
  // parseResponsiveTokens({'@initial': blah, '@desktop': blah}, breakpoints, )
300
307
  function parseResponsiveTokens(theme, breakpoints) {
301
- const globalResponsive = {
308
+ var globalResponsive = {
302
309
  "@initial": {},
303
310
  };
304
- const initialResponsive = {};
305
- for (const scale in theme) {
306
- const initials = {};
311
+ var initialResponsive = {};
312
+ for (var scale in theme) {
313
+ var initials = {};
307
314
  initialResponsive[scale] = initials;
308
- for (const key in theme[scale]) {
309
- const val = theme[scale][key];
315
+ for (var key in theme[scale]) {
316
+ var val = theme[scale][key];
310
317
  if (val && typeof val === "object") {
311
- const [tokenGlobals, initial] = getResponsiveObjectStyles(breakpoints, val, "--" + scale + "-" + key);
312
- for (const bp in tokenGlobals) {
313
- globalResponsive[bp] = {
314
- ...globalResponsive[bp],
315
- ...tokenGlobals[bp],
316
- };
318
+ var _a = getResponsiveObjectStyles(breakpoints, val, "--" + scale + "-" + key), tokenGlobals = _a[0], initial = _a[1];
319
+ for (var bp in tokenGlobals) {
320
+ globalResponsive[bp] = __assign(__assign({}, globalResponsive[bp]), tokenGlobals[bp]);
317
321
  }
318
322
  initials[key] = initial;
319
323
  }
@@ -322,80 +326,60 @@ function parseResponsiveTokens(theme, breakpoints) {
322
326
  }
323
327
  }
324
328
  }
325
- return { initialResponsive, globalResponsive };
329
+ return { initialResponsive: initialResponsive, globalResponsive: globalResponsive };
326
330
  }
327
331
  exports.parseResponsiveTokens = parseResponsiveTokens;
328
332
  function createStitches(config) {
329
- const breakpoints = parseBreakpoints(config.breakpoints, config.media);
330
- const { typeVariants, globalTypography } = parseTypography(config.theme, breakpoints, config.typography);
331
- const { gridVariants, globalGrid } = parseGrid(config.theme, config.media, config.grid);
332
- const { initialResponsive, globalResponsive } = parseResponsiveTokens(config.responsive, breakpoints);
333
- const stitches = (0, react_1.createStitches)({
333
+ var breakpoints = parseBreakpoints(config.breakpoints, config.media);
334
+ var _a = parseTypography(config.theme, breakpoints, config.typography), typeVariants = _a.typeVariants, globalTypography = _a.globalTypography;
335
+ var _b = parseGrid(config.theme, config.media, config.grid), gridVariants = _b.gridVariants, globalGrid = _b.globalGrid;
336
+ var _c = parseResponsiveTokens(config.responsive, breakpoints), initialResponsive = _c.initialResponsive, globalResponsive = _c.globalResponsive;
337
+ var stitches = (0, react_1.createStitches)({
334
338
  // prefix: config.prefix,
335
- media: {
336
- initial: "",
337
- ...config.media,
338
- },
339
- theme: { ...config.theme, ...initialResponsive },
339
+ media: __assign({ initial: "" }, config.media),
340
+ theme: __assign(__assign({}, config.theme), initialResponsive),
340
341
  themeMap: config.themeMap,
341
- utils: {
342
- ...(config.utils || {}),
343
- typography: (key) => typeVariants[key],
344
- m: (value) => ({
342
+ utils: __assign(__assign({}, (config.utils || {})), { typography: function (key) { return typeVariants[key]; }, m: function (value) { return ({
345
343
  margin: value,
346
- }),
347
- mt: (value) => ({
344
+ }); }, mt: function (value) { return ({
348
345
  marginTop: value,
349
- }),
350
- mr: (value) => ({
346
+ }); }, mr: function (value) { return ({
351
347
  marginRight: value,
352
- }),
353
- mb: (value) => ({
348
+ }); }, mb: function (value) { return ({
354
349
  marginBottom: value,
355
- }),
356
- ml: (value) => ({
350
+ }); }, ml: function (value) { return ({
357
351
  marginLeft: value,
358
- }),
359
- mx: (value) => ({
352
+ }); }, mx: function (value) { return ({
360
353
  marginLeft: value,
361
354
  marginRight: value,
362
- }),
363
- my: (value) => ({
355
+ }); }, my: function (value) { return ({
364
356
  marginTop: value,
365
357
  marginBottom: value,
366
- }),
367
- p: (value) => ({
358
+ }); }, p: function (value) { return ({
368
359
  padding: value,
369
- }),
370
- pt: (value) => ({
360
+ }); }, pt: function (value) { return ({
371
361
  paddingTop: value,
372
- }),
373
- pr: (value) => ({
362
+ }); }, pr: function (value) { return ({
374
363
  paddingRight: value,
375
- }),
376
- pb: (value) => ({
364
+ }); }, pb: function (value) { return ({
377
365
  paddingBottom: value,
378
- }),
379
- pl: (value) => ({
366
+ }); }, pl: function (value) { return ({
380
367
  paddingLeft: value,
381
- }),
382
- px: (value) => ({
368
+ }); }, px: function (value) { return ({
383
369
  paddingLeft: value,
384
370
  paddingRight: value,
385
- }),
386
- py: (value) => ({
371
+ }); }, py: function (value) { return ({
387
372
  paddingTop: value,
388
373
  paddingBottom: value,
389
- }),
390
- cols: (value) => ({
391
- gridColumn: `auto / span ${value}`,
374
+ }); }, cols: function (value) { return ({
375
+ gridColumn: "auto / span ".concat(value),
392
376
  "--grid-columns": value,
393
- }),
394
- },
377
+ }); } }),
395
378
  });
396
379
  // Typography globals
397
- const typeGlobals = {};
398
- Object.entries(globalTypography).forEach(([key, styles]) => {
380
+ var typeGlobals = {};
381
+ Object.entries(globalTypography).forEach(function (_a) {
382
+ var key = _a[0], styles = _a[1];
399
383
  if (key === "@initial") {
400
384
  typeGlobals[":root"] = styles;
401
385
  }
@@ -408,8 +392,9 @@ function createStitches(config) {
408
392
  });
409
393
  stitches.globalCss(typeGlobals)();
410
394
  // Grid globals
411
- const gridGlobals = {};
412
- Object.entries(globalGrid).forEach(([key, styles]) => {
395
+ var gridGlobals = {};
396
+ Object.entries(globalGrid).forEach(function (_a) {
397
+ var key = _a[0], styles = _a[1];
413
398
  if (key === "@initial") {
414
399
  gridGlobals[":root"] = styles;
415
400
  }
@@ -421,8 +406,9 @@ function createStitches(config) {
421
406
  }
422
407
  });
423
408
  stitches.globalCss(gridGlobals)();
424
- const responsiveGlobals = {};
425
- Object.entries(globalResponsive).forEach(([key, styles]) => {
409
+ var responsiveGlobals = {};
410
+ Object.entries(globalResponsive).forEach(function (_a) {
411
+ var key = _a[0], styles = _a[1];
426
412
  if (key === "@initial") {
427
413
  responsiveGlobals[":root"] = styles;
428
414
  }
@@ -434,15 +420,7 @@ function createStitches(config) {
434
420
  }
435
421
  });
436
422
  stitches.globalCss(responsiveGlobals)();
437
- const responsiveTokens = {};
438
- return {
439
- ...stitches,
440
- originalConfig: config,
441
- breakpoints,
442
- typeVariants,
443
- gridVariants,
444
- responsiveTokens,
445
- responsiveGlobals,
446
- };
423
+ var responsiveTokens = {};
424
+ return __assign(__assign({}, stitches), { originalConfig: config, breakpoints: breakpoints, typeVariants: typeVariants, gridVariants: gridVariants, responsiveTokens: responsiveTokens, responsiveGlobals: responsiveGlobals });
447
425
  }
448
426
  exports.createStitches = createStitches;
package/style/index.js CHANGED
@@ -1,11 +1,7 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
9
5
  }) : (function(o, m, k, k2) {
10
6
  if (k2 === undefined) k2 = k;
11
7
  o[k2] = m[k];
package/tsconfig.json CHANGED
@@ -11,7 +11,7 @@
11
11
  // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
12
12
 
13
13
  /* Language and Environment */
14
- "target": "ES2020" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
14
+ "target": "es5" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
15
15
  // "types": ["./src/types.d.ts"],
16
16
  "lib": [
17
17
  "DOM",
@@ -1,5 +1,5 @@
1
- type Observer<T> = (value: T) => void;
2
- type Disposer = () => void;
1
+ declare type Observer<T> = (value: T) => void;
2
+ declare type Disposer = () => void;
3
3
  export declare class Observable<T> {
4
4
  value: T;
5
5
  private _observers;
@@ -1,23 +1,25 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Observable = void 0;
4
- class Observable {
5
- constructor(value) {
4
+ var Observable = /** @class */ (function () {
5
+ function Observable(value) {
6
6
  this._observers = [];
7
7
  this.value = value;
8
8
  }
9
- subscribe(observer) {
9
+ Observable.prototype.subscribe = function (observer) {
10
+ var _this = this;
10
11
  this._observers.push(observer);
11
12
  observer(this.value);
12
- return () => this.unsubscribe(observer);
13
- }
14
- unsubscribe(observer) {
15
- const index = this._observers.indexOf(observer);
13
+ return function () { return _this.unsubscribe(observer); };
14
+ };
15
+ Observable.prototype.unsubscribe = function (observer) {
16
+ var index = this._observers.indexOf(observer);
16
17
  if (index > -1) {
17
18
  this._observers.splice(index, 1);
18
19
  }
19
- }
20
- update(data) {
20
+ };
21
+ Observable.prototype.update = function (data) {
22
+ var _this = this;
21
23
  if (typeof data === "function") {
22
24
  // @ts-ignore
23
25
  this.value = data(this.value);
@@ -25,7 +27,8 @@ class Observable {
25
27
  else {
26
28
  this.value = data;
27
29
  }
28
- this._observers.forEach((observer) => observer(this.value));
29
- }
30
- }
30
+ this._observers.forEach(function (observer) { return observer(_this.value); });
31
+ };
32
+ return Observable;
33
+ }());
31
34
  exports.Observable = Observable;
@@ -4,8 +4,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getRepoName = void 0;
7
- const git_repo_name_1 = __importDefault(require("git-repo-name"));
8
- const path_1 = __importDefault(require("path"));
7
+ var git_repo_name_1 = __importDefault(require("git-repo-name"));
8
+ var path_1 = __importDefault(require("path"));
9
9
  function getRepoName(dir) {
10
10
  if (process.env.VERCEL) {
11
11
  return {
@@ -14,7 +14,7 @@ function getRepoName(dir) {
14
14
  };
15
15
  }
16
16
  else {
17
- let info = "";
17
+ var info = "";
18
18
  try {
19
19
  info = git_repo_name_1.default.sync(dir);
20
20
  }