@weser/styling 0.0.15 → 0.0.17
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.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createHooks as baseCreateHooks } from '@css-hooks/react';
|
|
2
2
|
import { WithHooks as BaseWithHooks } from '@css-hooks/core';
|
|
3
3
|
import { assignStyle } from 'css-in-js-utils';
|
|
4
|
-
import { T_Fallback, T_RawStyle } from '../types.js';
|
|
4
|
+
import { T_Fallback, T_RawStyle, T_Style } from '../types.js';
|
|
5
5
|
type WithHooks<Hooks, T> = BaseWithHooks<Hooks, T>;
|
|
6
6
|
type Plugin<T> = (style: T) => T;
|
|
7
7
|
type HookOptions<Hooks extends string> = Parameters<typeof baseCreateHooks<Hooks>>[0];
|
|
@@ -13,7 +13,7 @@ type Config<T, Hooks extends string> = {
|
|
|
13
13
|
};
|
|
14
14
|
export type Properties<T, Hooks> = Array<Properties<T, Hooks>> | WithHooks<Hooks, T> | undefined;
|
|
15
15
|
export type CSSFunction<T, Hooks> = (...style: Array<Properties<T, Hooks>>) => T_RawStyle;
|
|
16
|
-
export default function createRenderer<Hooks extends Record<string, string>, T extends Record<string, any> =
|
|
16
|
+
export default function createRenderer<Hooks extends Record<string, string>, T extends Record<string, any> = T_Style>({ hooks, fallbacks, plugins, mergeStyle, }: Config<T, keyof Hooks & string>): [
|
|
17
17
|
string,
|
|
18
18
|
CSSFunction<T, keyof Hooks & string>
|
|
19
19
|
];
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
export { default as createRenderer } from './core/createRenderer.js';
|
|
2
2
|
export { default as fallbackValue } from './core/fallbackValue.js';
|
|
3
|
-
export { default as responsiveValuePlugin, T_ResponsiveStyle, } from './plugins/responsiveValue.js';
|
|
3
|
+
export { default as responsiveValuePlugin, responsiveValue, T_ResponsiveStyle, T_ResponsiveValue, } from './plugins/responsiveValue.js';
|
|
4
4
|
export { default as prefixerPlugin, fallbacks as prefixerFallbacks, } from './plugins/prefixer.js';
|
|
5
5
|
export { default as debugPlugin } from './plugins/debug.js';
|
|
6
6
|
export { default as enforceLonghandPlugin } from './plugins/enforceLonghand.js';
|
|
7
7
|
export { default as sortPropertyPlugin } from './plugins/sortProperty.js';
|
|
8
8
|
export { default as unitPlugin } from './plugins/unit.js';
|
|
9
|
-
export { default as extendPlugin, T_ExtendStyle } from './plugins/extend.js';
|
|
10
9
|
export { default as useCSSVariable } from './helpers/useCSSVariable.js';
|
|
11
10
|
export { T_Fallback, T_Style } from './types.js';
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
export { default as createRenderer } from './core/createRenderer.js';
|
|
2
2
|
export { default as fallbackValue } from './core/fallbackValue.js';
|
|
3
|
-
export { default as responsiveValuePlugin, } from './plugins/responsiveValue.js';
|
|
3
|
+
export { default as responsiveValuePlugin, responsiveValue, } from './plugins/responsiveValue.js';
|
|
4
4
|
export { default as prefixerPlugin, fallbacks as prefixerFallbacks, } from './plugins/prefixer.js';
|
|
5
5
|
export { default as debugPlugin } from './plugins/debug.js';
|
|
6
6
|
export { default as enforceLonghandPlugin } from './plugins/enforceLonghand.js';
|
|
7
7
|
export { default as sortPropertyPlugin } from './plugins/sortProperty.js';
|
|
8
8
|
export { default as unitPlugin } from './plugins/unit.js';
|
|
9
|
-
export { default as extendPlugin } from './plugins/extend.js';
|
|
10
9
|
export { default as useCSSVariable } from './helpers/useCSSVariable.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { T_Style } from '../types.js';
|
|
2
|
-
type
|
|
2
|
+
export type T_ResponsiveValue<T> = T | (T | undefined)[];
|
|
3
3
|
export type T_ResponsiveStyle<T = T_Style> = {
|
|
4
|
-
[P in keyof T]:
|
|
4
|
+
[P in keyof T]: T_ResponsiveValue<T[P]>;
|
|
5
5
|
};
|
|
6
6
|
export default function responsiveValuePlugin<T = T_Style>(mediaQueries: Array<string>): (style: T) => T;
|
|
7
|
-
export
|
|
7
|
+
export declare function responsiveValue<T>(value: T_ResponsiveValue<T>): T;
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import isPlainObject from 'isobject';
|
|
2
2
|
import { assignStyle } from 'css-in-js-utils';
|
|
3
|
+
export default function responsiveValuePlugin(mediaQueries) {
|
|
4
|
+
return function responsiveValue(style) {
|
|
5
|
+
return resolveResponsiveValues(style, mediaQueries);
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
export function responsiveValue(value) {
|
|
9
|
+
return value;
|
|
10
|
+
}
|
|
3
11
|
function resolveResponsiveValues(style, mediaQueries) {
|
|
4
12
|
for (const key in style) {
|
|
5
13
|
const property = key;
|
|
@@ -26,8 +34,3 @@ function resolveResponsiveValues(style, mediaQueries) {
|
|
|
26
34
|
}
|
|
27
35
|
return style;
|
|
28
36
|
}
|
|
29
|
-
export default function responsiveValuePlugin(mediaQueries) {
|
|
30
|
-
return function responsiveValue(style) {
|
|
31
|
-
return resolveResponsiveValues(style, mediaQueries);
|
|
32
|
-
};
|
|
33
|
-
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"root":["../src/index.ts","../src/types.ts","../src/core/createrenderer.ts","../src/core/fallbackvalue.ts","../src/core/fallbackvalueplugin.ts","../src/core/getfallbackcss.ts","../src/core/getfallbackvariable.ts","../src/helpers/usecssvariable.ts","../src/modules/css-in-js-utils.d.ts","../src/modules/styles-debugger.d.ts","../src/plugins/debug.ts","../src/plugins/enforcelonghand.ts","../src/plugins/
|
|
1
|
+
{"root":["../src/index.ts","../src/types.ts","../src/core/createrenderer.ts","../src/core/fallbackvalue.ts","../src/core/fallbackvalueplugin.ts","../src/core/getfallbackcss.ts","../src/core/getfallbackvariable.ts","../src/helpers/usecssvariable.ts","../src/modules/css-in-js-utils.d.ts","../src/modules/styles-debugger.d.ts","../src/plugins/debug.ts","../src/plugins/enforcelonghand.ts","../src/plugins/prefixer.ts","../src/plugins/responsivevalue.ts","../src/plugins/sortproperty.ts","../src/plugins/unit.ts"],"version":"5.9.2"}
|
package/dist/types.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@weser/styling",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.17",
|
|
4
4
|
"description": "Utils for styling with CSS hooks",
|
|
5
5
|
"author": "Robin Weser <robin@weser.io>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -57,5 +57,5 @@
|
|
|
57
57
|
"styles-debugger": "^1.0.0",
|
|
58
58
|
"typescript": "^5.9.2"
|
|
59
59
|
},
|
|
60
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "71b258e9fc17ff82728fc3b51ac935f48b11f204"
|
|
61
61
|
}
|