@domicile-desktop/component-library 0.0.0-alpha-5524dc6074c1 → 0.0.0-alpha-20719bea37b2

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 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-5524dc6074c1",
6
- "@domicile-desktop/system-apps": "0.0.0-alpha-5524dc6074c1",
5
+ "@domicile-desktop/sdk": "0.0.0-alpha-20719bea37b2",
6
+ "@domicile-desktop/system-apps": "0.0.0-alpha-20719bea37b2",
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-5524dc6074c1"
109
+ "version": "0.0.0-alpha-20719bea37b2"
110
110
  }
@@ -27,6 +27,9 @@ export const DEFAULT_THEME: Theme = "dark";
27
27
  /** What the preset's `_light` condition selects on. */
28
28
  const THEME_ATTRIBUTE = "data-theme";
29
29
 
30
+ /** What the preset pauses the wipe on while windows turn. */
31
+ const HOLDING_ATTRIBUTE = "data-theme-holding";
32
+
30
33
  /**
31
34
  * Applies a theme to `<html>` so the tokens resolve to it.
32
35
  *
@@ -58,7 +61,7 @@ export type FlipThemeOptions = {
58
61
  */
59
62
  applyNextTheme: () => void;
60
63
  /**
61
- * Repaints the other windows after the wipe's start frame is captured. See
64
+ * Repaints the other windows once the wipe's start frame is on screen. See
62
65
  * {@link ThemeSource.turnWindows}.
63
66
  */
64
67
  turnWindows: () => Promise<void>;
@@ -114,12 +117,23 @@ export const flipThemeWithAnimation = ({
114
117
  // `data-theme-flip-to` sets the wipe direction.
115
118
  root.setAttribute("data-theme-flipping", "");
116
119
  root.setAttribute("data-theme-flip-to", next);
117
- // The old frame is captured before this runs, and the wipe waits for
118
- // it to settle, so the windows repaint behind the old frame.
119
- const transition = document.startViewTransition(() => {
120
- applyNextTheme();
121
- return turnWindows();
122
- });
120
+ // `data-theme-holding` pauses the wipe at its start, so only the old
121
+ // frame shows.
122
+ root.setAttribute(HOLDING_ATTRIBUTE, "");
123
+ const transition = document.startViewTransition(applyNextTheme);
124
+ // Turn the windows once the old frame is on screen. Until `ready`, the
125
+ // screen shows the page's live frame, with `<app>` windows in it, and
126
+ // the update callback runs before the capture has been drawn.
127
+ const turnWindowsBehindWipe = () =>
128
+ turnWindows().finally(() => {
129
+ root.removeAttribute(HOLDING_ATTRIBUTE);
130
+ });
131
+ transition.ready
132
+ .then(turnWindowsBehindWipe, turnWindowsBehindWipe)
133
+ .catch((error: unknown) => {
134
+ // biome-ignore lint/suspicious/noConsole: surfacing a failed turnover
135
+ console.error("Failed to turn the desk's windows", error);
136
+ });
123
137
  const cleanup = () => {
124
138
  root.removeAttribute("data-theme-flipping");
125
139
  root.removeAttribute("data-theme-flip-to");
@@ -34,9 +34,9 @@ export type ThemeSource = {
34
34
  /**
35
35
  * Repaints the other windows in `theme` and settles once they have.
36
36
  *
37
- * {@link flipThemeWithAnimation} calls this after capturing the wipe's start
38
- * frame and holds that frame until it settles. Otherwise windows would
39
- * change before or during the wipe.
37
+ * {@link flipThemeWithAnimation} calls this once the wipe's start frame is
38
+ * on screen and holds the wipe at its start until it settles. Otherwise
39
+ * windows would change before or during the wipe.
40
40
  */
41
41
  turnWindows: (theme: Theme) => Promise<void>;
42
42
  };
@@ -69,6 +69,11 @@ export const domicilePreset = definePreset({
69
69
  "html[data-theme-flip-to='light']::view-transition-new(root)": {
70
70
  animationName: "themeSwipeFromBottom",
71
71
  },
72
+ // Held at the start, so only the old frame shows, while windows repaint
73
+ // behind it (`flipThemeWithAnimation`).
74
+ "html[data-theme-holding]::view-transition-new(root)": {
75
+ animationPlayState: "paused",
76
+ },
72
77
  // Disable element transitions during a theme change. Otherwise they are
73
78
  // mid-flight when the new snapshot is captured, so the snapshot shows the
74
79
  // old colors and the elements snap at the end. `!important` beats more