@pandacss/generator 0.0.0-dev-20230814201731 → 0.0.0-dev-20230816155120

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 CHANGED
@@ -94,6 +94,10 @@ declare const getEngine: (conf: ConfigResultWithHooks) => {
94
94
  conditions: _pandacss_core.Conditions;
95
95
  createSheetContext: () => _pandacss_core.StylesheetContext;
96
96
  createSheet: (options?: Pick<_pandacss_core.StylesheetOptions, "content"> | undefined) => _pandacss_core.Stylesheet;
97
+ layers: _pandacss_types.CascadeLayers;
98
+ isValidLayerRule: (layerRule: string) => boolean;
99
+ layerString: string;
100
+ layerNames: string[];
97
101
  hooks: _pandacss_types.PandaHookable;
98
102
  path: string;
99
103
  config: _pandacss_types_dist_shared.UnwrapExtend<_pandacss_types.RequiredBy<_pandacss_types.Config, "outdir" | "cwd" | "include">>;
@@ -320,6 +324,10 @@ declare const createGenerator: (conf: ConfigResultWithHooks) => {
320
324
  conditions: _pandacss_core.Conditions;
321
325
  createSheetContext: () => _pandacss_core.StylesheetContext;
322
326
  createSheet: (options?: Pick<_pandacss_core.StylesheetOptions, "content"> | undefined) => _pandacss_core.Stylesheet;
327
+ layers: _pandacss_types.CascadeLayers;
328
+ isValidLayerRule: (layerRule: string) => boolean;
329
+ layerString: string;
330
+ layerNames: string[];
323
331
  hooks: _pandacss_types.PandaHookable;
324
332
  path: string;
325
333
  config: _pandacss_types_dist_shared.UnwrapExtend<_pandacss_types.RequiredBy<_pandacss_types.Config, "outdir" | "cwd" | "include">>;
package/dist/index.d.ts CHANGED
@@ -94,6 +94,10 @@ declare const getEngine: (conf: ConfigResultWithHooks) => {
94
94
  conditions: _pandacss_core.Conditions;
95
95
  createSheetContext: () => _pandacss_core.StylesheetContext;
96
96
  createSheet: (options?: Pick<_pandacss_core.StylesheetOptions, "content"> | undefined) => _pandacss_core.Stylesheet;
97
+ layers: _pandacss_types.CascadeLayers;
98
+ isValidLayerRule: (layerRule: string) => boolean;
99
+ layerString: string;
100
+ layerNames: string[];
97
101
  hooks: _pandacss_types.PandaHookable;
98
102
  path: string;
99
103
  config: _pandacss_types_dist_shared.UnwrapExtend<_pandacss_types.RequiredBy<_pandacss_types.Config, "outdir" | "cwd" | "include">>;
@@ -320,6 +324,10 @@ declare const createGenerator: (conf: ConfigResultWithHooks) => {
320
324
  conditions: _pandacss_core.Conditions;
321
325
  createSheetContext: () => _pandacss_core.StylesheetContext;
322
326
  createSheet: (options?: Pick<_pandacss_core.StylesheetOptions, "content"> | undefined) => _pandacss_core.Stylesheet;
327
+ layers: _pandacss_types.CascadeLayers;
328
+ isValidLayerRule: (layerRule: string) => boolean;
329
+ layerString: string;
330
+ layerNames: string[];
323
331
  hooks: _pandacss_types.PandaHookable;
324
332
  path: string;
325
333
  config: _pandacss_types_dist_shared.UnwrapExtend<_pandacss_types.RequiredBy<_pandacss_types.Config, "outdir" | "cwd" | "include">>;
package/dist/index.js CHANGED
@@ -206,7 +206,7 @@ function generateKeyframeCss(ctx) {
206
206
  var css = String.raw;
207
207
  function generateResetCss(ctx, scope = "") {
208
208
  const selector = scope ? `${scope} ` : "";
209
- const output = css`@layer reset {
209
+ const output = css`@layer ${ctx.layers.reset} {
210
210
  ${selector}* {
211
211
  margin: 0;
212
212
  padding: 0;
@@ -473,7 +473,7 @@ function generateTokenCss(ctx) {
473
473
  }
474
474
  }
475
475
  const css2 = results.join("\n\n");
476
- const output = `@layer tokens {
476
+ const output = `@layer ${ctx.layers.tokens} {
477
477
  ${(0, import_core3.prettifyCss)(cleanupSelectors(css2, root))}
478
478
  }
479
479
  `;
@@ -3351,7 +3351,7 @@ var generateFlattenedCss = (ctx) => (options) => {
3351
3351
  const { files, resolve } = options;
3352
3352
  const { theme: { keyframes } = {}, preflight, minify, staticCss } = ctx.config;
3353
3353
  const unresolved = [
3354
- "@layer reset, base, tokens, recipes, utilities;",
3354
+ ctx.layerString,
3355
3355
  preflight && "@import './reset.css';",
3356
3356
  "@import './global.css';",
3357
3357
  staticCss && "@import './static.css';",
@@ -3502,12 +3502,20 @@ var getBaseEngine = (conf) => {
3502
3502
  });
3503
3503
  const compositionContext = { conditions, utility };
3504
3504
  (0, import_core5.assignCompositions)(compositions, compositionContext);
3505
+ const layers = config.layers;
3506
+ const layerNames = Object.values(layers);
3507
+ const isValidLayerRule = (0, import_shared5.memo)((layerRule) => {
3508
+ const names = new Set(layerRule.split(",").map((name) => name.trim()));
3509
+ return names.size >= 5 && layerNames.every((name) => names.has(name));
3510
+ });
3511
+ const layerString = `@layer ${layerNames.join(", ")};`;
3505
3512
  const createSheetContext = () => ({
3506
3513
  root: import_postcss3.default.root(),
3507
3514
  conditions,
3508
3515
  utility,
3509
3516
  hash: hash.className,
3510
- helpers
3517
+ helpers,
3518
+ layers
3511
3519
  });
3512
3520
  const createSheet = (options) => {
3513
3521
  const sheetContext = createSheetContext();
@@ -3543,7 +3551,12 @@ var getBaseEngine = (conf) => {
3543
3551
  recipes,
3544
3552
  conditions,
3545
3553
  createSheetContext,
3546
- createSheet
3554
+ createSheet,
3555
+ // cascade layer
3556
+ layers,
3557
+ isValidLayerRule,
3558
+ layerString,
3559
+ layerNames
3547
3560
  };
3548
3561
  };
3549
3562
 
@@ -3652,7 +3665,15 @@ var defaults = (conf) => ({
3652
3665
  outExtension: "mjs",
3653
3666
  shorthands: true,
3654
3667
  syntax: "object-literal",
3655
- ...conf.config
3668
+ ...conf.config,
3669
+ layers: {
3670
+ reset: "reset",
3671
+ base: "base",
3672
+ tokens: "tokens",
3673
+ recipes: "recipes",
3674
+ utilities: "utilities",
3675
+ ...conf.config.layers
3676
+ }
3656
3677
  }
3657
3678
  });
3658
3679
  var getImportMap = (outdir) => ({
package/dist/index.mjs CHANGED
@@ -175,7 +175,7 @@ function generateKeyframeCss(ctx) {
175
175
  var css = String.raw;
176
176
  function generateResetCss(ctx, scope = "") {
177
177
  const selector = scope ? `${scope} ` : "";
178
- const output = css`@layer reset {
178
+ const output = css`@layer ${ctx.layers.reset} {
179
179
  ${selector}* {
180
180
  margin: 0;
181
181
  padding: 0;
@@ -442,7 +442,7 @@ function generateTokenCss(ctx) {
442
442
  }
443
443
  }
444
444
  const css2 = results.join("\n\n");
445
- const output = `@layer tokens {
445
+ const output = `@layer ${ctx.layers.tokens} {
446
446
  ${prettifyCss(cleanupSelectors(css2, root))}
447
447
  }
448
448
  `;
@@ -3320,7 +3320,7 @@ var generateFlattenedCss = (ctx) => (options) => {
3320
3320
  const { files, resolve } = options;
3321
3321
  const { theme: { keyframes } = {}, preflight, minify, staticCss } = ctx.config;
3322
3322
  const unresolved = [
3323
- "@layer reset, base, tokens, recipes, utilities;",
3323
+ ctx.layerString,
3324
3324
  preflight && "@import './reset.css';",
3325
3325
  "@import './global.css';",
3326
3326
  staticCss && "@import './static.css';",
@@ -3477,12 +3477,20 @@ var getBaseEngine = (conf) => {
3477
3477
  });
3478
3478
  const compositionContext = { conditions, utility };
3479
3479
  assignCompositions(compositions, compositionContext);
3480
+ const layers = config.layers;
3481
+ const layerNames = Object.values(layers);
3482
+ const isValidLayerRule = memo((layerRule) => {
3483
+ const names = new Set(layerRule.split(",").map((name) => name.trim()));
3484
+ return names.size >= 5 && layerNames.every((name) => names.has(name));
3485
+ });
3486
+ const layerString = `@layer ${layerNames.join(", ")};`;
3480
3487
  const createSheetContext = () => ({
3481
3488
  root: postcss3.root(),
3482
3489
  conditions,
3483
3490
  utility,
3484
3491
  hash: hash.className,
3485
- helpers
3492
+ helpers,
3493
+ layers
3486
3494
  });
3487
3495
  const createSheet = (options) => {
3488
3496
  const sheetContext = createSheetContext();
@@ -3518,7 +3526,12 @@ var getBaseEngine = (conf) => {
3518
3526
  recipes,
3519
3527
  conditions,
3520
3528
  createSheetContext,
3521
- createSheet
3529
+ createSheet,
3530
+ // cascade layer
3531
+ layers,
3532
+ isValidLayerRule,
3533
+ layerString,
3534
+ layerNames
3522
3535
  };
3523
3536
  };
3524
3537
 
@@ -3627,7 +3640,15 @@ var defaults = (conf) => ({
3627
3640
  outExtension: "mjs",
3628
3641
  shorthands: true,
3629
3642
  syntax: "object-literal",
3630
- ...conf.config
3643
+ ...conf.config,
3644
+ layers: {
3645
+ reset: "reset",
3646
+ base: "base",
3647
+ tokens: "tokens",
3648
+ recipes: "recipes",
3649
+ utilities: "utilities",
3650
+ ...conf.config.layers
3651
+ }
3631
3652
  }
3632
3653
  });
3633
3654
  var getImportMap = (outdir) => ({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/generator",
3
- "version": "0.0.0-dev-20230814201731",
3
+ "version": "0.0.0-dev-20230816155120",
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.27",
22
22
  "ts-pattern": "5.0.4",
23
- "@pandacss/core": "0.0.0-dev-20230814201731",
24
- "@pandacss/is-valid-prop": "0.0.0-dev-20230814201731",
25
- "@pandacss/logger": "0.0.0-dev-20230814201731",
26
- "@pandacss/shared": "0.0.0-dev-20230814201731",
27
- "@pandacss/token-dictionary": "0.0.0-dev-20230814201731",
28
- "@pandacss/types": "0.0.0-dev-20230814201731"
23
+ "@pandacss/core": "0.0.0-dev-20230816155120",
24
+ "@pandacss/is-valid-prop": "0.0.0-dev-20230816155120",
25
+ "@pandacss/logger": "0.0.0-dev-20230816155120",
26
+ "@pandacss/shared": "0.0.0-dev-20230816155120",
27
+ "@pandacss/token-dictionary": "0.0.0-dev-20230816155120",
28
+ "@pandacss/types": "0.0.0-dev-20230816155120"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@types/pluralize": "0.0.30",
32
32
  "hookable": "5.5.3",
33
- "@pandacss/fixture": "0.0.0-dev-20230814201731"
33
+ "@pandacss/fixture": "0.0.0-dev-20230816155120"
34
34
  },
35
35
  "scripts": {
36
36
  "prebuild": "tsx scripts/prebuild.ts",