@pandacss/studio 1.2.0 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/studio.d.mts CHANGED
@@ -1,9 +1,9 @@
1
1
  interface BuildOpts {
2
2
  outDir: string;
3
3
  configPath: string;
4
- port?: string;
5
- host?: boolean;
6
- base?: string;
4
+ port?: string | undefined;
5
+ host?: boolean | undefined;
6
+ base?: string | undefined;
7
7
  }
8
8
  declare function buildStudio({ outDir, configPath, base }: BuildOpts): Promise<void>;
9
9
  declare function serveStudio({ configPath, port, host, outDir, base }: BuildOpts): Promise<void>;
package/dist/studio.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  interface BuildOpts {
2
2
  outDir: string;
3
3
  configPath: string;
4
- port?: string;
5
- host?: boolean;
6
- base?: string;
4
+ port?: string | undefined;
5
+ host?: boolean | undefined;
6
+ base?: string | undefined;
7
7
  }
8
8
  declare function buildStudio({ outDir, configPath, base }: BuildOpts): Promise<void>;
9
9
  declare function serveStudio({ configPath, port, host, outDir, base }: BuildOpts): Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/studio",
3
- "version": "1.2.0",
3
+ "version": "1.3.1",
4
4
  "description": "The automated token documentation for Panda CSS",
5
5
  "main": "dist/studio.js",
6
6
  "module": "dist/studio.mjs",
@@ -48,12 +48,12 @@
48
48
  "react": "19.1.1",
49
49
  "react-dom": "19.1.1",
50
50
  "vite": "7.0.6",
51
- "@pandacss/config": "1.2.0",
52
- "@pandacss/logger": "1.2.0",
53
- "@pandacss/shared": "1.2.0",
54
- "@pandacss/token-dictionary": "1.2.0",
55
- "@pandacss/types": "1.2.0",
56
- "@pandacss/astro-plugin-studio": "1.2.0"
51
+ "@pandacss/config": "1.3.1",
52
+ "@pandacss/logger": "1.3.1",
53
+ "@pandacss/shared": "1.3.1",
54
+ "@pandacss/token-dictionary": "1.3.1",
55
+ "@pandacss/types": "1.3.1",
56
+ "@pandacss/astro-plugin-studio": "1.3.1"
57
57
  },
58
58
  "devDependencies": {
59
59
  "@types/react": "18.2.55",
@@ -1,11 +1,11 @@
1
1
  /* eslint-disable */
2
2
  import type { SlotRecipeRuntimeFn, RecipeVariantProps } from '../types/recipe';
3
3
  import type { JsxHTMLProps, JsxStyleProps, Assign } from '../types/system-types';
4
- import type { JsxFactoryOptions } from '../types/jsx';
5
- import type { ComponentType, ElementType, ComponentPropsWithoutRef, ElementRef, Ref } from 'react'
4
+ import type { JsxFactoryOptions, ComponentProps } from '../types/jsx';
5
+ import type { ComponentType, ElementType } from 'react'
6
6
 
7
7
  interface UnstyledProps {
8
- unstyled?: boolean
8
+ unstyled?: boolean | undefined
9
9
  }
10
10
 
11
11
  type SvaFn<S extends string = any> = SlotRecipeRuntimeFn<S, any>
@@ -18,29 +18,36 @@ type SlotRecipe = SvaFn | SlotRecipeFn
18
18
 
19
19
  type InferSlot<R extends SlotRecipe> = R extends SlotRecipeFn ? R['__slot'] : R extends SvaFn<infer S> ? S : never
20
20
 
21
- type ComponentProps<T extends ElementType> = Omit<ComponentPropsWithoutRef<T>, 'ref'> & {
22
- ref?: Ref<ElementRef<T>>
21
+ interface WithProviderOptions<P = {}> {
22
+ defaultProps?: Partial<P> | undefined
23
23
  }
24
24
 
25
25
  type StyleContextProvider<T extends ElementType, R extends SlotRecipe> = ComponentType<
26
26
  JsxHTMLProps<ComponentProps<T> & UnstyledProps, Assign<RecipeVariantProps<R>, JsxStyleProps>>
27
27
  >
28
28
 
29
+ type StyleContextRootProvider<T extends ElementType, R extends SlotRecipe> = ComponentType<
30
+ ComponentProps<T> & UnstyledProps & RecipeVariantProps<R>
31
+ >
32
+
29
33
  type StyleContextConsumer<T extends ElementType> = ComponentType<
30
34
  JsxHTMLProps<ComponentProps<T> & UnstyledProps, JsxStyleProps>
31
35
  >
32
36
 
33
37
  export interface StyleContext<R extends SlotRecipe> {
34
- withRootProvider: <T extends ElementType>(Component: T) => StyleContextProvider<T, R>
38
+ withRootProvider: <T extends ElementType>(
39
+ Component: T,
40
+ options?: WithProviderOptions<ComponentProps<T>> | undefined
41
+ ) => StyleContextRootProvider<T, R>
35
42
  withProvider: <T extends ElementType>(
36
43
  Component: T,
37
44
  slot: InferSlot<R>,
38
- options?: JsxFactoryOptions<ComponentProps<T>>
45
+ options?: JsxFactoryOptions<ComponentProps<T>> | undefined
39
46
  ) => StyleContextProvider<T, R>
40
47
  withContext: <T extends ElementType>(
41
48
  Component: T,
42
49
  slot: InferSlot<R>,
43
- options?: JsxFactoryOptions<ComponentProps<T>>
50
+ options?: JsxFactoryOptions<ComponentProps<T>> | undefined
44
51
  ) => StyleContextConsumer<T>
45
52
  }
46
53
 
@@ -19,16 +19,20 @@ export function createStyleContext(recipe) {
19
19
  return { ...slotStyles, ...restProps }
20
20
  }
21
21
 
22
- const withRootProvider = (Component) => {
22
+ const withRootProvider = (Component, options) => {
23
23
  const WithRootProvider = (props) => {
24
24
  const [variantProps, otherProps] = svaFn.splitVariantProps(props)
25
25
 
26
26
  const slotStyles = isConfigRecipe ? svaFn(variantProps) : svaFn.raw(variantProps)
27
27
  slotStyles._classNameMap = svaFn.classNameMap
28
28
 
29
+ const mergedProps = options?.defaultProps
30
+ ? { ...options.defaultProps, ...otherProps }
31
+ : otherProps
32
+
29
33
  return createElement(StyleContext.Provider, {
30
34
  value: slotStyles,
31
- children: createElement(Component, otherProps)
35
+ children: createElement(Component, mergedProps)
32
36
  })
33
37
  }
34
38
 
@@ -57,7 +57,7 @@ function styledFn(Dynamic, configOrCva = {}, options = {}) {
57
57
  ...elementProps,
58
58
  ...normalizeHTMLProps(htmlProps),
59
59
  className: classes(),
60
- }, combinedProps.children ?? children)
60
+ }, children ?? combinedProps.children)
61
61
  })
62
62
 
63
63
  const name = getDisplayName(__base__)
@@ -15,6 +15,8 @@ interface Recursive<T> {
15
15
  * -----------------------------------------------------------------------------*/
16
16
 
17
17
  type TextStyleProperty =
18
+ | 'color'
19
+ | 'direction'
18
20
  | 'font'
19
21
  | 'fontFamily'
20
22
  | 'fontFeatureSettings'
@@ -35,6 +37,7 @@ type TextStyleProperty =
35
37
  | 'fontVariantPosition'
36
38
  | 'fontVariationSettings'
37
39
  | 'fontWeight'
40
+ | 'hangingPunctuation'
38
41
  | 'hypens'
39
42
  | 'hyphenateCharacter'
40
43
  | 'hyphenateLimitChars'
@@ -43,11 +46,17 @@ type TextStyleProperty =
43
46
  | 'lineHeight'
44
47
  | 'quotes'
45
48
  | 'overflowWrap'
49
+ | 'tabSize'
50
+ | 'textAlign'
51
+ | 'textAlignLast'
46
52
  | 'textCombineUpright'
47
53
  | 'textDecoration'
48
54
  | 'textDecorationColor'
49
55
  | 'textDecorationLine'
56
+ | 'textDecorationSkip'
57
+ | 'textDecorationSkipBox'
50
58
  | 'textDecorationSkipInk'
59
+ | 'textDecorationSkipInset'
51
60
  | 'textDecorationStyle'
52
61
  | 'textDecorationThickness'
53
62
  | 'textEmphasis'
@@ -60,16 +69,21 @@ type TextStyleProperty =
60
69
  | 'textOverflow'
61
70
  | 'textRendering'
62
71
  | 'textShadow'
72
+ | 'textStroke'
73
+ | 'textStrokeColor'
74
+ | 'textStrokeWidth'
63
75
  | 'textTransform'
64
76
  | 'textUnderlineOffset'
65
77
  | 'textUnderlinePosition'
66
78
  | 'textWrap'
67
79
  | 'textWrapMode'
68
80
  | 'textWrapStyle'
81
+ | 'unicodeBidi'
69
82
  | 'verticalAlign'
70
83
  | 'whiteSpace'
71
84
  | 'wordBreak'
72
85
  | 'wordSpacing'
86
+ | 'writingMode'
73
87
 
74
88
  export type TextStyle = CompositionStyleObject<TextStyleProperty>
75
89
 
@@ -79,17 +93,11 @@ export type TextStyles = Recursive<Token<TextStyle>>
79
93
  * Layer styles
80
94
  * -----------------------------------------------------------------------------*/
81
95
 
82
- type Placement =
83
- | 'Top'
84
- | 'Right'
85
- | 'Bottom'
86
- | 'Left'
87
- | 'Inline'
88
- | 'Block'
89
- | 'InlineStart'
90
- | 'InlineEnd'
91
- | 'BlockStart'
92
- | 'BlockEnd'
96
+ type LogicalPlacement = 'Inline' | 'Block' | 'InlineStart' | 'InlineEnd' | 'BlockStart' | 'BlockEnd'
97
+
98
+ type PhysicalPlacement = 'Top' | 'Right' | 'Bottom' | 'Left'
99
+
100
+ type Placement = PhysicalPlacement | LogicalPlacement
93
101
 
94
102
  type Radius =
95
103
  | `Top${'Right' | 'Left'}`
@@ -98,20 +106,80 @@ type Radius =
98
106
  | `End${'Start' | 'End'}`
99
107
 
100
108
  type LayerStyleProperty =
109
+ | 'aspectRatio'
101
110
  | 'background'
102
111
  | 'backgroundColor'
103
112
  | 'backgroundImage'
104
- | 'borderRadius'
105
113
  | 'border'
106
- | 'borderWidth'
107
114
  | 'borderColor'
115
+ | 'borderImage'
116
+ | 'borderImageOutset'
117
+ | 'borderImageRepeat'
118
+ | 'borderImageSlice'
119
+ | 'borderImageSource'
120
+ | 'borderImageWidth'
121
+ | 'borderRadius'
108
122
  | 'borderStyle'
123
+ | 'borderWidth'
124
+ | `border${Placement}`
125
+ | `border${Placement}Color`
126
+ | `border${Placement}Style`
127
+ | `border${Placement}Width`
128
+ | 'borderRadius'
129
+ | `border${Radius}Radius`
109
130
  | 'boxShadow'
131
+ | 'boxShadowColor'
132
+ | 'clipPath'
133
+ | 'color'
134
+ | 'contain'
135
+ | 'content'
136
+ | 'contentVisibility'
137
+ | 'cursor'
138
+ | 'display'
110
139
  | 'filter'
111
140
  | 'backdropFilter'
112
- | 'transform'
113
- | 'color'
141
+ | 'height'
142
+ | 'width'
143
+ | 'minHeight'
144
+ | 'minWidth'
145
+ | 'maxHeight'
146
+ | 'maxWidth'
147
+ | `margin${Placement}`
148
+ | 'inset'
149
+ | `inset${LogicalPlacement}`
150
+ | Lowercase<PhysicalPlacement>
151
+ | 'isolation'
152
+ | 'mask'
153
+ | 'maskClip'
154
+ | 'maskComposite'
155
+ | 'maskImage'
156
+ | 'maskMode'
157
+ | 'maskOrigin'
158
+ | 'maskPosition'
159
+ | 'maskRepeat'
160
+ | 'maskSize'
161
+ | 'mixBlendMode'
162
+ | 'objectFit'
163
+ | 'objectPosition'
114
164
  | 'opacity'
165
+ | 'outline'
166
+ | 'outlineColor'
167
+ | 'outlineOffset'
168
+ | 'outlineStyle'
169
+ | 'outlineWidth'
170
+ | 'overflow'
171
+ | 'overflowX'
172
+ | 'overflowY'
173
+ | 'padding'
174
+ | `padding${Placement}`
175
+ | 'pointerEvents'
176
+ | 'position'
177
+ | 'resize'
178
+ | 'transform'
179
+ | 'transition'
180
+ | 'visibility'
181
+ | 'willChange'
182
+ | 'zIndex'
115
183
  | 'backgroundBlendMode'
116
184
  | 'backgroundAttachment'
117
185
  | 'backgroundClip'
@@ -119,14 +187,6 @@ type LayerStyleProperty =
119
187
  | 'backgroundPosition'
120
188
  | 'backgroundRepeat'
121
189
  | 'backgroundSize'
122
- | `border${Placement}`
123
- | `border${Placement}Width`
124
- | 'borderRadius'
125
- | `border${Radius}Radius`
126
- | `border${Placement}Color`
127
- | `border${Placement}Style`
128
- | 'padding'
129
- | `padding${Placement}`
130
190
 
131
191
  export type LayerStyle = CompositionStyleObject<LayerStyleProperty>
132
192
 
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable */
2
- import type { ComponentPropsWithoutRef, ElementType, ElementRef, JSX, Ref } from 'react'
2
+ import type { ElementType, JSX, ComponentPropsWithRef, ComponentType, Component } from 'react'
3
3
  import type { RecipeDefinition, RecipeSelection, RecipeVariantRecord } from './recipe';
4
4
  import type { Assign, DistributiveOmit, DistributiveUnion, JsxHTMLProps, JsxStyleProps, Pretty } from './system-types';
5
5
 
@@ -14,27 +14,34 @@ export interface UnstyledProps {
14
14
  unstyled?: boolean | undefined
15
15
  }
16
16
 
17
- export type ComponentProps<T extends ElementType> = DistributiveOmit<ComponentPropsWithoutRef<T>, 'ref'> & {
18
- ref?: Ref<ElementRef<T>>
17
+ export interface AsProps {
18
+ /**
19
+ * The element to render as
20
+ */
21
+ as?: ElementType | undefined
19
22
  }
20
23
 
24
+ export type ComponentProps<T extends ElementType> = T extends ComponentType<infer P> | Component<infer P>
25
+ ? JSX.LibraryManagedAttributes<T, P>
26
+ : ComponentPropsWithRef<T>
27
+
21
28
  export interface PandaComponent<T extends ElementType, P extends Dict = {}> {
22
- (props: JsxHTMLProps<ComponentProps<T> & UnstyledProps, Assign<JsxStyleProps, P>>): JSX.Element
23
- displayName?: string
29
+ (props: JsxHTMLProps<ComponentProps<T> & UnstyledProps & AsProps, Assign<JsxStyleProps, P>>): JSX.Element
30
+ displayName?: string | undefined
24
31
  }
25
32
 
26
33
  interface RecipeFn {
27
34
  __type: any
28
35
  }
29
36
 
30
- interface JsxFactoryOptions<TProps extends Dict> {
37
+ export interface JsxFactoryOptions<TProps extends Dict> {
31
38
  dataAttr?: boolean
32
- defaultProps?: TProps
39
+ defaultProps?: Partial<TProps>
33
40
  shouldForwardProp?: (prop: string, variantKeys: string[]) => boolean
34
41
  forwardProps?: string[]
35
42
  }
36
43
 
37
- export type JsxRecipeProps<T extends ElementType, P extends Dict> = JsxHTMLProps<ComponentProps<T> & UnstyledProps, P>;
44
+ export type JsxRecipeProps<T extends ElementType, P extends Dict> = JsxHTMLProps<ComponentProps<T> & UnstyledProps & AsProps, P>;
38
45
 
39
46
  export type JsxElement<T extends ElementType, P extends Dict> = T extends PandaComponent<infer A, infer B>
40
47
  ? PandaComponent<A, Pretty<DistributiveUnion<P, B>>>
@@ -55,6 +62,6 @@ export type JsxElements = {
55
62
 
56
63
  export type Panda = JsxFactory & JsxElements
57
64
 
58
- export type HTMLPandaProps<T extends ElementType> = JsxHTMLProps<ComponentProps<T> & UnstyledProps, JsxStyleProps>
65
+ export type HTMLPandaProps<T extends ElementType> = JsxHTMLProps<ComponentProps<T> & UnstyledProps & AsProps, JsxStyleProps>
59
66
 
60
67
  export type PandaVariantProps<T extends PandaComponent<any, any>> = T extends PandaComponent<any, infer Props> ? Props : never
@@ -150,7 +150,8 @@ export interface UtilityValues {
150
150
  transitionTimingFunction: Tokens["easings"];
151
151
  transitionDelay: Tokens["durations"];
152
152
  transitionDuration: Tokens["durations"];
153
- transition: "all" | "common" | "background" | "colors" | "opacity" | "shadow" | "transform";
153
+ transitionProperty: "common" | "colors" | "size" | "position" | "background";
154
+ transition: "all" | "common" | "size" | "position" | "background" | "colors" | "opacity" | "shadow" | "transform";
154
155
  animation: Tokens["animations"];
155
156
  animationName: "spin" | "ping" | "pulse" | "bounce";
156
157
  animationTimingFunction: Tokens["easings"];
@@ -5907,7 +5907,7 @@ transitionDuration?: ConditionalValue<UtilityValues["transitionDuration"] | CssV
5907
5907
  *
5908
5908
  * @see https://developer.mozilla.org/docs/Web/CSS/transition-property
5909
5909
  */
5910
- transitionProperty?: ConditionalValue<CssProperties["transitionProperty"] | AnyString>
5910
+ transitionProperty?: ConditionalValue<UtilityValues["transitionProperty"] | CssVars | CssProperties["transitionProperty"] | AnyString>
5911
5911
  /**
5912
5912
  * The **`transition-timing-function`** CSS property sets how intermediate values are calculated for CSS properties being affected by a transition effect.
5913
5913
  *
package/tsconfig.json CHANGED
@@ -1,8 +1,24 @@
1
1
  {
2
- "extends": "astro/tsconfigs/strict",
3
- "include": ["src", "__tests__"],
2
+ "include": ["src", "__tests__", "astro.config.mjs"],
4
3
  "compilerOptions": {
4
+ "target": "ESNext",
5
+ "lib": ["ES2022"],
6
+ "module": "ESNext",
7
+ "moduleResolution": "Bundler",
8
+ "allowImportingTsExtensions": true,
9
+ "resolveJsonModule": true,
10
+ "verbatimModuleSyntax": true,
11
+ "isolatedModules": true,
12
+ "noEmit": true,
5
13
  "jsx": "preserve",
14
+ "strict": true,
15
+ "noUnusedLocals": true,
16
+ "noUnusedParameters": true,
17
+ // "exactOptionalPropertyTypes": true,
18
+ "skipLibCheck": true,
19
+ "forceConsistentCasingInFileNames": true,
20
+ "esModuleInterop": true,
21
+ "allowJs": true,
6
22
  "customConditions": ["source"]
7
23
  }
8
24
  }