@vaneui/ui 0.3.1-alpha.20250930162311.b66aed0 → 0.3.1-alpha.20250930203841.cec91ca

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
@@ -3712,6 +3712,64 @@ class ComponentTheme {
3712
3712
  }
3713
3713
  }
3714
3714
 
3715
+ class FontSizeTheme extends BaseTheme {
3716
+ constructor(customMapping) {
3717
+ super();
3718
+ /** Extra-small font size - text-xs (0.75rem = 6 * 0.125rem) */
3719
+ this.xs = "[--fs-unit:6]";
3720
+ /** Small font size - text-sm (0.875rem = 7 * 0.125rem) */
3721
+ this.sm = "[--fs-unit:7]";
3722
+ /** Medium font size - text-base (1rem = 8 * 0.125rem) */
3723
+ this.md = "[--fs-unit:8]";
3724
+ /** Large font size - text-lg (1.125rem = 9 * 0.125rem) */
3725
+ this.lg = "[--fs-unit:9]";
3726
+ /** Extra-large font size - text-xl (1.25rem = 10 * 0.125rem) */
3727
+ this.xl = "[--fs-unit:10]";
3728
+ if (customMapping) {
3729
+ this.xs = customMapping.xs || this.xs;
3730
+ this.sm = customMapping.sm || this.sm;
3731
+ this.md = customMapping.md || this.md;
3732
+ this.lg = customMapping.lg || this.lg;
3733
+ this.xl = customMapping.xl || this.xl;
3734
+ }
3735
+ }
3736
+ getClasses(extractedKeys) {
3737
+ if (extractedKeys === null || extractedKeys === void 0 ? void 0 : extractedKeys.size) {
3738
+ const fsUnitClass = this[extractedKeys.size];
3739
+ return fsUnitClass ? [fsUnitClass, "text-(--fs)"] : [];
3740
+ }
3741
+ return [this.md, "text-(--fs)"];
3742
+ }
3743
+ // Static factory methods for different text size ranges
3744
+ static createForPageTitle() {
3745
+ return new FontSizeTheme({
3746
+ xs: "[--fs-unit:15]", // text-3xl: 1.875rem = 15 * 0.125rem
3747
+ sm: "[--fs-unit:18]", // text-4xl: 2.25rem = 18 * 0.125rem
3748
+ md: "[--fs-unit:24]", // text-5xl: 3rem = 24 * 0.125rem
3749
+ lg: "[--fs-unit:30]", // text-6xl: 3.75rem = 30 * 0.125rem
3750
+ xl: "[--fs-unit:36]" // text-7xl: 4.5rem = 36 * 0.125rem
3751
+ });
3752
+ }
3753
+ static createForSectionTitle() {
3754
+ return new FontSizeTheme({
3755
+ xs: "[--fs-unit:12]", // text-2xl: 1.5rem = 12 * 0.125rem
3756
+ sm: "[--fs-unit:15]", // text-3xl: 1.875rem = 15 * 0.125rem
3757
+ md: "[--fs-unit:18]", // text-4xl: 2.25rem = 18 * 0.125rem
3758
+ lg: "[--fs-unit:24]", // text-5xl: 3rem = 24 * 0.125rem
3759
+ xl: "[--fs-unit:30]" // text-6xl: 3.75rem = 30 * 0.125rem
3760
+ });
3761
+ }
3762
+ static createForTitle() {
3763
+ return new FontSizeTheme({
3764
+ xs: "[--fs-unit:9]", // text-lg: 1.125rem = 9 * 0.125rem
3765
+ sm: "[--fs-unit:10]", // text-xl: 1.25rem = 10 * 0.125rem
3766
+ md: "[--fs-unit:12]", // text-2xl: 1.5rem = 12 * 0.125rem
3767
+ lg: "[--fs-unit:15]", // text-3xl: 1.875rem = 15 * 0.125rem
3768
+ xl: "[--fs-unit:18]" // text-4xl: 2.25rem = 18 * 0.125rem
3769
+ });
3770
+ }
3771
+ }
3772
+
3715
3773
  class SizeTheme extends BaseTheme {
3716
3774
  constructor(sizeMap, useDefaultKey = true) {
3717
3775
  super();
@@ -3726,13 +3784,24 @@ class SizeTheme extends BaseTheme {
3726
3784
  /** Extra-large size variant */
3727
3785
  this.xl = "";
3728
3786
  this.useDefaultKey = useDefaultKey;
3729
- ComponentKeys.size.forEach((key) => {
3730
- var _a;
3731
- this[key] = (_a = sizeMap === null || sizeMap === void 0 ? void 0 : sizeMap[key]) !== null && _a !== void 0 ? _a : "";
3732
- });
3787
+ if (sizeMap instanceof FontSizeTheme) {
3788
+ this.fontSizeTheme = sizeMap;
3789
+ ComponentKeys.size.forEach((key) => {
3790
+ this[key] = sizeMap[key];
3791
+ });
3792
+ }
3793
+ else {
3794
+ ComponentKeys.size.forEach((key) => {
3795
+ var _a;
3796
+ this[key] = (_a = sizeMap === null || sizeMap === void 0 ? void 0 : sizeMap[key]) !== null && _a !== void 0 ? _a : "";
3797
+ });
3798
+ }
3733
3799
  }
3734
3800
  getClasses(extractedKeys) {
3735
3801
  var _a;
3802
+ if (this.fontSizeTheme) {
3803
+ return this.fontSizeTheme.getClasses(extractedKeys);
3804
+ }
3736
3805
  const size = (_a = extractedKeys === null || extractedKeys === void 0 ? void 0 : extractedKeys.size) !== null && _a !== void 0 ? _a : (this.useDefaultKey ? 'md' : undefined);
3737
3806
  return size ? [this[size]] : [''];
3738
3807
  }
@@ -3811,11 +3880,11 @@ class RadiusTheme extends BaseTheme {
3811
3880
  }
3812
3881
  static createUITheme() {
3813
3882
  return new RadiusTheme({
3814
- xs: '[--br-unit:1]',
3815
- sm: '[--br-unit:2]',
3816
- md: '[--br-unit:3]',
3817
- lg: '[--br-unit:4]',
3818
- xl: '[--br-unit:5]'
3883
+ xs: '[--br-unit:2]',
3884
+ sm: '[--br-unit:3]',
3885
+ md: '[--br-unit:4]',
3886
+ lg: '[--br-unit:5]',
3887
+ xl: '[--br-unit:6]'
3819
3888
  }, true);
3820
3889
  }
3821
3890
  static createLayoutTheme() {
@@ -4095,13 +4164,6 @@ const textAppearanceClasses = {
4095
4164
  info: "text-(--color-text-info)",
4096
4165
  transparent: "text-transparent",
4097
4166
  };
4098
- const textSizeClasses = {
4099
- xs: "text-xs",
4100
- sm: "text-sm",
4101
- md: "text-base",
4102
- lg: "text-lg",
4103
- xl: "text-xl",
4104
- };
4105
4167
 
4106
4168
  const filledBackgroundAppearanceClasses = {
4107
4169
  default: "bg-(--color-bg-filled-default)",
@@ -5113,13 +5175,13 @@ class ListStyleTheme extends BaseTheme {
5113
5175
  }
5114
5176
  }
5115
5177
 
5116
- const createTypographyComponentTheme = (tag, base = "text-balance", textSizeMap = textSizeClasses, defaults = {}, lineHeightTheme) => {
5178
+ const createTypographyComponentTheme = (tag, base = "text-balance", fontSizeTheme = new FontSizeTheme(), defaults = {}, lineHeightTheme) => {
5117
5179
  const typographyThemes = lineHeightTheme
5118
5180
  ? { ...defaultTypographyThemes, lineHeight: lineHeightTheme }
5119
5181
  : defaultTypographyThemes;
5120
5182
  return new ComponentTheme(tag, base, {
5121
5183
  size: {
5122
- text: new SizeTheme(textSizeMap),
5184
+ text: fontSizeTheme,
5123
5185
  },
5124
5186
  appearance: {
5125
5187
  text: GenericVariantTheme.createTypographyTextTheme(),
@@ -5132,29 +5194,17 @@ const createTypographyComponentTheme = (tag, base = "text-balance", textSizeMap
5132
5194
  });
5133
5195
  };
5134
5196
  // Page title specific theme
5135
- const pageTitleTheme = createTypographyComponentTheme("h1", "text-balance tracking-tight w-fit", {
5136
- xs: "text-3xl max-lg:text-2xl max-md:text-xl",
5137
- sm: "text-4xl max-lg:text-3xl max-md:text-2xl",
5138
- md: "text-5xl max-lg:text-4xl max-md:text-3xl",
5139
- lg: "text-6xl max-lg:text-5xl max-md:text-4xl",
5140
- xl: "text-7xl max-lg:text-6xl max-md:text-5xl"
5141
- }, mergeDefaults(themeDefaults.pageTitle, { semibold: true }), LineHeightTheme.createForPageTitle());
5197
+ const pageTitleTheme = createTypographyComponentTheme("h1", "text-balance tracking-tight w-fit", FontSizeTheme.createForPageTitle(), mergeDefaults(themeDefaults.pageTitle, { semibold: true }), LineHeightTheme.createForPageTitle());
5142
5198
  // Section title specific theme
5143
- const sectionTitleTheme = createTypographyComponentTheme("h2", "text-balance w-fit", {
5144
- xs: "text-2xl max-lg:text-xl max-md:text-lg",
5145
- sm: "text-3xl max-lg:text-2xl max-md:text-xl",
5146
- md: "text-4xl max-lg:text-3xl max-md:text-2xl",
5147
- lg: "text-5xl max-lg:text-4xl max-md:text-3xl",
5148
- xl: "text-6xl max-lg:text-5xl max-md:text-4xl"
5149
- }, mergeDefaults(themeDefaults.sectionTitle, { semibold: true }), LineHeightTheme.createForSectionTitle());
5199
+ const sectionTitleTheme = createTypographyComponentTheme("h2", "text-balance w-fit", FontSizeTheme.createForSectionTitle(), mergeDefaults(themeDefaults.sectionTitle, { semibold: true }), LineHeightTheme.createForSectionTitle());
5150
5200
  // Title specific theme
5151
- const titleTheme = createTypographyComponentTheme("h3", "text-balance w-fit", { xs: "text-lg", sm: "text-xl", md: "text-2xl", lg: "text-3xl", xl: "text-4xl" }, mergeDefaults(themeDefaults.title, { semibold: true }), LineHeightTheme.createForTitle());
5201
+ const titleTheme = createTypographyComponentTheme("h3", "text-balance w-fit", FontSizeTheme.createForTitle(), mergeDefaults(themeDefaults.title, { semibold: true }), LineHeightTheme.createForTitle());
5152
5202
  // Text specific theme
5153
- const textTheme = createTypographyComponentTheme("p", "p-0 m-0 w-fit", textSizeClasses, themeDefaults.text);
5203
+ const textTheme = createTypographyComponentTheme("p", "p-0 m-0 w-fit", new FontSizeTheme(), themeDefaults.text);
5154
5204
  // Link specific theme
5155
5205
  const linkTheme = new ComponentTheme("a", "hover:underline w-fit cursor-pointer", {
5156
5206
  size: {
5157
- text: new SizeTheme(textSizeClasses, false),
5207
+ text: new FontSizeTheme(),
5158
5208
  },
5159
5209
  appearance: {
5160
5210
  text: GenericVariantTheme.createTypographyTextTheme(),
@@ -5165,7 +5215,7 @@ const linkTheme = new ComponentTheme("a", "hover:underline w-fit cursor-pointer"
5165
5215
  // List specific theme
5166
5216
  const listItemTheme = new ComponentTheme("li", "", {
5167
5217
  size: {
5168
- text: new SizeTheme(textSizeClasses, false),
5218
+ text: new FontSizeTheme(),
5169
5219
  },
5170
5220
  appearance: {
5171
5221
  text: GenericVariantTheme.createTypographyTextTheme(),
@@ -5176,7 +5226,7 @@ const listItemTheme = new ComponentTheme("li", "", {
5176
5226
  // List specific theme
5177
5227
  const listTheme = new ComponentTheme("ul", "list-inside", {
5178
5228
  size: {
5179
- text: new SizeTheme(textSizeClasses),
5229
+ text: new FontSizeTheme(),
5180
5230
  paddingLeft: new PlTheme(),
5181
5231
  },
5182
5232
  appearance: {
@@ -5405,7 +5455,7 @@ const defaultCheckboxTheme = new ComponentTheme("input", "peer col-start-1 row-s
5405
5455
  lg: 'h-4.5 w-4.5',
5406
5456
  xl: 'h-5 w-5'
5407
5457
  }),
5408
- text: new SizeTheme(textSizeClasses)
5458
+ text: new FontSizeTheme()
5409
5459
  },
5410
5460
  layout: {
5411
5461
  ...defaultLayoutsThemes,
@@ -5457,7 +5507,7 @@ const defaultCheckboxWrapperTheme = new ComponentTheme("span", "", {
5457
5507
 
5458
5508
  const defaultLabelTheme = new ComponentTheme("label", "has-[input]:cursor-pointer cursor-default", {
5459
5509
  size: {
5460
- text: new SizeTheme(textSizeClasses),
5510
+ text: new FontSizeTheme(),
5461
5511
  gap: new GapTheme(true),
5462
5512
  },
5463
5513
  appearance: {