@pandacss/generator 0.0.0-dev-20240122204655 → 0.0.0-dev-20240122224953
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 +24 -14
- package/dist/index.mjs +24 -14
- 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
|
@@ -3509,7 +3509,6 @@ var generateGlobalCss = (ctx, sheet) => {
|
|
|
3509
3509
|
}
|
|
3510
3510
|
});
|
|
3511
3511
|
sheet.processGlobalCss(globalCss);
|
|
3512
|
-
void ctx.hooks.callHook("generator:css", "global.css", "");
|
|
3513
3512
|
};
|
|
3514
3513
|
|
|
3515
3514
|
// src/artifacts/css/keyframe-css.ts
|
|
@@ -3520,14 +3519,16 @@ function generateKeyframeCss(ctx, sheet) {
|
|
|
3520
3519
|
for (const [name, definition] of Object.entries(keyframes)) {
|
|
3521
3520
|
result[`@keyframes ${name}`] = definition;
|
|
3522
3521
|
}
|
|
3523
|
-
|
|
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
|
+
}
|
|
3524
3526
|
sheet.layers.tokens.append(css2);
|
|
3525
|
-
void ctx.hooks.callHook("generator:css", "keyframes.css", "");
|
|
3526
3527
|
}
|
|
3527
3528
|
|
|
3528
3529
|
// src/artifacts/css/parser-css.ts
|
|
3529
3530
|
var import_logger = require("@pandacss/logger");
|
|
3530
|
-
var generateParserCss = (ctx, decoder
|
|
3531
|
+
var generateParserCss = (ctx, decoder) => {
|
|
3531
3532
|
if (!decoder)
|
|
3532
3533
|
return "";
|
|
3533
3534
|
const sheet = ctx.createSheet();
|
|
@@ -3535,7 +3536,6 @@ var generateParserCss = (ctx, decoder, filePath) => {
|
|
|
3535
3536
|
sheet.processDecoder(decoder);
|
|
3536
3537
|
try {
|
|
3537
3538
|
const css2 = sheet.toCss({ minify, optimize });
|
|
3538
|
-
ctx.hooks.callHook("parser:css", filePath ?? "", css2);
|
|
3539
3539
|
return css2;
|
|
3540
3540
|
} catch (err) {
|
|
3541
3541
|
import_logger.logger.error("serializer:css", "Failed to serialize CSS: " + err);
|
|
@@ -3550,7 +3550,7 @@ function generateResetCss(ctx, sheet) {
|
|
|
3550
3550
|
const { preflight } = ctx.config;
|
|
3551
3551
|
const scope = (0, import_shared4.isObject)(preflight) ? preflight.scope : void 0;
|
|
3552
3552
|
const selector = scope ? `${scope} ` : "";
|
|
3553
|
-
|
|
3553
|
+
let output = css`
|
|
3554
3554
|
${selector}* {
|
|
3555
3555
|
margin: 0;
|
|
3556
3556
|
padding: 0;
|
|
@@ -3764,8 +3764,10 @@ function generateResetCss(ctx, sheet) {
|
|
|
3764
3764
|
outline: auto;
|
|
3765
3765
|
}
|
|
3766
3766
|
`;
|
|
3767
|
+
if (ctx.hooks["cssgen:done"]) {
|
|
3768
|
+
output = ctx.hooks["cssgen:done"]({ artifact: "reset", content: output }) ?? output;
|
|
3769
|
+
}
|
|
3767
3770
|
sheet.layers.reset.append(output);
|
|
3768
|
-
void ctx.hooks.callHook("generator:css", "reset.css", "");
|
|
3769
3771
|
}
|
|
3770
3772
|
|
|
3771
3773
|
// src/artifacts/css/static-css.ts
|
|
@@ -3774,9 +3776,11 @@ var generateStaticCss = (ctx, sheet) => {
|
|
|
3774
3776
|
const engine = staticCss.process(ctx.config.staticCss ?? {}, sheet);
|
|
3775
3777
|
if (!sheet) {
|
|
3776
3778
|
const { optimize = true, minify } = config;
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
|
|
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;
|
|
3780
3784
|
}
|
|
3781
3785
|
};
|
|
3782
3786
|
|
|
@@ -3814,8 +3818,10 @@ function generateTokenCss(ctx, sheet) {
|
|
|
3814
3818
|
}
|
|
3815
3819
|
let css2 = results.join("\n\n");
|
|
3816
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
|
+
}
|
|
3817
3824
|
sheet.layers.tokens.append(css2);
|
|
3818
|
-
void ctx.hooks.callHook("generator:css", "tokens.css", "");
|
|
3819
3825
|
}
|
|
3820
3826
|
function getDeepestRule(root, selectors) {
|
|
3821
3827
|
const rule = import_postcss.default.rule({ selector: "" });
|
|
@@ -3893,15 +3899,19 @@ var Generator = class extends import_core4.Context {
|
|
|
3893
3899
|
const decoder = this.decoder.collect(this.encoder);
|
|
3894
3900
|
sheet.processDecoder(decoder);
|
|
3895
3901
|
};
|
|
3896
|
-
getParserCss = (decoder
|
|
3897
|
-
return generateParserCss(this, decoder
|
|
3902
|
+
getParserCss = (decoder) => {
|
|
3903
|
+
return generateParserCss(this, decoder);
|
|
3898
3904
|
};
|
|
3899
3905
|
getCss = (stylesheet) => {
|
|
3900
3906
|
const sheet = stylesheet ?? this.createSheet();
|
|
3901
|
-
|
|
3907
|
+
let css2 = sheet.toCss({
|
|
3902
3908
|
optimize: true,
|
|
3903
3909
|
minify: this.config.minify
|
|
3904
3910
|
});
|
|
3911
|
+
if (this.hooks["cssgen:done"]) {
|
|
3912
|
+
css2 = this.hooks["cssgen:done"]({ artifact: "styles.css", content: css2 }) ?? css2;
|
|
3913
|
+
}
|
|
3914
|
+
return css2;
|
|
3905
3915
|
};
|
|
3906
3916
|
};
|
|
3907
3917
|
// Annotate the CommonJS export names for ESM import in node:
|
package/dist/index.mjs
CHANGED
|
@@ -3473,7 +3473,6 @@ var generateGlobalCss = (ctx, sheet) => {
|
|
|
3473
3473
|
}
|
|
3474
3474
|
});
|
|
3475
3475
|
sheet.processGlobalCss(globalCss);
|
|
3476
|
-
void ctx.hooks.callHook("generator:css", "global.css", "");
|
|
3477
3476
|
};
|
|
3478
3477
|
|
|
3479
3478
|
// src/artifacts/css/keyframe-css.ts
|
|
@@ -3484,14 +3483,16 @@ function generateKeyframeCss(ctx, sheet) {
|
|
|
3484
3483
|
for (const [name, definition] of Object.entries(keyframes)) {
|
|
3485
3484
|
result[`@keyframes ${name}`] = definition;
|
|
3486
3485
|
}
|
|
3487
|
-
|
|
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
|
+
}
|
|
3488
3490
|
sheet.layers.tokens.append(css2);
|
|
3489
|
-
void ctx.hooks.callHook("generator:css", "keyframes.css", "");
|
|
3490
3491
|
}
|
|
3491
3492
|
|
|
3492
3493
|
// src/artifacts/css/parser-css.ts
|
|
3493
3494
|
import { logger } from "@pandacss/logger";
|
|
3494
|
-
var generateParserCss = (ctx, decoder
|
|
3495
|
+
var generateParserCss = (ctx, decoder) => {
|
|
3495
3496
|
if (!decoder)
|
|
3496
3497
|
return "";
|
|
3497
3498
|
const sheet = ctx.createSheet();
|
|
@@ -3499,7 +3500,6 @@ var generateParserCss = (ctx, decoder, filePath) => {
|
|
|
3499
3500
|
sheet.processDecoder(decoder);
|
|
3500
3501
|
try {
|
|
3501
3502
|
const css2 = sheet.toCss({ minify, optimize });
|
|
3502
|
-
ctx.hooks.callHook("parser:css", filePath ?? "", css2);
|
|
3503
3503
|
return css2;
|
|
3504
3504
|
} catch (err) {
|
|
3505
3505
|
logger.error("serializer:css", "Failed to serialize CSS: " + err);
|
|
@@ -3514,7 +3514,7 @@ function generateResetCss(ctx, sheet) {
|
|
|
3514
3514
|
const { preflight } = ctx.config;
|
|
3515
3515
|
const scope = isObject(preflight) ? preflight.scope : void 0;
|
|
3516
3516
|
const selector = scope ? `${scope} ` : "";
|
|
3517
|
-
|
|
3517
|
+
let output = css`
|
|
3518
3518
|
${selector}* {
|
|
3519
3519
|
margin: 0;
|
|
3520
3520
|
padding: 0;
|
|
@@ -3728,8 +3728,10 @@ function generateResetCss(ctx, sheet) {
|
|
|
3728
3728
|
outline: auto;
|
|
3729
3729
|
}
|
|
3730
3730
|
`;
|
|
3731
|
+
if (ctx.hooks["cssgen:done"]) {
|
|
3732
|
+
output = ctx.hooks["cssgen:done"]({ artifact: "reset", content: output }) ?? output;
|
|
3733
|
+
}
|
|
3731
3734
|
sheet.layers.reset.append(output);
|
|
3732
|
-
void ctx.hooks.callHook("generator:css", "reset.css", "");
|
|
3733
3735
|
}
|
|
3734
3736
|
|
|
3735
3737
|
// src/artifacts/css/static-css.ts
|
|
@@ -3738,9 +3740,11 @@ var generateStaticCss = (ctx, sheet) => {
|
|
|
3738
3740
|
const engine = staticCss.process(ctx.config.staticCss ?? {}, sheet);
|
|
3739
3741
|
if (!sheet) {
|
|
3740
3742
|
const { optimize = true, minify } = config;
|
|
3741
|
-
|
|
3742
|
-
|
|
3743
|
-
|
|
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;
|
|
3744
3748
|
}
|
|
3745
3749
|
};
|
|
3746
3750
|
|
|
@@ -3778,8 +3782,10 @@ function generateTokenCss(ctx, sheet) {
|
|
|
3778
3782
|
}
|
|
3779
3783
|
let css2 = results.join("\n\n");
|
|
3780
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
|
+
}
|
|
3781
3788
|
sheet.layers.tokens.append(css2);
|
|
3782
|
-
void ctx.hooks.callHook("generator:css", "tokens.css", "");
|
|
3783
3789
|
}
|
|
3784
3790
|
function getDeepestRule(root, selectors) {
|
|
3785
3791
|
const rule = postcss.rule({ selector: "" });
|
|
@@ -3857,15 +3863,19 @@ var Generator = class extends Context2 {
|
|
|
3857
3863
|
const decoder = this.decoder.collect(this.encoder);
|
|
3858
3864
|
sheet.processDecoder(decoder);
|
|
3859
3865
|
};
|
|
3860
|
-
getParserCss = (decoder
|
|
3861
|
-
return generateParserCss(this, decoder
|
|
3866
|
+
getParserCss = (decoder) => {
|
|
3867
|
+
return generateParserCss(this, decoder);
|
|
3862
3868
|
};
|
|
3863
3869
|
getCss = (stylesheet) => {
|
|
3864
3870
|
const sheet = stylesheet ?? this.createSheet();
|
|
3865
|
-
|
|
3871
|
+
let css2 = sheet.toCss({
|
|
3866
3872
|
optimize: true,
|
|
3867
3873
|
minify: this.config.minify
|
|
3868
3874
|
});
|
|
3875
|
+
if (this.hooks["cssgen:done"]) {
|
|
3876
|
+
css2 = this.hooks["cssgen:done"]({ artifact: "styles.css", content: css2 }) ?? css2;
|
|
3877
|
+
}
|
|
3878
|
+
return css2;
|
|
3869
3879
|
};
|
|
3870
3880
|
};
|
|
3871
3881
|
export {
|
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-20240122224953",
|
|
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.0.0-dev-
|
|
41
|
-
"@pandacss/is-valid-prop": "^0.0.0-dev-
|
|
42
|
-
"@pandacss/logger": "0.0.0-dev-
|
|
43
|
-
"@pandacss/shared": "0.0.0-dev-
|
|
44
|
-
"@pandacss/token-dictionary": "0.0.0-dev-
|
|
45
|
-
"@pandacss/types": "0.0.0-dev-
|
|
40
|
+
"@pandacss/core": "0.0.0-dev-20240122224953",
|
|
41
|
+
"@pandacss/is-valid-prop": "^0.0.0-dev-20240122224953",
|
|
42
|
+
"@pandacss/logger": "0.0.0-dev-20240122224953",
|
|
43
|
+
"@pandacss/shared": "0.0.0-dev-20240122224953",
|
|
44
|
+
"@pandacss/token-dictionary": "0.0.0-dev-20240122224953",
|
|
45
|
+
"@pandacss/types": "0.0.0-dev-20240122224953"
|
|
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",
|