Skip to content

Commit

Permalink
Move preflight to unocss
Browse files Browse the repository at this point in the history
  • Loading branch information
thetarnav committed Jul 26, 2023
1 parent 0778b3f commit d6c838e
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 192 deletions.
2 changes: 1 addition & 1 deletion packages/extension/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { createSignal } from 'solid-js'
import { render } from 'solid-js/web'
import { ConnectionName, createPortMessanger, once, Versions } from './bridge'

import '@solid-devtools/frontend/dist/index.css'
import '@solid-devtools/frontend/dist/styles.css'

const port = chrome.runtime.connect({ name: ConnectionName.Panel })
const { postPortMessage: toBackground, onPortMessage: fromBackground } = createPortMessanger<
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"dev": "pnpm run build --watch",
"build": "pnpm run --filter frontend --parallel /build:.*/",
"build:code": "tsup",
"build:css": "unocss \"src/**/*.tsx\" -o dist/uno.css",
"build:css": "unocss \"src/**/*.tsx\" -o dist/styles.css",
"test": "vitest",
"typecheck": "tsc --noEmit"
},
Expand Down
2 changes: 0 additions & 2 deletions packages/frontend/src/ui/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import './reset.css'

export * as theme from '../../../../configs/theme'
export * as styles from './styles'

Expand Down
185 changes: 0 additions & 185 deletions packages/frontend/src/ui/reset.css

This file was deleted.

4 changes: 1 addition & 3 deletions packages/overlay/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ import {
import { Dynamic, Portal } from 'solid-js/web'
import { Devtools } from './controller'

import frontendStyles from '@solid-devtools/frontend/dist/index.css'
import frontendUnoStyles from '@solid-devtools/frontend/dist/uno.css'
import frontendStyles from '@solid-devtools/frontend/dist/styles.css'
import overlayStyles from './styles.css'

export function attachDevtoolsOverlay(props: ComponentProps<typeof Overlay> = {}): VoidFunction {
Expand Down Expand Up @@ -106,7 +105,6 @@ const Overlay: Component<{
</div>
<MountIcons />
<style>{frontendStyles}</style>
<style>{frontendUnoStyles}</style>
<style>{overlayStyles}</style>
</Portal>
)
Expand Down
70 changes: 70 additions & 0 deletions uno.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,74 @@ export default defineConfig({
shortcuts: {
'center-child': 'flex items-center justify-center',
},
preflights: [{ getCSS: () => reset }],
}) as any

/* http://meyerweb.com/eric/tools/css/reset/
v2.0 | 20110126
License: none (public domain)
*/
const reset = /*css*/ `
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section {
display: block;
}
body {
line-height: 1;
}
ol,ul {
list-style: none;
}
blockquote,q {
quotes: none;
}
blockquote:before,blockquote:after,q:before,q:after {
content: '';
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
button {
padding: 0;
border: none;
border-width: 0;
background: transparent;
cursor: pointer;
color: inherit;
font-family: inherit;
font-size: inherit;
}
input {
font-size: inherit;
font-family: inherit;
}
input[type='checkbox'] {
margin: 0;
}
input[type='text'] {
outline: unset;
background: unset;
border: unset;
color: inherit;
}
*,*::before,*::after {
box-sizing: border-box;
}
@media screen and (prefers-color-scheme: dark) {
* {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
}
`

0 comments on commit d6c838e

Please sign in to comment.