@pandacss/studio 0.16.0 → 0.17.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,11 @@
1
- type BuildOpts = {
1
+ interface BuildOpts {
2
2
  outDir: string;
3
3
  configPath: string;
4
- };
4
+ port?: string;
5
+ host?: boolean;
6
+ }
5
7
  declare function buildStudio({ outDir, configPath }: BuildOpts): Promise<void>;
6
- declare function serveStudio({ configPath }: BuildOpts): Promise<void>;
8
+ declare function serveStudio({ configPath, port, host }: BuildOpts): Promise<void>;
7
9
  declare function previewStudio({ outDir }: BuildOpts): Promise<void>;
8
10
  declare function printUrls(options: {
9
11
  host: string;
package/dist/studio.d.ts CHANGED
@@ -1,9 +1,11 @@
1
- type BuildOpts = {
1
+ interface BuildOpts {
2
2
  outDir: string;
3
3
  configPath: string;
4
- };
4
+ port?: string;
5
+ host?: boolean;
6
+ }
5
7
  declare function buildStudio({ outDir, configPath }: BuildOpts): Promise<void>;
6
- declare function serveStudio({ configPath }: BuildOpts): Promise<void>;
8
+ declare function serveStudio({ configPath, port, host }: BuildOpts): Promise<void>;
7
9
  declare function previewStudio({ outDir }: BuildOpts): Promise<void>;
8
10
  declare function printUrls(options: {
9
11
  host: string;
package/dist/studio.js CHANGED
@@ -33,10 +33,10 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
33
33
  ));
34
34
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
35
35
 
36
- // ../../node_modules/.pnpm/tsup@7.1.0_postcss@8.4.27_typescript@5.2.2/node_modules/tsup/assets/cjs_shims.js
36
+ // ../../node_modules/.pnpm/tsup@7.1.0_postcss@8.4.31_typescript@5.2.2/node_modules/tsup/assets/cjs_shims.js
37
37
  var getImportMetaUrl, importMetaUrl;
38
38
  var init_cjs_shims = __esm({
39
- "../../node_modules/.pnpm/tsup@7.1.0_postcss@8.4.27_typescript@5.2.2/node_modules/tsup/assets/cjs_shims.js"() {
39
+ "../../node_modules/.pnpm/tsup@7.1.0_postcss@8.4.31_typescript@5.2.2/node_modules/tsup/assets/cjs_shims.js"() {
40
40
  "use strict";
41
41
  getImportMetaUrl = () => typeof document === "undefined" ? new URL("file:" + __filename).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href;
42
42
  importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
@@ -2079,8 +2079,8 @@ async function buildStudio({ outDir, configPath }) {
2079
2079
  });
2080
2080
  import_logger.logger.log(stdout);
2081
2081
  }
2082
- async function serveStudio({ configPath }) {
2083
- const result = execa(astroBin, ["dev", "--root", appPath], {
2082
+ async function serveStudio({ configPath, port, host }) {
2083
+ const result = execa(astroBin, ["dev", "--root", appPath, "--port", port ?? "", host ? "--host" : ""], {
2084
2084
  stdio: "inherit",
2085
2085
  cwd: appPath,
2086
2086
  env: {
package/dist/studio.mjs CHANGED
@@ -34,12 +34,12 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
34
34
  mod
35
35
  ));
36
36
 
37
- // ../../node_modules/.pnpm/tsup@7.1.0_postcss@8.4.27_typescript@5.2.2/node_modules/tsup/assets/esm_shims.js
37
+ // ../../node_modules/.pnpm/tsup@7.1.0_postcss@8.4.31_typescript@5.2.2/node_modules/tsup/assets/esm_shims.js
38
38
  import { fileURLToPath } from "url";
39
39
  import path from "path";
40
40
  var getFilename, getDirname, __dirname;
41
41
  var init_esm_shims = __esm({
42
- "../../node_modules/.pnpm/tsup@7.1.0_postcss@8.4.27_typescript@5.2.2/node_modules/tsup/assets/esm_shims.js"() {
42
+ "../../node_modules/.pnpm/tsup@7.1.0_postcss@8.4.31_typescript@5.2.2/node_modules/tsup/assets/esm_shims.js"() {
43
43
  "use strict";
44
44
  getFilename = () => fileURLToPath(import.meta.url);
45
45
  getDirname = () => path.dirname(getFilename());
@@ -2075,8 +2075,8 @@ async function buildStudio({ outDir, configPath }) {
2075
2075
  });
2076
2076
  logger.log(stdout);
2077
2077
  }
2078
- async function serveStudio({ configPath }) {
2079
- const result = execa(astroBin, ["dev", "--root", appPath], {
2078
+ async function serveStudio({ configPath, port, host }) {
2079
+ const result = execa(astroBin, ["dev", "--root", appPath, "--port", port ?? "", host ? "--host" : ""], {
2080
2080
  stdio: "inherit",
2081
2081
  cwd: appPath,
2082
2082
  env: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/studio",
3
- "version": "0.16.0",
3
+ "version": "0.17.1",
4
4
  "description": "The automated token documentation for Panda CSS",
5
5
  "main": "dist/studio.js",
6
6
  "module": "dist/studio.mjs",
@@ -33,27 +33,27 @@
33
33
  "react": "18.2.0",
34
34
  "react-dom": "18.2.0",
35
35
  "vite": "4.4.11",
36
- "@pandacss/config": "0.16.0",
37
- "@pandacss/logger": "0.16.0",
38
- "@pandacss/node": "0.16.0",
39
- "@pandacss/shared": "0.16.0",
40
- "@pandacss/token-dictionary": "0.16.0",
41
- "@pandacss/types": "0.16.0"
36
+ "@pandacss/config": "0.17.1",
37
+ "@pandacss/node": "0.17.1",
38
+ "@pandacss/types": "0.17.1",
39
+ "@pandacss/token-dictionary": "0.17.1",
40
+ "@pandacss/logger": "0.17.1",
41
+ "@pandacss/shared": "0.17.1"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@types/react": "18.2.22",
45
45
  "@types/react-dom": "18.2.7",
46
46
  "@vitejs/plugin-react": "4.0.4",
47
- "execa": "7.2.0",
48
- "@pandacss/dev": "0.16.0"
47
+ "execa": "7.2.0"
49
48
  },
50
49
  "scripts": {
51
- "codegen": "panda",
50
+ "panda": "node ../cli/bin.js",
51
+ "codegen": "node ../cli/bin.js codegen",
52
52
  "build": "tsup scripts --format=esm,cjs --dts --no-splitting --shims",
53
- "postbuild": "panda",
53
+ "postbuild": "pnpm panda",
54
54
  "build-fast": "tsup scripts --format=esm,cjs --no-dts --no-splitting --shims",
55
55
  "dev": "pnpm build-fast --watch scripts",
56
- "dev:panda": "panda --clean --watch",
56
+ "dev:panda": "node ../cli/bin.js --clean --watch",
57
57
  "dev:astro": "astro dev",
58
58
  "start": "concurrently \"pnpm dev:panda\" \"pnpm dev:astro\""
59
59
  }
package/panda.config.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { defineConfig } from '@pandacss/dev'
1
+ import type { Config } from '@pandacss/types'
2
2
 
3
- export default defineConfig({
3
+ export default {
4
4
  gitignore: false,
5
5
  preflight: true,
6
6
  include: ['./src/**/*.{tsx,jsx,astro}'],
@@ -107,4 +107,4 @@ export default defineConfig({
107
107
  minHeight: '100vh',
108
108
  },
109
109
  },
110
- })
110
+ } satisfies Config
@@ -1,6 +1,6 @@
1
1
  import { panda, Stack } from '../../styled-system/jsx'
2
2
 
3
- type EmptyStateProps = {
3
+ interface EmptyStateProps {
4
4
  title: string
5
5
  children: React.ReactNode
6
6
  icon: React.ReactElement
@@ -4,7 +4,7 @@ import { TokenContent } from '../components/token-content'
4
4
  import { TokenGroup } from '../components/token-group'
5
5
  import { Input, Textarea } from './input'
6
6
 
7
- type FontTokensProps = {
7
+ interface FontTokensProps {
8
8
  text?: string
9
9
  largeText?: boolean
10
10
  token: string
@@ -3,7 +3,9 @@ import { Grid, panda } from '../../styled-system/jsx'
3
3
  import { getSortedSizes } from '../lib/sizes-sort'
4
4
  import { TokenGroup } from './token-group'
5
5
 
6
- export type SizesProps = { sizes: Map<string, any> }
6
+ export interface SizesProps {
7
+ sizes: Map<string, any>
8
+ }
7
9
 
8
10
  const contentRegex = /^(min|max|fit)-content$/
9
11
  const unitRegex = /(ch|%)$/
@@ -1,7 +1,15 @@
1
1
  // Credits: https://github.com/bbc/color-contrast-checker
2
2
 
3
- type Pair = { colorA: string; colorB: string; fontSize: number }
4
- type Rgb = { r: number; g: number; b: number }
3
+ interface Pair {
4
+ colorA: string
5
+ colorB: string
6
+ fontSize: number
7
+ }
8
+ interface Rgb {
9
+ r: number
10
+ g: number
11
+ b: number
12
+ }
5
13
 
6
14
  class RgbClass {
7
15
  r = 0
@@ -30,7 +30,7 @@ export enum NavKeys {
30
30
  CONTRAST_CHECKER = 'playground/contrast-checker',
31
31
  }
32
32
 
33
- export type NavItemData = {
33
+ export interface NavItemData {
34
34
  label: string
35
35
  id: NavKeys
36
36
  description: string
@@ -2,7 +2,7 @@ import type { Token } from '@pandacss/types'
2
2
  import { useState } from 'react'
3
3
  import context from './panda.context'
4
4
 
5
- type Color = {
5
+ interface Color {
6
6
  isConditional?: boolean
7
7
  isReference?: boolean
8
8
  name: string
@@ -1,8 +1,16 @@
1
- import { compact, splitProps } from '../helpers.mjs';
1
+ import { compact, mergeProps, splitProps, uniq } from '../helpers.mjs';
2
2
  import { css, mergeCss } from './css.mjs';
3
3
 
4
+ const defaults = (conf) => ({
5
+ base: {},
6
+ variants: {},
7
+ defaultVariants: {},
8
+ compoundVariants: [],
9
+ ...conf,
10
+ })
11
+
4
12
  export function cva(config) {
5
- const { base = {}, variants = {}, defaultVariants = {}, compoundVariants = [] } = config
13
+ const { base, variants, defaultVariants, compoundVariants } = defaults(config)
6
14
 
7
15
  function resolve(props = {}) {
8
16
  const computedVariants = { ...defaultVariants, ...compact(props) }
@@ -16,6 +24,19 @@ export function cva(config) {
16
24
  return mergeCss(variantCss, compoundVariantCss)
17
25
  }
18
26
 
27
+ function merge(cvaConfig) {
28
+ const override = defaults(cvaConfig)
29
+ const variantKeys = uniq(override.variantKeys, Object.keys(variants))
30
+ return cva({
31
+ base: mergeCss(base, override.base),
32
+ variants: Object.fromEntries(
33
+ variantKeys.map((key) => [key, mergeCss(variants[key], override.variants[key])]),
34
+ ),
35
+ defaultVariants: mergeProps(defaultVariants, override.defaultVariants),
36
+ compoundVariants: [...compoundVariants, ...override.compoundVariants],
37
+ })
38
+ }
39
+
19
40
  function cvaFn(props) {
20
41
  return css(resolve(props))
21
42
  }
@@ -34,6 +55,7 @@ export function cva(config) {
34
55
  variantKeys,
35
56
  raw: resolve,
36
57
  config,
58
+ merge,
37
59
  splitVariantProps,
38
60
  })
39
61
  }
@@ -49,17 +49,19 @@ function toHash(value) {
49
49
 
50
50
  // src/merge-props.ts
51
51
  function mergeProps(...sources) {
52
- const result = {};
53
- for (const source of sources) {
54
- for (const [key, value] of Object.entries(source)) {
55
- if (isObject(value)) {
56
- result[key] = mergeProps(result[key] || {}, value);
52
+ const objects = sources.filter(Boolean);
53
+ return objects.reduce((prev, obj) => {
54
+ Object.keys(obj).forEach((key) => {
55
+ const prevValue = prev[key];
56
+ const value = obj[key];
57
+ if (isObject(prevValue) && isObject(value)) {
58
+ prev[key] = mergeProps(prevValue, value);
57
59
  } else {
58
- result[key] = value;
60
+ prev[key] = value;
59
61
  }
60
- }
61
- }
62
- return result;
62
+ });
63
+ return prev;
64
+ }, {});
63
65
  }
64
66
 
65
67
  // src/walk-object.ts
@@ -250,6 +252,9 @@ function splitProps(props, ...keys) {
250
252
  const fn = (key) => split(Array.isArray(key) ? key : dKeys.filter(key));
251
253
  return keys.map(fn).concat(split(dKeys));
252
254
  }
255
+
256
+ // src/uniq.ts
257
+ var uniq = (...items) => items.filter(Boolean).reduce((acc, item) => Array.from(/* @__PURE__ */ new Set([...acc, ...item])), []);
253
258
  export {
254
259
  compact,
255
260
  createCss,
@@ -265,6 +270,7 @@ export {
265
270
  mergeProps,
266
271
  splitProps,
267
272
  toHash,
273
+ uniq,
268
274
  walkObject,
269
275
  withoutSpace
270
276
  };
@@ -0,0 +1,22 @@
1
+ import { isCssProperty } from './is-valid-prop.mjs';
2
+
3
+ export const defaultShouldForwardProp = (prop, variantKeys) => !variantKeys.includes(prop) && !isCssProperty(prop)
4
+
5
+ export const composeShouldForwardProps = (tag, shouldForwardProp) =>
6
+ tag.__shouldForwardProps__ && shouldForwardProp
7
+ ? (propName) => tag.__shouldForwardProps__(propName) && shouldForwardProp(propName)
8
+ : shouldForwardProp
9
+
10
+ export const composeCvaFn = (cvaA, cvaB) => {
11
+ if (cvaA && !cvaB) return cvaA
12
+ if (!cvaA && cvaB) return cvaB
13
+ if ((cvaA.__cva__ && cvaB.__cva__) || (cvaA.__recipe__ && cvaB.__recipe__)) return cvaA.merge(cvaB.config)
14
+ const error = new TypeError('Cannot merge cva with recipe. Please use either cva or recipe.')
15
+ TypeError.captureStackTrace?.(error)
16
+ throw error
17
+ }
18
+
19
+ export const getDisplayName = (Component) => {
20
+ if (typeof Component === 'string') return Component
21
+ return Component?.displayName || Component?.name || 'Component'
22
+ }
@@ -1,39 +1,41 @@
1
1
  import { createElement, forwardRef, useMemo } from 'react'
2
2
  import { css, cx, cva } from '../css/index.mjs';
3
+ import { defaultShouldForwardProp, composeShouldForwardProps, composeCvaFn, getDisplayName } from './factory-helper.mjs';
3
4
  import { splitProps, normalizeHTMLProps } from '../helpers.mjs';
4
5
  import { isCssProperty } from './is-valid-prop.mjs';
5
6
 
6
- const defaultShouldForwardProp = (prop, variantKeys) => !variantKeys.includes(prop) && !isCssProperty(prop)
7
-
8
7
  function styledFn(Dynamic, configOrCva = {}, options = {}) {
9
8
  const cvaFn = configOrCva.__cva__ || configOrCva.__recipe__ ? configOrCva : cva(configOrCva)
10
9
 
11
10
  const forwardFn = options.shouldForwardProp || defaultShouldForwardProp
12
11
  const shouldForwardProp = (prop) => forwardFn(prop, cvaFn.variantKeys)
13
-
12
+
14
13
  const defaultProps = Object.assign(
15
14
  options.dataAttr && configOrCva.__name__ ? { 'data-recipe': configOrCva.__name__ } : {},
16
15
  options.defaultProps,
17
16
  )
18
17
 
19
18
  const PandaComponent = /* @__PURE__ */ forwardRef(function PandaComponent(props, ref) {
20
- const { as: Element = Dynamic, children, ...restProps } = props
19
+ const { as: Element = Dynamic.__base__ || Dynamic, children, ...restProps } = props
20
+
21
+ const __cvaFn__ = composeCvaFn(Dynamic.__cva__, cvaFn)
22
+ const __shouldForwardProps__ = composeShouldForwardProps(Dynamic, shouldForwardProp)
21
23
 
22
24
  const combinedProps = useMemo(() => Object.assign({}, defaultProps, restProps), [restProps])
23
25
 
24
- const [forwardedProps, variantProps, styleProps, htmlProps, elementProps] = useMemo(() => {
25
- return splitProps(combinedProps, shouldForwardProp, cvaFn.variantKeys, isCssProperty, normalizeHTMLProps.keys)
26
+ const [htmlProps, forwardedProps, variantProps, styleProps, elementProps] = useMemo(() => {
27
+ return splitProps(combinedProps, normalizeHTMLProps.keys, __shouldForwardProps__, __cvaFn__.variantKeys, isCssProperty)
26
28
  }, [combinedProps])
27
29
 
28
30
  function recipeClass() {
29
31
  const { css: cssStyles, ...propStyles } = styleProps
30
- const compoundVariantStyles = cvaFn.__getCompoundVariantCss__?.(variantProps);
31
- return cx(cvaFn(variantProps, false), css(compoundVariantStyles, propStyles, cssStyles), combinedProps.className)
32
+ const compoundVariantStyles = __cvaFn__.__getCompoundVariantCss__?.(variantProps)
33
+ return cx(__cvaFn__(variantProps, false), css(compoundVariantStyles, propStyles, cssStyles), combinedProps.className)
32
34
  }
33
35
 
34
36
  function cvaClass() {
35
37
  const { css: cssStyles, ...propStyles } = styleProps
36
- const cvaStyles = cvaFn.raw(variantProps)
38
+ const cvaStyles = __cvaFn__.raw(variantProps)
37
39
  return cx(css(cvaStyles, propStyles, cssStyles), combinedProps.className)
38
40
  }
39
41
 
@@ -49,8 +51,13 @@ function styledFn(Dynamic, configOrCva = {}, options = {}) {
49
51
  })
50
52
  })
51
53
 
52
- const name = (typeof Dynamic === 'string' ? Dynamic : Dynamic.displayName || Dynamic.name) || 'Component'
54
+ const name = getDisplayName(Dynamic)
55
+
53
56
  PandaComponent.displayName = `panda.${name}`
57
+ PandaComponent.__cva__ = cvaFn
58
+ PandaComponent.__base__ = Dynamic
59
+ PandaComponent.__shouldForwardProps__ = shouldForwardProp
60
+
54
61
  return PandaComponent
55
62
  }
56
63
 
@@ -90,6 +90,14 @@
90
90
  background-color: transparent;
91
91
  background-image: none;
92
92
  }
93
+
94
+ button,
95
+ input,
96
+ optgroup,
97
+ select,
98
+ textarea {
99
+ color: inherit;
100
+ }
93
101
 
94
102
  button,
95
103
  select {
@@ -1,15 +1,11 @@
1
1
  /* eslint-disable */
2
2
  import type { CompositionStyleObject } from './system-types';
3
+ import type { Token } from '../tokens';
3
4
 
4
5
  interface Recursive<T> {
5
6
  [key: string]: Recursive<T> | T
6
7
  }
7
8
 
8
- export interface Token<Value = any> {
9
- value: Value
10
- description?: string
11
- }
12
-
13
9
  /* -----------------------------------------------------------------------------
14
10
  * Text styles
15
11
  * -----------------------------------------------------------------------------*/
@@ -5,4 +5,4 @@ export * from './pattern';
5
5
  export * from './recipe';
6
6
  export * from './system-types';
7
7
  export * from './jsx';
8
- export * from './style-props';
8
+ export * from './style-props';
@@ -1,9 +1,11 @@
1
1
  /* eslint-disable */
2
2
  import type { ComponentPropsWithoutRef, ElementType, ElementRef, Ref } from 'react'
3
- import type { Assign, DistributiveOmit, JsxHTMLProps, JsxStyleProps } from './system-types';
4
3
  import type { RecipeDefinition, RecipeSelection, RecipeVariantRecord } from './recipe';
4
+ import type { Assign, DistributiveOmit, DistributiveUnion, JsxHTMLProps, JsxStyleProps, Pretty } from './system-types';
5
5
 
6
- type Dict = Record<string, unknown>
6
+ interface Dict {
7
+ [k: string]: unknown
8
+ }
7
9
 
8
10
  export type ComponentProps<T extends ElementType> = DistributiveOmit<ComponentPropsWithoutRef<T>, 'ref'> & {
9
11
  ref?: Ref<ElementRef<T>>
@@ -14,7 +16,9 @@ export interface PandaComponent<T extends ElementType, P extends Dict = {}> {
14
16
  displayName?: string
15
17
  }
16
18
 
17
- interface RecipeFn { __type: any }
19
+ interface RecipeFn {
20
+ __type: any
21
+ }
18
22
 
19
23
  interface JsxFactoryOptions<TProps extends Dict> {
20
24
  dataAttr?: boolean
@@ -24,17 +28,25 @@ interface JsxFactoryOptions<TProps extends Dict> {
24
28
 
25
29
  export type JsxRecipeProps<T extends ElementType, P extends Dict> = JsxHTMLProps<ComponentProps<T>, P>;
26
30
 
27
- interface JsxFactory {
31
+ export type JsxElement<T extends ElementType, P> = T extends PandaComponent<infer A, infer B>
32
+ ? PandaComponent<A, Pretty<DistributiveUnion<P, B>>>
33
+ : PandaComponent<T, P>
34
+
35
+ export interface JsxFactory {
28
36
  <T extends ElementType>(component: T): PandaComponent<T, {}>
29
- <T extends ElementType, P extends RecipeVariantRecord>(component: T, recipe: RecipeDefinition<P>, options?: JsxFactoryOptions<JsxRecipeProps<T, RecipeSelection<P>>>): PandaComponent<
37
+ <T extends ElementType, P extends RecipeVariantRecord>(component: T, recipe: RecipeDefinition<P>, options?: JsxFactoryOptions<JsxRecipeProps<T, RecipeSelection<P>>>): JsxElement<
30
38
  T,
31
39
  RecipeSelection<P>
32
40
  >
33
- <T extends ElementType, P extends RecipeFn>(component: T, recipeFn: P, options?: JsxFactoryOptions<JsxRecipeProps<T, P['__type']>>): PandaComponent<T, P['__type']>
41
+ <T extends ElementType, P extends RecipeFn>(component: T, recipeFn: P, options?: JsxFactoryOptions<JsxRecipeProps<T, P['__type']>>): JsxElement<T, P['__type']>
34
42
  }
35
43
 
36
- type JsxElements = { [K in keyof JSX.IntrinsicElements]: PandaComponent<K, {}> }
44
+ export type JsxElements = {
45
+ [K in keyof JSX.IntrinsicElements]: PandaComponent<K, {}>
46
+ }
37
47
 
38
48
  export type Panda = JsxFactory & JsxElements
39
49
 
40
- export type HTMLPandaProps<T extends ElementType> = JsxHTMLProps<ComponentProps<T>, JsxStyleProps>
50
+ export type HTMLPandaProps<T extends ElementType> = JsxHTMLProps<ComponentProps<T>, JsxStyleProps>
51
+
52
+ export type PandaVariantProps<T extends PandaComponent<any, any>> = T extends PandaComponent<any, infer Props> ? Props : never
@@ -3,4 +3,6 @@ export interface Part {
3
3
  selector: string
4
4
  }
5
5
 
6
- export type Parts = Record<string, Part>
6
+ export interface Parts {
7
+ [key: string]: Part
8
+ }
@@ -15,7 +15,9 @@ export interface PatternHelpers {
15
15
  map: (value: any, fn: (value: string) => string | undefined) => any
16
16
  }
17
17
 
18
- export type PatternProperties = Record<string, PatternProperty>
18
+ export interface PatternProperties {
19
+ [key: string]: PatternProperty
20
+ }
19
21
 
20
22
  type Props<T> = Record<LiteralUnion<keyof T>, any>
21
23
 
@@ -6,6 +6,18 @@ import type { SystemProperties, CssVarProperties } from './style-props';
6
6
  type String = string & {}
7
7
  type Number = number & {}
8
8
 
9
+ export type Pretty<T> = { [K in keyof T]: T[K] } & {}
10
+
11
+ export type DistributiveOmit<T, K extends keyof any> = T extends unknown ? Omit<T, K> : never
12
+
13
+ export type DistributiveUnion<T, U> = {
14
+ [K in keyof T]: K extends keyof U ? U[K] | T[K] : T[K]
15
+ } & DistributiveOmit<U, keyof T>
16
+
17
+ export type Assign<T, U> = {
18
+ [K in keyof T]: K extends keyof U ? U[K] : T[K]
19
+ } & U
20
+
9
21
  /* -----------------------------------------------------------------------------
10
22
  * Native css properties
11
23
  * -----------------------------------------------------------------------------*/
@@ -62,12 +74,6 @@ type StyleProps = SystemProperties & MinimalNested<SystemStyleObject>
62
74
 
63
75
  export type JsxStyleProps = StyleProps & WithCss
64
76
 
65
- export type DistributiveOmit<T, K extends keyof any> = T extends unknown ? Omit<T, K> : never
66
-
67
- export type Assign<T, U> = {
68
- [K in keyof T]: K extends keyof U ? U[K] : T[K]
69
- } & U
70
-
71
77
  export interface PatchedHTMLProps {
72
78
  htmlWidth?: string | number
73
79
  htmlHeight?: string | number