Skip to content

Commit f804a86

Browse files
committed
Merge branch 'master' into fix-saving-code
2 parents f983813 + 2a88cf9 commit f804a86

File tree

111 files changed

+6047
-2250
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

111 files changed

+6047
-2250
lines changed

.all-contributorsrc

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1531,6 +1531,24 @@
15311531
"contributions": [
15321532
"code"
15331533
]
1534+
},
1535+
{
1536+
"login": "johansenja",
1537+
"name": "johansenja",
1538+
"avatar_url": "https://avatars1.githubusercontent.com/u/43235608?v=4",
1539+
"profile": "https://github.com/johansenja",
1540+
"contributions": [
1541+
"doc"
1542+
]
1543+
},
1544+
{
1545+
"login": "Developerayo",
1546+
"name": "Shodipo Ayomide",
1547+
"avatar_url": "https://avatars2.githubusercontent.com/u/20538832?v=4",
1548+
"profile": "https://shodipoayomide.com",
1549+
"contributions": [
1550+
"doc"
1551+
]
15341552
}
15351553
],
15361554
"contributorsPerLine": 7,

.circleci/config.yml

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -214,13 +214,13 @@ commands:
214214
JEST_JUNIT_OUTPUT: '/tmp/test-results/js-test-results.xml'
215215
- store_test_results: *store_test_results
216216
- store_artifacts: *store_artifacts
217-
# test_visual_regressions:
218-
# description: "Test Chromatic with 'yarn chromatic'"
219-
# steps:
220-
# - restore_cache: *restore_deps_cache
221-
# - attach_workspace: *attach_deps_workspace
222-
# - run:
223-
# command: yarn chromatic
217+
test_visual_regressions:
218+
description: "Test Chromatic with 'yarn chromatic'"
219+
steps:
220+
- restore_cache: *restore_deps_cache
221+
- attach_workspace: *attach_deps_workspace
222+
- run:
223+
command: yarn chromatic
224224
test_jest:
225225
description: 'Test with `yarn test`'
226226
steps:
@@ -298,11 +298,11 @@ jobs:
298298
steps:
299299
- checkout_with_cache
300300
- test_integrations
301-
# test-visual-regressions:
302-
# executor: node
303-
# steps:
304-
# - checkout_with_cache
305-
# - test_visual_regressions
301+
test-visual-regressions:
302+
executor: node
303+
steps:
304+
- checkout_with_cache
305+
- test_visual_regressions
306306
test-jest:
307307
executor: node
308308
steps:
@@ -363,9 +363,9 @@ workflows:
363363
- test-integrations:
364364
requires:
365365
- build-deps
366-
# - test-visual-regressions:
367-
# requires:
368-
# - build-deps
366+
- test-visual-regressions:
367+
requires:
368+
- build-deps
369369
- typecheck:
370370
requires:
371371
- build-deps
@@ -384,12 +384,11 @@ workflows:
384384
- deploy-to-production:
385385
requires:
386386
- create-docker-image
387-
- build-prod
388387
- lint
389388
- typecheck
390389
- test-integrations
391390
- test-jest
392-
# - test-visual-regressions
391+
- test-visual-regressions
393392
filters:
394393
branches:
395394
only:

.github/ISSUE_TEMPLATE/QUESTION.md

Lines changed: 0 additions & 18 deletions
This file was deleted.

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
blank_issues_enabled: false
2+
contact_links:
3+
- name: Question
4+
url: https://github.com/codesandbox/codesandbox-client/discussions
5+
about: Have any questions?

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
 
88

9-
[![Join the community on Spectrum](https://withspectrum.github.io/badge/badge.svg)](https://spectrum.chat/codesandbox)
109
[![All Contributors](https://img.shields.io/badge/all_contributors-153-orange.svg?style=flat-square)](#contributors-)
1110
[![CircleCI](https://circleci.com/gh/codesandbox/codesandbox-client.svg?style=svg)](https://circleci.com/gh/codesandbox/codesandbox-client)
1211
[![BrowserStack Status](https://www.browserstack.com/automate/badge.svg?badge_key=cVJuczlJWUtqWXhIbFN1ZjVQekF4NzNsd3phNEZRaGlWU0pHYVVkdGRFWT0tLXFtTVhaOWRySmN0ZG5QVDNDQ0g5Z0E9PQ==--79fe3eae4f149a400d396c9b12d3988f685785cf)](https://www.browserstack.com/automate/public-build/cVJuczlJWUtqWXhIbFN1ZjVQekF4NzNsd3phNEZRaGlWU0pHYVVkdGRFWT0tLXFtTVhaOWRySmN0ZG5QVDNDQ0g5Z0E9PQ==--79fe3eae4f149a400d396c9b12d3988f685785cf)
@@ -102,7 +101,7 @@ Thanks goes to these wonderful people
102101
<td align="center"><a href="https://github.com/ro-savage"><img src="https://avatars2.githubusercontent.com/u/9244507?v=4" width="100px;" alt=""/><br /><sub><b>Ro Savage</b></sub></a><br /><a href="https://github.com/codesandbox/codesandbox-client/commits?author=ro-savage" title="Code">💻</a></td>
103102
<td align="center"><a href="https://samdd.me"><img src="https://avatars3.githubusercontent.com/u/13242392?v=4" width="100px;" alt=""/><br /><sub><b>Sam Denty</b></sub></a><br /><a href="https://github.com/codesandbox/codesandbox-client/commits?author=samdenty" title="Code">💻</a></td>
104103
<td align="center"><a href="https://github.com/zephraph"><img src="https://avatars1.githubusercontent.com/u/3087225?v=4" width="100px;" alt=""/><br /><sub><b>Zephraph</b></sub></a><br /><a href="https://github.com/codesandbox/codesandbox-client/commits?author=zephraph" title="Code">💻</a></td>
105-
<td align="center"><a href="https://www.joshwaller.me"><img src="https://avatars1.githubusercontent.com/u/1900735?v=4" width="100px;" alt=""/><br /><sub><b>Josh Waller</b></sub></a><br /><a href="https://github.com/codesandbox/codesandbox-client/issues?q=author%3Amdxprograms" title="Bug reports">🐛</a> <a href="https://github.com/codesandbox/codesandbox-client/commits?author=mdxprograms" title="Code">💻</a> <a href="https://github.com/codesandbox/codesandbox-client/commits?author=mdxprograms" title="Documentation">📖</a></td>
104+
<td align="center"><a href="https://joshwaller.dev"><img src="https://avatars1.githubusercontent.com/u/1900735?v=4" width="100px;" alt=""/><br /><sub><b>Josh Waller</b></sub></a><br /><a href="https://github.com/codesandbox/codesandbox-client/issues?q=author%3Amdxprograms" title="Bug reports">🐛</a> <a href="https://github.com/codesandbox/codesandbox-client/commits?author=mdxprograms" title="Code">💻</a> <a href="https://github.com/codesandbox/codesandbox-client/commits?author=mdxprograms" title="Documentation">📖</a></td>
106105
</tr>
107106
<tr>
108107
<td align="center"><a href="http://joey.co.ke"><img src="https://avatars0.githubusercontent.com/u/1195863?v=4" width="100px;" alt=""/><br /><sub><b>Joe Ng'ethe</b></sub></a><br /><a href="https://github.com/codesandbox/codesandbox-client/commits?author=joeynimu" title="Code">💻</a></td>
@@ -251,6 +250,8 @@ Thanks goes to these wonderful people
251250
<tr>
252251
<td align="center"><a href="http://mcmunder.de"><img src="https://avatars3.githubusercontent.com/u/5681686?v=4" width="100px;" alt=""/><br /><sub><b>Matthias Christoph Munder</b></sub></a><br /><a href="https://github.com/codesandbox/codesandbox-client/issues?q=author%3Amcmunder" title="Bug reports">🐛</a> <a href="https://github.com/codesandbox/codesandbox-client/commits?author=mcmunder" title="Code">💻</a></td>
253252
<td align="center"><a href="http://anuraghazra.github.io"><img src="https://avatars3.githubusercontent.com/u/35374649?v=4" width="100px;" alt=""/><br /><sub><b>Anurag Hazra</b></sub></a><br /><a href="https://github.com/codesandbox/codesandbox-client/commits?author=anuraghazra" title="Code">💻</a></td>
253+
<td align="center"><a href="https://github.com/johansenja"><img src="https://avatars1.githubusercontent.com/u/43235608?v=4" width="100px;" alt=""/><br /><sub><b>johansenja</b></sub></a><br /><a href="https://github.com/codesandbox/codesandbox-client/commits?author=johansenja" title="Documentation">📖</a></td>
254+
<td align="center"><a href="https://shodipoayomide.com"><img src="https://avatars2.githubusercontent.com/u/20538832?v=4" width="100px;" alt=""/><br /><sub><b>Shodipo Ayomide</b></sub></a><br /><a href="https://github.com/codesandbox/codesandbox-client/commits?author=Developerayo" title="Documentation">📖</a></td>
254255
</tr>
255256
</table>
256257

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"license": "GPL-3.0",
1010
"workspaces": {
1111
"packages": [
12+
"packages/@styled-system/css",
1213
"packages/@types/ot",
1314
"packages/app",
1415
"packages/homepage",
Lines changed: 229 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,229 @@
1+
/* eslint-disable */
2+
3+
// based on https://github.com/developit/dlv
4+
export var get = function get(obj, key, def, p, undef) {
5+
key = key && key.split ? key.split('.') : [key];
6+
7+
for (p = 0; p < key.length; p++) {
8+
obj = obj ? obj[key[p]] : undef;
9+
}
10+
11+
return obj === undef ? def : obj;
12+
};
13+
const defaultBreakpoints = [40, 52, 64].map(function(n) {
14+
return n + 'em';
15+
});
16+
const aliases = {
17+
bg: 'backgroundColor',
18+
m: 'margin',
19+
mt: 'marginTop',
20+
mr: 'marginRight',
21+
mb: 'marginBottom',
22+
ml: 'marginLeft',
23+
mx: 'marginX',
24+
my: 'marginY',
25+
p: 'padding',
26+
pt: 'paddingTop',
27+
pr: 'paddingRight',
28+
pb: 'paddingBottom',
29+
pl: 'paddingLeft',
30+
px: 'paddingX',
31+
py: 'paddingY',
32+
};
33+
const multiples = {
34+
marginX: ['marginLeft', 'marginRight'],
35+
marginY: ['marginTop', 'marginBottom'],
36+
paddingX: ['paddingLeft', 'paddingRight'],
37+
paddingY: ['paddingTop', 'paddingBottom'],
38+
size: ['width', 'height'],
39+
};
40+
const scales = {
41+
color: 'colors',
42+
backgroundColor: 'colors',
43+
borderColor: 'colors',
44+
margin: 'space',
45+
marginTop: 'space',
46+
marginRight: 'space',
47+
marginBottom: 'space',
48+
marginLeft: 'space',
49+
marginX: 'space',
50+
marginY: 'space',
51+
padding: 'space',
52+
paddingTop: 'space',
53+
paddingRight: 'space',
54+
paddingBottom: 'space',
55+
paddingLeft: 'space',
56+
paddingX: 'space',
57+
paddingY: 'space',
58+
top: 'space',
59+
right: 'space',
60+
bottom: 'space',
61+
left: 'space',
62+
gridGap: 'space',
63+
gridColumnGap: 'space',
64+
gridRowGap: 'space',
65+
gap: 'space',
66+
columnGap: 'space',
67+
rowGap: 'space',
68+
fontFamily: 'fonts',
69+
fontSize: 'fontSizes',
70+
fontWeight: 'fontWeights',
71+
lineHeight: 'lineHeights',
72+
letterSpacing: 'letterSpacings',
73+
border: 'borders',
74+
borderTop: 'borders',
75+
borderRight: 'borders',
76+
borderBottom: 'borders',
77+
borderLeft: 'borders',
78+
borderWidth: 'borderWidths',
79+
borderStyle: 'borderStyles',
80+
borderRadius: 'radii',
81+
borderTopRightRadius: 'radii',
82+
borderTopLeftRadius: 'radii',
83+
borderBottomRightRadius: 'radii',
84+
borderBottomLeftRadius: 'radii',
85+
borderTopWidth: 'borderWidths',
86+
borderTopColor: 'colors',
87+
borderTopStyle: 'borderStyles',
88+
borderBottomWidth: 'borderWidths',
89+
borderBottomColor: 'colors',
90+
borderBottomStyle: 'borderStyles',
91+
borderLeftWidth: 'borderWidths',
92+
borderLeftColor: 'colors',
93+
borderLeftStyle: 'borderStyles',
94+
borderRightWidth: 'borderWidths',
95+
borderRightColor: 'colors',
96+
borderRightStyle: 'borderStyles',
97+
outlineColor: 'colors',
98+
boxShadow: 'shadows',
99+
textShadow: 'shadows',
100+
zIndex: 'zIndices',
101+
width: 'sizes',
102+
minWidth: 'sizes',
103+
maxWidth: 'sizes',
104+
height: 'sizes',
105+
minHeight: 'sizes',
106+
maxHeight: 'sizes',
107+
flexBasis: 'sizes',
108+
size: 'sizes',
109+
// svg
110+
fill: 'colors',
111+
stroke: 'colors',
112+
};
113+
114+
const positiveOrNegative = function positiveOrNegative(scale, value) {
115+
if (typeof value !== 'number' || value >= 0) {
116+
return get(scale, value, value);
117+
}
118+
119+
const absolute = Math.abs(value);
120+
const n = get(scale, absolute, absolute);
121+
if (typeof n === 'string') return '-' + n;
122+
return n * -1;
123+
};
124+
125+
const transforms = [
126+
'margin',
127+
'marginTop',
128+
'marginRight',
129+
'marginBottom',
130+
'marginLeft',
131+
'marginX',
132+
'marginY',
133+
'top',
134+
'bottom',
135+
'left',
136+
'right',
137+
].reduce(function(acc, curr) {
138+
let _extends2;
139+
140+
return {
141+
...acc,
142+
...((_extends2 = {}), (_extends2[curr] = positiveOrNegative), _extends2),
143+
};
144+
}, {});
145+
export var responsive = function responsive(styles) {
146+
return function(theme) {
147+
const next = {};
148+
const breakpoints = get(theme, 'breakpoints', defaultBreakpoints);
149+
const mediaQueries = [null].concat(
150+
breakpoints.map(function(n) {
151+
return '@media screen and (min-width: ' + n + ')';
152+
})
153+
);
154+
155+
for (const key in styles) {
156+
const value =
157+
typeof styles[key] === 'function' ? styles[key](theme) : styles[key];
158+
if (value == null) continue;
159+
160+
if (!Array.isArray(value)) {
161+
next[key] = value;
162+
continue;
163+
}
164+
165+
for (let i = 0; i < value.slice(0, mediaQueries.length).length; i++) {
166+
const media = mediaQueries[i];
167+
168+
if (!media) {
169+
next[key] = value[i];
170+
continue;
171+
}
172+
173+
next[media] = next[media] || {};
174+
if (value[i] == null) continue;
175+
next[media][key] = value[i];
176+
}
177+
}
178+
179+
return next;
180+
};
181+
};
182+
export var css = function css(args) {
183+
return function(props) {
184+
if (props === void 0) {
185+
props = {};
186+
}
187+
188+
const theme = props.theme || props;
189+
190+
let result = {};
191+
const obj = typeof args === 'function' ? args(theme) : args;
192+
const styles = responsive(obj)(theme);
193+
194+
for (const key in styles) {
195+
const x = styles[key];
196+
const val = typeof x === 'function' ? x(theme) : x;
197+
198+
if (key === 'variant') {
199+
const variant = css(get(theme, val))(theme);
200+
result = { ...result, ...variant };
201+
continue;
202+
}
203+
204+
if (val && typeof val === 'object') {
205+
result[key] = css(val)(theme);
206+
continue;
207+
}
208+
209+
const prop = get(aliases, key, key);
210+
const scaleName = get(scales, prop);
211+
const scale = get(theme, scaleName, get(theme, prop, {}));
212+
const transform = get(transforms, prop, get);
213+
const value = transform(scale, val, val);
214+
215+
if (multiples[prop]) {
216+
const dirs = multiples[prop];
217+
218+
for (let i = 0; i < dirs.length; i++) {
219+
result[dirs[i]] = value;
220+
}
221+
} else {
222+
result[prop] = value;
223+
}
224+
}
225+
226+
return result;
227+
};
228+
};
229+
export default css;

0 commit comments

Comments
 (0)