@marigold/system 11.1.0 → 11.1.1
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.d.mts +22 -1
- package/dist/index.d.ts +22 -1
- package/dist/index.js +7 -1
- package/dist/index.mjs +5 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -76,6 +76,27 @@ declare const createVar: (o: {
|
|
|
76
76
|
* Based on: https://github.com/developit/dlv
|
|
77
77
|
*/
|
|
78
78
|
declare const get: (obj: object, path: string, fallback?: any) => any;
|
|
79
|
+
/**
|
|
80
|
+
* Checks if a given string is a valid CSS custom property name (without the leading `--`).
|
|
81
|
+
*
|
|
82
|
+
* This simplified check ensures:
|
|
83
|
+
* - The name does not start with a digit.
|
|
84
|
+
* - It contains only word characters (letters, digits, underscore) or hyphens.
|
|
85
|
+
* - It must include at least one hyphen to be considered a custom property name.
|
|
86
|
+
*/
|
|
87
|
+
declare const isValidCssCustomPropertyName: (val: string) => boolean;
|
|
88
|
+
/**
|
|
89
|
+
* Returns a CSS variable reference string based on the input value.
|
|
90
|
+
*
|
|
91
|
+
* If the provided value is a valid CSS custom property name (without the leading `--`),
|
|
92
|
+
* the function returns a string in the format `var(--<val>, <val>)`, which uses the value
|
|
93
|
+
* both as the custom property name (with a `--` prefix) and as the fallback value.
|
|
94
|
+
*
|
|
95
|
+
* If the value is not a valid custom property name, the function simply returns the value.
|
|
96
|
+
*
|
|
97
|
+
* If no input is given, the function returns `undefined`.
|
|
98
|
+
*/
|
|
99
|
+
declare const ensureCssVar: (val?: string) => string | undefined;
|
|
79
100
|
|
|
80
101
|
interface NestedStringObject {
|
|
81
102
|
[key: string]: NestedStringObject | string;
|
|
@@ -943,4 +964,4 @@ type HeightProp = {
|
|
|
943
964
|
height?: keyof typeof height;
|
|
944
965
|
};
|
|
945
966
|
|
|
946
|
-
export { type AlignmentProp, type AspectProp, type ComponentClassNames, type ComponentNames, type ComponentState, type ComponentStyleFunction, type Config, type ConfigSchema, type ConfigVariants, type ConfigVariantsMulti, type CursorProp, DateFormat, type FontSizeProp, type FontStyleProp, type FontWeightProp, type GapSpaceProp, type HeightProp, type NestedStringObject, NumericFormat, type ObjectFitProp, type ObjectPositionProp, type PaddingBottomProp, type PaddingLeftProp, type PaddingRightProp, type PaddingSpaceProp, type PaddingSpacePropX, type PaddingSpacePropY, type PaddingTopProp, type PlaceItemsProp, type Props, SVG, type SVGProps, type StateAttrKeyProps, type StateAttrProps, type StylesProps, type TextAlignProp, type Theme, type ThemeComponent, ThemeProvider, type ThemeProviderProps, type UseClassNamesProps, type UseStateProps, type WidthProp, alignment, aspect, cn, createVar, cursorStyle, cva, defaultTheme, extendTheme, fontWeight, gapSpace, get, height, objectFit, objectPosition, paddingBottom, paddingLeft, paddingRight, paddingSpace, paddingSpaceX, paddingSpaceY, paddingTop, placeItems, textAlign, textSize, textStyle, useClassNames, useResponsiveValue, useSmallScreen, useStateProps, useTheme, width };
|
|
967
|
+
export { type AlignmentProp, type AspectProp, type ComponentClassNames, type ComponentNames, type ComponentState, type ComponentStyleFunction, type Config, type ConfigSchema, type ConfigVariants, type ConfigVariantsMulti, type CursorProp, DateFormat, type FontSizeProp, type FontStyleProp, type FontWeightProp, type GapSpaceProp, type HeightProp, type NestedStringObject, NumericFormat, type ObjectFitProp, type ObjectPositionProp, type PaddingBottomProp, type PaddingLeftProp, type PaddingRightProp, type PaddingSpaceProp, type PaddingSpacePropX, type PaddingSpacePropY, type PaddingTopProp, type PlaceItemsProp, type Props, SVG, type SVGProps, type StateAttrKeyProps, type StateAttrProps, type StylesProps, type TextAlignProp, type Theme, type ThemeComponent, ThemeProvider, type ThemeProviderProps, type UseClassNamesProps, type UseStateProps, type WidthProp, alignment, aspect, cn, createVar, cursorStyle, cva, defaultTheme, ensureCssVar, extendTheme, fontWeight, gapSpace, get, height, isValidCssCustomPropertyName, objectFit, objectPosition, paddingBottom, paddingLeft, paddingRight, paddingSpace, paddingSpaceX, paddingSpaceY, paddingTop, placeItems, textAlign, textSize, textStyle, useClassNames, useResponsiveValue, useSmallScreen, useStateProps, useTheme, width };
|
package/dist/index.d.ts
CHANGED
|
@@ -76,6 +76,27 @@ declare const createVar: (o: {
|
|
|
76
76
|
* Based on: https://github.com/developit/dlv
|
|
77
77
|
*/
|
|
78
78
|
declare const get: (obj: object, path: string, fallback?: any) => any;
|
|
79
|
+
/**
|
|
80
|
+
* Checks if a given string is a valid CSS custom property name (without the leading `--`).
|
|
81
|
+
*
|
|
82
|
+
* This simplified check ensures:
|
|
83
|
+
* - The name does not start with a digit.
|
|
84
|
+
* - It contains only word characters (letters, digits, underscore) or hyphens.
|
|
85
|
+
* - It must include at least one hyphen to be considered a custom property name.
|
|
86
|
+
*/
|
|
87
|
+
declare const isValidCssCustomPropertyName: (val: string) => boolean;
|
|
88
|
+
/**
|
|
89
|
+
* Returns a CSS variable reference string based on the input value.
|
|
90
|
+
*
|
|
91
|
+
* If the provided value is a valid CSS custom property name (without the leading `--`),
|
|
92
|
+
* the function returns a string in the format `var(--<val>, <val>)`, which uses the value
|
|
93
|
+
* both as the custom property name (with a `--` prefix) and as the fallback value.
|
|
94
|
+
*
|
|
95
|
+
* If the value is not a valid custom property name, the function simply returns the value.
|
|
96
|
+
*
|
|
97
|
+
* If no input is given, the function returns `undefined`.
|
|
98
|
+
*/
|
|
99
|
+
declare const ensureCssVar: (val?: string) => string | undefined;
|
|
79
100
|
|
|
80
101
|
interface NestedStringObject {
|
|
81
102
|
[key: string]: NestedStringObject | string;
|
|
@@ -943,4 +964,4 @@ type HeightProp = {
|
|
|
943
964
|
height?: keyof typeof height;
|
|
944
965
|
};
|
|
945
966
|
|
|
946
|
-
export { type AlignmentProp, type AspectProp, type ComponentClassNames, type ComponentNames, type ComponentState, type ComponentStyleFunction, type Config, type ConfigSchema, type ConfigVariants, type ConfigVariantsMulti, type CursorProp, DateFormat, type FontSizeProp, type FontStyleProp, type FontWeightProp, type GapSpaceProp, type HeightProp, type NestedStringObject, NumericFormat, type ObjectFitProp, type ObjectPositionProp, type PaddingBottomProp, type PaddingLeftProp, type PaddingRightProp, type PaddingSpaceProp, type PaddingSpacePropX, type PaddingSpacePropY, type PaddingTopProp, type PlaceItemsProp, type Props, SVG, type SVGProps, type StateAttrKeyProps, type StateAttrProps, type StylesProps, type TextAlignProp, type Theme, type ThemeComponent, ThemeProvider, type ThemeProviderProps, type UseClassNamesProps, type UseStateProps, type WidthProp, alignment, aspect, cn, createVar, cursorStyle, cva, defaultTheme, extendTheme, fontWeight, gapSpace, get, height, objectFit, objectPosition, paddingBottom, paddingLeft, paddingRight, paddingSpace, paddingSpaceX, paddingSpaceY, paddingTop, placeItems, textAlign, textSize, textStyle, useClassNames, useResponsiveValue, useSmallScreen, useStateProps, useTheme, width };
|
|
967
|
+
export { type AlignmentProp, type AspectProp, type ComponentClassNames, type ComponentNames, type ComponentState, type ComponentStyleFunction, type Config, type ConfigSchema, type ConfigVariants, type ConfigVariantsMulti, type CursorProp, DateFormat, type FontSizeProp, type FontStyleProp, type FontWeightProp, type GapSpaceProp, type HeightProp, type NestedStringObject, NumericFormat, type ObjectFitProp, type ObjectPositionProp, type PaddingBottomProp, type PaddingLeftProp, type PaddingRightProp, type PaddingSpaceProp, type PaddingSpacePropX, type PaddingSpacePropY, type PaddingTopProp, type PlaceItemsProp, type Props, SVG, type SVGProps, type StateAttrKeyProps, type StateAttrProps, type StylesProps, type TextAlignProp, type Theme, type ThemeComponent, ThemeProvider, type ThemeProviderProps, type UseClassNamesProps, type UseStateProps, type WidthProp, alignment, aspect, cn, createVar, cursorStyle, cva, defaultTheme, ensureCssVar, extendTheme, fontWeight, gapSpace, get, height, isValidCssCustomPropertyName, objectFit, objectPosition, paddingBottom, paddingLeft, paddingRight, paddingSpace, paddingSpaceX, paddingSpaceY, paddingTop, placeItems, textAlign, textSize, textStyle, useClassNames, useResponsiveValue, useSmallScreen, useStateProps, useTheme, width };
|
package/dist/index.js
CHANGED
|
@@ -41,11 +41,13 @@ __export(index_exports, {
|
|
|
41
41
|
cursorStyle: () => cursorStyle,
|
|
42
42
|
cva: () => cva,
|
|
43
43
|
defaultTheme: () => defaultTheme,
|
|
44
|
+
ensureCssVar: () => ensureCssVar,
|
|
44
45
|
extendTheme: () => extendTheme,
|
|
45
46
|
fontWeight: () => fontWeight,
|
|
46
47
|
gapSpace: () => gapSpace,
|
|
47
48
|
get: () => get,
|
|
48
49
|
height: () => height,
|
|
50
|
+
isValidCssCustomPropertyName: () => isValidCssCustomPropertyName,
|
|
49
51
|
objectFit: () => objectFit,
|
|
50
52
|
objectPosition: () => objectPosition,
|
|
51
53
|
paddingBottom: () => paddingBottom,
|
|
@@ -94,6 +96,8 @@ var get = (obj, path, fallback) => {
|
|
|
94
96
|
}
|
|
95
97
|
return result === void 0 ? fallback : result;
|
|
96
98
|
};
|
|
99
|
+
var isValidCssCustomPropertyName = (val) => /^[A-Za-z0-9_-]+$/.test(val);
|
|
100
|
+
var ensureCssVar = (val) => val ? isValidCssCustomPropertyName(val) ? `var(--${val}, ${val})` : val : void 0;
|
|
97
101
|
|
|
98
102
|
// src/components/SVG/SVG.tsx
|
|
99
103
|
var SVG = (0, import_react.forwardRef)(
|
|
@@ -106,7 +110,7 @@ var SVG = (0, import_react.forwardRef)(
|
|
|
106
110
|
width: `${props.width || size}px`,
|
|
107
111
|
height: `${props.height || size}px`,
|
|
108
112
|
className: cn("flex-none fill-current", className),
|
|
109
|
-
style: { color:
|
|
113
|
+
style: { color: ensureCssVar(color) }
|
|
110
114
|
},
|
|
111
115
|
children
|
|
112
116
|
);
|
|
@@ -903,11 +907,13 @@ var cursorStyle = {
|
|
|
903
907
|
cursorStyle,
|
|
904
908
|
cva,
|
|
905
909
|
defaultTheme,
|
|
910
|
+
ensureCssVar,
|
|
906
911
|
extendTheme,
|
|
907
912
|
fontWeight,
|
|
908
913
|
gapSpace,
|
|
909
914
|
get,
|
|
910
915
|
height,
|
|
916
|
+
isValidCssCustomPropertyName,
|
|
911
917
|
objectFit,
|
|
912
918
|
objectPosition,
|
|
913
919
|
paddingBottom,
|
package/dist/index.mjs
CHANGED
|
@@ -24,6 +24,8 @@ var get = (obj, path, fallback) => {
|
|
|
24
24
|
}
|
|
25
25
|
return result === void 0 ? fallback : result;
|
|
26
26
|
};
|
|
27
|
+
var isValidCssCustomPropertyName = (val) => /^[A-Za-z0-9_-]+$/.test(val);
|
|
28
|
+
var ensureCssVar = (val) => val ? isValidCssCustomPropertyName(val) ? `var(--${val}, ${val})` : val : void 0;
|
|
27
29
|
|
|
28
30
|
// src/components/SVG/SVG.tsx
|
|
29
31
|
var SVG = forwardRef(
|
|
@@ -36,7 +38,7 @@ var SVG = forwardRef(
|
|
|
36
38
|
width: `${props.width || size}px`,
|
|
37
39
|
height: `${props.height || size}px`,
|
|
38
40
|
className: cn("flex-none fill-current", className),
|
|
39
|
-
style: { color:
|
|
41
|
+
style: { color: ensureCssVar(color) }
|
|
40
42
|
},
|
|
41
43
|
children
|
|
42
44
|
);
|
|
@@ -832,11 +834,13 @@ export {
|
|
|
832
834
|
cursorStyle,
|
|
833
835
|
cva,
|
|
834
836
|
defaultTheme,
|
|
837
|
+
ensureCssVar,
|
|
835
838
|
extendTheme,
|
|
836
839
|
fontWeight,
|
|
837
840
|
gapSpace,
|
|
838
841
|
get,
|
|
839
842
|
height,
|
|
843
|
+
isValidCssCustomPropertyName,
|
|
840
844
|
objectFit,
|
|
841
845
|
objectPosition,
|
|
842
846
|
paddingBottom,
|