vueless 0.0.478-beta.3 → 0.0.479
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/composables/useBreakpoint.js +1 -1
- package/composables/useUI.js +1 -204
- package/constants.js +1 -2
- package/directives/clickOutside/vClickOutside.js +2 -2
- package/directives/tooltip/storybook/stories.js +5 -5
- package/{index.ts → index.js} +7 -10
- package/package.json +18 -28
- package/preset.tailwind.js +7 -16
- package/ui.button/config.js +0 -12
- package/ui.button/storybook/stories.js +2 -2
- package/ui.button-link/ULink.vue +1 -1
- package/ui.button-link/config.js +0 -9
- package/ui.button-link/storybook/stories.js +1 -1
- package/ui.button-toggle/storybook/stories.js +1 -1
- package/ui.container-divider/storybook/stories.js +1 -1
- package/ui.container-modal/storybook/stories.js +1 -1
- package/ui.container-modal-confirm/storybook/stories.js +1 -1
- package/ui.container-row/storybook/stories.js +1 -1
- package/ui.data-list/UDataList.vue +4 -4
- package/ui.data-table/UTable.vue +1 -1
- package/ui.dropdown-badge/config.js +0 -1
- package/ui.dropdown-badge/storybook/stories.js +1 -1
- package/ui.dropdown-button/config.js +0 -1
- package/ui.dropdown-button/storybook/stories.js +2 -2
- package/ui.dropdown-link/storybook/stories.js +1 -1
- package/ui.dropdown-list/storybook/stories.js +1 -1
- package/ui.form-checkbox/config.js +0 -9
- package/ui.form-checkbox/storybook/stories.js +1 -1
- package/ui.form-checkbox-group/storybook/stories.js +1 -1
- package/ui.form-checkbox-multi-state/storybook/stories.js +1 -1
- package/ui.form-color-picker/config.js +0 -7
- package/ui.form-color-picker/storybook/stories.js +1 -1
- package/ui.form-date-picker/storybook/stories.js +2 -2
- package/ui.form-date-picker-range/storybook/stories.js +1 -1
- package/ui.form-input/UInput.vue +1 -1
- package/ui.form-input/storybook/stories.js +1 -1
- package/ui.form-input-file/storybook/stories.js +1 -1
- package/ui.form-input-money/storybook/stories.js +1 -1
- package/ui.form-input-money/useFormatCurrency.js +1 -1
- package/ui.form-input-number/UInputNumber.vue +3 -4
- package/ui.form-input-number/storybook/stories.js +1 -1
- package/ui.form-input-rating/storybook/stories.js +1 -1
- package/ui.form-input-search/storybook/stories.js +1 -1
- package/ui.form-label/config.js +2 -2
- package/ui.form-label/storybook/stories.js +1 -1
- package/ui.form-radio/config.js +0 -6
- package/ui.form-radio-group/storybook/stories.js +1 -1
- package/ui.form-select/storybook/stories.js +1 -1
- package/ui.form-switch/config.js +0 -6
- package/ui.form-switch/storybook/stories.js +1 -1
- package/ui.form-textarea/storybook/stories.js +1 -1
- package/ui.image-avatar/config.js +0 -5
- package/ui.image-avatar/storybook/stories.js +1 -1
- package/ui.image-icon/UIcon.vue +14 -5
- package/ui.image-icon/config.js +0 -5
- package/ui.image-icon/storybook/stories.js +1 -1
- package/ui.loader/config.js +0 -1
- package/ui.loader/storybook/stories.js +1 -1
- package/ui.loader-overlay/config.js +0 -1
- package/ui.loader-progress/config.js +0 -1
- package/ui.loader-progress/storybook/stories.js +1 -1
- package/ui.navigation-progress/config.js +0 -9
- package/ui.navigation-progress/storybook/stories.js +1 -1
- package/ui.navigation-tabs/storybook/stories.js +1 -1
- package/ui.other-dot/config.js +0 -1
- package/ui.other-dot/storybook/stories.js +1 -1
- package/ui.text-alert/config.js +0 -7
- package/ui.text-alert/storybook/stories.js +1 -1
- package/ui.text-badge/config.js +0 -8
- package/ui.text-badge/storybook/stories.js +2 -10
- package/ui.text-block/UText.vue +62 -18
- package/ui.text-block/storybook/Docs.mdx +3 -3
- package/ui.text-block/storybook/{stories.ts → stories.js} +8 -13
- package/ui.text-block/useAttrs.js +15 -0
- package/ui.text-empty/storybook/stories.js +1 -1
- package/ui.text-file/UFile.vue +15 -12
- package/ui.text-file/config.js +2 -12
- package/ui.text-files/config.js +1 -1
- package/ui.text-header/config.js +0 -1
- package/ui.text-header/storybook/stories.js +1 -1
- package/ui.text-money/config.js +0 -1
- package/ui.text-money/storybook/stories.js +1 -1
- package/ui.text-money/utilMoney.js +2 -2
- package/{utilsTs/utilTheme.ts → utils/utilTheme.js} +27 -31
- package/utils/utilUI.js +205 -1
- package/web-types.json +9580 -0
- package/composablesTs/useAutoPosition.ts +0 -115
- package/composablesTs/useBreakpoint.ts +0 -106
- package/composablesTs/useLocale.ts +0 -25
- package/composablesTs/useMutationObserver.ts +0 -50
- package/composablesTs/useUI.ts +0 -557
- package/constants.ts +0 -73
- package/types.ts +0 -223
- package/ui.text-block/types.ts +0 -33
- package/ui.text-block/useAttrs.ts +0 -20
- package/utilsTs/utilHelper.ts +0 -68
- package/utilsTs/utilPlatform.ts +0 -53
- package/utilsTs/utilStorybook.ts +0 -296
- package/utilsTs/utilTailwind.ts +0 -38
- package/utilsTs/utilUI.ts +0 -143
- /package/ui.text-block/{config.ts → config.js} +0 -0
- /package/ui.text-block/{constants.ts → constants.js} +0 -0
package/utilsTs/utilTailwind.ts
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
-
|
|
3
|
-
import resolveConfig from "tailwindcss/resolveConfig";
|
|
4
|
-
import { isSSR, isCSR } from "./utilHelper.ts";
|
|
5
|
-
|
|
6
|
-
import type { Config } from "tailwindcss";
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Load Tailwind config from the project root.
|
|
10
|
-
* Both for server and client side renderings.
|
|
11
|
-
* IIFE for SSR is used to prevent top level await issue.
|
|
12
|
-
*/
|
|
13
|
-
export let fullTailwindConfig: any;
|
|
14
|
-
|
|
15
|
-
if (isSSR) {
|
|
16
|
-
/* Load Tailwind config from the project root in IIFE (no top-level await). */
|
|
17
|
-
(async () => {
|
|
18
|
-
try {
|
|
19
|
-
const filePath = `${process.cwd()}/tailwind.config`;
|
|
20
|
-
|
|
21
|
-
let tailwindConfig = (await import(/* @vite-ignore */ `${filePath}.js`)).default;
|
|
22
|
-
|
|
23
|
-
if (!tailwindConfig) {
|
|
24
|
-
tailwindConfig = (await import(/* @vite-ignore */ `${filePath}.ts`)).default;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
fullTailwindConfig = resolveConfig(tailwindConfig);
|
|
28
|
-
} catch {}
|
|
29
|
-
})();
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
if (isCSR) {
|
|
33
|
-
const tailwindConfig = Object.values(
|
|
34
|
-
import.meta.glob("/tailwind.config.{js,ts}", { eager: true, import: "default" }),
|
|
35
|
-
)[0] as Config;
|
|
36
|
-
|
|
37
|
-
fullTailwindConfig = resolveConfig(tailwindConfig);
|
|
38
|
-
}
|
package/utilsTs/utilUI.ts
DELETED
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
import { merge } from "lodash-es";
|
|
2
|
-
import { defineConfig } from "cva";
|
|
3
|
-
import { extendTailwindMerge } from "tailwind-merge";
|
|
4
|
-
import { cloneDeep, isCSR, isSSR } from "./utilHelper.ts";
|
|
5
|
-
import {
|
|
6
|
-
BRAND_COLOR,
|
|
7
|
-
GRAYSCALE_COLOR,
|
|
8
|
-
DEFAULT_BRAND_COLOR,
|
|
9
|
-
NESTED_COMPONENT_REG_EXP,
|
|
10
|
-
} from "../constants.ts";
|
|
11
|
-
|
|
12
|
-
import type { BrandColors, Config, ComponentNames, Component, Defaults } from "../types.ts";
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Load Vueless config from the project root.
|
|
16
|
-
* Both for server and client side renderings.
|
|
17
|
-
* IIFE for SSR is used to prevent top level await issue.
|
|
18
|
-
*/
|
|
19
|
-
export let vuelessConfig: Config = {};
|
|
20
|
-
|
|
21
|
-
if (isSSR) {
|
|
22
|
-
/* Load Vueless config from the project root in IIFE (no top-level await). */
|
|
23
|
-
(async () => {
|
|
24
|
-
try {
|
|
25
|
-
const filePath = `${process.cwd()}/vueless.config`;
|
|
26
|
-
|
|
27
|
-
vuelessConfig = (await import(/* @vite-ignore */ `${filePath}.js`)).default;
|
|
28
|
-
|
|
29
|
-
if (!vuelessConfig) {
|
|
30
|
-
vuelessConfig = (await import(/* @vite-ignore */ `${filePath}.ts`)).default;
|
|
31
|
-
}
|
|
32
|
-
} catch {
|
|
33
|
-
vuelessConfig = {};
|
|
34
|
-
}
|
|
35
|
-
})();
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
if (isCSR) {
|
|
39
|
-
vuelessConfig =
|
|
40
|
-
Object.values(
|
|
41
|
-
import.meta.glob("/vueless.config.{js,ts}", { eager: true, import: "default" }),
|
|
42
|
-
)[0] || {};
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Extend twMerge (tailwind merge) by vueless and user config:
|
|
47
|
-
* All list of rules available here:
|
|
48
|
-
* https://github.com/dcastil/tailwind-merge/blob/v2.3.0/src/lib/default-config.ts
|
|
49
|
-
*/
|
|
50
|
-
const twMerge = extendTailwindMerge(
|
|
51
|
-
merge(
|
|
52
|
-
{
|
|
53
|
-
extend: {
|
|
54
|
-
theme: {
|
|
55
|
-
spacing: ["safe-top", "safe-bottom", "safe-left", "safe-right"],
|
|
56
|
-
},
|
|
57
|
-
classGroups: {
|
|
58
|
-
"ring-w": [{ ring: ["dynamic"] }],
|
|
59
|
-
"ring-offset-w": [{ "ring-offset": ["dynamic"] }],
|
|
60
|
-
"ring-offset-color": [{ "ring-offset": ["dynamic"] }],
|
|
61
|
-
"font-size": [{ text: ["2xs"] }],
|
|
62
|
-
rounded: [{ rounded: ["dynamic"] }],
|
|
63
|
-
},
|
|
64
|
-
},
|
|
65
|
-
},
|
|
66
|
-
vuelessConfig.tailwindMerge,
|
|
67
|
-
),
|
|
68
|
-
);
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* Export cva (class variance authority) methods:
|
|
72
|
-
* – extended with tailwind-merge
|
|
73
|
-
* – remove all Vueless nested component names ({U...} strings) from class list string.
|
|
74
|
-
* Learn more here: https://beta.cva.style
|
|
75
|
-
*/
|
|
76
|
-
export const {
|
|
77
|
-
cx,
|
|
78
|
-
compose,
|
|
79
|
-
cva: classVarianceAuthority,
|
|
80
|
-
} = defineConfig({
|
|
81
|
-
hooks: {
|
|
82
|
-
onComplete: (classNames) => twMerge(classNames).replace(NESTED_COMPONENT_REG_EXP, ""),
|
|
83
|
-
},
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
/* This allows skipping some CVA config keys in vueless config. */
|
|
87
|
-
export const cva = ({ base = "", variants = {}, compoundVariants = [], defaultVariants = {} }) =>
|
|
88
|
-
classVarianceAuthority({
|
|
89
|
-
base,
|
|
90
|
-
variants,
|
|
91
|
-
compoundVariants,
|
|
92
|
-
defaultVariants,
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Return default values for component props, icons, etc..
|
|
97
|
-
*/
|
|
98
|
-
export function getDefault<T>(defaultConfig: Component, name: ComponentNames): T {
|
|
99
|
-
const componentDefaults = cloneDeep(defaultConfig.defaults) || {};
|
|
100
|
-
const globalDefaults = cloneDeep(vuelessConfig.component?.[name]?.defaults) || {};
|
|
101
|
-
|
|
102
|
-
const defaults = merge(componentDefaults, globalDefaults) as T & Defaults;
|
|
103
|
-
|
|
104
|
-
if (defaults.color) {
|
|
105
|
-
defaults.color = getColor(defaults.color as BrandColors);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
return defaults;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* Return `grayscale` color if in component config it `brand` but in vueless config it `grayscale`
|
|
113
|
-
* Otherwise return given color.
|
|
114
|
-
*/
|
|
115
|
-
export function getColor(color: string) {
|
|
116
|
-
const isBrandColorGrayscale = (vuelessConfig.brand ?? DEFAULT_BRAND_COLOR) === GRAYSCALE_COLOR;
|
|
117
|
-
const isComponentColorBrand = color === BRAND_COLOR;
|
|
118
|
-
|
|
119
|
-
return isBrandColorGrayscale && isComponentColorBrand ? GRAYSCALE_COLOR : color;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* Replace in tailwind classes `{color}` variable into given color.
|
|
124
|
-
*/
|
|
125
|
-
export function setColor(classes: string, color: string) {
|
|
126
|
-
return classes?.replace(/{color}/g, color);
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* Generates simple unique identifier.
|
|
131
|
-
*/
|
|
132
|
-
export function getRandomId(length = 15) {
|
|
133
|
-
const characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
|
134
|
-
const charactersLength = characters.length;
|
|
135
|
-
|
|
136
|
-
let id = "";
|
|
137
|
-
|
|
138
|
-
while (id.length < length) {
|
|
139
|
-
id += characters.charAt(Math.floor(Math.random() * charactersLength));
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
return id;
|
|
143
|
-
}
|
|
File without changes
|
|
File without changes
|