@classic-homes/theme-styles 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.
package/README.md CHANGED
@@ -25,17 +25,28 @@ The main entry defines the cascade layers, brand fonts, tokens, base, accessibil
25
25
 
26
26
  ## Exports
27
27
 
28
- | Import | Contents |
29
- | --------------------------------------------- | ---------------------------------------------------------- |
30
- | `@classic-homes/theme-styles` | All styles (fonts, tokens, base, accessibility, utilities) |
31
- | `@classic-homes/theme-styles/core` | Same as the main entry, without the brand fonts |
32
- | `@classic-homes/theme-styles/fonts` | Brand fonts |
33
- | `@classic-homes/theme-styles/base` | Base element styles |
34
- | `@classic-homes/theme-styles/accessibility` | Accessibility styles |
35
- | `@classic-homes/theme-styles/utilities` | Utility classes |
36
- | `@classic-homes/theme-styles/tailwind-v4` | The theme for Tailwind CSS 4 (see below) |
37
- | `@classic-homes/theme-styles/components.css` | Plain CSS `ch-*` component classes (see below) |
38
- | `@classic-homes/theme-styles/components.json` | The `ch-*` class list as data (recipe, axis, option) |
28
+ | Import | Contents |
29
+ | --------------------------------------------- | ---------------------------------------------------------------- |
30
+ | `@classic-homes/theme-styles` | All styles (fonts, tokens, base, accessibility, utilities, fold) |
31
+ | `@classic-homes/theme-styles/core` | Same as the main entry, without the brand fonts |
32
+ | `@classic-homes/theme-styles/fonts` | Brand fonts |
33
+ | `@classic-homes/theme-styles/base` | Base element styles |
34
+ | `@classic-homes/theme-styles/accessibility` | Accessibility styles |
35
+ | `@classic-homes/theme-styles/utilities` | Utility classes |
36
+ | `@classic-homes/theme-styles/fold` | Foldable layout rules (see below) |
37
+ | `@classic-homes/theme-styles/tailwind-v4` | The theme for Tailwind CSS 4 (see below) |
38
+ | `@classic-homes/theme-styles/components.css` | Plain CSS `ch-*` component classes (see below) |
39
+ | `@classic-homes/theme-styles/components.json` | The `ch-*` class list as data (recipe, axis, option) |
40
+
41
+ ### Foldable phones (iPhone Duo)
42
+
43
+ While a foldable is partly open, the Classic Theme iOS shell sets `<html data-fold="vertical|horizontal">` and `--fold-left/-top/-width/-height` (`@classic-homes/native`, Foldable). `fold.css` (in both entry points) then keeps content out of the fold; with no active fold, and everywhere else, it does nothing:
44
+
45
+ - the `Header` mobile menu stays in one pane;
46
+ - a full-width layout's main region (`main#main-content` without a sidebar before it, as in `PublicLayout`) is centred on a vertical fold, and its two-column grids (`grid-cols-2`, `md:grid-cols-2`, …) widen their gap to the fold, so the gap lands on it. Add `.fold-center` to centre another full-width element, `.fold-gap` to widen another grid's gap;
47
+ - `.fold-split` lays its first two children out one per pane, for an element that starts at the viewport's left (or top) edge, such as a full-screen view.
48
+
49
+ Its rules are unlayered so they win over the page's own utilities while folded.
39
50
 
40
51
  ### Touch field size
41
52
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@classic-homes/theme-styles",
3
- "version": "0.10.0",
3
+ "version": "0.11.0",
4
4
  "description": "Base styles and utilities for the Classic Theme design system",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -15,6 +15,7 @@
15
15
  "./base": "./src/base.css",
16
16
  "./accessibility": "./src/accessibility.css",
17
17
  "./utilities": "./src/utilities.css",
18
+ "./fold": "./src/fold.css",
18
19
  "./tailwind-v4": "./dist/tailwind-v4.css",
19
20
  "./tailwind-v4.css": "./dist/tailwind-v4.css",
20
21
  "./components.css": "./dist/components.css",
package/src/core.css CHANGED
@@ -24,3 +24,6 @@
24
24
 
25
25
  /* Import utility classes */
26
26
  @import './utilities.css';
27
+
28
+ /* Keep content out of a foldable's fold (only while data-fold is set) */
29
+ @import './fold.css';
package/src/fold.css ADDED
@@ -0,0 +1,97 @@
1
+ /**
2
+ * Classic Theme Fold Styles
3
+ *
4
+ * Keeps content and controls out of the fold of a foldable phone (iPhone Duo)
5
+ * while it is partly open. WebKit tells a page nothing about the fold, so the
6
+ * Classic Theme iOS shell (see @classic-homes/native, "Foldable") sets, on
7
+ * <html>:
8
+ *
9
+ * data-fold="vertical" the fold runs top to bottom: two panes side by side
10
+ * data-fold="horizontal" the fold runs left to right: a top and a bottom pane
11
+ * data-fold="none" no active fold (closed, or fully open)
12
+ *
13
+ * and --fold-left/-top/-width/-height in CSS px of the layout viewport. Every
14
+ * rule here needs data-fold="vertical" or "horizontal", so nothing changes in a
15
+ * browser, on Android, on the desktop, closed or fully open (Apple: avoid
16
+ * extreme layout changes; fully open, content may cross the fold).
17
+ *
18
+ * Unlayered on purpose: while the device is folded these rules must win over
19
+ * the page's own Tailwind display, padding and gap utilities.
20
+ *
21
+ * - The header's mobile menu (Header `mobileNav`) stays in one pane.
22
+ * - The main content region of a full-width layout (PublicLayout) is centred
23
+ * on the fold, and its two-column grids widen their gap to cover it, so the
24
+ * gap of an even column count lands on the fold. `.fold-center` does the
25
+ * same for any other full-width element.
26
+ * - `.fold-split` lays out its first two children one per pane.
27
+ */
28
+
29
+ /* ===== Header mobile menu: one pane ===== */
30
+
31
+ html[data-fold='vertical'] header > nav[aria-label='Mobile navigation'] {
32
+ max-width: var(--fold-left, 100%);
33
+ border-inline-end: 1px solid hsl(var(--foreground));
34
+ }
35
+
36
+ html[data-fold='horizontal'] header > nav[aria-label='Mobile navigation'] {
37
+ /* Below the 4rem bar (plus its top inset), above the fold */
38
+ max-height: calc(var(--fold-top, 100vh) - 4rem - env(safe-area-inset-top, 0px));
39
+ overflow-y: auto;
40
+ overscroll-behavior: contain;
41
+ }
42
+
43
+ /* ===== Full-width content centred on the fold ===== */
44
+
45
+ /* A layout's main region spans the viewport unless a sidebar precedes it
46
+ (DashboardLayout), whose offset CSS cannot know: that one is left alone.
47
+ Widths are 100% of the containing block (the layout viewport), never 100vw:
48
+ in the iOS app 100vw is the whole web view, content inset included. */
49
+ html[data-fold='vertical'] :is(.fold-center, main#main-content:not(aside ~ * main)) {
50
+ --fold-center: calc(var(--fold-left, 50%) + var(--fold-width, 0px) / 2);
51
+ --fold-half: min(var(--fold-center), 100% - var(--fold-center));
52
+ /* The larger of the safe-area inset and what centres the content box */
53
+ padding-inline-start: max(env(safe-area-inset-left, 0px), var(--fold-center) - var(--fold-half));
54
+ padding-inline-end: max(
55
+ env(safe-area-inset-right, 0px),
56
+ 100% - var(--fold-center) - var(--fold-half)
57
+ );
58
+ }
59
+
60
+ html[data-fold='vertical']
61
+ :is(.fold-center, main#main-content:not(aside ~ * main))
62
+ :is([class*='grid-cols-2'], .fold-gap) {
63
+ column-gap: max(1.5rem, var(--fold-width, 0px));
64
+ }
65
+
66
+ /* ===== One pane per segment ===== */
67
+
68
+ /* For an element that starts at the viewport's left (vertical fold) or top
69
+ (horizontal fold) edge, such as a fixed full-screen view. Without an active
70
+ fold it keeps whatever layout the page gave it. */
71
+ html[data-fold='vertical'] .fold-split {
72
+ display: grid;
73
+ grid-template-columns: var(--fold-left) var(--fold-width) minmax(0, 1fr);
74
+ grid-template-rows: minmax(0, 1fr);
75
+ }
76
+
77
+ html[data-fold='vertical'] .fold-split > :nth-child(1) {
78
+ grid-area: 1 / 1;
79
+ }
80
+
81
+ html[data-fold='vertical'] .fold-split > :nth-child(2) {
82
+ grid-area: 1 / 3;
83
+ }
84
+
85
+ html[data-fold='horizontal'] .fold-split {
86
+ display: grid;
87
+ grid-template-rows: var(--fold-top) var(--fold-height) minmax(0, 1fr);
88
+ grid-template-columns: minmax(0, 1fr);
89
+ }
90
+
91
+ html[data-fold='horizontal'] .fold-split > :nth-child(1) {
92
+ grid-area: 1 / 1;
93
+ }
94
+
95
+ html[data-fold='horizontal'] .fold-split > :nth-child(2) {
96
+ grid-area: 3 / 1;
97
+ }
package/src/index.css CHANGED
@@ -30,3 +30,6 @@
30
30
 
31
31
  /* Import utility classes */
32
32
  @import './utilities.css';
33
+
34
+ /* Keep content out of a foldable's fold (only while data-fold is set) */
35
+ @import './fold.css';