@pandacss/generator 0.0.0-dev-20230420172131 → 0.0.0-dev-20230420174911

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/index.js CHANGED
@@ -1799,6 +1799,16 @@ var recipe_d_ts_default = {
1799
1799
  content: "import type { SystemStyleObject } from './system-types'\n\ntype Pretty<T> = T extends infer U ? { [K in keyof U]: U[K] } : never\n\ntype StringToBoolean<T> = T extends 'true' | 'false' ? boolean : T\n\nexport type RecipeVariantRecord = Record<string, Record<string, SystemStyleObject>>\n\nexport type RecipeSelection<T extends RecipeVariantRecord> = {\n [K in keyof T]?: StringToBoolean<keyof T[K]>\n}\n\nexport type RecipeVariantFn<T extends RecipeVariantRecord> = (props?: RecipeSelection<T>) => string\n\nexport type RecipeVariantProps<T extends RecipeVariantFn<RecipeVariantRecord>> = Pretty<Parameters<T>[0]>\n\nexport type RecipeRuntimeFn<T extends RecipeVariantRecord> = RecipeVariantFn<T> & {\n variants: (keyof T)[]\n resolve: (props: RecipeSelection<T>) => SystemStyleObject\n config: RecipeConfig<T>\n}\n\nexport type RecipeCompoundSelection<\n T extends RecipeVariantRecord,\n Key extends Exclude<keyof T, 'css'> = Exclude<keyof T, 'css'>,\n> = {\n [K in Key]?: StringToBoolean<keyof T[K]> | Array<StringToBoolean<keyof T[K]>>\n}\n\nexport type RecipeCompoundVariant<T extends RecipeVariantRecord> = RecipeCompoundSelection<T> & {\n css: SystemStyleObject\n}\n\nexport type RecipeDefinition<T extends RecipeVariantRecord> = {\n /**\n * The base styles of the recipe.\n */\n base?: SystemStyleObject\n /**\n * The multi-variant styles of the recipe.\n */\n variants?: T | RecipeVariantRecord\n /**\n * The default variants of the recipe.\n */\n defaultVariants?: RecipeSelection<T>\n /**\n * The styles to apply when a combination of variants is selected.\n */\n compoundVariants?: Array<RecipeCompoundVariant<T>>\n}\n\nexport type RecipeCreatorFn = <T extends RecipeVariantRecord>(config: RecipeDefinition<T>) => RecipeRuntimeFn<T>\n\nexport type RecipeConfig<T> = RecipeDefinition<T extends RecipeVariantRecord ? T : RecipeVariantRecord> & {\n /**\n * The name of the recipe.\n */\n name: string\n /**\n * The description of the recipe. This will be used in the JSDoc comment.\n */\n description?: string\n /**\n * The jsx elements to track for this recipe. Can be string or Regexp.\n *\n * @default capitalize(recipe.name)\n * @example ['Button', 'Link', /Button$/]\n */\n jsx?: Array<string | RegExp>\n}\nexport type AnyRecipeConfig = RecipeConfig<RecipeVariantRecord>\n"
1800
1800
  };
1801
1801
 
1802
+ // src/artifacts/generated/pattern.d.ts.json
1803
+ var pattern_d_ts_default = {
1804
+ content: "import type { LiteralUnion } from './shared'\nimport type { NativeCssProperty, SystemStyleObject } from './system-types'\nimport type { TokenCategory } from './tokens'\n\nexport type PatternProperty =\n | { type: 'property'; value: NativeCssProperty }\n | { type: 'enum'; value: string[] }\n | { type: 'token'; value: TokenCategory; property?: NativeCssProperty }\n | { type: 'string' | 'boolean' | 'number' }\n\nexport type PatternHelpers = {\n map: (value: any, fn: (value: string) => string | undefined) => any\n}\n\nexport type PatternConfig<T> = {\n /**\n * The description of the pattern. This will be used in the JSDoc comment.\n */\n description?: string\n /**\n * The JSX element rendered by the pattern\n * @default 'div'\n */\n jsxElement?: string\n /**\n * The properties of the pattern.\n */\n properties: T extends Record<string, PatternProperty> ? T : Record<string, PatternProperty>\n /**\n * The css object this pattern will generate.\n */\n transform?: (\n props: T extends Record<infer Keys, PatternProperty> ? Record<Keys, any> : Record<string, PatternProperty>,\n helpers: PatternHelpers,\n ) => SystemStyleObject\n /**\n * The jsx element name this pattern will generate.\n */\n jsx?: string\n /**\n * Whether to only generate types for the specified properties.\n * This will disallow css properties\n */\n strict?: boolean\n /**\n * @experimental\n * Disallow certain css properties for this pattern\n */\n blocklist?: LiteralUnion<NativeCssProperty>[]\n}\n\nexport type AnyPatternConfig = PatternConfig<PatternProperty>\n"
1805
+ };
1806
+
1807
+ // src/artifacts/generated/parts.d.ts.json
1808
+ var parts_d_ts_default = {
1809
+ content: "export type Part = {\n selector: string\n}\n\nexport type Parts = Record<string, Part>\n"
1810
+ };
1811
+
1802
1812
  // src/artifacts/generated/selectors.d.ts.json
1803
1813
  var selectors_d_ts_default = {
1804
1814
  content: "import type { Pseudos } from './csstype'\n\ntype AriaAttributes =\n | '[aria-disabled]'\n | '[aria-hidden]'\n | '[aria-invalid]'\n | '[aria-readonly]'\n | '[aria-required]'\n | '[aria-selected]'\n | '[aria-checked]'\n | '[aria-expanded]'\n | '[aria-pressed]'\n | `[aria-current=${'page' | 'step' | 'location' | 'date' | 'time'}]`\n | '[aria-invalid]'\n | `[aria-sort=${'ascending' | 'descending'}]`\n\ntype DataAttributes =\n | '[data-selected]'\n | '[data-highlighted]'\n | '[data-hover]'\n | '[data-active]'\n | '[data-checked]'\n | '[data-disabled]'\n | '[data-readonly]'\n | '[data-focus]'\n | '[data-focus-visible]'\n | '[data-focus-visible-added]'\n | '[data-invalid]'\n | '[data-pressed]'\n | '[data-expanded]'\n | '[data-grabbed]'\n | '[data-dragged]'\n | '[data-orientation=horizontal]'\n | '[data-orientation=vertical]'\n | '[data-in-range]'\n | '[data-out-of-range]'\n | '[data-placeholder-shown]'\n | `[data-part=${string}]`\n | `[data-attr=${string}]`\n | `[data-placement=${string}]`\n | `[data-theme=${string}]`\n | `[data-size=${string}]`\n | `[data-state=${string}]`\n | '[data-empty]'\n | '[data-loading]'\n | '[data-loaded]'\n | '[data-enter]'\n | '[data-entering]'\n | '[data-exited]'\n | '[data-exiting]'\n\ntype AttributeSelector = `&${Pseudos | DataAttributes | AriaAttributes}`\ntype ParentSelector = `${DataAttributes | AriaAttributes} &`\n\nexport type AnySelector = `${string}&` | `&${string}`\nexport type Selectors = AttributeSelector | ParentSelector\n"
@@ -1809,6 +1819,8 @@ function getGeneratedTypes() {
1809
1819
  return {
1810
1820
  cssType: csstype_d_ts_default.content,
1811
1821
  recipe: recipe_d_ts_default.content,
1822
+ pattern: pattern_d_ts_default.content,
1823
+ parts: parts_d_ts_default.content,
1812
1824
  composition: composition_d_ts_default.content,
1813
1825
  selectors: selectors_d_ts_default.content,
1814
1826
  system: system_types_d_ts_default.content
@@ -1820,21 +1832,25 @@ var import_outdent26 = require("outdent");
1820
1832
  var generateTypesEntry = () => ({
1821
1833
  global: import_outdent26.outdent`
1822
1834
  import { RecipeVariantRecord, RecipeConfig } from './recipe'
1823
- import { GlobalStyleObject } from './system-types'
1835
+ import { Parts } from './parts'
1836
+ import { AnyPatternConfig, PatternConfig } from './pattern'
1837
+ import { GlobalStyleObject, SystemStyleObject } from './system-types'
1824
1838
  import { CompositionStyles } from './composition'
1825
-
1839
+
1826
1840
  declare module '@pandacss/dev' {
1827
1841
  export function defineRecipe<V extends RecipeVariantRecord>(config: RecipeConfig<V>): RecipeConfig<V>
1828
1842
  export function defineGlobalStyles(definition: GlobalStyleObject): GlobalStyleObject
1829
1843
  export function defineTextStyles(definition: CompositionStyles['textStyles']): CompositionStyles['textStyles']
1830
1844
  export function defineLayerStyles(definition: CompositionStyles['layerStyles']): CompositionStyles['layerStyles']
1845
+ export function definePattern<Pattern>(config: PatternConfig<Pattern>): AnyPatternConfig
1846
+ export function defineParts<T extends Parts>(parts: T): (config: Partial<Record<keyof T, SystemStyleObject>>) => Partial<Record<keyof T, SystemStyleObject>>;
1831
1847
  }
1832
1848
  `,
1833
1849
  index: import_outdent26.outdent`
1834
1850
  import './global'
1835
1851
  export { ConditionalValue } from './conditions'
1836
1852
  export { GlobalStyleObject, JsxStyleProps, SystemStyleObject } from './system-types'
1837
-
1853
+
1838
1854
  `
1839
1855
  });
1840
1856
 
@@ -2037,6 +2053,8 @@ function setupTypes(ctx) {
2037
2053
  { file: "composition.d.ts", code: gen.composition },
2038
2054
  { file: "global.d.ts", code: entry.global },
2039
2055
  { file: "recipe.d.ts", code: gen.recipe },
2056
+ { file: "pattern.d.ts", code: gen.pattern },
2057
+ { file: "parts.d.ts", code: gen.parts },
2040
2058
  { file: "index.d.ts", code: entry.index },
2041
2059
  { file: "token.d.ts", code: generateTokenTypes(ctx) },
2042
2060
  { file: "prop-type.d.ts", code: generatePropTypes(ctx) },
package/dist/index.mjs CHANGED
@@ -1768,6 +1768,16 @@ var recipe_d_ts_default = {
1768
1768
  content: "import type { SystemStyleObject } from './system-types'\n\ntype Pretty<T> = T extends infer U ? { [K in keyof U]: U[K] } : never\n\ntype StringToBoolean<T> = T extends 'true' | 'false' ? boolean : T\n\nexport type RecipeVariantRecord = Record<string, Record<string, SystemStyleObject>>\n\nexport type RecipeSelection<T extends RecipeVariantRecord> = {\n [K in keyof T]?: StringToBoolean<keyof T[K]>\n}\n\nexport type RecipeVariantFn<T extends RecipeVariantRecord> = (props?: RecipeSelection<T>) => string\n\nexport type RecipeVariantProps<T extends RecipeVariantFn<RecipeVariantRecord>> = Pretty<Parameters<T>[0]>\n\nexport type RecipeRuntimeFn<T extends RecipeVariantRecord> = RecipeVariantFn<T> & {\n variants: (keyof T)[]\n resolve: (props: RecipeSelection<T>) => SystemStyleObject\n config: RecipeConfig<T>\n}\n\nexport type RecipeCompoundSelection<\n T extends RecipeVariantRecord,\n Key extends Exclude<keyof T, 'css'> = Exclude<keyof T, 'css'>,\n> = {\n [K in Key]?: StringToBoolean<keyof T[K]> | Array<StringToBoolean<keyof T[K]>>\n}\n\nexport type RecipeCompoundVariant<T extends RecipeVariantRecord> = RecipeCompoundSelection<T> & {\n css: SystemStyleObject\n}\n\nexport type RecipeDefinition<T extends RecipeVariantRecord> = {\n /**\n * The base styles of the recipe.\n */\n base?: SystemStyleObject\n /**\n * The multi-variant styles of the recipe.\n */\n variants?: T | RecipeVariantRecord\n /**\n * The default variants of the recipe.\n */\n defaultVariants?: RecipeSelection<T>\n /**\n * The styles to apply when a combination of variants is selected.\n */\n compoundVariants?: Array<RecipeCompoundVariant<T>>\n}\n\nexport type RecipeCreatorFn = <T extends RecipeVariantRecord>(config: RecipeDefinition<T>) => RecipeRuntimeFn<T>\n\nexport type RecipeConfig<T> = RecipeDefinition<T extends RecipeVariantRecord ? T : RecipeVariantRecord> & {\n /**\n * The name of the recipe.\n */\n name: string\n /**\n * The description of the recipe. This will be used in the JSDoc comment.\n */\n description?: string\n /**\n * The jsx elements to track for this recipe. Can be string or Regexp.\n *\n * @default capitalize(recipe.name)\n * @example ['Button', 'Link', /Button$/]\n */\n jsx?: Array<string | RegExp>\n}\nexport type AnyRecipeConfig = RecipeConfig<RecipeVariantRecord>\n"
1769
1769
  };
1770
1770
 
1771
+ // src/artifacts/generated/pattern.d.ts.json
1772
+ var pattern_d_ts_default = {
1773
+ content: "import type { LiteralUnion } from './shared'\nimport type { NativeCssProperty, SystemStyleObject } from './system-types'\nimport type { TokenCategory } from './tokens'\n\nexport type PatternProperty =\n | { type: 'property'; value: NativeCssProperty }\n | { type: 'enum'; value: string[] }\n | { type: 'token'; value: TokenCategory; property?: NativeCssProperty }\n | { type: 'string' | 'boolean' | 'number' }\n\nexport type PatternHelpers = {\n map: (value: any, fn: (value: string) => string | undefined) => any\n}\n\nexport type PatternConfig<T> = {\n /**\n * The description of the pattern. This will be used in the JSDoc comment.\n */\n description?: string\n /**\n * The JSX element rendered by the pattern\n * @default 'div'\n */\n jsxElement?: string\n /**\n * The properties of the pattern.\n */\n properties: T extends Record<string, PatternProperty> ? T : Record<string, PatternProperty>\n /**\n * The css object this pattern will generate.\n */\n transform?: (\n props: T extends Record<infer Keys, PatternProperty> ? Record<Keys, any> : Record<string, PatternProperty>,\n helpers: PatternHelpers,\n ) => SystemStyleObject\n /**\n * The jsx element name this pattern will generate.\n */\n jsx?: string\n /**\n * Whether to only generate types for the specified properties.\n * This will disallow css properties\n */\n strict?: boolean\n /**\n * @experimental\n * Disallow certain css properties for this pattern\n */\n blocklist?: LiteralUnion<NativeCssProperty>[]\n}\n\nexport type AnyPatternConfig = PatternConfig<PatternProperty>\n"
1774
+ };
1775
+
1776
+ // src/artifacts/generated/parts.d.ts.json
1777
+ var parts_d_ts_default = {
1778
+ content: "export type Part = {\n selector: string\n}\n\nexport type Parts = Record<string, Part>\n"
1779
+ };
1780
+
1771
1781
  // src/artifacts/generated/selectors.d.ts.json
1772
1782
  var selectors_d_ts_default = {
1773
1783
  content: "import type { Pseudos } from './csstype'\n\ntype AriaAttributes =\n | '[aria-disabled]'\n | '[aria-hidden]'\n | '[aria-invalid]'\n | '[aria-readonly]'\n | '[aria-required]'\n | '[aria-selected]'\n | '[aria-checked]'\n | '[aria-expanded]'\n | '[aria-pressed]'\n | `[aria-current=${'page' | 'step' | 'location' | 'date' | 'time'}]`\n | '[aria-invalid]'\n | `[aria-sort=${'ascending' | 'descending'}]`\n\ntype DataAttributes =\n | '[data-selected]'\n | '[data-highlighted]'\n | '[data-hover]'\n | '[data-active]'\n | '[data-checked]'\n | '[data-disabled]'\n | '[data-readonly]'\n | '[data-focus]'\n | '[data-focus-visible]'\n | '[data-focus-visible-added]'\n | '[data-invalid]'\n | '[data-pressed]'\n | '[data-expanded]'\n | '[data-grabbed]'\n | '[data-dragged]'\n | '[data-orientation=horizontal]'\n | '[data-orientation=vertical]'\n | '[data-in-range]'\n | '[data-out-of-range]'\n | '[data-placeholder-shown]'\n | `[data-part=${string}]`\n | `[data-attr=${string}]`\n | `[data-placement=${string}]`\n | `[data-theme=${string}]`\n | `[data-size=${string}]`\n | `[data-state=${string}]`\n | '[data-empty]'\n | '[data-loading]'\n | '[data-loaded]'\n | '[data-enter]'\n | '[data-entering]'\n | '[data-exited]'\n | '[data-exiting]'\n\ntype AttributeSelector = `&${Pseudos | DataAttributes | AriaAttributes}`\ntype ParentSelector = `${DataAttributes | AriaAttributes} &`\n\nexport type AnySelector = `${string}&` | `&${string}`\nexport type Selectors = AttributeSelector | ParentSelector\n"
@@ -1778,6 +1788,8 @@ function getGeneratedTypes() {
1778
1788
  return {
1779
1789
  cssType: csstype_d_ts_default.content,
1780
1790
  recipe: recipe_d_ts_default.content,
1791
+ pattern: pattern_d_ts_default.content,
1792
+ parts: parts_d_ts_default.content,
1781
1793
  composition: composition_d_ts_default.content,
1782
1794
  selectors: selectors_d_ts_default.content,
1783
1795
  system: system_types_d_ts_default.content
@@ -1789,21 +1801,25 @@ import { outdent as outdent26 } from "outdent";
1789
1801
  var generateTypesEntry = () => ({
1790
1802
  global: outdent26`
1791
1803
  import { RecipeVariantRecord, RecipeConfig } from './recipe'
1792
- import { GlobalStyleObject } from './system-types'
1804
+ import { Parts } from './parts'
1805
+ import { AnyPatternConfig, PatternConfig } from './pattern'
1806
+ import { GlobalStyleObject, SystemStyleObject } from './system-types'
1793
1807
  import { CompositionStyles } from './composition'
1794
-
1808
+
1795
1809
  declare module '@pandacss/dev' {
1796
1810
  export function defineRecipe<V extends RecipeVariantRecord>(config: RecipeConfig<V>): RecipeConfig<V>
1797
1811
  export function defineGlobalStyles(definition: GlobalStyleObject): GlobalStyleObject
1798
1812
  export function defineTextStyles(definition: CompositionStyles['textStyles']): CompositionStyles['textStyles']
1799
1813
  export function defineLayerStyles(definition: CompositionStyles['layerStyles']): CompositionStyles['layerStyles']
1814
+ export function definePattern<Pattern>(config: PatternConfig<Pattern>): AnyPatternConfig
1815
+ export function defineParts<T extends Parts>(parts: T): (config: Partial<Record<keyof T, SystemStyleObject>>) => Partial<Record<keyof T, SystemStyleObject>>;
1800
1816
  }
1801
1817
  `,
1802
1818
  index: outdent26`
1803
1819
  import './global'
1804
1820
  export { ConditionalValue } from './conditions'
1805
1821
  export { GlobalStyleObject, JsxStyleProps, SystemStyleObject } from './system-types'
1806
-
1822
+
1807
1823
  `
1808
1824
  });
1809
1825
 
@@ -2006,6 +2022,8 @@ function setupTypes(ctx) {
2006
2022
  { file: "composition.d.ts", code: gen.composition },
2007
2023
  { file: "global.d.ts", code: entry.global },
2008
2024
  { file: "recipe.d.ts", code: gen.recipe },
2025
+ { file: "pattern.d.ts", code: gen.pattern },
2026
+ { file: "parts.d.ts", code: gen.parts },
2009
2027
  { file: "index.d.ts", code: entry.index },
2010
2028
  { file: "token.d.ts", code: generateTokenTypes(ctx) },
2011
2029
  { file: "prop-type.d.ts", code: generatePropTypes(ctx) },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/generator",
3
- "version": "0.0.0-dev-20230420172131",
3
+ "version": "0.0.0-dev-20230420174911",
4
4
  "description": "The css generator for css panda",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -20,20 +20,20 @@
20
20
  "pluralize": "8.0.0",
21
21
  "postcss": "8.4.23",
22
22
  "ts-pattern": "4.2.2",
23
- "@pandacss/core": "0.0.0-dev-20230420172131",
24
- "@pandacss/logger": "0.0.0-dev-20230420172131",
25
- "@pandacss/is-valid-prop": "0.0.0-dev-20230420172131",
26
- "@pandacss/shared": "0.0.0-dev-20230420172131",
27
- "@pandacss/types": "0.0.0-dev-20230420172131",
28
- "@pandacss/token-dictionary": "0.0.0-dev-20230420172131"
23
+ "@pandacss/core": "0.0.0-dev-20230420174911",
24
+ "@pandacss/logger": "0.0.0-dev-20230420174911",
25
+ "@pandacss/is-valid-prop": "0.0.0-dev-20230420174911",
26
+ "@pandacss/shared": "0.0.0-dev-20230420174911",
27
+ "@pandacss/types": "0.0.0-dev-20230420174911",
28
+ "@pandacss/token-dictionary": "0.0.0-dev-20230420174911"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@types/pluralize": "0.0.29",
32
- "@pandacss/fixture": "0.0.0-dev-20230420172131"
32
+ "@pandacss/fixture": "0.0.0-dev-20230420174911"
33
33
  },
34
34
  "scripts": {
35
35
  "prebuild": "tsx scripts/prebuild.ts",
36
- "build": "tsup src/index.ts --format=esm,cjs --dts",
36
+ "build": "pnpm prebuild && tsup src/index.ts --format=esm,cjs --dts",
37
37
  "build-fast": "tsup src/index.ts --format=esm,cjs --no-dts",
38
38
  "dev": "tsx scripts/prebuild.ts && pnpm build-fast --watch"
39
39
  }