@gjsify/adwaita-web 0.36.0 → 0.37.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.
Files changed (146) hide show
  1. package/dist/adwaita-web.css +433 -33
  2. package/dist/adwaita-web.css.map +1 -1
  3. package/lib/types/adw-shortcut-label.spec.d.ts +2 -0
  4. package/lib/types/breakpoints.d.ts +10 -12
  5. package/lib/types/elements/adw-about-dialog.d.ts +19 -36
  6. package/lib/types/elements/adw-action-row.d.ts +9 -12
  7. package/lib/types/elements/adw-alert-dialog.d.ts +0 -12
  8. package/lib/types/elements/adw-avatar.d.ts +1 -0
  9. package/lib/types/elements/adw-bottom-sheet.d.ts +7 -12
  10. package/lib/types/elements/adw-button-content.d.ts +3 -4
  11. package/lib/types/elements/adw-button-row.d.ts +1 -1
  12. package/lib/types/elements/adw-carousel.d.ts +28 -49
  13. package/lib/types/elements/adw-checks.d.ts +2 -8
  14. package/lib/types/elements/adw-combo-row.d.ts +6 -6
  15. package/lib/types/elements/adw-data-grid.d.ts +5 -10
  16. package/lib/types/elements/adw-drop-down.d.ts +3 -11
  17. package/lib/types/elements/adw-entry-row.d.ts +20 -23
  18. package/lib/types/elements/adw-icon.d.ts +2 -4
  19. package/lib/types/elements/adw-inline-view-switcher.d.ts +18 -31
  20. package/lib/types/elements/adw-navigation-split-view.d.ts +7 -12
  21. package/lib/types/elements/adw-navigation-view.d.ts +2 -10
  22. package/lib/types/elements/adw-overlay-split-view.d.ts +28 -52
  23. package/lib/types/elements/adw-password-entry-row.d.ts +4 -5
  24. package/lib/types/elements/adw-popover.d.ts +2 -7
  25. package/lib/types/elements/adw-preferences-dialog.d.ts +21 -34
  26. package/lib/types/elements/adw-preferences-group.d.ts +12 -14
  27. package/lib/types/elements/adw-progress-bar.d.ts +3 -4
  28. package/lib/types/elements/adw-shortcut-label.d.ts +20 -0
  29. package/lib/types/elements/adw-sidebar.d.ts +5 -10
  30. package/lib/types/elements/adw-spinner.d.ts +3 -5
  31. package/lib/types/elements/adw-split-button.d.ts +6 -16
  32. package/lib/types/elements/adw-switch-row.d.ts +3 -3
  33. package/lib/types/elements/adw-tab-view.d.ts +16 -26
  34. package/lib/types/elements/adw-toast-overlay.d.ts +8 -13
  35. package/lib/types/elements/adw-view-stack.d.ts +7 -17
  36. package/lib/types/elements/adw-view-switcher-bar.d.ts +4 -8
  37. package/lib/types/elements/adw-view-switcher.d.ts +18 -38
  38. package/lib/types/elements/adw-wrap-box.d.ts +7 -17
  39. package/lib/types/elements/view-switcher-dom.d.ts +10 -13
  40. package/lib/types/index.d.ts +1 -0
  41. package/lib/types/source-view/hex.d.ts +7 -13
  42. package/lib/types/style-classes.spec.d.ts +11 -0
  43. package/lib/types/styles.generated.d.ts +1 -1
  44. package/package.json +6 -6
  45. package/scss/_about_dialog.scss +3 -2
  46. package/scss/_action_row.scss +33 -0
  47. package/scss/_avatar.scss +12 -0
  48. package/scss/_button.scss +44 -22
  49. package/scss/_card.scss +11 -8
  50. package/scss/_checks.scss +2 -4
  51. package/scss/_dialog.scss +3 -2
  52. package/scss/_headerbar.scss +23 -0
  53. package/scss/_popover.scss +8 -4
  54. package/scss/_preferences.scss +7 -7
  55. package/scss/_progress_bar.scss +9 -6
  56. package/scss/_reset.scss +1 -1
  57. package/scss/_shortcut_label.scss +80 -0
  58. package/scss/_sidebar.scss +57 -0
  59. package/scss/_status_page.scss +20 -0
  60. package/scss/_style_classes.scss +407 -0
  61. package/scss/_switch.scss +4 -3
  62. package/scss/_variables.scss +25 -0
  63. package/scss/adwaita-skin.scss +12 -0
  64. package/src/adw-about-dialog.spec.ts +34 -49
  65. package/src/adw-action-rows.spec.ts +25 -33
  66. package/src/adw-avatar.spec.ts +51 -20
  67. package/src/adw-banner.spec.ts +5 -8
  68. package/src/adw-button-content.spec.ts +9 -12
  69. package/src/adw-button-row.spec.ts +2 -4
  70. package/src/adw-carousel.spec.ts +40 -53
  71. package/src/adw-checks.spec.ts +36 -47
  72. package/src/adw-drop-down.spec.ts +25 -32
  73. package/src/adw-header-bar.spec.ts +5 -7
  74. package/src/adw-icon.spec.ts +23 -32
  75. package/src/adw-progress-bar.spec.ts +10 -12
  76. package/src/adw-row-state.spec.ts +9 -10
  77. package/src/adw-shortcut-label.spec.ts +112 -0
  78. package/src/adw-sidebar.spec.ts +17 -24
  79. package/src/adw-switch.spec.ts +11 -17
  80. package/src/adw-tab-view.spec.ts +7 -10
  81. package/src/adw-toast-overlay.spec.ts +7 -11
  82. package/src/adw-view-switcher-bar.spec.ts +10 -14
  83. package/src/adw-wrap-box.spec.ts +25 -36
  84. package/src/bottom-sheet.spec.ts +30 -36
  85. package/src/breakpoints.ts +15 -18
  86. package/src/chrome.spec.ts +13 -21
  87. package/src/elements/adw-about-dialog.ts +71 -114
  88. package/src/elements/adw-action-row.ts +22 -37
  89. package/src/elements/adw-alert-dialog.ts +25 -50
  90. package/src/elements/adw-avatar.ts +40 -15
  91. package/src/elements/adw-banner.ts +14 -18
  92. package/src/elements/adw-bottom-sheet.ts +31 -52
  93. package/src/elements/adw-button-content.ts +30 -37
  94. package/src/elements/adw-button-row.ts +14 -24
  95. package/src/elements/adw-carousel.ts +87 -148
  96. package/src/elements/adw-checks.ts +43 -56
  97. package/src/elements/adw-clamp.ts +8 -9
  98. package/src/elements/adw-combo-row.ts +17 -25
  99. package/src/elements/adw-data-grid.ts +26 -38
  100. package/src/elements/adw-dialog.ts +25 -56
  101. package/src/elements/adw-drop-down.ts +31 -51
  102. package/src/elements/adw-entry-row.ts +39 -46
  103. package/src/elements/adw-expander-row.ts +30 -53
  104. package/src/elements/adw-icon.ts +30 -53
  105. package/src/elements/adw-inline-view-switcher.ts +38 -67
  106. package/src/elements/adw-menu-button.ts +28 -58
  107. package/src/elements/adw-navigation-split-view.ts +35 -47
  108. package/src/elements/adw-navigation-view.ts +12 -28
  109. package/src/elements/adw-overlay-split-view.ts +100 -175
  110. package/src/elements/adw-password-entry-row.ts +18 -28
  111. package/src/elements/adw-popover.ts +28 -44
  112. package/src/elements/adw-preferences-dialog.ts +41 -66
  113. package/src/elements/adw-preferences-group.ts +33 -46
  114. package/src/elements/adw-progress-bar.ts +27 -47
  115. package/src/elements/adw-shortcut-label.ts +138 -0
  116. package/src/elements/adw-sidebar.ts +31 -39
  117. package/src/elements/adw-spin-row.ts +7 -14
  118. package/src/elements/adw-spinner.ts +31 -43
  119. package/src/elements/adw-split-button.ts +45 -75
  120. package/src/elements/adw-switch-row.ts +29 -46
  121. package/src/elements/adw-switch.ts +28 -47
  122. package/src/elements/adw-tab-view.ts +62 -103
  123. package/src/elements/adw-toast-overlay.ts +28 -35
  124. package/src/elements/adw-toggle-group.ts +9 -16
  125. package/src/elements/adw-view-stack.ts +32 -51
  126. package/src/elements/adw-view-switcher-bar.ts +26 -50
  127. package/src/elements/adw-view-switcher.ts +60 -110
  128. package/src/elements/adw-window-title.ts +4 -4
  129. package/src/elements/adw-wrap-box.ts +33 -59
  130. package/src/elements/view-switcher-dom.ts +15 -22
  131. package/src/entry-rows.spec.ts +18 -24
  132. package/src/index.ts +13 -15
  133. package/src/navigation-view.spec.ts +7 -10
  134. package/src/preferences-search.ts +11 -15
  135. package/src/preferences.spec.ts +13 -15
  136. package/src/source-view/adw-source-view.ts +6 -19
  137. package/src/source-view/hex.ts +7 -13
  138. package/src/split-button.spec.ts +32 -44
  139. package/src/split-views.spec.ts +83 -149
  140. package/src/style-classes.spec.ts +181 -0
  141. package/src/style-isolation.spec.ts +3 -6
  142. package/src/styles.generated.ts +1 -1
  143. package/src/tab-view.spec.ts +26 -35
  144. package/src/test.browser.mts +4 -0
  145. package/src/view-stack.spec.ts +23 -34
  146. package/src/view-switcher.spec.ts +56 -84
@@ -0,0 +1,181 @@
1
+ // libadwaita's DOCUMENTED style-class surface, held against the compiled
2
+ // stylesheet.
3
+ //
4
+ // THE INCIDENT
5
+ //
6
+ // `refs/libadwaita/doc/style-classes.md` is the contract an app author reads:
7
+ // `.card` on a box, `.boxed-list` on a list, `.toolbar` on a bar, `.linked`
8
+ // around a button group. Twenty-one of those classes had no rule in this package
9
+ // at all (#1049) — a consumer following the upstream documentation got nothing,
10
+ // silently.
11
+ //
12
+ // WHY THIS READS THE COMPILED CSS AND NOT THE SCSS
13
+ //
14
+ // A source grep cannot answer the question, and got it wrong in both directions:
15
+ //
16
+ // - `.osd` and `.linked` appeared in `scss/` only inside COMMENTS, so a text
17
+ // search reported them as present while the code spelled its own
18
+ // `.adw-linked` and shipped no `.osd` at all.
19
+ // - `.error` / `.warning` / `.success` are generated by an `@each` in
20
+ // `_labels.scss` (`.#{$e_type}`), so they appear in no source text at all and
21
+ // a text search reports them missing.
22
+ //
23
+ // The compiled stylesheet is what a consumer actually loads, so that is what is
24
+ // asserted. `:not(…)` is stripped before matching, because a selector mentioning
25
+ // a class in order to EXCLUDE it (`.toolbar … :not(.opaque)`) is the opposite of
26
+ // shipping it.
27
+ //
28
+ // THE LEDGER IS THE POINT
29
+ //
30
+ // Every documented class has an entry, and a class that is NOT shipped must say
31
+ // why — so the next reader sees the difference between "we decided against it"
32
+ // and "nobody noticed". `scripts/check-adwaita-style-classes.mjs` holds this
33
+ // ledger against the upstream document itself, so a libadwaita bump that adds a
34
+ // class cannot leave the ledger silently short.
35
+ //
36
+ // Reference: refs/libadwaita/doc/style-classes.md
37
+ import { describe, expect, it } from '@gjsify/unit';
38
+
39
+ import { ADWAITA_WEB_CSS } from './styles.generated.js';
40
+
41
+ /** Ships a rule in the compiled stylesheet. */
42
+ const SHIPPED = { shipped: true } as const;
43
+
44
+ /** Deprecated upstream, with a named replacement — deliberately not ported. */
45
+ const deprecated = (replacement: string) =>
46
+ ({ shipped: false, reason: `deprecated upstream — use ${replacement}` }) as const;
47
+
48
+ /** No counterpart in this renderer (yet), with the reason. */
49
+ const unported = (reason: string) => ({ shipped: false, reason }) as const;
50
+
51
+ /**
52
+ * Every class `style-classes.md` documents, and what this package does about it.
53
+ *
54
+ * Keys are the bare class names, in the document's own spelling. The order is
55
+ * the document's, so the two can be read side by side.
56
+ */
57
+ export const DOCUMENTED_STYLE_CLASSES: Record<string, { shipped: boolean; reason?: string }> = {
58
+ // Buttons
59
+ 'suggested-action': SHIPPED,
60
+ 'destructive-action': SHIPPED,
61
+ flat: SHIPPED,
62
+ raised: SHIPPED,
63
+ circular: SHIPPED,
64
+ pill: SHIPPED,
65
+ // Toggle groups
66
+ round: SHIPPED,
67
+ // Linked controls
68
+ linked: SHIPPED,
69
+ // Toolbars + spacers
70
+ toolbar: SHIPPED,
71
+ spacer: SHIPPED,
72
+ // Dimmed + typography
73
+ dimmed: SHIPPED,
74
+ 'title-1': SHIPPED,
75
+ 'title-2': SHIPPED,
76
+ 'title-3': SHIPPED,
77
+ 'title-4': SHIPPED,
78
+ heading: SHIPPED,
79
+ document: SHIPPED,
80
+ body: SHIPPED,
81
+ caption: SHIPPED,
82
+ 'caption-heading': SHIPPED,
83
+ monospace: SHIPPED,
84
+ numeric: SHIPPED,
85
+ // Colors
86
+ error: SHIPPED,
87
+ warning: SHIPPED,
88
+ success: SHIPPED,
89
+ // Boxed lists & cards
90
+ 'boxed-list': SHIPPED,
91
+ 'boxed-list-separate': SHIPPED,
92
+ card: SHIPPED,
93
+ activatable: SHIPPED,
94
+ // Sidebars
95
+ 'navigation-sidebar': SHIPPED,
96
+ // App icons
97
+ 'lowres-icon': SHIPPED,
98
+ 'icon-dropshadow': SHIPPED,
99
+ // Selection mode
100
+ 'selection-mode': SHIPPED,
101
+ // OSD
102
+ osd: SHIPPED,
103
+ // Surfaces
104
+ background: SHIPPED,
105
+ view: SHIPPED,
106
+ frame: SHIPPED,
107
+ // Compact status page
108
+ compact: SHIPPED,
109
+ // Menu popovers
110
+ menu: SHIPPED,
111
+ // Development window
112
+ devel: SHIPPED,
113
+ // Inline
114
+ inline: unported(
115
+ 'applies to GtkSearchBar, AdwTabBar and GtkTextView. This renderer ports none of ' +
116
+ 'the three — <adw-tab-view> is the tab CONTENT, not AdwTabBar — and upstream ' +
117
+ 'excludes GtkSourceView, which is the one text widget here (<adw-source-view>). ' +
118
+ 'The class ships with the first of those three widgets, not before.',
119
+ ),
120
+ // Undershoot indicators
121
+ 'undershoot-top': SHIPPED,
122
+ 'undershoot-bottom': SHIPPED,
123
+ 'undershoot-start': SHIPPED,
124
+ 'undershoot-end': SHIPPED,
125
+ // Property rows
126
+ property: SHIPPED,
127
+ // Deprecated
128
+ content: deprecated('.boxed-list, which upstream calls completely equivalent'),
129
+ sidebar: deprecated('.navigation-sidebar plus a separator for the border'),
130
+ 'app-notification': deprecated('<adw-toast-overlay>'),
131
+ 'large-title': deprecated('.title-1'),
132
+ opaque: deprecated('.suggested-action with the accent tokens overridden'),
133
+ 'dim-label': deprecated('.dimmed'),
134
+ };
135
+
136
+ /**
137
+ * Selector text of every rule in the stylesheet, with `:not(…)` removed.
138
+ *
139
+ * Matching against selectors rather than the whole file keeps a class name in a
140
+ * comment or in a `content:` string from counting as a rule.
141
+ */
142
+ const selectorText = (css: string): string =>
143
+ [...css.matchAll(/(?:^|\}|\*\/)([^{}]+)\{/g)].map((match) => match[1].replace(/:not\([^)]*\)/g, '')).join('\n');
144
+
145
+ const definesClass = (selectors: string, name: string): boolean =>
146
+ new RegExp(`\\.${name.replace(/-/g, '\\-')}(?![-\\w])`).test(selectors);
147
+
148
+ export const AdwStyleClassesTest = async () => {
149
+ await describe('documented style classes', async () => {
150
+ const selectors = selectorText(ADWAITA_WEB_CSS);
151
+
152
+ await it('ships a rule for every class libadwaita documents', async () => {
153
+ const missing = Object.entries(DOCUMENTED_STYLE_CLASSES)
154
+ .filter(([, entry]) => entry.shipped)
155
+ .map(([name]) => name)
156
+ .filter((name) => !definesClass(selectors, name));
157
+
158
+ // Named in the failure so the message says WHICH contract broke.
159
+ expect(missing.join(', ')).toBe('');
160
+ });
161
+
162
+ await it('keeps the ledger honest about the ones it does not ship', async () => {
163
+ // The reverse direction: a class that quietly gained a rule must move
164
+ // to SHIPPED, or the reason next to it is now a lie. Every non-shipped
165
+ // entry also has to carry that reason.
166
+ const unexpected = Object.entries(DOCUMENTED_STYLE_CLASSES)
167
+ .filter(([, entry]) => !entry.shipped)
168
+ .filter(([name, entry]) => definesClass(selectors, name) || !entry.reason)
169
+ .map(([name]) => name);
170
+
171
+ expect(unexpected.join(', ')).toBe('');
172
+ });
173
+
174
+ await it('is a real stylesheet and not an empty string', async () => {
175
+ // The two assertions above both pass vacuously against an empty CSS
176
+ // bundle — a stale or unbuilt `styles.generated.ts` would read as a
177
+ // clean bill of health.
178
+ expect(selectors.length > 10_000).toBe(true);
179
+ });
180
+ });
181
+ };
@@ -1,14 +1,11 @@
1
- // Style-isolation regression test (browser axis). Guards the boundary reset
2
- // (scss/_reset.scss, ADR 0010): a host page's inherited typography must not leak
3
- // into an adwaita-web widget. It also guards that the widget's tag is listed in
4
- // the reset's `$adw-components` — if it weren't, the reset wouldn't apply and
5
- // these assertions would fail.
1
+ // The boundary reset (scss/_reset.scss, ADR 0010): a host page's inherited typography must
2
+ // not leak into an adwaita-web widget. Also guards that the widget's tag is listed in the
3
+ // reset's `$adw-components` — without it the reset would not apply and these fail.
6
4
  import { describe, expect, it } from '@gjsify/unit';
7
5
 
8
6
  export const AdwStyleIsolationTest = async () => {
9
7
  await describe('style isolation (boundary reset)', async () => {
10
8
  await it('re-roots typography so a host font does not inherit into a widget', async () => {
11
- // A container styled like a hostile host theme.
12
9
  const host = document.createElement('div');
13
10
  host.style.fontFamily = 'Georgia, "Times New Roman", serif';
14
11
  host.style.color = 'rgb(255, 0, 255)';