@fluentui-react-native/use-styling 0.13.11 → 0.14.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.
Files changed (42) hide show
  1. package/CHANGELOG.json +15 -0
  2. package/CHANGELOG.md +46 -1
  3. package/README.md +1 -1
  4. package/babel.config.js +1 -1
  5. package/lib/buildProps.d.ts +14 -6
  6. package/lib/buildProps.js +28 -24
  7. package/lib/buildProps.js.map +1 -1
  8. package/lib/buildProps.test.d.ts +1 -1
  9. package/lib/buildProps.test.js +28 -28
  10. package/lib/buildProps.test.js.map +1 -1
  11. package/lib/buildUseStyling.d.ts +30 -27
  12. package/lib/buildUseStyling.js +30 -31
  13. package/lib/buildUseStyling.js.map +1 -1
  14. package/lib/buildUseStyling.test.d.ts +1 -1
  15. package/lib/buildUseStyling.test.js +67 -64
  16. package/lib/buildUseStyling.test.js.map +1 -1
  17. package/lib/index.d.ts +1 -1
  18. package/lib/index.js +1 -1
  19. package/lib/useStyling.samples.test.d.ts +1 -1
  20. package/lib/useStyling.samples.test.js +171 -148
  21. package/lib/useStyling.samples.test.js.map +1 -1
  22. package/lib-commonjs/buildProps.d.ts +14 -6
  23. package/lib-commonjs/buildProps.js +32 -29
  24. package/lib-commonjs/buildProps.js.map +1 -1
  25. package/lib-commonjs/buildProps.test.d.ts +1 -1
  26. package/lib-commonjs/buildProps.test.js +32 -32
  27. package/lib-commonjs/buildProps.test.js.map +1 -1
  28. package/lib-commonjs/buildUseStyling.d.ts +30 -27
  29. package/lib-commonjs/buildUseStyling.js +35 -37
  30. package/lib-commonjs/buildUseStyling.js.map +1 -1
  31. package/lib-commonjs/buildUseStyling.test.d.ts +1 -1
  32. package/lib-commonjs/buildUseStyling.test.js +72 -69
  33. package/lib-commonjs/buildUseStyling.test.js.map +1 -1
  34. package/lib-commonjs/index.d.ts +1 -1
  35. package/lib-commonjs/index.js +30 -10
  36. package/lib-commonjs/index.js.map +1 -1
  37. package/lib-commonjs/useStyling.samples.test.d.ts +1 -1
  38. package/lib-commonjs/useStyling.samples.test.js +227 -155
  39. package/lib-commonjs/useStyling.samples.test.js.map +1 -1
  40. package/package.json +50 -44
  41. package/src/buildProps.ts +2 -2
  42. package/src/useStyling.samples.test.tsx +23 -14
@@ -4,27 +4,27 @@ import type { TokensThatAreAlsoProps, BuildSlotProps } from './buildProps';
4
4
  * Options used to build up a useStyling hook
5
5
  */
6
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;
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
28
  };
29
29
  /**
30
30
  * Signature for the use styling hook
@@ -34,10 +34,10 @@ export type UseStyling<TProps, TSlotProps> = (props: TProps, lookup?: HasLayer)
34
34
  * Helper object which injects theme specific functionality
35
35
  */
36
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;
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
41
  };
42
42
  /**
43
43
  * Construct a useStyling hook which returns styled slot props based on props and tokens defined in options and in the theme
@@ -45,5 +45,8 @@ export type ThemeHelper<TTheme> = {
45
45
  * @param options - options which drive behavior for the generated styling hook
46
46
  * @param themeHelper - injected theme functionality
47
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
48
+ export declare function buildUseStyling<TProps, TSlotProps, TTokens, TTheme>(
49
+ options: UseStylingOptions<TProps, TSlotProps, TTokens, TTheme>,
50
+ themeHelper: ThemeHelper<TTheme>,
51
+ ): UseStyling<TProps, TSlotProps>;
52
+ //# sourceMappingURL=buildUseStyling.d.ts.map
@@ -1,8 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.buildUseStyling = void 0;
4
- const use_tokens_1 = require("@fluentui-react-native/use-tokens");
5
- const buildProps_1 = require("./buildProps");
1
+ 'use strict';
2
+ 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
6
  /**
7
7
  * Produce the final slot props for the styled hook
8
8
  *
@@ -12,12 +12,12 @@ const buildProps_1 = require("./buildProps");
12
12
  * @param cache - cache to use for the base of slot caching
13
13
  */
14
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;
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
21
  }
22
22
  /**
23
23
  * Construct a useStyling hook which returns styled slot props based on props and tokens defined in options and in the theme
@@ -26,30 +26,28 @@ function resolveToSlotProps(styles, tokens, theme, cache) {
26
26
  * @param themeHelper - injected theme functionality
27
27
  */
28
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
- };
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
+ } else if (tokenProps === 'all') {
47
+ mergedTokens = { ...mergedTokens, ...props };
48
+ }
49
+ // finally produce slotProps from calling the style functions on each entry
50
+ return resolveToSlotProps(styles, mergedTokens, theme, cache);
51
+ };
53
52
  }
54
- exports.buildUseStyling = buildUseStyling;
55
- //# sourceMappingURL=buildUseStyling.js.map
53
+ //# sourceMappingURL=buildUseStyling.js.map
@@ -1 +1 @@
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;IAEjC,MAAM,SAAS,GAAG,EAAE,CAAC;IACrB,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;QAClC,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;QAC1B,SAAS,CAAC,GAAG,CAAC,GAAG,OA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ts.map
@@ -1,89 +1,92 @@
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");
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
6
  let lastInstance = 0;
7
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
- },
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
17
  };
18
18
  const defaultTheme = {
19
- vals: {
20
- foo: 'foo',
21
- bar: 'bar',
19
+ vals: {
20
+ foo: 'foo',
21
+ bar: 'bar',
22
+ },
23
+ components: {
24
+ uno: {
25
+ a: 'uno-a',
26
+ c: 'uno-c',
22
27
  },
23
- components: {
24
- uno: {
25
- a: 'uno-a',
26
- c: 'uno-c',
27
- },
28
- dos: {
29
- b: 'dos-b',
30
- c: 'dos-c',
31
- },
28
+ dos: {
29
+ b: 'dos-b',
30
+ c: 'dos-c',
32
31
  },
32
+ },
33
33
  };
34
34
  const themeHelper = {
35
- useTheme: () => defaultTheme,
36
- getComponentInfo: (theme, name) => theme.components[name],
35
+ useTheme: () => defaultTheme,
36
+ getComponentInfo: (theme, name) => theme.components[name],
37
37
  };
38
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
- };
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
48
  };
49
49
  const extraCache = (0, framework_base_1.getMemoCache)();
50
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];
51
+ return extraCache(
52
+ () => ({
53
+ style: {
54
+ a: tokens.a,
55
+ b: tokens.b,
56
+ instance: lastInstance++,
57
+ },
58
+ }),
59
+ [tokens.a, tokens.b],
60
+ )[0];
58
61
  };
59
62
  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,
63
+ tokens: [
64
+ baseTokens,
65
+ 'uno',
66
+ (theme) => ({
67
+ b: theme.vals.foo,
68
+ }),
69
+ ],
70
+ states: ['hover', 'press'],
71
+ slotProps: {
72
+ slot1: {
73
+ style: {
74
+ instance: lastInstance++,
75
+ },
76
76
  },
77
- tokensThatAreAlsoProps: ['b'],
77
+ slot2: (0, buildProps_1.buildProps)(slotFn1, ['a', 'b', 'c']),
78
+ slot3: slotFn2,
79
+ },
80
+ tokensThatAreAlsoProps: ['b'],
78
81
  };
79
82
  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
- });
83
+ test('basic built hook', () => {
84
+ const useStyling = (0, buildUseStyling_1.buildUseStyling)(baseOptions, themeHelper);
85
+ const slotProps = useStyling({});
86
+ const slotProps2 = useStyling({ p1: 2, p2: 'bar' });
87
+ Object.keys(slotProps).forEach((key) => {
88
+ expect(slotProps[key]).toBe(slotProps2[key]);
87
89
  });
90
+ });
88
91
  });
89
- //# sourceMappingURL=buildUseStyling.test.js.map
92
+ //# sourceMappingURL=buildUseStyling.test.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"buildUseStyling.test.js","sourceRoot":"","sources":["../src/buildUseStyling.test.ts"],"names":[],"mappings":";;AAAA,0EAAqE;AAErE,6CAA0C;AAE1C,uDAAoD;AAEpD,IAAI,YAAY,GAAG,CAAC,CAAC;AAUrB,MAAM,UAAU,GAAW;IACzB,CAAC,EAAE,QAAQ;IACX,CAAC,EAAE,QAAQ;IACX,CAAC,EAAE,QAAQ;IACX,KAAK,EAAE;QACL,CAAC,EAAE,cAAc;KAClB;IACD,KAAK,EAAE;QACL,CAAC,EAAE,cAAc;KAClB;CACF,CAAC;AAYF,MAAM,YAAY,GAAU;IAC1B,IAAI,EAAE;QACJ,GAAG,EAAE,KAAK;QACV,GAAG,EAAE,KAAK;KACX;IACD,UAAU,EAAE;QACV,GAAG,EAAE;YACH,CAAC,EAAE,OAAO;YACV,CAAC,EAAE,OAAO;SACX;QACD,GAAG,EAAE;YACH,CAAC,EAAE,OAAO;YACV,CAAC,EAAE,OAAO;SACX;KACF;CACF,CAAC;AAEF,MAAM,WAAW,GAAuB;IACtC,QAAQ,EAAE,GAAG,EAAE,CAAC,YAAY;IAC5B,gBAAgB,EAAE,CAAC,KAAY,EAAE,IAAY,EAAE,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC;CACzE,CAAC;AAcF,MAAM,OAAO,GAAG,CAAC,MAAc,EAAE,KAAY,EAAE,EAAE;IAC/C,OAAO;QACL,KAAK,EAAE;YACL,CAAC,EAAE,MAAM,CAAC,CAAC;YACX,CAAC,EAAE,MAAM,CAAC,CAAC;YACX,CAAC,EAAE,MAAM,CAAC,C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AAW,CAAC,CAAC;QAC7D,MAAM,SAAS,GAAG,UAAU,CAAC,EAAE,CAAC,CAAC;QACjC,MAAM,UAAU,GAAG,UAAU,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;QACpD,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC;YACtC,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC;QAAA,CAC9C,CAAC,CAAC;IAAA,CACJ,CAAC,CAAC;AAAA,CACJ,CAAC,CAAC"}
@@ -4,4 +4,4 @@ export { buildProps, refinePropsFunctions } from './buildProps';
4
4
  export type { BuildPropsBase, BuildSlotProps, RefinableBuildPropsBase, RefineFunctionBase, TokensThatAreAlsoProps } from './buildProps';
5
5
  export type { HasLayer, TokenSettings, TokensFromTheme } from '@fluentui-react-native/use-tokens';
6
6
  export { applyTokenLayers } from '@fluentui-react-native/use-tokens';
7
- //# sourceMappingURL=index.d.ts.map
7
+ //# sourceMappingURL=index.d.ts.map
@@ -1,11 +1,31 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ 'use strict';
2
+ Object.defineProperty(exports, '__esModule', { value: true });
3
3
  exports.applyTokenLayers = exports.refinePropsFunctions = exports.buildProps = exports.buildUseStyling = void 0;
4
- var buildUseStyling_1 = require("./buildUseStyling");
5
- Object.defineProperty(exports, "buildUseStyling", { enumerable: true, get: function () { return buildUseStyling_1.buildUseStyling; } });
6
- var 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
- var 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
4
+ const buildUseStyling_1 = require('./buildUseStyling');
5
+ Object.defineProperty(exports, 'buildUseStyling', {
6
+ enumerable: true,
7
+ get: function () {
8
+ return buildUseStyling_1.buildUseStyling;
9
+ },
10
+ });
11
+ const buildProps_1 = require('./buildProps');
12
+ Object.defineProperty(exports, 'buildProps', {
13
+ enumerable: true,
14
+ get: function () {
15
+ return buildProps_1.buildProps;
16
+ },
17
+ });
18
+ Object.defineProperty(exports, 'refinePropsFunctions', {
19
+ enumerable: true,
20
+ get: function () {
21
+ return buildProps_1.refinePropsFunctions;
22
+ },
23
+ });
24
+ const use_tokens_1 = require('@fluentui-react-native/use-tokens');
25
+ Object.defineProperty(exports, 'applyTokenLayers', {
26
+ enumerable: true,
27
+ get: function () {
28
+ return use_tokens_1.applyTokenLayers;
29
+ },
30
+ });
31
+ //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,qDAAoD;AAA3C,kHAAA,eAAe,OAAA;AAExB,2CAAgE;AAAvD,wGAAA,UAAU,OAAA;AAAE,kHAAA,oBAAoB,OAAA;AAGzC,gEAAqE;AAA5D,8GAAA,gBAAgB,OAAA"}
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,2 +1,2 @@
1
1
  export {};
2
- //# sourceMappingURL=useStyling.samples.test.d.ts.map
2
+ //# sourceMappingURL=useStyling.samples.test.d.ts.map