@marigold/system 11.1.1 → 11.2.0
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 +6 -8
- package/dist/index.d.ts +6 -8
- package/dist/index.js +2 -2
- package/dist/index.mjs +2 -2
- package/package.json +7 -6
package/dist/index.d.mts
CHANGED
|
@@ -86,17 +86,15 @@ declare const get: (obj: object, path: string, fallback?: any) => any;
|
|
|
86
86
|
*/
|
|
87
87
|
declare const isValidCssCustomPropertyName: (val: string) => boolean;
|
|
88
88
|
/**
|
|
89
|
-
*
|
|
89
|
+
* Ensures that the given value is formatted as a CSS variable reference.
|
|
90
90
|
*
|
|
91
|
-
* If the provided value is a valid CSS custom property name (without the leading `--`),
|
|
92
|
-
* the function returns a string in the
|
|
93
|
-
*
|
|
91
|
+
* If the provided value (`val`) is a valid CSS custom property name (without the leading `--`),
|
|
92
|
+
* the function returns a string in the form of `var(--<prefix-if-provided><val>, <val>)`. When a
|
|
93
|
+
* `prefix` is provided, it is prepended to the custom property name with a hyphen.
|
|
94
94
|
*
|
|
95
|
-
* If the value is not a valid custom property name, the function
|
|
96
|
-
*
|
|
97
|
-
* If no input is given, the function returns `undefined`.
|
|
95
|
+
* If the value is not a valid custom property name, the function returns the original value.
|
|
98
96
|
*/
|
|
99
|
-
declare const ensureCssVar: (val?: string) => string
|
|
97
|
+
declare const ensureCssVar: (val: string, prefix?: string) => string;
|
|
100
98
|
|
|
101
99
|
interface NestedStringObject {
|
|
102
100
|
[key: string]: NestedStringObject | string;
|
package/dist/index.d.ts
CHANGED
|
@@ -86,17 +86,15 @@ declare const get: (obj: object, path: string, fallback?: any) => any;
|
|
|
86
86
|
*/
|
|
87
87
|
declare const isValidCssCustomPropertyName: (val: string) => boolean;
|
|
88
88
|
/**
|
|
89
|
-
*
|
|
89
|
+
* Ensures that the given value is formatted as a CSS variable reference.
|
|
90
90
|
*
|
|
91
|
-
* If the provided value is a valid CSS custom property name (without the leading `--`),
|
|
92
|
-
* the function returns a string in the
|
|
93
|
-
*
|
|
91
|
+
* If the provided value (`val`) is a valid CSS custom property name (without the leading `--`),
|
|
92
|
+
* the function returns a string in the form of `var(--<prefix-if-provided><val>, <val>)`. When a
|
|
93
|
+
* `prefix` is provided, it is prepended to the custom property name with a hyphen.
|
|
94
94
|
*
|
|
95
|
-
* If the value is not a valid custom property name, the function
|
|
96
|
-
*
|
|
97
|
-
* If no input is given, the function returns `undefined`.
|
|
95
|
+
* If the value is not a valid custom property name, the function returns the original value.
|
|
98
96
|
*/
|
|
99
|
-
declare const ensureCssVar: (val?: string) => string
|
|
97
|
+
declare const ensureCssVar: (val: string, prefix?: string) => string;
|
|
100
98
|
|
|
101
99
|
interface NestedStringObject {
|
|
102
100
|
[key: string]: NestedStringObject | string;
|
package/dist/index.js
CHANGED
|
@@ -97,7 +97,7 @@ var get = (obj, path, fallback) => {
|
|
|
97
97
|
return result === void 0 ? fallback : result;
|
|
98
98
|
};
|
|
99
99
|
var isValidCssCustomPropertyName = (val) => /^[A-Za-z0-9_-]+$/.test(val);
|
|
100
|
-
var ensureCssVar = (val) =>
|
|
100
|
+
var ensureCssVar = (val, prefix) => isValidCssCustomPropertyName(val) ? `var(--${prefix ? `${prefix}-` : ""}${val}, ${val})` : val;
|
|
101
101
|
|
|
102
102
|
// src/components/SVG/SVG.tsx
|
|
103
103
|
var SVG = (0, import_react.forwardRef)(
|
|
@@ -110,7 +110,7 @@ var SVG = (0, import_react.forwardRef)(
|
|
|
110
110
|
width: `${props.width || size}px`,
|
|
111
111
|
height: `${props.height || size}px`,
|
|
112
112
|
className: cn("flex-none fill-current", className),
|
|
113
|
-
style: { color: ensureCssVar(color) }
|
|
113
|
+
style: { color: color && ensureCssVar(color, "color") }
|
|
114
114
|
},
|
|
115
115
|
children
|
|
116
116
|
);
|
package/dist/index.mjs
CHANGED
|
@@ -25,7 +25,7 @@ var get = (obj, path, fallback) => {
|
|
|
25
25
|
return result === void 0 ? fallback : result;
|
|
26
26
|
};
|
|
27
27
|
var isValidCssCustomPropertyName = (val) => /^[A-Za-z0-9_-]+$/.test(val);
|
|
28
|
-
var ensureCssVar = (val) =>
|
|
28
|
+
var ensureCssVar = (val, prefix) => isValidCssCustomPropertyName(val) ? `var(--${prefix ? `${prefix}-` : ""}${val}, ${val})` : val;
|
|
29
29
|
|
|
30
30
|
// src/components/SVG/SVG.tsx
|
|
31
31
|
var SVG = forwardRef(
|
|
@@ -38,7 +38,7 @@ var SVG = forwardRef(
|
|
|
38
38
|
width: `${props.width || size}px`,
|
|
39
39
|
height: `${props.height || size}px`,
|
|
40
40
|
className: cn("flex-none fill-current", className),
|
|
41
|
-
style: { color: ensureCssVar(color) }
|
|
41
|
+
style: { color: color && ensureCssVar(color, "color") }
|
|
42
42
|
},
|
|
43
43
|
children
|
|
44
44
|
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@marigold/system",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.2.0",
|
|
4
4
|
"description": "Marigold System Library",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
@@ -29,18 +29,19 @@
|
|
|
29
29
|
"deepmerge": "4.3.1",
|
|
30
30
|
"react-fast-compare": "3.2.2",
|
|
31
31
|
"tailwind-merge": "2.6.0",
|
|
32
|
-
"@marigold/types": "1.
|
|
32
|
+
"@marigold/types": "1.3.0"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
|
-
"react": "
|
|
36
|
-
"react-dom": "
|
|
35
|
+
"react": ">=17.0.0",
|
|
36
|
+
"react-dom": ">=17.0.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@babel/core": "7.26.
|
|
39
|
+
"@babel/core": "7.26.9",
|
|
40
40
|
"postcss": "8.5.2",
|
|
41
41
|
"react": "19.0.0",
|
|
42
|
+
"@types/react": "19.0.8",
|
|
42
43
|
"tailwindcss": "4.0.6",
|
|
43
|
-
"tsup": "8.3.
|
|
44
|
+
"tsup": "8.3.6",
|
|
44
45
|
"@marigold/tsconfig": "0.4.0"
|
|
45
46
|
},
|
|
46
47
|
"scripts": {
|