@wise/components-theming 0.0.0-experimental-7cfec48 → 0.0.0-experimental-1ed1574
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/ThemeProvider.d.ts +1 -1
- package/dist/ThemeProvider.d.ts.map +1 -1
- package/dist/ThemedChildren.d.ts +1 -1
- package/dist/ThemedChildren.d.ts.map +1 -1
- package/dist/const.d.ts +2 -2
- package/dist/const.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.mjs +2 -2
- package/dist/useTheme.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/ThemeProvider.tsx +1 -1
- package/src/ThemedChildren.tsx +1 -1
- package/src/const.ts +2 -2
- package/src/useTheme.ts +7 -8
package/dist/ThemeProvider.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThemeProvider.d.ts","sourceRoot":"","sources":["../src/ThemeProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,
|
|
1
|
+
{"version":3,"file":"ThemeProvider.d.ts","sourceRoot":"","sources":["../src/ThemeProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,iBAAiB,EAAkC,MAAM,OAAO,CAAC;AAGzF,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAInD,eAAO,MAAM,YAAY;WAEZ,OAAO,CAAC,OAAO,CAAC;gBACX,UAAU;cAGhB,CAAC;AAEb,KAAK,kBAAkB,GAAG,iBAAiB,CAAC,OAAO,CAAC,GAAG;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAE9E,eAAO,MAAM,aAAa,mEAMvB,kBAAkB,gCA6BpB,CAAC"}
|
package/dist/ThemedChildren.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThemedChildren.d.ts","sourceRoot":"","sources":["../src/ThemedChildren.tsx"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"ThemedChildren.d.ts","sourceRoot":"","sources":["../src/ThemedChildren.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIlC,KAAK,mBAAmB,GAAG;IAAE,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,SAAS,CAAA;CAAE,CAAC;AAEvE,eAAO,MAAM,cAAc,4BAAyC,mBAAmB,gCAItF,CAAC"}
|
package/dist/const.d.ts
CHANGED
|
@@ -12,8 +12,8 @@ export type ScreenMode = (typeof screenModes)[number];
|
|
|
12
12
|
export type ScreenModeDark = (typeof screenModes)[1];
|
|
13
13
|
export type PlatformTheme = (typeof platformThemes)[0];
|
|
14
14
|
export type PlatformForestGreenTheme = (typeof platformThemes)[1];
|
|
15
|
-
export declare const DEFAULT_BASE_THEME
|
|
16
|
-
export declare const DEFAULT_SCREEN_MODE
|
|
15
|
+
export declare const DEFAULT_BASE_THEME: "light";
|
|
16
|
+
export declare const DEFAULT_SCREEN_MODE: "light";
|
|
17
17
|
export type Theming = {
|
|
18
18
|
theme?: ComponentTheme | BaseTheme | ExtraTheme | PlatformTheme | PlatformForestGreenTheme;
|
|
19
19
|
screenMode?: ScreenMode;
|
package/dist/const.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"const.d.ts","sourceRoot":"","sources":["../src/const.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,UAAU,gCAAiC,CAAC;AACzD,eAAO,MAAM,WAAW,2CAA4C,CAAC;AACrE,eAAO,MAAM,WAAW,4BAA6B,CAAC;AACtD,eAAO,MAAM,YAAY,uDAA2C,CAAC;AACrE,eAAO,MAAM,cAAc,iDAAkD,CAAC;AAG9E,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC;AACzD,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,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CAAC,CAAC,CAAC,CAAC;AACvD,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC;AACtD,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;AACrD,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;AACvD,MAAM,MAAM,wBAAwB,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;AAElE,eAAO,MAAM,kBAAkB,SAAmB,CAAC;AACnD,eAAO,MAAM,mBAAmB,SAAmB,CAAC;AAEpD,MAAM,MAAM,OAAO,GAAG;IACpB,KAAK,CAAC,EAAE,cAAc,GAAG,SAAS,GAAG,UAAU,GAAG,aAAa,GAAG,wBAAwB,CAAC;IAC3F,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,iBAAiB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CACzC,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -51,12 +51,12 @@ const useTheme = () => {
|
|
|
51
51
|
console.warn('Call to useTheme outside a ThemeProvider');
|
|
52
52
|
}
|
|
53
53
|
const {
|
|
54
|
-
theme
|
|
54
|
+
theme,
|
|
55
55
|
screenMode: contextScreenMode
|
|
56
56
|
} = theming ?? FALLBACK_VALUES;
|
|
57
57
|
const screenMode = theme === DEFAULT_BASE_THEME ? DEFAULT_SCREEN_MODE : contextScreenMode;
|
|
58
58
|
return react.useMemo(() => ({
|
|
59
|
-
theme
|
|
59
|
+
theme,
|
|
60
60
|
screenMode,
|
|
61
61
|
isModern: isThemeModern(theme),
|
|
62
62
|
isForestGreenTheme: isForestGreenTheme(theme),
|
package/dist/index.mjs
CHANGED
|
@@ -45,12 +45,12 @@ const useTheme = () => {
|
|
|
45
45
|
console.warn('Call to useTheme outside a ThemeProvider');
|
|
46
46
|
}
|
|
47
47
|
const {
|
|
48
|
-
theme
|
|
48
|
+
theme,
|
|
49
49
|
screenMode: contextScreenMode
|
|
50
50
|
} = theming ?? FALLBACK_VALUES;
|
|
51
51
|
const screenMode = theme === DEFAULT_BASE_THEME ? DEFAULT_SCREEN_MODE : contextScreenMode;
|
|
52
52
|
return useMemo(() => ({
|
|
53
|
-
theme
|
|
53
|
+
theme,
|
|
54
54
|
screenMode,
|
|
55
55
|
isModern: isThemeModern(theme),
|
|
56
56
|
isForestGreenTheme: isForestGreenTheme(theme),
|
package/dist/useTheme.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTheme.d.ts","sourceRoot":"","sources":["../src/useTheme.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAInD,UAAU,cAAc;IACtB,KAAK,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IACxB,UAAU,EAAE,UAAU,CAAC;IACvB,QAAQ,EAAE,OAAO,CAAC;IAClB,kBAAkB,EAAE,OAAO,CAAC;IAC5B,gBAAgB,EAAE,OAAO,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;CACnB;AAeD,eAAO,MAAM,QAAQ,QAAO,
|
|
1
|
+
{"version":3,"file":"useTheme.d.ts","sourceRoot":"","sources":["../src/useTheme.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAInD,UAAU,cAAc;IACtB,KAAK,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IACxB,UAAU,EAAE,UAAU,CAAC;IACvB,QAAQ,EAAE,OAAO,CAAC;IAClB,kBAAkB,EAAE,OAAO,CAAC;IAC5B,gBAAgB,EAAE,OAAO,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;CACnB;AAeD,eAAO,MAAM,QAAQ,QAAO,cAuB3B,CAAC"}
|
package/package.json
CHANGED
package/src/ThemeProvider.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createContext,
|
|
1
|
+
import { createContext, PropsWithChildren, useContext, useEffect, useMemo } from 'react';
|
|
2
2
|
|
|
3
3
|
import { ThemedChildren } from './ThemedChildren';
|
|
4
4
|
import type { ScreenMode, Theming } from './const';
|
package/src/ThemedChildren.tsx
CHANGED
package/src/const.ts
CHANGED
|
@@ -16,8 +16,8 @@ export type ScreenModeDark = (typeof screenModes)[1];
|
|
|
16
16
|
export type PlatformTheme = (typeof platformThemes)[0];
|
|
17
17
|
export type PlatformForestGreenTheme = (typeof platformThemes)[1];
|
|
18
18
|
|
|
19
|
-
export const DEFAULT_BASE_THEME = 'light';
|
|
20
|
-
export const DEFAULT_SCREEN_MODE = 'light';
|
|
19
|
+
export const DEFAULT_BASE_THEME = 'light' as const;
|
|
20
|
+
export const DEFAULT_SCREEN_MODE = 'light' as const;
|
|
21
21
|
|
|
22
22
|
export type Theming = {
|
|
23
23
|
theme?: ComponentTheme | BaseTheme | ExtraTheme | PlatformTheme | PlatformForestGreenTheme;
|
package/src/useTheme.ts
CHANGED
|
@@ -35,19 +35,18 @@ export const useTheme = (): ThemeHookValue => {
|
|
|
35
35
|
console.warn('Call to useTheme outside a ThemeProvider');
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
const { theme
|
|
38
|
+
const { theme, screenMode: contextScreenMode } = theming ?? FALLBACK_VALUES;
|
|
39
39
|
|
|
40
|
-
const screenMode =
|
|
41
|
-
theme === DEFAULT_BASE_THEME ? DEFAULT_SCREEN_MODE : (contextScreenMode as ScreenMode);
|
|
40
|
+
const screenMode = theme === DEFAULT_BASE_THEME ? DEFAULT_SCREEN_MODE : contextScreenMode;
|
|
42
41
|
|
|
43
42
|
return useMemo(
|
|
44
43
|
() => ({
|
|
45
|
-
theme
|
|
44
|
+
theme,
|
|
46
45
|
screenMode,
|
|
47
|
-
isModern: isThemeModern(theme
|
|
48
|
-
isForestGreenTheme: isForestGreenTheme(theme
|
|
49
|
-
isScreenModeDark: isScreenModeDark(theme
|
|
50
|
-
className: getThemeClassName(theme
|
|
46
|
+
isModern: isThemeModern(theme),
|
|
47
|
+
isForestGreenTheme: isForestGreenTheme(theme),
|
|
48
|
+
isScreenModeDark: isScreenModeDark(theme, screenMode),
|
|
49
|
+
className: getThemeClassName(theme, screenMode),
|
|
51
50
|
}),
|
|
52
51
|
[theme, screenMode],
|
|
53
52
|
);
|