-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
37 changed files
with
4,384 additions
and
5,546 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,40 @@ | ||
# panda-vscode | ||
|
||
The official Panda CSS VSCode extension | ||
|
||
## Contributing | ||
|
||
### Setup | ||
|
||
```bash | ||
yarn install | ||
``` | ||
|
||
### Development | ||
|
||
```bash | ||
yarn dev | ||
``` | ||
|
||
Then start the VSCode extension development host with [the `Run extension` launch config.](.vscode/launch.json) | ||
|
||
### Build | ||
|
||
```bash | ||
yarn build | ||
``` | ||
|
||
### Test | ||
|
||
```bash | ||
yarn test | ||
``` | ||
|
||
```bash | ||
yarn typecheck | ||
``` | ||
|
||
### Publishing | ||
|
||
Done automatically when the release PR (generated with | ||
[Changesets](https://github.com/changesets/changesets/blob/main/docs/adding-a-changeset.md)) is merged. |
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 |
---|---|---|
|
@@ -19,26 +19,27 @@ | |
"author": "Segun Adebayo <[email protected]>", | ||
"license": "MIT", | ||
"dependencies": { | ||
"@changesets/changelog-github": "0.4.8", | ||
"@changesets/cli": "2.26.2", | ||
"@types/node": "20.4.5", | ||
"@typescript-eslint/eslint-plugin": "6.2.1", | ||
"@typescript-eslint/parser": "6.2.1", | ||
"prettier": "^2.8.8", | ||
"tsup": "7.1.0", | ||
"typescript": "5.2.2", | ||
"vitest": "0.33.0" | ||
"@changesets/changelog-github": "0.5.0", | ||
"@changesets/cli": "2.27.1", | ||
"@types/node": "20.11.30", | ||
"@typescript-eslint/eslint-plugin": "7.3.1", | ||
"@typescript-eslint/parser": "7.3.1", | ||
"prettier": "^3.2.5", | ||
"tsup": "8.0.2", | ||
"typescript": "5.4.2", | ||
"vitest": "1.4.0" | ||
}, | ||
"resolutions": { | ||
"panda-css-vscode/esbuild": "npm:[email protected]" | ||
"panda-css-vscode/esbuild": "npm:[email protected]", | ||
"panda-css-vscode/lightningcss": "npm:[email protected]" | ||
}, | ||
"packageManager": "[email protected]", | ||
"workspaces": [ | ||
"packages/*", | ||
"sandbox/**" | ||
], | ||
"devDependencies": { | ||
"@types/eslint": "^8", | ||
"eslint": "^8.52.0" | ||
"@types/eslint": "^8.56.6", | ||
"eslint": "^8.57.0" | ||
} | ||
} |
108 changes: 108 additions & 0 deletions
108
packages/language-server/__tests__/fixtures/create-config-result.ts
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,108 @@ | ||
import { mergeConfigs } from '@pandacss/config' | ||
import { PandaContext } from '@pandacss/node' | ||
import presetBase from '@pandacss/preset-base' | ||
import presetPanda from '@pandacss/preset-panda' | ||
import { parseJson, stringifyJson } from '@pandacss/shared' | ||
import type { Config, LoadConfigResult, PresetCore, UserConfig } from '@pandacss/types' | ||
import { utils } from './utils' | ||
|
||
const buttonRecipe = { | ||
className: 'button', | ||
description: 'The styles for the Button component', | ||
base: { | ||
display: 'flex', | ||
cursor: 'pointer', | ||
fontWeight: 'bold', | ||
}, | ||
variants: { | ||
visual: { | ||
funky: { bg: 'red.200', color: 'slate.800' }, | ||
edgy: { border: '1px solid {colors.red.500}' }, | ||
}, | ||
size: { | ||
sm: { padding: '4', fontSize: '12px' }, | ||
lg: { padding: '8', fontSize: '40px' }, | ||
}, | ||
shape: { | ||
square: { borderRadius: '0' }, | ||
circle: { borderRadius: 'full' }, | ||
}, | ||
}, | ||
defaultVariants: { | ||
visual: 'funky', | ||
size: 'sm', | ||
shape: 'circle', | ||
}, | ||
} | ||
|
||
const fixturePreset: Omit<PresetCore, 'globalCss' | 'staticCss'> = { | ||
...presetBase, | ||
...presetPanda, | ||
theme: { | ||
...presetPanda.theme, | ||
recipes: { | ||
button: buttonRecipe, | ||
}, | ||
}, | ||
} | ||
|
||
const config: UserConfig = { | ||
...fixturePreset, | ||
optimize: true, | ||
cwd: '', | ||
outdir: 'styled-system', | ||
include: [], | ||
// | ||
cssVarRoot: ':where(html)', | ||
jsxFramework: 'react', | ||
} | ||
|
||
const fixtureDefaults = { | ||
dependencies: [], | ||
config, | ||
path: '', | ||
hooks: {}, | ||
serialized: stringifyJson(config), | ||
deserialize: () => parseJson(stringifyJson(config)), | ||
} as LoadConfigResult | ||
|
||
export const createConfigResult = (userConfig?: Config) => { | ||
const resolvedConfig = ( | ||
userConfig ? mergeConfigs([userConfig, fixtureDefaults.config]) : fixtureDefaults.config | ||
) as UserConfig | ||
|
||
return { ...fixtureDefaults, config: resolvedConfig } | ||
} | ||
|
||
export const createContext = (userConfig?: Config) => { | ||
let resolvedConfig = ( | ||
userConfig ? mergeConfigs([userConfig, fixtureDefaults.config]) : fixtureDefaults.config | ||
) as UserConfig | ||
|
||
const hooks = userConfig?.hooks ?? {} | ||
|
||
// This allows editing the config before the context is created | ||
// since this function is only used in tests, we only look at the user hooks | ||
// not the presets hooks, so that we can keep this fn sync | ||
if (hooks['config:resolved']) { | ||
const result = hooks['config:resolved']({ | ||
config: resolvedConfig, | ||
path: fixtureDefaults.path, | ||
dependencies: fixtureDefaults.dependencies, | ||
utils: utils, | ||
}) | ||
if (result) { | ||
resolvedConfig = result as UserConfig | ||
} | ||
} | ||
|
||
return new PandaContext({ | ||
...fixtureDefaults, | ||
hooks, | ||
config: resolvedConfig, | ||
tsconfig: { | ||
// @ts-expect-error | ||
useInMemoryFileSystem: 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 |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './create-config-result' |
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,18 @@ | ||
import { traverse } from '@pandacss/shared' | ||
|
||
const omit = <T, K extends keyof T | (string & {})>(obj: T, paths: K[]): Omit<T, K> => { | ||
const result = { ...obj } | ||
|
||
traverse(result, ({ path, parent, key }) => { | ||
if (paths.includes(path as K)) { | ||
delete (parent as any)[key] | ||
} | ||
}) | ||
|
||
return result as Omit<T, K> | ||
} | ||
|
||
export const utils = { | ||
omit, | ||
traverse, | ||
} |
Oops, something went wrong.