@pandacss/generator 0.0.0-dev-20230705181609 → 0.0.0-dev-20230706113853

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
@@ -412,7 +412,15 @@ var generateStaticCss = (ctx) => {
412
412
  const fn = (0, import_core2.getStaticCss)(staticCss);
413
413
  const results = fn({
414
414
  breakpoints: Object.keys(theme.breakpoints ?? {}),
415
- getPropertyKeys: (prop) => utility.getPropertyKeys(prop).filter((key) => !key.startsWith("type:") && !key.startsWith("CssProperties:")),
415
+ getPropertyKeys: (prop) => {
416
+ const propConfig = utility.config[prop];
417
+ if (!propConfig)
418
+ return [];
419
+ const values = utility.getPropertyValues(propConfig);
420
+ if (!values)
421
+ return [];
422
+ return Object.keys(values);
423
+ },
416
424
  getRecipeKeys: (recipe) => recipes.details.find((detail) => detail.config.name === recipe)?.variantKeyMap ?? {}
417
425
  });
418
426
  results.css.forEach((css2) => {
@@ -2720,7 +2728,7 @@ var recipe_d_ts_default = {
2720
2728
 
2721
2729
  // src/artifacts/generated/pattern.d.ts.json
2722
2730
  var pattern_d_ts_default = {
2723
- content: "import type { CssProperty, SystemStyleObject } from './system-types'\nimport type { TokenCategory } from '../tokens'\n\ntype Primitive = string | number | boolean | null | undefined\ntype LiteralUnion<T, K extends Primitive = string> = T | (K & Record<never, never>)\n\nexport type PatternProperty =\n | { type: 'property'; value: CssProperty }\n | { type: 'enum'; value: string[] }\n | { type: 'token'; value: TokenCategory; property?: CssProperty }\n | { type: 'string' | 'boolean' | 'number' }\n\nexport type PatternHelpers = {\n map: (value: any, fn: (value: string) => string | undefined) => any\n}\n\ntype PatternProperties = Record<string, PatternProperty>\n\ntype Props<T> = Record<LiteralUnion<keyof T>, any>\n\nexport type PatternConfig<T extends PatternProperties = PatternProperties> = {\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\n /**\n * The css object this pattern will generate.\n */\n transform?: (props: Props<T>, helpers: PatternHelpers) => 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<CssProperty>[]\n}\n"
2731
+ content: "import type { CssProperty, SystemStyleObject } from './system-types'\nimport type { TokenCategory } from '../tokens'\n\ntype Primitive = string | number | boolean | null | undefined\ntype LiteralUnion<T, K extends Primitive = string> = T | (K & Record<never, never>)\n\nexport type PatternProperty =\n | { type: 'property'; value: CssProperty }\n | { type: 'enum'; value: string[] }\n | { type: 'token'; value: TokenCategory; property?: CssProperty }\n | { type: 'string' | 'boolean' | 'number' }\n\nexport type PatternHelpers = {\n map: (value: any, fn: (value: string) => string | undefined) => any\n}\n\nexport type PatternProperties = Record<string, PatternProperty>\n\ntype Props<T> = Record<LiteralUnion<keyof T>, any>\n\nexport type PatternConfig<T extends PatternProperties = PatternProperties> = {\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\n /**\n * The css object this pattern will generate.\n */\n transform?: (props: Props<T>, helpers: PatternHelpers) => 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<CssProperty>[]\n}\n"
2724
2732
  };
2725
2733
 
2726
2734
  // src/artifacts/generated/parts.d.ts.json
@@ -2752,7 +2760,7 @@ var generateTypesEntry = () => ({
2752
2760
  global: import_outdent38.outdent`
2753
2761
  import type { RecipeVariantRecord, RecipeConfig } from './recipe'
2754
2762
  import type { Parts } from './parts'
2755
- import type { PatternConfig } from './pattern'
2763
+ import type { PatternConfig, PatternProperties } from './pattern'
2756
2764
  import type { GlobalStyleObject, SystemStyleObject } from './system-types'
2757
2765
  import type { CompositionStyles } from './composition'
2758
2766
 
@@ -2762,7 +2770,7 @@ var generateTypesEntry = () => ({
2762
2770
  export function defineGlobalStyles(definition: GlobalStyleObject): GlobalStyleObject
2763
2771
  export function defineTextStyles(definition: CompositionStyles['textStyles']): CompositionStyles['textStyles']
2764
2772
  export function defineLayerStyles(definition: CompositionStyles['layerStyles']): CompositionStyles['layerStyles']
2765
- export function definePattern<T>(config: PatternConfig<T>): PatternConfig
2773
+ export function definePattern<T extends PatternProperties>(config: PatternConfig<T>): PatternConfig
2766
2774
  export function defineParts<T extends Parts>(parts: T): (config: Partial<Record<keyof T, SystemStyleObject>>) => Partial<Record<keyof T, SystemStyleObject>>;
2767
2775
  }
2768
2776
  `,
package/dist/index.mjs CHANGED
@@ -381,7 +381,15 @@ var generateStaticCss = (ctx) => {
381
381
  const fn = getStaticCss(staticCss);
382
382
  const results = fn({
383
383
  breakpoints: Object.keys(theme.breakpoints ?? {}),
384
- getPropertyKeys: (prop) => utility.getPropertyKeys(prop).filter((key) => !key.startsWith("type:") && !key.startsWith("CssProperties:")),
384
+ getPropertyKeys: (prop) => {
385
+ const propConfig = utility.config[prop];
386
+ if (!propConfig)
387
+ return [];
388
+ const values = utility.getPropertyValues(propConfig);
389
+ if (!values)
390
+ return [];
391
+ return Object.keys(values);
392
+ },
385
393
  getRecipeKeys: (recipe) => recipes.details.find((detail) => detail.config.name === recipe)?.variantKeyMap ?? {}
386
394
  });
387
395
  results.css.forEach((css2) => {
@@ -2689,7 +2697,7 @@ var recipe_d_ts_default = {
2689
2697
 
2690
2698
  // src/artifacts/generated/pattern.d.ts.json
2691
2699
  var pattern_d_ts_default = {
2692
- content: "import type { CssProperty, SystemStyleObject } from './system-types'\nimport type { TokenCategory } from '../tokens'\n\ntype Primitive = string | number | boolean | null | undefined\ntype LiteralUnion<T, K extends Primitive = string> = T | (K & Record<never, never>)\n\nexport type PatternProperty =\n | { type: 'property'; value: CssProperty }\n | { type: 'enum'; value: string[] }\n | { type: 'token'; value: TokenCategory; property?: CssProperty }\n | { type: 'string' | 'boolean' | 'number' }\n\nexport type PatternHelpers = {\n map: (value: any, fn: (value: string) => string | undefined) => any\n}\n\ntype PatternProperties = Record<string, PatternProperty>\n\ntype Props<T> = Record<LiteralUnion<keyof T>, any>\n\nexport type PatternConfig<T extends PatternProperties = PatternProperties> = {\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\n /**\n * The css object this pattern will generate.\n */\n transform?: (props: Props<T>, helpers: PatternHelpers) => 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<CssProperty>[]\n}\n"
2700
+ content: "import type { CssProperty, SystemStyleObject } from './system-types'\nimport type { TokenCategory } from '../tokens'\n\ntype Primitive = string | number | boolean | null | undefined\ntype LiteralUnion<T, K extends Primitive = string> = T | (K & Record<never, never>)\n\nexport type PatternProperty =\n | { type: 'property'; value: CssProperty }\n | { type: 'enum'; value: string[] }\n | { type: 'token'; value: TokenCategory; property?: CssProperty }\n | { type: 'string' | 'boolean' | 'number' }\n\nexport type PatternHelpers = {\n map: (value: any, fn: (value: string) => string | undefined) => any\n}\n\nexport type PatternProperties = Record<string, PatternProperty>\n\ntype Props<T> = Record<LiteralUnion<keyof T>, any>\n\nexport type PatternConfig<T extends PatternProperties = PatternProperties> = {\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\n /**\n * The css object this pattern will generate.\n */\n transform?: (props: Props<T>, helpers: PatternHelpers) => 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<CssProperty>[]\n}\n"
2693
2701
  };
2694
2702
 
2695
2703
  // src/artifacts/generated/parts.d.ts.json
@@ -2721,7 +2729,7 @@ var generateTypesEntry = () => ({
2721
2729
  global: outdent38`
2722
2730
  import type { RecipeVariantRecord, RecipeConfig } from './recipe'
2723
2731
  import type { Parts } from './parts'
2724
- import type { PatternConfig } from './pattern'
2732
+ import type { PatternConfig, PatternProperties } from './pattern'
2725
2733
  import type { GlobalStyleObject, SystemStyleObject } from './system-types'
2726
2734
  import type { CompositionStyles } from './composition'
2727
2735
 
@@ -2731,7 +2739,7 @@ var generateTypesEntry = () => ({
2731
2739
  export function defineGlobalStyles(definition: GlobalStyleObject): GlobalStyleObject
2732
2740
  export function defineTextStyles(definition: CompositionStyles['textStyles']): CompositionStyles['textStyles']
2733
2741
  export function defineLayerStyles(definition: CompositionStyles['layerStyles']): CompositionStyles['layerStyles']
2734
- export function definePattern<T>(config: PatternConfig<T>): PatternConfig
2742
+ export function definePattern<T extends PatternProperties>(config: PatternConfig<T>): PatternConfig
2735
2743
  export function defineParts<T extends Parts>(parts: T): (config: Partial<Record<keyof T, SystemStyleObject>>) => Partial<Record<keyof T, SystemStyleObject>>;
2736
2744
  }
2737
2745
  `,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/generator",
3
- "version": "0.0.0-dev-20230705181609",
3
+ "version": "0.0.0-dev-20230706113853",
4
4
  "description": "The css generator for css panda",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -20,17 +20,17 @@
20
20
  "pluralize": "8.0.0",
21
21
  "postcss": "8.4.24",
22
22
  "ts-pattern": "4.3.0",
23
- "@pandacss/core": "0.0.0-dev-20230705181609",
24
- "@pandacss/is-valid-prop": "0.0.0-dev-20230705181609",
25
- "@pandacss/logger": "0.0.0-dev-20230705181609",
26
- "@pandacss/shared": "0.0.0-dev-20230705181609",
27
- "@pandacss/token-dictionary": "0.0.0-dev-20230705181609",
28
- "@pandacss/types": "0.0.0-dev-20230705181609"
23
+ "@pandacss/core": "0.0.0-dev-20230706113853",
24
+ "@pandacss/is-valid-prop": "0.0.0-dev-20230706113853",
25
+ "@pandacss/logger": "0.0.0-dev-20230706113853",
26
+ "@pandacss/shared": "0.0.0-dev-20230706113853",
27
+ "@pandacss/token-dictionary": "0.0.0-dev-20230706113853",
28
+ "@pandacss/types": "0.0.0-dev-20230706113853"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@types/pluralize": "0.0.29",
32
32
  "hookable": "5.5.3",
33
- "@pandacss/fixture": "0.0.0-dev-20230705181609"
33
+ "@pandacss/fixture": "0.0.0-dev-20230706113853"
34
34
  },
35
35
  "scripts": {
36
36
  "prebuild": "tsx scripts/prebuild.ts",