@wtfalch/email 0.10.0 → 0.11.0

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.
@@ -12,12 +12,19 @@
12
12
  * - `wide` — mailboxes, list and message side by side. Selecting a
13
13
  * conversation reveals it; there is nothing to navigate to.
14
14
  * - `medium` — the mailboxes collapse to a rail of icons, and the list and
15
- * the message share what is left. Below about 1150px a 3-column layout puts
16
- * the reading measure under 45 characters, which is where prose stops being
17
- * readable, and the mailbox names are the least valuable of the three.
15
+ * the message share what is left. Below `@wtfalch/design`'s `wide` breakpoint
16
+ * (1150px) a 3-column layout puts the reading measure under 45 characters,
17
+ * which is where prose stops being readable, and the mailbox names are the
18
+ * least valuable of the three.
18
19
  * - `narrow` — one at a time, with the mailboxes in a drawer. Measured at
19
- * 860px, where the list's two-line row can no longer hold a sender, a time
20
- * and a subject without the subject truncating to nothing.
20
+ * `@wtfalch/design`'s `medium` breakpoint (860px), where the list's
21
+ * two-line row can no longer hold a sender, a time and a subject without
22
+ * the subject truncating to nothing.
23
+ *
24
+ * The widths themselves live in `@wtfalch/design`'s `MEDIA_QUERIES` (and
25
+ * `BREAKPOINTS`), not here: one source, shared with the stylesheet-facing
26
+ * side of the design system, rather than a second copy that can drift from
27
+ * it.
21
28
  */
22
29
  export type Panes = 'wide' | 'medium' | 'narrow';
23
30
  /**
@@ -1,15 +1,14 @@
1
+ import { MEDIA_QUERIES } from '@wtfalch/design';
1
2
  import { useEffect, useState } from 'react';
2
- const WIDE = '(min-width: 1150px)';
3
- const MEDIUM = '(min-width: 860px)';
4
3
  function read() {
5
4
  /* Server rendering, and jsdom without the shim, both land here. `wide` is
6
5
  the right default for both: it is the layout with no hidden state, so a
7
6
  render that never gets a second chance still shows everything. */
8
7
  if (typeof window === 'undefined' || typeof window.matchMedia !== 'function')
9
8
  return 'wide';
10
- if (window.matchMedia(WIDE).matches)
9
+ if (window.matchMedia(MEDIA_QUERIES.wide).matches)
11
10
  return 'wide';
12
- if (window.matchMedia(MEDIUM).matches)
11
+ if (window.matchMedia(MEDIA_QUERIES.medium).matches)
13
12
  return 'medium';
14
13
  return 'narrow';
15
14
  }
@@ -26,7 +25,10 @@ export function usePanes() {
26
25
  useEffect(() => {
27
26
  if (typeof window === 'undefined' || typeof window.matchMedia !== 'function')
28
27
  return;
29
- const queries = [window.matchMedia(WIDE), window.matchMedia(MEDIUM)];
28
+ const queries = [
29
+ window.matchMedia(MEDIA_QUERIES.wide),
30
+ window.matchMedia(MEDIA_QUERIES.medium),
31
+ ];
30
32
  const update = () => setPanes(read());
31
33
  for (const query of queries)
32
34
  query.addEventListener('change', update);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wtfalch/email",
3
- "version": "0.10.0",
3
+ "version": "0.11.0",
4
4
  "description": "The wtfalch estate: reading a mailbox over JMAP, and administering the Stalwart server it lives on. Two entries with no code in common.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -42,7 +42,7 @@
42
42
  "record-fixtures": "node scripts/record-fixtures.mjs"
43
43
  },
44
44
  "peerDependencies": {
45
- "@wtfalch/design": ">=0.5.0",
45
+ "@wtfalch/design": ">=0.16.0",
46
46
  "react": "^19.0.0",
47
47
  "react-dom": "^19.0.0"
48
48
  },
@@ -61,7 +61,7 @@
61
61
  "@types/node": "^22",
62
62
  "@types/react": "^19",
63
63
  "@types/react-dom": "^19",
64
- "@wtfalch/design": "^0.7.0",
64
+ "@wtfalch/design": "^0.16.0",
65
65
  "jsdom": "^30.0.1",
66
66
  "react": "^19",
67
67
  "react-dom": "^19",