@pandacss/generator 0.0.0-dev-20230208184147 → 0.0.0-dev-20230209112455

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
@@ -1866,61 +1866,62 @@ var generateFlattenedCss = (ctx) => (options) => {
1866
1866
 
1867
1867
  // src/artifacts/css/parser-css.ts
1868
1868
  var import_logger2 = require("@pandacss/logger");
1869
+ var import_func = require("lil-fp/func");
1869
1870
  var import_ts_pattern5 = require("ts-pattern");
1870
- var generateParserCss = (ctx) => (result) => {
1871
- const {
1872
- createSheet,
1873
- patterns,
1874
- recipes,
1875
- config: { minify }
1876
- } = ctx;
1877
- const sheet = createSheet();
1878
- result.css.forEach((css3) => {
1879
- sheet.processAtomic(css3.data);
1880
- });
1881
- result.cva.forEach((cva) => {
1882
- sheet.processAtomicRecipe(cva.data);
1883
- });
1884
- result.jsx.forEach((jsx) => {
1885
- const { css: css3 = {}, ...rest } = jsx.data;
1886
- const styles = { ...rest, ...css3 };
1887
- (0, import_ts_pattern5.match)(jsx).with({ type: "pattern", name: import_ts_pattern5.P.string }, ({ name }) => {
1888
- result.setPattern(patterns.getFnName(name), { data: styles });
1889
- }).with({ type: "recipe", name: import_ts_pattern5.P.string }, ({ name }) => {
1890
- const [recipeProps, styleProps] = recipes.splitProps(name, styles);
1891
- result.setRecipe(recipes.getFnName(name), { data: recipeProps });
1892
- sheet.processAtomic(styleProps);
1893
- }).otherwise(() => {
1894
- sheet.processAtomic(styles);
1871
+ var generateParserCss = (ctx) => (result) => (0, import_func.pipe)(
1872
+ { ...ctx, sheet: ctx.createSheet(), result },
1873
+ (0, import_func.tap)(({ sheet, result: result2, patterns, recipes }) => {
1874
+ result2.css.forEach((css3) => {
1875
+ sheet.processAtomic(css3.data);
1895
1876
  });
1896
- });
1897
- result.recipe.forEach((recipeSet, name) => {
1898
- try {
1899
- for (const recipe of recipeSet) {
1900
- const recipeConfig = recipes.getConfig(name);
1901
- if (!recipeConfig)
1902
- continue;
1903
- sheet.processRecipe(recipeConfig, recipe.data);
1904
- }
1905
- } catch (error) {
1906
- import_logger2.logger.error("serializer:recipe", error);
1907
- }
1908
- });
1909
- result.pattern.forEach((patternSet, name) => {
1910
- try {
1911
- for (const pattern of patternSet) {
1912
- const styleProps = patterns.transform(name, pattern.data);
1877
+ result2.cva.forEach((cva) => {
1878
+ sheet.processAtomicRecipe(cva.data);
1879
+ });
1880
+ result2.jsx.forEach((jsx) => {
1881
+ const { css: css3 = {}, ...rest } = jsx.data;
1882
+ const styles = { ...rest, ...css3 };
1883
+ (0, import_ts_pattern5.match)(jsx).with({ type: "pattern", name: import_ts_pattern5.P.string }, ({ name }) => {
1884
+ result2.setPattern(patterns.getFnName(name), { data: styles });
1885
+ }).with({ type: "recipe", name: import_ts_pattern5.P.string }, ({ name }) => {
1886
+ const [recipeProps, styleProps] = recipes.splitProps(name, styles);
1887
+ result2.setRecipe(recipes.getFnName(name), { data: recipeProps });
1913
1888
  sheet.processAtomic(styleProps);
1889
+ }).otherwise(() => {
1890
+ sheet.processAtomic(styles);
1891
+ });
1892
+ });
1893
+ result2.recipe.forEach((recipeSet, name) => {
1894
+ try {
1895
+ for (const recipe of recipeSet) {
1896
+ const recipeConfig = recipes.getConfig(name);
1897
+ if (!recipeConfig)
1898
+ continue;
1899
+ sheet.processRecipe(recipeConfig, recipe.data);
1900
+ }
1901
+ } catch (error) {
1902
+ import_logger2.logger.error("serializer:recipe", error);
1903
+ }
1904
+ });
1905
+ result2.pattern.forEach((patternSet, name) => {
1906
+ try {
1907
+ for (const pattern of patternSet) {
1908
+ const styleProps = patterns.transform(name, pattern.data);
1909
+ sheet.processAtomic(styleProps);
1910
+ }
1911
+ } catch (error) {
1912
+ import_logger2.logger.error("serializer:pattern", error);
1914
1913
  }
1915
- } catch (error) {
1916
- import_logger2.logger.error("serializer:pattern", error);
1914
+ });
1915
+ }),
1916
+ (0, import_func.tryCatch)(
1917
+ ({ sheet, result: result2, config: { minify } }) => {
1918
+ return !result2.isEmpty() ? sheet.toCss({ minify }) : void 0;
1919
+ },
1920
+ () => {
1921
+ import_logger2.logger.error("serializer:css", "Failed to serialize CSS");
1917
1922
  }
1918
- });
1919
- if (result.isEmpty()) {
1920
- return;
1921
- }
1922
- return sheet.toCss({ minify });
1923
- };
1923
+ )
1924
+ );
1924
1925
 
1925
1926
  // src/engines/base.ts
1926
1927
  var import_core4 = require("@pandacss/core");
package/dist/index.mjs CHANGED
@@ -93,7 +93,7 @@ var getMessages = (ctx) => ({
93
93
  });
94
94
 
95
95
  // src/generator.ts
96
- import { Obj as Obj4, pipe as pipe4 } from "lil-fp";
96
+ import { Obj as Obj4, pipe as pipe5 } from "lil-fp";
97
97
 
98
98
  // src/artifacts/index.ts
99
99
  import outdent26 from "outdent";
@@ -1835,61 +1835,62 @@ var generateFlattenedCss = (ctx) => (options) => {
1835
1835
 
1836
1836
  // src/artifacts/css/parser-css.ts
1837
1837
  import { logger } from "@pandacss/logger";
1838
+ import { pipe, tap, tryCatch } from "lil-fp/func";
1838
1839
  import { match as match5, P } from "ts-pattern";
1839
- var generateParserCss = (ctx) => (result) => {
1840
- const {
1841
- createSheet,
1842
- patterns,
1843
- recipes,
1844
- config: { minify }
1845
- } = ctx;
1846
- const sheet = createSheet();
1847
- result.css.forEach((css3) => {
1848
- sheet.processAtomic(css3.data);
1849
- });
1850
- result.cva.forEach((cva) => {
1851
- sheet.processAtomicRecipe(cva.data);
1852
- });
1853
- result.jsx.forEach((jsx) => {
1854
- const { css: css3 = {}, ...rest } = jsx.data;
1855
- const styles = { ...rest, ...css3 };
1856
- match5(jsx).with({ type: "pattern", name: P.string }, ({ name }) => {
1857
- result.setPattern(patterns.getFnName(name), { data: styles });
1858
- }).with({ type: "recipe", name: P.string }, ({ name }) => {
1859
- const [recipeProps, styleProps] = recipes.splitProps(name, styles);
1860
- result.setRecipe(recipes.getFnName(name), { data: recipeProps });
1861
- sheet.processAtomic(styleProps);
1862
- }).otherwise(() => {
1863
- sheet.processAtomic(styles);
1840
+ var generateParserCss = (ctx) => (result) => pipe(
1841
+ { ...ctx, sheet: ctx.createSheet(), result },
1842
+ tap(({ sheet, result: result2, patterns, recipes }) => {
1843
+ result2.css.forEach((css3) => {
1844
+ sheet.processAtomic(css3.data);
1864
1845
  });
1865
- });
1866
- result.recipe.forEach((recipeSet, name) => {
1867
- try {
1868
- for (const recipe of recipeSet) {
1869
- const recipeConfig = recipes.getConfig(name);
1870
- if (!recipeConfig)
1871
- continue;
1872
- sheet.processRecipe(recipeConfig, recipe.data);
1873
- }
1874
- } catch (error) {
1875
- logger.error("serializer:recipe", error);
1876
- }
1877
- });
1878
- result.pattern.forEach((patternSet, name) => {
1879
- try {
1880
- for (const pattern of patternSet) {
1881
- const styleProps = patterns.transform(name, pattern.data);
1846
+ result2.cva.forEach((cva) => {
1847
+ sheet.processAtomicRecipe(cva.data);
1848
+ });
1849
+ result2.jsx.forEach((jsx) => {
1850
+ const { css: css3 = {}, ...rest } = jsx.data;
1851
+ const styles = { ...rest, ...css3 };
1852
+ match5(jsx).with({ type: "pattern", name: P.string }, ({ name }) => {
1853
+ result2.setPattern(patterns.getFnName(name), { data: styles });
1854
+ }).with({ type: "recipe", name: P.string }, ({ name }) => {
1855
+ const [recipeProps, styleProps] = recipes.splitProps(name, styles);
1856
+ result2.setRecipe(recipes.getFnName(name), { data: recipeProps });
1882
1857
  sheet.processAtomic(styleProps);
1858
+ }).otherwise(() => {
1859
+ sheet.processAtomic(styles);
1860
+ });
1861
+ });
1862
+ result2.recipe.forEach((recipeSet, name) => {
1863
+ try {
1864
+ for (const recipe of recipeSet) {
1865
+ const recipeConfig = recipes.getConfig(name);
1866
+ if (!recipeConfig)
1867
+ continue;
1868
+ sheet.processRecipe(recipeConfig, recipe.data);
1869
+ }
1870
+ } catch (error) {
1871
+ logger.error("serializer:recipe", error);
1883
1872
  }
1884
- } catch (error) {
1885
- logger.error("serializer:pattern", error);
1873
+ });
1874
+ result2.pattern.forEach((patternSet, name) => {
1875
+ try {
1876
+ for (const pattern of patternSet) {
1877
+ const styleProps = patterns.transform(name, pattern.data);
1878
+ sheet.processAtomic(styleProps);
1879
+ }
1880
+ } catch (error) {
1881
+ logger.error("serializer:pattern", error);
1882
+ }
1883
+ });
1884
+ }),
1885
+ tryCatch(
1886
+ ({ sheet, result: result2, config: { minify } }) => {
1887
+ return !result2.isEmpty() ? sheet.toCss({ minify }) : void 0;
1888
+ },
1889
+ () => {
1890
+ logger.error("serializer:css", "Failed to serialize CSS");
1886
1891
  }
1887
- });
1888
- if (result.isEmpty()) {
1889
- return;
1890
- }
1891
- return sheet.toCss({ minify });
1892
- };
1892
+ )
1893
+ );
1893
1894
 
1894
1895
  // src/engines/base.ts
1895
1896
  import { assignCompositions, Conditions, Stylesheet, Utility } from "@pandacss/core";
@@ -1897,16 +1898,16 @@ import { isCssProperty } from "@pandacss/is-valid-prop";
1897
1898
  import { logger as logger2 } from "@pandacss/logger";
1898
1899
  import { compact, mapObject } from "@pandacss/shared";
1899
1900
  import { TokenDictionary } from "@pandacss/token-dictionary";
1900
- import { Obj, pipe, tap } from "lil-fp";
1901
+ import { Obj, pipe as pipe2, tap as tap2 } from "lil-fp";
1901
1902
  import postcss3 from "postcss";
1902
1903
  var helpers = { map: mapObject };
1903
- var getBaseEngine = (conf) => pipe(
1904
+ var getBaseEngine = (conf) => pipe2(
1904
1905
  conf,
1905
1906
  Obj.bind("tokens", ({ config: { theme = {}, prefix } }) => {
1906
1907
  const { breakpoints, tokens, semanticTokens } = theme;
1907
1908
  return new TokenDictionary({ breakpoints, tokens, semanticTokens, prefix });
1908
1909
  }),
1909
- tap(({ tokens }) => {
1910
+ tap2(({ tokens }) => {
1910
1911
  logger2.debug("generator:tokens", tokens.allNames);
1911
1912
  }),
1912
1913
  Obj.bind("utility", ({ config: { prefix, utilities, separator }, tokens }) => {
@@ -1916,7 +1917,7 @@ var getBaseEngine = (conf) => pipe(
1916
1917
  const { breakpoints } = theme ?? {};
1917
1918
  return new Conditions({ conditions, breakpoints });
1918
1919
  }),
1919
- tap(({ conditions, utility, config: { theme } }) => {
1920
+ tap2(({ conditions, utility, config: { theme } }) => {
1920
1921
  logger2.debug("generator:conditions", conditions);
1921
1922
  const { textStyles, layerStyles } = theme ?? {};
1922
1923
  const compositions = compact({ textStyle: textStyles, layerStyle: layerStyles });
@@ -1970,10 +1971,10 @@ var getPathEngine = ({ cwd, emitPackage, outdir }) => {
1970
1971
 
1971
1972
  // src/engines/pattern.ts
1972
1973
  import { capitalize as capitalize4, dashCase, mapObject as mapObject2, uncapitalize } from "@pandacss/shared";
1973
- import { Obj as Obj2, pipe as pipe2 } from "lil-fp";
1974
+ import { Obj as Obj2, pipe as pipe3 } from "lil-fp";
1974
1975
  var helpers2 = { map: mapObject2 };
1975
1976
  var getPatternEngine = (config) => {
1976
- return pipe2(
1977
+ return pipe3(
1977
1978
  { patterns: config.patterns ?? {} },
1978
1979
  Obj2.bind("getConfig", ({ patterns }) => {
1979
1980
  return (name) => patterns[name];
@@ -2020,9 +2021,9 @@ var getPatternEngine = (config) => {
2020
2021
 
2021
2022
  // src/engines/recipe.ts
2022
2023
  import { capitalize as capitalize5, dashCase as dashCase2, splitProps, uncapitalize as uncapitalize2 } from "@pandacss/shared";
2023
- import { Obj as Obj3, pipe as pipe3 } from "lil-fp";
2024
+ import { Obj as Obj3, pipe as pipe4 } from "lil-fp";
2024
2025
  var getRecipeEngine = (config) => {
2025
- return pipe3(
2026
+ return pipe4(
2026
2027
  { recipes: config.theme?.recipes ?? {} },
2027
2028
  Obj3.bind("getConfig", ({ recipes }) => {
2028
2029
  return (name) => recipes[name];
@@ -2108,7 +2109,7 @@ var getImportMap = (outdir) => ({
2108
2109
  pattern: `${outdir}/patterns`,
2109
2110
  jsx: `${outdir}/jsx`
2110
2111
  });
2111
- var createGenerator = (conf) => pipe4(
2112
+ var createGenerator = (conf) => pipe5(
2112
2113
  getEngine(defaults(conf)),
2113
2114
  Obj4.assign((ctx) => ({
2114
2115
  getArtifacts: generateArtifacts(ctx),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/generator",
3
- "version": "0.0.0-dev-20230208184147",
3
+ "version": "0.0.0-dev-20230209112455",
4
4
  "description": "The css generator for css panda",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -20,16 +20,16 @@
20
20
  "pluralize": "8.0.0",
21
21
  "postcss": "8.4.21",
22
22
  "ts-pattern": "4.1.4",
23
- "@pandacss/core": "0.0.0-dev-20230208184147",
24
- "@pandacss/logger": "0.0.0-dev-20230208184147",
25
- "@pandacss/is-valid-prop": "0.0.0-dev-20230208184147",
26
- "@pandacss/shared": "0.0.0-dev-20230208184147",
27
- "@pandacss/types": "0.0.0-dev-20230208184147",
28
- "@pandacss/token-dictionary": "0.0.0-dev-20230208184147"
23
+ "@pandacss/core": "0.0.0-dev-20230209112455",
24
+ "@pandacss/logger": "0.0.0-dev-20230209112455",
25
+ "@pandacss/is-valid-prop": "0.0.0-dev-20230209112455",
26
+ "@pandacss/shared": "0.0.0-dev-20230209112455",
27
+ "@pandacss/types": "0.0.0-dev-20230209112455",
28
+ "@pandacss/token-dictionary": "0.0.0-dev-20230209112455"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@types/pluralize": "0.0.29",
32
- "@pandacss/fixture": "0.0.0-dev-20230208184147"
32
+ "@pandacss/fixture": "0.0.0-dev-20230209112455"
33
33
  },
34
34
  "scripts": {
35
35
  "prebuild": "tsx scripts/prebuild.ts",