UNPKG

@beamwind/reset

Version:

An opinionated set of base styles for legacy browsers like IE10/11

8 lines (7 loc) 11.3 kB
{ "version": 3, "sources": ["../../src/index.ts", "../../src/reset.ts", "../../src/index.ts"], "sourcesContent": ["import type { ConfigurationOptions } from '@beamwind/types'\n\nimport { reset } from './reset'\n\nexport default (): ConfigurationOptions => ({\n init(insert, theme): void {\n reset(theme).forEach(insert)\n },\n})\n", "// Source: https://github.com/necolas/normalize.css/blob/master/normalize.css\n// License: MIT\n\n// Source: https://github.com/tailwindlabs/tailwindcss/blob/v1/src/plugins/css/preflight.css\n// License: MIT\n\nimport type { ThemeResolver } from '@beamwind/types'\n\n/**\n * Manually forked from SUIT CSS Base: https://github.com/suitcss/base\n * A thin layer on top of normalize.css that provides a starting point more\n * suitable for web applications.\n */\nexport const reset = (theme: ThemeResolver): string[] => [\n /**\n * Use a more readable tab size (opinionated).\n */\n `:root{-moz-tab-size:4;tab-size:4}`,\n\n /**\n * Removes the default spacing and border for appropriate elements.\n */\n `blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}`,\n\n `button{background-color:transparent;background-image:none}`,\n /**\n * Correct the inability to style clickable types in iOS and Safari.\n */\n `button,[type='button'],[type='reset'],[type='submit']{-webkit-appearance:button}`,\n\n /**\n * Work around a Firefox/IE bug where the transparent `button` background\n * results in a loss of the default `button` focus styles.\n */\n `button:focus{outline:1px dotted;outline:5px auto -webkit-focus-ring-color}`,\n\n `fieldset{margin:0;padding:0}`,\n\n `ol,ul{list-style:none;margin:0;padding:0}`,\n\n /**\n * 1. Use Tailwind's default \"normal\" line-height so the user isn't forced\n * to override it to ensure consistency even when using the default theme.\n * 2. Prevent adjustments of font size after orientation changes in iOS.\n * 3. Use the user's configured `sans` font-family (with Tailwind's default\n * sans-serif font stack as a fallback) as a sane default.\n */\n `html{line-height:1.5;-webkit-text-size-adjust:100%;font-family:${theme(\n 'fontFamily',\n 'sans',\n 'ui-sans-serif,system-ui,sans-serif',\n )}}`,\n\n /**\n * 1. Remove the margin in all browsers.\n * 2. Inherit font-family and line-height from `html` so users can set them as\n * a class directly on the `html` element.\n */\n `body{margin:0;font-family:inherit;line-height:inherit}`,\n\n /**\n * 1. Prevent padding and border from affecting element width.\n *\n * We used to set this in the html element and inherit from\n * the parent element for everything else. This caused issues\n * in shadow-dom-enhanced elements like <details> where the content\n * is wrapped by a div with box-sizing set to `content-box`.\n *\n * https://github.com/mozdevs/cssremedy/issues/4\n *\n *\n * 2. Allow adding a border to an element by just adding a border-width.\n *\n * By default, the way the browser specifies that an element should have no\n * border is by setting it's border-style to `none` in the user-agent\n * stylesheet.\n *\n * In order to easily add borders to elements by just setting the `border-width`\n * property, we change the default border-style for all elements to `solid`, and\n * use border-width to hide them instead. This way our `border` utilities only\n * need to set the `border-width` property instead of the entire `border`\n * shorthand, making our border utilities much more straightforward to compose.\n *\n * https://github.com/tailwindcss/tailwindcss/pull/116\n */\n `*,::before,::after{box-sizing:border-box;border:0 solid ${theme(\n 'borderColor',\n 'DEFAULT',\n 'currentColor',\n )}}`,\n\n /*\n * 1. Add the correct height in Firefox.\n * 2. Show the overflow in Edge and IE.\n * 3. Correct the inheritance of border color in Firefox. (https://bugzilla.mozilla.org/show_bug.cgi?id=190655)\n * 4. Ensure horizontal rules are visible by default\n */\n `hr{height:0;overflow:visible;color:inherit;border-top-width:1px}`,\n\n /**\n * Undo the `border-style: none` reset that Normalize applies to images so that\n * our `border-{width}` utilities have the expected effect.\n *\n * The Normalize reset is unnecessary for us since we default the border-width\n * to 0 on all elements.\n *\n * https://github.com/tailwindcss/tailwindcss/issues/362\n */\n `img{border-style:solid}`,\n\n /**\n * Remove the default vertical scrollbar in IE 10+.\n */\n `textarea{overflow:auto;resize:vertical}`,\n\n `input::placeholder,textarea::placeholder{color:${theme(\n 'placeholderColor',\n 'DEFAULT',\n '#a1a1aa',\n )}}`,\n\n `button,[role=\"button\"]{cursor:pointer}`,\n\n /**\n * 1. Remove text indentation from table contents in Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=999088, https://bugs.webkit.org/show_bug.cgi?id=201297)\n * 2. Correct table border color inheritance in all Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=935729, https://bugs.webkit.org/show_bug.cgi?id=195016)\n */\n `table{text-indent:0;border-color:inherit;border-collapse:collapse}`,\n\n `h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}`,\n\n /**\n * Reset links to optimize for opt-in styling instead of\n * opt-out.\n */\n `a{color:inherit;text-decoration:inherit}`,\n\n /**\n * 1. Change the font styles in all browsers.\n * 2. Remove the margin in Firefox and Safari.\n * Reset form element properties that are easy to forget to\n * style explicitly so you don't inadvertently introduce\n * styles that deviate from your design system. These styles\n * supplement a partial reset that is already applied by\n * normalize.css.\n */\n `button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;margin:0;padding:0;line-height:inherit;color:inherit}`,\n\n /**\n * Remove the inheritance of text transform in Edge, Firefox, and IE.\n * 1. Remove the inheritance of text transform in Firefox.\n */\n `button,select{text-transform:none}`,\n\n /**\n * Remove the inner border and padding in Firefox.\n */\n `::-moz-focus-inner{border-style:none;padding:0}`,\n\n /**\n * Restore the focus styles unset by the previous rule.\n */\n `:-moz-focusring{outline:1px dotted ButtonText}`,\n\n /**\n * Remove the additional ':invalid' styles in Firefox.\n * See: https://github.com/mozilla/gecko-dev/blob/2f9eacd9d3d995c937b4251a5557d95d494c9be1/layout/style/res/forms.css#L728-L737\n */\n `:-moz-ui-invalid{box-shadow:none}`,\n\n /**\n * 1. Correct the text wrapping in Edge and IE.\n * 2. Correct the color inheritance from `fieldset` elements in IE.\n * 3. Remove the padding so developers are not caught out when they zero out\n * `fieldset` elements in all browsers.\n */\n `legend{color:inherit;display:table;max-width:100%;padding:0;white-space:normal;}`,\n\n /**\n * Add the correct vertical alignment in Chrome and Firefox.\n */\n `progress{vertical-align:baseline}`,\n\n /**\n * Correct the cursor style of increment and decrement buttons in Safari.\n */\n `::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}`,\n\n /**\n * 1. Correct the odd appearance in Chrome and Safari.\n * 2. Correct the outline style in Safari.\n */\n `[type=\"search\"]{-webkit-appearance:textfield;outline-offset:-2px}`,\n\n /**\n * Remove the inner padding in Chrome and Safari on macOS.\n */\n `::-webkit-search-decoration{-webkit-appearance:none}`,\n\n /**\n *1. Correct the inability to style clickable types in iOS and Safari.\n *2. Change font properties to 'inherit' in Safari.\n */\n `::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}`,\n\n /*\n *Add the correct display in Chrome and Safari.\n */\n `summary{display:list-item}`,\n\n /**\n * 1. Remove the bottom border in Chrome 57-\n * 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari.\n */\n `abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}`,\n\n /**\n * Add the correct font weight in Edge and Safari.\n */\n `b,strong{font-weight:bolder}`,\n\n /**\n * 1. Use the configured 'mono' font family for elements that\n * are expected to be rendered with a monospace font, falling\n * back to the system monospace stack if there is no configured\n * 'mono' font family.\n * 2. Correct the odd 'em' font sizing in all browsers.\n */\n `pre,code,kbd,samp{font-family:${theme(\n 'fontFamily',\n 'mono',\n 'ui-monospace,monospace',\n )};font-size:1em}`,\n\n /**\n * Prevent 'sub' and 'sup' elements from affecting the line height in all browsers.\n */\n `sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}`,\n\n `sub{bottom:-0.25em}`,\n\n `sup{top:-0.5em}`,\n\n /**\n * Make replaced elements `display: block` by default as that's\n * the behavior you want almost all of the time. Inspired by\n * CSS Remedy, with `svg` added as well.\n *\n * https://github.com/mozdevs/cssremedy/issues/14\n */\n `img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}`,\n\n /**\n * Constrain images and videos to the parent width and preserve\n * their instrinsic aspect ratio.\n *\n * https://github.com/mozdevs/cssremedy/issues/14\n */\n `img,video{max-width:100%;height:auto}`,\n\n /**\n * Render the `main` element consistently in IE.\n */\n `main{display: block}`,\n\n /**\n * Remove the gray background on active links in IE 10.\n */\n `a{background-color:transparent}`,\n\n /**\n * Remove the border on images inside links in IE 10.\n */\n `img{border-style:none}`,\n\n /**\n * Show the overflow in IE.\n * 1. Show the overflow in Edge.\n */\n `button,input{overflow:visible}`,\n\n /**\n * 1. Add the correct box sizing in IE 10.\n * 2. Remove the padding in IE 10.\n */\n `[type=\"checkbox\"],[type=\"radio\"]{box-sizing:border-box;padding:0}`,\n\n /*\n * Add the correct display in Edge, IE 10+, and Firefox.\n */\n `details{display:block}`,\n\n /*\n * Add the correct display in all browsers.\n */\n `summary{display:list-item}`,\n\n /**\n * Add the correct display in IE 10+.\n */\n `template{display:none}`,\n\n /**\n * Add the correct display in IE 10.\n */\n `[hidden]{display:none}`,\n]\n", "import type { ConfigurationOptions } from '@beamwind/types'\n\nimport { reset } from './reset'\n\nexport default (): ConfigurationOptions => ({\n init(insert, theme): void {\n reset(theme).forEach(insert)\n },\n})\n"], "mappings": "6IAAA,0BCaO,IAAM,EAAQ,GAAoC,CAIvD,oCAKA,+DAEA,6DAIA,mFAMA,6EAEA,+BAEA,4CASA,kEAAkE,EAChE,aACA,OACA,yCAQF,yDA2BA,2DAA2D,EACzD,cACA,UACA,mBASF,mEAWA,0BAKA,0CAEA,kDAAkD,EAChD,mBACA,UACA,cAGF,yCAMA,qEAEA,2DAMA,2CAWA,iIAMA,qCAKA,kDAKA,iDAMA,oCAQA,mFAKA,oCAKA,uEAMA,oEAKA,uDAMA,uEAKA,6BAMA,6FAKA,+BASA,iCAAiC,EAC/B,aACA,OACA,2CAMF,iFAEA,sBAEA,kBASA,sFAQA,wCAKA,uBAKA,kCAKA,yBAMA,iCAMA,oEAKA,yBAKA,6BAKA,yBAKA,0BC7SK,EAAQ,IAA6B,EAC1C,UACE,EAAM,GAAO,QAAQ", "names": [] }