diff --git a/.all-contributorsrc b/.all-contributorsrc new file mode 100644 index 000000000..0f89eb361 --- /dev/null +++ b/.all-contributorsrc @@ -0,0 +1,1049 @@ +{ + "projectName": "theme-ui", + "projectOwner": "system-ui", + "repoType": "github", + "repoHost": "https://github.com", + "files": [ + "packages/theme-ui/README.md" + ], + "imageSize": 63, + "contributorsPerLine": 8, + "commit": true, + "commitConvention": "angular", + "contributors": [ + { + "login": "jxnblk", + "name": "Brent Jackson", + "avatar_url": "https://avatars.githubusercontent.com/u/3451712?v=4", + "profile": "https://jxnblk.com/", + "contributions": [ + "ideas", + "code", + "design", + "doc", + "example", + "test", + "review" + ] + }, + { + "login": "hasparus", + "name": "Piotr Monwid-Olechnowicz", + "avatar_url": "https://avatars.githubusercontent.com/u/15332326?v=4", + "profile": "https://haspar.us/", + "contributions": [ + "code", + "doc", + "test", + "review" + ] + }, + { + "login": "dcastil", + "name": "Dany Castillo", + "avatar_url": "https://avatars.githubusercontent.com/u/31006608?v=4", + "profile": "https://github.com/dcastil", + "contributions": [ + "code", + "doc", + "example", + "test" + ] + }, + { + "login": "jordanoverbye", + "name": "Jordan Overbye", + "avatar_url": "https://avatars.githubusercontent.com/u/6265154?v=4", + "profile": "https://jordanoverbye.com/", + "contributions": [ + "code", + "example", + "test" + ] + }, + { + "login": "lachlanjc", + "name": "Lachlan Campbell", + "avatar_url": "https://avatars.githubusercontent.com/u/5074763?v=4", + "profile": "https://lachlanjc.com/", + "contributions": [ + "code", + "example", + "test", + "review", + "doc", + "question" + ] + }, + { + "login": "johno", + "name": "John Otander", + "avatar_url": "https://avatars.githubusercontent.com/u/1424573?v=4", + "profile": "https://johno.com/", + "contributions": [ + "code", + "review", + "doc", + "test", + "ideas" + ] + }, + { + "login": "dburles", + "name": "David Burles", + "avatar_url": "https://avatars.githubusercontent.com/u/319567?v=4", + "profile": "http://twitter.com/dburles", + "contributions": [ + "code", + "review", + "test", + "doc" + ] + }, + { + "login": "mxstbr", + "name": "Max Stoiber", + "avatar_url": "https://avatars.githubusercontent.com/u/7525670?v=4", + "profile": "https://mxstbr.com/", + "contributions": [ + "code", + "review", + "test", + "example" + ] + }, + { + "login": "atanasster", + "name": "Atanas Stoyanov", + "avatar_url": "https://avatars.githubusercontent.com/u/6075606?v=4", + "profile": "https://github.com/atanasster", + "contributions": [ + "code", + "question", + "test", + "bug" + ] + }, + { + "login": "LekoArts", + "name": "Lennart", + "avatar_url": "https://avatars.githubusercontent.com/u/16143594?v=4", + "profile": "https://www.lekoarts.de/", + "contributions": [ + "code", + "bug", + "doc" + ] + }, + { + "login": "beerose", + "name": "Aleksandra Sikora", + "avatar_url": "https://avatars.githubusercontent.com/u/9019397?v=4", + "profile": "https://github.com/beerose", + "contributions": [ + "code" + ] + }, + { + "login": "laurieontech", + "name": "LB", + "avatar_url": "https://avatars.githubusercontent.com/u/15000607?v=4", + "profile": "https://github.com/laurieontech", + "contributions": [ + "code", + "test" + ] + }, + { + "login": "fcisio", + "name": "Francis Champagne", + "avatar_url": "https://avatars.githubusercontent.com/u/46095852?v=4", + "profile": "https://github.com/fcisio", + "contributions": [ + "code", + "bug", + "test" + ] + }, + { + "login": "alex-page", + "name": "Alex Page", + "avatar_url": "https://avatars.githubusercontent.com/u/19199063?v=4", + "profile": "https://alexpage.com.au/", + "contributions": [ + "code", + "doc" + ] + }, + { + "login": "hoobdeebla", + "name": "Adam Schay", + "avatar_url": "https://avatars.githubusercontent.com/u/3589140?v=4", + "profile": "https://github.com/hoobdeebla", + "contributions": [ + "code" + ] + }, + { + "login": "alexpermiakov", + "name": "Alex", + "avatar_url": "https://avatars.githubusercontent.com/u/1989750?v=4", + "profile": "https://github.com/alexpermiakov", + "contributions": [ + "code", + "doc" + ] + }, + { + "login": "deckchairlabs", + "name": "James Edmonds", + "avatar_url": "https://avatars.githubusercontent.com/u/7539725?v=4", + "profile": "https://deckchairlabs.com/", + "contributions": [ + "code", + "doc" + ] + }, + { + "login": "flo-sch", + "name": "Florent SCHILDKNECHT", + "avatar_url": "https://avatars.githubusercontent.com/u/1577155?v=4", + "profile": "https://floschild.me/", + "contributions": [ + "code", + "doc" + ] + }, + { + "login": "colebemis", + "name": "Cole Bemis", + "avatar_url": "https://avatars.githubusercontent.com/u/4608155?v=4", + "profile": "https://github.com/colebemis", + "contributions": [ + "code", + "test", + "doc" + ] + }, + { + "login": "jletey", + "name": "John Letey", + "avatar_url": "https://avatars.githubusercontent.com/u/30328854?v=4", + "profile": "https://github.com/jletey", + "contributions": [ + "doc" + ] + }, + { + "login": "yurm04", + "name": "Yuraima Estevez", + "avatar_url": "https://avatars.githubusercontent.com/u/4642404?v=4", + "profile": "https://github.com/yurm04", + "contributions": [ + "code" + ] + }, + { + "login": "allanpope", + "name": "Allan Pope", + "avatar_url": "https://avatars.githubusercontent.com/u/2561365?v=4", + "profile": "http://codepen.io/allanpope/", + "contributions": [ + "code", + "doc" + ] + }, + { + "login": "epilande", + "name": "Emmanuel Pilande", + "avatar_url": "https://avatars.githubusercontent.com/u/3210082?v=4", + "profile": "https://github.com/epilande", + "contributions": [ + "code" + ] + }, + { + "login": "wKovacs64", + "name": "Justin Hall", + "avatar_url": "https://avatars.githubusercontent.com/u/1288694?v=4", + "profile": "https://github.com/wKovacs64", + "contributions": [ + "code" + ] + }, + { + "login": "marekzelinka", + "name": "Marek", + "avatar_url": "https://avatars.githubusercontent.com/u/21342072?v=4", + "profile": "https://github.com/marekzelinka", + "contributions": [ + "code", + "bug" + ] + }, + { + "login": "Pyrax", + "name": "Björn Clees", + "avatar_url": "https://avatars.githubusercontent.com/u/4885581?v=4", + "profile": "https://linkedin.com/in/bjoern-clees/en", + "contributions": [ + "doc", + "code" + ] + }, + { + "login": "yuyokk", + "name": "Iurii Kucherov", + "avatar_url": "https://avatars.githubusercontent.com/u/1225343?v=4", + "profile": "https://github.com/yuyokk", + "contributions": [ + "doc" + ] + }, + { + "login": "joestrouth1", + "name": "Joe Strouth", + "avatar_url": "https://avatars.githubusercontent.com/u/644238?v=4", + "profile": "https://github.com/joestrouth1", + "contributions": [ + "code", + "bug" + ] + }, + { + "login": "sjmeverett", + "name": "Stewart Everett", + "avatar_url": "https://avatars.githubusercontent.com/u/1624432?v=4", + "profile": "http://sjmeverett.uk/", + "contributions": [ + "code" + ] + }, + { + "login": "souporserious", + "name": "Travis Arnold", + "avatar_url": "https://avatars.githubusercontent.com/u/2762082?v=4", + "profile": "https://github.com/souporserious", + "contributions": [ + "code", + "doc" + ] + }, + { + "login": "ivoreis", + "name": "Ivo Reis", + "avatar_url": "https://avatars.githubusercontent.com/u/1410207?v=4", + "profile": "https://github.com/ivoreis", + "contributions": [ + "code" + ] + }, + { + "login": "axe312ger", + "name": "Benedikt Rötsch", + "avatar_url": "https://avatars.githubusercontent.com/u/1737026?v=4", + "profile": "https://github.com/axe312ger", + "contributions": [ + "bug", + "doc" + ] + }, + { + "login": "JCofman", + "name": "Jacob Cofman", + "avatar_url": "https://avatars.githubusercontent.com/u/2118956?v=4", + "profile": "https://jcofman.de/", + "contributions": [ + "doc" + ] + }, + { + "login": "johnletey", + "name": "John Letey", + "avatar_url": "https://avatars.githubusercontent.com/u/62398724?v=4", + "profile": "https://github.com/johnletey", + "contributions": [ + "doc" + ] + }, + { + "login": "gosseti", + "name": "Lawrence Gosset", + "avatar_url": "https://avatars.githubusercontent.com/u/775742?v=4", + "profile": "https://github.com/gosseti", + "contributions": [ + "doc" + ] + }, + { + "login": "MarkosKon", + "name": "Markos Konstantopoulos", + "avatar_url": "https://avatars.githubusercontent.com/u/6961216?v=4", + "profile": "https://markoskon.com/", + "contributions": [ + "doc" + ] + }, + { + "login": "millette", + "name": "Robin Millette", + "avatar_url": "https://avatars.githubusercontent.com/u/50741?v=4", + "profile": "https://mastodon.fedi.quebec/@waglo", + "contributions": [ + "code" + ] + }, + { + "login": "folz", + "name": "Rodney Folz", + "avatar_url": "https://avatars.githubusercontent.com/u/299281?v=4", + "profile": "http://www.rodneyfolz.com/", + "contributions": [ + "code" + ] + }, + { + "login": "pomber", + "name": "Rodrigo Pombo", + "avatar_url": "https://avatars.githubusercontent.com/u/1911623?v=4", + "profile": "https://pomb.us/", + "contributions": [ + "code", + "test", + "doc" + ] + }, + { + "login": "mergebandit", + "name": "Scott Silvi", + "avatar_url": "https://avatars.githubusercontent.com/u/22401430?v=4", + "profile": "https://github.com/mergebandit", + "contributions": [ + "doc" + ] + }, + { + "login": "shawnbot", + "name": "Shawn Allen", + "avatar_url": "https://avatars.githubusercontent.com/u/113896?v=4", + "profile": "http://secularproducts.com/work/", + "contributions": [ + "doc" + ] + }, + { + "login": "wereHamster", + "name": "Tomas Carnecky", + "avatar_url": "https://avatars.githubusercontent.com/u/34538?v=4", + "profile": "https://caurea.org/", + "contributions": [ + "code", + "bug" + ] + }, + { + "login": "johnpolacek", + "name": "John Polacek", + "avatar_url": "https://avatars.githubusercontent.com/u/179482?v=4", + "profile": "https://johnpolacek.com/", + "contributions": [ + "code", + "bug" + ] + }, + { + "login": "macklinu", + "name": "mackie", + "avatar_url": "https://avatars.githubusercontent.com/u/2344137?v=4", + "profile": "https://mackie.world/", + "contributions": [ + "code" + ] + }, + { + "login": "aaronadamsCA", + "name": "Aaron Adams", + "avatar_url": "https://avatars.githubusercontent.com/u/1505561?v=4", + "profile": "https://www.linkedin.com/in/aaronadamsca/", + "contributions": [ + "code", + "bug" + ] + }, + { + "login": "amberleyromo", + "name": "Amberley", + "avatar_url": "https://avatars.githubusercontent.com/u/3461087?v=4", + "profile": "https://amberley.dev/", + "contributions": [ + "code" + ] + }, + { + "login": "diemkay", + "name": "Andreea Năstase", + "avatar_url": "https://avatars.githubusercontent.com/u/1731240?v=4", + "profile": "http://andreea.xyz/", + "contributions": [ + "doc" + ] + }, + { + "login": "ansonlowzf", + "name": "Anson Low Z.F", + "avatar_url": "https://avatars.githubusercontent.com/u/39628765?v=4", + "profile": "https://github.com/ansonlowzf", + "contributions": [ + "bug", + "doc" + ] + }, + { + "login": "bernharduw", + "name": "Bernhard Gschwantner", + "avatar_url": "https://avatars.githubusercontent.com/u/740978?v=4", + "profile": "https://bernhard.gschwantner.org/", + "contributions": [ + "code" + ] + }, + { + "login": "BhanuKorthiwada", + "name": "Bhanu Prakash Korthiwada", + "avatar_url": "https://avatars.githubusercontent.com/u/4593794?v=4", + "profile": "https://bhanu.dev/", + "contributions": [ + "doc" + ] + }, + { + "login": "brunolemos", + "name": "Bruno Lemos", + "avatar_url": "https://avatars.githubusercontent.com/u/619186?v=4", + "profile": "https://twitter.com/brunolemos", + "contributions": [ + "doc" + ] + }, + { + "login": "vbfischer", + "name": "Bryce Fischer", + "avatar_url": "https://avatars.githubusercontent.com/u/138106?v=4", + "profile": "https://github.com/vbfischer", + "contributions": [ + "code" + ] + }, + { + "login": "valtism", + "name": "Dan Wood", + "avatar_url": "https://avatars.githubusercontent.com/u/1286001?v=4", + "profile": "http://valtism.com/", + "contributions": [ + "doc" + ] + }, + { + "login": "DebsDee", + "name": "Debs", + "avatar_url": "https://avatars.githubusercontent.com/u/7225720?v=4", + "profile": "https://github.com/DebsDee", + "contributions": [ + "doc" + ] + }, + { + "login": "ed0wolf", + "name": "Edward O'Reilly", + "avatar_url": "https://avatars.githubusercontent.com/u/3645373?v=4", + "profile": "https://github.com/ed0wolf", + "contributions": [ + "code", + "bug" + ] + }, + { + "login": "eschaefer", + "name": "Eric Schaefer", + "avatar_url": "https://avatars.githubusercontent.com/u/547148?v=4", + "profile": "https://eric-schaefer.com/", + "contributions": [ + "code" + ] + }, + { + "login": "felixakiragreen", + "name": "Felix Green", + "avatar_url": "https://avatars.githubusercontent.com/u/1843672?v=4", + "profile": "https://github.com/felixakiragreen", + "contributions": [ + "doc" + ] + }, + { + "login": "bldng", + "name": "Gerhard Bliedung", + "avatar_url": "https://avatars.githubusercontent.com/u/2665732?v=4", + "profile": "https://github.com/bldng", + "contributions": [ + "code", + "bug" + ] + }, + { + "login": "guayom", + "name": "Guayo Mena", + "avatar_url": "https://avatars.githubusercontent.com/u/3279037?v=4", + "profile": "https://github.com/guayom", + "contributions": [ + "example" + ] + }, + { + "login": "guilhermelimak", + "name": "Guilherme Lima", + "avatar_url": "https://avatars.githubusercontent.com/u/6863574?v=4", + "profile": "https://github.com/guilhermelimak", + "contributions": [ + "doc" + ] + }, + { + "login": "HerbCaudill", + "name": "Herb Caudill", + "avatar_url": "https://avatars.githubusercontent.com/u/2136620?v=4", + "profile": "https://github.com/HerbCaudill", + "contributions": [ + "doc" + ] + }, + { + "login": "jbolda", + "name": "Jacob Bolda", + "avatar_url": "https://avatars.githubusercontent.com/u/2019387?v=4", + "profile": "http://www.jacobbolda.com/", + "contributions": [ + "code", + "bug" + ] + }, + { + "login": "jlengstorf", + "name": "Jason Lengstorf", + "avatar_url": "https://avatars.githubusercontent.com/u/163561?v=4", + "profile": "https://learnwithjason.dev/", + "contributions": [ + "bug", + "doc" + ] + }, + { + "login": "jasonrundell", + "name": "Jason Rundell (he/him)", + "avatar_url": "https://avatars.githubusercontent.com/u/524344?v=4", + "profile": "https://jasonrundell.com/", + "contributions": [ + "example" + ] + }, + { + "login": "josephrace", + "name": "Joe Race", + "avatar_url": "https://avatars.githubusercontent.com/u/2642432?v=4", + "profile": "https://joerace.uk/", + "contributions": [ + "doc" + ] + }, + { + "login": "mrkosima", + "name": "Kanstantsin Klimashevich", + "avatar_url": "https://avatars.githubusercontent.com/u/6384121?v=4", + "profile": "https://github.com/mrkosima", + "contributions": [ + "doc" + ] + }, + { + "login": "ekafyi", + "name": "Eka", + "avatar_url": "https://avatars.githubusercontent.com/u/6597211?v=4", + "profile": "https://dev.to/@ekafyi", + "contributions": [ + "doc", + "bug" + ] + }, + { + "login": "keirwilliams", + "name": "Keir Williams", + "avatar_url": "https://avatars.githubusercontent.com/u/26045249?v=4", + "profile": "https://github.com/keirwilliams", + "contributions": [ + "doc" + ] + }, + { + "login": "kripod", + "name": "Kristóf Poduszló", + "avatar_url": "https://avatars.githubusercontent.com/u/14854048?v=4", + "profile": "https://github.com/kripod", + "contributions": [ + "code", + "bug", + "ideas" + ] + }, + { + "login": "gillkyle", + "name": "Kyle Gill", + "avatar_url": "https://avatars.githubusercontent.com/u/21114044?v=4", + "profile": "https://kylegill.com/", + "contributions": [ + "doc" + ] + }, + { + "login": "kylemh", + "name": "Kyle Holmberg", + "avatar_url": "https://avatars.githubusercontent.com/u/9523719?v=4", + "profile": "https://kylemh.com/", + "contributions": [ + "doc" + ] + }, + { + "login": "LA1CH3", + "name": "Jay Laiche", + "avatar_url": "https://avatars.githubusercontent.com/u/11605788?v=4", + "profile": "http://jaylaiche.com/", + "contributions": [ + "code" + ] + }, + { + "login": "marcwiest", + "name": "Marc Wiest", + "avatar_url": "https://avatars.githubusercontent.com/u/815624?v=4", + "profile": "https://marcwiest.com/", + "contributions": [ + "code" + ] + }, + { + "login": "mtxr", + "name": "Matheus Teixeira", + "avatar_url": "https://avatars.githubusercontent.com/u/707561?v=4", + "profile": "https://mteixeira.dev/", + "contributions": [ + "code" + ] + }, + { + "login": "matt-cratebind", + "name": "matt-cratebind", + "avatar_url": "https://avatars.githubusercontent.com/u/42040318?v=4", + "profile": "https://github.com/matt-cratebind", + "contributions": [ + "doc" + ] + }, + { + "login": "mzabriskie", + "name": "Matt Zabriskie", + "avatar_url": "https://avatars.githubusercontent.com/u/199035?v=4", + "profile": "http://twitter.com/mzabriskie", + "contributions": [ + "code" + ] + }, + { + "login": "windkomo", + "name": "Maxime Khoy", + "avatar_url": "https://avatars.githubusercontent.com/u/1193421?v=4", + "profile": "https://humble.dev/", + "contributions": [ + "code" + ] + }, + { + "login": "michaelfriedman", + "name": "Michael Friedman", + "avatar_url": "https://avatars.githubusercontent.com/u/17555926?v=4", + "profile": "https://github.com/michaelfriedman", + "contributions": [ + "doc" + ] + }, + { + "login": "michaellopez", + "name": "Michael Zetterberg fd. Lopez", + "avatar_url": "https://avatars.githubusercontent.com/u/487039?v=4", + "profile": "https://weahead.se/", + "contributions": [ + "code" + ] + }, + { + "login": "knowler", + "name": "Nathan Knowler", + "avatar_url": "https://avatars.githubusercontent.com/u/6908001?v=4", + "profile": "https://knowlerkno.ws/", + "contributions": [ + "code" + ] + }, + { + "login": "FlashBlaze", + "name": "Neeraj Lagwankar", + "avatar_url": "https://avatars.githubusercontent.com/u/13968549?v=4", + "profile": "https://flashblaze.xyz/", + "contributions": [ + "doc" + ] + }, + { + "login": "theowenyoung", + "name": "Owen Young", + "avatar_url": "https://avatars.githubusercontent.com/u/62473795?v=4", + "profile": "https://github.com/theowenyoung", + "contributions": [ + "code" + ] + }, + { + "login": "patrick91", + "name": "Patrick Arminio", + "avatar_url": "https://avatars.githubusercontent.com/u/667029?v=4", + "profile": "https://patrick.wtf/", + "contributions": [ + "code", + "bug" + ] + }, + { + "login": "peduarte", + "name": "Pedro Duarte", + "avatar_url": "https://avatars.githubusercontent.com/u/372831?v=4", + "profile": "https://ped.ro/", + "contributions": [ + "code" + ] + }, + { + "login": "rclanan", + "name": "Ray Clanan", + "avatar_url": "https://avatars.githubusercontent.com/u/115944?v=4", + "profile": "https://noutc.com/", + "contributions": [ + "code" + ] + }, + { + "login": "r-i-c-h", + "name": "Rich Werden", + "avatar_url": "https://avatars.githubusercontent.com/u/19735136?v=4", + "profile": "http://www.richwerden.com/", + "contributions": [ + "doc" + ] + }, + { + "login": "robphoenix", + "name": "Rob Phoenix", + "avatar_url": "https://avatars.githubusercontent.com/u/9257284?v=4", + "profile": "https://www.robphoenix.com/", + "contributions": [ + "doc", + "bug" + ] + }, + { + "login": "robmoggach", + "name": "Robert Moggach", + "avatar_url": "https://avatars.githubusercontent.com/u/184759?v=4", + "profile": "http://moggach.com/", + "contributions": [ + "code", + "bug" + ] + }, + { + "login": "sanandnarayan", + "name": "Anand Narayan", + "avatar_url": "https://avatars.githubusercontent.com/u/433334?v=4", + "profile": "https://github.com/sanandnarayan", + "contributions": [ + "code", + "bug" + ] + }, + { + "login": "sampoder", + "name": "Sam Poder", + "avatar_url": "https://avatars.githubusercontent.com/u/39828164?v=4", + "profile": "https://github.com/sampoder", + "contributions": [ + "doc" + ] + }, + { + "login": "samrose3", + "name": "Sam Rose", + "avatar_url": "https://avatars.githubusercontent.com/u/11774595?v=4", + "profile": "https://samrose.me/", + "contributions": [ + "doc" + ] + }, + { + "login": "sohrab-", + "name": "Sohrab", + "avatar_url": "https://avatars.githubusercontent.com/u/4444588?v=4", + "profile": "https://github.com/sohrab-", + "contributions": [ + "code" + ] + }, + { + "login": "nubs", + "name": "Spencer Rinehart", + "avatar_url": "https://avatars.githubusercontent.com/u/57673?v=4", + "profile": "http://overthemonkey.com/", + "contributions": [ + "code" + ] + }, + { + "login": "intelligentandroid", + "name": "Steve", + "avatar_url": "https://avatars.githubusercontent.com/u/66937020?v=4", + "profile": "https://github.com/intelligentandroid", + "contributions": [ + "doc" + ] + }, + { + "login": "Bevets87", + "name": "Steve Barton", + "avatar_url": "https://avatars.githubusercontent.com/u/15524306?v=4", + "profile": "https://www.steve-barton.com/", + "contributions": [ + "doc" + ] + }, + { + "login": "timReynolds", + "name": "Tim Reynolds", + "avatar_url": "https://avatars.githubusercontent.com/u/168870?v=4", + "profile": "https://github.com/timReynolds", + "contributions": [ + "code", + "bug" + ] + }, + { + "login": "lemes", + "name": "Vinícius Lemes", + "avatar_url": "https://avatars.githubusercontent.com/u/3749403?v=4", + "profile": "https://github.com/lemes", + "contributions": [ + "doc" + ] + }, + { + "login": "Yihwan", + "name": "Yihwan Kim", + "avatar_url": "https://avatars.githubusercontent.com/u/16960054?v=4", + "profile": "https://github.com/Yihwan", + "contributions": [ + "code", + "bug" + ] + }, + { + "login": "yuriy636", + "name": "Yuriy Burychka", + "avatar_url": "https://avatars.githubusercontent.com/u/6631050?v=4", + "profile": "https://github.com/yuriy636", + "contributions": [ + "doc" + ] + }, + { + "login": "Zolwiastyl", + "name": "Zolwiastyl", + "avatar_url": "https://avatars.githubusercontent.com/u/45352717?v=4", + "profile": "https://github.com/Zolwiastyl", + "contributions": [ + "code" + ] + }, + { + "login": "IsAmrish", + "name": "Amrish Kushwaha", + "avatar_url": "https://avatars.githubusercontent.com/u/6524419?v=4", + "profile": "https://isamrish.com/", + "contributions": [ + "code" + ] + }, + { + "login": "joe-bell", + "name": "Joe Bell", + "avatar_url": "https://avatars.githubusercontent.com/u/7349341?v=4", + "profile": "https://joebell.co.uk/", + "contributions": [ + "code", + "bug" + ] + }, + { + "login": "kenny-loveholidays", + "name": "kenny-loveholidays", + "avatar_url": "https://avatars.githubusercontent.com/u/56022497?v=4", + "profile": "https://github.com/kenny-loveholidays", + "contributions": [ + "code" + ] + }, + { + "login": "lxynox", + "name": "⦇⦀∙ˇ∎ˇ∙⦀⦈", + "avatar_url": "https://avatars.githubusercontent.com/u/10333817?v=4", + "profile": "https://lxynox.netlify.com/", + "contributions": [ + "code", + "bug" + ] + }, + { + "login": "navsgh", + "name": "navsgh", + "avatar_url": "https://avatars.githubusercontent.com/u/45191853?v=4", + "profile": "https://github.com/navsgh", + "contributions": [ + "doc" + ] + }, + { + "login": "zeevo", + "name": "Shane O'Neill", + "avatar_url": "https://avatars.githubusercontent.com/u/8338013?v=4", + "profile": "https://zeevo.io/", + "contributions": [ + "doc" + ] + }, + { + "login": "zce", + "name": "汪磊", + "avatar_url": "https://avatars.githubusercontent.com/u/6166576?v=4", + "profile": "https://zce.me/", + "contributions": [ + "code", + "bug" + ] + } + ] +} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f1658fd10..0f6a73642 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,6 +2,7 @@ name: CI on: pull_request: + types: [opened, synchronize] push: branches: - develop @@ -10,22 +11,57 @@ on: jobs: build: runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - uses: actions/setup-node@v1 + with: + node-version: 14.x + + - uses: bahmutov/npm-install@v1 + with: + # By default, bahmutov/npm-install uses --frozen-lockfile + install-command: yarn + - name: Run tests and collect coverage + run: yarn test --coverage + + - name: Typecheck + run: yarn typecheck + release: + runs-on: ubuntu-latest + needs: [build] + if: > + !contains(github.event.head_commit.message, 'ci skip') && + !contains(github.event.head_commit.message, 'skip ci') && + !startsWith(github.event.head_commit.message, 'chore') && + !startsWith(github.event.pull_request.title, 'chore') && ( + github.event_name == 'push' || + github.event.pull_request.head.repo.full_name == github.repository + ) steps: - uses: actions/checkout@v2 + + - name: Prepare repository + run: git fetch --unshallow --tags + - uses: actions/setup-node@v1 with: - node-version: 12.x - - name: Get yarn cache directory path - id: yarn-cache-dir - run: echo "::set-output name=dir::$(yarn cache dir)" + node-version: 14.x + + - uses: bahmutov/npm-install@v1 - - uses: actions/cache@v1 + - name: Queue in release turnstile + id: turnstyle + continue-on-error: true + uses: softprops/turnstyle@v1 with: - path: ${{ steps.yarn-cache-dir.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - - run: yarn - - run: yarn test --coverage - - run: yarn typecheck + abort-after-seconds: 600 + + - name: Create release + if: steps.turnstyle.outcome == 'success' + env: + GITHUB_TOKEN: ${{ secrets.AUTO_RELEASE_GH_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN }} + run: yarn release diff --git a/.husky/_/husky.sh b/.husky/_/husky.sh new file mode 100644 index 000000000..ca2720e08 --- /dev/null +++ b/.husky/_/husky.sh @@ -0,0 +1,30 @@ +#!/bin/sh +if [ -z "$husky_skip_init" ]; then + debug () { + [ "$HUSKY_DEBUG" = "1" ] && echo "husky (debug) - $1" + } + + readonly hook_name="$(basename "$0")" + debug "starting $hook_name..." + + if [ "$HUSKY" = "0" ]; then + debug "HUSKY env variable is set to 0, skipping hook" + exit 0 + fi + + if [ -f ~/.huskyrc ]; then + debug "sourcing ~/.huskyrc" + . ~/.huskyrc + fi + + export readonly husky_skip_init=1 + sh -e "$0" "$@" + exitCode="$?" + + if [ $exitCode != 0 ]; then + echo "husky - $hook_name hook exited with code $exitCode (error)" + exit $exitCode + fi + + exit 0 +fi diff --git a/CHANGELOG.md b/CHANGELOG.md index 6927b5ca3..5a5c24b0b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,195 @@ # Changelog -## v0.6.0 UNRELEASED +## v0.6.2 (Mon Apr 05 2021) + +### 🐛 Bug Fix + +- `@theme-ui/css` + - Types for `borderTopWidth` now correctly accept `number`. + [#1623](https://github.com/system-ui/theme-ui/pull/1623) + ([@beerose](https://github.com/beerose)) + +## v0.6.1 + +- Reexported `jsx` as `createElement` to fix babel JSX pragma crash. Issue + [#1603](https://github.com/system-ui/theme-ui/issues/1603), PR + [#1604](https://github.com/system-ui/theme-ui/pull/1604) by @ethanwu10. + + The following code doesn't crash anymore. + + ```tsx +
+ ``` + +## v0.6.0 + +_changes relative to 0.3, not the latest 0.6 prerelease_ + +### What's New + +- `Styled` components dict was renamed to [`Themed`](/themed/) to avoid + confusion with `styled` components constructors from `@emotion/styled` and + similar libraries. + +- `theme.useRootStyles` configuration option (false by default). Set it to + `true` to add `styles.root` to `html` instead of `body`. + + - `theme.useBodyStyles` configuration option still defaults to `true`, but + it's going in to be deprecated in favor of `theme.useRootStyles` in the + future. + +- New scale: `transitions` supporting `transition` CSS property. Issue + [#1079](https://github.com/system-ui/theme-ui/issues/1079), PR + [#1272](https://github.com/system-ui/theme-ui/pull/1272) + +- Objects in nested scales can now have a `__default` key. PR + [#951](https://github.com/system-ui/theme-ui/pull/951) + + Given the theme + + ``` + const theme = { + colors: { + primary: { + __default: '#00f', + light: '#33f', + } + } + } + ``` + + `color: 'primary'` resolves to `color: '#00f'`. + +- Configuration option for printing color mode. PR + [#1267](https://github.com/system-ui/theme-ui/pull/1267), issue + [#1144](https://github.com/system-ui/theme-ui/issues/1144). No more wasted + ink. + + ``` + { + initialColorModeName: "dark", + printColorModeName: "light" + } + ``` + +- A new component, Paragraph was added in PR + [#1298](https://github.com/system-ui/theme-ui/pull/1298) + +### Breaking Changes + +- Theme UI 0.6 depends on Emotion 11, and isn't compatible with Emotion 10 + anymore. + + - If you didn't install Emotion separately, this update shouldn't affect you. + - If your other dependencies depend on Emotion 10, and have no published + versions for Emotion 11, you can use + [Yarn resolutions](https://yarnpkg.com/lang/en/docs/selective-version-resolutions/) + or + [Webpack's resolve.alias](https://webpack.js.org/configuration/resolve/#resolvealias) + to enforce a version. + + Refer to [Emotion 11 release notes](https://emotion.sh/docs/emotion-11) for + more information. + +- Color mode flash on first render is gone, but to achieve this we had to bring + back `theme.rawColors`. + + - **You can no longer read raw color values from `theme.colors`** when reading + theme from `useThemeUI` or inside `sx`. + - `.colors` object contains Custom CSS Properties now. + - If you need to pass original value somewhere where CSS Properties (e.g. + WebGL Canvas) won't work use `.rawColors`. + +- Default color mode name is no longer `"default"` — it's now `undefined`, what + represents the lack of color mode set by user or detected from preferences. + +- `useColorSchemeMediaQuery` defaults to `true`. Issue + [#624](https://github.com/system-ui/theme-ui/issues/624), PR + [#1373](https://github.com/system-ui/theme-ui/pull/1373) + + **How to migrate?** Add `useColorSchemeMediaQuery: false` to your theme if you + don't have this property. + [Read more in the docs.](https://dev.theme-ui.com/color-modes/#responding-to-the-prefers-color-scheme-media-query) + +- We no longer export internal React context named as `Context` 😅 It wasn't and + it's still not public API, but if you used it and _you really_ need it, you + can grab it as `__ThemeUIContext`. (But please don't do this. Use + `ThemeProvider` from _@theme-ui/core_ for local theme overrides instead.) + +### Deprecations + +- `Styled` will be removed in v0.7. Use [`Themed`](/themed) instead. +- `useBodyStyles` will be removed in v0.7. Use `useRootStyles` instead. + +### TypeScript Changes + +Theme UI is now written in TypeScript, and the emitted types differ from +`@types/theme-ui`. + +- `false` in now accepted in responsive tuple types. PR + [#1499](https://github.com/system-ui/theme-ui/pull/1499) + +- Known colors (_primary_, _text_, _background_, _accent_, _secondary_) in + `ColorMode` can now be nested scales. + + The following no longer typechecks, as `colors.primary` can be an object. + + ```tsx + sx={{ + color: theme => theme.colors?.primary?.toUpperCase() + }} + ``` + + But the following code still works. + + ```tsx + sx={{ + color: theme => theme.colors?.primary + }} + ``` + + If `colors.primary` is an object, `colors.primary.__default` is used. + +- `false` values are skipped before passing style objects to Emotion. Issue + [#1297](https://github.com/system-ui/theme-ui/issues/1297), PR + [#1460](https://github.com/system-ui/theme-ui/pull/1460). + + The following syntax is now supported + + ```tsx + sx={{ color: isActive && blue }} + ``` + +- "as" prop on Themed.X components now properly opts out of typechecking + + - TypeScript users, don't use `ComponentProps`, import + `ThemedComponent` and use `ThemedComponent<'div'>` instead. + +- Theme UI 0.6 depends on [`csstype`](https://github.com/frenic/csstype) v3 + instead of `csstype` v2. + +- Renamed types + - Anything copied from `styled-system` types was renamed or removed. + - `SxProps` was renamed to `SxProp`. + - `SxStyleProp`, an alias for `ThemeUIStyleObject` was removed. Use + `ThemeUIStyleObject` instead. + +**Refer to the changelog for a full list of changes.** + +## v0.6.0-alpha.8 2021-02-19 + +- Make the rename of `Styled` to `Themed` non-breaking. Add a deprecation + warning on `Styled` until a future release. PR + [#1461](https://github.com/system-ui/theme-ui/pull/1461) +- Paragraph component's hardcoded responsive style has been removed (issue + [#1476](https://github.com/system-ui/theme-ui/issues/1476)) +- Fix issue where css custom vars are only added to body if modes is in the + colors declaration of the theme. ## v0.6.0-alpha.7 2021-02-15 -- **Breaking TypeScript**: Known colors (_primary_, _text_, _background_, _accent_, _secondary_) in `ColorMode` can now be nested scales. +- **Breaking TypeScript**: Known colors (_primary_, _text_, _background_, + _accent_, _secondary_) in `ColorMode` can now be nested scales. The following no longer typechecks, as `colors.primary` can be an object. @@ -24,26 +209,35 @@ If `colors.primary` is an object, `colors.primary.__default` is used. -- Add `theme.useRootStyles` configuration option (false by default). - Set it to `true` to add `styles.root` to `html` instead of `body`. - `theme.useBodyStyles` configuration option still defaults to `true`, - but it's going in to be deprecated in favor of `theme.useRootStyles` in the future. -- Accept `false` in responsive tuple types. PR #1499 -- Skip `false` values before passing style objects to Emotion. Issue #1297, PR #1460. - - Allow `false` as style property value in TS types. +- Add `theme.useRootStyles` configuration option (false by default). Set it to + `true` to add `styles.root` to `html` instead of `body`. `theme.useBodyStyles` + configuration option still defaults to `true`, but it's going in to be + deprecated in favor of `theme.useRootStyles` in the future. +- + Accept `false` in responsive tuple types. PR #1499 +- Skip `false` values before passing style objects to Emotion. Issue #1297, PR + #1460. + - + Allow `false` as style property value in TS types. ## v0.6.0-alpha.6 2021-01-22 -- **BREAKING**: Default `useColorSchemeMediaQuery` to `true`. Issue #624, PR #1373 +- **BREAKING**: Default `useColorSchemeMediaQuery` to `true`. Issue #624, PR + #1373 - **How to migrate?** Add `useColorSchemeMediaQuery: false` to your theme if you don't have this property. + **How to migrate?** Add `useColorSchemeMediaQuery: false` to your theme if you + don't have this property. [Read more in the docs.](https://dev.theme-ui.com/color-modes/#responding-to-the-prefers-color-scheme-media-query) -- Option for `gatsby-plugin-theme-ui` to disable body script (`injectColorFlashScript`, defaulting to `true`). Issue #1369, PR #1370 -- Bump versions `@mdx-js/mdx` and `@mdx-js/react` to `^1.6.22`, gatsby-plugin-mdx to `^1.6.0`. PR #1351 +- Option for `gatsby-plugin-theme-ui` to disable body script + (`injectColorFlashScript`, defaulting to `true`). Issue #1369, PR #1370 +- Bump versions `@mdx-js/mdx` and `@mdx-js/react` to `^1.6.22`, + gatsby-plugin-mdx to `^1.6.0`. PR #1351 - Fix: "as" prop on Themed.X components now properly opts out of typechecking - - TypeScript users, don't use `ComponentProps`, import `ThemedComponent<'div'>` instead. -- `@theme-ui/prism`: Support multiple highlight wrappers in a single code block. PR #1393 + - TypeScript users, don't use `ComponentProps`, import + `ThemedComponent<'div'>` instead. +- `@theme-ui/prism`: Support multiple highlight wrappers in a single code block. + PR #1393 ## v0.6.0-alpha.5 2021-01-22 @@ -69,7 +263,8 @@ - Extract objects with nested variant props. Issue #1357 - Add ability for MDX styling, and fix mdx table align styles. Issue #654 - Remove recursive default values from CSS custom properties. PR #1327 -- Render extra Embed props onto `iframe` tag instead of wrapping `div`. Issue #966, PR #1122 +- Render extra Embed props onto `iframe` tag instead of wrapping `div`. Issue + #966, PR #1122 ## v0.6.0-alpha.2 @@ -77,10 +272,13 @@ ## v0.6.0-alpha.1 -- Switches from lodash.kebabCase to alternative package ([param-case](/blakeembrey/change-case/tree/master/packages/param-case)) per [official Lodash documentation](https://lodash.com/per-method-packages). PR #1304 +- Switches from lodash.kebabCase to alternative package + ([param-case](/blakeembrey/change-case/tree/master/packages/param-case)) per + [official Lodash documentation](https://lodash.com/per-method-packages). PR + #1304 - Rebuilds Prism preset with latest upstream theme changes. PR #1304 -- Fix: Preserve order of variant expansion props. PR #1326 - _(bug introduced in 0.5.0-alpha.1)_ +- Fix: Preserve order of variant expansion props. PR #1326 _(bug introduced in + 0.5.0-alpha.1)_ ## v0.6.0-alpha.0 @@ -88,7 +286,8 @@ - **BREAKING**: Make Text component use `span` instead of `div` - **breaking TypeScript**: Renamed and removed types. PR #1308 - `SxProps` to `SxProp`. - - `SxStyleProp`, an alias for `ThemeUIStyleObject` removed. Use `ThemeUIStyleObject` instead. + - `SxStyleProp`, an alias for `ThemeUIStyleObject` removed. Use + `ThemeUIStyleObject` instead. - Fix: Add `sx` props types to all props accepting `className`. PR #1308 - Fix WithPoorAsProp to work with ComponentProps utility type. PR #1308 @@ -101,14 +300,17 @@ - Bump React peerDependency to `"^16.14.0 || ^17.0.0"`. - Support automatic JSX runtime. Issue #1160, PR #1237 - Bump React peerDependency to `"^16.14.0 || ^17.0.0"`. -- Apply variant styles _before_ responsive styles. Issues #1030, and #720, PR #1273 +- Apply variant styles _before_ responsive styles. Issues #1030, and #720, PR + #1273 ## v0.5.0-alpha.0 2020-11-20 - **BREAKING**: Upgrade to Emotion 11, and `csstype` 3. PR #1261 - We are now depending on `@emotion/react@11` instead of `@emotion/core@10` - - `sx` prop types are still global, and we opt in for Emotion `css` prop types (This will change in the future.) - - Refer to [Emotion 11 release notes](https://emotion.sh/docs/emotion-11) for more information. + - `sx` prop types are still global, and we opt in for Emotion `css` prop types + (This will change in the future.) + - Refer to [Emotion 11 release notes](https://emotion.sh/docs/emotion-11) for + more information. ## v0.4.0-rc.14 2020-11-20 @@ -126,8 +328,8 @@ ### `theme-ui` -- Use correct version of @theme-ui/components in theme-ui package. - (Locked dependencies on other Theme UI packages) +- Use correct version of @theme-ui/components in theme-ui package. (Locked + dependencies on other Theme UI packages) ## v0.4.0-rc.11 2020-11-18 @@ -148,7 +350,8 @@ ### `@theme-ui/components` -- Add `arrow` prop to Select to allow passing custom arrow icon. Issues #1177 #1151, PR #1232 +- Add `arrow` prop to Select to allow passing custom arrow icon. Issues #1177 + #1151, PR #1232 - Fix: Field component uses `id` if passed. PR #1252 - Fix circular import in Switch.js @@ -183,7 +386,8 @@ ### examples -- Convert Gatsby example to TypeScript and stop using removed components. Issue #1227, PR #1229 +- Convert Gatsby example to TypeScript and stop using removed components. Issue + #1227, PR #1229 ## v0.4.0-rc.7 2020-11-08 @@ -230,7 +434,8 @@ ### `@theme-ui/core` -- Support Webpack 5. (Uses default export from package.json instead of named export) #1141 +- Support Webpack 5. (Uses default export from package.json instead of named + export) #1141 ### `@theme-ui/components` @@ -246,23 +451,31 @@ ## v0.3.1 2020-01-32 - Adjusts media query sort logic #600 -- Fixes link to Gatsby Plugin page in `getting-started` page. Issue #602, PR #603 +- Fixes link to Gatsby Plugin page in `getting-started` page. Issue #602, PR + #603 ## v0.3.0 2020-01-22 -- Split theme-ui package into `@theme-ui/core`, `@theme-ui/mdx`, and `@theme-ui/color-modes` +- Split theme-ui package into `@theme-ui/core`, `@theme-ui/mdx`, and + `@theme-ui/color-modes` - Removes `context.components` (still available through MDX context) - Adds separate `ColorModeProvider` component -- Removes support for `theme.initialColorMode` - use `initialColorModeName` instead -- Removes layout components (`Layout`, `Header`, `Main`, `Footer`) - use `Box` and `Flex` instead +- Removes support for `theme.initialColorMode` - use `initialColorModeName` + instead +- Removes layout components (`Layout`, `Header`, `Main`, `Footer`) - use `Box` + and `Flex` instead - Updates CSS custom properties implementation for color modes -- When using `useColorSchemeMediaQuery` flag, it will initialize the mode to `light` when `@media (prefers-color-scheme: light)` is enabled -- Global color mode styles are automatically added to the body without needing to render the `ColorMode` component +- When using `useColorSchemeMediaQuery` flag, it will initialize the mode to + `light` when `@media (prefers-color-scheme: light)` is enabled +- Global color mode styles are automatically added to the body without needing + to render the `ColorMode` component - Adds global typographic styles, set `useBodyStyles: false` to disable - Removes `ThemeStateProvider` - Fix issue where `` tag was incorrectly specified as `delete` -- The `@theme-ui/editor` API has changed significantly. See the README.md for more information. -- `@theme-ui/components`: on Grid component, allow custom `columns` definitions via strings #541 +- The `@theme-ui/editor` API has changed significantly. See the README.md for + more information. +- `@theme-ui/components`: on Grid component, allow custom `columns` definitions + via strings #541 - `@theme-ui/gatsby-theme-style-guide`: add docs on shadowing #558 - Adds `@theme-ui/preset-polaris` #567 - Adjusts default font stack in presets #568 @@ -319,7 +532,8 @@ ## v0.2.43 2019-09-17 - Fix Reakit for ColorPicker test #357 -- Simplify color mode API and disable `prefers-color-scheme` media query behavior by default #246 +- Simplify color mode API and disable `prefers-color-scheme` media query + behavior by default #246 - Add BaseStyles component #369 ## v0.2.42 2019-09-11 @@ -362,7 +576,8 @@ ## v0.2.34 2019-08-15 -- `gatsby-plugin-theme-ui` remove JSX syntax from gatsby-ssr in Gatsby plugin #299 +- `gatsby-plugin-theme-ui` remove JSX syntax from gatsby-ssr in Gatsby plugin + #299 - `@theme-ui/typography` fix for CSS font-family keywords #285 - `@theme-ui/preset-tailwind` add button and input variants #291 @@ -377,7 +592,8 @@ ## v0.2.31 2019-08-07 -- Maintain raw color values in Theme UI context when `useCustomProperties` is enabled #274 +- Maintain raw color values in Theme UI context when `useCustomProperties` is + enabled #274 ## v0.2.30 2019-08-06 @@ -510,9 +726,12 @@ - Replaced `lodash.merge` with `deepmerge` - Updated to use smaller Styled System v5 packages - Removed layout and flexbox style props from `Box` and layout components -- Renamed `css` prop in experimental custom pragma to `sx` to avoid collisions with Emotion and other libraries +- Renamed `css` prop in experimental custom pragma to `sx` to avoid collisions + with Emotion and other libraries - Refactored `ThemeProvider` - Removed `toStyle` API from Typography.js package - Renamed Typography.js package to `@theme-ui/typography` -- Removed `@emotion/styled` dependency - layout components are no longer created with `styled` so passing non-HTML attributes to the component will result in React rendering those props to the DOM +- Removed `@emotion/styled` dependency - layout components are no longer created + with `styled` so passing non-HTML attributes to the component will result in + React rendering those props to the DOM - Removed legacy `ColorModeProvider` and `ComponentProvider` exports diff --git a/MIGRATING.md b/MIGRATING.md new file mode 100644 index 000000000..92dc54bc5 --- /dev/null +++ b/MIGRATING.md @@ -0,0 +1,234 @@ +# Migration Guides + +## v0.6 + +### What's New + +- `Styled` components dict was renamed to [`Themed`](/themed/) to avoid + confusion with `styled` components constructors from `@emotion/styled` and + similar libraries. + +- `theme.useRootStyles` configuration option (false by default). Set it to + `true` to add `styles.root` to `html` instead of `body`. + + - `theme.useBodyStyles` configuration option still defaults to `true`, but + it's going in to be deprecated in favor of `theme.useRootStyles` in the + future. + +- New scale: `transitions` supporting `transition` CSS property. Issue + [#1079](https://github.com/system-ui/theme-ui/issues/1079), PR + [#1272](https://github.com/system-ui/theme-ui/pull/1272) + +- Objects in nested scales can now have a `__default` key. PR + [#951](https://github.com/system-ui/theme-ui/pull/951) + + Given the theme + + ``` + const theme = { + colors: { + primary: { + __default: '#00f', + light: '#33f', + } + } + } + ``` + + `color: 'primary'` resolves to `color: '#00f'`. + +- Configuration option for printing color mode. PR + [#1267](https://github.com/system-ui/theme-ui/pull/1267), issue + [#1144](https://github.com/system-ui/theme-ui/issues/1144). No more wasted + ink. + + ``` + { + initialColorModeName: "dark", + printColorModeName: "light" + } + ``` + +- A new component, Paragraph was added in PR + [#1298](https://github.com/system-ui/theme-ui/pull/1298) + +### Breaking Changes + +- Theme UI 0.6 depends on Emotion 11, and isn't compatible with Emotion 10 + anymore. + + - If you didn't install Emotion separately, this update shouldn't affect you. + - If your other dependencies depend on Emotion 10, and have no published + versions for Emotion 11, you can use + [Yarn resolutions](https://yarnpkg.com/lang/en/docs/selective-version-resolutions/) + or + [Webpack's resolve.alias](https://webpack.js.org/configuration/resolve/#resolvealias) + to enforce a version. + + Refer to [Emotion 11 release notes](https://emotion.sh/docs/emotion-11) for + more information. + +- Color mode flash on first render is gone, but to achieve this we had to bring + back `theme.rawColors`. + + - **You can no longer read raw color values from `theme.colors`** when reading + theme from `useThemeUI` or inside `sx`. + - `.colors` object contains Custom CSS Properties now. + - If you need to pass original value somewhere where CSS Properties (e.g. + WebGL Canvas) won't work use `.rawColors`. + + **How to migrate?** + + Find places where you read `colors` from the _useThemeUI_ and extract + `rawColors` instead of `colors`. + + ```tsx + const { rawColors: colors } = useThemeUI().theme + ``` + +- Default color mode name is no longer `"default"` — it's now `undefined`, what + represents the lack of color mode set by user or detected from preferences. + +- `useColorSchemeMediaQuery` defaults to `true`. Issue + [#624](https://github.com/system-ui/theme-ui/issues/624), PR + [#1373](https://github.com/system-ui/theme-ui/pull/1373) + + **How to migrate?** Add `useColorSchemeMediaQuery: false` to your theme if you + don't have this property. + [Read more in the docs.](https://dev.theme-ui.com/color-modes/#responding-to-the-prefers-color-scheme-media-query) + +- We no longer export internal React context named as `Context` 😅 It wasn't and + it's still not public API, but if you used it and _you really_ need it, you + can grab it as `__ThemeUIContext`. (But please don't do this. Use + `ThemeProvider` from _@theme-ui/core_ for local theme overrides instead.) + +### Deprecations + +- `Styled` will be removed in v0.7. Use [`Themed`](/themed) instead. +- `useBodyStyles` will be removed in v0.7. Use `useRootStyles` instead. + +### TypeScript Changes + +Theme UI is now written in TypeScript, and the emitted types differ from +`@types/theme-ui`. + +- `false` in now accepted in responsive tuple types. PR + [#1499](https://github.com/system-ui/theme-ui/pull/1499) + +- Known colors (_primary_, _text_, _background_, _accent_, _secondary_) in + `ColorMode` can now be nested scales. + + The following no longer typechecks, as `colors.primary` can be an object. + + ```tsx + sx={{ + color: theme => theme.colors?.primary?.toUpperCase() + }} + ``` + + But the following code still works. + + ```tsx + sx={{ + color: theme => theme.colors?.primary + }} + ``` + + If `colors.primary` is an object, `colors.primary.__default` is used. + +- `false` values are skipped before passing style objects to Emotion. Issue + [#1297](https://github.com/system-ui/theme-ui/issues/1297), PR + [#1460](https://github.com/system-ui/theme-ui/pull/1460). + + The following syntax is now supported + + ```tsx + sx={{ color: isActive && blue }} + ``` + +- "as" prop on Themed.X components now properly opts out of typechecking + + - TypeScript users, don't use `ComponentProps`, import + `ThemedComponent` and use `ThemedComponent<'div'>` instead. + +- Theme UI 0.6 depends on [`csstype`](https://github.com/frenic/csstype) v3 + instead of `csstype` v2. + +- Renamed types + - Anything copied from `styled-system` types was renamed or removed. + - `SxProps` was renamed to `SxProp`. + - `SxStyleProp`, an alias for `ThemeUIStyleObject` was removed. Use + `ThemeUIStyleObject` instead. + +[**Refer to the changelog for a full list of changes.**](https://github.com/system-ui/theme-ui/blob/develop/CHANGELOG.md) + +## v0.3 + +### What's New + +- Components can now be imported directly from the `theme-ui` package. Be sure + that treeshaking is enabled with your build tool. +- Includes smart defaults for adding base styles to the `` element. +- Simplified color modes API. +- New `@theme-ui/css`, `@theme-ui/core`, `@theme-ui/color-modes`, and + `@theme-ui/mdx` packages allow for more bespoke ways to use the library. + +### Breaking Changes + +- `@emotion/react` and `@mdx-js/react` are now dependencies of `theme-ui` and + should not be installed separately. If you'd like to use a particular version + of each library, use + [Yarn resolutions](https://yarnpkg.com/lang/en/docs/selective-version-resolutions/). +- Theme UI context no longer provides `context.components`. If you're using this + object from context, use the MDX hook instead. E.g. + `import { useMDXComponents } from '@mdx-js/react'` +- If you'd like color mode to be initialized from the `prefers-color-scheme` + media query, you must enable the `useColorSchemeMediaQuery: true` flag in your + theme. +- The `ColorMode` component is deprecated and no longer required to add color + styles to the `` element. +- The following components have been removed in favor of using `Box` and `Flex` + components: `Layout`, `Header`, `Main`, `Footer` +- The `initialColorMode` flag no longer works, use `initialColorModeName` + instead. +- The `ThemeProvider` now adds global typographic styles to the `` element + based on `theme.styles.root`. To disable this behavior set the + `useBodyStyles: false` flag in your theme. +- Theme context is now stateless. If you've made use of `context.setTheme`, this + no longer works. An alternative approach is available with the + `@theme-ui/editor` package. +- The `ThemeStateProvider` component is no longer avialable, see + `@theme-ui/editor` as an alternative. +- The `@theme-ui/editor` package has a completely new API. Please refer to the + package's + [README.md](https://github.com/system-ui/theme-ui/blob/stable/packages/editor/README.md) + for more information. + +## v0.2 + +### JSX Pragma + +If you were using the Theme UI custom JSX pragma, rename the `css` prop to `sx`. +This does not apply if you were importing and using the `css` utility function +manually. + +### `theme-ui-typography` + +If you were using the `theme-ui-typography` package, install the new package +named `@theme-ui/typography` instead. The `toStyle` API is no longer included. +Use the `toTheme` API instead, see the +[Typography.js docs](/styling-mdx/#typographyjs) for how to use this utility. + +### `Box` and layout component + +If you were using Styled System style props on the `Box` component or any other +layout component, replace these props with either the [`sx` prop](/sx-prop) or +by using the `css` utility. + +### Other + +- Replace `ColorModeProvider` and `ComponentProvider` with the `ThemeProvider` + component. +- The `@emotion/styled` package is no longer required for Theme UI. If you are + not using it directly in your application, you can remove it from your + dependencies. diff --git a/auto.rc b/auto.rc new file mode 100644 index 000000000..15891364e --- /dev/null +++ b/auto.rc @@ -0,0 +1,36 @@ +{ + "author": "Piotr Monwid-Olechnowicz ", + "baseBranch": "stable", + "prereleaseBranches": ["develop"], + "plugins": [ + [ + "npm", + { + "exact": true + } + ], + "conventional-commits", + "first-time-contributor", + "released", + [ + "all-contributors", + { + "exclude": ["dependabot", "dependabot-preview"], + "types": { + "infra": ["./github/**/*"], + "example": ["examples/**/*"], + "doc": ["**/*.mdx", "**/*.md", "packages/docs/**/*"], + "test": ["**/*.test.*", "**/*.spec.*"], + "code": [ + "packages/**/*.js", + "packages/**/*.ts", + "packages/**/*.jsx", + "packages/**/*.tsx", + "**/package.json", + "**/tsconfig.json" + ] + } + } + ] + ] +} diff --git a/deprecated/chrome/babel.config.js b/deprecated/chrome/babel.config.js deleted file mode 100644 index 46bf5309f..000000000 --- a/deprecated/chrome/babel.config.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('../../babel.config') diff --git a/deprecated/chrome/package.json b/deprecated/chrome/package.json index 7c17fc3c0..f8cb2f64e 100644 --- a/deprecated/chrome/package.json +++ b/deprecated/chrome/package.json @@ -2,7 +2,7 @@ "private": true, "name": "@theme-ui/chrome", "version": "0.5.0-alpha.0", - "main": "index.js", + "main": "dist/chrome.cjs.js", "author": "Brent Jackson", "license": "MIT", "scripts": { @@ -18,7 +18,6 @@ "@babel/core": "^7.4.5", "@babel/preset-env": "^7.4.5", "@babel/preset-react": "^7.0.0", - "@emotion/react": "^11.1.1", "@theme-ui/editor": "^0.5.0-alpha.0", "babel-loader": "^8.0.6", "copy-to-clipboard": "^3.2.0", @@ -29,10 +28,9 @@ "stringify-object": "^3.3.0", "theme-ui": "^0.5.0-alpha.0", "webpack": "^4.33.0", - "webpack-cli": "^3.3.4" + "webpack-cli": "^3.3.4", + "@emotion/react": "^11.1.1" }, - "devDependencies": { - "@theme-ui/css": "^0.5.0-alpha.0" - }, - "gitHead": "bfd026cae085f377ca537de897dc43233d50f5d5" + "gitHead": "bfd026cae085f377ca537de897dc43233d50f5d5", + "module": "dist/chrome.esm.js" } diff --git a/deprecated/chrome/tsconfig.json b/deprecated/chrome/tsconfig.json deleted file mode 100644 index c9468836d..000000000 --- a/deprecated/chrome/tsconfig.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "lib": ["ES2015", "DOM"], - "jsx": "react" - }, - "include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.d.ts", "global.d.ts"] -} diff --git a/deprecated/chrome/webpack.config.js b/deprecated/chrome/webpack.config.js deleted file mode 100644 index 69c5e7af2..000000000 --- a/deprecated/chrome/webpack.config.js +++ /dev/null @@ -1,17 +0,0 @@ -const path = require('path') - -module.exports = { - entry: ['./src/index.tsx'], - output: { - path: path.resolve(__dirname, 'public', 'bundle'), - filename: 'index.js', - }, - module: { - rules: [ - { - test: /\.tsx?$/, - use: 'babel-loader', - }, - ], - }, -} diff --git a/deprecated/gatsby-theme-ui-blog/package.json b/deprecated/gatsby-theme-ui-blog/package.json index 46da5c96b..4db8ef19b 100644 --- a/deprecated/gatsby-theme-ui-blog/package.json +++ b/deprecated/gatsby-theme-ui-blog/package.json @@ -2,11 +2,12 @@ "name": "gatsby-theme-ui-blog", "version": "0.4.0-rc.0", "main": "index.js", + "private": true, "scripts": { "avatar": "npx capture-website-cli \"https://contrast.now.sh/fff/33e?text=UI&size=48&fontSize=1.5&radius=32&baseline=1\" content/assets/avatar.png --width=48 --height=48 --overwrite" }, "peerDependencies": { - "gatsby": "^2.13.1", + "gatsby": ">=2", "react": "^16.14.0 || ^17.0.0", "react-dom": "^16.8.0 || ^17.0.0" }, diff --git a/examples/codesandbox-starter/.prettierrc b/examples/codesandbox-starter/.prettierrc index 3a42238c9..6b33f0821 100755 --- a/examples/codesandbox-starter/.prettierrc +++ b/examples/codesandbox-starter/.prettierrc @@ -8,4 +8,4 @@ "bracketSpacing": true, "jsxBracketSameLine": false, "fluid": false -} \ No newline at end of file +} diff --git a/examples/gatsby-plugin/package.json b/examples/gatsby-plugin/package.json index 603876001..d34458a0f 100644 --- a/examples/gatsby-plugin/package.json +++ b/examples/gatsby-plugin/package.json @@ -25,6 +25,6 @@ "husky": ">=4.0.7", "jest": "^24.8.0", "lint-staged": "10", - "react-test-renderer": "^16.8.6" + "react-test-renderer": "^17.0.1" } } diff --git a/examples/next/pages/hello.js b/examples/next/pages/hello.js index 36bcfb2ea..8b15c7eff 100644 --- a/examples/next/pages/hello.js +++ b/examples/next/pages/hello.js @@ -2,13 +2,15 @@ /** @jsx jsx */ import { jsx, Themed } from 'theme-ui' -export default () => ( -
- Hello -
-) +export default function Hello() { + return ( +
+ Hello +
+ ) +} diff --git a/examples/next/yarn.lock b/examples/next/yarn.lock index 051228a58..1d1706400 100644 --- a/examples/next/yarn.lock +++ b/examples/next/yarn.lock @@ -2260,10 +2260,10 @@ bluebird@^3.5.5: resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.7.2.tgz#9f229c15be272454ffa973ace0dbee79a1b0c36f" integrity sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg== -bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.1.1, bn.js@^4.4.0: - version "4.11.9" - resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.11.9.tgz#26d556829458f9d1e81fc48952493d0ba3507828" - integrity sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw== +bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.1.1, bn.js@^4.11.9: + version "4.12.0" + resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.12.0.tgz#775b3f278efbb9718eec7361f483fb36fbbfea88" + integrity sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA== brace-expansion@^1.1.7: version "1.1.11" @@ -2296,7 +2296,7 @@ braces@~3.0.2: dependencies: fill-range "^7.0.1" -brorand@^1.0.1: +brorand@^1.0.1, brorand@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/brorand/-/brorand-1.1.0.tgz#12c25efe40a45e3c323eb8675a0a0ce57b22371f" integrity sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8= @@ -3129,17 +3129,17 @@ electron-to-chromium@^1.3.591: integrity sha512-mEax1P0CcoZJtXQU7OA0dO5nHiAQWw8gRGWKhnUyPA9bJW0B/JGiaQB+vtK66Ovm6U9qPxe2iXbO1L+f4jJAiw== elliptic@^6.0.0: - version "6.5.3" - resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.3.tgz#cb59eb2efdaf73a0bd78ccd7015a62ad6e0f93d6" - integrity sha512-IMqzv5wNQf+E6aHeIqATs0tOLeOTwj1QKbRcS3jBbYkl5oLAserA8yJTT7/VyHUYG91PRmPyeQDObKLPpeS4dw== + version "6.5.4" + resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.4.tgz#da37cebd31e79a1367e941b592ed1fbebd58abbb" + integrity sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ== dependencies: - bn.js "^4.4.0" - brorand "^1.0.1" + bn.js "^4.11.9" + brorand "^1.1.0" hash.js "^1.0.0" - hmac-drbg "^1.0.0" - inherits "^2.0.1" - minimalistic-assert "^1.0.0" - minimalistic-crypto-utils "^1.0.0" + hmac-drbg "^1.0.1" + inherits "^2.0.4" + minimalistic-assert "^1.0.1" + minimalistic-crypto-utils "^1.0.1" emojis-list@^2.0.0: version "2.1.0" @@ -3687,7 +3687,7 @@ he@1.1.1: resolved "https://registry.yarnpkg.com/he/-/he-1.1.1.tgz#93410fd21b009735151f8868c2f271f3427e23fd" integrity sha1-k0EP0hsAlzUVH4howvJx80J+I/0= -hmac-drbg@^1.0.0: +hmac-drbg@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/hmac-drbg/-/hmac-drbg-1.0.1.tgz#d2745701025a6c775a6c545793ed502fc0c649a1" integrity sha1-0nRXAQJabHdabFRXk+1QL8DGSaE= @@ -4347,7 +4347,7 @@ minimalistic-assert@^1.0.0, minimalistic-assert@^1.0.1: resolved "https://registry.yarnpkg.com/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz#2e194de044626d4a10e7f7fbc00ce73e83e4d5c7" integrity sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A== -minimalistic-crypto-utils@^1.0.0, minimalistic-crypto-utils@^1.0.1: +minimalistic-crypto-utils@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz#f6c00c1c0b082246e5c4d99dfb8c7c083b2b582a" integrity sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo= @@ -6508,9 +6508,9 @@ xtend@^4.0.0, xtend@^4.0.1, xtend@~4.0.1: integrity sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ== y18n@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.0.tgz#95ef94f85ecc81d007c264e190a120f0a3c8566b" - integrity sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w== + version "4.0.1" + resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.1.tgz#8db2b83c31c5d75099bb890b23f3094891e247d4" + integrity sha512-wNcy4NvjMYL8gogWWYAO7ZFWFfHcbdbE57tZO8e4cbpj8tfUcwrwqSl3ad8HxpYWCdXcJUCeKKZS62Av1affwQ== yallist@^3.0.2: version "3.1.1" diff --git a/jest.config.js b/jest.config.js index b16cd9c5e..fecdc23ce 100644 --- a/jest.config.js +++ b/jest.config.js @@ -38,6 +38,8 @@ const config = { statements: 90, }, }, + modulePathIgnorePatterns: ['packages/.*/dist'], + // projects: ['/packages/*'], snapshotSerializers: ['@emotion/jest/serializer'], setupFiles: ['jest-canvas-mock'], transform: { diff --git a/lerna.json b/lerna.json index f53b3edbe..ee2a6bbc2 100644 --- a/lerna.json +++ b/lerna.json @@ -1,6 +1,13 @@ { - "version": "0.6.0-alpha.7", + "version": "0.6.1", "npmClient": "yarn", "useWorkspaces": true, - "packages": ["packages/*"] + "packages": [ + "packages/*" + ], + "command": { + "publish": { + "verifyAccess": false + } + } } diff --git a/package.json b/package.json index 8b7e766a4..a2cbe9f0e 100644 --- a/package.json +++ b/package.json @@ -1,27 +1,33 @@ { "private": true, "scripts": { - "prepare": "lerna run prepare", - "start": "yarn workspace docs start", - "build": "yarn workspace docs build", - "serve": "yarn workspace docs serve --port 8000", + "build": "preconstruct build", + "build:docs": "yarn build && yarn workspace docs build", "clean": "lerna run clean && rimraf packages/*/{dist,rts2_cache*}", - "format": "prettier --write \"**/*.js{,on}\" \"**/*.md\" \"**/*.mdx\"", + "format": "prettier --write \"**/*.{ts,js,json}\" \"**/*.md\" \"**/*.mdx\"", "test": "jest", - "typecheck": "lerna run typecheck", + "typecheck": "tsc --noEmit", "typecheck:tests": "tsc --noEmit -P ./tsconfig.test.json", "logo": "yarn workspace docs logo", - "dev:chrome": "yarn workspace @theme-ui/chrome dev", - "dev:editor": "yarn workspace @theme-ui/editor dev", - "release": "lerna publish from-package --dist-tag next --pre-dist-tag next", - "prerelease": "yarn clean && yarn prepare && yarn typecheck && yarn test --coverage", + "postinstall": "preconstruct dev", + "version:bump": "lerna version", + "version:bump-next": "lerna version prerelease --preid alpha --exact", + "release": "yarn clean && yarn build && auto shipit -v", + "release-manual": "yarn prerelease-manual && lerna publish from-package --dist-tag next --pre-dist-tag next", + "prerelease-manual": "yarn clean && yarn build && yarn typecheck && yarn test --coverage", "bump-version": "lerna version", - "bump-version-next": "lerna version prerelease --preid alpha --exact --force-publish" + "bump-version-next": "lerna version prerelease --preid alpha --exact --force-publish", + "all-contributors:check": "./scripts/all-contributors-check.js", + "all-contributors:add": "npx all-contributors add" }, "workspaces": [ "packages/*" ], "devDependencies": { + "@auto-it/all-contributors": "^10.16.8", + "@auto-it/conventional-commits": "^10.16.8", + "@auto-it/first-time-contributor": "^10.16.8", + "@auto-it/released": "^10.16.8", "@babel/cli": "^7.10.1", "@babel/core": "^7.10.2", "@babel/helper-validator-identifier": "^7.10.1", @@ -35,24 +41,34 @@ "@types/jest": "^26.0.10", "@types/react-dom": "^17.0.0", "@types/react-test-renderer": "^17.0.0", + "auto": "^10.16.8", "babel-jest": "^26.0.1", "babel-preset-gatsby": "^0.12.1", + "egzek": "^1.2.0", "husky": ">=4.0.7", "jest": "^26.0.1", "jest-canvas-mock": "^2.2.0", "jest-mock-console": "^1.0.1", "lerna": "^3.14.1", "lint-staged": "10", - "microbundle": "^0.13.0", "prettier": "^2.2.0", "react-test-renderer": "^17.0.1", "rimraf": "^3.0.2", "ts-jest": "^26.4.4", - "typescript": "^4" + "typescript": "^4", + "@types/node": "^14.14.20", + "@preconstruct/cli": "^2" }, "husky": { "hooks": { "pre-commit": "lint-staged" } - } + }, + "preconstruct": { + "packages": [ + "packages/*", + "!packages/docs" + ] + }, + "name": "@theme-ui/monorepo" } diff --git a/packages/color-modes/package.json b/packages/color-modes/package.json index 2972f7f6f..f820bc69a 100644 --- a/packages/color-modes/package.json +++ b/packages/color-modes/package.json @@ -1,16 +1,12 @@ { "name": "@theme-ui/color-modes", - "version": "0.6.0-alpha.7", - "main": "dist/index.js", - "module": "dist/index.esm.js", - "types": "dist/index.d.ts", + "version": "0.6.1", + "main": "dist/theme-ui-color-modes.cjs.js", + "module": "dist/theme-ui-color-modes.esm.js", + "types": "dist/theme-ui-color-modes.cjs.d.ts", "source": "src/index.tsx", "sideEffects": false, - "scripts": { - "prepare": "microbundle --no-compress", - "watch": "microbundle watch --no-compress", - "typecheck": "tsc --noEmit" - }, + "scripts": {}, "repository": "system-ui/theme-ui", "author": "Brent Jackson", "license": "MIT", @@ -19,8 +15,8 @@ }, "dependencies": { "@emotion/react": "^11.1.1", - "@theme-ui/core": "0.6.0-alpha.7", - "@theme-ui/css": "0.6.0-alpha.7", + "@theme-ui/core": "^0.6.1", + "@theme-ui/css": "0.6.0", "deepmerge": "^4.2.2" }, "peerDependencies": { diff --git a/packages/color-modes/src/custom-properties.ts b/packages/color-modes/src/custom-properties.ts index b0cc3a42d..c46e81c9d 100644 --- a/packages/color-modes/src/custom-properties.ts +++ b/packages/color-modes/src/custom-properties.ts @@ -1,9 +1,7 @@ import { css, get, Theme, __internalGetUseRootStyles } from '@theme-ui/css' -const stripKeyDefault = (key: string) => key.replace('-__default', '') -const toVarName = (key: string) => `--theme-ui-${stripKeyDefault(key)}` -const toVarValue = (key: string, value: string | number) => - `var(${toVarName(key)}, ${value})` +const toVarName = (key: string) => `--theme-ui-${key.replace('-__default', '')}` +const toVarValue = (key: string) => `var(${toVarName(key)})` const join = (...args: (string | undefined)[]) => args.filter(Boolean).join('-') @@ -45,7 +43,7 @@ export const toCustomProperties = ( continue } const val = toPixel(themeKey || key, value) - next[key] = toVarValue(name, val) + next[key] = toVarValue(name) } return next @@ -71,17 +69,19 @@ export const objectToVars = (parent: string, obj: Record) => { // create root styles for color modes export const createColorStyles = (theme: Theme = {}) => { - const use = __internalGetUseRootStyles(theme) - if (!theme.colors || use.rootStyles === false) return {} - if (theme.useCustomProperties === false || !theme.colors.modes) { + const rootStyles = __internalGetUseRootStyles(theme) + const colors = theme.rawColors || theme.colors + + if (!colors || rootStyles.rootStyles === false) return {} + if (theme.useCustomProperties === false) { return css({ - [use.scope]: { + [rootStyles.scope]: { color: 'text', bg: 'background', }, })(theme) } - const { colors, initialColorModeName, printColorModeName } = theme + const { initialColorModeName, printColorModeName } = theme const modes = colors.modes || {} const styles = objectToVars('colors', colors) @@ -89,6 +89,7 @@ export const createColorStyles = (theme: Theme = {}) => { const key = `&.theme-ui-${mode}` styles[key] = objectToVars('colors', modes[mode]) }) + if (printColorModeName) { const mode = printColorModeName === 'initial' || @@ -97,11 +98,10 @@ export const createColorStyles = (theme: Theme = {}) => { : modes[printColorModeName] styles['@media print'] = objectToVars('colors', mode) } - const colorToVarValue = (color: string) => - toVarValue(`colors-${color}`, get(theme, `colors.${color}`)) + const colorToVarValue = (color: string) => toVarValue(`colors-${color}`) return css({ - [use.scope]: { + [rootStyles.scope]: { ...styles, color: colorToVarValue('text'), bg: colorToVarValue('background'), diff --git a/packages/color-modes/src/index.tsx b/packages/color-modes/src/index.tsx index 2c5a584af..31abf9110 100644 --- a/packages/color-modes/src/index.tsx +++ b/packages/color-modes/src/index.tsx @@ -1,22 +1,28 @@ -import React, { Dispatch, SetStateAction } from 'react' -import { jsx, useThemeUI, merge, Context } from '@theme-ui/core' -import { get, Theme } from '@theme-ui/css' -import { Global, ThemeContext as EmotionContext } from '@emotion/react' +import React, { Dispatch, useEffect, useState, SetStateAction } from 'react' +import { + jsx, + useThemeUI, + merge, + __ThemeUIInternalBaseThemeProvider, +} from '@theme-ui/core' +import { get, Theme, __internalGetUseRootStyles } from '@theme-ui/css' +import { Global } from '@emotion/react' + import { toCustomProperties, createColorStyles } from './custom-properties' const STORAGE_KEY = 'theme-ui-color-mode' declare module '@theme-ui/core' { - export interface ContextValue { + export interface ThemeUIContextValue { colorMode?: string - setColorMode?: (colorMode: SetStateAction) => void + setColorMode?: (colorMode: SetStateAction) => void } } const storage = { - get: (init?: string) => { + get: () => { try { - return window.localStorage.getItem(STORAGE_KEY) || init + return window.localStorage.getItem(STORAGE_KEY) } catch (e) { console.warn( 'localStorage is disabled and color mode might not work as expected.', @@ -50,25 +56,48 @@ const getPreferredColorScheme = (): 'dark' | 'light' | null => { return null } +const getModeFromClass = (): string | undefined => { + let mode: string | undefined + if (typeof document !== 'undefined') { + document.documentElement.classList.forEach((className) => { + if (className.startsWith('theme-ui-')) { + mode = className.replace('theme-ui-', '') + } + }) + } + return mode +} + const useColorModeState = (theme: Theme = {}) => { - const [mode, setMode] = React.useState(() => { + let [mode, setMode] = useState(() => { + const modeFromClass = getModeFromClass() + if (modeFromClass) { + return modeFromClass + } + const preferredMode = theme.useColorSchemeMediaQuery !== false && getPreferredColorScheme() - return preferredMode || theme.initialColorModeName || 'default' + return preferredMode || theme.initialColorModeName }) - // read color mode from local storage - React.useEffect(() => { + // on first render, we read the color mode from localStorage and + // clear the class on document element body + useEffect(() => { const stored = theme.useLocalStorage !== false && storage.get() - document.documentElement.classList.remove('theme-ui-' + stored) - document.body.classList.remove('theme-ui-' + stored) + + if (typeof document !== 'undefined') { + document.documentElement.classList.remove('theme-ui-' + stored) + document.body.classList.remove('theme-ui-' + stored) + } if (stored && stored !== mode) { + mode = stored setMode(stored) } }, []) + // when mode changes, we save it to localStorage React.useEffect(() => { if (mode && theme.useLocalStorage !== false) { storage.set(mode) @@ -109,29 +138,25 @@ export function useColorMode(): [ ] } -const applyColorMode = (theme: Theme, mode: string): Theme => { - if (!mode) return theme +const applyColorMode = (theme: Theme, mode: string | undefined): Theme => { + if (!mode) return { ...theme } const modes = get(theme, 'colors.modes', {}) return merge.all({}, theme, { colors: get(modes, mode, {}), }) } -const BodyStyles = ({ theme }: { theme: Theme }) => - jsx(Global, { - styles: () => { - return createColorStyles(theme) - }, - }) - export const ColorModeProvider: React.FC = ({ children }) => { const outer = useThemeUI() const [colorMode, setColorMode] = useColorModeState(outer.theme) - const theme = applyColorMode(outer.theme || {}, colorMode) - const emotionTheme = { ...theme } + const theme = applyColorMode(outer.theme || {}, colorMode) if (theme.useCustomProperties !== false) { - emotionTheme.colors = toCustomProperties(emotionTheme.colors, 'colors') + // TODO: This mutation is less than ideal + // We could save custom properties to `theme.colorVars`, + // But it's infeasible to do this because of how the packages are split. + theme.rawColors = theme.colors + theme.colors = toCustomProperties(theme.colors, 'colors') } const context = { @@ -141,15 +166,25 @@ export const ColorModeProvider: React.FC = ({ children }) => { setColorMode, } + const isTopLevelColorModeProvider = outer.setColorMode === undefined + return jsx( - EmotionContext.Provider, - { value: emotionTheme }, - jsx( - Context.Provider, - { value: context }, - jsx(BodyStyles, { key: 'color-mode', theme }), - children - ) + __ThemeUIInternalBaseThemeProvider, + { context }, + isTopLevelColorModeProvider + ? jsx(Global, { + styles: () => { + return createColorStyles(theme) + }, + }) + : jsx('div', { + className: 'theme-ui__nested-color-mode-provider', + // TODO: This could be refactored a bit. + style: createColorStyles(theme)[ + __internalGetUseRootStyles(theme).scope + ], + }), + children ) } diff --git a/packages/color-modes/test/custom-properties.tsx b/packages/color-modes/test/custom-properties.tsx index e5449d0f0..0967a4bc9 100644 --- a/packages/color-modes/test/custom-properties.tsx +++ b/packages/color-modes/test/custom-properties.tsx @@ -18,20 +18,20 @@ describe('toCustomProperties', () => { expect(result).toEqual({ initialColorModeName: 'light', colors: { - text: 'var(--theme-ui-colors-text, black)', + text: 'var(--theme-ui-colors-text)', }, space: [ - 'var(--theme-ui-space-0, 0px)', - 'var(--theme-ui-space-1, 4px)', - 'var(--theme-ui-space-2, 8px)', - 'var(--theme-ui-space-3, 16px)', - 'var(--theme-ui-space-4, 32px)', + 'var(--theme-ui-space-0)', + 'var(--theme-ui-space-1)', + 'var(--theme-ui-space-2)', + 'var(--theme-ui-space-3)', + 'var(--theme-ui-space-4)', ], fonts: { - body: 'var(--theme-ui-fonts-body, system-ui, sans-serif)', + body: 'var(--theme-ui-fonts-body)', }, fontWeights: { - body: 'var(--theme-ui-fontWeights-body, 400)', + body: 'var(--theme-ui-fontWeights-body)', }, }) }) @@ -69,8 +69,8 @@ describe('createColorStyles', () => { }) expect(styles).toEqual({ body: { - color: 'var(--theme-ui-colors-text, tomato)', - backgroundColor: 'var(--theme-ui-colors-background, white)', + color: 'var(--theme-ui-colors-text)', + backgroundColor: 'var(--theme-ui-colors-background)', '--theme-ui-colors-text': 'tomato', '--theme-ui-colors-background': 'white', '--theme-ui-colors-primary': '#3333ee', @@ -102,8 +102,8 @@ describe('createColorStyles', () => { }) expect(styles).toEqual({ body: { - color: 'var(--theme-ui-colors-text, tomato)', - backgroundColor: 'var(--theme-ui-colors-background, white)', + color: 'var(--theme-ui-colors-text)', + backgroundColor: 'var(--theme-ui-colors-background)', '--theme-ui-colors-text': 'tomato', '--theme-ui-colors-background': 'white', '&.theme-ui-dark': { @@ -130,8 +130,8 @@ describe('createColorStyles', () => { }) expect(styles).toEqual({ html: { - color: 'var(--theme-ui-colors-text, white)', - backgroundColor: 'var(--theme-ui-colors-background, tomato)', + color: 'var(--theme-ui-colors-text)', + backgroundColor: 'var(--theme-ui-colors-background)', '--theme-ui-colors-text': 'white', '--theme-ui-colors-background': 'tomato', '&.theme-ui-light': { @@ -159,8 +159,8 @@ describe('createColorStyles', () => { }) expect(styles).toEqual({ html: { - color: 'var(--theme-ui-colors-text, white)', - backgroundColor: 'var(--theme-ui-colors-background, tomato)', + color: 'var(--theme-ui-colors-text)', + backgroundColor: 'var(--theme-ui-colors-background)', '--theme-ui-colors-text': 'white', '--theme-ui-colors-background': 'tomato', '&.theme-ui-light': { @@ -173,7 +173,7 @@ describe('createColorStyles', () => { test('creates styles at the BODY root while ignoring the root styles prop', () => { const styles = createColorStyles({ - useRootStyles: null, + useRootStyles: undefined, useBodyStyles: true, colors: { text: 'white', @@ -188,8 +188,8 @@ describe('createColorStyles', () => { }) expect(styles).toEqual({ body: { - color: 'var(--theme-ui-colors-text, white)', - backgroundColor: 'var(--theme-ui-colors-background, tomato)', + color: 'var(--theme-ui-colors-text)', + backgroundColor: 'var(--theme-ui-colors-background)', '--theme-ui-colors-text': 'white', '--theme-ui-colors-background': 'tomato', '&.theme-ui-light': { @@ -216,8 +216,8 @@ describe('createColorStyles', () => { }) expect(styles).toEqual({ body: { - color: 'var(--theme-ui-colors-text, white)', - backgroundColor: 'var(--theme-ui-colors-background, tomato)', + color: 'var(--theme-ui-colors-text)', + backgroundColor: 'var(--theme-ui-colors-background)', '--theme-ui-colors-text': 'white', '--theme-ui-colors-background': 'tomato', '&.theme-ui-light': { @@ -249,8 +249,8 @@ describe('createColorStyles', () => { }) expect(styles).toEqual({ body: { - color: 'var(--theme-ui-colors-text, tomato)', - backgroundColor: 'var(--theme-ui-colors-background, white)', + color: 'var(--theme-ui-colors-text)', + backgroundColor: 'var(--theme-ui-colors-background)', '--theme-ui-colors-text': 'tomato', '--theme-ui-colors-background': 'white', '&.theme-ui-dark': { @@ -264,4 +264,21 @@ describe('createColorStyles', () => { }, }) }) + + test('creates styles from color palette', () => { + const styles = createColorStyles({ + colors: { + text: 'tomato', + background: 'white', + }, + }) + expect(styles).toEqual({ + body: { + color: 'var(--theme-ui-colors-text)', + backgroundColor: 'var(--theme-ui-colors-background)', + '--theme-ui-colors-text': 'tomato', + '--theme-ui-colors-background': 'white', + }, + }) + }) }) diff --git a/packages/color-modes/test/index.tsx b/packages/color-modes/test/index.tsx index a27f73c84..56f0e000f 100644 --- a/packages/color-modes/test/index.tsx +++ b/packages/color-modes/test/index.tsx @@ -1,14 +1,21 @@ /** @jsx jsx */ import renderer from 'react-test-renderer' import { render, fireEvent, cleanup, act } from '@testing-library/react' +import { useTheme } from '@emotion/react' import { matchers } from '@emotion/jest' import mockConsole from 'jest-mock-console' -import { jsx, ThemeProvider, useThemeUI } from '@theme-ui/core' +import { + jsx, + ThemeProvider, + ThemeUIContextValue, + useThemeUI, +} from '@theme-ui/core' import { ColorModeProvider, useColorMode, InitializeColorMode } from '../src' import { Theme } from '@theme-ui/css' import { renderJSON } from '@theme-ui/test-utils' const STORAGE_KEY = 'theme-ui-color-mode' +const defaultColorModeName = undefined afterEach(() => { cleanup() @@ -45,7 +52,7 @@ test('renders with color modes', () => { ) }) - expect(mode).toBe('default') + expect(mode).toBe(defaultColorModeName) }) test('renders with initial color mode name', () => { @@ -170,17 +177,19 @@ test('converts color modes to css custom properties', () => { ) expect(tree.getByText('test')).toHaveStyleRule( 'color', - 'var(--theme-ui-colors-text, #000)' + 'var(--theme-ui-colors-text)' ) }) test('uses default mode', () => { let mode + const Button = () => { const [colorMode] = useColorMode() mode = colorMode return @@ -302,20 +315,20 @@ describe('colors inside ThemeProvider', () => { }, } - type MyTheme = typeof theme + type MyTheme = typeof theme & { rawColors: typeof theme.colors } const tree = render(

- lighten((theme as MyTheme).colors.blue.__default, 0.1)(theme), + lighten((theme as MyTheme).rawColors.blue.__default, 0.1)(theme), }}> Hello

diff --git a/packages/color/tsconfig.json b/packages/color/tsconfig.json deleted file mode 100644 index 36be9b168..000000000 --- a/packages/color/tsconfig.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.d.ts"] -} diff --git a/packages/components/package.json b/packages/components/package.json index dec96c77a..e7b2a86c0 100644 --- a/packages/components/package.json +++ b/packages/components/package.json @@ -1,34 +1,29 @@ { "name": "@theme-ui/components", - "version": "0.6.0-alpha.7", - "main": "dist/index.js", - "module": "dist/index.esm.js", + "version": "0.6.1", + "main": "dist/theme-ui-components.cjs.js", + "module": "dist/theme-ui-components.esm.js", "types": "index.d.ts", "sideEffects": false, - "scripts": { - "prepare": "microbundle --no-compress --jsx React.createElement", - "watch": "microbundle watch --no-compress --jsx React.createElement", - "typecheck": "tsc --noEmit" - }, + "scripts": {}, "dependencies": { - "@emotion/react": "^11.1.1", "@emotion/styled": "^11.0.0", "@styled-system/color": "^5.1.2", "@styled-system/should-forward-prop": "^5.1.2", "@styled-system/space": "^5.1.2", - "@theme-ui/css": "0.6.0-alpha.7", - "@types/styled-system": "^5.1.10" + "@theme-ui/css": "^0.6.0", + "@types/styled-system": "^5.1.10", + "@emotion/react": "^11.1.1" }, "peerDependencies": { "react": "^16.14.0 || ^17.0.0" }, - "devDependencies": { - "react": "^17.0.1" - }, "publishConfig": { "access": "public" }, "author": "Brent Jackson ", "license": "MIT", - "gitHead": "621199460fa3bdb0100748441e62517b7529b8c8" + "devDependencies": { + "react": "^17.0.1" + } } diff --git a/packages/components/src/Paragraph.js b/packages/components/src/Paragraph.js index 0f95573df..b129fa6b4 100644 --- a/packages/components/src/Paragraph.js +++ b/packages/components/src/Paragraph.js @@ -14,11 +14,7 @@ export const Paragraph = React.forwardRef(function Paragraph( sx={{ // reset margin by default: avoid relying on user-agent margins (not aware of theme-ui space scale) margin: 0, - // set a max-width: avoid full-page paragraphs - '@media screen and (min-width: 36em)': { - maxWidth: '48rem', - }, - ...sx, + ...sx }} __themeKey="text" __css={{ diff --git a/packages/components/test/__snapshots__/index.js.snap b/packages/components/test/__snapshots__/index.js.snap index 2c291d785..7048a822c 100644 --- a/packages/components/test/__snapshots__/index.js.snap +++ b/packages/components/test/__snapshots__/index.js.snap @@ -1100,12 +1100,6 @@ exports[`Paragraph renders 1`] = ` margin: 0; } -@media screen and (min-width: 36em) { - .emotion-0 { - max-width: 48rem; - } -} -

diff --git a/packages/components/test/index.js b/packages/components/test/index.js index 07404e2da..384bd56b4 100644 --- a/packages/components/test/index.js +++ b/packages/components/test/index.js @@ -67,6 +67,8 @@ const theme = { fontSize: 3, }, block: { + my: 0, + maxWidth: [0, '48em'], variant: 'default', textAlign: 'justify', textAlignLast: 'start', diff --git a/packages/components/tsconfig.json b/packages/components/tsconfig.json deleted file mode 100644 index e8abfbb5e..000000000 --- a/packages/components/tsconfig.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "include": [ - "src/**/*.ts", - "src/**/*.tsx", - "test/**/*.ts", - "test/**/*.tsx", - "index.d.ts" - ] -} diff --git a/packages/core/jsx-dev-runtime/package.json b/packages/core/jsx-dev-runtime/package.json index c1ddbbd4e..cbc073d53 100644 --- a/packages/core/jsx-dev-runtime/package.json +++ b/packages/core/jsx-dev-runtime/package.json @@ -1,9 +1,9 @@ { "name": "@theme-ui/core-jsx-dev-runtime", "source": "../src/jsx-dev-runtime.ts", - "main": "dist/index.js", - "module": "dist/index.esm.js", - "types": "dist/jsx-dev-runtime.d.ts", + "main": "dist/theme-ui-core-jsx-dev-runtime.cjs.js", + "module": "dist/theme-ui-core-jsx-dev-runtime.esm.js", + "types": "dist/theme-ui-core-jsx-dev-runtime.cjs.d.ts", "dependencies": { "@emotion/react": "*", "@theme-ui/parse-props": "*", diff --git a/packages/core/jsx-runtime/package.json b/packages/core/jsx-runtime/package.json index bd75c07bd..097bcf852 100644 --- a/packages/core/jsx-runtime/package.json +++ b/packages/core/jsx-runtime/package.json @@ -1,9 +1,9 @@ { "name": "@theme-ui/core-jsx-runtime", "source": "../src/jsx-runtime.ts", - "main": "dist/index.js", - "module": "dist/index.esm.js", - "types": "dist/jsx-runtime.d.ts", + "main": "dist/theme-ui-core-jsx-runtime.cjs.js", + "module": "dist/theme-ui-core-jsx-runtime.esm.js", + "types": "dist/theme-ui-core-jsx-runtime.cjs.d.ts", "dependencies": { "@emotion/react": "*", "@theme-ui/parse-props": "*", diff --git a/packages/core/package.json b/packages/core/package.json index c2f01b1b6..5086b452c 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,19 +1,12 @@ { "name": "@theme-ui/core", - "version": "0.6.0-alpha.7", + "version": "0.6.1", "source": "src/index.ts", - "main": "dist/index.js", - "module": "dist/index.esm.js", - "types": "dist/index.d.ts", + "main": "dist/theme-ui-core.cjs.js", + "module": "dist/theme-ui-core.esm.js", + "types": "dist/theme-ui-core.cjs.d.ts", "sideEffects": false, - "scripts": { - "prepare": "yarn prepare:index && yarn prepare:jsx-runtime && yarn prepare:jsx-dev-runtime", - "prepare:index": "microbundle --no-compress --tsconfig tsconfig.json", - "prepare:jsx-runtime": "microbundle --no-compress --tsconfig tsconfig.json --cwd jsx-runtime", - "prepare:jsx-dev-runtime": "microbundle --no-compress --tsconfig tsconfig.json --cwd jsx-dev-runtime", - "watch": "microbundle watch --no-compress --tsconfig tsconfig.json", - "typecheck": "tsc --noEmit" - }, + "scripts": {}, "repository": "system-ui/theme-ui", "author": "Brent Jackson", "license": "MIT", @@ -22,8 +15,8 @@ }, "dependencies": { "@emotion/react": "^11.1.1", - "@theme-ui/css": "0.6.0-alpha.7", - "@theme-ui/parse-props": "0.6.0-alpha.7", + "@theme-ui/css": "^0.6.0", + "@theme-ui/parse-props": "^0.6.1", "deepmerge": "^4.2.2" }, "peerDependencies": { @@ -33,5 +26,11 @@ "@types/react": "^17.0.0", "react": "^17.0.1" }, - "gitHead": "621199460fa3bdb0100748441e62517b7529b8c8" + "preconstruct": { + "entrypoints": [ + "index.ts", + "jsx-dev-runtime.ts", + "jsx-runtime.ts" + ] + } } diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index ff7cb312c..ca3dcc7d3 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -33,7 +33,6 @@ export type { VariantProperty, } from '@theme-ui/css' - export { __internalGetUseRootStyles } from '@theme-ui/css' export * from './types' @@ -45,6 +44,12 @@ export const jsx: typeof React.createElement =

( ...children: React.ReactNode[] ): any => emotionJsx(type, parseProps(props), ...children) +/** + * @internal for Babel JSX pragma + * @see https://github.com/system-ui/theme-ui/issues/1603 + */ +export const createElement: unknown = jsx + export declare namespace jsx { export namespace JSX { export interface Element extends ThemeUIJSX.Element {} @@ -65,17 +70,20 @@ export declare namespace jsx { } } -export interface ContextValue { +export interface ThemeUIContextValue { __EMOTION_VERSION__: string theme: Theme } -export const Context = React.createContext({ +/** + * @internal + */ +export const __ThemeUIContext = React.createContext({ __EMOTION_VERSION__, theme: {}, }) -export const useThemeUI = () => React.useContext(Context) +export const useThemeUI = () => React.useContext(__ThemeUIContext) const canUseSymbol = typeof Symbol === 'function' && Symbol.for @@ -109,14 +117,20 @@ function mergeAll(...args: Partial[]) { merge.all = mergeAll -interface BaseProviderProps { - context: ContextValue +export interface __ThemeUIInternalBaseThemeProviderProps { + context: ThemeUIContextValue } -const BaseProvider: React.FC = ({ context, children }) => +/** + * @internal + */ +export const __ThemeUIInternalBaseThemeProvider: React.FC<__ThemeUIInternalBaseThemeProviderProps> = ({ + context, + children, +}) => jsx( EmotionContext.Provider, { value: context.theme }, - jsx(Context.Provider, { + jsx(__ThemeUIContext.Provider, { value: context, children, }) @@ -145,5 +159,5 @@ export function ThemeProvider({ theme, children }: ThemeProviderProps) { ? { ...outer, theme: theme(outer.theme) } : merge.all({}, outer, { theme }) - return jsx(BaseProvider, { context }, children) + return jsx(__ThemeUIInternalBaseThemeProvider, { context }, children) } diff --git a/packages/core/test/index.tsx b/packages/core/test/index.tsx index 019df5387..d67cdefc2 100644 --- a/packages/core/test/index.tsx +++ b/packages/core/test/index.tsx @@ -5,11 +5,12 @@ import { matchers } from '@emotion/jest' import mockConsole from 'jest-mock-console' import { jsx, - Context, + __ThemeUIContext, useThemeUI, merge, ThemeProvider, - ContextValue, + ThemeUIContextValue, + Theme, } from '../src' afterEach(cleanup) @@ -29,13 +30,13 @@ describe('ThemeProvider', () => { test('warns when multiple versions of emotion are installed', () => { const restore = mockConsole() const json = renderJSON( - Conflicting versions - + ) expect(console.warn).toBeCalled() restore() @@ -96,13 +97,13 @@ describe('ThemeProvider', () => { }) test('variants support functional values', () => { - const theme = { + const theme: Theme = { colors: { primary: 'tomato', }, cards: { default: { - border: (t) => `1px solid ${t.colors.primary}`, + border: (t) => `1px solid ${t.colors!.primary}`, }, }, } @@ -333,7 +334,7 @@ describe('merge', () => { describe('useThemeUI', () => { test('returns theme context', () => { - let context: ContextValue | undefined + let context: ThemeUIContextValue | undefined const GetContext = () => { context = useThemeUI() return null diff --git a/packages/core/tsconfig.json b/packages/core/tsconfig.json deleted file mode 100644 index cab60c39c..000000000 --- a/packages/core/tsconfig.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "jsx": "react", - "strictFunctionTypes": true - }, - "include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.d.ts"] -} diff --git a/packages/css/package.json b/packages/css/package.json index e548ed670..213065939 100644 --- a/packages/css/package.json +++ b/packages/css/package.json @@ -1,24 +1,19 @@ { "name": "@theme-ui/css", - "version": "0.6.0-alpha.7", + "version": "0.6.0", "source": "src/index.ts", - "main": "dist/index.js", - "module": "dist/index.esm.js", - "types": "dist/index.d.ts", + "main": "dist/theme-ui-css.cjs.js", + "module": "dist/theme-ui-css.esm.js", "sideEffects": false, - "scripts": { - "prepare": "microbundle --no-compress --tsconfig tsconfig.json", - "watch": "microbundle watch --no-compress --tsconfig tsconfig.json", - "typecheck": "tsc --noEmit" - }, + "scripts": {}, "author": "Brent Jackson", "license": "MIT", "publishConfig": { "access": "public" }, "dependencies": { - "@emotion/react": "^11.1.1", - "csstype": "^3.0.5" + "csstype": "^3.0.5", + "@emotion/react": "^11.1.1" }, "gitHead": "621199460fa3bdb0100748441e62517b7529b8c8" } diff --git a/packages/css/src/types.ts b/packages/css/src/types.ts index 0855f424c..abb69a78b 100644 --- a/packages/css/src/types.ts +++ b/packages/css/src/types.ts @@ -361,18 +361,6 @@ interface OverwriteCSSProperties { * @see https://developer.mozilla.org/docs/Web/CSS/border-top-style */ borderTopStyle?: CSS.Property.BorderTopStyle | string - /** - * The **`border-top-width`** CSS property sets the width of the top border of an element. - * - * **Initial value**: `medium` - * - * | Chrome | Firefox | Safari | Edge | IE | - * | :----: | :-----: | :----: | :----: | :---: | - * | **1** | **1** | **1** | **12** | **4** | - * - * @see https://developer.mozilla.org/docs/Web/CSS/border-top-width - */ - borderTopWidth?: CSS.Property.BorderTopWidth | string /** * The **`border-bottom-style`** CSS property sets the line style of an element's bottom `border`. * @@ -708,6 +696,14 @@ export interface Theme { */ colors?: ColorModesScale + /** + * Colors are transformed into CSS custom properties. + * + * If you need to read their raw values to pass them somewhere where CSS + * custom properties are not supported, use `rawColors`. + */ + rawColors?: ColorModesScale + /** * Styles for elements rendered in MDX can be added to the theme.styles * object. This is the primary, low-level way to control typographic and diff --git a/packages/css/test/errors-and-inference.ts b/packages/css/test/errors-and-inference.ts index ce0f94e6b..597c041bf 100644 --- a/packages/css/test/errors-and-inference.ts +++ b/packages/css/test/errors-and-inference.ts @@ -72,7 +72,7 @@ describe('Theme', () => { declare module 'theme-ui' { interface Theme { - syntaxHighlighting: MySyntaxHighlightingTheme + syntaxHighlighting?: MySyntaxHighlightingTheme } } @@ -82,7 +82,7 @@ describe('Theme', () => { }, } - const syntaxHighlighting = theme.syntaxHighlighting + const syntaxHighlighting = theme.syntaxHighlighting! `).toInfer('syntaxHighlighting', 'MySyntaxHighlightingTheme') }) @@ -140,26 +140,12 @@ describe('ColorMode', () => { const colorMode: ColorMode = {} - const baseColors = [ - colorMode.text, - colorMode.background, - colorMode.primary, - colorMode.secondary, - colorMode.muted, - colorMode.highlight, - colorMode.accent, - ]; - const seriousPink = colorMode.seriousPink if (Array.isArray(seriousPink)) { const [light, medium, dark] = seriousPink } `) - expectedSnippet.toInfer( - 'baseColors', - '((string & {}) | Color[] | NestedScaleDict | undefined)[]' - ) expectedSnippet.toInfer('light', 'Color') expectedSnippet.toInfer('dark', 'Color') }) diff --git a/packages/css/test/index.ts b/packages/css/test/index.ts index ff94a15cb..add6f5cf6 100644 --- a/packages/css/test/index.ts +++ b/packages/css/test/index.ts @@ -1,4 +1,4 @@ -import { css, NestedScale, NestedScaleDict, Theme } from '../src' +import { css, NestedScale, NestedScaleDict, Theme, ThemeUIExtendedCSSProperties } from '../src' const theme: Theme = { colors: { @@ -676,3 +676,20 @@ test('omits empty values', () => { })(theme) ).toStrictEqual({ border: '1px solid black' }) }) + + +test('borderTopWidth accepts number', () => { + expect(css({ + borderTopWidth: 7, + })(theme)).toEqual({ + borderTopWidth: 7, + }) + + expect(css({ + borderTopWidth: 1, + })({ + borderWidths: ['10px', '20px'] + })).toEqual({ + borderTopWidth: '20px', + }) +}) \ No newline at end of file diff --git a/packages/css/test/internal.ts b/packages/css/test/internal.ts index 6cb8b869e..68e116b1c 100644 --- a/packages/css/test/internal.ts +++ b/packages/css/test/internal.ts @@ -29,7 +29,7 @@ describe(__internalGetUseRootStyles, () => { (value) => { const theme: Theme = { useBodyStyles: value, - useRootStyles: null, + useRootStyles: null as any as undefined, } expect(__internalGetUseRootStyles(theme)).toStrictEqual({ diff --git a/packages/css/tsconfig.json b/packages/css/tsconfig.json deleted file mode 100644 index 36be9b168..000000000 --- a/packages/css/tsconfig.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.d.ts"] -} diff --git a/packages/custom-properties/babel.config.js b/packages/custom-properties/babel.config.js deleted file mode 100644 index 46bf5309f..000000000 --- a/packages/custom-properties/babel.config.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('../../babel.config') diff --git a/packages/custom-properties/package.json b/packages/custom-properties/package.json index ebfc63004..dd4830b09 100644 --- a/packages/custom-properties/package.json +++ b/packages/custom-properties/package.json @@ -1,18 +1,13 @@ { "name": "@theme-ui/custom-properties", "description": "Generate CSS custom properties for use with Theme UI", - "version": "0.6.0-alpha.7", + "version": "0.6.1", "source": "src/index.ts", - "main": "dist/index.js", - "module": "dist/index.esm.js", - "types": "dist/index.d.ts", + "main": "dist/theme-ui-custom-properties.cjs.js", + "module": "dist/theme-ui-custom-properties.esm.js", "author": "Alex Page ", "license": "MIT", - "scripts": { - "prepare": "microbundle --no-compress --tsconfig tsconfig.json", - "watch": "microbundle watch --no-compress --tsconfig tsconfig.json", - "typecheck": "tsc --noEmit" - }, + "scripts": {}, "publishConfig": { "access": "public" }, @@ -20,7 +15,7 @@ "pluralize": "^8.0.0" }, "devDependencies": { - "@theme-ui/css": "0.6.0-alpha.7", + "@theme-ui/css": "0.6.0", "@types/pluralize": "^0.0.29" }, "gitHead": "621199460fa3bdb0100748441e62517b7529b8c8" diff --git a/packages/custom-properties/tsconfig.json b/packages/custom-properties/tsconfig.json deleted file mode 100644 index 4082f16a5..000000000 --- a/packages/custom-properties/tsconfig.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "../../tsconfig.json" -} diff --git a/packages/docs/.eslintrc.js b/packages/docs/.eslintrc.js new file mode 100644 index 000000000..2778802ce --- /dev/null +++ b/packages/docs/.eslintrc.js @@ -0,0 +1,6 @@ +module.exports = { + globals: { + __PATH_PREFIX__: true, + }, + extends: `react-app`, +} diff --git a/packages/docs/package.json b/packages/docs/package.json index f610031ce..6e177ee72 100644 --- a/packages/docs/package.json +++ b/packages/docs/package.json @@ -1,8 +1,8 @@ { "private": true, "name": "docs", - "version": "0.6.0-alpha.7", - "main": "index.js", + "version": "0.6.1", + "main": "dist/docs.cjs.js", "author": "Brent Jackson ", "license": "MIT", "scripts": { @@ -16,29 +16,30 @@ "icon": "npx repng src/components/logo.js -d static -f icon.png -w=32 -h=32 --props='{\"size\":32}'" }, "dependencies": { - "@emotion/react": "^11.1.1", + "@emotion/react": "11.1.5", "@emotion/styled": "^11.0.0", "@mdx-js/mdx": "^1.6.22", "@mdx-js/react": "^1.6.22", - "@theme-ui/color": "0.6.0-alpha.7", - "@theme-ui/components": "0.6.0-alpha.7", - "@theme-ui/css": "0.6.0-alpha.7", - "@theme-ui/editor": "0.6.0-alpha.7", - "@theme-ui/match-media": "0.6.0-alpha.7", - "@theme-ui/presets": "0.6.0-alpha.7", - "@theme-ui/prism": "0.6.0-alpha.7", - "@theme-ui/sidenav": "0.6.0-alpha.7", - "@theme-ui/style-guide": "0.6.0-alpha.7", - "@theme-ui/typography": "0.6.0-alpha.7", + "@theme-ui/color": "^0.6.1", + "@theme-ui/components": "^0.6.1", + "@theme-ui/css": "0.6.0", + "@theme-ui/editor": "^0.6.1", + "@theme-ui/match-media": "^0.6.1", + "@theme-ui/presets": "^0.6.1", + "@theme-ui/prism": "^0.6.1", + "@theme-ui/sidenav": "^0.6.1", + "@theme-ui/style-guide": "^0.6.1", + "@theme-ui/typography": "^0.6.1", "copy-to-clipboard": "^3.2.0", + "eslint-config-react-app": "^6.0.0", "gatsby": "^2.26.1", "gatsby-plugin-catch-links": "^2.4.0", "gatsby-plugin-compile-es6-packages": "^2.1.0", - "gatsby-plugin-mdx": "^1.6.0", + "gatsby-plugin-mdx": "^2.0.1", "gatsby-plugin-react-helmet": "^3.4.0", - "gatsby-plugin-theme-ui": "0.6.0-alpha.7", - "gatsby-theme-code-recipes": "0.6.0-alpha.7", - "gatsby-theme-style-guide": "0.6.0-alpha.7", + "gatsby-plugin-theme-ui": "^0.6.0", + "gatsby-theme-code-recipes": "^0.6.0", + "gatsby-theme-style-guide": "^0.6.1", "lodash.merge": "^4.6.1", "lodash.omit": "^4.5.0", "prismjs": "^1.16.0", @@ -48,7 +49,7 @@ "react-live": "^2.1.2", "remark-slug": "^6.0.0", "stringify-object": "^3.3.0", - "theme-ui": "0.6.0-alpha.7", + "theme-ui": "^0.6.1", "typography-theme-alton": "^0.16.19", "typography-theme-anonymous": "^0.15.10", "typography-theme-bootstrap": "^0.16.19", @@ -90,5 +91,8 @@ }, "devDependencies": { "@babel/register": "^7.8.6" + }, + "resolutions": { + "@emotion/react": "11.1.5" } } diff --git a/packages/docs/src/components/code.js b/packages/docs/src/components/code.js index bb5a554a2..20b3a7c60 100644 --- a/packages/docs/src/components/code.js +++ b/packages/docs/src/components/code.js @@ -56,16 +56,27 @@ const scope = { images, } -const transformCode = (src) => `/** @jsx jsx */\n<>${src}` +const stripTrailingNewline = (str) => { + if (typeof str === 'string' && str[str.length - 1] === '\n') { + return str.slice(0, -1) + } + return str +} + +const transformCode = (src) => { + return `/** @jsx jsx */\n<>${src}` +} const liveTheme = { styles: [] } export const LiveCode = ({ children, preview, xray }) => { + const code = stripTrailingNewline(children) + if (preview) { return ( @@ -76,7 +87,7 @@ export const LiveCode = ({ children, preview, xray }) => { return (

{
- + ) diff --git a/packages/docs/src/components/debug-theme.js b/packages/docs/src/components/debug-theme.js index b727cce80..4c3cefcc5 100644 --- a/packages/docs/src/components/debug-theme.js +++ b/packages/docs/src/components/debug-theme.js @@ -1,8 +1,7 @@ /** @jsx jsx */ -import { jsx, Context } from 'theme-ui' -import { useContext } from 'react' +import { jsx, useThemeUI } from 'theme-ui' -export default (props) => { - const theme = useContext(Context) +export default () => { + const theme = useThemeUI() return
 }
diff --git a/packages/docs/src/components/editor-demo.js b/packages/docs/src/components/editor-demo.js
new file mode 100644
index 000000000..7a49646f5
--- /dev/null
+++ b/packages/docs/src/components/editor-demo.js
@@ -0,0 +1,27 @@
+// @ts-check
+
+import React from 'react'
+import { Box } from 'theme-ui'
+import { EditorProvider, Theme } from '@theme-ui/editor'
+
+export function EditorPackageDemo() {
+  return (
+    
+      
+        Demo Box
+      
+      
+      
+      Font Weights
+      
+      Line Heights
+      
+    
+  )
+}
diff --git a/packages/docs/src/components/google-fonts.js b/packages/docs/src/components/google-fonts.js
index 2a20fcce7..4812266d5 100644
--- a/packages/docs/src/components/google-fonts.js
+++ b/packages/docs/src/components/google-fonts.js
@@ -1,6 +1,6 @@
 // for development only
 import { useEffect, useContext } from 'react'
-import { Context } from 'theme-ui'
+import { useThemeUI } from 'theme-ui'
 
 const parseTypographyGoogleFonts = (typography) => {
   const { googleFonts } = typography.options
@@ -15,7 +15,7 @@ const parseTypographyGoogleFonts = (typography) => {
 }
 
 export default (props) => {
-  const { theme } = useContext(Context)
+  const { theme } = useThemeUI()
   if (!theme.typography) return false
   const href = parseTypographyGoogleFonts(theme.typography)
   useEffect(() => {
diff --git a/packages/docs/src/components/layout.js b/packages/docs/src/components/layout.js
index d6e3f40db..301b6e4aa 100644
--- a/packages/docs/src/components/layout.js
+++ b/packages/docs/src/components/layout.js
@@ -29,8 +29,11 @@ const getModeName = (mode) => {
       return 'Deep'
     case 'swiss':
       return 'Swiss'
+    case 'light':
     case 'default':
       return 'Light'
+    case undefined:
+      return '         '
     default:
       return mode
   }
@@ -92,6 +95,7 @@ export default (props) => {
               
diff --git a/packages/editor/src/Theme/FontWeights.tsx b/packages/editor/src/Theme/FontWeights.tsx index 07804045a..09e0b20c5 100644 --- a/packages/editor/src/Theme/FontWeights.tsx +++ b/packages/editor/src/Theme/FontWeights.tsx @@ -21,12 +21,16 @@ const FontWeights = () => { return ( - {Object.keys(fontWeights).map(key => ( + {Object.keys(fontWeights).map((key) => (
- label={key} name={'fontWeights.' + key} - value={fontWeights[key]} + value={ + fontWeights[ + key as keyof typeof fontWeights + ] as CSS.Property.FontWeight + } onChange={onChange(key)} options={weights} /> diff --git a/packages/editor/src/Theme/Fonts.tsx b/packages/editor/src/Theme/Fonts.tsx index 3e803c8cf..681ab9ce2 100644 --- a/packages/editor/src/Theme/Fonts.tsx +++ b/packages/editor/src/Theme/Fonts.tsx @@ -42,12 +42,12 @@ const Fonts = ({ options = defaultFonts }) => { return ( - {Object.keys(fonts).map(key => ( + {Object.keys(fonts).map((key) => (
diff --git a/packages/editor/src/Theme/LineHeights.tsx b/packages/editor/src/Theme/LineHeights.tsx index a7de3332c..410fd24c8 100644 --- a/packages/editor/src/Theme/LineHeights.tsx +++ b/packages/editor/src/Theme/LineHeights.tsx @@ -1,5 +1,6 @@ /** @jsx jsx */ import { jsx, useThemeUI } from 'theme-ui' +import * as CSS from 'csstype' import { Fragment } from 'react' import { Field } from '@theme-ui/components' import { EditorContextValue } from '../types' @@ -27,7 +28,11 @@ const LineHeights = () => { type="number" label={key} name={'lineHeights.' + key} - value={lineHeights[key]} + value={ + lineHeights[ + key as keyof typeof lineHeights + ] as CSS.Property.LineHeight + } onChange={onChange(key)} min={1} max={3} diff --git a/packages/editor/src/Theme/Space.tsx b/packages/editor/src/Theme/Space.tsx index 8c4b595d6..5b756dbe5 100644 --- a/packages/editor/src/Theme/Space.tsx +++ b/packages/editor/src/Theme/Space.tsx @@ -36,7 +36,7 @@ const Space = () => { type="number" label={key} name={'space.' + key} - value={space[key]} + value={space[key as keyof typeof space] as string} onChange={onChange(key)} />
diff --git a/packages/editor/src/index.ts b/packages/editor/src/index.ts index d95dd8e29..bee1c2b50 100644 --- a/packages/editor/src/index.ts +++ b/packages/editor/src/index.ts @@ -4,7 +4,7 @@ export { default as Theme } from './Theme' // theme.styles form export { default as Styles } from './Styles' // sx style object forms -export { default as Sx } from './Sx' +export * as Sx from './Sx' // extra components export { default as ColorPicker } from './ColorPicker' diff --git a/packages/editor/src/types.ts b/packages/editor/src/types.ts index a64800067..f32531b67 100644 --- a/packages/editor/src/types.ts +++ b/packages/editor/src/types.ts @@ -1,5 +1,5 @@ -import { Theme, ContextValue } from 'theme-ui' +import { Theme, ThemeUIContextValue } from '@theme-ui/core' -export interface EditorContextValue extends ContextValue { +export interface EditorContextValue extends ThemeUIContextValue { setTheme: React.Dispatch } diff --git a/packages/editor/test/Theme.tsx b/packages/editor/test/Theme.tsx index 71c4b9183..500cfc183 100644 --- a/packages/editor/test/Theme.tsx +++ b/packages/editor/test/Theme.tsx @@ -1,12 +1,12 @@ import React from 'react' -import renderer from 'react-test-renderer' import { render, fireEvent, cleanup, waitForElement, + act, } from '@testing-library/react' -import { ThemeProvider, useThemeUI, Context } from 'theme-ui' +import { useThemeUI, ThemeUIContextValue, __ThemeUIContext } from 'theme-ui' import { EditorProvider, Theme } from '../src' afterEach(cleanup) @@ -51,8 +51,8 @@ const theme = { } test('edits theme.colors', async () => { - let context - const GetContext = props => { + let context: ThemeUIContextValue + const GetContext = () => { context = useThemeUI() return null } @@ -72,39 +72,45 @@ test('edits theme.colors', async () => { value: '#ff0000', }, }) - expect(context.theme.colors.text).toBe('#ff0000') + expect(context!.theme!.colors!.text).toBe('#ff0000') }) test('edits theme.colors within a color mode', async () => { - let context + let context: ThemeUIContextValue const GetContext = () => { context = useThemeUI() return null } const tree = render( - // TODO: Remove any after @theme-ui/color-mode was transformed to TypeScript - + <__ThemeUIContext.Provider + value={{ + colorMode: 'dark', + theme: {}, + __EMOTION_VERSION__: undefined as any, + }}> - + ) const swatch = tree.getByText('text') fireEvent.click(swatch) const [input] = await waitForElement(() => tree.getAllByPlaceholderText('hex') ) - fireEvent.change(input, { - target: { - value: '#ff0000', - }, + act(() => { + fireEvent.change(input, { + target: { + value: '#ff0000', + }, + }) }) - expect(context.theme.colors.modes.dark.text).toBe('#ff0000') + expect(context!.theme!.colors!.modes!.dark.text).toBe('#ff0000') }) test('edits theme.fontSizes', async () => { - let context + let context: ThemeUIContextValue const GetContext = () => { context = useThemeUI() return null @@ -121,12 +127,12 @@ test('edits theme.fontSizes', async () => { value: '11', }, }) - expect(context.theme.fontSizes[0]).toBe(11) + expect(context!.theme!.fontSizes![0]).toBe(11) }) test('supports non-array theme.fontSizes objects', async () => { - let context - const GetContext = props => { + let context: any + const GetContext = () => { context = useThemeUI() return null } @@ -149,12 +155,12 @@ test('supports non-array theme.fontSizes objects', async () => { value: '11', }, }) - expect(context.theme.fontSizes.small).toBe(11) + expect(context!.theme!.fontSizes!.small!).toBe(11) }) test('renders without a theme', () => { - let context - const GetContext = props => { + let context: ThemeUIContextValue + const GetContext = () => { context = useThemeUI() return null } @@ -168,12 +174,12 @@ test('renders without a theme', () => { ) - expect(context.theme).toEqual({}) + expect(context!.theme).toEqual({}) }) test('edits theme.fontWeights', async () => { - let context - const GetContext = props => { + let context: any + const GetContext = () => { context = useThemeUI() return null } @@ -193,8 +199,8 @@ test('edits theme.fontWeights', async () => { }) test('edits theme.lineHeights', async () => { - let context - const GetContext = props => { + let context: any + const GetContext = () => { context = useThemeUI() return null } @@ -214,8 +220,8 @@ test('edits theme.lineHeights', async () => { }) test('edits theme.fonts', async () => { - let context - const GetContext = props => { + let context: any + const GetContext = () => { context = useThemeUI() return null } @@ -236,8 +242,8 @@ test('edits theme.fonts', async () => { }) test('edits theme.space', async () => { - let context - const GetContext = props => { + let context: any + const GetContext = () => { context = useThemeUI() return null } @@ -253,13 +259,13 @@ test('edits theme.space', async () => { value: '2', }, }) - expect(context.theme.space[0]).toBe(2) - expect(context.theme.space[1]).toBe(4) + expect(context!.theme.space[0]).toBe(2) + expect(context!.theme.space[1]).toBe(4) }) test('supports non-array theme.space objects', async () => { - let context - const GetContext = props => { + let context: any + const GetContext = () => { context = useThemeUI() return null } @@ -282,5 +288,5 @@ test('supports non-array theme.space objects', async () => { value: '3', }, }) - expect(context.theme.space.small).toBe(3) + expect(context!.theme.space.small).toBe(3) }) diff --git a/packages/editor/tsconfig.json b/packages/editor/tsconfig.json deleted file mode 100644 index 9d4e66858..000000000 --- a/packages/editor/tsconfig.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "jsx": "react", - "strict": false, - "strictFunctionTypes": true - }, - "include": ["./src/**/*.ts", "./src/**/*.tsx"] -} diff --git a/packages/gatsby-plugin-theme-ui/package.json b/packages/gatsby-plugin-theme-ui/package.json index d660db56e..89bde5322 100644 --- a/packages/gatsby-plugin-theme-ui/package.json +++ b/packages/gatsby-plugin-theme-ui/package.json @@ -1,12 +1,12 @@ { "name": "gatsby-plugin-theme-ui", - "version": "0.6.0-alpha.7", - "main": "index.js", + "version": "0.6.0", + "main": "dist/gatsby-plugin-theme-ui.cjs.js", "author": "Brent Jackson", "license": "MIT", "peerDependencies": { - "gatsby": "^2.13.1", - "theme-ui": "^0.5.0-alpha.0" + "gatsby": ">=2", + "theme-ui": ">=0.6.0" }, "keywords": [ "gatsby", diff --git a/packages/gatsby-theme-code-recipes/package.json b/packages/gatsby-theme-code-recipes/package.json index 96477ec20..4d0e7c640 100644 --- a/packages/gatsby-theme-code-recipes/package.json +++ b/packages/gatsby-theme-code-recipes/package.json @@ -1,10 +1,10 @@ { "name": "gatsby-theme-code-recipes", - "version": "0.6.0-alpha.7", - "main": "index.js", + "version": "0.6.0", + "main": "dist/gatsby-theme-code-recipes.cjs.js", "license": "MIT", "peerDependencies": { - "gatsby": "^2.13.1", + "gatsby": ">=2", "react": "^16.14.0 || ^17.0.0", "react-dom": "^16.14.0 || ^17.0.0" }, diff --git a/packages/gatsby-theme-code-recipes/index.js b/packages/gatsby-theme-code-recipes/src/index.js similarity index 100% rename from packages/gatsby-theme-code-recipes/index.js rename to packages/gatsby-theme-code-recipes/src/index.js diff --git a/packages/gatsby-theme-code-recipes/src/query.js b/packages/gatsby-theme-code-recipes/src/query.js index 0c24ee601..24dfdab74 100644 --- a/packages/gatsby-theme-code-recipes/src/query.js +++ b/packages/gatsby-theme-code-recipes/src/query.js @@ -15,7 +15,7 @@ export const query = graphql` } ` -export default (props) => { +export default function Query(props) { const { name, slug, id, body, snippets } = props.data.recipe const children = diff --git a/packages/gatsby-theme-style-guide/package.json b/packages/gatsby-theme-style-guide/package.json index b4051836f..34d305855 100644 --- a/packages/gatsby-theme-style-guide/package.json +++ b/packages/gatsby-theme-style-guide/package.json @@ -1,10 +1,10 @@ { "name": "gatsby-theme-style-guide", - "version": "0.6.0-alpha.7", - "main": "index.js", + "version": "0.6.1", + "main": "dist/gatsby-theme-style-guide.cjs.js", "license": "MIT", "peerDependencies": { - "gatsby": "^2.13.1", + "gatsby": ">=2", "react": "^16.14.0 || ^17.0.0", "react-dom": "^16.14.0 || ^17.0.0" }, @@ -14,8 +14,8 @@ "react-dom": "^17.0.1" }, "dependencies": { - "@theme-ui/style-guide": "0.6.0-alpha.7", - "theme-ui": "0.6.0-alpha.7" + "@theme-ui/style-guide": "^0.6.1", + "theme-ui": "^0.6.1" }, "gitHead": "621199460fa3bdb0100748441e62517b7529b8c8" } diff --git a/packages/gatsby-theme-style-guide/src/colors.js b/packages/gatsby-theme-style-guide/src/colors.js index effa2555e..3878a3b9e 100644 --- a/packages/gatsby-theme-style-guide/src/colors.js +++ b/packages/gatsby-theme-style-guide/src/colors.js @@ -2,7 +2,7 @@ import React from 'react' import { Themed } from 'theme-ui' import { ColorPalette } from '@theme-ui/style-guide' -export default () => { +export default function ColorsDemo() { return (
Colors diff --git a/packages/gatsby-theme-style-guide/src/header.js b/packages/gatsby-theme-style-guide/src/header.js index beeafd952..d6b6808e4 100644 --- a/packages/gatsby-theme-style-guide/src/header.js +++ b/packages/gatsby-theme-style-guide/src/header.js @@ -1,8 +1,10 @@ import React from 'react' import { Themed } from 'theme-ui' -export default () => ( -
- Style Guide -
-) +export default function Header() { + return ( +
+ Style Guide +
+ ) +} diff --git a/packages/gatsby-theme-style-guide/index.js b/packages/gatsby-theme-style-guide/src/index.js similarity index 100% rename from packages/gatsby-theme-style-guide/index.js rename to packages/gatsby-theme-style-guide/src/index.js diff --git a/packages/gatsby-theme-style-guide/src/template.js b/packages/gatsby-theme-style-guide/src/template.js index 45fd9eb4c..c6b5d3974 100644 --- a/packages/gatsby-theme-style-guide/src/template.js +++ b/packages/gatsby-theme-style-guide/src/template.js @@ -4,10 +4,12 @@ import Header from './header' import Typography from './typography' import Colors from './colors' -export default (props) => ( - -
- - - -) +export default function Template() { + return ( + +
+ + + + ) +} diff --git a/packages/gatsby-theme-ui-layout/package.json b/packages/gatsby-theme-ui-layout/package.json index 693517859..92a0ab3d8 100644 --- a/packages/gatsby-theme-ui-layout/package.json +++ b/packages/gatsby-theme-ui-layout/package.json @@ -1,13 +1,12 @@ { "name": "gatsby-theme-ui-layout", - "version": "0.6.0-alpha.7", - "main": "index.js", + "version": "0.6.0", + "main": "dist/gatsby-theme-ui-layout.cjs.js", "repository": "system-ui/theme-ui", "peerDependencies": { - "gatsby": "^2.13.1", + "gatsby": ">=2", "react": "^16.14.0 || ^17.0.0", "react-dom": "^16.14.0 || ^17.0.0" }, - "license": "MIT", - "gitHead": "621199460fa3bdb0100748441e62517b7529b8c8" + "license": "MIT" } diff --git a/packages/match-media/package.json b/packages/match-media/package.json index c49262a44..bd763f283 100644 --- a/packages/match-media/package.json +++ b/packages/match-media/package.json @@ -1,30 +1,25 @@ { "name": "@theme-ui/match-media", - "version": "0.6.0-alpha.7", + "version": "0.6.1", "description": "React hooks for theme-ui breakpoints", "source": "src/index.ts", - "main": "dist/index.js", - "module": "dist/index.esm.js", - "types": "dist/index.d.ts", + "main": "dist/theme-ui-match-media.cjs.js", + "module": "dist/theme-ui-match-media.esm.js", "author": "Brent Jackson ", "license": "MIT", "repository": "system-ui/theme-ui", - "scripts": { - "prepare": "microbundle --no-compress --tsconfig tsconfig.json", - "watch": "microbundle watch --no-compress --tsconfig tsconfig.json", - "typecheck": "tsc --noEmit" - }, + "scripts": {}, "publishConfig": { "access": "public" }, "devDependencies": { - "@theme-ui/core": "0.6.0-alpha.7", - "@theme-ui/css": "0.6.0-alpha.7", + "@theme-ui/core": "^0.6.1", + "@theme-ui/css": "0.6.0", "react": "^17.0.1" }, "peerDependencies": { - "@theme-ui/core": "^0.5.0-alpha.0", - "@theme-ui/css": "^0.5.0-alpha.0", + "@theme-ui/core": ">=0.6.0", + "@theme-ui/css": ">=0.6.0", "react": "^16.14.0 || ^17.0.0" }, "gitHead": "621199460fa3bdb0100748441e62517b7529b8c8" diff --git a/packages/match-media/tsconfig.json b/packages/match-media/tsconfig.json deleted file mode 100644 index 4082f16a5..000000000 --- a/packages/match-media/tsconfig.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "../../tsconfig.json" -} diff --git a/packages/mdx/package.json b/packages/mdx/package.json index 06324da0b..fb03b1f66 100644 --- a/packages/mdx/package.json +++ b/packages/mdx/package.json @@ -1,22 +1,17 @@ { "name": "@theme-ui/mdx", - "version": "0.6.0-alpha.7", + "version": "0.6.1", "source": "src/index.ts", - "main": "dist/index.js", - "module": "dist/index.esm.js", - "types": "dist/index.d.ts", + "main": "dist/theme-ui-mdx.cjs.js", + "module": "dist/theme-ui-mdx.esm.js", "sideEffects": false, - "scripts": { - "prepare": "microbundle --no-compress --tsconfig tsconfig.json", - "watch": "microbundle watch --no-compress --tsconfig tsconfig.json", - "typecheck": "tsc --noEmit" - }, + "scripts": {}, "dependencies": { - "@emotion/react": "^11.1.1", "@emotion/styled": "^11.0.0", "@mdx-js/react": "^1.6.22", - "@theme-ui/core": "0.6.0-alpha.7", - "@theme-ui/css": "0.6.0-alpha.7" + "@theme-ui/core": "^0.6.1", + "@theme-ui/css": "^0.6.0", + "@emotion/react": "^11.1.1" }, "devDependencies": { "react": "^17.0.1" diff --git a/packages/mdx/src/index.ts b/packages/mdx/src/index.ts index 5573dd1eb..4eb757b10 100644 --- a/packages/mdx/src/index.ts +++ b/packages/mdx/src/index.ts @@ -8,6 +8,8 @@ import { HTMLAttributes, ElementType, ComponentProps, + createElement, + useEffect, } from 'react' import styled, { StyledComponent } from '@emotion/styled' import { MDXProvider as _MDXProvider, useMDXComponents } from '@mdx-js/react' @@ -156,12 +158,34 @@ export const Themed: ThemedDiv & ThemedComponentsDict = styled('div')( themed('div') ) as ThemedDiv & ThemedComponentsDict +/** + * @deprecated since 0.6.0. + * + * `Styled` was renamed to `Themed` to avoid confusion with styled components. + */ +export const Styled: ThemedDiv & ThemedComponentsDict = styled('div')( + themed('div') +) as ThemedDiv & ThemedComponentsDict + +const warnStyled = (tag: keyof IntrinsicSxElements): FC => (props) => { + useEffect(() => { + if (process.env.NODE_ENV !== 'production') { + console.warn( + '[theme-ui] The Styled component from "@theme-ui/mdx" is deprecated and will be removed in a future version. It has been renamed to Themed with the same API.' + ) + } + }, []) + return createElement(alias(tag), props) +} + export const components = {} as ThemedComponentsDict tags.forEach((tag) => { // fixme? components[tag] = styled(alias(tag))(themed(tag)) as any Themed[tag] = components[tag] as any + + Styled[tag] = styled(warnStyled(tag))(themed(tag)) as any }) const createComponents = (comps: MDXProviderComponents) => { diff --git a/packages/mdx/test/index.tsx b/packages/mdx/test/index.tsx index b3b7afc2f..3f0f6cd90 100644 --- a/packages/mdx/test/index.tsx +++ b/packages/mdx/test/index.tsx @@ -3,10 +3,11 @@ import React from 'react' import { mdx } from '@mdx-js/react' import { render } from '@testing-library/react' import { matchers } from '@emotion/jest' +import mockConsole from 'jest-mock-console' import { ThemeProvider } from '@theme-ui/core' import { renderJSON } from '@theme-ui/test-utils' -import { themed, Themed, components, MDXProvider } from '../src' +import { themed, Themed, Styled, components, MDXProvider } from '../src' expect.extend(matchers) @@ -191,3 +192,52 @@ test('table columns align', () => { expect(tree.getByText('TextCenter')).toHaveStyleRule('text-align', 'center') expect(tree.getByText('TextRight')).toHaveStyleRule('text-align', 'right') }) + +test('Warn deprecated Styled', () => { + const restore = mockConsole() + const tree = render( + + + styled + + + )! + const code = tree.getByText('styled') + expect(code).toMatchInlineSnapshot(` + + styled + +`) + expect(console.warn).toHaveBeenCalled() + restore() +}) + +test('Deprecated Styled test', () => { + const json = renderJSON( + + + + H1 + + + + )! + expect(json.type).toBe('h1') + expect(json).toHaveStyleRule('color', 'tomato') +}) \ No newline at end of file diff --git a/packages/mdx/tsconfig.json b/packages/mdx/tsconfig.json deleted file mode 100644 index 36be9b168..000000000 --- a/packages/mdx/tsconfig.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.d.ts"] -} diff --git a/packages/parse-props/package.json b/packages/parse-props/package.json index 6f830d3fb..f6d0ea542 100644 --- a/packages/parse-props/package.json +++ b/packages/parse-props/package.json @@ -1,13 +1,14 @@ { "name": "@theme-ui/parse-props", - "version": "0.6.0-alpha.7", + "description": "Internal package — You don't want to consume this directly.", + "version": "0.6.1", "source": "src/index.ts", - "main": "dist/index.js", - "module": "dist/index.esm.js", - "types": "dist/index.d.ts", + "main": "dist/theme-ui-parse-props.cjs.js", + "module": "dist/theme-ui-parse-props.esm.js", + "types": "dist/theme-ui-parse-props.cjs.d.ts", "sideEffects": false, "scripts": { - "prepare": "microbundle --no-compress --tsconfig tsconfig.json", + "build": "microbundle --no-compress --tsconfig tsconfig.json", "watch": "microbundle watch --no-compress --tsconfig tsconfig.json", "typecheck": "tsc --noEmit" }, @@ -18,7 +19,7 @@ }, "dependencies": { "@emotion/react": "^11.1.1", - "@theme-ui/css": "0.6.0-alpha.7" + "@theme-ui/css": "0.6.0" }, "peerDependencies": { "react": "^16.14.0 || ^17.0.0" diff --git a/packages/parse-props/tsconfig.json b/packages/parse-props/tsconfig.json deleted file mode 100644 index 9d4e66858..000000000 --- a/packages/parse-props/tsconfig.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "jsx": "react", - "strict": false, - "strictFunctionTypes": true - }, - "include": ["./src/**/*.ts", "./src/**/*.tsx"] -} diff --git a/packages/preset-base/package.json b/packages/preset-base/package.json index 3324886dd..a67faa9e7 100644 --- a/packages/preset-base/package.json +++ b/packages/preset-base/package.json @@ -1,17 +1,12 @@ { "name": "@theme-ui/preset-base", - "version": "0.6.0-alpha.7", - "main": "dist/index.js", - "module": "dist/index.esm.js", + "version": "0.6.0", + "main": "dist/theme-ui-preset-base.cjs.js", + "module": "dist/theme-ui-preset-base.esm.js", "author": "Brent Jackson", "license": "MIT", "repository": "system-ui/theme-ui", - "scripts": { - "prepare": "microbundle --no-compress --tsconfig tsconfig.json", - "watch": "microbundle watch --no-compress --tsconfig tsconfig.json", - "typecheck": "tsc --noEmit" - }, - "types": "dist/index.d.ts", + "scripts": {}, "source": "src/index.ts", "publishConfig": { "access": "public" diff --git a/packages/preset-base/tsconfig.json b/packages/preset-base/tsconfig.json deleted file mode 100644 index 4082f16a5..000000000 --- a/packages/preset-base/tsconfig.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "../../tsconfig.json" -} diff --git a/packages/preset-bootstrap/package.json b/packages/preset-bootstrap/package.json index 8eddd12f4..43b9bb876 100644 --- a/packages/preset-bootstrap/package.json +++ b/packages/preset-bootstrap/package.json @@ -1,17 +1,13 @@ { "name": "@theme-ui/preset-bootstrap", - "version": "0.6.0-alpha.7", - "main": "dist/index.js", - "module": "dist/index.esm.js", - "types": "dist/index.d.ts", + "version": "0.6.0", + "main": "dist/theme-ui-preset-bootstrap.cjs.js", + "module": "dist/theme-ui-preset-bootstrap.esm.js", + "types": "dist/theme-ui-preset-bootstrap.cjs.d.ts", "source": "src/index.ts", "author": "Brent Jackson", "license": "MIT", - "scripts": { - "prepare": "microbundle --no-compress", - "watch": "microbundle watch --no-compress", - "typecheck": "tsc --noEmit" - }, + "scripts": {}, "publishConfig": { "access": "public" }, diff --git a/packages/preset-bootstrap/tsconfig.json b/packages/preset-bootstrap/tsconfig.json deleted file mode 100644 index 4082f16a5..000000000 --- a/packages/preset-bootstrap/tsconfig.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "../../tsconfig.json" -} diff --git a/packages/preset-bulma/babel.config.js b/packages/preset-bulma/babel.config.js deleted file mode 100644 index 46bf5309f..000000000 --- a/packages/preset-bulma/babel.config.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('../../babel.config') diff --git a/packages/preset-bulma/package.json b/packages/preset-bulma/package.json index faa7eb61e..c078def7c 100644 --- a/packages/preset-bulma/package.json +++ b/packages/preset-bulma/package.json @@ -1,19 +1,14 @@ { "name": "@theme-ui/preset-bulma", - "version": "0.6.0-alpha.7", - "main": "dist/index.js", - "module": "dist/index.esm.js", - "types": "dist/index.d.ts", + "version": "0.6.0", + "main": "dist/theme-ui-preset-bulma.cjs.js", + "module": "dist/theme-ui-preset-bulma.esm.js", "source": "src/index.ts", "author": "Brent Jackson", "license": "MIT", - "scripts": { - "prepare": "microbundle --no-compress", - "watch": "microbundle watch --no-compress", - "typecheck": "tsc --noEmit" - }, + "scripts": {}, "dependencies": { - "@theme-ui/preset-base": "0.6.0-alpha.7" + "@theme-ui/preset-base": "^0.6.0" }, "publishConfig": { "access": "public" diff --git a/packages/preset-bulma/tsconfig.json b/packages/preset-bulma/tsconfig.json deleted file mode 100644 index 4082f16a5..000000000 --- a/packages/preset-bulma/tsconfig.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "../../tsconfig.json" -} diff --git a/packages/preset-dark/babel.config.js b/packages/preset-dark/babel.config.js deleted file mode 100644 index 46bf5309f..000000000 --- a/packages/preset-dark/babel.config.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('../../babel.config') diff --git a/packages/preset-dark/package.json b/packages/preset-dark/package.json index eb3af63b9..ab59c3e4f 100644 --- a/packages/preset-dark/package.json +++ b/packages/preset-dark/package.json @@ -1,17 +1,13 @@ { "name": "@theme-ui/preset-dark", - "version": "0.6.0-alpha.7", - "main": "dist/index.js", - "module": "dist/index.esm.js", - "types": "dist/index.d.ts", + "version": "0.6.0", + "main": "dist/theme-ui-preset-dark.cjs.js", + "module": "dist/theme-ui-preset-dark.esm.js", + "types": "dist/theme-ui-preset-dark.cjs.d.ts", "source": "src/index.ts", "author": "Brent Jackson", "license": "MIT", - "scripts": { - "prepare": "microbundle --no-compress", - "watch": "microbundle watch --no-compress", - "typecheck": "tsc --noEmit" - }, + "scripts": {}, "publishConfig": { "access": "public" }, diff --git a/packages/preset-dark/tsconfig.json b/packages/preset-dark/tsconfig.json deleted file mode 100644 index 4082f16a5..000000000 --- a/packages/preset-dark/tsconfig.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "../../tsconfig.json" -} diff --git a/packages/preset-deep/babel.config.js b/packages/preset-deep/babel.config.js deleted file mode 100644 index 46bf5309f..000000000 --- a/packages/preset-deep/babel.config.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('../../babel.config') diff --git a/packages/preset-deep/package.json b/packages/preset-deep/package.json index 10e1113a1..4fa87035b 100644 --- a/packages/preset-deep/package.json +++ b/packages/preset-deep/package.json @@ -1,17 +1,12 @@ { "name": "@theme-ui/preset-deep", - "version": "0.6.0-alpha.7", - "main": "dist/index.js", - "module": "dist/index.esm.js", - "types": "dist/index.d.ts", + "version": "0.6.0", + "main": "dist/theme-ui-preset-deep.cjs.js", + "module": "dist/theme-ui-preset-deep.esm.js", "source": "src/index.ts", "author": "Brent Jackson", "license": "MIT", - "scripts": { - "prepare": "microbundle --no-compress", - "watch": "microbundle watch --no-compress", - "typecheck": "tsc --noEmit" - }, + "scripts": {}, "publishConfig": { "access": "public" }, diff --git a/packages/preset-deep/tsconfig.json b/packages/preset-deep/tsconfig.json deleted file mode 100644 index 4082f16a5..000000000 --- a/packages/preset-deep/tsconfig.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "../../tsconfig.json" -} diff --git a/packages/preset-funk/babel.config.js b/packages/preset-funk/babel.config.js deleted file mode 100644 index 46bf5309f..000000000 --- a/packages/preset-funk/babel.config.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('../../babel.config') diff --git a/packages/preset-funk/package.json b/packages/preset-funk/package.json index 87323eef0..cd77508a8 100644 --- a/packages/preset-funk/package.json +++ b/packages/preset-funk/package.json @@ -1,19 +1,14 @@ { "name": "@theme-ui/preset-funk", - "version": "0.6.0-alpha.7", - "main": "dist/index.js", - "module": "dist/index.esm.js", - "types": "dist/index.d.ts", + "version": "0.6.0", + "main": "dist/theme-ui-preset-funk.cjs.js", + "module": "dist/theme-ui-preset-funk.esm.js", "source": "src/index.ts", "author": "Brent Jackson", "license": "MIT", - "scripts": { - "prepare": "microbundle --no-compress", - "watch": "microbundle watch --no-compress", - "typecheck": "tsc --noEmit" - }, + "scripts": {}, "dependencies": { - "@theme-ui/preset-base": "0.6.0-alpha.7" + "@theme-ui/preset-base": "^0.6.0" }, "publishConfig": { "access": "public" diff --git a/packages/preset-funk/tsconfig.json b/packages/preset-funk/tsconfig.json deleted file mode 100644 index 4082f16a5..000000000 --- a/packages/preset-funk/tsconfig.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "../../tsconfig.json" -} diff --git a/packages/preset-future/babel.config.js b/packages/preset-future/babel.config.js deleted file mode 100644 index 46bf5309f..000000000 --- a/packages/preset-future/babel.config.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('../../babel.config') diff --git a/packages/preset-future/package.json b/packages/preset-future/package.json index 8dd18cb03..8e79ed402 100644 --- a/packages/preset-future/package.json +++ b/packages/preset-future/package.json @@ -1,19 +1,14 @@ { "name": "@theme-ui/preset-future", - "version": "0.6.0-alpha.7", - "main": "dist/index.js", - "module": "dist/index.esm.js", - "types": "dist/index.d.ts", + "version": "0.6.0", + "main": "dist/theme-ui-preset-future.cjs.js", + "module": "dist/theme-ui-preset-future.esm.js", "source": "src/index.ts", "author": "Brent Jackson", "license": "MIT", - "scripts": { - "prepare": "microbundle --no-compress", - "watch": "microbundle watch --no-compress", - "typecheck": "tsc --noEmit" - }, + "scripts": {}, "dependencies": { - "@theme-ui/preset-base": "0.6.0-alpha.7" + "@theme-ui/preset-base": "^0.6.0" }, "publishConfig": { "access": "public" diff --git a/packages/preset-future/tsconfig.json b/packages/preset-future/tsconfig.json deleted file mode 100644 index 4082f16a5..000000000 --- a/packages/preset-future/tsconfig.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "../../tsconfig.json" -} diff --git a/packages/preset-polaris/babel.config.js b/packages/preset-polaris/babel.config.js deleted file mode 100644 index 46bf5309f..000000000 --- a/packages/preset-polaris/babel.config.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('../../babel.config') diff --git a/packages/preset-polaris/package.json b/packages/preset-polaris/package.json index 3b317a889..b0a422827 100644 --- a/packages/preset-polaris/package.json +++ b/packages/preset-polaris/package.json @@ -1,19 +1,14 @@ { "name": "@theme-ui/preset-polaris", - "version": "0.6.0-alpha.7", - "main": "dist/index.js", - "module": "dist/index.esm.js", + "version": "0.6.0", + "main": "dist/theme-ui-preset-polaris.cjs.js", + "module": "dist/theme-ui-preset-polaris.esm.js", "source": "src/index.ts", - "types": "dist/index.d.ts", "author": "Yuraima Estevez", "license": "MIT", - "scripts": { - "prepare": "microbundle --no-compress", - "watch": "microbundle watch --no-compress", - "typecheck": "tsc --noEmit" - }, + "scripts": {}, "dependencies": { - "@theme-ui/preset-base": "0.6.0-alpha.7" + "@theme-ui/preset-base": "^0.6.0" }, "publishConfig": { "access": "public" diff --git a/packages/preset-polaris/tsconfig.json b/packages/preset-polaris/tsconfig.json deleted file mode 100644 index 4082f16a5..000000000 --- a/packages/preset-polaris/tsconfig.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "../../tsconfig.json" -} diff --git a/packages/preset-roboto/babel.config.js b/packages/preset-roboto/babel.config.js deleted file mode 100644 index 46bf5309f..000000000 --- a/packages/preset-roboto/babel.config.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('../../babel.config') diff --git a/packages/preset-roboto/package.json b/packages/preset-roboto/package.json index 43c58ffe8..eb086ba0d 100644 --- a/packages/preset-roboto/package.json +++ b/packages/preset-roboto/package.json @@ -1,19 +1,15 @@ { "name": "@theme-ui/preset-roboto", - "version": "0.6.0-alpha.7", - "main": "dist/index.js", - "module": "dist/index.esm.js", - "types": "dist/index.d.ts", + "version": "0.6.0", + "main": "dist/theme-ui-preset-roboto.cjs.js", + "module": "dist/theme-ui-preset-roboto.esm.js", + "types": "dist/theme-ui-preset-roboto.cjs.d.ts", "source": "src/index.ts", "author": "Brent Jackson", "license": "MIT", - "scripts": { - "prepare": "microbundle --no-compress", - "watch": "microbundle watch --no-compress", - "typecheck": "tsc --noEmit" - }, + "scripts": {}, "dependencies": { - "@theme-ui/preset-base": "0.6.0-alpha.7" + "@theme-ui/preset-base": "^0.6.0" }, "publishConfig": { "access": "public" diff --git a/packages/preset-roboto/tsconfig.json b/packages/preset-roboto/tsconfig.json deleted file mode 100644 index 4082f16a5..000000000 --- a/packages/preset-roboto/tsconfig.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "../../tsconfig.json" -} diff --git a/packages/preset-sketchy/babel.config.js b/packages/preset-sketchy/babel.config.js deleted file mode 100644 index 46bf5309f..000000000 --- a/packages/preset-sketchy/babel.config.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('../../babel.config') diff --git a/packages/preset-sketchy/package.json b/packages/preset-sketchy/package.json index 7086cdd8e..f8566afdc 100644 --- a/packages/preset-sketchy/package.json +++ b/packages/preset-sketchy/package.json @@ -1,22 +1,18 @@ { "name": "@theme-ui/preset-sketchy", - "version": "0.6.0-alpha.7", - "main": "dist/index.js", - "module": "dist/index.esm.js", - "types": "dist/index.d.ts", + "version": "0.6.1", + "main": "dist/theme-ui-preset-sketchy.cjs.js", + "module": "dist/theme-ui-preset-sketchy.esm.js", + "types": "dist/theme-ui-preset-sketchy.cjs.d.ts", "source": "src/index.ts", "author": "Aleksandra Sikora", "license": "MIT", - "scripts": { - "prepare": "microbundle --no-compress", - "watch": "microbundle watch --no-compress", - "typecheck": "tsc --noEmit" - }, + "scripts": {}, "publishConfig": { "access": "public" }, "dependencies": { - "@theme-ui/css": "0.6.0-alpha.7" + "@theme-ui/css": "0.6.0" }, "gitHead": "621199460fa3bdb0100748441e62517b7529b8c8" } diff --git a/packages/preset-sketchy/tsconfig.json b/packages/preset-sketchy/tsconfig.json deleted file mode 100644 index 4082f16a5..000000000 --- a/packages/preset-sketchy/tsconfig.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "../../tsconfig.json" -} diff --git a/packages/preset-swiss/babel.config.js b/packages/preset-swiss/babel.config.js deleted file mode 100644 index 46bf5309f..000000000 --- a/packages/preset-swiss/babel.config.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('../../babel.config') diff --git a/packages/preset-swiss/package.json b/packages/preset-swiss/package.json index b54a2cb56..9098497c8 100644 --- a/packages/preset-swiss/package.json +++ b/packages/preset-swiss/package.json @@ -1,17 +1,13 @@ { "name": "@theme-ui/preset-swiss", - "version": "0.6.0-alpha.7", - "main": "dist/index.js", - "module": "dist/index.esm.js", - "types": "dist/index.d.ts", + "version": "0.6.0", + "main": "dist/theme-ui-preset-swiss.cjs.js", + "module": "dist/theme-ui-preset-swiss.esm.js", + "types": "dist/theme-ui-preset-swiss.cjs.d.ts", "source": "src/index.ts", "author": "Brent Jackson", "license": "MIT", - "scripts": { - "prepare": "microbundle --no-compress", - "watch": "microbundle watch --no-compress", - "typecheck": "tsc --noEmit" - }, + "scripts": {}, "publishConfig": { "access": "public" }, diff --git a/packages/preset-swiss/tsconfig.json b/packages/preset-swiss/tsconfig.json deleted file mode 100644 index 4082f16a5..000000000 --- a/packages/preset-swiss/tsconfig.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "../../tsconfig.json" -} diff --git a/packages/preset-system/babel.config.js b/packages/preset-system/babel.config.js deleted file mode 100644 index 46bf5309f..000000000 --- a/packages/preset-system/babel.config.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('../../babel.config') diff --git a/packages/preset-system/package.json b/packages/preset-system/package.json index 2649c4ed9..118897aa9 100644 --- a/packages/preset-system/package.json +++ b/packages/preset-system/package.json @@ -1,17 +1,13 @@ { "name": "@theme-ui/preset-system", - "version": "0.6.0-alpha.7", - "main": "dist/index.js", - "module": "dist/index.esm.js", - "types": "dist/index.d.ts", + "version": "0.6.0", + "main": "dist/theme-ui-preset-system.cjs.js", + "module": "dist/theme-ui-preset-system.esm.js", + "types": "dist/theme-ui-preset-system.cjs.d.ts", "source": "src/index.ts", "author": "Brent Jackson", "license": "MIT", - "scripts": { - "prepare": "microbundle --no-compress", - "watch": "microbundle watch --no-compress", - "typecheck": "tsc --noEmit" - }, + "scripts": {}, "publishConfig": { "access": "public" }, diff --git a/packages/preset-system/tsconfig.json b/packages/preset-system/tsconfig.json deleted file mode 100644 index 4082f16a5..000000000 --- a/packages/preset-system/tsconfig.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "../../tsconfig.json" -} diff --git a/packages/preset-tailwind/babel.config.js b/packages/preset-tailwind/babel.config.js deleted file mode 100644 index 46bf5309f..000000000 --- a/packages/preset-tailwind/babel.config.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('../../babel.config') diff --git a/packages/preset-tailwind/package.json b/packages/preset-tailwind/package.json index 8dbf59bf7..691e34299 100644 --- a/packages/preset-tailwind/package.json +++ b/packages/preset-tailwind/package.json @@ -1,17 +1,13 @@ { "name": "@theme-ui/preset-tailwind", - "version": "0.6.0-alpha.7", - "main": "dist/index.js", - "module": "dist/index.esm.js", - "types": "dist/index.d.ts", + "version": "0.6.0", + "main": "dist/theme-ui-preset-tailwind.cjs.js", + "module": "dist/theme-ui-preset-tailwind.esm.js", + "types": "dist/theme-ui-preset-tailwind.cjs.d.ts", "source": "src/index.ts", "author": "Brent Jackson", "license": "MIT", - "scripts": { - "prepare": "microbundle --no-compress", - "watch": "microbundle watch --no-compress", - "typecheck": "tsc --noEmit" - }, + "scripts": {}, "publishConfig": { "access": "public" }, diff --git a/packages/preset-tailwind/tsconfig.json b/packages/preset-tailwind/tsconfig.json deleted file mode 100644 index 4082f16a5..000000000 --- a/packages/preset-tailwind/tsconfig.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "../../tsconfig.json" -} diff --git a/packages/preset-tosh/babel.config.js b/packages/preset-tosh/babel.config.js deleted file mode 100644 index 46bf5309f..000000000 --- a/packages/preset-tosh/babel.config.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('../../babel.config') diff --git a/packages/preset-tosh/package.json b/packages/preset-tosh/package.json index 0901cac2c..1ecd4a843 100644 --- a/packages/preset-tosh/package.json +++ b/packages/preset-tosh/package.json @@ -1,18 +1,14 @@ { "name": "@theme-ui/preset-tosh", - "version": "0.6.0-alpha.7", - "main": "dist/index.js", - "module": "dist/index.esm.js", - "types": "dist/index.d.ts", + "version": "0.6.0", + "main": "dist/theme-ui-preset-tosh.cjs.js", + "module": "dist/theme-ui-preset-tosh.esm.js", + "types": "dist/theme-ui-preset-tosh.cjs.d.ts", "source": "src/index.ts", "author": "John Otander", "license": "MIT", "repository": "system-ui/theme-ui", - "scripts": { - "prepare": "microbundle --no-compress", - "watch": "microbundle watch --no-compress", - "typecheck": "tsc --noEmit" - }, + "scripts": {}, "publishConfig": { "access": "public" }, diff --git a/packages/preset-tosh/tsconfig.json b/packages/preset-tosh/tsconfig.json deleted file mode 100644 index 4082f16a5..000000000 --- a/packages/preset-tosh/tsconfig.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "../../tsconfig.json" -} diff --git a/packages/presets/babel.config.js b/packages/presets/babel.config.js deleted file mode 100644 index 46bf5309f..000000000 --- a/packages/presets/babel.config.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('../../babel.config') diff --git a/packages/presets/package.json b/packages/presets/package.json index 42aff5e75..70a817927 100644 --- a/packages/presets/package.json +++ b/packages/presets/package.json @@ -1,32 +1,28 @@ { "name": "@theme-ui/presets", - "version": "0.6.0-alpha.7", - "main": "dist/index.js", - "module": "dist/index.esm.js", - "types": "dist/index.d.ts", + "version": "0.6.1", + "main": "dist/theme-ui-presets.cjs.js", + "module": "dist/theme-ui-presets.esm.js", + "types": "dist/theme-ui-presets.cjs.d.ts", "source": "src/index.ts", "author": "Brent Jackson", "license": "MIT", - "scripts": { - "prepare": "microbundle --no-compress", - "watch": "microbundle watch --no-compress", - "typecheck": "tsc --noEmit" - }, + "scripts": {}, "dependencies": { - "@theme-ui/preset-base": "0.6.0-alpha.7", - "@theme-ui/preset-bootstrap": "0.6.0-alpha.7", - "@theme-ui/preset-bulma": "0.6.0-alpha.7", - "@theme-ui/preset-dark": "0.6.0-alpha.7", - "@theme-ui/preset-deep": "0.6.0-alpha.7", - "@theme-ui/preset-funk": "0.6.0-alpha.7", - "@theme-ui/preset-future": "0.6.0-alpha.7", - "@theme-ui/preset-polaris": "0.6.0-alpha.7", - "@theme-ui/preset-roboto": "0.6.0-alpha.7", - "@theme-ui/preset-sketchy": "0.6.0-alpha.7", - "@theme-ui/preset-swiss": "0.6.0-alpha.7", - "@theme-ui/preset-system": "0.6.0-alpha.7", - "@theme-ui/preset-tailwind": "0.6.0-alpha.7", - "@theme-ui/preset-tosh": "0.6.0-alpha.7" + "@theme-ui/preset-base": "^0.6.0", + "@theme-ui/preset-bootstrap": "^0.6.0", + "@theme-ui/preset-bulma": "^0.6.0", + "@theme-ui/preset-dark": "^0.6.0", + "@theme-ui/preset-deep": "^0.6.0", + "@theme-ui/preset-funk": "^0.6.0", + "@theme-ui/preset-future": "^0.6.0", + "@theme-ui/preset-polaris": "^0.6.0", + "@theme-ui/preset-roboto": "^0.6.0", + "@theme-ui/preset-sketchy": "^0.6.1", + "@theme-ui/preset-swiss": "^0.6.0", + "@theme-ui/preset-system": "^0.6.0", + "@theme-ui/preset-tailwind": "^0.6.0", + "@theme-ui/preset-tosh": "^0.6.0" }, "publishConfig": { "access": "public" diff --git a/packages/presets/tsconfig.json b/packages/presets/tsconfig.json deleted file mode 100644 index 4082f16a5..000000000 --- a/packages/presets/tsconfig.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "../../tsconfig.json" -} diff --git a/packages/prism/babel.config.js b/packages/prism/babel.config.js deleted file mode 100644 index 46bf5309f..000000000 --- a/packages/prism/babel.config.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('../../babel.config') diff --git a/packages/prism/package.json b/packages/prism/package.json index efec3d803..f3831b160 100644 --- a/packages/prism/package.json +++ b/packages/prism/package.json @@ -1,17 +1,14 @@ { "name": "@theme-ui/prism", - "version": "0.6.0-alpha.7", - "main": "dist/prism.js", - "module": "dist/prism.esm.js", - "types": "dist/index.d.ts", + "version": "0.6.1", + "main": "dist/theme-ui-prism.cjs.js", + "module": "dist/theme-ui-prism.esm.js", + "types": "dist/theme-ui-prism.cjs.d.ts", "source": "src/index.tsx", "author": "John Otander", "license": "MIT", "scripts": { - "prepare": "microbundle --no-compress -o dist", - "watch": "microbundle watch --no-compress -o dist", - "build-presets": "node build-presets.js", - "typecheck": "tsc --noEmit" + "build-presets": "node build-presets.js" }, "dependencies": { "prism-react-renderer": "^1.1.1" @@ -34,9 +31,9 @@ ], "gitHead": "621199460fa3bdb0100748441e62517b7529b8c8", "devDependencies": { - "param-case": "^3.0.3", "postcss": "^8.1.10", "postcss-js": "^3.0.3", - "theme-ui": "0.6.0-alpha.7" + "theme-ui": "^0.6.1", + "param-case": "^3.0.3" } } diff --git a/packages/prism/tsconfig.json b/packages/prism/tsconfig.json deleted file mode 100644 index 687dc5540..000000000 --- a/packages/prism/tsconfig.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "jsx": "react" - }, - "include": ["src"] -} diff --git a/packages/sidenav/package.json b/packages/sidenav/package.json index a87d6c8a1..61ee4e1d5 100644 --- a/packages/sidenav/package.json +++ b/packages/sidenav/package.json @@ -1,16 +1,12 @@ { "name": "@theme-ui/sidenav", - "version": "0.6.0-alpha.7", - "main": "dist/index.js", - "module": "dist/index.esm.js", - "types": "dist/index.d.ts", + "version": "0.6.1", + "main": "dist/theme-ui-sidenav.cjs.js", + "module": "dist/theme-ui-sidenav.esm.js", + "types": "dist/theme-ui-sidenav.cjs.d.ts", "sideEffects": false, "license": "MIT", - "scripts": { - "prepare": "microbundle --no-compress", - "watch": "microbundle watch --no-compress", - "typecheck": "tsc --noEmit" - }, + "scripts": {}, "publishConfig": { "access": "public" }, @@ -21,11 +17,11 @@ "react": "^17.0.1" }, "dependencies": { - "@emotion/react": "^11.1.1", "@mdx-js/react": "^1.6.22", "@types/mdx-js__react": "^1.5.3", "deepmerge": "^4.0.0", - "theme-ui": "0.6.0-alpha.7" + "theme-ui": "0.6.1", + "@emotion/react": "^11.1.1" }, "keywords": [ "theme-ui", diff --git a/packages/sidenav/tsconfig.json b/packages/sidenav/tsconfig.json deleted file mode 100644 index fd155467d..000000000 --- a/packages/sidenav/tsconfig.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "jsx": "react" - }, - "include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.d.ts"] -} diff --git a/packages/style-guide/babel.config.js b/packages/style-guide/babel.config.js deleted file mode 100644 index 46bf5309f..000000000 --- a/packages/style-guide/babel.config.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('../../babel.config') diff --git a/packages/style-guide/package.json b/packages/style-guide/package.json index 44b59b1b5..881823868 100644 --- a/packages/style-guide/package.json +++ b/packages/style-guide/package.json @@ -1,19 +1,15 @@ { "name": "@theme-ui/style-guide", - "version": "0.6.0-alpha.7", - "main": "dist/index.js", - "module": "dist/index.esm.js", - "types": "dist/index.d.ts", + "version": "0.6.1", + "main": "dist/theme-ui-style-guide.cjs.js", + "module": "dist/theme-ui-style-guide.esm.js", + "types": "dist/theme-ui-style-guide.cjs.d.ts", "source": "src/index.ts", "author": "Brent Jackson", "license": "MIT", - "scripts": { - "prepare": "microbundle --no-compress", - "watch": "microbundle watch --no-compress", - "typecheck": "tsc --noEmit" - }, + "scripts": {}, "dependencies": { - "@theme-ui/presets": "0.6.0-alpha.7", + "@theme-ui/presets": "^0.6.1", "@types/color": "^3.0.1", "color": "^3.1.2", "lodash.get": "^4.4.2" @@ -24,7 +20,7 @@ }, "devDependencies": { "react": "^17.0.1", - "theme-ui": "0.6.0-alpha.7" + "theme-ui": "^0.6.1" }, "publishConfig": { "access": "public" diff --git a/packages/style-guide/tsconfig.json b/packages/style-guide/tsconfig.json deleted file mode 100644 index 687dc5540..000000000 --- a/packages/style-guide/tsconfig.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "jsx": "react" - }, - "include": ["src"] -} diff --git a/packages/tachyons/babel.config.js b/packages/tachyons/babel.config.js deleted file mode 100644 index 46bf5309f..000000000 --- a/packages/tachyons/babel.config.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('../../babel.config') diff --git a/packages/tachyons/package.json b/packages/tachyons/package.json index 5e0227662..52d2e5b10 100644 --- a/packages/tachyons/package.json +++ b/packages/tachyons/package.json @@ -1,20 +1,15 @@ { "name": "@theme-ui/tachyons", "description": "Generate static CSS for use outside of React with Theme UI and Tachyons", - "version": "0.6.0-alpha.7", - "main": "dist/index.js", - "module": "dist/index.esm.js", + "version": "0.6.1", + "main": "dist/theme-ui-tachyons.cjs.js", + "module": "dist/theme-ui-tachyons.esm.js", "source": "src/index.ts", - "types": "dist/index.d.ts", "author": "John Otander ", "license": "MIT", - "scripts": { - "prepare": "microbundle --no-compress --tsconfig tsconfig.json", - "watch": "microbundle watch --no-compress --tsconfig tsconfig.json", - "typecheck": "tsc --noEmit" - }, + "scripts": {}, "devDependencies": { - "@theme-ui/css": "0.6.0-alpha.7", + "@theme-ui/css": "0.6.0", "babel-polyfill": "^6.26.0", "execa": "^5.0.0" }, diff --git a/packages/tachyons/tsconfig.json b/packages/tachyons/tsconfig.json deleted file mode 100644 index 4082f16a5..000000000 --- a/packages/tachyons/tsconfig.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "../../tsconfig.json" -} diff --git a/packages/tailwind/babel.config.js b/packages/tailwind/babel.config.js deleted file mode 100644 index 46bf5309f..000000000 --- a/packages/tailwind/babel.config.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('../../babel.config') diff --git a/packages/tailwind/package.json b/packages/tailwind/package.json index 3f59466fb..22f6f0078 100644 --- a/packages/tailwind/package.json +++ b/packages/tailwind/package.json @@ -1,20 +1,15 @@ { "name": "@theme-ui/tailwind", "description": "Generate static CSS for use outside of React with Theme UI and Tailwind.css", - "version": "0.6.0-alpha.7", - "main": "dist/index.js", - "module": "dist/index.esm.js", + "version": "0.6.1", + "main": "dist/theme-ui-tailwind.cjs.js", + "module": "dist/theme-ui-tailwind.esm.js", "source": "src/index.ts", - "types": "dist/index.d.ts", "author": "John Otander ", "license": "MIT", - "scripts": { - "prepare": "microbundle --no-compress --tsconfig tsconfig.json", - "watch": "microbundle watch --no-compress --tsconfig tsconfig.json", - "typecheck": "tsc --noEmit" - }, + "scripts": {}, "devDependencies": { - "@theme-ui/css": "0.6.0-alpha.7", + "@theme-ui/css": "0.6.0", "babel-polyfill": "^6.26.0", "execa": "^5.0.0", "tailwindcss": "^1.0.4" diff --git a/packages/tailwind/tsconfig.json b/packages/tailwind/tsconfig.json deleted file mode 100644 index ea497b092..000000000 --- a/packages/tailwind/tsconfig.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "exclude": ["test"] -} diff --git a/packages/test-utils/package.json b/packages/test-utils/package.json index 8824fe1b9..65bd17cc4 100644 --- a/packages/test-utils/package.json +++ b/packages/test-utils/package.json @@ -1,21 +1,22 @@ { "name": "@theme-ui/test-utils", - "version": "0.6.0-alpha.7", + "version": "0.6.0", "private": true, "license": "MIT", "source": "src/index.ts", - "main": "dist/index.js", - "module": "dist/index.js", - "types": "dist/index.d.ts", + "main": "dist/theme-ui-test-utils.cjs.js", + "module": "dist/theme-ui-test-utils.esm.js", + "types": "dist/theme-ui-test-utils.cjs.d.ts", "sideEffects": false, "scripts": { - "prepare": "tsc", + "build": "tsc", "watch": "tsc -w", "typecheck": "tsc --noEmit" }, "dependencies": { "@testing-library/react": "^11.0.1", "conditional-type-checks": "^1.0.5", - "ts-snippet": "^5.0.0" + "ts-snippet": "^5.0.0", + "react-test-renderer": "17.0.1" } } diff --git a/packages/test-utils/src/index.ts b/packages/test-utils/src/index.ts index 78795ab3a..6adcde99c 100644 --- a/packages/test-utils/src/index.ts +++ b/packages/test-utils/src/index.ts @@ -58,6 +58,8 @@ export const expecter = ( // for better error message snapshots noErrorTruncation: true, + + types: ['node'], }) const snippets = tsSnippet.snippet( diff --git a/packages/test-utils/tsconfig.json b/packages/test-utils/tsconfig.json index 7dc5354c0..a4fa63979 100644 --- a/packages/test-utils/tsconfig.json +++ b/packages/test-utils/tsconfig.json @@ -1,8 +1,6 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "outDir": "dist", - "declaration": true, "target": "ES2018" }, "include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.d.ts"] diff --git a/packages/theme-provider/package.json b/packages/theme-provider/package.json index 62bcb99a3..6eef52192 100644 --- a/packages/theme-provider/package.json +++ b/packages/theme-provider/package.json @@ -1,24 +1,19 @@ { "name": "@theme-ui/theme-provider", - "version": "0.6.0-alpha.7", - "main": "dist/index.js", - "module": "dist/index.esm.js", + "version": "0.6.1", + "main": "dist/theme-ui-theme-provider.cjs.js", + "module": "dist/theme-ui-theme-provider.esm.js", "source": "src/index.ts", - "types": "dist/index.d.ts", "sideEffects": false, - "scripts": { - "prepare": "microbundle --no-compress --tsconfig tsconfig.json", - "watch": "microbundle watch --no-compress --tsconfig tsconfig.json", - "typecheck": "tsc --noEmit" - }, + "scripts": {}, "dependencies": { - "@emotion/react": "^11.1.1", - "@theme-ui/color-modes": "0.6.0-alpha.7", - "@theme-ui/core": "0.6.0-alpha.7", - "@theme-ui/mdx": "0.6.0-alpha.7" + "@theme-ui/color-modes": "^0.6.1", + "@theme-ui/core": "^0.6.1", + "@theme-ui/mdx": "^0.6.1", + "@theme-ui/css": "^0.6.0", + "@emotion/react": "^11.1.1" }, "peerDependencies": { - "@theme-ui/css": "*", "react": "^16.14.0 || ^17.0.0" }, "repository": "system-ui/theme-ui", diff --git a/packages/theme-provider/src/index.ts b/packages/theme-provider/src/index.ts index f58f9e2eb..627f0eae9 100644 --- a/packages/theme-provider/src/index.ts +++ b/packages/theme-provider/src/index.ts @@ -3,7 +3,6 @@ import { useThemeUI, ThemeProvider as CoreProvider, ThemeProviderProps as CoreThemeProviderProps, - IntrinsicSxElements, __internalGetUseRootStyles, } from '@theme-ui/core' import { css, Theme } from '@theme-ui/css' diff --git a/packages/theme-provider/tsconfig.json b/packages/theme-provider/tsconfig.json deleted file mode 100644 index 4b3acf012..000000000 --- a/packages/theme-provider/tsconfig.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "extends": "../core/tsconfig.json", - "include": ["src/**/*.ts", "src/**/*.tsx"] -} diff --git a/packages/theme-ui/README.md b/packages/theme-ui/README.md index 885f56541..1db51acfd 100644 --- a/packages/theme-ui/README.md +++ b/packages/theme-ui/README.md @@ -56,27 +56,30 @@ alt="MIT license" /> - + Join our Discord community

\ -Theme UI is a library for creating themeable user interfaces based on constraint-based design principles. Build custom component libraries, design systems, web applications, Gatsby themes, and more with a flexible API for best-in-class developer ergonomics. +Theme UI is a library for creating themeable user interfaces based on constraint-based +design principles. Build custom component libraries, design systems, web applications, +Gatsby themes, and more with a flexible API for best-in-class developer ergonomics. **[stable] docs**: https://theme-ui.com \ -**[develop] (v0.6.0-alpha) docs**: https://dev.theme-ui.com +**[develop] (prerelease) docs**: https://dev.theme-ui.com [stable]: https://github.com/system-ui/theme-ui/tree/stable [develop]: https://github.com/system-ui/theme-ui/tree/develop --- -Built for design systems, white-labels, themes, and other applications where customizing colors, typography, and layout are treated as first-class citizens -and based on a standard [Theme Specification][], -Theme UI is intended to work in a variety of applications, libraries, and other UI components. -Colors, typography, and layout styles derived from customizable theme-based design scales -help you build UI rooted in constraint-based design principles. +Built for design systems, white-labels, themes, and other applications where +customizing colors, typography, and layout are treated as first-class citizens +and based on a standard [Theme Specification][], Theme UI is intended to work in +a variety of applications, libraries, and other UI components. Colors, +typography, and layout styles derived from customizable theme-based design +scales help you build UI rooted in constraint-based design principles. - The next evolution of Styled System - From the creators of utility-based, atomic CSS methodologies @@ -106,9 +109,9 @@ help you build UI rooted in constraint-based design principles. npm install theme-ui ``` -Any styles in your app can reference values from the global `theme` object. -To provide the theme in context, -wrap your application with the `ThemeProvider` component and pass in a custom `theme` object. +Any styles in your app can reference values from the global `theme` object. To +provide the theme in context, wrap your application with the `ThemeProvider` +component and pass in a custom `theme` object. ```jsx // basic usage @@ -120,9 +123,10 @@ export default (props) => ( ) ``` -The `theme` object follows the System UI [Theme Specification](https://theme-ui.com/theme-spec/), -which lets you define custom color palettes, typographic scales, fonts, and more. -Read more about [theming](https://theme-ui.com/theming). +The `theme` object follows the System UI +[Theme Specification](https://theme-ui.com/theme-spec/), which lets you define +custom color palettes, typographic scales, fonts, and more. Read more about +[theming](https://theme-ui.com/theming). ```js // example theme.js @@ -143,12 +147,16 @@ export default { ## `sx` prop -The `sx` prop works similarly to Emotion's `css` prop, accepting style objects to add CSS directly to an element in JSX, but includes extra theme-aware functionality. -Using the `sx` prop for styles means that certain properties can reference values defined in your `theme` object. -This is intended to make keeping styles consistent throughout your app the easy thing to do. +The `sx` prop works similarly to Emotion's `css` prop, accepting style objects +to add CSS directly to an element in JSX, but includes extra theme-aware +functionality. Using the `sx` prop for styles means that certain properties can +reference values defined in your `theme` object. This is intended to make +keeping styles consistent throughout your app the easy thing to do. -The `sx` prop only works in modules that have defined a custom pragma at the top of the file, which replaces the default React JSX functions. -This means you can control which modules in your application opt into this feature without the need for a Babel plugin or additional configuration. +The `sx` prop only works in modules that have defined a custom pragma at the top +of the file, which replaces the default React JSX functions. This means you can +control which modules in your application opt into this feature without the need +for a Babel plugin or additional configuration. ```jsx /** @jsxImportSource theme-ui */ @@ -165,12 +173,16 @@ export default (props) => ( ) ``` -Read more about [how the custom pragma works](https://theme-ui.com/guides/how-it-works/#jsx-pragma). +Read more about +[how the custom pragma works](https://theme-ui.com/guides/how-it-works/#jsx-pragma). ## Responsive styles -The `sx` prop also supports using arrays as values to change properties responsively with a mobile-first approach. -This API originated in [Styled System][] and is intended as [a terser syntax for applying responsive styles](https://styled-system.com/guides/array-props) across a singular dimension. +The `sx` prop also supports using arrays as values to change properties +responsively with a mobile-first approach. This API originated in [Styled +System][] and is intended as +[a terser syntax for applying responsive styles](https://styled-system.com/guides/array-props) +across a singular dimension. ```jsx /** @jsxImportSource theme-ui */ @@ -202,3 +214,158 @@ export default (props) => ( - [API](https://theme-ui.com/api) MIT License + +## Contributors ✨ + +Thanks goes to these wonderful people +([emoji key](https://allcontributors.org/docs/en/emoji-key)): + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Brent Jackson

🤔 💻 🎨 📖 💡 ⚠️ 👀

Piotr Monwid-Olechnowicz

💻 📖 ⚠️ 👀

Dany Castillo

💻 📖 💡 ⚠️

Jordan Overbye

💻 💡 ⚠️

Lachlan Campbell

💻 💡 ⚠️ 👀 📖 💬

John Otander

💻 👀 📖 ⚠️ 🤔

David Burles

💻 👀 ⚠️ 📖

Max Stoiber

💻 👀 ⚠️ 💡

Atanas Stoyanov

💻 💬 ⚠️ 🐛

Lennart

💻 🐛 📖

Aleksandra Sikora

💻

LB

💻 ⚠️

Francis Champagne

💻 🐛 ⚠️

Alex Page

💻 📖

Adam Schay

💻

Alex

💻 📖

James Edmonds

💻 📖

Florent SCHILDKNECHT

💻 📖

Cole Bemis

💻 ⚠️ 📖

John Letey

📖

Yuraima Estevez

💻

Allan Pope

💻 📖

Emmanuel Pilande

💻

Justin Hall

💻

Marek

💻 🐛

Björn Clees

📖 💻

Iurii Kucherov

📖

Joe Strouth

💻 🐛

Stewart Everett

💻

Travis Arnold

💻 📖

Ivo Reis

💻

Benedikt Rötsch

🐛 📖

Jacob Cofman

📖

John Letey

📖

Lawrence Gosset

📖

Markos Konstantopoulos

📖

Robin Millette

💻

Rodney Folz

💻

Rodrigo Pombo

💻 ⚠️ 📖

Scott Silvi

📖

Shawn Allen

📖

Tomas Carnecky

💻 🐛

John Polacek

💻 🐛

mackie

💻

Aaron Adams

💻 🐛

Amberley

💻

Andreea Năstase

📖

Anson Low Z.F

🐛 📖

Bernhard Gschwantner

💻

Bhanu Prakash Korthiwada

📖

Bruno Lemos

📖

Bryce Fischer

💻

Dan Wood

📖

Debs

📖

Edward O'Reilly

💻 🐛

Eric Schaefer

💻

Felix Green

📖

Gerhard Bliedung

💻 🐛

Guayo Mena

💡

Guilherme Lima

📖

Herb Caudill

📖

Jacob Bolda

💻 🐛

Jason Lengstorf

🐛 📖

Jason Rundell (he/him)

💡

Joe Race

📖

Kanstantsin Klimashevich

📖

Eka

📖 🐛

Keir Williams

📖

Kristóf Poduszló

💻 🐛 🤔

Kyle Gill

📖

Kyle Holmberg

📖

Jay Laiche

💻

Marc Wiest

💻

Matheus Teixeira

💻

matt-cratebind

📖

Matt Zabriskie

💻

Maxime Khoy

💻

Michael Friedman

📖

Michael Zetterberg fd. Lopez

💻

Nathan Knowler

💻

Neeraj Lagwankar

📖

Owen Young

💻

Patrick Arminio

💻 🐛

Pedro Duarte

💻

Ray Clanan

💻

Rich Werden

📖

Rob Phoenix

📖 🐛

Robert Moggach

💻 🐛

Anand Narayan

💻 🐛

Sam Poder

📖

Sam Rose

📖

Sohrab

💻

Spencer Rinehart

💻

Steve

📖

Steve Barton

📖

Tim Reynolds

💻 🐛

Vinícius Lemes

📖

Yihwan Kim

💻 🐛

Yuriy Burychka

📖

Zolwiastyl

💻

Amrish Kushwaha

💻

Joe Bell

💻 🐛

kenny-loveholidays

💻

⦇⦀∙ˇ∎ˇ∙⦀⦈

💻 🐛

navsgh

📖

Shane O'Neill

📖

汪磊

💻 🐛
+ + + + + + +This project follows the +[all-contributors](https://github.com/all-contributors/all-contributors) +specification. Contributions of any kind welcome! diff --git a/packages/theme-ui/babel.config.js b/packages/theme-ui/babel.config.js deleted file mode 100644 index 46bf5309f..000000000 --- a/packages/theme-ui/babel.config.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('../../babel.config') diff --git a/packages/theme-ui/jsx-dev-runtime/package.json b/packages/theme-ui/jsx-dev-runtime/package.json index 8351ebadf..9bcd5fe4f 100644 --- a/packages/theme-ui/jsx-dev-runtime/package.json +++ b/packages/theme-ui/jsx-dev-runtime/package.json @@ -1,11 +1,5 @@ { - "name": "@theme-ui/theme-ui-jsx-dev-runtime", - "source": "../src/jsx-dev-runtime.ts", - "main": "dist/index.js", - "module": "dist/index.esm.js", - "types": "dist/jsx-dev-runtime.d.ts", - "dependencies": { - "@theme-ui/core": "*", - "react": "*" - } + "main": "dist/theme-ui-jsx-dev-runtime.cjs.js", + "module": "dist/theme-ui-jsx-dev-runtime.esm.js", + "types": "dist/theme-ui-jsx-dev-runtime.cjs.d.ts" } diff --git a/packages/theme-ui/jsx-runtime/package.json b/packages/theme-ui/jsx-runtime/package.json index 3e9239b94..ef0035fd3 100644 --- a/packages/theme-ui/jsx-runtime/package.json +++ b/packages/theme-ui/jsx-runtime/package.json @@ -1,11 +1,5 @@ { - "name": "@theme-ui/theme-ui-jsx-runtime", - "source": "../src/jsx-runtime.ts", - "main": "dist/index.js", - "module": "dist/index.esm.js", - "types": "dist/jsx-runtime.d.ts", - "dependencies": { - "@theme-ui/core": "*", - "react": "*" - } + "main": "dist/theme-ui-jsx-runtime.cjs.js", + "module": "dist/theme-ui-jsx-runtime.esm.js", + "types": "dist/theme-ui-jsx-runtime.cjs.d.ts" } diff --git a/packages/theme-ui/package.json b/packages/theme-ui/package.json index ead8fc0a7..faeb7bb8b 100644 --- a/packages/theme-ui/package.json +++ b/packages/theme-ui/package.json @@ -1,30 +1,28 @@ { "name": "theme-ui", - "version": "0.6.0-alpha.7", + "version": "0.6.1", "description": "The Design Graph Framework", "source": "src/index.ts", - "main": "dist/index.js", - "module": "dist/index.esm.js", - "types": "dist/index.d.ts", + "main": "dist/theme-ui.cjs.js", + "module": "dist/theme-ui.esm.js", + "types": "dist/theme-ui.cjs.d.ts", "sideEffects": false, "author": "Brent Jackson ", "license": "MIT", "repository": "system-ui/theme-ui", "scripts": { - "prepare": "yarn prepare:index && yarn prepare:jsx-runtime && yarn prepare:jsx-dev-runtime", - "prepare:index": "microbundle --no-compress --tsconfig tsconfig.json", - "prepare:jsx-runtime": "microbundle --no-compress --tsconfig tsconfig.json --cwd jsx-runtime", - "prepare:jsx-dev-runtime": "microbundle --no-compress --tsconfig tsconfig.json --cwd jsx-dev-runtime", - "watch": "microbundle watch --no-compress", - "typecheck": "tsc --noEmit" + "build": "yarn build:index && yarn build:jsx-runtime && yarn build:jsx-dev-runtime", + "build:jsx-runtime": "microbundle --no-compress --tsconfig tsconfig.json --cwd jsx-runtime", + "build:jsx-dev-runtime": "microbundle --no-compress --tsconfig tsconfig.json --cwd jsx-dev-runtime", + "build:index": "microbundle --no-compress --tsconfig tsconfig.json" }, "dependencies": { - "@theme-ui/color-modes": "0.6.0-alpha.7", - "@theme-ui/components": "0.6.0-alpha.7", - "@theme-ui/core": "0.6.0-alpha.7", - "@theme-ui/css": "0.6.0-alpha.7", - "@theme-ui/mdx": "0.6.0-alpha.7", - "@theme-ui/theme-provider": "0.6.0-alpha.7" + "@theme-ui/color-modes": "^0.6.1", + "@theme-ui/components": "^0.6.1", + "@theme-ui/core": "^0.6.1", + "@theme-ui/css": "0.6.0", + "@theme-ui/mdx": "^0.6.1", + "@theme-ui/theme-provider": "^0.6.1" }, "peerDependencies": { "react": "^16.14.0 || ^17.0.0" @@ -37,5 +35,11 @@ "styles", "css-in-js" ], - "gitHead": "621199460fa3bdb0100748441e62517b7529b8c8" + "preconstruct": { + "entrypoints": [ + "index.ts", + "jsx-dev-runtime.ts", + "jsx-runtime.ts" + ] + } } diff --git a/packages/theme-ui/src/index.ts b/packages/theme-ui/src/index.ts index 47f28e507..10deda679 100644 --- a/packages/theme-ui/src/index.ts +++ b/packages/theme-ui/src/index.ts @@ -1,7 +1,12 @@ import { jsx as coreJsx, ThemeUIJSX } from '@theme-ui/core' -export { Context, merge, useThemeUI } from '@theme-ui/core' +export { + __ThemeUIContext, + merge, + useThemeUI, + createElement, +} from '@theme-ui/core' export type { - ContextValue, + ThemeUIContextValue, IntrinsicSxElements, SxProp, ColorMode, @@ -19,7 +24,7 @@ export type { StylePropertyValue, } from '@theme-ui/core' export { useColorMode, InitializeColorMode } from '@theme-ui/color-modes' -export { Themed, components } from '@theme-ui/mdx' +export { Themed, Styled, components } from '@theme-ui/mdx' export { ThemeProvider } from '@theme-ui/theme-provider' export * from '@theme-ui/components' export { css, get } from '@theme-ui/css' @@ -36,6 +41,7 @@ export const BaseStyles = (props: Record) => }) export const jsx = coreJsx + export declare namespace jsx { export namespace JSX { export interface Element extends ThemeUIJSX.Element {} diff --git a/packages/theme-ui/test/color-modes.tsx b/packages/theme-ui/test/color-modes.tsx index 69be8accf..103ae552b 100644 --- a/packages/theme-ui/test/color-modes.tsx +++ b/packages/theme-ui/test/color-modes.tsx @@ -7,7 +7,7 @@ import mockConsole, { RestoreConsole } from 'jest-mock-console' import packageInfo from '@emotion/react/package.json' import { - ContextValue, + ThemeUIContextValue, jsx, Theme, ThemeProvider, @@ -18,6 +18,8 @@ import { const emotionVersion = packageInfo.version const STORAGE_KEY = 'theme-ui-color-mode' +const defaultColorMode = undefined + expect.extend(matchers) let restoreConsole: RestoreConsole @@ -33,29 +35,38 @@ afterEach(() => { test('renders with color modes', () => { let mode: string | undefined + let rendered: + | renderer.ReactTestRendererJSON + | renderer.ReactTestRendererJSON[] + | null = null + const Mode = () => { const [colorMode] = useColorMode() mode = colorMode return
Mode
} renderer.act(() => { - renderer.create( - - - - ) + }}> + + + ) + .toJSON() }) - expect(mode).toBe('default') + expect(mode).toBe(defaultColorMode) + expect(rendered).toBe(null) + // expect(rendered).toHaveStyleRule('color', 'var(--theme-ui-color-black)') }) test('renders with initial color mode name', () => { @@ -172,7 +183,7 @@ test('converts color modes to css custom properties', () => { ) expect(tree.getByText('test')).toHaveStyleRule( 'color', - 'var(--theme-ui-colors-text, #000)' + 'var(--theme-ui-colors-text)' ) }) @@ -188,7 +199,7 @@ test('uses default mode', () => {