@vaneui/ui 0.3.1-alpha.20251110140105.0a5a63e → 0.3.1-alpha.20251110155311.4ef4158

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
@@ -3766,42 +3766,10 @@ class LineHeightTheme extends BaseTheme {
3766
3766
  }
3767
3767
  }
3768
3768
 
3769
- // Reusable layout classes used by multiple components
3770
- const layoutGapClasses = {
3771
- xs: "[--gap-unit:2]",
3772
- sm: "[--gap-unit:3]",
3773
- md: "[--gap-unit:4]",
3774
- lg: "[--gap-unit:5]",
3775
- xl: "[--gap-unit:6]",
3776
- };
3777
- const layoutPaddingClasses = {
3778
- xs: "[--py-unit:2]",
3779
- sm: "[--py-unit:3]",
3780
- md: "[--py-unit:4]",
3781
- lg: "[--py-unit:5]",
3782
- xl: "[--py-unit:6]",
3783
- };
3784
- // Reusable UI component classes used by multiple components
3785
- const uiPaddingClasses = {
3786
- xs: "[--py-unit:1]",
3787
- sm: "[--py-unit:1.5]",
3788
- md: "[--py-unit:2]",
3789
- lg: "[--py-unit:2.5]",
3790
- xl: "[--py-unit:3]",
3791
- };
3792
- const uiGapClasses = {
3793
- xs: "[--gap-unit:1]",
3794
- sm: "[--gap-unit:1.5]",
3795
- md: "[--gap-unit:2]",
3796
- lg: "[--gap-unit:2.5]",
3797
- xl: "[--gap-unit:3]",
3798
- };
3799
-
3800
3769
  class GapTheme extends BaseTheme {
3801
- constructor(isUIComponent = false) {
3770
+ constructor(gapClasses, isUIComponent = false) {
3802
3771
  super();
3803
3772
  this.gapVarClass = isUIComponent ? "gap-(--ui-gap)" : "gap-(--gap)";
3804
- const gapClasses = isUIComponent ? uiGapClasses : layoutGapClasses;
3805
3773
  this.xs = gapClasses.xs;
3806
3774
  this.sm = gapClasses.sm;
3807
3775
  this.md = gapClasses.md;
@@ -3816,6 +3784,24 @@ class GapTheme extends BaseTheme {
3816
3784
  }
3817
3785
  return [];
3818
3786
  }
3787
+ static createForUI() {
3788
+ return new GapTheme({
3789
+ xs: "[--gap-unit:1]",
3790
+ sm: "[--gap-unit:1.5]",
3791
+ md: "[--gap-unit:2]",
3792
+ lg: "[--gap-unit:2.5]",
3793
+ xl: "[--gap-unit:3]",
3794
+ }, true);
3795
+ }
3796
+ static createForLayout() {
3797
+ return new GapTheme({
3798
+ xs: "[--gap-unit:2]",
3799
+ sm: "[--gap-unit:3]",
3800
+ md: "[--gap-unit:4]",
3801
+ lg: "[--gap-unit:5]",
3802
+ xl: "[--gap-unit:6]",
3803
+ }, false);
3804
+ }
3819
3805
  }
3820
3806
 
3821
3807
  class RadiusTheme extends BaseTheme {
@@ -3857,22 +3843,25 @@ class RadiusTheme extends BaseTheme {
3857
3843
  return new RadiusTheme(brUnitClasses, false);
3858
3844
  }
3859
3845
  getClasses(extractedKeys) {
3860
- var _a, _b;
3846
+ var _a;
3861
3847
  const size = (_a = extractedKeys.size) !== null && _a !== void 0 ? _a : 'md';
3862
- const shape = (_b = extractedKeys.shape) !== null && _b !== void 0 ? _b : 'rounded';
3863
- switch (shape) {
3864
- case 'pill':
3865
- return [this.pill];
3866
- case 'sharp':
3867
- return [this.sharp];
3868
- case 'rounded': {
3869
- const brUnitClass = this.rounded[size];
3870
- const roundedVar = this.isUIComponent ? "rounded-(--ui-br)" : "rounded-(--br)";
3871
- return brUnitClass ? [brUnitClass, roundedVar] : [];
3848
+ const shape = extractedKeys.shape;
3849
+ if (shape) {
3850
+ switch (shape) {
3851
+ case 'pill':
3852
+ return [this.pill];
3853
+ case 'sharp':
3854
+ return [this.sharp];
3855
+ case 'rounded': {
3856
+ const brUnitClass = this.rounded[size];
3857
+ const roundedVar = this.isUIComponent ? "rounded-(--ui-br)" : "rounded-(--br)";
3858
+ return brUnitClass ? [brUnitClass, roundedVar] : [];
3859
+ }
3860
+ default:
3861
+ return [];
3872
3862
  }
3873
- default:
3874
- return [];
3875
3863
  }
3864
+ return [];
3876
3865
  }
3877
3866
  }
3878
3867
 
@@ -3987,7 +3976,13 @@ class PaddingTheme extends BaseTheme {
3987
3976
  class PxTheme extends PaddingTheme {
3988
3977
  constructor(aspectRatio, isUIComponent = false) {
3989
3978
  super();
3990
- this.aspectRatioMap = aspectRatio;
3979
+ this.aspectRatioMap = aspectRatio ? aspectRatio : {
3980
+ xs: "[--aspect-ratio:1]",
3981
+ sm: "[--aspect-ratio:1]",
3982
+ md: "[--aspect-ratio:1]",
3983
+ lg: "[--aspect-ratio:1]",
3984
+ xl: "[--aspect-ratio:1]",
3985
+ };
3991
3986
  this.isUIComponent = isUIComponent;
3992
3987
  // PxTheme should not set any padding classes - that's PyTheme's job
3993
3988
  // PxTheme only handles aspect-ratio
@@ -4018,7 +4013,13 @@ class PyTheme extends PaddingTheme {
4018
4013
  // Override with PyTheme's default classes if no custom sizeMap provided
4019
4014
  if (!sizeMap) {
4020
4015
  ComponentKeys.size.forEach((key) => {
4021
- this[key] = layoutPaddingClasses[key];
4016
+ this[key] = {
4017
+ xs: "[--py-unit:2]",
4018
+ sm: "[--py-unit:3]",
4019
+ md: "[--py-unit:4]",
4020
+ lg: "[--py-unit:5]",
4021
+ xl: "[--py-unit:6]",
4022
+ }[key];
4022
4023
  });
4023
4024
  }
4024
4025
  }
@@ -4034,6 +4035,15 @@ class PyTheme extends PaddingTheme {
4034
4035
  }
4035
4036
  return [];
4036
4037
  }
4038
+ static createForUI() {
4039
+ return new PyTheme({
4040
+ xs: "[--py-unit:1]",
4041
+ sm: "[--py-unit:1.5]",
4042
+ md: "[--py-unit:2]",
4043
+ lg: "[--py-unit:2.5]",
4044
+ xl: "[--py-unit:3]",
4045
+ }, true);
4046
+ }
4037
4047
  }
4038
4048
 
4039
4049
  class AppearanceTheme extends BaseTheme {
@@ -4695,7 +4705,6 @@ const themeDefaults = {
4695
4705
  md: true,
4696
4706
  itemsCenter: true,
4697
4707
  gap: true,
4698
- sharp: true,
4699
4708
  },
4700
4709
  section: {
4701
4710
  md: true,
@@ -4708,7 +4717,6 @@ const themeDefaults = {
4708
4717
  noBorder: true,
4709
4718
  noRing: true,
4710
4719
  noShadow: true,
4711
- sharp: true,
4712
4720
  },
4713
4721
  stack: {
4714
4722
  md: true,
@@ -4719,7 +4727,6 @@ const themeDefaults = {
4719
4727
  padding: true,
4720
4728
  noBorder: true,
4721
4729
  noRing: true,
4722
- sharp: true,
4723
4730
  },
4724
4731
  row: {
4725
4732
  row: true,
@@ -4729,7 +4736,6 @@ const themeDefaults = {
4729
4736
  gap: true,
4730
4737
  noBorder: true,
4731
4738
  noRing: true,
4732
- sharp: true,
4733
4739
  },
4734
4740
  col: {
4735
4741
  column: true,
@@ -4738,7 +4744,6 @@ const themeDefaults = {
4738
4744
  gap: true,
4739
4745
  noBorder: true,
4740
4746
  noRing: true,
4741
- sharp: true,
4742
4747
  },
4743
4748
  grid2: {
4744
4749
  md: true,
@@ -4876,8 +4881,8 @@ const buttonAspectRatioClasses = {
4876
4881
  const defaultButtonTheme = new ComponentTheme("button", "w-fit h-fit cursor-pointer transition-all duration-200 whitespace-nowrap", {
4877
4882
  size: {
4878
4883
  px: new PxTheme(buttonAspectRatioClasses, true),
4879
- py: new PyTheme(uiPaddingClasses, true),
4880
- gap: new GapTheme(true),
4884
+ py: PyTheme.createForUI(),
4885
+ gap: GapTheme.createForUI(),
4881
4886
  text: new FontSizeTheme(),
4882
4887
  lineHeight: new LineHeightTheme({
4883
4888
  xs: "[--lh:1.3]",
@@ -4921,8 +4926,8 @@ const badgeAspectRatioClasses = {
4921
4926
  const defaultBadgeTheme = new ComponentTheme("span", "w-fit h-fit transition-all duration-200 whitespace-nowrap", {
4922
4927
  size: {
4923
4928
  px: new PxTheme(badgeAspectRatioClasses, true),
4924
- py: new PyTheme(uiPaddingClasses, true),
4925
- gap: new GapTheme(true),
4929
+ py: PyTheme.createForUI(),
4930
+ gap: GapTheme.createForUI(),
4926
4931
  text: new FontSizeTheme(),
4927
4932
  lineHeight: LineHeightTheme.createDefault()
4928
4933
  },
@@ -4972,7 +4977,7 @@ const defaultChipTheme = new ComponentTheme("span", "w-fit h-fit transition-all
4972
4977
  lg: "[--lh:1.2]",
4973
4978
  xl: "[--lh:1.2]"
4974
4979
  }),
4975
- gap: new GapTheme(true)
4980
+ gap: GapTheme.createForUI()
4976
4981
  },
4977
4982
  appearance: {
4978
4983
  background: GenericVariantTheme.createSimpleUIElementBgAppearanceTheme(),
@@ -5020,7 +5025,7 @@ const defaultCodeTheme = new ComponentTheme("code", "", {
5020
5025
  lg: "[--lh:1.2]",
5021
5026
  xl: "[--lh:1.2]"
5022
5027
  }),
5023
- gap: new GapTheme(true)
5028
+ gap: GapTheme.createForUI()
5024
5029
  },
5025
5030
  appearance: {
5026
5031
  background: GenericVariantTheme.createSimpleUIElementBgAppearanceTheme(),
@@ -5252,7 +5257,7 @@ const defaultCardTheme = new ComponentTheme("div", "", {
5252
5257
  xl: "[--py-unit:10]",
5253
5258
  }),
5254
5259
  lineHeight: LineHeightTheme.createDefault(),
5255
- gap: new GapTheme(false),
5260
+ gap: GapTheme.createForLayout(),
5256
5261
  },
5257
5262
  layout: {
5258
5263
  ...defaultLayoutsThemes,
@@ -5275,7 +5280,7 @@ const defaultCardTheme = new ComponentTheme("div", "", {
5275
5280
 
5276
5281
  const defaultRowTheme = new ComponentTheme("div", "", {
5277
5282
  size: {
5278
- gap: new GapTheme(),
5283
+ gap: GapTheme.createForLayout(),
5279
5284
  breakpoint: new BreakpointTheme(),
5280
5285
  },
5281
5286
  layout: {
@@ -5334,7 +5339,7 @@ class SizeTheme extends BaseTheme {
5334
5339
 
5335
5340
  const defaultContainerTheme = new ComponentTheme("div", "mx-auto w-full", {
5336
5341
  size: {
5337
- gap: new GapTheme(),
5342
+ gap: GapTheme.createForLayout(),
5338
5343
  maxWidth: new SizeTheme({ xs: 'max-w-3xl', sm: 'max-w-4xl', md: 'max-w-5xl', lg: 'max-w-6xl', xl: 'max-w-7xl' }),
5339
5344
  },
5340
5345
  layout: {
@@ -5356,7 +5361,7 @@ const defaultContainerTheme = new ComponentTheme("div", "mx-auto w-full", {
5356
5361
 
5357
5362
  const defaultColTheme = new ComponentTheme("div", "", {
5358
5363
  size: {
5359
- gap: new GapTheme(),
5364
+ gap: GapTheme.createForLayout(),
5360
5365
  },
5361
5366
  layout: {
5362
5367
  ...defaultLayoutsThemes,
@@ -5377,9 +5382,15 @@ const defaultColTheme = new ComponentTheme("div", "", {
5377
5382
 
5378
5383
  const defaultStackTheme = new ComponentTheme("div", "", {
5379
5384
  size: {
5380
- px: new PxTheme(),
5385
+ px: new PxTheme({
5386
+ xs: "[--aspect-ratio:1]",
5387
+ sm: "[--aspect-ratio:1]",
5388
+ md: "[--aspect-ratio:1]",
5389
+ lg: "[--aspect-ratio:1]",
5390
+ xl: "[--aspect-ratio:1]",
5391
+ }),
5381
5392
  py: new PyTheme(),
5382
- gap: new GapTheme(),
5393
+ gap: GapTheme.createForLayout(),
5383
5394
  breakpoint: new BreakpointTheme(),
5384
5395
  },
5385
5396
  layout: {
@@ -5415,7 +5426,13 @@ const defaultSectionTheme = new ComponentTheme("div", "w-full", {
5415
5426
  lg: "[--py-unit:16] max-laptop:[--py-unit:8] max-tablet:[--py-unit:2]",
5416
5427
  xl: "[--py-unit:20] max-laptop:[--py-unit:10] max-tablet:[--py-unit:4]",
5417
5428
  }),
5418
- gap: new GapTheme(),
5429
+ gap: new GapTheme({
5430
+ xs: "[--gap-unit:4] max-laptop:[--gap-unit:3] max-tablet:[--gap-unit:2]",
5431
+ sm: "[--gap-unit:6] max-laptop:[--gap-unit:5] max-tablet:[--gap-unit:4]",
5432
+ md: "[--gap-unit:8] max-laptop:[--gap-unit:6] max-tablet:[--gap-unit:4]",
5433
+ lg: "[--gap-unit:10] max-laptop:[--gap-unit:8] max-tablet:[--gap-unit:6]",
5434
+ xl: "[--gap-unit:12] max-laptop:[--gap-unit:10] max-tablet:[--gap-unit:8]",
5435
+ }),
5419
5436
  breakpoint: new BreakpointTheme(),
5420
5437
  },
5421
5438
  appearance: {
@@ -5437,7 +5454,7 @@ const defaultSectionTheme = new ComponentTheme("div", "w-full", {
5437
5454
 
5438
5455
  const gridSubThemes = {
5439
5456
  size: {
5440
- gap: new GapTheme(),
5457
+ gap: GapTheme.createForLayout(),
5441
5458
  },
5442
5459
  appearance: {
5443
5460
  background: GenericVariantTheme.createLayoutBgAppearanceTheme(),
@@ -5519,7 +5536,7 @@ const defaultLabelTheme = new ComponentTheme("label", "has-[input]:cursor-pointe
5519
5536
  size: {
5520
5537
  text: new FontSizeTheme(),
5521
5538
  lineHeight: LineHeightTheme.createDefault(),
5522
- gap: new GapTheme(true),
5539
+ gap: GapTheme.createForUI(),
5523
5540
  },
5524
5541
  appearance: {
5525
5542
  text: GenericVariantTheme.createTypographyTextTheme(),
@@ -5559,8 +5576,8 @@ const defaultInputTheme = new ComponentTheme("input", "w-full transition-all dur
5559
5576
  lg: "[--aspect-ratio:2]",
5560
5577
  xl: "[--aspect-ratio:2]",
5561
5578
  }, true),
5562
- py: new PyTheme(uiPaddingClasses, true),
5563
- gap: new GapTheme(true),
5579
+ py: PyTheme.createForUI(),
5580
+ gap: GapTheme.createForUI(),
5564
5581
  text: new FontSizeTheme(),
5565
5582
  lineHeight: LineHeightTheme.createDefault(),
5566
5583
  },