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.
- package/admin/components/ImageWell.d.ts +2 -2
- package/admin/components/ImageWell.js +51 -39
- package/admin/defineField.d.ts +2 -2
- package/admin/defineWidget.d.ts +1 -1
- package/admin/defineWidget.js +2 -2
- package/admin/index.js +1 -5
- package/admin/installFieldTypes.js +26 -26
- package/admin/runWidgets.js +28 -17
- package/admin/selectMedia.d.ts +2 -2
- package/admin/selectMedia.js +1 -1
- package/blocks/ContentBlocks.d.ts +6 -6
- package/blocks/ContentBlocks.js +66 -58
- package/blocks/ErrorBoundaryEditor.d.ts +1 -1
- package/blocks/ErrorBoundaryEditor.js +45 -16
- package/blocks/ErrorBoundaryFrontend.d.ts +1 -1
- package/blocks/ErrorBoundaryFrontend.js +45 -16
- package/blocks/InspectorControls.d.ts +1 -1
- package/blocks/InspectorControls.js +3 -3
- package/blocks/blockAttributes.d.ts +2 -2
- package/blocks/blockAttributes.js +44 -24
- package/blocks/index.js +1 -5
- package/blocks/inlineEditing.d.ts +6 -6
- package/blocks/inlineEditing.js +55 -36
- package/blocks/installGutenbergHooks.js +68 -48
- package/build/babel/plugin-name-defined-components.js +16 -15
- package/build/build-favicon.js +62 -11
- package/build/clean.js +52 -5
- package/build/create-codegen-worker.js +33 -78
- package/build/create-serverless-dev-worker.js +39 -61
- package/build/create-webpack-worker.js +33 -65
- package/build/file-tree.d.ts +2 -2
- package/build/file-tree.js +12 -12
- package/build/get-webpack-config.js +395 -341
- package/build/graphql-codegen/graphql-codegen-files.js +25 -31
- package/build/graphql-codegen/graphql-codegen-no-duplicates.js +4 -4
- package/build/graphql-codegen/graphql-codegen-queries.js +99 -102
- package/build/manifests/manifest-blocks.d.ts +1 -1
- package/build/manifests/manifest-blocks.js +29 -37
- package/build/manifests/manifest-fields.d.ts +1 -1
- package/build/manifests/manifest-fields.js +21 -23
- package/build/manifests/manifest-views.d.ts +1 -1
- package/build/manifests/manifest-views.js +25 -32
- package/build/manifests/manifest-widgets.d.ts +1 -1
- package/build/manifests/manifest-widgets.js +20 -22
- package/build/manifests/manifest.d.ts +2 -2
- package/build/manifests/manifest.js +94 -30
- package/build/reporter.d.ts +1 -1
- package/build/reporter.js +32 -29
- package/build/serverless/create-next-app.d.ts +1 -1
- package/build/serverless/create-next-app.js +467 -245
- package/build/state/codegen-state.d.ts +4 -4
- package/build/state/compiler-state.d.ts +5 -5
- package/build/state/serverless-state.d.ts +3 -3
- package/build/workers/codegen-worker-script.js +519 -393
- package/build/workers/serverless-worker-dev-script.js +4 -4
- package/build/workers/webpack-worker-script.js +156 -90
- package/cli/build.dev.d.ts +1 -1
- package/cli/build.dev.js +126 -79
- package/cli/build.prod.d.ts +1 -1
- package/cli/build.prod.js +98 -42
- package/cli/cli.js +28 -19
- package/cli/display/components/BundleDisplay.d.ts +1 -1
- package/cli/display/components/BundleDisplay.js +24 -13
- package/cli/display/components/CodegenDisplay.d.ts +1 -1
- package/cli/display/components/CodegenDisplay.js +25 -14
- package/cli/display/components/DevCLIDisplay.d.ts +2 -2
- package/cli/display/components/DevCLIDisplay.js +25 -14
- package/cli/display/components/Fullscreen.js +20 -9
- package/cli/display/components/ServerlessDisplay.d.ts +2 -2
- package/cli/display/components/ServerlessDisplay.js +26 -15
- package/cli/display/components/StatusIcon.d.ts +2 -2
- package/cli/display/components/StatusIcon.js +3 -3
- package/cli/preinstall.js +5 -4
- package/cli/setup.js +73 -25
- package/components/AdminBar.d.ts +1 -1
- package/components/AdminBar.js +3 -37
- package/components/BrowserRouter.d.ts +2 -2
- package/components/BrowserRouter.js +54 -41
- package/components/InlinePage.d.ts +2 -2
- package/components/InlinePage.js +29 -17
- package/components/NextRouter.d.ts +2 -2
- package/components/NextRouter.js +29 -20
- package/components/index.js +1 -5
- package/config/config-schema.d.ts +1 -1
- package/config/config-schema.js +1 -1
- package/config/create-schema-file.js +6 -6
- package/config/get-config.js +13 -10
- package/config/index.js +1 -5
- package/config/parse-config.js +1 -1
- package/config/print-zod-errors.js +3 -3
- package/dev-ui/components/BreakpointColumnHeader.d.ts +2 -2
- package/dev-ui/components/BreakpointColumnHeader.js +18 -7
- package/dev-ui/components/BreakpointIndicator.d.ts +1 -1
- package/dev-ui/components/BreakpointIndicator.js +32 -25
- package/dev-ui/components/DevUI.d.ts +1 -1
- package/dev-ui/components/DevUI.js +13 -13
- package/dev-ui/components/Launcher.d.ts +2 -2
- package/dev-ui/components/Launcher.js +25 -13
- package/dev-ui/components/PanelWrapper.d.ts +2 -2
- package/dev-ui/components/PanelWrapper.js +8 -8
- package/dev-ui/components/ResponsiveLerpControl.d.ts +2 -2
- package/dev-ui/components/ResponsiveLerpControl.js +38 -27
- package/dev-ui/components/ResponsiveScaleEditor.d.ts +4 -4
- package/dev-ui/components/ResponsiveScaleEditor.js +78 -64
- package/dev-ui/components/atoms/Button.js +1 -1
- package/dev-ui/components/atoms/Dropdown.d.ts +3 -3
- package/dev-ui/components/atoms/Dropdown.js +9 -8
- package/dev-ui/components/atoms/NumberField.d.ts +2 -2
- package/dev-ui/components/atoms/NumberField.js +42 -29
- package/dev-ui/components/atoms/Spacer.js +1 -1
- package/dev-ui/components/atoms/Text.js +1 -1
- package/dev-ui/components/atoms/ToggleButton.d.ts +2 -2
- package/dev-ui/components/atoms/ToggleButton.js +16 -5
- package/dev-ui/components/atoms/Tooltip.d.ts +2 -2
- package/dev-ui/components/atoms/Tooltip.js +20 -8
- package/dev-ui/components/panels/AppDataDebugger.d.ts +1 -1
- package/dev-ui/components/panels/AppDataDebugger.js +19 -8
- package/dev-ui/components/panels/ColorEditor.d.ts +1 -1
- package/dev-ui/components/panels/ColorEditor.js +42 -35
- package/dev-ui/components/panels/PageDataDebugger.d.ts +1 -1
- package/dev-ui/components/panels/PageDataDebugger.js +20 -8
- package/dev-ui/components/panels/QueryDebugger.d.ts +1 -1
- package/dev-ui/components/panels/QueryDebugger.js +24 -12
- package/dev-ui/components/panels/SpacingEditor.d.ts +1 -1
- package/dev-ui/components/panels/SpacingEditor.js +48 -34
- package/dev-ui/components/panels/TypographyEditor.d.ts +1 -1
- package/dev-ui/components/panels/TypographyEditor.js +46 -38
- package/dev-ui/hooks/useBreakpoint.d.ts +1 -1
- package/dev-ui/hooks/useBreakpoint.js +13 -13
- package/dev-ui/hooks/usePersistState.js +7 -6
- package/dev-ui/hooks/useStylesheet.js +6 -6
- package/dev-ui/icons.d.ts +15 -15
- package/dev-ui/icons.js +27 -16
- package/dev-ui/index.js +1 -5
- package/dev-ui/loader.d.ts +1 -1
- package/dev-ui/loader.js +9 -13
- package/dev-ui/panels.d.ts +2 -2
- package/dev-ui/panels.js +7 -7
- package/dev-ui/theme.js +3 -3
- package/dynamic/dynamic-component.js +1 -1
- package/dynamic/index.js +1 -5
- package/entry/Root.d.ts +2 -2
- package/entry/Root.js +26 -16
- package/entry/entry.admin.dev.js +4 -4
- package/entry/entry.admin.prod.js +4 -4
- package/entry/entry.monolith.dev.js +5 -5
- package/entry/entry.monolith.prod.js +5 -5
- package/gravityforms/gravity-forms.d.ts +2 -2
- package/gravityforms/index.js +1 -5
- package/gravityforms/useGravityForm.d.ts +2 -2
- package/gravityforms/useGravityForm.js +130 -126
- package/hooks/index.js +1 -5
- package/hooks/queryUtils.d.ts +14 -14
- package/hooks/queryUtils.js +192 -101
- package/hooks/useAppData.d.ts +2 -2
- package/hooks/useAppData.js +9 -9
- package/hooks/usePageLoad.js +4 -4
- package/hooks/useQueryDebug.d.ts +1 -1
- package/hooks/useQueryDebug.js +7 -7
- package/hooks/useRPC.d.ts +4 -4
- package/hooks/useRPC.js +3 -3
- package/package.json +11 -11
- package/routing/index.js +1 -5
- package/routing/remoteProps.d.ts +1 -1
- package/routing/remoteProps.js +72 -31
- package/routing/routing.d.ts +25 -15
- package/routing/routing.js +200 -112
- package/routing/updateEditLink.js +1 -1
- package/serverless/define-api.d.ts +1 -1
- package/serverless/define-rpc-router.js +4 -8
- package/serverless/index.js +2 -6
- package/style/createStitches.js +142 -164
- package/style/index.js +1 -5
- package/tsconfig.json +1 -1
- package/utils/Observable.d.ts +2 -2
- package/utils/Observable.js +15 -12
- package/utils/getRepoName.js +3 -3
- package/utils/promptIfRepoNameIncorrect.js +64 -18
- package/utils/refreshOverlayInterop.js +1 -1
- package/utils/reportErrorStack.d.ts +1 -1
- package/utils/reportErrorStack.js +1 -1
- package/utils/serverlessAppContext.js +1 -1
- package/utils/updateEnvFile.js +69 -19
- package/utils/useObservable.js +3 -3
- package/views/index.js +1 -5
package/style/createStitches.js
CHANGED
|
@@ -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
|
-
|
|
5
|
-
|
|
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
|
-
|
|
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 (
|
|
28
|
+
for (var key in medias) {
|
|
18
29
|
if (!names.includes(key))
|
|
19
30
|
continue;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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 (
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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
|
-
|
|
57
|
+
var unitless = function (value) { return parseFloat(value); };
|
|
47
58
|
function parseTypography(theme, breakpoints, typography) {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
breakpoints.forEach((bp)
|
|
59
|
+
var globals = {};
|
|
60
|
+
var typeVariants = {};
|
|
61
|
+
breakpoints.forEach(function (bp) { return (globals["@" + bp.key] = {}); });
|
|
51
62
|
globals["@editor"] = {};
|
|
52
|
-
|
|
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
|
-
|
|
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 (
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
typeVariants[
|
|
74
|
-
for (
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
variant[key] =
|
|
78
|
-
|
|
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
|
-
|
|
86
|
-
|
|
87
|
-
for (
|
|
88
|
-
globals[
|
|
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
|
-
|
|
120
|
-
|
|
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 (
|
|
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":
|
|
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":
|
|
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
|
-
|
|
193
|
-
for (
|
|
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
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
for (
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
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
|
-
|
|
240
|
-
|
|
241
|
-
for (
|
|
242
|
-
|
|
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
|
-
|
|
256
|
+
result.forEach(function (item, i) {
|
|
257
|
+
var lerp = item.lerping;
|
|
255
258
|
if (lerp) {
|
|
256
|
-
|
|
257
|
-
|
|
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(
|
|
262
|
+
throw new Error("Cannot create responsive style for first breakpoint");
|
|
260
263
|
}
|
|
261
264
|
if (!toBP || toBP.min === null) {
|
|
262
|
-
throw new Error(
|
|
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)
|
|
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
|
|
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 = {
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
for (
|
|
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
|
-
|
|
281
|
-
globals["@" + atom.breakpoint] = {
|
|
282
|
-
[varName]
|
|
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]
|
|
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]
|
|
293
|
-
|
|
298
|
+
globals["@" + atom.breakpoint] = (_c = {},
|
|
299
|
+
_c[varName] = atom.value,
|
|
300
|
+
_c);
|
|
294
301
|
}
|
|
295
302
|
}
|
|
296
|
-
return [globals, globals["@initial"]
|
|
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
|
-
|
|
308
|
+
var globalResponsive = {
|
|
302
309
|
"@initial": {},
|
|
303
310
|
};
|
|
304
|
-
|
|
305
|
-
for (
|
|
306
|
-
|
|
311
|
+
var initialResponsive = {};
|
|
312
|
+
for (var scale in theme) {
|
|
313
|
+
var initials = {};
|
|
307
314
|
initialResponsive[scale] = initials;
|
|
308
|
-
for (
|
|
309
|
-
|
|
315
|
+
for (var key in theme[scale]) {
|
|
316
|
+
var val = theme[scale][key];
|
|
310
317
|
if (val && typeof val === "object") {
|
|
311
|
-
|
|
312
|
-
for (
|
|
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
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
398
|
-
Object.entries(globalTypography).forEach((
|
|
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
|
-
|
|
412
|
-
Object.entries(globalGrid).forEach((
|
|
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
|
-
|
|
425
|
-
Object.entries(globalResponsive).forEach((
|
|
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
|
-
|
|
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
|
-
|
|
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": "
|
|
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",
|
package/utils/Observable.d.ts
CHANGED
package/utils/Observable.js
CHANGED
|
@@ -1,23 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Observable = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
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 ()
|
|
13
|
-
}
|
|
14
|
-
unsubscribe(observer) {
|
|
15
|
-
|
|
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)
|
|
29
|
-
}
|
|
30
|
-
|
|
30
|
+
this._observers.forEach(function (observer) { return observer(_this.value); });
|
|
31
|
+
};
|
|
32
|
+
return Observable;
|
|
33
|
+
}());
|
|
31
34
|
exports.Observable = Observable;
|
package/utils/getRepoName.js
CHANGED
|
@@ -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
|
-
|
|
8
|
-
|
|
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
|
-
|
|
17
|
+
var info = "";
|
|
18
18
|
try {
|
|
19
19
|
info = git_repo_name_1.default.sync(dir);
|
|
20
20
|
}
|