@domicile-desktop/component-library 0.0.0-alpha-40b5a0fb8a55 → 0.0.0-alpha-db7f02b3f03f
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 +3 -3
- package/src/ThemeSwitch/ThemeSwitch.tsx +12 -13
package/package.json
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
"dependencies": {
|
|
3
3
|
"@base-ui/react": "^1.8.0",
|
|
4
4
|
"@cprussin/option-result": "^2.0.1",
|
|
5
|
-
"@domicile-desktop/sdk": "0.0.0-alpha-
|
|
6
|
-
"@domicile-desktop/system-apps": "0.0.0-alpha-
|
|
5
|
+
"@domicile-desktop/sdk": "0.0.0-alpha-db7f02b3f03f",
|
|
6
|
+
"@domicile-desktop/system-apps": "0.0.0-alpha-db7f02b3f03f",
|
|
7
7
|
"@phosphor-icons/react": "^2.1.10"
|
|
8
8
|
},
|
|
9
9
|
"description": "React components and the Panda CSS design system that Domicile's shells are built from.",
|
|
@@ -106,5 +106,5 @@
|
|
|
106
106
|
"test:unit": "bun test"
|
|
107
107
|
},
|
|
108
108
|
"type": "module",
|
|
109
|
-
"version": "0.0.0-alpha-
|
|
109
|
+
"version": "0.0.0-alpha-db7f02b3f03f"
|
|
110
110
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MoonIcon } from "@phosphor-icons/react/dist/ssr/Moon";
|
|
2
|
+
import { SunIcon } from "@phosphor-icons/react/dist/ssr/Sun";
|
|
2
3
|
|
|
3
4
|
import { css, cx } from "../../styled-system/css";
|
|
4
5
|
import type { ThemeControl } from "./ThemeProvider";
|
|
@@ -21,9 +22,6 @@ type Props = {
|
|
|
21
22
|
/**
|
|
22
23
|
* A dark/light theme toggle for the shell's chrome.
|
|
23
24
|
*
|
|
24
|
-
* The icon is a half-filled circle, mirrored per theme, so it stays distinct
|
|
25
|
-
* from the brightness readout's sun.
|
|
26
|
-
*
|
|
27
25
|
* There is no "system" option because Domicile is the system. A click asks
|
|
28
26
|
* the compositor for the change; the page repaints when the answer arrives.
|
|
29
27
|
* Throws when no `ThemeProvider` is mounted above it.
|
|
@@ -39,25 +37,26 @@ export const ThemeSwitch = ({ useTheme: useThemeHook = useTheme }: Props) => {
|
|
|
39
37
|
title={LABELS[theme]}
|
|
40
38
|
type="button"
|
|
41
39
|
>
|
|
42
|
-
<span aria-hidden className={cx(slotStyles,
|
|
43
|
-
<
|
|
40
|
+
<span aria-hidden className={cx(slotStyles, sunSlotStyles)}>
|
|
41
|
+
<SunIcon size={16} weight="fill" />
|
|
44
42
|
</span>
|
|
45
|
-
<span aria-hidden className={cx(slotStyles,
|
|
46
|
-
<
|
|
43
|
+
<span aria-hidden className={cx(slotStyles, moonSlotStyles)}>
|
|
44
|
+
<MoonIcon size={16} weight="fill" />
|
|
47
45
|
</span>
|
|
48
46
|
</button>
|
|
49
47
|
);
|
|
50
48
|
};
|
|
51
49
|
|
|
52
|
-
// A circular window holding the
|
|
50
|
+
// A circular window holding the sun and moon slots.
|
|
53
51
|
//
|
|
54
52
|
// Sets no `color` so the icons inherit their surroundings' text color. The
|
|
55
53
|
// toggle often sits in a white bar over the wallpaper, which does not change
|
|
56
54
|
// with the theme; a `foreground` color would turn black there in light mode.
|
|
55
|
+
// The hover tint mixes `currentcolor` for the same reason, matching the bar's
|
|
56
|
+
// other buttons.
|
|
57
57
|
const buttonStyles = css({
|
|
58
58
|
_hover: {
|
|
59
|
-
backgroundColor:
|
|
60
|
-
"color-mix(in oklab, {colors.foreground} 10%, transparent)",
|
|
59
|
+
backgroundColor: "color-mix(in oklab, currentcolor 16%, transparent)",
|
|
61
60
|
},
|
|
62
61
|
backgroundColor: "transparent",
|
|
63
62
|
blockSize: 7,
|
|
@@ -107,7 +106,7 @@ const slotStyles = css({
|
|
|
107
106
|
// The `color-mix` is repeated inline because Panda only extracts static
|
|
108
107
|
// literals. A shared const would silently emit no rule.
|
|
109
108
|
|
|
110
|
-
const
|
|
109
|
+
const sunSlotStyles = css({
|
|
111
110
|
"[data-theme-mode=dark] &": {
|
|
112
111
|
color: "color-mix(in oklab, currentcolor 40%, transparent)",
|
|
113
112
|
transform: "translateY(100%)",
|
|
@@ -118,7 +117,7 @@ const lightSlotStyles = css({
|
|
|
118
117
|
},
|
|
119
118
|
});
|
|
120
119
|
|
|
121
|
-
const
|
|
120
|
+
const moonSlotStyles = css({
|
|
122
121
|
"[data-theme-mode=dark] &": {
|
|
123
122
|
color: "currentcolor",
|
|
124
123
|
transform: "translateY(0)",
|