@multiplatform.one/theme 9.8.0 → 9.8.1
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/package.json +5 -5
- package/src/theme/ThemeProvider.stories.tsx +15 -3
- package/src/theme/accentOnSurface.spec.tsx +11 -1
- package/src/theme/colorThemeAccent.spec.ts +1 -1
- package/src/theme/devtools/ColorLineVisualizer.stories.tsx +8 -0
- package/src/theme/devtools/ThemeDevtoolsPanel.stories.tsx +11 -1
- package/src/theme/selectedState.spec.ts +16 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@multiplatform.one/theme",
|
|
3
|
-
"version": "9.8.
|
|
3
|
+
"version": "9.8.1",
|
|
4
4
|
"description": "Tamagui theme system for multiplatform.one",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"multiplatform",
|
|
@@ -163,8 +163,8 @@
|
|
|
163
163
|
"access": "public"
|
|
164
164
|
},
|
|
165
165
|
"dependencies": {
|
|
166
|
-
"@multiplatform.one/platform": "^9.8.
|
|
167
|
-
"@multiplatform.one/store": "^9.8.
|
|
166
|
+
"@multiplatform.one/platform": "^9.8.1",
|
|
167
|
+
"@multiplatform.one/store": "^9.8.1",
|
|
168
168
|
"@tamagui/animations-react-native": "2.7.6",
|
|
169
169
|
"@tamagui/colors": "2.7.6",
|
|
170
170
|
"@tamagui/config": "2.7.6",
|
|
@@ -180,8 +180,8 @@
|
|
|
180
180
|
},
|
|
181
181
|
"devDependencies": {
|
|
182
182
|
"@expo/prebuild-config": "55.0.18",
|
|
183
|
-
"@multiplatform.one/config": "9.8.
|
|
184
|
-
"@multiplatform.one/test-utils": "9.8.
|
|
183
|
+
"@multiplatform.one/config": "9.8.1",
|
|
184
|
+
"@multiplatform.one/test-utils": "9.8.1",
|
|
185
185
|
"@tamagui/animations-css": "2.7.6",
|
|
186
186
|
"@tamagui/animations-reanimated": "2.7.6",
|
|
187
187
|
"@tamagui/build": "2.7.6",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useEffect, useState } from "react";
|
|
2
|
-
import { YStack } from "tamagui";
|
|
2
|
+
import { useThemeName, YStack } from "tamagui";
|
|
3
3
|
import { SizableText } from "./Text";
|
|
4
4
|
|
|
5
5
|
export default {
|
|
@@ -9,12 +9,24 @@ export default {
|
|
|
9
9
|
docs: {
|
|
10
10
|
description: {
|
|
11
11
|
component:
|
|
12
|
-
"ThemeProvider is the Storybook preview wrapper (TamaguiProvider + KnobBridge). This story measures that live provider: the html theme class and the FontKnobStyles stylesheet KnobBridge mounts. Remounting ThemeProvider inside the preview would nest TamaguiProvider, so the probe reads the one already on the page.",
|
|
12
|
+
"ThemeProvider is the Storybook preview wrapper (TamaguiProvider + KnobBridge). This story measures that live provider: the html theme class and the FontKnobStyles stylesheet KnobBridge mounts. On device there is no html element or stylesheet, so the probe reads the provider's theme name. Remounting ThemeProvider inside the preview would nest TamaguiProvider, so the probe reads the one already on the page.",
|
|
13
13
|
},
|
|
14
14
|
},
|
|
15
15
|
},
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
+
const hasDocument = typeof globalThis.document !== "undefined";
|
|
19
|
+
|
|
20
|
+
function NativeProbe() {
|
|
21
|
+
const themeName = useThemeName();
|
|
22
|
+
return (
|
|
23
|
+
<YStack testID="theme-provider-probe" gap="$2" padding="$4">
|
|
24
|
+
<SizableText>theme: {themeName}</SizableText>
|
|
25
|
+
<SizableText>FontKnobStyles: none on native, knobProps carry the font knobs</SizableText>
|
|
26
|
+
</YStack>
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
18
30
|
function Probe() {
|
|
19
31
|
const [themeClass, setThemeClass] = useState("pending");
|
|
20
32
|
const [fontStyles, setFontStyles] = useState("pending");
|
|
@@ -47,5 +59,5 @@ function Probe() {
|
|
|
47
59
|
|
|
48
60
|
export const main = {
|
|
49
61
|
name: "Main",
|
|
50
|
-
render: () => <Probe
|
|
62
|
+
render: () => (hasDocument ? <Probe /> : <NativeProbe />),
|
|
51
63
|
};
|
|
@@ -30,7 +30,17 @@ const presets = {
|
|
|
30
30
|
dense: densePreset,
|
|
31
31
|
roomy: roomyPreset,
|
|
32
32
|
};
|
|
33
|
-
const colourThemes = [
|
|
33
|
+
const colourThemes = [
|
|
34
|
+
"blue",
|
|
35
|
+
"red",
|
|
36
|
+
"green",
|
|
37
|
+
"yellow",
|
|
38
|
+
"orange",
|
|
39
|
+
"pink",
|
|
40
|
+
"purple",
|
|
41
|
+
"sky",
|
|
42
|
+
"plum",
|
|
43
|
+
] as const;
|
|
34
44
|
const schemes = ["light", "dark"] as const;
|
|
35
45
|
const house = createDefaultThemeConfig({ presets });
|
|
36
46
|
const chromaFloor = 0.1;
|
|
@@ -13,7 +13,7 @@ const themes = createThemesBuilder(
|
|
|
13
13
|
defaultBuilderOptions,
|
|
14
14
|
).themes();
|
|
15
15
|
const config = createTamagui({ ...configWithoutAnimations, themes });
|
|
16
|
-
const hues = ["blue", "red", "green", "yellow", "orange", "pink", "purple", "gray"];
|
|
16
|
+
const hues = ["blue", "red", "green", "yellow", "orange", "pink", "purple", "sky", "plum", "gray"];
|
|
17
17
|
const ratio = (a: string, b: string) =>
|
|
18
18
|
contrastRatio(relativeLuminance(normalizeToHex(a)!), relativeLuminance(normalizeToHex(b)!));
|
|
19
19
|
|
|
@@ -8,6 +8,14 @@ export default {
|
|
|
8
8
|
component: ColorLineVisualizer,
|
|
9
9
|
parameters: {
|
|
10
10
|
status: { type: "beta" },
|
|
11
|
+
nativeGallery: {
|
|
12
|
+
exempt: {
|
|
13
|
+
from: "native",
|
|
14
|
+
reason:
|
|
15
|
+
"The colour line is part of the Storybook theme devtools panel, drawn in plain DOM (Part 3, Devtools panels).",
|
|
16
|
+
readInstead: "the Knobs sheet on any component",
|
|
17
|
+
},
|
|
18
|
+
},
|
|
11
19
|
docs: {
|
|
12
20
|
description: {
|
|
13
21
|
component:
|
|
@@ -3,7 +3,17 @@ import { ThemeDevtoolsPanel } from "./ThemeDevtoolsPanel";
|
|
|
3
3
|
export default {
|
|
4
4
|
title: "Theme/ThemeDevtoolsPanel",
|
|
5
5
|
component: ThemeDevtoolsPanel,
|
|
6
|
-
parameters: {
|
|
6
|
+
parameters: {
|
|
7
|
+
status: { type: "beta" },
|
|
8
|
+
nativeGallery: {
|
|
9
|
+
exempt: {
|
|
10
|
+
from: "native",
|
|
11
|
+
reason:
|
|
12
|
+
"The theme devtools panel is Storybook host chrome, drawn in plain DOM (Part 3, Devtools panels).",
|
|
13
|
+
readInstead: "the Knobs sheet on any component",
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
},
|
|
7
17
|
};
|
|
8
18
|
|
|
9
19
|
export const main = {
|
|
@@ -36,7 +36,18 @@ const presets = {
|
|
|
36
36
|
dense: densePreset,
|
|
37
37
|
roomy: roomyPreset,
|
|
38
38
|
};
|
|
39
|
-
const colourThemes = [
|
|
39
|
+
const colourThemes = [
|
|
40
|
+
"blue",
|
|
41
|
+
"gray",
|
|
42
|
+
"green",
|
|
43
|
+
"orange",
|
|
44
|
+
"pink",
|
|
45
|
+
"purple",
|
|
46
|
+
"red",
|
|
47
|
+
"yellow",
|
|
48
|
+
"sky",
|
|
49
|
+
"plum",
|
|
50
|
+
];
|
|
40
51
|
|
|
41
52
|
describe("LC-131 SELECTED-STATE: one selected recipe in the theme", () => {
|
|
42
53
|
it("is the soft accent tint behind accent text", () => {
|
|
@@ -110,7 +121,10 @@ describe("LC-131 SELECTED-STATE: one selected recipe in the theme", () => {
|
|
|
110
121
|
}
|
|
111
122
|
}
|
|
112
123
|
expect(cells).toHaveLength(
|
|
113
|
-
Object.values(presets).reduce(
|
|
124
|
+
Object.values(presets).reduce(
|
|
125
|
+
(count, preset) => count + colourThemes.length + (preset.theme ? 2 : 1),
|
|
126
|
+
0,
|
|
127
|
+
),
|
|
114
128
|
);
|
|
115
129
|
});
|
|
116
130
|
}
|