@uifabricshared/theming-react-native 0.21.0 → 0.21.3

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 (72) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/lib/BaselinePlatformDefaults.d.ts +1 -1
  3. package/lib/BaselinePlatformDefaults.js +2 -2
  4. package/lib/Global.d.ts +1 -1
  5. package/lib/Global.js +11 -11
  6. package/lib/NativeModule/ThemingModule.d.ts +2 -2
  7. package/lib/NativeModule/ThemingModule.js +1 -1
  8. package/lib/NativeModule/ThemingModule.types.d.ts +13 -13
  9. package/lib/NativeModule/ThemingModule.types.js +1 -1
  10. package/lib/NativeModule/ThemingModuleHelpers.d.ts +3 -8
  11. package/lib/NativeModule/ThemingModuleHelpers.js +36 -36
  12. package/lib/NativeModule/getHostSettings.d.ts +1 -1
  13. package/lib/NativeModule/getHostSettings.js +2 -2
  14. package/lib/NativeModule/index.d.ts +1 -1
  15. package/lib/NativeModule/index.js +1 -1
  16. package/lib/Theme.types.d.ts +1 -1
  17. package/lib/Theme.types.js +1 -1
  18. package/lib/ThemeContext.d.ts +1 -1
  19. package/lib/ThemeContext.js +1 -1
  20. package/lib/ThemeLayer.d.ts +24 -24
  21. package/lib/ThemeLayer.js +40 -42
  22. package/lib/ThemeProvider.d.ts +1 -1
  23. package/lib/ThemeProvider.js +21 -21
  24. package/lib/ThemeProvider.types.d.ts +3 -3
  25. package/lib/ThemeProvider.types.js +1 -1
  26. package/lib/index.d.ts +1 -1
  27. package/lib/index.js +1 -1
  28. package/lib/platform/PlatformDefaults.d.ts +2 -8
  29. package/lib/platform/PlatformDefaults.js +2 -2
  30. package/lib/platform/PlatformDefaults.native.d.ts +2 -8
  31. package/lib/platform/PlatformDefaults.native.js +6 -6
  32. package/lib/platform/index.d.ts +2 -2
  33. package/lib/platform/index.d.ts.map +1 -1
  34. package/lib/platform/index.js +2 -2
  35. package/lib/platform/index.js.map +1 -1
  36. package/lib-commonjs/BaselinePlatformDefaults.d.ts +1 -1
  37. package/lib-commonjs/BaselinePlatformDefaults.js +5 -5
  38. package/lib-commonjs/Global.d.ts +1 -1
  39. package/lib-commonjs/Global.js +14 -14
  40. package/lib-commonjs/NativeModule/ThemingModule.d.ts +2 -2
  41. package/lib-commonjs/NativeModule/ThemingModule.js +5 -5
  42. package/lib-commonjs/NativeModule/ThemingModule.types.d.ts +13 -13
  43. package/lib-commonjs/NativeModule/ThemingModule.types.js +3 -3
  44. package/lib-commonjs/NativeModule/ThemingModuleHelpers.d.ts +3 -8
  45. package/lib-commonjs/NativeModule/ThemingModuleHelpers.js +41 -44
  46. package/lib-commonjs/NativeModule/getHostSettings.d.ts +1 -1
  47. package/lib-commonjs/NativeModule/getHostSettings.js +4 -4
  48. package/lib-commonjs/NativeModule/index.d.ts +1 -1
  49. package/lib-commonjs/NativeModule/index.js +7 -17
  50. package/lib-commonjs/Theme.types.d.ts +1 -1
  51. package/lib-commonjs/Theme.types.js +3 -3
  52. package/lib-commonjs/ThemeContext.d.ts +1 -1
  53. package/lib-commonjs/ThemeContext.js +36 -63
  54. package/lib-commonjs/ThemeLayer.d.ts +24 -24
  55. package/lib-commonjs/ThemeLayer.js +74 -93
  56. package/lib-commonjs/ThemeProvider.d.ts +1 -1
  57. package/lib-commonjs/ThemeProvider.js +56 -75
  58. package/lib-commonjs/ThemeProvider.types.d.ts +3 -3
  59. package/lib-commonjs/ThemeProvider.types.js +3 -3
  60. package/lib-commonjs/index.d.ts +1 -1
  61. package/lib-commonjs/index.js +24 -108
  62. package/lib-commonjs/platform/PlatformDefaults.d.ts +2 -8
  63. package/lib-commonjs/platform/PlatformDefaults.js +7 -10
  64. package/lib-commonjs/platform/PlatformDefaults.native.d.ts +2 -8
  65. package/lib-commonjs/platform/PlatformDefaults.native.js +11 -14
  66. package/lib-commonjs/platform/index.d.ts +2 -2
  67. package/lib-commonjs/platform/index.d.ts.map +1 -1
  68. package/lib-commonjs/platform/index.js +6 -29
  69. package/lib-commonjs/platform/index.js.map +1 -1
  70. package/package.json +24 -23
  71. package/src/platform/index.ts +1 -1
  72. package/eslint.config.js +0 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,40 @@
1
1
  # Change Log - @uifabricshared/theming-react-native
2
2
 
3
+ ## 0.21.3
4
+
5
+ ### Patch Changes
6
+
7
+ - 9cf4444: Migrate from ESLint to oxlint
8
+ - Updated dependencies [9cf4444]
9
+ - @uifabricshared/theme-registry@0.13.3
10
+ - @uifabricshared/theming-ramp@0.21.3
11
+ - @fluentui-react-native/default-theme@0.27.3
12
+ - @fluentui-react-native/win32-theme@0.39.3
13
+
14
+ ## 0.21.2
15
+
16
+ ### Patch Changes
17
+
18
+ - 8a7b549: Update to the latest rnx-kit versions, fix some typing issues, and correct the vscode settings
19
+ - Updated dependencies [8a7b549]
20
+ - @uifabricshared/theme-registry@0.13.2
21
+ - @uifabricshared/theming-ramp@0.21.2
22
+ - @fluentui-react-native/default-theme@0.27.2
23
+ - @fluentui-react-native/win32-theme@0.39.2
24
+
25
+ ## 0.21.1
26
+
27
+ ### Patch Changes
28
+
29
+ - 0d6e9c1: chore: migrate to `oxfmt`
30
+ - ac6e7af: Ensure packages have a default export that references the typescript entrypoint and clean up build dependency ordering
31
+ - Updated dependencies [0d6e9c1]
32
+ - Updated dependencies [ac6e7af]
33
+ - @uifabricshared/theme-registry@0.13.1
34
+ - @uifabricshared/theming-ramp@0.21.1
35
+ - @fluentui-react-native/default-theme@0.27.1
36
+ - @fluentui-react-native/win32-theme@0.39.1
37
+
3
38
  ## 0.21.0
4
39
 
5
40
  ### Minor Changes
@@ -3,4 +3,4 @@ import type { ITheme } from '@uifabricshared/theming-ramp';
3
3
  * @deprecated
4
4
  */
5
5
  export declare function getBaselinePlatformTheme(): ITheme;
6
- //# sourceMappingURL=BaselinePlatformDefaults.d.ts.map
6
+ //# sourceMappingURL=BaselinePlatformDefaults.d.ts.map
@@ -3,6 +3,6 @@ import { defaultFluentTheme } from '@fluentui-react-native/default-theme';
3
3
  * @deprecated
4
4
  */
5
5
  export function getBaselinePlatformTheme() {
6
- return defaultFluentTheme;
6
+ return defaultFluentTheme;
7
7
  }
8
- //# sourceMappingURL=BaselinePlatformDefaults.js.map
8
+ //# sourceMappingURL=BaselinePlatformDefaults.js.map
package/lib/Global.d.ts CHANGED
@@ -53,4 +53,4 @@ export declare function getTheme(name?: string): ITheme;
53
53
  * @deprecated
54
54
  */
55
55
  export declare function augmentPlatformTheme(definition: IPartialTheme): void;
56
- //# sourceMappingURL=Global.d.ts.map
56
+ //# sourceMappingURL=Global.d.ts.map
package/lib/Global.js CHANGED
@@ -6,10 +6,10 @@ let _registry;
6
6
  * @deprecated
7
7
  */
8
8
  export function getThemeRegistry() {
9
- if (!_registry) {
10
- _registry = createPlatformThemeRegistry();
11
- }
12
- return _registry;
9
+ if (!_registry) {
10
+ _registry = createPlatformThemeRegistry();
11
+ }
12
+ return _registry;
13
13
  }
14
14
  /**
15
15
  * Set the global theme registry.
@@ -23,7 +23,7 @@ export function getThemeRegistry() {
23
23
  * @deprecated
24
24
  */
25
25
  export function setThemeRegistry(registry) {
26
- _registry = registry;
26
+ _registry = registry;
27
27
  }
28
28
  /**
29
29
  * Create or update a theme definition
@@ -33,7 +33,7 @@ export function setThemeRegistry(registry) {
33
33
  * @deprecated
34
34
  */
35
35
  export function setTheme(definition, name, parent) {
36
- return getThemeRegistry().setTheme(definition, name, parent);
36
+ return getThemeRegistry().setTheme(definition, name, parent);
37
37
  }
38
38
  /**
39
39
  * Register a theme event listener
@@ -41,7 +41,7 @@ export function setTheme(definition, name, parent) {
41
41
  * @deprecated
42
42
  */
43
43
  export function addThemeRegistryListener(listener) {
44
- return getThemeRegistry().addEventListener(listener);
44
+ return getThemeRegistry().addEventListener(listener);
45
45
  }
46
46
  /**
47
47
  * Unregister a theme event listener
@@ -49,7 +49,7 @@ export function addThemeRegistryListener(listener) {
49
49
  * @deprecated
50
50
  */
51
51
  export function removeThemeRegistryListener(listener) {
52
- return getThemeRegistry().removeEventListener(listener);
52
+ return getThemeRegistry().removeEventListener(listener);
53
53
  }
54
54
  /**
55
55
  * Get a theme by name
@@ -57,7 +57,7 @@ export function removeThemeRegistryListener(listener) {
57
57
  * @deprecated
58
58
  */
59
59
  export function getTheme(name) {
60
- return getThemeRegistry().getTheme(name);
60
+ return getThemeRegistry().getTheme(name);
61
61
  }
62
62
  /**
63
63
  * This will update the platform theme. This is primarily exposed for clients to add custom lookup values to palettes or to
@@ -68,6 +68,6 @@ export function getTheme(name) {
68
68
  * @deprecated
69
69
  */
70
70
  export function augmentPlatformTheme(definition) {
71
- getThemeRegistry().updatePlatformDefaults(definition);
71
+ getThemeRegistry().updatePlatformDefaults(definition);
72
72
  }
73
- //# sourceMappingURL=Global.js.map
73
+ //# sourceMappingURL=Global.js.map
@@ -1,5 +1,5 @@
1
1
  /**
2
2
  * @deprecated
3
3
  */
4
- export declare const ThemingModuleHelper: import('./ThemingModule.types').IThemingModuleHelper;
5
- //# sourceMappingURL=ThemingModule.d.ts.map
4
+ export declare const ThemingModuleHelper: import("./ThemingModule.types").IThemingModuleHelper;
5
+ //# sourceMappingURL=ThemingModule.d.ts.map
@@ -4,4 +4,4 @@ import { createThemingModuleHelper } from './ThemingModuleHelpers';
4
4
  * @deprecated
5
5
  */
6
6
  export const ThemingModuleHelper = createThemingModuleHelper(...getThemingModule());
7
- //# sourceMappingURL=ThemingModule.js.map
7
+ //# sourceMappingURL=ThemingModule.js.map
@@ -5,7 +5,7 @@ import type { ITheme, IPartialTheme, OfficePalette as IOfficePalette } from '@ui
5
5
  * @deprecated
6
6
  */
7
7
  export interface IEventEmitter {
8
- addListener: (event: string, PlatformDefaultsChangedCallback: any) => void;
8
+ addListener: (event: string, PlatformDefaultsChangedCallback: any) => void;
9
9
  }
10
10
  /**
11
11
  * @deprecated
@@ -15,21 +15,21 @@ export type IPlatformThemeDefinition = IPartialTheme | IProcessTheme<ITheme, IPa
15
15
  * @deprecated
16
16
  */
17
17
  export interface IThemingModuleHelper {
18
- /**
19
- * Gets a complete platform theme suitable for using with a Theme Registry
20
- */
21
- getPlatformDefaults: (themeId?: string) => ITheme;
22
- /**
23
- * Gets a theme definition to register with a Theme Registry & use with the theme context to create a subtree with the
24
- * look & feel of a platform theme.
25
- */
26
- getPlatformThemeDefinition: (themeId?: string) => IPlatformThemeDefinition;
27
- addListener: (listener: PlatformDefaultsChangedCallback) => void;
18
+ /**
19
+ * Gets a complete platform theme suitable for using with a Theme Registry
20
+ */
21
+ getPlatformDefaults: (themeId?: string) => ITheme;
22
+ /**
23
+ * Gets a theme definition to register with a Theme Registry & use with the theme context to create a subtree with the
24
+ * look & feel of a platform theme.
25
+ */
26
+ getPlatformThemeDefinition: (themeId?: string) => IPlatformThemeDefinition;
27
+ addListener: (listener: PlatformDefaultsChangedCallback) => void;
28
28
  }
29
29
  /**
30
30
  * @deprecated
31
31
  */
32
32
  export type IHostSettingsWin32 = {
33
- palette: IOfficePalette;
33
+ palette: IOfficePalette;
34
34
  };
35
- //# sourceMappingURL=ThemingModule.types.d.ts.map
35
+ //# sourceMappingURL=ThemingModule.types.d.ts.map
@@ -1,2 +1,2 @@
1
1
  export {};
2
- //# sourceMappingURL=ThemingModule.types.js.map
2
+ //# sourceMappingURL=ThemingModule.types.js.map
@@ -2,20 +2,15 @@ import type { OfficeThemingModule } from '@fluentui-react-native/win32-theme';
2
2
  import type { OfficePalette } from '@uifabricshared/theming-ramp';
3
3
  import type { IThemingModuleHelper, IEventEmitter } from './ThemingModule.types';
4
4
  type PaletteCache = {
5
- [key: string]: OfficePalette;
5
+ [key: string]: OfficePalette;
6
6
  };
7
7
  /**
8
8
  * @deprecated
9
9
  */
10
- export declare function translateOfficeTheme(
11
- module: OfficeThemingModule,
12
- cache: PaletteCache,
13
- id?: string,
14
- themeName?: string,
15
- ): import('@fluentui-react-native/theme-types').PartialTheme;
10
+ export declare function translateOfficeTheme(module: OfficeThemingModule, cache: PaletteCache, id?: string, themeName?: string): import("@fluentui-react-native/theme-types").PartialTheme;
16
11
  /**
17
12
  * @deprecated
18
13
  */
19
14
  export declare function createThemingModuleHelper(themingModule?: OfficeThemingModule, emitter?: IEventEmitter): IThemingModuleHelper;
20
15
  export {};
21
- //# sourceMappingURL=ThemingModuleHelpers.d.ts.map
16
+ //# sourceMappingURL=ThemingModuleHelpers.d.ts.map
@@ -2,56 +2,56 @@ import { createPartialOfficeTheme } from '@fluentui-react-native/win32-theme';
2
2
  import { resolvePartialTheme } from '@uifabricshared/theming-ramp';
3
3
  import { getBaselinePlatformTheme } from '../BaselinePlatformDefaults';
4
4
  function isException(palette) {
5
- return palette.message !== undefined;
5
+ return palette.message !== undefined;
6
6
  }
7
7
  function updatePaletteInCache(module, cache, palette) {
8
- const paletteValue = module.getPalette(palette);
9
- if (!isException(paletteValue)) {
10
- cache[palette] = paletteValue;
11
- }
8
+ const paletteValue = module.getPalette(palette);
9
+ if (!isException(paletteValue)) {
10
+ cache[palette] = paletteValue;
11
+ }
12
12
  }
13
13
  const getPaletteCacheKey = (palette) => {
14
- return palette || 'WhiteColors';
14
+ return palette || 'WhiteColors';
15
15
  };
16
16
  function ensurePalette(module, paletteCache, palette) {
17
- const key = getPaletteCacheKey(palette);
18
- if (!paletteCache[key]) {
19
- updatePaletteInCache(module, paletteCache, key);
20
- }
21
- return paletteCache[key] || {};
17
+ const key = getPaletteCacheKey(palette);
18
+ if (!paletteCache[key]) {
19
+ updatePaletteInCache(module, paletteCache, key);
20
+ }
21
+ return paletteCache[key] || {};
22
22
  }
23
23
  /**
24
24
  * @deprecated
25
25
  */
26
26
  export function translateOfficeTheme(module, cache, id, themeName) {
27
- const palette = ensurePalette(module, cache, id);
28
- return createPartialOfficeTheme(module, themeName, palette);
27
+ const palette = ensurePalette(module, cache, id);
28
+ return createPartialOfficeTheme(module, themeName, palette);
29
29
  }
30
30
  /**
31
31
  * @deprecated
32
32
  */
33
33
  export function createThemingModuleHelper(themingModule, emitter) {
34
- themingModule || console.error('No NativeModule for Theming found');
35
- const paletteCache = {};
36
- let _hostTheme = themingModule.getConstants().initialHostThemeSetting || '';
37
- emitter &&
38
- emitter.addListener('onPlatformDefaultsChanged', (args) => {
39
- _hostTheme = (args && args.hostThemeSetting) || _hostTheme;
40
- Object.keys(paletteCache).forEach((key) => delete paletteCache[key]);
41
- });
42
- return {
43
- getPlatformDefaults: (themeId) => {
44
- return resolvePartialTheme(getBaselinePlatformTheme(), translateOfficeTheme(themingModule, paletteCache, themeId, _hostTheme));
45
- },
46
- getPlatformThemeDefinition: (themeId) => {
47
- return (_parent) => {
48
- updatePaletteInCache(themingModule, paletteCache, themeId);
49
- return translateOfficeTheme(themingModule, paletteCache, themeId);
50
- };
51
- },
52
- addListener: (callback) => {
53
- emitter && emitter.addListener('onPlatformDefaultsChanged', callback);
54
- },
55
- };
34
+ themingModule || console.error('No NativeModule for Theming found');
35
+ const paletteCache = {};
36
+ let _hostTheme = themingModule.getConstants().initialHostThemeSetting || '';
37
+ emitter &&
38
+ emitter.addListener('onPlatformDefaultsChanged', (args) => {
39
+ _hostTheme = (args && args.hostThemeSetting) || _hostTheme;
40
+ Object.keys(paletteCache).forEach((key) => delete paletteCache[key]);
41
+ });
42
+ return {
43
+ getPlatformDefaults: (themeId) => {
44
+ return resolvePartialTheme(getBaselinePlatformTheme(), translateOfficeTheme(themingModule, paletteCache, themeId, _hostTheme));
45
+ },
46
+ getPlatformThemeDefinition: (themeId) => {
47
+ return (_parent) => {
48
+ updatePaletteInCache(themingModule, paletteCache, themeId);
49
+ return translateOfficeTheme(themingModule, paletteCache, themeId);
50
+ };
51
+ },
52
+ addListener: (callback) => {
53
+ emitter && emitter.addListener('onPlatformDefaultsChanged', callback);
54
+ },
55
+ };
56
56
  }
57
- //# sourceMappingURL=ThemingModuleHelpers.js.map
57
+ //# sourceMappingURL=ThemingModuleHelpers.js.map
@@ -3,4 +3,4 @@ import type { ITheme } from '../Theme.types';
3
3
  * @deprecated
4
4
  */
5
5
  export declare function getHostSettingsWin32(theme: ITheme): ITheme['host'] | undefined;
6
- //# sourceMappingURL=getHostSettings.d.ts.map
6
+ //# sourceMappingURL=getHostSettings.d.ts.map
@@ -2,6 +2,6 @@
2
2
  * @deprecated
3
3
  */
4
4
  export function getHostSettingsWin32(theme) {
5
- return theme.host?.palette ? theme.host : undefined;
5
+ return theme.host?.palette ? theme.host : undefined;
6
6
  }
7
- //# sourceMappingURL=getHostSettings.js.map
7
+ //# sourceMappingURL=getHostSettings.js.map
@@ -1,4 +1,4 @@
1
1
  export { ThemingModuleHelper } from './ThemingModule';
2
2
  export type { IEventEmitter, IPlatformThemeDefinition, IThemingModuleHelper, IHostSettingsWin32 } from './ThemingModule.types';
3
3
  export { getHostSettingsWin32 } from './getHostSettings';
4
- //# sourceMappingURL=index.d.ts.map
4
+ //# sourceMappingURL=index.d.ts.map
@@ -1,3 +1,3 @@
1
1
  export { ThemingModuleHelper } from './ThemingModule';
2
2
  export { getHostSettingsWin32 } from './getHostSettings';
3
- //# sourceMappingURL=index.js.map
3
+ //# sourceMappingURL=index.js.map
@@ -12,4 +12,4 @@ export type IThemeDefinition = IPartialTheme | IProcessTheme<ITheme, IPartialThe
12
12
  * @deprecated
13
13
  */
14
14
  export type ThemeRegistry = IThemeRegistry<ITheme, IPartialTheme>;
15
- //# sourceMappingURL=Theme.types.d.ts.map
15
+ //# sourceMappingURL=Theme.types.d.ts.map
@@ -1,2 +1,2 @@
1
1
  export {};
2
- //# sourceMappingURL=Theme.types.js.map
2
+ //# sourceMappingURL=Theme.types.js.map
@@ -12,4 +12,4 @@ export declare const ThemeRegistryContext: React.Context<ThemeRegistry>;
12
12
  * @deprecated
13
13
  */
14
14
  export declare const useThemeRegistry: () => ThemeRegistry;
15
- //# sourceMappingURL=ThemeContext.d.ts.map
15
+ //# sourceMappingURL=ThemeContext.d.ts.map
@@ -11,4 +11,4 @@ export const ThemeRegistryContext = React.createContext(undefined);
11
11
  * @deprecated
12
12
  */
13
13
  export const useThemeRegistry = () => React.useContext(ThemeRegistryContext);
14
- //# sourceMappingURL=ThemeContext.js.map
14
+ //# sourceMappingURL=ThemeContext.js.map
@@ -7,17 +7,17 @@ import type { FurnJSX } from '@fluentui-react-native/framework-base';
7
7
  * @deprecated
8
8
  */
9
9
  export interface IThemeLayerProps {
10
- /**
11
- * If `themeName` is specified this layer will set that theme as the active theme. Setting the value
12
- * to '' will explicitly set the default theme as active in the context. If `themeName` is unspecified
13
- * the theme layer will act as a consumer and pick up the currently active theme in the context
14
- */
15
- themeName?: string;
16
- /**
17
- * children function that allows passing of the theme to children. This is a standard pattern for
18
- * consumers.
19
- */
20
- children: (theme: ITheme) => FurnJSX.Element | null;
10
+ /**
11
+ * If `themeName` is specified this layer will set that theme as the active theme. Setting the value
12
+ * to '' will explicitly set the default theme as active in the context. If `themeName` is unspecified
13
+ * the theme layer will act as a consumer and pick up the currently active theme in the context
14
+ */
15
+ themeName?: string;
16
+ /**
17
+ * children function that allows passing of the theme to children. This is a standard pattern for
18
+ * consumers.
19
+ */
20
+ children: (theme: ITheme) => FurnJSX.Element | null;
21
21
  }
22
22
  /**
23
23
  * Multipurpose theme provider. This can run in provider/consumer mode and pure consumer mode.
@@ -46,17 +46,17 @@ export interface IThemeLayerProps {
46
46
  * @deprecated
47
47
  */
48
48
  export declare class ThemeLayer extends React.Component<IThemeLayerProps> {
49
- /**
50
- * stores the name of the theme if in provider mode. Existence of this string is tied to registration
51
- * and is used to signal registration and unregistration
52
- */
53
- private _registeredTheme;
54
- /** handler for theme changes, conditionally will force update */
55
- onInvalidate: IThemeEventListener['onInvalidate'];
56
- /** standard cleanup handler to ensure we unregister */
57
- componentWillUnmount(): void;
58
- render(): FurnJSX.Element;
59
- /** helper to register if this is the first time and to update the filter if necessary */
60
- private _ensureCallbackRegistration;
49
+ /**
50
+ * stores the name of the theme if in provider mode. Existence of this string is tied to registration
51
+ * and is used to signal registration and unregistration
52
+ */
53
+ private _registeredTheme;
54
+ /** handler for theme changes, conditionally will force update */
55
+ onInvalidate: IThemeEventListener['onInvalidate'];
56
+ /** standard cleanup handler to ensure we unregister */
57
+ componentWillUnmount(): void;
58
+ render(): FurnJSX.Element;
59
+ /** helper to register if this is the first time and to update the filter if necessary */
60
+ private _ensureCallbackRegistration;
61
61
  }
62
- //# sourceMappingURL=ThemeLayer.d.ts.map
62
+ //# sourceMappingURL=ThemeLayer.d.ts.map
package/lib/ThemeLayer.js CHANGED
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx } from 'react/jsx-runtime';
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import * as React from 'react';
3
3
  import { ThemeContext } from '@uifabricshared/theming-ramp';
4
4
  import { removeThemeRegistryListener, getTheme, addThemeRegistryListener } from './Global';
@@ -29,48 +29,46 @@ import { removeThemeRegistryListener, getTheme, addThemeRegistryListener } from
29
29
  * @deprecated
30
30
  */
31
31
  export class ThemeLayer extends React.Component {
32
- /**
33
- * stores the name of the theme if in provider mode. Existence of this string is tied to registration
34
- * and is used to signal registration and unregistration
35
- */
36
- _registeredTheme;
37
- /** handler for theme changes, conditionally will force update */
38
- onInvalidate = (name) => {
39
- // only force updates if this theme was the one invalidated
40
- if (name === this._registeredTheme) {
41
- this.forceUpdate();
32
+ /**
33
+ * stores the name of the theme if in provider mode. Existence of this string is tied to registration
34
+ * and is used to signal registration and unregistration
35
+ */
36
+ _registeredTheme;
37
+ /** handler for theme changes, conditionally will force update */
38
+ onInvalidate = (name) => {
39
+ // only force updates if this theme was the one invalidated
40
+ if (name === this._registeredTheme) {
41
+ this.forceUpdate();
42
+ }
43
+ };
44
+ /** standard cleanup handler to ensure we unregister */
45
+ componentWillUnmount() {
46
+ if (this._registeredTheme !== undefined) {
47
+ removeThemeRegistryListener(this);
48
+ this._registeredTheme = undefined;
49
+ }
42
50
  }
43
- };
44
- /** standard cleanup handler to ensure we unregister */
45
- componentWillUnmount() {
46
- if (this._registeredTheme !== undefined) {
47
- removeThemeRegistryListener(this);
48
- this._registeredTheme = undefined;
51
+ render() {
52
+ let themeName = this.props.themeName;
53
+ return (_jsx(ThemeContext.Consumer, { children: (theme) => {
54
+ // go to provider mode if a themeName is specified or if this is the first consumer and the context
55
+ // is undefined.
56
+ if (themeName !== undefined || theme === undefined) {
57
+ themeName = themeName || '';
58
+ this._ensureCallbackRegistration(themeName);
59
+ theme = getTheme(themeName);
60
+ return _jsx(ThemeContext.Provider, { value: theme, children: this.props.children(theme) });
61
+ }
62
+ // otherwise in consumer mode just push the current theme to the children
63
+ return this.props.children(theme);
64
+ } }));
49
65
  }
50
- }
51
- render() {
52
- let themeName = this.props.themeName;
53
- return _jsx(ThemeContext.Consumer, {
54
- children: (theme) => {
55
- // go to provider mode if a themeName is specified or if this is the first consumer and the context
56
- // is undefined.
57
- if (themeName !== undefined || theme === undefined) {
58
- themeName = themeName || '';
59
- this._ensureCallbackRegistration(themeName);
60
- theme = getTheme(themeName);
61
- return _jsx(ThemeContext.Provider, { value: theme, children: this.props.children(theme) });
66
+ /** helper to register if this is the first time and to update the filter if necessary */
67
+ _ensureCallbackRegistration = (themeName) => {
68
+ if (this._registeredTheme === undefined) {
69
+ addThemeRegistryListener(this);
62
70
  }
63
- // otherwise in consumer mode just push the current theme to the children
64
- return this.props.children(theme);
65
- },
66
- });
67
- }
68
- /** helper to register if this is the first time and to update the filter if necessary */
69
- _ensureCallbackRegistration = (themeName) => {
70
- if (this._registeredTheme === undefined) {
71
- addThemeRegistryListener(this);
72
- }
73
- this._registeredTheme = themeName;
74
- };
71
+ this._registeredTheme = themeName;
72
+ };
75
73
  }
76
- //# sourceMappingURL=ThemeLayer.js.map
74
+ //# sourceMappingURL=ThemeLayer.js.map
@@ -5,4 +5,4 @@ import type { IThemeProviderProps } from './ThemeProvider.types';
5
5
  * See https://github.com/microsoft/fluentui-react-native/blob/main/docs/pages/Guides/UpdateThemeProvider.md for details
6
6
  */
7
7
  export declare const ThemeProvider: React.FunctionComponent<IThemeProviderProps>;
8
- //# sourceMappingURL=ThemeProvider.d.ts.map
8
+ //# sourceMappingURL=ThemeProvider.d.ts.map
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx } from 'react/jsx-runtime';
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import * as React from 'react';
3
3
  import { ThemeContext } from '@uifabricshared/theming-ramp';
4
4
  import { getThemeRegistry } from './Global';
@@ -8,24 +8,24 @@ import { useThemeRegistry, ThemeRegistryContext } from './ThemeContext';
8
8
  * See https://github.com/microsoft/fluentui-react-native/blob/main/docs/pages/Guides/UpdateThemeProvider.md for details
9
9
  */
10
10
  export const ThemeProvider = (props) => {
11
- const { registry: registryFromProps, theme: themeName = '', children } = props;
12
- const defaultRegistry = useThemeRegistry();
13
- const registryToUse = registryFromProps || defaultRegistry || getThemeRegistry();
14
- const [theme, setThemeState] = React.useState(registryToUse.getTheme(themeName));
15
- React.useEffect(() => {
16
- setThemeState(registryToUse.getTheme(themeName));
17
- const themeInvalidater = {
18
- onInvalidate: (name) => {
19
- name === themeName && setThemeState(registryToUse.getTheme(themeName));
20
- },
21
- };
22
- registryToUse.addEventListener(themeInvalidater);
23
- return () => {
24
- registryToUse.removeEventListener(themeInvalidater);
25
- };
26
- }, [registryToUse, themeName, setThemeState]);
27
- const themeProvider = _jsx(ThemeContext.Provider, { value: theme, children: children });
28
- // note `registryFromProps` came from props and it's not the same as `registryToUse`
29
- return registryFromProps ? _jsx(ThemeRegistryContext.Provider, { value: registryFromProps, children: themeProvider }) : themeProvider;
11
+ const { registry: registryFromProps, theme: themeName = '', children } = props;
12
+ const defaultRegistry = useThemeRegistry();
13
+ const registryToUse = registryFromProps || defaultRegistry || getThemeRegistry();
14
+ const [theme, setThemeState] = React.useState(registryToUse.getTheme(themeName));
15
+ React.useEffect(() => {
16
+ setThemeState(registryToUse.getTheme(themeName));
17
+ const themeInvalidater = {
18
+ onInvalidate: (name) => {
19
+ name === themeName && setThemeState(registryToUse.getTheme(themeName));
20
+ },
21
+ };
22
+ registryToUse.addEventListener(themeInvalidater);
23
+ return () => {
24
+ registryToUse.removeEventListener(themeInvalidater);
25
+ };
26
+ }, [registryToUse, themeName, setThemeState]);
27
+ const themeProvider = _jsx(ThemeContext.Provider, { value: theme, children: children });
28
+ // note `registryFromProps` came from props and it's not the same as `registryToUse`
29
+ return registryFromProps ? (_jsx(ThemeRegistryContext.Provider, { value: registryFromProps, children: themeProvider })) : (themeProvider);
30
30
  };
31
- //# sourceMappingURL=ThemeProvider.js.map
31
+ //# sourceMappingURL=ThemeProvider.js.map
@@ -3,7 +3,7 @@ import { ThemeRegistry } from './Theme.types';
3
3
  * @deprecated
4
4
  */
5
5
  export interface IThemeProviderProps extends React.PropsWithChildren<{}> {
6
- theme?: string;
7
- registry?: ThemeRegistry;
6
+ theme?: string;
7
+ registry?: ThemeRegistry;
8
8
  }
9
- //# sourceMappingURL=ThemeProvider.types.d.ts.map
9
+ //# sourceMappingURL=ThemeProvider.types.d.ts.map
@@ -1,3 +1,3 @@
1
1
  /* eslint-disable */
2
2
  export {};
3
- //# sourceMappingURL=ThemeProvider.types.js.map
3
+ //# sourceMappingURL=ThemeProvider.types.js.map
package/lib/index.d.ts CHANGED
@@ -39,4 +39,4 @@ export { ThemingModuleHelper, getHostSettingsWin32 } from './NativeModule';
39
39
  * @deprecated
40
40
  */
41
41
  export type { IEventEmitter, IHostSettingsWin32, IPlatformThemeDefinition, IThemingModuleHelper } from './NativeModule';
42
- //# sourceMappingURL=index.d.ts.map
42
+ //# sourceMappingURL=index.d.ts.map
package/lib/index.js CHANGED
@@ -19,4 +19,4 @@ export { ThemeContext, ThemeRegistryContext, useTheme, useThemeRegistry } from '
19
19
  * @deprecated
20
20
  */
21
21
  export { ThemingModuleHelper, getHostSettingsWin32 } from './NativeModule';
22
- //# sourceMappingURL=index.js.map
22
+ //# sourceMappingURL=index.js.map
@@ -2,11 +2,5 @@ import type { IThemingModuleHelper } from '../NativeModule';
2
2
  /**
3
3
  * @deprecated
4
4
  */
5
- export declare function createPlatformThemeRegistry(
6
- _themeId?: string,
7
- _module?: IThemingModuleHelper,
8
- ): import('@uifabricshared/theme-registry').IThemeRegistry<
9
- import('@fluentui-react-native/theme-types').Theme,
10
- import('@fluentui-react-native/theme-types').PartialTheme
11
- >;
12
- //# sourceMappingURL=PlatformDefaults.d.ts.map
5
+ export declare function createPlatformThemeRegistry(_themeId?: string, _module?: IThemingModuleHelper): import("@uifabricshared/theme-registry").IThemeRegistry<import("@fluentui-react-native/theme-types").Theme, import("@fluentui-react-native/theme-types").PartialTheme>;
6
+ //# sourceMappingURL=PlatformDefaults.d.ts.map