--------------------------------------------------------------------------------
/packages/studio/styled-system/patterns/box.mjs:
--------------------------------------------------------------------------------
1 | import { mapObject } from '../helpers.mjs'
2 | import { css } from '../css/index.mjs'
3 |
4 | const boxConfig = {
5 | transform(props) {
6 | return props
7 | },
8 | }
9 |
10 | export const getBoxStyle = (styles = {}) => boxConfig.transform(styles, { map: mapObject })
11 |
12 | export const box = (styles) => css(getBoxStyle(styles))
13 |
--------------------------------------------------------------------------------
/sandbox/svelte/src/routes/+page.svelte:
--------------------------------------------------------------------------------
1 |
6 |
7 | using class binding css
8 |
15 | It works in Svelte, using inline styles
16 |
17 |
--------------------------------------------------------------------------------
/website/src/types.ts:
--------------------------------------------------------------------------------
1 | import type { ReactNode } from 'react'
2 | import type { PageOpts } from 'nextra'
3 | import type { DocsThemeConfig } from './constants'
4 |
5 | export type Context = {
6 | pageOpts: PageOpts
7 | themeConfig: DocsThemeConfig
8 | }
9 |
10 | export type SearchResult = {
11 | children: ReactNode
12 | id: string
13 | prefix?: ReactNode
14 | route: string
15 | }
16 |
--------------------------------------------------------------------------------
/packages/studio/styled-system/jsx/container.mjs:
--------------------------------------------------------------------------------
1 | import { createElement, forwardRef } from 'react'
2 | import { panda } from './factory.mjs'
3 | import { getContainerStyle } from '../patterns/container.mjs'
4 |
5 | export const Container = forwardRef(function Container(props, ref) {
6 | const styleProps = getContainerStyle()
7 | return createElement(panda.div, { ref, ...styleProps, ...props })
8 | })
9 |
--------------------------------------------------------------------------------
/packages/studio/styled-system/jsx/center.d.ts:
--------------------------------------------------------------------------------
1 | /* eslint-disable */
2 | import type { FunctionComponent } from 'react'
3 | import type { CenterProperties } from '../patterns/center'
4 | import type { HTMLPandaProps } from '../types/jsx'
5 |
6 | export type CenterProps = CenterProperties & Omit, keyof CenterProperties >
7 |
8 |
9 | export declare const Center: FunctionComponent
--------------------------------------------------------------------------------
/packages/studio/styled-system/jsx/circle.d.ts:
--------------------------------------------------------------------------------
1 | /* eslint-disable */
2 | import type { FunctionComponent } from 'react'
3 | import type { CircleProperties } from '../patterns/circle'
4 | import type { HTMLPandaProps } from '../types/jsx'
5 |
6 | export type CircleProps = CircleProperties & Omit, keyof CircleProperties >
7 |
8 |
9 | export declare const Circle: FunctionComponent
--------------------------------------------------------------------------------
/packages/studio/styled-system/jsx/hstack.d.ts:
--------------------------------------------------------------------------------
1 | /* eslint-disable */
2 | import type { FunctionComponent } from 'react'
3 | import type { HstackProperties } from '../patterns/hstack'
4 | import type { HTMLPandaProps } from '../types/jsx'
5 |
6 | export type HstackProps = HstackProperties & Omit, keyof HstackProperties >
7 |
8 |
9 | export declare const HStack: FunctionComponent
--------------------------------------------------------------------------------
/packages/studio/styled-system/jsx/spacer.d.ts:
--------------------------------------------------------------------------------
1 | /* eslint-disable */
2 | import type { FunctionComponent } from 'react'
3 | import type { SpacerProperties } from '../patterns/spacer'
4 | import type { HTMLPandaProps } from '../types/jsx'
5 |
6 | export type SpacerProps = SpacerProperties & Omit, keyof SpacerProperties >
7 |
8 |
9 | export declare const Spacer: FunctionComponent
--------------------------------------------------------------------------------
/packages/studio/styled-system/jsx/square.d.ts:
--------------------------------------------------------------------------------
1 | /* eslint-disable */
2 | import type { FunctionComponent } from 'react'
3 | import type { SquareProperties } from '../patterns/square'
4 | import type { HTMLPandaProps } from '../types/jsx'
5 |
6 | export type SquareProps = SquareProperties & Omit, keyof SquareProperties >
7 |
8 |
9 | export declare const Square: FunctionComponent
--------------------------------------------------------------------------------
/packages/studio/styled-system/jsx/vstack.d.ts:
--------------------------------------------------------------------------------
1 | /* eslint-disable */
2 | import type { FunctionComponent } from 'react'
3 | import type { VstackProperties } from '../patterns/vstack'
4 | import type { HTMLPandaProps } from '../types/jsx'
5 |
6 | export type VstackProps = VstackProperties & Omit, keyof VstackProperties >
7 |
8 |
9 | export declare const VStack: FunctionComponent
--------------------------------------------------------------------------------
/playground/src/components/Toolbar.tsx:
--------------------------------------------------------------------------------
1 | import { HStack } from '@/styled-system/jsx'
2 | import { PropsWithChildren } from 'react'
3 | import { Logo } from './Logo'
4 |
5 | export const Toolbar = (props: PropsWithChildren) => (
6 |
7 |
8 | {props.children}
9 |
10 | )
11 |
--------------------------------------------------------------------------------
/website/src/components/code-highlight/code.ts:
--------------------------------------------------------------------------------
1 | import { css } from '@/styled-system/css'
2 | import { Code } from 'bright'
3 | import gruvBoxTheme from './gruvbox-theme.cjs'
4 |
5 | Code.theme = gruvBoxTheme
6 |
7 | export { Code }
8 |
9 | export const codeStyle = css({
10 | padding: '4',
11 | fontFamily: 'mono',
12 | fontSize: 'md',
13 | lineHeight: '1.7',
14 | fontWeight: '500'
15 | })
16 |
--------------------------------------------------------------------------------
/packages/config/src/index.ts:
--------------------------------------------------------------------------------
1 | export { findConfigFile } from './find-config'
2 | export { getConfigDependencies, type GetDepsOptions } from './get-mod-deps'
3 | export { getResolvedConfig } from './get-resolved-config'
4 | export { bundleConfigFile, loadConfigFile, resolveConfigFile } from './load-config'
5 | export { mergeConfigs } from './merge-config'
6 | export { convertTsPathsToRegexes } from './ts-config-paths'
7 |
--------------------------------------------------------------------------------
/packages/shared/src/memo.ts:
--------------------------------------------------------------------------------
1 | export const memo = any>(fn: T): T => {
2 | const cache = new Map()
3 | const get = (...args: any[]) => {
4 | const key = JSON.stringify(args)
5 | if (cache.has(key)) {
6 | return cache.get(key)
7 | }
8 | const result = fn(...args)
9 | cache.set(key, result)
10 | return result
11 | }
12 | return get as T
13 | }
14 |
--------------------------------------------------------------------------------
/packages/studio/styled-system/chunks/src__components__token-group.css:
--------------------------------------------------------------------------------
1 | @layer utilities {
2 | .d_flex {
3 | display: flex;
4 | }
5 |
6 | .flex_column {
7 | flex-direction: column;
8 | }
9 |
10 | .gap_3 {
11 | gap: var(--spacing-3);
12 | }
13 |
14 | .w_full {
15 | width: var(--sizes-full);
16 | }
17 |
18 | .mt_5 {
19 | margin-top: var(--spacing-5);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/packages/studio/styled-system/jsx/divider.d.ts:
--------------------------------------------------------------------------------
1 | /* eslint-disable */
2 | import type { FunctionComponent } from 'react'
3 | import type { DividerProperties } from '../patterns/divider'
4 | import type { HTMLPandaProps } from '../types/jsx'
5 |
6 | export type DividerProps = DividerProperties & Omit, keyof DividerProperties >
7 |
8 |
9 | export declare const Divider: FunctionComponent
--------------------------------------------------------------------------------
/packages/studio/styled-system/jsx/link-overlay.mjs:
--------------------------------------------------------------------------------
1 | import { createElement, forwardRef } from 'react'
2 | import { panda } from './factory.mjs'
3 | import { getLinkOverlayStyle } from '../patterns/link-overlay.mjs'
4 |
5 | export const LinkOverlay = forwardRef(function LinkOverlay(props, ref) {
6 | const styleProps = getLinkOverlayStyle()
7 | return createElement(panda.a, { ref, ...styleProps, ...props })
8 | })
9 |
--------------------------------------------------------------------------------
/packages/studio/styled-system/jsx/styled-link.mjs:
--------------------------------------------------------------------------------
1 | import { createElement, forwardRef } from 'react'
2 | import { panda } from './factory.mjs'
3 | import { getStyledLinkStyle } from '../patterns/styled-link.mjs'
4 |
5 | export const StyledLink = forwardRef(function StyledLink(props, ref) {
6 | const styleProps = getStyledLinkStyle()
7 | return createElement(panda.div, { ref, ...styleProps, ...props })
8 | })
9 |
--------------------------------------------------------------------------------
/packages/core/__tests__/to-css.test.ts:
--------------------------------------------------------------------------------
1 | import { describe, expect, test } from 'vitest'
2 | import { toCss } from '../src/to-css'
3 |
4 | describe('to-css', () => {
5 | test('should convert', () => {
6 | expect(toCss({ whiteSpace: 'nowrap' }).css).toMatchInlineSnapshot('"white-space: nowrap"')
7 | expect(toCss({ '--welcome-x': '20' }).css).toMatchInlineSnapshot('"--welcome-x: 20"')
8 | })
9 | })
10 |
--------------------------------------------------------------------------------
/packages/studio/styled-system/jsx/link-box.d.ts:
--------------------------------------------------------------------------------
1 | /* eslint-disable */
2 | import type { FunctionComponent } from 'react'
3 | import type { LinkBoxProperties } from '../patterns/link-box'
4 | import type { HTMLPandaProps } from '../types/jsx'
5 |
6 | export type LinkBoxProps = LinkBoxProperties & Omit, keyof LinkBoxProperties >
7 |
8 |
9 | export declare const LinkBox: FunctionComponent
--------------------------------------------------------------------------------
/website/src/icons/word-wrap.tsx:
--------------------------------------------------------------------------------
1 | export function WordWrapIcon(props: React.ComponentProps<'svg'>) {
2 | return (
3 |
9 | )
10 | }
11 |
--------------------------------------------------------------------------------
/packages/cli/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../../tsconfig.json",
3 | "include": ["src", "index.ts", "app"],
4 | "exclude": ["node_modules"],
5 | "compilerOptions": {
6 | "jsx": "react-jsx",
7 | "tsBuildInfoFile": "node_modules/.cache/.tsbuildinfo",
8 | "paths": {
9 | "virtual:panda": ["./virtual-panda.d.ts"],
10 | "~react-pages": ["./react-pages.d.ts"]
11 | }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/packages/studio/styled-system/jsx/grid-item.d.ts:
--------------------------------------------------------------------------------
1 | /* eslint-disable */
2 | import type { FunctionComponent } from 'react'
3 | import type { GridItemProperties } from '../patterns/grid-item'
4 | import type { HTMLPandaProps } from '../types/jsx'
5 |
6 | export type GridItemProps = GridItemProperties & Omit, keyof GridItemProperties >
7 |
8 |
9 | export declare const GridItem: FunctionComponent
--------------------------------------------------------------------------------
/sandbox/svelte/src/app.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | %sveltekit.head%
8 |
9 |
10 | %sveltekit.body%
11 |
12 |
13 |
--------------------------------------------------------------------------------
/website/src/nextra/lib/use-git-edit-url.ts:
--------------------------------------------------------------------------------
1 | import { useConfig } from '../contexts'
2 | import gitUrlParse from 'git-url-parse'
3 |
4 | export function useGitEditUrl(filePath = ''): string {
5 | const config = useConfig()
6 | const repo = gitUrlParse(config.docsRepositoryBase || '')
7 |
8 | if (!repo) throw new Error('Invalid `docsRepositoryBase` URL!')
9 |
10 | return `${repo.href}/${filePath}`
11 | }
12 |
--------------------------------------------------------------------------------
/packages/studio/styled-system/chunks/src__components__analyzer__truncated-text.css:
--------------------------------------------------------------------------------
1 | @layer utilities {
2 | .p_2 {
3 | padding: var(--spacing-2);
4 | }
5 |
6 | .bg_card {
7 | background-color: var(--colors-card);
8 | }
9 |
10 | .border_1px_solid_rgba\(0\,_0\,_0\,_0\.1\) {
11 | border: 1px solid rgba(0, 0, 0, 0.1);
12 | }
13 |
14 | .text_text {
15 | color: var(--colors-text);
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/playground/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '3.3'
2 |
3 | services:
4 | db:
5 | container_name: panda-mysql
6 | image: mariadb:10.8.2-focal
7 | restart: always
8 | ports:
9 | - 3310:3306
10 | environment:
11 | MARIADB_ROOT_PASSWORD: root
12 | MARIADB_DATABASE: panda
13 | volumes:
14 | - panda-mysql:/var/lib/mysql
15 |
16 | volumes:
17 | panda-mysql:
18 | driver: local
19 |
--------------------------------------------------------------------------------
/sandbox/next-js-pages/src/pages/_app.tsx:
--------------------------------------------------------------------------------
1 | import '@/styles/globals.css'
2 | import type { AppProps } from 'next/app'
3 | import { Inter } from 'next/font/google'
4 |
5 | const inter = Inter({ subsets: ['latin'] })
6 |
7 | export default function App({ Component, pageProps }: AppProps) {
8 | return (
9 |
10 |
11 |
12 | );
13 | }
14 |
--------------------------------------------------------------------------------
/packages/preset-base/src/index.ts:
--------------------------------------------------------------------------------
1 | import type { Preset } from '@pandacss/types'
2 |
3 | import { conditions } from './conditions'
4 | import { utilities } from './utilities'
5 | import { patterns } from './patterns'
6 |
7 | const definePreset = (preset: T) => preset
8 |
9 | export const preset = definePreset({
10 | conditions,
11 | utilities,
12 | patterns,
13 | })
14 |
15 | export default preset
16 |
--------------------------------------------------------------------------------
/packages/studio/astro.config.mjs:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'astro/config'
2 | import react from '@astrojs/react'
3 | import virtualPanda from './virtual-panda.mjs'
4 |
5 | // https://astro.build/config
6 | export default defineConfig({
7 | outDir: process.env.ASTRO_OUT_DIR,
8 | integrations: [react(), virtualPanda()],
9 | vite: {
10 | ssr: {
11 | noExternal: ['@ark-ui/react'],
12 | },
13 | },
14 | })
15 |
--------------------------------------------------------------------------------
/packages/studio/src/components/analyzer/external-icon.tsx:
--------------------------------------------------------------------------------
1 | /** @see https://iconmonstr.com/share-11-svg/ */
2 | export const ExternalIcon = () => {
3 | return (
4 |
7 | )
8 | }
9 |
--------------------------------------------------------------------------------
/packages/studio/src/pages/sizes.astro:
--------------------------------------------------------------------------------
1 | ---
2 | import { Sizes } from '../components/sizes'
3 | import Layout from '../layouts/Layout.astro'
4 | import Sidebar from '../layouts/Sidebar.astro'
5 | import context from '../lib/panda.context'
6 |
7 | const tokens = context.getCategory('sizes')
8 | ---
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/packages/studio/styled-system/jsx/container.d.ts:
--------------------------------------------------------------------------------
1 | /* eslint-disable */
2 | import type { FunctionComponent } from 'react'
3 | import type { ContainerProperties } from '../patterns/container'
4 | import type { HTMLPandaProps } from '../types/jsx'
5 |
6 | export type ContainerProps = ContainerProperties & Omit, keyof ContainerProperties >
7 |
8 |
9 | export declare const Container: FunctionComponent
--------------------------------------------------------------------------------
/sandbox/vite-ts/.gitignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | logs
3 | *.log
4 | npm-debug.log*
5 | yarn-debug.log*
6 | yarn-error.log*
7 | pnpm-debug.log*
8 | lerna-debug.log*
9 |
10 | node_modules
11 | dist
12 | dist-ssr
13 | *.local
14 |
15 | # Editor directories and files
16 | .vscode/*
17 | !.vscode/extensions.json
18 | .idea
19 | .DS_Store
20 | *.suo
21 | *.ntvs*
22 | *.njsproj
23 | *.sln
24 | *.sw?
25 |
26 | ## Panda
27 | styled-system
28 |
--------------------------------------------------------------------------------
/website/src/nextra/contexts/menu.ts:
--------------------------------------------------------------------------------
1 | import { createContext, useContext } from 'react'
2 |
3 | interface Menu {
4 | menu: boolean
5 | setMenu: React.Dispatch>
6 | }
7 |
8 | const MenuContext = createContext