UNPKG

@twind/preset-tailwind

Version:

Tailwind CSS preset for twind

1 lines 11.1 kB
{"version":3,"file":"preflight.cjs","sources":["../src/preflight.ts"],"sourcesContent":["/**\n * @module @twind/preset-tailwind/preflight\n */\n\nimport type { Preflight } from '@twind/core'\n\nimport baseTheme from './baseTheme'\n\nconst preflight: Preflight = {\n /*\n 1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4)\n 2. Allow adding a border to an element by just adding a border-width. (https://github.com/tailwindcss/tailwindcss/pull/116)\n */\n '*,::before,::after': {\n boxSizing: 'border-box' /* 1 */,\n borderWidth: '0' /* 2 */,\n borderStyle: 'solid' /* 2 */,\n borderColor: 'theme(borderColor.DEFAULT, currentColor)' /* 2 */,\n },\n\n '::before,::after': { '--tw-content': \"''\" },\n\n /*\n 1. Use a consistent sensible line-height in all browsers.\n 2. Prevent adjustments of font size after orientation changes in iOS.\n 3. Use a more readable tab size.\n 4. Use the user's configured `sans` font-family by default.\n 5. Use the user's configured `sans` font-feature-settings by default.\n */\n html: {\n lineHeight: 1.5 /* 1 */,\n WebkitTextSizeAdjust: '100%' /* 2 */,\n MozTabSize: '4' /* 3 */,\n tabSize: 4 /* 3 */,\n fontFamily: `theme(fontFamily.sans, ${\n (baseTheme.fontFamily as Record<string, string>).sans\n })` /* 4 */,\n fontFeatureSettings: 'theme(fontFamily.sans[1].fontFeatureSettings, normal)' /* 5 */,\n },\n\n /*\n 1. Remove the margin in all browsers.\n 2. Inherit line-height from `html` so users can set them as a class directly on the `html` element.\n */\n body: { margin: '0' /* 1 */, lineHeight: 'inherit' /* 2 */ },\n\n /*\n 1. Add the correct height in Firefox.\n 2. Correct the inheritance of border color in Firefox. (https://bugzilla.mozilla.org/show_bug.cgi?id=190655)\n 3. Ensure horizontal rules are visible by default.\n */\n hr: { height: '0' /* 1 */, color: 'inherit', /* 2 */ borderTopWidth: '1px' /* 3 */ },\n\n /*\n Add the correct text decoration in Chrome, Edge, and Safari.\n */\n 'abbr:where([title])': { textDecoration: 'underline dotted' },\n\n /*\n Remove the default font size and weight for headings.\n */\n 'h1,h2,h3,h4,h5,h6': { fontSize: 'inherit', fontWeight: 'inherit' },\n\n /*\n Reset links to optimize for opt-in styling instead of opt-out.\n */\n a: { color: 'inherit', textDecoration: 'inherit' },\n\n /*\n Add the correct font weight in Edge and Safari.\n */\n 'b,strong': { fontWeight: 'bolder' },\n\n /*\n 1. Use the user's configured `mono` font family by default.\n 2. Use the user's configured `mono` font-feature-settings by default.\n 3. Correct the odd `em` font sizing in all browsers.\n */\n 'code,kbd,samp,pre': {\n fontFamily: `theme(fontFamily.mono, ${(baseTheme.fontFamily as Record<string, string>).mono})`,\n fontFeatureSettings: 'theme(fontFamily.mono[1].fontFeatureSettings, normal)',\n fontSize: '1em',\n },\n\n /*\n Add the correct font size in all browsers.\n */\n small: { fontSize: '80%' },\n\n /*\n Prevent `sub` and `sup` elements from affecting the line height in all browsers.\n */\n 'sub,sup': {\n fontSize: '75%',\n lineHeight: 0,\n position: 'relative',\n verticalAlign: 'baseline',\n },\n sub: { bottom: '-0.25em' },\n sup: { top: '-0.5em' },\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 3. Remove gaps between table borders by default.\n */\n table: {\n textIndent: '0' /* 1 */,\n borderColor: 'inherit' /* 2 */,\n borderCollapse: 'collapse' /* 3 */,\n },\n\n /*\n 1. Change the font styles in all browsers.\n 2. Remove the margin in Firefox and Safari.\n 3. Remove default padding in all browsers.\n */\n 'button,input,optgroup,select,textarea': {\n fontFamily: 'inherit' /* 1 */,\n fontSize: '100%' /* 1 */,\n lineHeight: 'inherit' /* 1 */,\n color: 'inherit' /* 1 */,\n margin: '0' /* 2 */,\n padding: '0' /* 3 */,\n },\n\n /*\n Remove the inheritance of text transform in Edge and Firefox.\n */\n 'button,select': { textTransform: 'none' },\n\n /*\n 1. Correct the inability to style clickable types in iOS and Safari.\n 2. Remove default button styles.\n */\n \"button,[type='button'],[type='reset'],[type='submit']\": {\n WebkitAppearance: 'button' /* 1 */,\n backgroundColor: 'transparent' /* 2 */,\n backgroundImage: 'none' /* 4 */,\n },\n\n /*\n Use the modern Firefox focus style for all focusable elements.\n */\n ':-moz-focusring': { outline: 'auto' },\n\n /*\n Remove the additional `:invalid` styles in Firefox. (https://github.com/mozilla/gecko-dev/blob/2f9eacd9d3d995c937b4251a5557d95d494c9be1/layout/style/res/forms.css#L728-L737)\n */\n ':-moz-ui-invalid': { boxShadow: 'none' },\n\n /*\n Add the correct vertical alignment in Chrome and Firefox.\n */\n progress: { verticalAlign: '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': {\n height: 'auto',\n },\n\n /*\n 1. Correct the odd appearance in Chrome and Safari.\n 2. Correct the outline style in Safari.\n */\n \"[type='search']\": { WebkitAppearance: 'textfield' /* 1 */, outlineOffset: '-2px' /* 2 */ },\n\n /*\n Remove the inner padding in Chrome and Safari on macOS.\n */\n '::-webkit-search-decoration': { WebkitAppearance: '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': {\n WebkitAppearance: 'button' /* 1 */,\n font: 'inherit' /* 2 */,\n },\n\n /*\n Add the correct display in Chrome and Safari.\n */\n summary: { display: 'list-item' },\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': {\n margin: '0',\n },\n fieldset: { margin: '0', padding: '0' },\n legend: { padding: '0' },\n 'ol,ul,menu': { listStyle: 'none', margin: '0', padding: '0' },\n\n /*\n Prevent resizing textareas horizontally by default.\n */\n textarea: { resize: 'vertical' },\n\n /*\n 1. Reset the default placeholder opacity in Firefox. (https://github.com/tailwindlabs/tailwindcss/issues/3300)\n 2. Set the default placeholder color to the user's configured gray 400 color.\n */\n 'input::placeholder,textarea::placeholder': {\n opacity: 1 /* 1 */,\n color: 'theme(colors.gray.400, #9ca3af)' /* 2 */,\n },\n\n /*\n Set the default cursor for buttons.\n */\n 'button,[role=\"button\"]': { cursor: 'pointer' },\n\n /*\n Make sure disabled buttons don't get the pointer cursor.\n */\n ':disabled': { cursor: 'default' },\n\n /*\n 1. Make replaced elements `display: block` by default. (https://github.com/mozdevs/cssremedy/issues/14)\n 2. Add `vertical-align: middle` to align replaced elements more sensibly by default. (https://github.com/jensimmons/cssremedy/issues/14#issuecomment-634934210)\n This can trigger a poorly considered lint error in some tools but is included by design.\n */\n 'img,svg,video,canvas,audio,iframe,embed,object': {\n display: 'block' /* 1 */,\n verticalAlign: 'middle' /* 2 */,\n },\n\n /*\n Constrain images and videos to the parent width and preserve their intrinsic aspect ratio. (https://github.com/mozdevs/cssremedy/issues/14)\n */\n 'img,video': { maxWidth: '100%', height: 'auto' },\n\n /* Make elements with the HTML hidden attribute stay hidden by default */\n '[hidden]': { display: 'none' },\n}\n\nexport default preflight\n"],"names":["preflight","boxSizing","borderWidth","borderStyle","borderColor","html","lineHeight","WebkitTextSizeAdjust","MozTabSize","tabSize","fontFamily","baseTheme","sans","fontFeatureSettings","body","margin","hr","height","color","borderTopWidth","textDecoration","fontSize","fontWeight","a","mono","small","position","verticalAlign","sub","bottom","sup","top","table","textIndent","borderCollapse","padding","textTransform","WebkitAppearance","backgroundColor","backgroundImage","outline","boxShadow","progress","outlineOffset","font","summary","display","fieldset","legend","listStyle","textarea","resize","opacity","cursor","maxWidth"],"mappings":";8CAQMA,YAAuB;IAC3B;;;IAGE,GACF,sBAAsB;QACpBC,WAAW;QACXC,KAAAA,GAAAA,aAAa;QACbC,KAAAA,GAAAA,aAAa;QACbC,KAAAA,GAAAA,aAAa;IACf;IAD0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