@vaneui/ui 0.2.1-alpha.20250812182914.4e44540 → 0.2.1-alpha.20250813194307.2bb87da
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/components/themeContext.d.ts +3 -1
- package/dist/components/ui/checkbox.d.ts +1 -0
- package/dist/components/ui/code.d.ts +1 -0
- package/dist/components/ui/divider.d.ts +1 -0
- package/dist/components/ui/img.d.ts +1 -0
- package/dist/components/ui/label.d.ts +1 -1
- package/dist/components/ui/props/keys.d.ts +8 -10
- package/dist/components/ui/theme/buttonTheme.d.ts +1 -1
- package/dist/index.esm.js +21 -25
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +20 -25
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -20,7 +20,6 @@ const VISUAL_DECORATION = ['border', 'shadow', 'ring'];
|
|
|
20
20
|
const SHAPE = ['shape'];
|
|
21
21
|
const TYPOGRAPHY_STYLE = ['fontWeight', 'fontStyle', 'textDecoration', 'textTransform', 'fontFamily', 'textAlign'];
|
|
22
22
|
const LIST_STYLE = ['listStyle'];
|
|
23
|
-
const LINK = ['link'];
|
|
24
23
|
const VARIANT = ['variant'];
|
|
25
24
|
const COMPONENT_PROPS_CATEGORY = [
|
|
26
25
|
...VISUAL_CORE,
|
|
@@ -29,7 +28,6 @@ const COMPONENT_PROPS_CATEGORY = [
|
|
|
29
28
|
...LIST_STYLE,
|
|
30
29
|
...LAYOUT_CORE,
|
|
31
30
|
...BREAKPOINT,
|
|
32
|
-
...LINK,
|
|
33
31
|
...PADDING,
|
|
34
32
|
...VISUAL_DECORATION,
|
|
35
33
|
...SHAPE,
|
|
@@ -37,7 +35,7 @@ const COMPONENT_PROPS_CATEGORY = [
|
|
|
37
35
|
'mode',
|
|
38
36
|
];
|
|
39
37
|
const ComponentKeys = {
|
|
40
|
-
appearance: ['default', 'accent', 'primary', 'secondary', 'tertiary', 'success', 'danger', 'warning', 'info'],
|
|
38
|
+
appearance: ['default', 'accent', 'primary', 'secondary', 'tertiary', 'success', 'danger', 'warning', 'info', 'link'],
|
|
41
39
|
border: ['border', 'noBorder'],
|
|
42
40
|
breakpoint: ['xsCol', 'smCol', 'mdCol', 'lgCol', 'xlCol'],
|
|
43
41
|
display: ['inline', 'block', 'inlineBlock', 'flex', 'inlineFlex', 'grid', 'inlineGrid', 'contents', 'table', 'tableCell', 'hidden'],
|
|
@@ -49,7 +47,6 @@ const ComponentKeys = {
|
|
|
49
47
|
hide: ['xsHide', 'smHide', 'mdHide', 'lgHide', 'xlHide'],
|
|
50
48
|
items: ['itemsStart', 'itemsEnd', 'itemsCenter', 'itemsBaseline', 'itemsStretch'],
|
|
51
49
|
justify: ['justifyStart', 'justifyEnd', 'justifyCenter', 'justifyBetween', 'justifyAround', 'justifyEvenly', 'justifyStretch', 'justifyBaseline'],
|
|
52
|
-
link: ['link'],
|
|
53
50
|
listStyle: ['disc', 'decimal'],
|
|
54
51
|
mode: ['base', 'hover', 'active'],
|
|
55
52
|
overflow: ['overflowAuto', 'overflowHidden', 'overflowClip', 'overflowVisible', 'overflowScroll', 'overflowXAuto', 'overflowYAuto', 'overflowXHidden', 'overflowYHidden', 'overflowXClip', 'overflowYClip', 'overflowXVisible', 'overflowYVisible', 'overflowXScroll', 'overflowYScroll'],
|
|
@@ -70,7 +67,7 @@ const ComponentKeys = {
|
|
|
70
67
|
// Composite categories built from core blocks
|
|
71
68
|
const LAYOUT_FULL = [...LAYOUT_CORE, ...LAYOUT_FLEX];
|
|
72
69
|
const VISUAL_FULL = [...VISUAL_CORE, ...VISUAL_DECORATION, ...SHAPE];
|
|
73
|
-
const TYPOGRAPHY_FULL = [...TYPOGRAPHY_STYLE
|
|
70
|
+
const TYPOGRAPHY_FULL = [...TYPOGRAPHY_STYLE];
|
|
74
71
|
const INTERACTIVE_CATEGORIES = [...LAYOUT_FULL, ...VISUAL_FULL, ...TYPOGRAPHY_STYLE, ...PADDING, ...VARIANT];
|
|
75
72
|
const BUTTON_CATEGORIES = INTERACTIVE_CATEGORIES;
|
|
76
73
|
const BADGE_CATEGORIES = INTERACTIVE_CATEGORIES;
|
|
@@ -3667,26 +3664,21 @@ class AppearanceTheme extends BaseTheme {
|
|
|
3667
3664
|
this.linkClassSource = options === null || options === void 0 ? void 0 : options.linkClassSource;
|
|
3668
3665
|
}
|
|
3669
3666
|
getClasses(extractedKeys) {
|
|
3670
|
-
var _a
|
|
3671
|
-
// Check for specific transparent
|
|
3667
|
+
var _a;
|
|
3668
|
+
// Check for specific transparent styles first
|
|
3672
3669
|
if (extractedKeys === null || extractedKeys === void 0 ? void 0 : extractedKeys.transparent) {
|
|
3673
3670
|
const transparentClass = ((_a = this.transparentClassSource) === null || _a === void 0 ? void 0 : _a[extractedKeys.transparent]) || '';
|
|
3674
3671
|
return [transparentClass];
|
|
3675
3672
|
}
|
|
3676
|
-
|
|
3677
|
-
const linkClass = ((_b = this.linkClassSource) === null || _b === void 0 ? void 0 : _b[extractedKeys.link]) || '';
|
|
3678
|
-
return [linkClass];
|
|
3679
|
-
}
|
|
3680
|
-
// Use regular appearance
|
|
3673
|
+
// Use appearance (now includes link as an appearance option)
|
|
3681
3674
|
const pickedAppearanceKey = extractedKeys === null || extractedKeys === void 0 ? void 0 : extractedKeys.appearance;
|
|
3682
|
-
if (
|
|
3683
|
-
|
|
3684
|
-
|
|
3685
|
-
|
|
3686
|
-
|
|
3687
|
-
return [];
|
|
3675
|
+
if (pickedAppearanceKey) {
|
|
3676
|
+
const modes = this[pickedAppearanceKey];
|
|
3677
|
+
if (modes) {
|
|
3678
|
+
return ComponentKeys.mode.map(mode => modes[mode] || '');
|
|
3679
|
+
}
|
|
3688
3680
|
}
|
|
3689
|
-
return
|
|
3681
|
+
return [];
|
|
3690
3682
|
}
|
|
3691
3683
|
static createTheme(src = {}, options) {
|
|
3692
3684
|
const finalConfig = Object.fromEntries(ComponentKeys.appearance.map(textKey => [
|
|
@@ -4306,7 +4298,6 @@ const linkTheme = new ComponentTheme("a", "hover:underline w-fit cursor-pointer"
|
|
|
4306
4298
|
layout: defaultLayoutTheme,
|
|
4307
4299
|
}, {
|
|
4308
4300
|
link: true,
|
|
4309
|
-
default: true,
|
|
4310
4301
|
sans: true,
|
|
4311
4302
|
}, TYPOGRAPHY_CATEGORIES);
|
|
4312
4303
|
// List specific theme
|
|
@@ -4857,12 +4848,17 @@ function applyExtraClassesRecursively(themeObject, extraClassesObject) {
|
|
|
4857
4848
|
}
|
|
4858
4849
|
}
|
|
4859
4850
|
const ThemeContext = react.createContext(defaultTheme);
|
|
4860
|
-
function ThemeProvider({ children, theme: themeObject = {}, themeDefaults, extraClasses, themeOverride }) {
|
|
4851
|
+
function ThemeProvider({ children, theme: themeObject = {}, themeDefaults, extraClasses, themeOverride, mergeStrategy = 'merge' }) {
|
|
4852
|
+
const parentTheme = react.useContext(ThemeContext);
|
|
4861
4853
|
const mergedTheme = react.useMemo(() => {
|
|
4854
|
+
// Determine the base theme based on merge strategy
|
|
4855
|
+
const baseTheme = mergeStrategy === 'replace'
|
|
4856
|
+
? defaultTheme
|
|
4857
|
+
: parentTheme;
|
|
4862
4858
|
// Always start with a deep clone to ensure isolation
|
|
4863
4859
|
let finalTheme = themeObject
|
|
4864
|
-
? deepMerge(deepClone(
|
|
4865
|
-
: deepClone(
|
|
4860
|
+
? deepMerge(deepClone(baseTheme), themeObject)
|
|
4861
|
+
: deepClone(baseTheme);
|
|
4866
4862
|
if (typeof themeOverride === 'function') {
|
|
4867
4863
|
const themeToModify = deepClone(finalTheme);
|
|
4868
4864
|
finalTheme = themeOverride(themeToModify);
|
|
@@ -4880,7 +4876,7 @@ function ThemeProvider({ children, theme: themeObject = {}, themeDefaults, extra
|
|
|
4880
4876
|
applyExtraClassesRecursively(finalTheme, extraClasses);
|
|
4881
4877
|
}
|
|
4882
4878
|
return finalTheme;
|
|
4883
|
-
}, [themeObject, themeDefaults, extraClasses, themeOverride]);
|
|
4879
|
+
}, [themeObject, themeDefaults, extraClasses, themeOverride, mergeStrategy, parentTheme]);
|
|
4884
4880
|
return (jsxRuntime.jsx(ThemeContext.Provider, { value: mergedTheme, children: children }));
|
|
4885
4881
|
}
|
|
4886
4882
|
function useTheme() {
|
|
@@ -5061,7 +5057,6 @@ exports.LABEL_CATEGORIES = LABEL_CATEGORIES;
|
|
|
5061
5057
|
exports.LAYOUT_CORE = LAYOUT_CORE;
|
|
5062
5058
|
exports.LAYOUT_FLEX = LAYOUT_FLEX;
|
|
5063
5059
|
exports.LAYOUT_FULL = LAYOUT_FULL;
|
|
5064
|
-
exports.LINK = LINK;
|
|
5065
5060
|
exports.LIST_CATEGORIES = LIST_CATEGORIES;
|
|
5066
5061
|
exports.LIST_STYLE = LIST_STYLE;
|
|
5067
5062
|
exports.Label = Label;
|