-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: add auto imports for css and jsx * feat: add playground * feat: add pattern components * feat: add pattern functions * fix: fix playground * feat: add examples * feat: add example * feat: add example * feat: add autoImports option * fix: support later
- Loading branch information
Showing
12 changed files
with
255 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
imports.autoImport=false | ||
imports.autoImport=true | ||
typescript.includeWorkspace=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
<template> | ||
<NuxtPage /> | ||
</template> | ||
|
||
<style> | ||
#__nuxt { | ||
height: 100%; | ||
} | ||
</style> |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<script setup lang="ts"> | ||
import { css, cva } from "pandacss/css"; | ||
import type { SystemStyleObject } from "pandacss/types"; | ||
const props = withDefaults( | ||
defineProps<{ | ||
css?: SystemStyleObject; | ||
}>(), | ||
{ | ||
css: () => ({}), | ||
} | ||
); | ||
const buttonRecipe = cva({ | ||
base: { display: "flex", fontSize: "lg" }, | ||
variants: { | ||
variant: { | ||
primary: { color: "white", backgroundColor: "blue.500" }, | ||
}, | ||
}, | ||
}); | ||
const className = css( | ||
// using the button recipe | ||
buttonRecipe.raw({ variant: "primary" }), | ||
// adding style overrides (internal) | ||
{ _hover: { color: "blue.400" } }, | ||
// adding style overrides (external) | ||
props.css | ||
); | ||
</script> | ||
|
||
<template> | ||
<button :class="className"><slot /></button> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<script setup lang="ts"> | ||
import { center } from "pandacss/patterns"; | ||
const button = cva({ | ||
base: { | ||
borderRadius: "md", | ||
fontWeight: "semibold", | ||
h: "10", | ||
px: "4", | ||
}, | ||
variants: { | ||
visual: { | ||
solid: { | ||
bg: { base: "colorPalette.500", _dark: "colorPalette.300" }, | ||
color: { base: "white", _dark: "gray.800" }, | ||
}, | ||
outline: { | ||
border: "1px solid", | ||
color: { base: "colorPalette.600", _dark: "colorPalette.200" }, | ||
borderColor: "currentColor", | ||
}, | ||
}, | ||
}, | ||
}); | ||
</script> | ||
|
||
<template> | ||
<div :class="center({ colorPalette: 'yellow', h: 'full', gap: '4' })"> | ||
<button :class="button({ visual: 'solid' })">Button</button> | ||
<button :class="button({ visual: 'outline' })">Button</button> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,23 @@ | ||
<script setup lang="ts"> | ||
import { css } from "pandacss/css"; | ||
import { styled } from "pandacss/jsx"; | ||
import { center } from "pandacss/patterns"; | ||
</script> | ||
|
||
<template> | ||
<styled.h1 fontSize="5xl" fontWeight="bold">Panda CSS x Nuxt</styled.h1> | ||
<div :class="css({ fontSize: '5xl', fontWeight: 'bold', color: 'primary' })"> | ||
Hello 🐼! | ||
<div :class="center({ h: 'full' })"> | ||
<div | ||
:class=" | ||
css({ | ||
display: 'flex', | ||
flexDirection: 'column', | ||
fontWeight: 'semibold', | ||
color: 'yellow.300', | ||
textAlign: 'center', | ||
textStyle: '4xl', | ||
}) | ||
" | ||
> | ||
<span>🐼</span> | ||
<span>Hello from Panda</span> | ||
</div> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<script setup lang="ts"> | ||
import { square, flex, circle, center } from "pandacss/patterns"; | ||
import { Circle } from "pandacss/jsx"; | ||
</script> | ||
|
||
<template> | ||
<div | ||
:class=" | ||
cx( | ||
flex({ | ||
gap: '4', | ||
direction: 'column', | ||
}), | ||
center({ h: 'full' }) | ||
) | ||
" | ||
> | ||
<div :class="flex({ gap: '6', padding: '1' })"> | ||
<div :class="square({ size: '11', bg: 'yellow.300' })">1</div> | ||
<div :class="square({ size: '11', bg: 'red.300' })">2</div> | ||
<div :class="square({ size: '11', bg: 'green.300' })">3</div> | ||
</div> | ||
|
||
<div | ||
:class=" | ||
flex({ | ||
direction: 'row', | ||
align: 'center', | ||
gap: '4', | ||
}) | ||
" | ||
> | ||
<div :class="circle({ size: '12', bg: 'blue.300' })">1</div> | ||
<div :class="circle({ size: '12', bg: 'orange.300' })">2</div> | ||
<Circle size="12" bg="violet.300">3</Circle> | ||
</div> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<script setup lang="ts"> | ||
import { center } from "pandacss/patterns"; | ||
const card = sva({ | ||
slots: ["root", "title", "content"], | ||
base: { | ||
root: { | ||
p: "6", | ||
m: "4", | ||
w: "md", | ||
boxShadow: "md", | ||
borderRadius: "md", | ||
_dark: { bg: "#262626", color: "white" }, | ||
}, | ||
content: { | ||
textStyle: "lg", | ||
}, | ||
title: { | ||
textStyle: "xl", | ||
fontWeight: "semibold", | ||
pb: "2", | ||
}, | ||
}, | ||
}); | ||
const styles = card(); | ||
</script> | ||
|
||
<template> | ||
<div :class="center({ h: 'full' })"> | ||
<div :class="styles.root"> | ||
<div :class="styles.title">Team Members</div> | ||
<div :class="styles.content">Content</div> | ||
</div> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import type { ModuleOptions } from "./../types"; | ||
import type { InlinePreset } from "unimport"; | ||
import { defineUnimportPreset } from "unimport"; | ||
|
||
export const createPresets = ({ | ||
outdir, | ||
}: Pick<ModuleOptions, "outdir">): InlinePreset[] => { | ||
return [ | ||
defineUnimportPreset({ | ||
from: `${outdir}/css`, | ||
imports: ["css", "cva", "sva", "cx"], | ||
}), | ||
// TODO: jsx doesn't work with auto imports | ||
// defineUnimportPreset({ | ||
// from: `${outdir}/jsx`, | ||
// imports: [ | ||
// "styled", | ||
// "AspectRatio", | ||
// "Bleed", | ||
// "Box", | ||
// "Center", | ||
// "Circle", | ||
// "Container", | ||
// "Divider", | ||
// "Flex", | ||
// "Float", | ||
// "GridItem", | ||
// "Grid", | ||
// "HStack", | ||
// "LinkBox", | ||
// "LinkOverlay", | ||
// "Spacer", | ||
// "Square", | ||
// "Stack", | ||
// "VisuallyHidden", | ||
// "VStack", | ||
// "Wrap", | ||
// ], | ||
// }), | ||
// TODO: pattenrs doesn't work with auto imports | ||
// defineUnimportPreset({ | ||
// from: `${outdir}/patterns`, | ||
// imports: [ | ||
// "aspectRatio", | ||
// "bleed", | ||
// "box", | ||
// "center", | ||
// "circle", | ||
// "container", | ||
// "divider", | ||
// "flex", | ||
// "float", | ||
// "gridItem", | ||
// "grid", | ||
// "hStack", | ||
// "linkBox", | ||
// "linkOverlay", | ||
// "spacer", | ||
// "square", | ||
// "stack", | ||
// "visuallyHidden", | ||
// "vStack", | ||
// "wrap", | ||
// ], | ||
// }), | ||
]; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters