@gjsify/adwaita-web 0.51.1 → 0.53.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 (113) hide show
  1. package/README.md +34 -0
  2. package/dist/adwaita-web.css +259 -31
  3. package/dist/adwaita-web.css.map +1 -1
  4. package/lib/types/accent.d.ts +12 -2
  5. package/lib/types/adw-appearance.spec.d.ts +2 -0
  6. package/lib/types/appearance.d.ts +41 -0
  7. package/lib/types/blueprint-layout.spec.d.ts +1 -0
  8. package/lib/types/blueprint-markup.spec.d.ts +4 -0
  9. package/lib/types/blueprint-tree.spec.d.ts +1 -0
  10. package/lib/types/elements/adw-bottom-sheet.d.ts +31 -13
  11. package/lib/types/elements/adw-carousel.d.ts +5 -0
  12. package/lib/types/elements/adw-header-bar.d.ts +15 -0
  13. package/lib/types/elements/adw-inline-view-switcher.d.ts +1 -0
  14. package/lib/types/elements/adw-navigation-view.d.ts +1 -0
  15. package/lib/types/elements/adw-sidebar.d.ts +10 -0
  16. package/lib/types/elements/adw-tab-view.d.ts +1 -0
  17. package/lib/types/elements/adw-toggle-group.d.ts +11 -0
  18. package/lib/types/elements/gtk-action-bar.d.ts +19 -0
  19. package/lib/types/elements/gtk-box.d.ts +17 -0
  20. package/lib/types/elements/gtk-button.d.ts +2 -0
  21. package/lib/types/elements/gtk-label.d.ts +122 -0
  22. package/lib/types/font-stack.spec.d.ts +2 -0
  23. package/lib/types/gio-menu.spec.d.ts +1 -0
  24. package/lib/types/gtk-box.spec.d.ts +1 -0
  25. package/lib/types/gtk-label.spec.d.ts +1 -0
  26. package/lib/types/gtk-value-doors.spec.d.ts +1 -0
  27. package/lib/types/index.d.ts +6 -1
  28. package/lib/types/namespace/gio.d.ts +1 -0
  29. package/lib/types/namespace/gtk.d.ts +5 -0
  30. package/lib/types/shared-tree-builder.d.ts +64 -0
  31. package/lib/types/source-view/asm6502.d.ts +1 -20
  32. package/lib/types/source-view/index.d.ts +3 -2
  33. package/lib/types/source-view/theme.d.ts +1 -1
  34. package/lib/types/string-list-slot.d.ts +4 -0
  35. package/lib/types/styles.generated.d.ts +1 -1
  36. package/lib/types/tags.spec.d.ts +1 -0
  37. package/lib/types/value-lists.spec.d.ts +1 -0
  38. package/package.json +8 -6
  39. package/scss/_action_bar.scss +51 -0
  40. package/scss/_banner.scss +8 -1
  41. package/scss/_bottom_sheet.scss +57 -0
  42. package/scss/_box.scss +23 -0
  43. package/scss/_button.scss +29 -7
  44. package/scss/_button_content.scss +6 -1
  45. package/scss/_button_row.scss +5 -2
  46. package/scss/_carousel.scss +6 -0
  47. package/scss/_labels.scss +126 -12
  48. package/scss/_navigation_split_view.scss +18 -0
  49. package/scss/_overlay_split_view.scss +5 -0
  50. package/scss/_reset.scss +29 -4
  51. package/scss/_split_button.scss +5 -2
  52. package/scss/_status_page.scss +31 -17
  53. package/scss/_theme.scss +11 -3
  54. package/scss/_toolbar_view.scss +10 -0
  55. package/scss/_variables.scss +23 -3
  56. package/scss/_widget.scss +55 -0
  57. package/scss/_window_title.scss +9 -0
  58. package/scss/adwaita-skin.scss +8 -2
  59. package/src/accent.ts +28 -5
  60. package/src/adw-appearance.spec.ts +178 -0
  61. package/src/adw-banner.spec.ts +16 -0
  62. package/src/adw-button-row.spec.ts +8 -0
  63. package/src/adw-header-bar.spec.ts +17 -0
  64. package/src/appearance.ts +207 -0
  65. package/src/blueprint-layout.spec.ts +223 -0
  66. package/src/blueprint-markup.spec.ts +155 -0
  67. package/src/blueprint-tree.spec.ts +174 -0
  68. package/src/bottom-sheet.spec.ts +166 -1
  69. package/src/chrome.spec.ts +5 -2
  70. package/src/elements/adw-bottom-sheet.ts +166 -59
  71. package/src/elements/adw-carousel.ts +10 -5
  72. package/src/elements/adw-clamp.ts +12 -0
  73. package/src/elements/adw-combo-row.ts +13 -4
  74. package/src/elements/adw-header-bar.ts +46 -3
  75. package/src/elements/adw-inline-view-switcher.ts +11 -0
  76. package/src/elements/adw-navigation-view.ts +10 -0
  77. package/src/elements/adw-sidebar.ts +22 -0
  78. package/src/elements/adw-spin-row.ts +44 -5
  79. package/src/elements/adw-status-page.ts +12 -6
  80. package/src/elements/adw-tab-view.ts +20 -3
  81. package/src/elements/adw-toggle-group.ts +45 -4
  82. package/src/elements/adw-toolbar-view.ts +9 -0
  83. package/src/elements/gtk-action-bar.ts +90 -0
  84. package/src/elements/gtk-box.ts +87 -0
  85. package/src/elements/gtk-button.ts +60 -13
  86. package/src/elements/gtk-drop-down.ts +10 -1
  87. package/src/elements/gtk-label.ts +415 -0
  88. package/src/elements/swipe-drag.ts +1 -1
  89. package/src/font-stack.spec.ts +110 -0
  90. package/src/gio-menu.spec.ts +125 -0
  91. package/src/globals.d.ts +7 -0
  92. package/src/gtk-box.spec.ts +168 -0
  93. package/src/gtk-button.spec.ts +123 -1
  94. package/src/gtk-label.spec.ts +595 -0
  95. package/src/gtk-value-doors.spec.ts +104 -0
  96. package/src/index.ts +32 -1
  97. package/src/keyboard-operable.spec.ts +5 -4
  98. package/src/namespace/gio.ts +19 -0
  99. package/src/namespace/gtk.ts +14 -0
  100. package/src/shared-tree-builder.ts +268 -0
  101. package/src/shared-trees.spec.ts +296 -32
  102. package/src/source-view/adw-source-view.ts +3 -3
  103. package/src/source-view/asm6502.ts +11 -191
  104. package/src/source-view/index.ts +17 -11
  105. package/src/source-view/theme.ts +23 -17
  106. package/src/split-button.spec.ts +7 -0
  107. package/src/string-list-slot.ts +21 -0
  108. package/src/styles.generated.ts +1 -1
  109. package/src/tags.spec.ts +51 -0
  110. package/src/test.browser.mts +25 -0
  111. package/src/value-lists.spec.ts +93 -0
  112. package/lib/types/source-view/hex.d.ts +0 -21
  113. package/src/source-view/hex.ts +0 -37
@@ -14,6 +14,12 @@
14
14
  import { EditorView } from '@codemirror/view';
15
15
  import { HighlightStyle } from '@codemirror/language';
16
16
  import { tags } from '@lezer/highlight';
17
+ import {
18
+ ADW_SOURCE_PALETTE_DARK,
19
+ ADW_SOURCE_PALETTE_LIGHT,
20
+ ADW_SOURCE_SYNTAX_ROLES,
21
+ type AdwSourcePalette,
22
+ } from '@gjsify/adwaita-core';
17
23
 
18
24
  /**
19
25
  * Monospace stack — the `--monospace-font-family` token, with its own value
@@ -28,8 +34,14 @@ import { tags } from '@lezer/highlight';
28
34
  * and a `.monospace` label on the SAME page rendered in DIFFERENT typefaces.
29
35
  * `_variables.scss` is where that stack is argued about (it explains why
30
36
  * 'Cantarell' is dropped from it), so it is where it lives.
37
+ *
38
+ * The `var()` FALLBACK is a second copy by construction — it has to be, or a page
39
+ * that loads the stylesheet without the theme tokens gets no stack at all — so it
40
+ * is kept to the token's own value and nothing longer, and a tail entry landing in
41
+ * `_variables.scss` (#1817 added 'Consolas') has to land here too.
31
42
  */
32
- const MONO_FONT = "var(--monospace-font-family, 'Adwaita Mono', ui-monospace, 'SF Mono', 'Menlo', monospace)";
43
+ const MONO_FONT =
44
+ "var(--monospace-font-family, 'Adwaita Mono', ui-monospace, 'SF Mono', 'Menlo', 'Consolas', monospace)";
33
45
 
34
46
  /** The CodeMirror EditorView theme mapping `.cm-*` chrome to Adwaita tokens. */
35
47
  export const adwaitaEditorTheme = EditorView.theme({
@@ -95,18 +107,19 @@ export const adwaitaHighlightStyle = HighlightStyle.define([
95
107
  { tag: tags.variableName, color: 'var(--view-fg-color, rgba(0,0,6,0.8))' },
96
108
  ]);
97
109
 
110
+ /**
111
+ * Emit one `--adw-src-<role>: <colour>;` declaration per syntax role, in the
112
+ * core's role order. The two schemes therefore cannot drift into listing
113
+ * different roles, which is the failure a hand-written pair of blocks invites.
114
+ */
115
+ const paletteDeclarations = (palette: AdwSourcePalette): string =>
116
+ ADW_SOURCE_SYNTAX_ROLES.map((role) => ` --adw-src-${role}: ${palette[role]};`).join('\n');
117
+
98
118
  // The light-theme syntax palette + shared chrome. Dark values are supplied by
99
119
  // the overrides block (same mechanism as adwaita-web's _theme.scss: auto via
100
120
  // prefers-color-scheme, manual via .theme-dark / opt-out via .theme-light).
101
121
  const DARK_TOKENS = `
102
- --adw-src-comment: #9a9996;
103
- --adw-src-keyword: #78aeed;
104
- --adw-src-number: #ffa348;
105
- --adw-src-string: #8ff0a4;
106
- --adw-src-label: #dc8add;
107
- --adw-src-register: #33d1c9;
108
- --adw-src-directive: #f66151;
109
- --adw-src-operator: rgba(255, 255, 255, 0.55);
122
+ ${paletteDeclarations(ADW_SOURCE_PALETTE_DARK)}
110
123
  --adw-src-gutter-fg: rgba(255, 255, 255, 0.35);
111
124
  --adw-src-active-line: color-mix(in srgb, #ffffff 6%, transparent);`;
112
125
 
@@ -116,14 +129,7 @@ export const SOURCE_VIEW_STYLE_ID = 'adw-source-view-style';
116
129
  /** The chrome stylesheet: container, copy button, LTR pin, syntax palette. */
117
130
  export const SOURCE_VIEW_CSS = `
118
131
  .adw-source-view {
119
- --adw-src-comment: #5e5c64;
120
- --adw-src-keyword: #1c71d8;
121
- --adw-src-number: #c64600;
122
- --adw-src-string: #26a269;
123
- --adw-src-label: #813d9c;
124
- --adw-src-register: #007e8a;
125
- --adw-src-directive: #a51d2d;
126
- --adw-src-operator: rgba(0, 0, 6, 0.55);
132
+ ${paletteDeclarations(ADW_SOURCE_PALETTE_LIGHT)}
127
133
  --adw-src-selection: color-mix(in srgb, var(--accent-bg-color, #3584e4) 26%, transparent);
128
134
  --adw-src-gutter-bg: var(--view-bg-color, #ffffff);
129
135
  --adw-src-gutter-fg: rgba(0, 0, 6, 0.35);
@@ -338,6 +338,13 @@ export const AdwSplitButtonTest = async () => {
338
338
  expect(el.classList.contains('checked')).toBe(false);
339
339
  host.remove();
340
340
  });
341
+
342
+ // Measured beside a GTK render of the gallery's split-button `.blp`: 5px wider there.
343
+ await it('draws the arrow half 24px wide, as `splitbutton > menubutton > button` is', () => {
344
+ const { el, host } = mount({ label: 'Save' });
345
+ expect(Math.round(dropdownHalf(el).getBoundingClientRect().width)).toBe(24);
346
+ host.remove();
347
+ });
341
348
  });
342
349
 
343
350
  // The two behaviours a hand-rolled popover with only an outside-click handler cannot
@@ -0,0 +1,21 @@
1
+ // The `model` slot `<adw-combo-row>` and `<gtk-drop-down>` share — ADR 0072.
2
+ //
3
+ // A `.blp` writes a list model as an OBJECT at the property it sets,
4
+ // `model: Gtk.StringList { strings [ "Blue", "Teal" ] }`, and the shared-tree builder hands
5
+ // that over as a `<gtk-string-list slot="model" strings='["Blue","Teal"]'>` child. The slot
6
+ // CONSUMES it: the child is data, read for its strings and then gone, as GtkBuilder leaves no
7
+ // list model in the widget tree. The strings are JSON because `model` itself is a JSON
8
+ // attribute on both elements, so the one parser reads both spellings.
9
+
10
+ import { parseListModel } from '@gjsify/adwaita-core';
11
+ import type { AdwComboOption } from '@gjsify/adwaita-core';
12
+
13
+ import type { AdwSlotConsume } from './slotted-children.js';
14
+
15
+ /** The `model` slot, handing the authored list to `adopt`. */
16
+ export function stringListSlot(adopt: (model: AdwComboOption[]) => void): AdwSlotConsume {
17
+ return {
18
+ name: 'model',
19
+ consume: (node) => adopt(parseListModel(node instanceof Element ? node.getAttribute('strings') : null)),
20
+ };
21
+ }