vueless 0.0.710 → 0.0.711

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/constants.js CHANGED
@@ -18,6 +18,8 @@ export const COLOR_MODE_KEY = "vl-color-mode";
18
18
  export const DEFAULT_BRAND_COLOR = GRAYSCALE_COLOR;
19
19
  export const DEFAULT_GRAY_COLOR = COOL_COLOR;
20
20
  export const DEFAULT_RING = 2; /* pixels */
21
+ export const RING_DECREMENT = 1; /* pixels */
22
+ export const RING_INCREMENT = 1; /* pixels */
21
23
  export const DEFAULT_RING_OFFSET_COLOR_LIGHT = "#ffffff"; // white
22
24
  export const DEFAULT_RING_OFFSET_COLOR_DARK = "#111827"; // gray-900
23
25
  export const DEFAULT_ROUNDING = 8; /* pixels */
@@ -171,7 +173,7 @@ export const TAILWIND_MERGE_EXTENSION = {
171
173
  spacing: ["safe-top", "safe-bottom", "safe-left", "safe-right"],
172
174
  },
173
175
  classGroups: {
174
- "ring-w": [{ ring: ["dynamic", "dynamic-1"] }],
176
+ "ring-w": [{ ring: ["dynamic", "dynamic-sm", "dynamic-lg"] }],
175
177
  "ring-offset-color": [{ "ring-offset": ["color-dynamic"] }],
176
178
  "font-size": [{ text: ["2xs"] }],
177
179
  rounded: [{ rounded: ["dynamic", "dynamic-sm", "dynamic-lg", "inherit"] }],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vueless",
3
- "version": "0.0.710",
3
+ "version": "0.0.711",
4
4
  "license": "MIT",
5
5
  "description": "Vue Styleless UI Component Library, powered by Tailwind CSS.",
6
6
  "keywords": [
@@ -17,6 +17,10 @@ import {
17
17
  DEFAULT_BRAND_COLOR,
18
18
  DEFAULT_GRAY_COLOR,
19
19
  GRAYSCALE_COLOR,
20
+ ROUNDING_DECREMENT,
21
+ ROUNDING_INCREMENT,
22
+ RING_INCREMENT,
23
+ RING_DECREMENT,
20
24
  } from "./constants.js";
21
25
 
22
26
  const globalSettings = process.env.VUELESS_GLOBAL_SETTINGS || {};
@@ -92,8 +96,9 @@ export const vuelessTailwindConfig = {
92
96
  "dynamic-lg": "var(--vl-rounding-lg)",
93
97
  },
94
98
  ringWidth: {
99
+ "dynamic-sm": "var(--vl-ring-sm)",
95
100
  dynamic: "var(--vl-ring)",
96
- "dynamic-1": "calc(var(--vl-ring) - 1px)",
101
+ "dynamic-lg": "var(--vl-ring-lg)",
97
102
  },
98
103
  ringOffsetColor: {
99
104
  dynamic: twColorWithOpacity("--vl-ring-offset-color"),
@@ -101,15 +106,17 @@ export const vuelessTailwindConfig = {
101
106
  },
102
107
  configViewer: {
103
108
  themeReplacements: {
104
- /* eslint-disable prettier/prettier */
109
+ /* eslint-disable prettier/prettier, vue/max-len */
110
+ "var(--vl-ring-sm)": globalSettings.ringSm || Math.max(0, (globalSettings.ring || DEFAULT_RING) - RING_DECREMENT),
105
111
  "var(--vl-ring)": globalSettings.ring || DEFAULT_RING,
112
+ "var(--vl-ring-lg)": globalSettings.ringLg || Math.max(0, (globalSettings.ring || DEFAULT_RING) + RING_INCREMENT),
106
113
  "var(--vl-ring-offset-color)": globalSettings.ringOffsetColorLight || DEFAULT_RING_OFFSET_COLOR_LIGHT,
107
- "var(--vl-rounding-sm)": globalSettings.roundingSm || (globalSettings.ring || DEFAULT_ROUNDING) / 2,
114
+ "var(--vl-rounding-sm)": globalSettings.roundingSm || Math.max(0, (globalSettings.rounding || DEFAULT_ROUNDING) - ROUNDING_DECREMENT),
108
115
  "var(--vl-rounding)": globalSettings.ring || DEFAULT_ROUNDING,
109
- "var(--vl-rounding-lg)": globalSettings.roundingLg || (globalSettings.ring || DEFAULT_ROUNDING) * 2,
116
+ "var(--vl-rounding-lg)": globalSettings.roundingLg || Math.max(0, (globalSettings.rounding || DEFAULT_ROUNDING) - ROUNDING_INCREMENT),
110
117
  ...getReplacementColors(GRAY_COLOR, globalSettings.gray || DEFAULT_GRAY_COLOR),
111
118
  ...getReplacementColors(BRAND_COLOR, globalSettings.brand || DEFAULT_BRAND_COLOR),
112
- /* eslint-enable prettier/prettier */
119
+ /* eslint-enable prettier/prettier, vue/max-len */
113
120
  },
114
121
  },
115
122
  },
package/types.ts CHANGED
@@ -81,7 +81,7 @@ export interface ThemeConfig {
81
81
  gray?: GrayColors;
82
82
 
83
83
  /**
84
- * Default components "sm" size rounding (border-radius).
84
+ * Default components small size rounding (border-radius).
85
85
  */
86
86
  roundingSm?: number;
87
87
 
@@ -91,15 +91,25 @@ export interface ThemeConfig {
91
91
  rounding?: number;
92
92
 
93
93
  /**
94
- * Default components "lg" size rounding (border-radius).
94
+ * Default components large size rounding (border-radius).
95
95
  */
96
96
  roundingLg?: number;
97
97
 
98
+ /**
99
+ * Default components small size ring width.
100
+ */
101
+ ringSm?: number;
102
+
98
103
  /**
99
104
  * Default components ring width.
100
105
  */
101
106
  ring?: number;
102
107
 
108
+ /**
109
+ * Default components large size ring width.
110
+ */
111
+ ringLg?: number;
112
+
103
113
  /**
104
114
  * Default components ring color for light theme.
105
115
  */
@@ -339,7 +349,9 @@ export interface TailwindColorShades {
339
349
  }
340
350
 
341
351
  export interface VuelessCssVariables {
352
+ "--vl-ring-sm": string;
342
353
  "--vl-ring": string;
354
+ "--vl-ring-lg": string;
343
355
  "--vl-ring-offset-color": string;
344
356
  "--vl-rounding-sm": string;
345
357
  "--vl-rounding": string;
@@ -4,7 +4,7 @@ export default /*tw*/ {
4
4
  base: `
5
5
  border rounded-dynamic border-gray-300 relative flex w-full bg-white transition
6
6
  hover:border-gray-400 hover:focus-within:border-brand-600 focus-within:border-brand-600
7
- focus-within:ring-dynamic-1 focus-within:ring-brand-600
7
+ focus-within:ring-dynamic-sm focus-within:ring-brand-600
8
8
  `,
9
9
  variants: {
10
10
  error: {
@@ -5,7 +5,7 @@ export default /*tw*/ {
5
5
  p-3 size-auto w-full bg-white transition
6
6
  rounded-dynamic border border-solid border-gray-300
7
7
  hover:border-gray-400 hover:focus-within:border-brand-600 focus-within:border-brand-600
8
- focus-within:ring-brand-600 focus-within:ring-dynamic-1
8
+ focus-within:ring-brand-600 focus-within:ring-dynamic-sm
9
9
  `,
10
10
  variants: {
11
11
  error: {
@@ -5,7 +5,7 @@ export default /*tw*/ {
5
5
  flex flex-row-reverse justify-between w-full min-h-full box-border relative
6
6
  rounded-dynamic border border-gray-300 bg-white
7
7
  hover:border-gray-400 hover:transition hover:focus-within:border-brand-600
8
- focus-within:ring-brand-600 focus-within:ring-dynamic-1
8
+ focus-within:ring-brand-600 focus-within:ring-dynamic-sm
9
9
  focus-within:border-brand-600 focus-within:outline-none
10
10
  `,
11
11
  variants: {
@@ -7,7 +7,7 @@ export default /*tw*/ {
7
7
  base: `
8
8
  flex bg-white transition w-full
9
9
  rounded-dynamic border border-gray-300 hover:border-gray-400 hover:focus-within:border-brand-600
10
- focus-within:border-brand-600 focus-within:ring-dynamic-1
10
+ focus-within:border-brand-600 focus-within:ring-dynamic-sm
11
11
  focus-within:ring-brand-600 focus-within:outline-none
12
12
  `,
13
13
  variants: {
package/utils/theme.ts CHANGED
@@ -10,12 +10,14 @@ import {
10
10
  DARK_MODE_SELECTOR,
11
11
  GRAYSCALE_COLOR,
12
12
  TAILWIND_COLORS,
13
- DEFAULT_RING,
14
- DEFAULT_ROUNDING,
15
13
  DEFAULT_BRAND_COLOR,
16
14
  DEFAULT_GRAY_COLOR,
15
+ DEFAULT_RING,
17
16
  DEFAULT_RING_OFFSET_COLOR_LIGHT,
18
17
  DEFAULT_RING_OFFSET_COLOR_DARK,
18
+ RING_DECREMENT,
19
+ RING_INCREMENT,
20
+ DEFAULT_ROUNDING,
19
21
  ROUNDING_DECREMENT,
20
22
  ROUNDING_INCREMENT,
21
23
  } from "../constants.js";
@@ -40,7 +42,9 @@ declare interface RootCSSVariableOptions {
40
42
  colors: Colors;
41
43
  brand: string;
42
44
  gray: string;
45
+ ringSm: number;
43
46
  ring: number;
47
+ ringLg: number;
44
48
  ringOffsetColorDark: string;
45
49
  ringOffsetColorLight: string;
46
50
  roundingSm: number;
@@ -155,7 +159,11 @@ export function setTheme(config: Config = {}) {
155
159
  let gray: GrayColors =
156
160
  config.gray ?? getSelectedGrayColor() ?? vuelessConfig.gray ?? DEFAULT_GRAY_COLOR;
157
161
 
158
- const ring = config.ring ?? vuelessConfig.ring ?? DEFAULT_RING;
162
+ const { ringSm, ring, ringLg } = getRings(
163
+ config.ringSm ?? vuelessConfig.ringSm,
164
+ config.ring ?? vuelessConfig.ring,
165
+ config.ringLg ?? vuelessConfig.ringLg,
166
+ );
159
167
 
160
168
  const ringOffsetColorDark =
161
169
  config.ringOffsetColorDark ??
@@ -198,7 +206,9 @@ export function setTheme(config: Config = {}) {
198
206
  colors,
199
207
  brand,
200
208
  gray,
209
+ ringSm,
201
210
  ring,
211
+ ringLg,
202
212
  ringOffsetColorDark,
203
213
  ringOffsetColorLight,
204
214
  roundingSm,
@@ -207,6 +217,22 @@ export function setTheme(config: Config = {}) {
207
217
  });
208
218
  }
209
219
 
220
+ function getRings(sm?: number, md?: number, lg?: number) {
221
+ const ring = Math.max(0, md ?? DEFAULT_RING);
222
+ const ringSm = Math.max(0, ring - RING_DECREMENT);
223
+ let ringLg = Math.max(0, ring + RING_INCREMENT);
224
+
225
+ if (ring === 0) {
226
+ ringLg = 0;
227
+ }
228
+
229
+ return {
230
+ ring,
231
+ ringSm: sm === undefined ? ringSm : Math.max(0, sm),
232
+ ringLg: lg === undefined ? ringLg : Math.max(0, lg),
233
+ };
234
+ }
235
+
210
236
  function getRoundings(sm?: number, md?: number, lg?: number) {
211
237
  const rounding = Math.max(0, md ?? DEFAULT_ROUNDING);
212
238
  let roundingSm = Math.max(0, rounding - ROUNDING_DECREMENT);
@@ -240,7 +266,9 @@ function setRootCSSVariables(options: RootCSSVariableOptions) {
240
266
  colors,
241
267
  brand,
242
268
  gray,
269
+ ringSm,
243
270
  ring,
271
+ ringLg,
244
272
  ringOffsetColorDark,
245
273
  ringOffsetColorLight,
246
274
  roundingSm,
@@ -257,7 +285,9 @@ function setRootCSSVariables(options: RootCSSVariableOptions) {
257
285
  "--vl-rounding-sm": `${Number(roundingSm) / PX_IN_REM}rem`,
258
286
  "--vl-rounding": `${Number(rounding) / PX_IN_REM}rem`,
259
287
  "--vl-rounding-lg": `${Number(roundingLg) / PX_IN_REM}rem`,
260
- "--vl-ring": `${Math.max(0, ring)}px`,
288
+ "--vl-ring-sm": `${ringSm}px`,
289
+ "--vl-ring": `${ring}px`,
290
+ "--vl-ring-lg": `${ringLg}px`,
261
291
  "--vl-ring-offset-color": convertHexInRgb(defaultRingOffsetColor),
262
292
  "--vl-color-gray-default": convertHexInRgb(colors[gray]?.[defaultBrandShade]),
263
293
  "--vl-color-brand-default": convertHexInRgb(colors[brand]?.[defaultGrayShade]),