@classic-homes/theme-styles 0.8.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/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "@classic-homes/theme-styles",
3
- "version": "0.8.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": {
7
- "build": "echo 'No build needed for styles package'",
8
- "test": "vitest run"
7
+ "build": "node scripts/build-tailwind-v4.mjs && node scripts/build-components-css.mjs",
8
+ "test": "vitest run",
9
+ "clean": "node ../../scripts/rm.mjs dist"
9
10
  },
10
11
  "exports": {
11
12
  ".": "./src/index.css",
@@ -13,13 +14,19 @@
13
14
  "./fonts": "./src/fonts.css",
14
15
  "./base": "./src/base.css",
15
16
  "./accessibility": "./src/accessibility.css",
16
- "./utilities": "./src/utilities.css"
17
+ "./utilities": "./src/utilities.css",
18
+ "./fold": "./src/fold.css",
19
+ "./tailwind-v4": "./dist/tailwind-v4.css",
20
+ "./tailwind-v4.css": "./dist/tailwind-v4.css",
21
+ "./components.css": "./dist/components.css",
22
+ "./components.json": "./dist/components.json"
17
23
  },
18
24
  "sideEffects": [
19
25
  "*.css"
20
26
  ],
21
27
  "files": [
22
- "src"
28
+ "src",
29
+ "dist"
23
30
  ],
24
31
  "keywords": [
25
32
  "styles",
@@ -46,7 +53,9 @@
46
53
  "@classic-homes/theme-tokens": "*",
47
54
  "postcss": "^8.4.0",
48
55
  "postcss-import": "^16.1.1",
56
+ "prettier": "~3.7.4",
49
57
  "tailwindcss": "^3.4.0",
58
+ "tailwindcss-v4": "npm:tailwindcss@4.3.4",
50
59
  "vitest": "^4.0.0"
51
60
  }
52
61
  }
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';