eddev 0.2.65 → 0.2.67-beta1

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