vueless 0.0.727 → 0.0.729

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.
@@ -6,6 +6,7 @@ import {
6
6
  STRATEGY_TYPE,
7
7
  CVA_CONFIG_KEY,
8
8
  SYSTEM_CONFIG_KEY,
9
+ DEFAULT_BASE_CLASSES,
9
10
  EXTENDS_PATTERN_REG_EXP,
10
11
  NESTED_COMPONENT_PATTERN_REG_EXP,
11
12
  } from "../constants.js";
@@ -53,7 +54,6 @@ export default function useUI<T>(
53
54
 
54
55
  const firstClassKey = Object.keys(defaultConfig || {})[0];
55
56
  const config = ref({}) as Ref<ComponentConfigFull<T>>;
56
- const attrs = useAttrs();
57
57
 
58
58
  watchEffect(() => {
59
59
  const propsConfig = props.config as ComponentConfigFull<T>;
@@ -90,7 +90,7 @@ export default function useUI<T>(
90
90
  }
91
91
 
92
92
  if (key === (topLevelClassKey || firstClassKey)) {
93
- classes = cx([classes, attrs.class]);
93
+ classes = cx([DEFAULT_BASE_CLASSES, vuelessConfig.baseClasses, classes]);
94
94
  }
95
95
 
96
96
  classes = classes.replaceAll(EXTENDS_PATTERN_REG_EXP, "");
@@ -149,18 +149,21 @@ export default function useUI<T>(
149
149
 
150
150
  const commonAttrs: KeyAttrs = {
151
151
  ...(isTopLevelKey ? attrs : {}),
152
+ "data-vl-child": attrs["data-vl-child"] ? null : true,
152
153
  "vl-component": isDev ? attrs["vl-component"] || componentName || null : null,
153
154
  "vl-key": isDev ? attrs["vl-key"] || configKey || null : null,
154
155
  "vl-child-component": isDev && attrs["vl-component"] ? nestedComponent : null,
155
156
  "vl-child-key": isDev && attrs["vl-component"] ? configKey : null,
156
157
  };
157
158
 
159
+ const topLevelClasses = (!attrs["data-vl-child"] && commonAttrs.class) || "";
160
+
158
161
  /* Delete value key to prevent v-model overwrite. */
159
162
  delete commonAttrs.value;
160
163
 
161
164
  vuelessAttrs.value = {
162
165
  ...commonAttrs,
163
- class: cx([...extendsClasses, toValue(classes)]),
166
+ class: cx([...extendsClasses, toValue(classes), topLevelClasses]),
164
167
  config: getMergedConfig({
165
168
  defaultConfig: extendsKeyConfig,
166
169
  globalConfig: keyConfig,
package/constants.js CHANGED
@@ -23,6 +23,9 @@ export const OUTLINE_INCREMENT = 1; /* pixels */
23
23
  export const DEFAULT_ROUNDING = 8; /* pixels */
24
24
  export const ROUNDING_DECREMENT = 4; /* pixels */
25
25
  export const ROUNDING_INCREMENT = 6; /* pixels */
26
+ export const DEFAULT_BASE_CLASSES = `
27
+ text-gray-900 dark:text-gray-100
28
+ `;
26
29
 
27
30
  /* Vueless supported colors and shades */
28
31
  export const COLOR_SHADES = [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vueless",
3
- "version": "0.0.727",
3
+ "version": "0.0.729",
4
4
  "license": "MIT",
5
5
  "description": "Vue Styleless UI Component Library, powered by Tailwind CSS.",
6
6
  "keywords": [
package/types.ts CHANGED
@@ -124,6 +124,11 @@ export interface Config extends ThemeConfig {
124
124
  */
125
125
  strategy?: Strategies;
126
126
 
127
+ /**
128
+ * Classes which will be applied to the root element of all vueless components.
129
+ */
130
+ baseClasses?: string;
131
+
127
132
  /**
128
133
  * Component configs.
129
134
  */
@@ -305,11 +310,12 @@ export type KeyAttrsWithConfig<T> = {
305
310
  } & KeyAttrs;
306
311
 
307
312
  export interface KeyAttrs extends VueAttrs {
313
+ "data-vl-child"?: boolean | null;
308
314
  "vl-component"?: string | null;
309
315
  "vl-key"?: string | null;
310
316
  "vl-child-component"?: string | null;
311
317
  "vl-child-key"?: string | null;
312
- [key: string]: string | undefined | null;
318
+ [key: string]: string | boolean | undefined | null;
313
319
  }
314
320
 
315
321
  export interface VueAttrs {
@@ -2,7 +2,7 @@ export default /*tw*/ {
2
2
  wrapper: "group cursor-pointer",
3
3
  body: "",
4
4
  title: {
5
- base: "flex items-center justify-between font-medium text-gray-900",
5
+ base: "flex items-center justify-between font-medium",
6
6
  variants: {
7
7
  size: {
8
8
  sm: "text-sm",
@@ -31,7 +31,7 @@ export default /*tw*/ {
31
31
  },
32
32
  dragIcon: "{UIcon} {>dataListIcon} icon-drag cursor-move opacity-100",
33
33
  label: {
34
- base: "font-normal text-gray-900 flex-auto pt-px",
34
+ base: "font-normal flex-auto pt-px",
35
35
  variants: {
36
36
  size: {
37
37
  sm: "text-xs",
@@ -1,6 +1,6 @@
1
1
  export default /*tw*/ {
2
2
  wrapper: "relative w-full overflow-auto",
3
- headerCounterBase: "mr-1.5 pr-1.5 font-medium text-sm text-gray-900",
3
+ headerCounterBase: "mr-1.5 pr-1.5 font-medium text-sm",
4
4
  stickyHeader: {
5
5
  base: "fixed top-0 flex items-center z-30 overflow-hidden border rounded-none",
6
6
  variants: {
@@ -10,7 +10,7 @@ export default /*tw*/ {
10
10
  option: {
11
11
  base: `
12
12
  rounded-dynamic-sm px-2 py-2.5 flex items-center align-middle whitespace-nowrap cursor-pointer
13
- font-normal !leading-none text-gray-900
13
+ font-normal !leading-none
14
14
  hover:bg-{color}-600/5 active:bg-{color}-600/10
15
15
  overflow-hidden text-ellipsis
16
16
  `,
@@ -33,7 +33,7 @@ export default /*tw*/ {
33
33
  rightSlot: "pr-2.5 flex items-center",
34
34
  input: {
35
35
  base: `
36
- block w-full py-2 px-3 font-normal !leading-none text-gray-900 bg-transparent
36
+ block w-full py-2 px-3 font-normal !leading-none bg-transparent
37
37
  border-none rounded-inherit transition focus:ring-0
38
38
  placeholder:font-normal placeholder-gray-400
39
39
  disabled:text-gray-700 disabled:cursor-not-allowed
@@ -24,7 +24,7 @@ export default /*tw*/ {
24
24
  },
25
25
  content: "flex",
26
26
  label: {
27
- base: "text-gray-900 z-10 block !leading-none w-max transition",
27
+ base: "z-10 block !leading-none w-max transition",
28
28
  variants: {
29
29
  size: {
30
30
  sm: "text-xs",
@@ -42,7 +42,7 @@ export default /*tw*/ {
42
42
  selectedLabels: "flex flex-col col-span-2",
43
43
  selectedLabel: {
44
44
  base: `
45
- font-normal !leading-none text-gray-900 relative truncate
45
+ font-normal !leading-none relative truncate
46
46
  inline-flex items-center whitespace-nowrap mb-0 w-full
47
47
  `,
48
48
  variants: {
@@ -116,7 +116,7 @@ export default /*tw*/ {
116
116
  },
117
117
  searchInput: {
118
118
  base: `
119
- p-0 font-normal !leading-none text-gray-900 relative w-full border-none bg-transparent
119
+ p-0 font-normal !leading-none relative w-full border-none bg-transparent
120
120
  focus:shadow-none focus:outline-none focus:ring-0
121
121
  placeholder:text-gray-400 placeholder:font-normal
122
122
  `,
@@ -20,7 +20,7 @@ export default /*tw*/ {
20
20
  },
21
21
  textarea: {
22
22
  base: `
23
- px-3 pt-2 pb-1.5 block w-full bg-transparent border-none font-normal text-gray-900
23
+ px-3 pt-2 pb-1.5 block w-full bg-transparent border-none font-normal
24
24
  placeholder:text-gray-400 placeholder:font-normal placeholder:leading-none
25
25
  focus:ring-0 disabled:cursor-not-allowed
26
26
  `,
@@ -32,7 +32,7 @@ export default /*tw*/ {
32
32
  },
33
33
  },
34
34
  },
35
- stepperCount: "text-md font-bold text-gray-900 translate-y-2 transform",
35
+ stepperCount: "text-md font-bold translate-y-2 transform",
36
36
  indicator: {
37
37
  base: "text-{color}-600 flex justify-end w-full min-w-fit font-medium transition",
38
38
  variants: {