@pandacss/generator 0.27.2 → 0.28.0
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.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +26 -15
- package/dist/index.mjs +26 -15
- package/package.json +8 -9
package/dist/index.d.mts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import * as _pandacss_types from '@pandacss/types';
|
|
2
|
-
import {
|
|
2
|
+
import { LoadConfigResult, ArtifactId, CssArtifactType } from '@pandacss/types';
|
|
3
3
|
import { Context, Stylesheet, StyleDecoder } from '@pandacss/core';
|
|
4
4
|
|
|
5
5
|
declare class Generator extends Context {
|
|
6
|
-
constructor(conf:
|
|
6
|
+
constructor(conf: LoadConfigResult);
|
|
7
7
|
getArtifacts: (ids?: ArtifactId[] | undefined) => _pandacss_types.Artifact[];
|
|
8
8
|
appendCssOfType: (type: CssArtifactType, sheet: Stylesheet) => void;
|
|
9
9
|
appendLayerParams: (sheet: Stylesheet) => void;
|
|
10
10
|
appendBaselineCss: (sheet: Stylesheet) => void;
|
|
11
11
|
appendParserCss: (sheet: Stylesheet) => void;
|
|
12
|
-
getParserCss: (decoder: StyleDecoder
|
|
12
|
+
getParserCss: (decoder: StyleDecoder) => string;
|
|
13
13
|
getCss: (stylesheet?: Stylesheet) => string;
|
|
14
14
|
}
|
|
15
15
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import * as _pandacss_types from '@pandacss/types';
|
|
2
|
-
import {
|
|
2
|
+
import { LoadConfigResult, ArtifactId, CssArtifactType } from '@pandacss/types';
|
|
3
3
|
import { Context, Stylesheet, StyleDecoder } from '@pandacss/core';
|
|
4
4
|
|
|
5
5
|
declare class Generator extends Context {
|
|
6
|
-
constructor(conf:
|
|
6
|
+
constructor(conf: LoadConfigResult);
|
|
7
7
|
getArtifacts: (ids?: ArtifactId[] | undefined) => _pandacss_types.Artifact[];
|
|
8
8
|
appendCssOfType: (type: CssArtifactType, sheet: Stylesheet) => void;
|
|
9
9
|
appendLayerParams: (sheet: Stylesheet) => void;
|
|
10
10
|
appendBaselineCss: (sheet: Stylesheet) => void;
|
|
11
11
|
appendParserCss: (sheet: Stylesheet) => void;
|
|
12
|
-
getParserCss: (decoder: StyleDecoder
|
|
12
|
+
getParserCss: (decoder: StyleDecoder) => string;
|
|
13
13
|
getCss: (stylesheet?: Stylesheet) => string;
|
|
14
14
|
}
|
|
15
15
|
|
package/dist/index.js
CHANGED
|
@@ -474,7 +474,7 @@ function generateIsValidProp(ctx) {
|
|
|
474
474
|
content = ctx.file.import("memo", "../helpers") + "\n" + content;
|
|
475
475
|
}
|
|
476
476
|
content = ctx.file.import("splitProps", "../helpers") + "\n" + content;
|
|
477
|
-
content += `export const splitCssProps =
|
|
477
|
+
content += `export const splitCssProps = (props) => splitProps(props, isCssProperty)`;
|
|
478
478
|
return {
|
|
479
479
|
js: content,
|
|
480
480
|
dts: import_outdent8.outdent`
|
|
@@ -3007,6 +3007,7 @@ var categories = [
|
|
|
3007
3007
|
"spacing",
|
|
3008
3008
|
"radii",
|
|
3009
3009
|
"borders",
|
|
3010
|
+
"borderWidths",
|
|
3010
3011
|
"durations",
|
|
3011
3012
|
"easings",
|
|
3012
3013
|
"animations",
|
|
@@ -3508,7 +3509,6 @@ var generateGlobalCss = (ctx, sheet) => {
|
|
|
3508
3509
|
}
|
|
3509
3510
|
});
|
|
3510
3511
|
sheet.processGlobalCss(globalCss);
|
|
3511
|
-
void ctx.hooks.callHook("generator:css", "global.css", "");
|
|
3512
3512
|
};
|
|
3513
3513
|
|
|
3514
3514
|
// src/artifacts/css/keyframe-css.ts
|
|
@@ -3519,14 +3519,16 @@ function generateKeyframeCss(ctx, sheet) {
|
|
|
3519
3519
|
for (const [name, definition] of Object.entries(keyframes)) {
|
|
3520
3520
|
result[`@keyframes ${name}`] = definition;
|
|
3521
3521
|
}
|
|
3522
|
-
|
|
3522
|
+
let css2 = (0, import_core2.stringify)(sheet.serialize(result));
|
|
3523
|
+
if (ctx.hooks["cssgen:done"]) {
|
|
3524
|
+
css2 = ctx.hooks["cssgen:done"]({ artifact: "keyframes", content: css2 }) ?? css2;
|
|
3525
|
+
}
|
|
3523
3526
|
sheet.layers.tokens.append(css2);
|
|
3524
|
-
void ctx.hooks.callHook("generator:css", "keyframes.css", "");
|
|
3525
3527
|
}
|
|
3526
3528
|
|
|
3527
3529
|
// src/artifacts/css/parser-css.ts
|
|
3528
3530
|
var import_logger = require("@pandacss/logger");
|
|
3529
|
-
var generateParserCss = (ctx, decoder
|
|
3531
|
+
var generateParserCss = (ctx, decoder) => {
|
|
3530
3532
|
if (!decoder)
|
|
3531
3533
|
return "";
|
|
3532
3534
|
const sheet = ctx.createSheet();
|
|
@@ -3534,7 +3536,6 @@ var generateParserCss = (ctx, decoder, filePath) => {
|
|
|
3534
3536
|
sheet.processDecoder(decoder);
|
|
3535
3537
|
try {
|
|
3536
3538
|
const css2 = sheet.toCss({ minify, optimize });
|
|
3537
|
-
ctx.hooks.callHook("parser:css", filePath ?? "", css2);
|
|
3538
3539
|
return css2;
|
|
3539
3540
|
} catch (err) {
|
|
3540
3541
|
import_logger.logger.error("serializer:css", "Failed to serialize CSS: " + err);
|
|
@@ -3549,7 +3550,7 @@ function generateResetCss(ctx, sheet) {
|
|
|
3549
3550
|
const { preflight } = ctx.config;
|
|
3550
3551
|
const scope = (0, import_shared4.isObject)(preflight) ? preflight.scope : void 0;
|
|
3551
3552
|
const selector = scope ? `${scope} ` : "";
|
|
3552
|
-
|
|
3553
|
+
let output = css`
|
|
3553
3554
|
${selector}* {
|
|
3554
3555
|
margin: 0;
|
|
3555
3556
|
padding: 0;
|
|
@@ -3763,8 +3764,10 @@ function generateResetCss(ctx, sheet) {
|
|
|
3763
3764
|
outline: auto;
|
|
3764
3765
|
}
|
|
3765
3766
|
`;
|
|
3767
|
+
if (ctx.hooks["cssgen:done"]) {
|
|
3768
|
+
output = ctx.hooks["cssgen:done"]({ artifact: "reset", content: output }) ?? output;
|
|
3769
|
+
}
|
|
3766
3770
|
sheet.layers.reset.append(output);
|
|
3767
|
-
void ctx.hooks.callHook("generator:css", "reset.css", "");
|
|
3768
3771
|
}
|
|
3769
3772
|
|
|
3770
3773
|
// src/artifacts/css/static-css.ts
|
|
@@ -3773,9 +3776,11 @@ var generateStaticCss = (ctx, sheet) => {
|
|
|
3773
3776
|
const engine = staticCss.process(ctx.config.staticCss ?? {}, sheet);
|
|
3774
3777
|
if (!sheet) {
|
|
3775
3778
|
const { optimize = true, minify } = config;
|
|
3776
|
-
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
+
let css2 = engine.sheet.toCss({ optimize, minify });
|
|
3780
|
+
if (ctx.hooks["cssgen:done"]) {
|
|
3781
|
+
css2 = ctx.hooks["cssgen:done"]({ artifact: "static", content: css2 }) ?? css2;
|
|
3782
|
+
}
|
|
3783
|
+
return css2;
|
|
3779
3784
|
}
|
|
3780
3785
|
};
|
|
3781
3786
|
|
|
@@ -3813,8 +3818,10 @@ function generateTokenCss(ctx, sheet) {
|
|
|
3813
3818
|
}
|
|
3814
3819
|
let css2 = results.join("\n\n");
|
|
3815
3820
|
css2 = "\n\n" + cleanupSelectors(css2, root);
|
|
3821
|
+
if (ctx.hooks["cssgen:done"]) {
|
|
3822
|
+
css2 = ctx.hooks["cssgen:done"]({ artifact: "tokens", content: css2 }) ?? css2;
|
|
3823
|
+
}
|
|
3816
3824
|
sheet.layers.tokens.append(css2);
|
|
3817
|
-
void ctx.hooks.callHook("generator:css", "tokens.css", "");
|
|
3818
3825
|
}
|
|
3819
3826
|
function getDeepestRule(root, selectors) {
|
|
3820
3827
|
const rule = import_postcss.default.rule({ selector: "" });
|
|
@@ -3892,15 +3899,19 @@ var Generator = class extends import_core4.Context {
|
|
|
3892
3899
|
const decoder = this.decoder.collect(this.encoder);
|
|
3893
3900
|
sheet.processDecoder(decoder);
|
|
3894
3901
|
};
|
|
3895
|
-
getParserCss = (decoder
|
|
3896
|
-
return generateParserCss(this, decoder
|
|
3902
|
+
getParserCss = (decoder) => {
|
|
3903
|
+
return generateParserCss(this, decoder);
|
|
3897
3904
|
};
|
|
3898
3905
|
getCss = (stylesheet) => {
|
|
3899
3906
|
const sheet = stylesheet ?? this.createSheet();
|
|
3900
|
-
|
|
3907
|
+
let css2 = sheet.toCss({
|
|
3901
3908
|
optimize: true,
|
|
3902
3909
|
minify: this.config.minify
|
|
3903
3910
|
});
|
|
3911
|
+
if (this.hooks["cssgen:done"]) {
|
|
3912
|
+
css2 = this.hooks["cssgen:done"]({ artifact: "styles.css", content: css2 }) ?? css2;
|
|
3913
|
+
}
|
|
3914
|
+
return css2;
|
|
3904
3915
|
};
|
|
3905
3916
|
};
|
|
3906
3917
|
// Annotate the CommonJS export names for ESM import in node:
|
package/dist/index.mjs
CHANGED
|
@@ -438,7 +438,7 @@ function generateIsValidProp(ctx) {
|
|
|
438
438
|
content = ctx.file.import("memo", "../helpers") + "\n" + content;
|
|
439
439
|
}
|
|
440
440
|
content = ctx.file.import("splitProps", "../helpers") + "\n" + content;
|
|
441
|
-
content += `export const splitCssProps =
|
|
441
|
+
content += `export const splitCssProps = (props) => splitProps(props, isCssProperty)`;
|
|
442
442
|
return {
|
|
443
443
|
js: content,
|
|
444
444
|
dts: outdent8`
|
|
@@ -2971,6 +2971,7 @@ var categories = [
|
|
|
2971
2971
|
"spacing",
|
|
2972
2972
|
"radii",
|
|
2973
2973
|
"borders",
|
|
2974
|
+
"borderWidths",
|
|
2974
2975
|
"durations",
|
|
2975
2976
|
"easings",
|
|
2976
2977
|
"animations",
|
|
@@ -3472,7 +3473,6 @@ var generateGlobalCss = (ctx, sheet) => {
|
|
|
3472
3473
|
}
|
|
3473
3474
|
});
|
|
3474
3475
|
sheet.processGlobalCss(globalCss);
|
|
3475
|
-
void ctx.hooks.callHook("generator:css", "global.css", "");
|
|
3476
3476
|
};
|
|
3477
3477
|
|
|
3478
3478
|
// src/artifacts/css/keyframe-css.ts
|
|
@@ -3483,14 +3483,16 @@ function generateKeyframeCss(ctx, sheet) {
|
|
|
3483
3483
|
for (const [name, definition] of Object.entries(keyframes)) {
|
|
3484
3484
|
result[`@keyframes ${name}`] = definition;
|
|
3485
3485
|
}
|
|
3486
|
-
|
|
3486
|
+
let css2 = stringify3(sheet.serialize(result));
|
|
3487
|
+
if (ctx.hooks["cssgen:done"]) {
|
|
3488
|
+
css2 = ctx.hooks["cssgen:done"]({ artifact: "keyframes", content: css2 }) ?? css2;
|
|
3489
|
+
}
|
|
3487
3490
|
sheet.layers.tokens.append(css2);
|
|
3488
|
-
void ctx.hooks.callHook("generator:css", "keyframes.css", "");
|
|
3489
3491
|
}
|
|
3490
3492
|
|
|
3491
3493
|
// src/artifacts/css/parser-css.ts
|
|
3492
3494
|
import { logger } from "@pandacss/logger";
|
|
3493
|
-
var generateParserCss = (ctx, decoder
|
|
3495
|
+
var generateParserCss = (ctx, decoder) => {
|
|
3494
3496
|
if (!decoder)
|
|
3495
3497
|
return "";
|
|
3496
3498
|
const sheet = ctx.createSheet();
|
|
@@ -3498,7 +3500,6 @@ var generateParserCss = (ctx, decoder, filePath) => {
|
|
|
3498
3500
|
sheet.processDecoder(decoder);
|
|
3499
3501
|
try {
|
|
3500
3502
|
const css2 = sheet.toCss({ minify, optimize });
|
|
3501
|
-
ctx.hooks.callHook("parser:css", filePath ?? "", css2);
|
|
3502
3503
|
return css2;
|
|
3503
3504
|
} catch (err) {
|
|
3504
3505
|
logger.error("serializer:css", "Failed to serialize CSS: " + err);
|
|
@@ -3513,7 +3514,7 @@ function generateResetCss(ctx, sheet) {
|
|
|
3513
3514
|
const { preflight } = ctx.config;
|
|
3514
3515
|
const scope = isObject(preflight) ? preflight.scope : void 0;
|
|
3515
3516
|
const selector = scope ? `${scope} ` : "";
|
|
3516
|
-
|
|
3517
|
+
let output = css`
|
|
3517
3518
|
${selector}* {
|
|
3518
3519
|
margin: 0;
|
|
3519
3520
|
padding: 0;
|
|
@@ -3727,8 +3728,10 @@ function generateResetCss(ctx, sheet) {
|
|
|
3727
3728
|
outline: auto;
|
|
3728
3729
|
}
|
|
3729
3730
|
`;
|
|
3731
|
+
if (ctx.hooks["cssgen:done"]) {
|
|
3732
|
+
output = ctx.hooks["cssgen:done"]({ artifact: "reset", content: output }) ?? output;
|
|
3733
|
+
}
|
|
3730
3734
|
sheet.layers.reset.append(output);
|
|
3731
|
-
void ctx.hooks.callHook("generator:css", "reset.css", "");
|
|
3732
3735
|
}
|
|
3733
3736
|
|
|
3734
3737
|
// src/artifacts/css/static-css.ts
|
|
@@ -3737,9 +3740,11 @@ var generateStaticCss = (ctx, sheet) => {
|
|
|
3737
3740
|
const engine = staticCss.process(ctx.config.staticCss ?? {}, sheet);
|
|
3738
3741
|
if (!sheet) {
|
|
3739
3742
|
const { optimize = true, minify } = config;
|
|
3740
|
-
|
|
3741
|
-
|
|
3742
|
-
|
|
3743
|
+
let css2 = engine.sheet.toCss({ optimize, minify });
|
|
3744
|
+
if (ctx.hooks["cssgen:done"]) {
|
|
3745
|
+
css2 = ctx.hooks["cssgen:done"]({ artifact: "static", content: css2 }) ?? css2;
|
|
3746
|
+
}
|
|
3747
|
+
return css2;
|
|
3743
3748
|
}
|
|
3744
3749
|
};
|
|
3745
3750
|
|
|
@@ -3777,8 +3782,10 @@ function generateTokenCss(ctx, sheet) {
|
|
|
3777
3782
|
}
|
|
3778
3783
|
let css2 = results.join("\n\n");
|
|
3779
3784
|
css2 = "\n\n" + cleanupSelectors(css2, root);
|
|
3785
|
+
if (ctx.hooks["cssgen:done"]) {
|
|
3786
|
+
css2 = ctx.hooks["cssgen:done"]({ artifact: "tokens", content: css2 }) ?? css2;
|
|
3787
|
+
}
|
|
3780
3788
|
sheet.layers.tokens.append(css2);
|
|
3781
|
-
void ctx.hooks.callHook("generator:css", "tokens.css", "");
|
|
3782
3789
|
}
|
|
3783
3790
|
function getDeepestRule(root, selectors) {
|
|
3784
3791
|
const rule = postcss.rule({ selector: "" });
|
|
@@ -3856,15 +3863,19 @@ var Generator = class extends Context2 {
|
|
|
3856
3863
|
const decoder = this.decoder.collect(this.encoder);
|
|
3857
3864
|
sheet.processDecoder(decoder);
|
|
3858
3865
|
};
|
|
3859
|
-
getParserCss = (decoder
|
|
3860
|
-
return generateParserCss(this, decoder
|
|
3866
|
+
getParserCss = (decoder) => {
|
|
3867
|
+
return generateParserCss(this, decoder);
|
|
3861
3868
|
};
|
|
3862
3869
|
getCss = (stylesheet) => {
|
|
3863
3870
|
const sheet = stylesheet ?? this.createSheet();
|
|
3864
|
-
|
|
3871
|
+
let css2 = sheet.toCss({
|
|
3865
3872
|
optimize: true,
|
|
3866
3873
|
minify: this.config.minify
|
|
3867
3874
|
});
|
|
3875
|
+
if (this.hooks["cssgen:done"]) {
|
|
3876
|
+
css2 = this.hooks["cssgen:done"]({ artifact: "styles.css", content: css2 }) ?? css2;
|
|
3877
|
+
}
|
|
3878
|
+
return css2;
|
|
3868
3879
|
};
|
|
3869
3880
|
};
|
|
3870
3881
|
export {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pandacss/generator",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.28.0",
|
|
4
4
|
"description": "The css generator for css panda",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -37,16 +37,15 @@
|
|
|
37
37
|
"pluralize": "8.0.0",
|
|
38
38
|
"postcss": "^8.4.31",
|
|
39
39
|
"ts-pattern": "5.0.5",
|
|
40
|
-
"@pandacss/core": "0.
|
|
41
|
-
"@pandacss/is-valid-prop": "^0.
|
|
42
|
-
"@pandacss/logger": "0.
|
|
43
|
-
"@pandacss/shared": "0.
|
|
44
|
-
"@pandacss/token-dictionary": "0.
|
|
45
|
-
"@pandacss/types": "0.
|
|
40
|
+
"@pandacss/core": "0.28.0",
|
|
41
|
+
"@pandacss/is-valid-prop": "^0.28.0",
|
|
42
|
+
"@pandacss/logger": "0.28.0",
|
|
43
|
+
"@pandacss/shared": "0.28.0",
|
|
44
|
+
"@pandacss/token-dictionary": "0.28.0",
|
|
45
|
+
"@pandacss/types": "0.28.0"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@types/pluralize": "0.0.33"
|
|
49
|
-
"hookable": "5.5.3"
|
|
48
|
+
"@types/pluralize": "0.0.33"
|
|
50
49
|
},
|
|
51
50
|
"scripts": {
|
|
52
51
|
"build": "tsup src/index.ts --format=esm,cjs --dts",
|