@fluentui-react-native/use-styling 0.14.1 → 0.15.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/.cache/tsconfig.tsbuildinfo +1 -0
- package/CHANGELOG.md +38 -0
- package/jest.config.cjs +1 -0
- package/lib/buildProps.js.map +1 -1
- package/lib/buildProps.test.js +1 -1
- package/lib/buildProps.test.js.map +1 -1
- package/lib/buildUseStyling.d.ts +1 -1
- package/lib/buildUseStyling.d.ts.map +1 -1
- package/lib/buildUseStyling.js +3 -3
- package/lib/buildUseStyling.js.map +1 -1
- package/lib/buildUseStyling.test.js +4 -4
- package/lib/buildUseStyling.test.js.map +1 -1
- package/lib/index.d.ts +4 -4
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -2
- package/lib/index.js.map +1 -1
- package/lib/useStyling.samples.test.js +4 -8
- package/lib/useStyling.samples.test.js.map +1 -1
- package/package.json +20 -25
- package/src/buildProps.test.ts +1 -1
- package/src/buildUseStyling.test.ts +5 -5
- package/src/buildUseStyling.ts +4 -4
- package/src/index.ts +4 -4
- package/src/useStyling.samples.test.tsx +3 -3
- package/babel.config.js +0 -1
- package/eslint.config.js +0 -3
- package/lib-commonjs/buildProps.d.ts +0 -51
- package/lib-commonjs/buildProps.d.ts.map +0 -1
- package/lib-commonjs/buildProps.js +0 -48
- package/lib-commonjs/buildProps.js.map +0 -1
- package/lib-commonjs/buildProps.test.d.ts +0 -2
- package/lib-commonjs/buildProps.test.d.ts.map +0 -1
- package/lib-commonjs/buildProps.test.js +0 -38
- package/lib-commonjs/buildProps.test.js.map +0 -1
- package/lib-commonjs/buildUseStyling.d.ts +0 -49
- package/lib-commonjs/buildUseStyling.d.ts.map +0 -1
- package/lib-commonjs/buildUseStyling.js +0 -54
- package/lib-commonjs/buildUseStyling.js.map +0 -1
- package/lib-commonjs/buildUseStyling.test.d.ts +0 -2
- package/lib-commonjs/buildUseStyling.test.d.ts.map +0 -1
- package/lib-commonjs/buildUseStyling.test.js +0 -89
- package/lib-commonjs/buildUseStyling.test.js.map +0 -1
- package/lib-commonjs/index.d.ts +0 -7
- package/lib-commonjs/index.d.ts.map +0 -1
- package/lib-commonjs/index.js +0 -11
- package/lib-commonjs/index.js.map +0 -1
- package/lib-commonjs/useStyling.samples.test.d.ts +0 -2
- package/lib-commonjs/useStyling.samples.test.d.ts.map +0 -1
- package/lib-commonjs/useStyling.samples.test.js +0 -222
- package/lib-commonjs/useStyling.samples.test.js.map +0 -1
package/src/buildProps.test.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getMemoCache } from '@fluentui-react-native/framework-base';
|
|
2
2
|
|
|
3
|
-
import { buildProps } from './buildProps';
|
|
3
|
+
import { buildProps } from './buildProps.ts';
|
|
4
4
|
|
|
5
5
|
type ITheme = { foo?: string; bar?: string };
|
|
6
6
|
type ITokens = { a?: string; b?: string; c?: string; d?: string };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { getMemoCache } from '@fluentui-react-native/framework-base';
|
|
2
2
|
|
|
3
|
-
import { buildProps } from './buildProps';
|
|
4
|
-
import type { ThemeHelper, UseStylingOptions } from './buildUseStyling';
|
|
5
|
-
import { buildUseStyling } from './buildUseStyling';
|
|
3
|
+
import { buildProps } from './buildProps.ts';
|
|
4
|
+
import type { ThemeHelper, UseStylingOptions } from './buildUseStyling.ts';
|
|
5
|
+
import { buildUseStyling } from './buildUseStyling.ts';
|
|
6
6
|
|
|
7
7
|
let lastInstance = 0;
|
|
8
8
|
|
|
@@ -129,8 +129,8 @@ describe('useStyling test suite', () => {
|
|
|
129
129
|
const useStyling = buildUseStyling(baseOptions, themeHelper);
|
|
130
130
|
const slotProps = useStyling({});
|
|
131
131
|
const slotProps2 = useStyling({ p1: 2, p2: 'bar' });
|
|
132
|
-
Object.keys(slotProps)
|
|
132
|
+
for (const key of Object.keys(slotProps)) {
|
|
133
133
|
expect(slotProps[key]).toBe(slotProps2[key]);
|
|
134
|
-
}
|
|
134
|
+
}
|
|
135
135
|
});
|
|
136
136
|
});
|
package/src/buildUseStyling.ts
CHANGED
|
@@ -2,8 +2,8 @@ import type { GetTypedMemoValue } from '@fluentui-react-native/framework-base';
|
|
|
2
2
|
import type { HasLayer, TokenSettings } from '@fluentui-react-native/use-tokens';
|
|
3
3
|
import { applyPropsToTokens, applyTokenLayers, buildUseTokens } from '@fluentui-react-native/use-tokens';
|
|
4
4
|
|
|
5
|
-
import type { TokensThatAreAlsoProps, BuildSlotProps } from './buildProps';
|
|
6
|
-
import { refinePropsFunctions } from './buildProps';
|
|
5
|
+
import type { TokensThatAreAlsoProps, BuildSlotProps } from './buildProps.ts';
|
|
6
|
+
import { refinePropsFunctions } from './buildProps.ts';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Options used to build up a useStyling hook
|
|
@@ -67,10 +67,10 @@ function resolveToSlotProps<TSlotProps, TTokens, TTheme>(
|
|
|
67
67
|
cache: GetTypedMemoValue<TTokens>,
|
|
68
68
|
): TSlotProps {
|
|
69
69
|
const slotProps = {};
|
|
70
|
-
Object.keys(styles)
|
|
70
|
+
for (const key of Object.keys(styles)) {
|
|
71
71
|
const style = styles[key];
|
|
72
72
|
slotProps[key] = typeof style === 'function' ? style(tokens, theme, cache(null, [key])[1]) : style;
|
|
73
|
-
}
|
|
73
|
+
}
|
|
74
74
|
return slotProps as TSlotProps;
|
|
75
75
|
}
|
|
76
76
|
|
package/src/index.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { buildUseStyling } from './buildUseStyling';
|
|
2
|
-
export type { ThemeHelper, UseStyling, UseStylingOptions } from './buildUseStyling';
|
|
3
|
-
export { buildProps, refinePropsFunctions } from './buildProps';
|
|
4
|
-
export type { BuildPropsBase, BuildSlotProps, RefinableBuildPropsBase, RefineFunctionBase, TokensThatAreAlsoProps } from './buildProps';
|
|
1
|
+
export { buildUseStyling } from './buildUseStyling.ts';
|
|
2
|
+
export type { ThemeHelper, UseStyling, UseStylingOptions } from './buildUseStyling.ts';
|
|
3
|
+
export { buildProps, refinePropsFunctions } from './buildProps.ts';
|
|
4
|
+
export type { BuildPropsBase, BuildSlotProps, RefinableBuildPropsBase, RefineFunctionBase, TokensThatAreAlsoProps } from './buildProps.ts';
|
|
5
5
|
export type { HasLayer, TokenSettings, TokensFromTheme } from '@fluentui-react-native/use-tokens';
|
|
6
6
|
export { applyTokenLayers } from '@fluentui-react-native/use-tokens';
|
|
@@ -5,9 +5,9 @@ import { Text, View } from 'react-native';
|
|
|
5
5
|
|
|
6
6
|
import * as renderer from 'react-test-renderer';
|
|
7
7
|
|
|
8
|
-
import { buildProps } from './buildProps';
|
|
9
|
-
import type { ThemeHelper, UseStylingOptions } from './buildUseStyling';
|
|
10
|
-
import { buildUseStyling } from './buildUseStyling';
|
|
8
|
+
import { buildProps } from './buildProps.ts';
|
|
9
|
+
import type { ThemeHelper, UseStylingOptions } from './buildUseStyling.ts';
|
|
10
|
+
import { buildUseStyling } from './buildUseStyling.ts';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Sample super simple theming implementation, shared by all the samples. This is intended to be illustrative,
|
package/babel.config.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = require('@fluentui-react-native/babel-config');
|
package/eslint.config.js
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import type { GetMemoValue } from '@fluentui-react-native/framework-base';
|
|
2
|
-
/**
|
|
3
|
-
* Informs the framework of any tokens that also appear as props for the component.
|
|
4
|
-
* - 'none' | undefined : this means no properties should be treated as tokens, the tokens that will be passed in to buildProps
|
|
5
|
-
* will not be patched from props. This also means that for a given theme + state the tokens will not
|
|
6
|
-
* change. As a result this is the most efficient mode.
|
|
7
|
-
* - 'all' : treat all props as tokens. Props will be spread into the tokens before the slot functions are called
|
|
8
|
-
* - array of keys : this is the discrete list of tokens which also appear in props
|
|
9
|
-
*/
|
|
10
|
-
export type TokensThatAreAlsoProps<TTokens> = (keyof TTokens)[] | 'all' | 'none';
|
|
11
|
-
/**
|
|
12
|
-
* Raw format for producing styles in a functional manner. These can only depend on tokens or theme as inputs.
|
|
13
|
-
* - tokens: these will be produced from the theme and component constants, then they will be potentially
|
|
14
|
-
* be modified by the props. See the TokensThatAreAlsoProps type for more details.
|
|
15
|
-
* - theme: the theme is provided for reference
|
|
16
|
-
* The provided
|
|
17
|
-
* cache will be scoped to the theme, slot, and tokens that are coming out of the theme.
|
|
18
|
-
*/
|
|
19
|
-
export type BuildPropsBase<TProps, TTokens, TTheme> = (tokens: TTokens, theme: TTheme, cache: GetMemoValue) => Partial<TProps>;
|
|
20
|
-
/**
|
|
21
|
-
* A refine function allows style functions to be updated based on tokens that are also props. Only those tokens that are also
|
|
22
|
-
* props need to be considered as a key for caching
|
|
23
|
-
*/
|
|
24
|
-
export type RefineFunctionBase<TProps, TTokens, TTheme> = (mask?: TokensThatAreAlsoProps<TTokens>) => BuildPropsBase<TProps, TTokens, TTheme>;
|
|
25
|
-
/**
|
|
26
|
-
* Signature for a style function which can be optionally refined by the styling hook if prop masks are provided
|
|
27
|
-
*/
|
|
28
|
-
export type RefinableBuildPropsBase<TProps, TTokens, TTheme> = BuildPropsBase<TProps, TTokens, TTheme> & {
|
|
29
|
-
refine?: RefineFunctionBase<TProps, TTokens, TTheme>;
|
|
30
|
-
};
|
|
31
|
-
/**
|
|
32
|
-
* Style functions can be plain functions, refinable functions, or just raw props
|
|
33
|
-
*/
|
|
34
|
-
export type BuildSlotProps<TSlotProps, TTokens, TTheme> = {
|
|
35
|
-
[K in keyof TSlotProps]?: RefinableBuildPropsBase<TSlotProps[K], TTokens, TTheme> | TSlotProps[K];
|
|
36
|
-
};
|
|
37
|
-
/**
|
|
38
|
-
* Standard wrapper for a function that provides props for a component based on tokens and theme.
|
|
39
|
-
*
|
|
40
|
-
* @param fn - function which does the work of producing props for the tokens and theme provided
|
|
41
|
-
* @param keys - which token properties are used by this style, this determines the keys to use for caching
|
|
42
|
-
*/
|
|
43
|
-
export declare function buildProps<TProps, TTokens, TTheme>(fn: (tokens: TTokens, theme: TTheme) => TProps, keys?: (keyof TTokens)[]): RefinableBuildPropsBase<TProps, TTokens, TTheme>;
|
|
44
|
-
/**
|
|
45
|
-
* Utility function to check the type and refinement capabilities of a styleFunction and refine it if appropriate
|
|
46
|
-
*
|
|
47
|
-
* @param fn - function or props to potentially refine
|
|
48
|
-
* @param mask - prop mask to use for refinement
|
|
49
|
-
*/
|
|
50
|
-
export declare function refinePropsFunctions<TSlotProps, TTokens, TTheme>(styles: BuildSlotProps<TSlotProps, TTokens, TTheme>, mask: TokensThatAreAlsoProps<TTokens>): BuildSlotProps<TSlotProps, TTokens, TTheme>;
|
|
51
|
-
//# sourceMappingURL=buildProps.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"buildProps.d.ts","sourceRoot":"","sources":["../src/buildProps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAE1E;;;;;;;GAOG;AACH,MAAM,MAAM,sBAAsB,CAAC,OAAO,IAAI,CAAC,MAAM,OAAO,CAAC,EAAE,GAAG,KAAK,GAAG,MAAM,CAAC;AAEjF;;;;;;;GAOG;AACH,MAAM,MAAM,cAAc,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;AAE/H;;;GAGG;AACH,MAAM,MAAM,kBAAkB,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,IAAI,CACxD,IAAI,CAAC,EAAE,sBAAsB,CAAC,OAAO,CAAC,KACnC,cAAc,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;AAE7C;;GAEG;AACH,MAAM,MAAM,uBAAuB,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,IAAI,cAAc,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,GAAG;IACvG,MAAM,CAAC,EAAE,kBAAkB,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;CACtD,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,cAAc,CAAC,UAAU,EAAE,OAAO,EAAE,MAAM,IAAI;KACvD,CAAC,IAAI,MAAM,UAAU,CAAC,CAAC,EAAE,uBAAuB,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC;CAClG,CAAC;AAqBF;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAChD,EAAE,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,KAAK,MAAM,EAC9C,IAAI,CAAC,EAAE,CAAC,MAAM,OAAO,CAAC,EAAE,GACvB,uBAAuB,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,CAclD;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,OAAO,EAAE,MAAM,EAC9D,MAAM,EAAE,cAAc,CAAC,UAAU,EAAE,OAAO,EAAE,MAAM,CAAC,EACnD,IAAI,EAAE,sBAAsB,CAAC,OAAO,CAAC,GACpC,cAAc,CAAC,UAAU,EAAE,OAAO,EAAE,MAAM,CAAC,CAQ7C"}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.buildProps = buildProps;
|
|
4
|
-
exports.refinePropsFunctions = refinePropsFunctions;
|
|
5
|
-
function cacheStyleClosure(fn, keys) {
|
|
6
|
-
return (tokens, theme, cache) => cache(() => fn(tokens, theme), (keys || []).map((key) => tokens[key]))[0];
|
|
7
|
-
}
|
|
8
|
-
function refineKeys(keys, mask) {
|
|
9
|
-
return typeof mask === 'object' && Array.isArray(mask)
|
|
10
|
-
? keys.filter((key) => mask.findIndex((val) => val === key) !== -1)
|
|
11
|
-
: mask
|
|
12
|
-
? keys
|
|
13
|
-
: [];
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Standard wrapper for a function that provides props for a component based on tokens and theme.
|
|
17
|
-
*
|
|
18
|
-
* @param fn - function which does the work of producing props for the tokens and theme provided
|
|
19
|
-
* @param keys - which token properties are used by this style, this determines the keys to use for caching
|
|
20
|
-
*/
|
|
21
|
-
function buildProps(fn, keys) {
|
|
22
|
-
// wrap the provided function in the standard caching layer, basing it upon the provided keys
|
|
23
|
-
const result = cacheStyleClosure(fn, keys);
|
|
24
|
-
// if results are being cached on keys, provide the ability to refine the function if a prop mask is specified
|
|
25
|
-
result.refine =
|
|
26
|
-
keys && keys.length > 0
|
|
27
|
-
? (mask) => {
|
|
28
|
-
return cacheStyleClosure(fn, refineKeys(keys, mask));
|
|
29
|
-
}
|
|
30
|
-
: undefined;
|
|
31
|
-
// return the style function decorated with the refine function
|
|
32
|
-
return result;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Utility function to check the type and refinement capabilities of a styleFunction and refine it if appropriate
|
|
36
|
-
*
|
|
37
|
-
* @param fn - function or props to potentially refine
|
|
38
|
-
* @param mask - prop mask to use for refinement
|
|
39
|
-
*/
|
|
40
|
-
function refinePropsFunctions(styles, mask) {
|
|
41
|
-
const result = {};
|
|
42
|
-
for (const key of Object.keys(styles)) {
|
|
43
|
-
const refine = typeof styles[key] === 'function' && styles[key].refine;
|
|
44
|
-
result[key] = refine ? refine(mask) : styles[key];
|
|
45
|
-
}
|
|
46
|
-
return result;
|
|
47
|
-
}
|
|
48
|
-
//# sourceMappingURL=buildProps.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"buildProps.js","sourceRoot":"","sources":["../src/buildProps.ts"],"names":[],"mappings":";;;;AA4CA,SAAS,iBAAiB,CACxB,EAA8C,EA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GAAG,EAAE,CAAC;IAClB,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;QACtC,MAAM,MAAM,GACV,OAAO,MAAM,CAAC,GAAG,CAAC,KAAK,UAAU,IAAK,MAAM,CAAC,GAAG,CAA4E,CAAC,MAAM,CAAC;QACtI,MAAM,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACpD,CAAC;IACD,OAAO,MAAM,CAAC;AAAA,CACf"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"buildProps.test.d.ts","sourceRoot":"","sources":["../src/buildProps.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const framework_base_1 = require("@fluentui-react-native/framework-base");
|
|
4
|
-
const buildProps_1 = require("./buildProps");
|
|
5
|
-
const theme = { foo: 'foo', bar: 'bar' };
|
|
6
|
-
let instanceCount = 0;
|
|
7
|
-
function munge(tokens, theme) {
|
|
8
|
-
return {
|
|
9
|
-
...theme,
|
|
10
|
-
...tokens,
|
|
11
|
-
instance: instanceCount++,
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
describe('props function tests', () => {
|
|
15
|
-
test('basic build props function caches as expected', () => {
|
|
16
|
-
const cache = (0, framework_base_1.getMemoCache)();
|
|
17
|
-
const styleFn = (0, buildProps_1.buildProps)(munge, ['a', 'b']);
|
|
18
|
-
const p1 = styleFn({ a: 'a', b: 'b', c: 'c' }, theme, cache);
|
|
19
|
-
expect(styleFn({ a: 'a', b: 'b', c: 'foo' }, theme, cache)).toBe(p1);
|
|
20
|
-
const p2 = styleFn({ a: 'b', b: 'b' }, theme, cache);
|
|
21
|
-
expect(p2).not.toBe(p1);
|
|
22
|
-
expect(styleFn({ a: 'b', b: 'b', c: 'bar' }, theme, cache)).toBe(p2);
|
|
23
|
-
});
|
|
24
|
-
test('build props function refinement works with explicit keys', () => {
|
|
25
|
-
const cache = (0, framework_base_1.getMemoCache)();
|
|
26
|
-
const styleFn = (0, buildProps_1.buildProps)(munge, ['a', 'b', 'c', 'd']);
|
|
27
|
-
const refinedFn = styleFn.refine(['a', 'b']);
|
|
28
|
-
const t1 = { a: 'a', b: 'b', c: 'c', d: 'd' };
|
|
29
|
-
const t2 = { a: 'a', b: 'b', c: 'foo', d: 'bar' };
|
|
30
|
-
const p1 = styleFn(t1, theme, cache);
|
|
31
|
-
const p2 = styleFn(t2, theme, cache);
|
|
32
|
-
expect(p2).not.toBe(p1);
|
|
33
|
-
const rp1 = refinedFn(t1, theme, cache);
|
|
34
|
-
const rp2 = refinedFn(t2, theme, cache);
|
|
35
|
-
expect(rp2).toBe(rp1);
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
|
-
//# sourceMappingURL=buildProps.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"buildProps.test.js","sourceRoot":"","sources":["../src/buildProps.test.ts"],"names":[],"mappings":";;AAAA,0EAAqE;AAErE,6CAA0C;AAM1C,MAAM,KAAK,GAAW,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC;AAEjD,IAAI,aAAa,GAAG,CAAC,CAAC;AAEtB,SAAS,KAAK,CAAC,MAAe,EAAE,KAAa,EAAU;IACrD,OAAO;QACL,GAAG,KAAK;QACR,GAAG,MAAM;QACT,QAAQ,EAAE,aAAa,EAAE;KAC1B,CAAC;AAAA,CACH;AAED,QAAQ,CAAC,sBAAsB,EAAE,GAAG,EAAE,CAAC;IACrC,IAAI,CAAC,+CAA+C,EAAE,GAAG,EAAE,CAAC;QAC1D,MAAM,KAAK,GAAG,IAAA,6BAAY,GAAE,CAAC;QAC7B,MAAM,OAAO,GAAG,IAAA,uBAAU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GAAG,EAAE,CAAC;QAC9C,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC;QAElD,MAAM,EAAE,GAAG,OAAO,CAAC,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;QACrC,MAAM,EAAE,GAAG,OAAO,CAAC,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;QACrC,MAAM,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAExB,MAAM,GAAG,GAAG,SAAS,CAAC,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;QACxC,MAAM,GAAG,GAAG,SAAS,CAAC,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;QACxC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAAA,CACvB,CAAC,CAAC;AAAA,CACJ,CAAC,CAAC"}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import type { HasLayer, TokenSettings } from '@fluentui-react-native/use-tokens';
|
|
2
|
-
import type { TokensThatAreAlsoProps, BuildSlotProps } from './buildProps';
|
|
3
|
-
/**
|
|
4
|
-
* Options used to build up a useStyling hook
|
|
5
|
-
*/
|
|
6
|
-
export type UseStylingOptions<TProps, TSlotProps, TTokens, TTheme> = {
|
|
7
|
-
/**
|
|
8
|
-
* Baseline tokens for this component
|
|
9
|
-
*/
|
|
10
|
-
tokens?: TokenSettings<TTokens, TTheme>[];
|
|
11
|
-
/**
|
|
12
|
-
* States that might be applied for the component like disabled or hovered, these should be listed
|
|
13
|
-
* in the order that they should be applied
|
|
14
|
-
*/
|
|
15
|
-
states?: (keyof TTokens)[];
|
|
16
|
-
/**
|
|
17
|
-
* Functions which build up the props for each slot
|
|
18
|
-
*/
|
|
19
|
-
slotProps?: BuildSlotProps<TSlotProps, TTokens, TTheme>;
|
|
20
|
-
/**
|
|
21
|
-
* Which props should be considered to be tokens.
|
|
22
|
-
* - If an array of keys this will ensure these props are promoted to tokens
|
|
23
|
-
* - If true all props will be added to tokens, if false or not specified no props will be treated as tokens
|
|
24
|
-
*/
|
|
25
|
-
tokensThatAreAlsoProps?: TokensThatAreAlsoProps<TTokens>;
|
|
26
|
-
/** purely used to make type inferencing work correctly so the hook builder can pick up TProps from this type */
|
|
27
|
-
_propsType?: TProps;
|
|
28
|
-
};
|
|
29
|
-
/**
|
|
30
|
-
* Signature for the use styling hook
|
|
31
|
-
*/
|
|
32
|
-
export type UseStyling<TProps, TSlotProps> = (props: TProps, lookup?: HasLayer) => TSlotProps;
|
|
33
|
-
/**
|
|
34
|
-
* Helper object which injects theme specific functionality
|
|
35
|
-
*/
|
|
36
|
-
export type ThemeHelper<TTheme> = {
|
|
37
|
-
/** query the theme from the context, or from a global if your system doesn't use theming */
|
|
38
|
-
useTheme: () => TTheme;
|
|
39
|
-
/** lookup info for the component in the theme */
|
|
40
|
-
getComponentInfo: (theme: TTheme, name: string) => any;
|
|
41
|
-
};
|
|
42
|
-
/**
|
|
43
|
-
* Construct a useStyling hook which returns styled slot props based on props and tokens defined in options and in the theme
|
|
44
|
-
*
|
|
45
|
-
* @param options - options which drive behavior for the generated styling hook
|
|
46
|
-
* @param themeHelper - injected theme functionality
|
|
47
|
-
*/
|
|
48
|
-
export declare function buildUseStyling<TProps, TSlotProps, TTokens, TTheme>(options: UseStylingOptions<TProps, TSlotProps, TTokens, TTheme>, themeHelper: ThemeHelper<TTheme>): UseStyling<TProps, TSlotProps>;
|
|
49
|
-
//# sourceMappingURL=buildUseStyling.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"buildUseStyling.d.ts","sourceRoot":"","sources":["../src/buildUseStyling.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;A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
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.buildUseStyling = buildUseStyling;
|
|
4
|
-
const use_tokens_1 = require("@fluentui-react-native/use-tokens");
|
|
5
|
-
const buildProps_1 = require("./buildProps");
|
|
6
|
-
/**
|
|
7
|
-
* Produce the final slot props for the styled hook
|
|
8
|
-
*
|
|
9
|
-
* @param styles - refined style functions or props to use for processing
|
|
10
|
-
* @param tokens - token inputs for the style functions
|
|
11
|
-
* @param theme - theme to resolve against
|
|
12
|
-
* @param cache - cache to use for the base of slot caching
|
|
13
|
-
*/
|
|
14
|
-
function resolveToSlotProps(styles, tokens, theme, cache) {
|
|
15
|
-
const slotProps = {};
|
|
16
|
-
Object.keys(styles).forEach((key) => {
|
|
17
|
-
const style = styles[key];
|
|
18
|
-
slotProps[key] = typeof style === 'function' ? style(tokens, theme, cache(null, [key])[1]) : style;
|
|
19
|
-
});
|
|
20
|
-
return slotProps;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Construct a useStyling hook which returns styled slot props based on props and tokens defined in options and in the theme
|
|
24
|
-
*
|
|
25
|
-
* @param options - options which drive behavior for the generated styling hook
|
|
26
|
-
* @param themeHelper - injected theme functionality
|
|
27
|
-
*/
|
|
28
|
-
function buildUseStyling(options, themeHelper) {
|
|
29
|
-
// create a cache instance for this use styling implementation
|
|
30
|
-
const { useTheme, getComponentInfo } = themeHelper;
|
|
31
|
-
const { tokens, tokensThatAreAlsoProps: tokenProps } = options;
|
|
32
|
-
const styles = (0, buildProps_1.refinePropsFunctions)(options.slotProps || {}, tokenProps);
|
|
33
|
-
const useTokens = (0, use_tokens_1.buildUseTokens)(getComponentInfo, ...tokens);
|
|
34
|
-
return (props, lookup) => {
|
|
35
|
-
// query the theme
|
|
36
|
-
const theme = useTheme();
|
|
37
|
-
// get the merged tokens from the theme
|
|
38
|
-
let [mergedTokens, cache] = useTokens(theme);
|
|
39
|
-
// resolve overrides as appropriate
|
|
40
|
-
if (options.states) {
|
|
41
|
-
[mergedTokens, cache] = (0, use_tokens_1.applyTokenLayers)(mergedTokens, options.states, cache, lookup || ((val) => props[val]));
|
|
42
|
-
}
|
|
43
|
-
// now resolve tokens
|
|
44
|
-
if (typeof tokenProps === 'object' && Array.isArray(tokenProps)) {
|
|
45
|
-
[mergedTokens, cache] = (0, use_tokens_1.applyPropsToTokens)(props, mergedTokens, cache, tokenProps);
|
|
46
|
-
}
|
|
47
|
-
else if (tokenProps === 'all') {
|
|
48
|
-
mergedTokens = { ...mergedTokens, ...props };
|
|
49
|
-
}
|
|
50
|
-
// finally produce slotProps from calling the style functions on each entry
|
|
51
|
-
return resolveToSlotProps(styles, mergedTokens, theme, cache);
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
//# sourceMappingURL=buildUseStyling.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"buildUseStyling.js","sourceRoot":"","sources":["../src/buildUseStyling.ts"],"names":[],"mappings":";;;AAEA,kEAAyG;AAGzG,6CAAoD;AAiDpD;;;;;;;GAOG;AACH,SAAS,kBAAkB,CACzB,MAAmD,EACnD,MAAe,EACf,KAAa,EACb,KAAiC,EACrB;IACZ,MAAM,SAAS,GAAG,EAAE,CAAC;IACrB,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC;QACnC,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;QAC1B,SAAS,CAAC,GAAG,CAAC,GAAG,OAAO,KAAK,KAAK,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;IAAA,CACpG,CAAC,CAAC;IACH,OAAO,SAAuB,CAAC;AAAA,CAChC;AAED;;;;;GAKG;AACH,yBACE,OAA+D,EAC/D,WAAgC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,YAAY,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;IAAA,CAC/D,CAAC;AAAA,CACH"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"buildUseStyling.test.d.ts","sourceRoot":"","sources":["../src/buildUseStyling.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const framework_base_1 = require("@fluentui-react-native/framework-base");
|
|
4
|
-
const buildProps_1 = require("./buildProps");
|
|
5
|
-
const buildUseStyling_1 = require("./buildUseStyling");
|
|
6
|
-
let lastInstance = 0;
|
|
7
|
-
const baseTokens = {
|
|
8
|
-
a: 'a-base',
|
|
9
|
-
b: 'b-base',
|
|
10
|
-
c: 'c-base',
|
|
11
|
-
hover: {
|
|
12
|
-
c: 'c-base-hover',
|
|
13
|
-
},
|
|
14
|
-
press: {
|
|
15
|
-
c: 'c-base-press',
|
|
16
|
-
},
|
|
17
|
-
};
|
|
18
|
-
const defaultTheme = {
|
|
19
|
-
vals: {
|
|
20
|
-
foo: 'foo',
|
|
21
|
-
bar: 'bar',
|
|
22
|
-
},
|
|
23
|
-
components: {
|
|
24
|
-
uno: {
|
|
25
|
-
a: 'uno-a',
|
|
26
|
-
c: 'uno-c',
|
|
27
|
-
},
|
|
28
|
-
dos: {
|
|
29
|
-
b: 'dos-b',
|
|
30
|
-
c: 'dos-c',
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
|
-
};
|
|
34
|
-
const themeHelper = {
|
|
35
|
-
useTheme: () => defaultTheme,
|
|
36
|
-
getComponentInfo: (theme, name) => theme.components[name],
|
|
37
|
-
};
|
|
38
|
-
const slotFn1 = (tokens, theme) => {
|
|
39
|
-
return {
|
|
40
|
-
style: {
|
|
41
|
-
a: tokens.a,
|
|
42
|
-
b: tokens.b,
|
|
43
|
-
c: tokens.c,
|
|
44
|
-
...theme.vals,
|
|
45
|
-
instance: lastInstance++,
|
|
46
|
-
},
|
|
47
|
-
};
|
|
48
|
-
};
|
|
49
|
-
const extraCache = (0, framework_base_1.getMemoCache)();
|
|
50
|
-
const slotFn2 = (tokens) => {
|
|
51
|
-
return extraCache(() => ({
|
|
52
|
-
style: {
|
|
53
|
-
a: tokens.a,
|
|
54
|
-
b: tokens.b,
|
|
55
|
-
instance: lastInstance++,
|
|
56
|
-
},
|
|
57
|
-
}), [tokens.a, tokens.b])[0];
|
|
58
|
-
};
|
|
59
|
-
const baseOptions = {
|
|
60
|
-
tokens: [
|
|
61
|
-
baseTokens,
|
|
62
|
-
'uno',
|
|
63
|
-
(theme) => ({
|
|
64
|
-
b: theme.vals.foo,
|
|
65
|
-
}),
|
|
66
|
-
],
|
|
67
|
-
states: ['hover', 'press'],
|
|
68
|
-
slotProps: {
|
|
69
|
-
slot1: {
|
|
70
|
-
style: {
|
|
71
|
-
instance: lastInstance++,
|
|
72
|
-
},
|
|
73
|
-
},
|
|
74
|
-
slot2: (0, buildProps_1.buildProps)(slotFn1, ['a', 'b', 'c']),
|
|
75
|
-
slot3: slotFn2,
|
|
76
|
-
},
|
|
77
|
-
tokensThatAreAlsoProps: ['b'],
|
|
78
|
-
};
|
|
79
|
-
describe('useStyling test suite', () => {
|
|
80
|
-
test('basic built hook', () => {
|
|
81
|
-
const useStyling = (0, buildUseStyling_1.buildUseStyling)(baseOptions, themeHelper);
|
|
82
|
-
const slotProps = useStyling({});
|
|
83
|
-
const slotProps2 = useStyling({ p1: 2, p2: 'bar' });
|
|
84
|
-
Object.keys(slotProps).forEach((key) => {
|
|
85
|
-
expect(slotProps[key]).toBe(slotProps2[key]);
|
|
86
|
-
});
|
|
87
|
-
});
|
|
88
|
-
});
|
|
89
|
-
//# sourceMappingURL=buildUseStyling.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"buildUseStyling.test.js","sourceRoot":"","sources":["../src/buildUseStyling.test.ts"],"names":[],"mappings":";;AAAA,0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AAC;AAAA,CACJ,CAAC,CAAC"}
|
package/lib-commonjs/index.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export { buildUseStyling } from './buildUseStyling';
|
|
2
|
-
export type { ThemeHelper, UseStyling, UseStylingOptions } from './buildUseStyling';
|
|
3
|
-
export { buildProps, refinePropsFunctions } from './buildProps';
|
|
4
|
-
export type { BuildPropsBase, BuildSlotProps, RefinableBuildPropsBase, RefineFunctionBase, TokensThatAreAlsoProps } from './buildProps';
|
|
5
|
-
export type { HasLayer, TokenSettings, TokensFromTheme } from '@fluentui-react-native/use-tokens';
|
|
6
|
-
export { applyTokenLayers } from '@fluentui-react-native/use-tokens';
|
|
7
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACpF,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAChE,YAAY,EAAE,cAAc,EAAE,cAAc,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AACxI,YAAY,EAAE,QAAQ,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAClG,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC"}
|
package/lib-commonjs/index.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.applyTokenLayers = exports.refinePropsFunctions = exports.buildProps = exports.buildUseStyling = void 0;
|
|
4
|
-
const buildUseStyling_1 = require("./buildUseStyling");
|
|
5
|
-
Object.defineProperty(exports, "buildUseStyling", { enumerable: true, get: function () { return buildUseStyling_1.buildUseStyling; } });
|
|
6
|
-
const buildProps_1 = require("./buildProps");
|
|
7
|
-
Object.defineProperty(exports, "buildProps", { enumerable: true, get: function () { return buildProps_1.buildProps; } });
|
|
8
|
-
Object.defineProperty(exports, "refinePropsFunctions", { enumerable: true, get: function () { return buildProps_1.refinePropsFunctions; } });
|
|
9
|
-
const use_tokens_1 = require("@fluentui-react-native/use-tokens");
|
|
10
|
-
Object.defineProperty(exports, "applyTokenLayers", { enumerable: true, get: function () { return use_tokens_1.applyTokenLayers; } });
|
|
11
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,uDAAoD;AAA3C,kHAAA,eAAe,OAAA;AAExB,6CAAgE;AAAvD,wGAAA,UAAU,OAAA;AAAE,kHAAA,oBAAoB,OAAA;AAGzC,kEAAqE;AAA5D,8GAAA,gBAAgB,OAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useStyling.samples.test.d.ts","sourceRoot":"","sources":["../src/useStyling.samples.test.tsx"],"names":[],"mappings":""}
|