@pandacss/generator 0.0.0-dev-20230426205606 → 0.0.0-dev-20230428204429
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 +22 -23
- package/dist/index.mjs +22 -23
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -1812,7 +1812,7 @@ var recipe_d_ts_default = {
|
|
|
1812
1812
|
|
|
1813
1813
|
// src/artifacts/generated/pattern.d.ts.json
|
|
1814
1814
|
var pattern_d_ts_default = {
|
|
1815
|
-
content: "import type {
|
|
1815
|
+
content: "import type { NativeCssProperty, SystemStyleObject } from './system-types'\n\ntype Primitive = string | number | boolean | null | undefined\ntype LiteralUnion<T, K extends Primitive = string> = T | (K & Record<never, never>)\n\ntype TokenCategory =\n | 'zIndex'\n | 'opacity'\n | 'colors'\n | 'fonts'\n | 'fontSizes'\n | 'fontWeights'\n | 'lineHeights'\n | 'letterSpacings'\n | 'sizes'\n | 'shadows'\n | 'spacing'\n | 'radii'\n | 'borders'\n | 'durations'\n | 'easings'\n | 'animations'\n | 'blurs'\n | 'gradients'\n | 'breakpoints'\n | 'assets'\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"
|
|
1816
1816
|
};
|
|
1817
1817
|
|
|
1818
1818
|
// src/artifacts/generated/parts.d.ts.json
|
|
@@ -1880,7 +1880,7 @@ function generatePropTypes(ctx) {
|
|
|
1880
1880
|
import_outdent27.outdent`
|
|
1881
1881
|
import type { ConditionalValue } from './conditions';
|
|
1882
1882
|
import type { Properties as CSSProperties } from './csstype'
|
|
1883
|
-
import type { Tokens } from './
|
|
1883
|
+
import type { Tokens } from './tokens'
|
|
1884
1884
|
|
|
1885
1885
|
type PropertyValueTypes = {`
|
|
1886
1886
|
];
|
|
@@ -1891,9 +1891,9 @@ function generatePropTypes(ctx) {
|
|
|
1891
1891
|
result.push("}", "\n");
|
|
1892
1892
|
result.push(`
|
|
1893
1893
|
type NativeValue<T> = T extends keyof CSSProperties ? CSSProperties[T] : never
|
|
1894
|
-
|
|
1894
|
+
|
|
1895
1895
|
type Shorthand<T> = T extends keyof PropertyValueTypes ? PropertyValueTypes[T]${strictText} : NativeValue<T>
|
|
1896
|
-
|
|
1896
|
+
|
|
1897
1897
|
export type PropertyTypes = PropertyValueTypes & {
|
|
1898
1898
|
`);
|
|
1899
1899
|
utility.shorthands.forEach((value, key) => {
|
|
@@ -1918,12 +1918,12 @@ function generateStyleProps(ctx) {
|
|
|
1918
1918
|
const props = new Set(import_is_valid_prop.allCssProperties.concat(ctx.utility.keys()));
|
|
1919
1919
|
return import_outdent28.default`
|
|
1920
1920
|
import { PropertyValue } from './prop-type'
|
|
1921
|
-
import { Token } from './
|
|
1921
|
+
import { Token } from './tokens'
|
|
1922
1922
|
|
|
1923
1923
|
export type CssVarProperties = {
|
|
1924
1924
|
[key in \`--\${string}\`]?: Token | (string & {}) | (number & {})
|
|
1925
1925
|
}
|
|
1926
|
-
|
|
1926
|
+
|
|
1927
1927
|
export type SystemProperties = {
|
|
1928
1928
|
${Array.from(props).map((v) => ` ${v}?: PropertyValue<'${v}'>`).join("\n")}
|
|
1929
1929
|
}
|
|
@@ -1979,7 +1979,7 @@ function generateTokenTypes(ctx) {
|
|
|
1979
1979
|
|
|
1980
1980
|
// src/artifacts/css/global-css.ts
|
|
1981
1981
|
var generateGlobalCss = (ctx) => {
|
|
1982
|
-
const { globalCss = {} } = ctx.config;
|
|
1982
|
+
const { globalCss = {}, optimize = true } = ctx.config;
|
|
1983
1983
|
const sheet = ctx.createSheet();
|
|
1984
1984
|
sheet.processGlobalCss({
|
|
1985
1985
|
":root": {
|
|
@@ -2017,14 +2017,14 @@ var generateGlobalCss = (ctx) => {
|
|
|
2017
2017
|
}
|
|
2018
2018
|
});
|
|
2019
2019
|
sheet.processGlobalCss(globalCss);
|
|
2020
|
-
return sheet.toCss();
|
|
2020
|
+
return sheet.toCss({ optimize });
|
|
2021
2021
|
};
|
|
2022
2022
|
|
|
2023
2023
|
// src/artifacts/css/static-css.ts
|
|
2024
2024
|
var import_core3 = require("@pandacss/core");
|
|
2025
2025
|
var generateStaticCss = (ctx) => {
|
|
2026
2026
|
const { config, createSheet, utility, recipes } = ctx;
|
|
2027
|
-
const { staticCss = {}, theme = {} } = config;
|
|
2027
|
+
const { staticCss = {}, theme = {}, optimize = true } = config;
|
|
2028
2028
|
const sheet = createSheet();
|
|
2029
2029
|
const fn = (0, import_core3.getStaticCss)(staticCss);
|
|
2030
2030
|
const results = fn({
|
|
@@ -2044,7 +2044,7 @@ var generateStaticCss = (ctx) => {
|
|
|
2044
2044
|
sheet.processRecipe(recipeConfig, value);
|
|
2045
2045
|
});
|
|
2046
2046
|
});
|
|
2047
|
-
return sheet.toCss();
|
|
2047
|
+
return sheet.toCss({ optimize });
|
|
2048
2048
|
};
|
|
2049
2049
|
|
|
2050
2050
|
// src/artifacts/index.ts
|
|
@@ -2094,7 +2094,7 @@ function setupTypes(ctx) {
|
|
|
2094
2094
|
{ file: "pattern.d.ts", code: gen.pattern },
|
|
2095
2095
|
{ file: "parts.d.ts", code: gen.parts },
|
|
2096
2096
|
{ file: "index.d.ts", code: entry.index },
|
|
2097
|
-
{ file: "
|
|
2097
|
+
{ file: "tokens.d.ts", code: generateTokenTypes(ctx) },
|
|
2098
2098
|
{ file: "prop-type.d.ts", code: generatePropTypes(ctx) },
|
|
2099
2099
|
{ file: "style-props.d.ts", code: generateStyleProps(ctx) },
|
|
2100
2100
|
{ file: "conditions.d.ts", code: conditions.dts }
|
|
@@ -2284,19 +2284,18 @@ var generateFlattenedCss = (ctx) => (options) => {
|
|
|
2284
2284
|
!ctx.tokens.isEmpty && "@import './tokens/index.css';",
|
|
2285
2285
|
keyframes && "@import './tokens/keyframes.css';"
|
|
2286
2286
|
].filter(Boolean).join("\n\n");
|
|
2287
|
-
const resolved = [
|
|
2288
|
-
generateLayoutGridCss(),
|
|
2289
|
-
generateGlobalCss(ctx),
|
|
2290
|
-
generateStaticCss(ctx),
|
|
2291
|
-
generateResetCss(),
|
|
2292
|
-
generateTokenCss(ctx),
|
|
2293
|
-
generateKeyframeCss(ctx)
|
|
2294
|
-
].filter(Boolean).join("\n\n");
|
|
2295
2287
|
const sheet = ctx.createSheet({
|
|
2296
|
-
content: resolve ?
|
|
2288
|
+
content: resolve ? [
|
|
2289
|
+
generateLayoutGridCss(),
|
|
2290
|
+
generateGlobalCss(ctx),
|
|
2291
|
+
generateStaticCss(ctx),
|
|
2292
|
+
generateResetCss(),
|
|
2293
|
+
generateTokenCss(ctx),
|
|
2294
|
+
generateKeyframeCss(ctx)
|
|
2295
|
+
].filter(Boolean).join("\n\n") : unresolved
|
|
2297
2296
|
});
|
|
2298
2297
|
sheet.append(...files);
|
|
2299
|
-
return sheet.toCss({ minify });
|
|
2298
|
+
return sheet.toCss({ optimize: true, minify });
|
|
2300
2299
|
};
|
|
2301
2300
|
|
|
2302
2301
|
// src/artifacts/css/parser-css.ts
|
|
@@ -2366,8 +2365,8 @@ var generateParserCss = (ctx) => (result) => (0, import_func.pipe)(
|
|
|
2366
2365
|
});
|
|
2367
2366
|
}),
|
|
2368
2367
|
(0, import_func.tryCatch)(
|
|
2369
|
-
({ sheet, result: result2, config: { minify } }) => {
|
|
2370
|
-
return !result2.isEmpty() ? sheet.toCss({ minify }) : void 0;
|
|
2368
|
+
({ sheet, result: result2, config: { minify, optimize } }) => {
|
|
2369
|
+
return !result2.isEmpty() ? sheet.toCss({ minify, optimize }) : void 0;
|
|
2371
2370
|
},
|
|
2372
2371
|
() => {
|
|
2373
2372
|
import_logger2.logger.error("serializer:css", "Failed to serialize CSS");
|
package/dist/index.mjs
CHANGED
|
@@ -1781,7 +1781,7 @@ var recipe_d_ts_default = {
|
|
|
1781
1781
|
|
|
1782
1782
|
// src/artifacts/generated/pattern.d.ts.json
|
|
1783
1783
|
var pattern_d_ts_default = {
|
|
1784
|
-
content: "import type {
|
|
1784
|
+
content: "import type { NativeCssProperty, SystemStyleObject } from './system-types'\n\ntype Primitive = string | number | boolean | null | undefined\ntype LiteralUnion<T, K extends Primitive = string> = T | (K & Record<never, never>)\n\ntype TokenCategory =\n | 'zIndex'\n | 'opacity'\n | 'colors'\n | 'fonts'\n | 'fontSizes'\n | 'fontWeights'\n | 'lineHeights'\n | 'letterSpacings'\n | 'sizes'\n | 'shadows'\n | 'spacing'\n | 'radii'\n | 'borders'\n | 'durations'\n | 'easings'\n | 'animations'\n | 'blurs'\n | 'gradients'\n | 'breakpoints'\n | 'assets'\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"
|
|
1785
1785
|
};
|
|
1786
1786
|
|
|
1787
1787
|
// src/artifacts/generated/parts.d.ts.json
|
|
@@ -1849,7 +1849,7 @@ function generatePropTypes(ctx) {
|
|
|
1849
1849
|
outdent27`
|
|
1850
1850
|
import type { ConditionalValue } from './conditions';
|
|
1851
1851
|
import type { Properties as CSSProperties } from './csstype'
|
|
1852
|
-
import type { Tokens } from './
|
|
1852
|
+
import type { Tokens } from './tokens'
|
|
1853
1853
|
|
|
1854
1854
|
type PropertyValueTypes = {`
|
|
1855
1855
|
];
|
|
@@ -1860,9 +1860,9 @@ function generatePropTypes(ctx) {
|
|
|
1860
1860
|
result.push("}", "\n");
|
|
1861
1861
|
result.push(`
|
|
1862
1862
|
type NativeValue<T> = T extends keyof CSSProperties ? CSSProperties[T] : never
|
|
1863
|
-
|
|
1863
|
+
|
|
1864
1864
|
type Shorthand<T> = T extends keyof PropertyValueTypes ? PropertyValueTypes[T]${strictText} : NativeValue<T>
|
|
1865
|
-
|
|
1865
|
+
|
|
1866
1866
|
export type PropertyTypes = PropertyValueTypes & {
|
|
1867
1867
|
`);
|
|
1868
1868
|
utility.shorthands.forEach((value, key) => {
|
|
@@ -1887,12 +1887,12 @@ function generateStyleProps(ctx) {
|
|
|
1887
1887
|
const props = new Set(allCssProperties.concat(ctx.utility.keys()));
|
|
1888
1888
|
return outdent28`
|
|
1889
1889
|
import { PropertyValue } from './prop-type'
|
|
1890
|
-
import { Token } from './
|
|
1890
|
+
import { Token } from './tokens'
|
|
1891
1891
|
|
|
1892
1892
|
export type CssVarProperties = {
|
|
1893
1893
|
[key in \`--\${string}\`]?: Token | (string & {}) | (number & {})
|
|
1894
1894
|
}
|
|
1895
|
-
|
|
1895
|
+
|
|
1896
1896
|
export type SystemProperties = {
|
|
1897
1897
|
${Array.from(props).map((v) => ` ${v}?: PropertyValue<'${v}'>`).join("\n")}
|
|
1898
1898
|
}
|
|
@@ -1948,7 +1948,7 @@ function generateTokenTypes(ctx) {
|
|
|
1948
1948
|
|
|
1949
1949
|
// src/artifacts/css/global-css.ts
|
|
1950
1950
|
var generateGlobalCss = (ctx) => {
|
|
1951
|
-
const { globalCss = {} } = ctx.config;
|
|
1951
|
+
const { globalCss = {}, optimize = true } = ctx.config;
|
|
1952
1952
|
const sheet = ctx.createSheet();
|
|
1953
1953
|
sheet.processGlobalCss({
|
|
1954
1954
|
":root": {
|
|
@@ -1986,14 +1986,14 @@ var generateGlobalCss = (ctx) => {
|
|
|
1986
1986
|
}
|
|
1987
1987
|
});
|
|
1988
1988
|
sheet.processGlobalCss(globalCss);
|
|
1989
|
-
return sheet.toCss();
|
|
1989
|
+
return sheet.toCss({ optimize });
|
|
1990
1990
|
};
|
|
1991
1991
|
|
|
1992
1992
|
// src/artifacts/css/static-css.ts
|
|
1993
1993
|
import { getStaticCss } from "@pandacss/core";
|
|
1994
1994
|
var generateStaticCss = (ctx) => {
|
|
1995
1995
|
const { config, createSheet, utility, recipes } = ctx;
|
|
1996
|
-
const { staticCss = {}, theme = {} } = config;
|
|
1996
|
+
const { staticCss = {}, theme = {}, optimize = true } = config;
|
|
1997
1997
|
const sheet = createSheet();
|
|
1998
1998
|
const fn = getStaticCss(staticCss);
|
|
1999
1999
|
const results = fn({
|
|
@@ -2013,7 +2013,7 @@ var generateStaticCss = (ctx) => {
|
|
|
2013
2013
|
sheet.processRecipe(recipeConfig, value);
|
|
2014
2014
|
});
|
|
2015
2015
|
});
|
|
2016
|
-
return sheet.toCss();
|
|
2016
|
+
return sheet.toCss({ optimize });
|
|
2017
2017
|
};
|
|
2018
2018
|
|
|
2019
2019
|
// src/artifacts/index.ts
|
|
@@ -2063,7 +2063,7 @@ function setupTypes(ctx) {
|
|
|
2063
2063
|
{ file: "pattern.d.ts", code: gen.pattern },
|
|
2064
2064
|
{ file: "parts.d.ts", code: gen.parts },
|
|
2065
2065
|
{ file: "index.d.ts", code: entry.index },
|
|
2066
|
-
{ file: "
|
|
2066
|
+
{ file: "tokens.d.ts", code: generateTokenTypes(ctx) },
|
|
2067
2067
|
{ file: "prop-type.d.ts", code: generatePropTypes(ctx) },
|
|
2068
2068
|
{ file: "style-props.d.ts", code: generateStyleProps(ctx) },
|
|
2069
2069
|
{ file: "conditions.d.ts", code: conditions.dts }
|
|
@@ -2253,19 +2253,18 @@ var generateFlattenedCss = (ctx) => (options) => {
|
|
|
2253
2253
|
!ctx.tokens.isEmpty && "@import './tokens/index.css';",
|
|
2254
2254
|
keyframes && "@import './tokens/keyframes.css';"
|
|
2255
2255
|
].filter(Boolean).join("\n\n");
|
|
2256
|
-
const resolved = [
|
|
2257
|
-
generateLayoutGridCss(),
|
|
2258
|
-
generateGlobalCss(ctx),
|
|
2259
|
-
generateStaticCss(ctx),
|
|
2260
|
-
generateResetCss(),
|
|
2261
|
-
generateTokenCss(ctx),
|
|
2262
|
-
generateKeyframeCss(ctx)
|
|
2263
|
-
].filter(Boolean).join("\n\n");
|
|
2264
2256
|
const sheet = ctx.createSheet({
|
|
2265
|
-
content: resolve ?
|
|
2257
|
+
content: resolve ? [
|
|
2258
|
+
generateLayoutGridCss(),
|
|
2259
|
+
generateGlobalCss(ctx),
|
|
2260
|
+
generateStaticCss(ctx),
|
|
2261
|
+
generateResetCss(),
|
|
2262
|
+
generateTokenCss(ctx),
|
|
2263
|
+
generateKeyframeCss(ctx)
|
|
2264
|
+
].filter(Boolean).join("\n\n") : unresolved
|
|
2266
2265
|
});
|
|
2267
2266
|
sheet.append(...files);
|
|
2268
|
-
return sheet.toCss({ minify });
|
|
2267
|
+
return sheet.toCss({ optimize: true, minify });
|
|
2269
2268
|
};
|
|
2270
2269
|
|
|
2271
2270
|
// src/artifacts/css/parser-css.ts
|
|
@@ -2335,8 +2334,8 @@ var generateParserCss = (ctx) => (result) => pipe(
|
|
|
2335
2334
|
});
|
|
2336
2335
|
}),
|
|
2337
2336
|
tryCatch(
|
|
2338
|
-
({ sheet, result: result2, config: { minify } }) => {
|
|
2339
|
-
return !result2.isEmpty() ? sheet.toCss({ minify }) : void 0;
|
|
2337
|
+
({ sheet, result: result2, config: { minify, optimize } }) => {
|
|
2338
|
+
return !result2.isEmpty() ? sheet.toCss({ minify, optimize }) : void 0;
|
|
2340
2339
|
},
|
|
2341
2340
|
() => {
|
|
2342
2341
|
logger.error("serializer:css", "Failed to serialize CSS");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pandacss/generator",
|
|
3
|
-
"version": "0.0.0-dev-
|
|
3
|
+
"version": "0.0.0-dev-20230428204429",
|
|
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.23",
|
|
22
22
|
"ts-pattern": "4.2.2",
|
|
23
|
-
"@pandacss/core": "0.0.0-dev-
|
|
24
|
-
"@pandacss/logger": "0.0.0-dev-
|
|
25
|
-
"@pandacss/is-valid-prop": "0.0.0-dev-
|
|
26
|
-
"@pandacss/shared": "0.0.0-dev-
|
|
27
|
-
"@pandacss/types": "0.0.0-dev-
|
|
28
|
-
"@pandacss/token-dictionary": "0.0.0-dev-
|
|
23
|
+
"@pandacss/core": "0.0.0-dev-20230428204429",
|
|
24
|
+
"@pandacss/logger": "0.0.0-dev-20230428204429",
|
|
25
|
+
"@pandacss/is-valid-prop": "0.0.0-dev-20230428204429",
|
|
26
|
+
"@pandacss/shared": "0.0.0-dev-20230428204429",
|
|
27
|
+
"@pandacss/types": "0.0.0-dev-20230428204429",
|
|
28
|
+
"@pandacss/token-dictionary": "0.0.0-dev-20230428204429"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@types/pluralize": "0.0.29",
|
|
32
|
-
"@pandacss/fixture": "0.0.0-dev-
|
|
32
|
+
"@pandacss/fixture": "0.0.0-dev-20230428204429"
|
|
33
33
|
},
|
|
34
34
|
"scripts": {
|
|
35
35
|
"prebuild": "tsx scripts/prebuild.ts",
|