@gjsify/adwaita-web 0.44.0 → 0.46.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 (114) hide show
  1. package/README.md +8 -6
  2. package/dist/adwaita-web.css +96 -96
  3. package/dist/adwaita-web.css.map +1 -1
  4. package/lib/types/elements/adw-entry-row.d.ts +2 -2
  5. package/lib/types/elements/adw-expander-row.d.ts +1 -1
  6. package/lib/types/elements/adw-header-bar.d.ts +16 -8
  7. package/lib/types/elements/adw-split-button.d.ts +1 -1
  8. package/lib/types/elements/adw-switch-row.d.ts +1 -1
  9. package/lib/types/elements/adw-wrap-box.d.ts +1 -1
  10. package/lib/types/elements/{adw-checks.d.ts → checks.d.ts} +9 -2
  11. package/lib/types/elements/{adw-button.d.ts → gtk-button.d.ts} +1 -1
  12. package/lib/types/elements/{adw-drop-down.d.ts → gtk-drop-down.d.ts} +6 -6
  13. package/lib/types/elements/{adw-entry.d.ts → gtk-entry.d.ts} +1 -1
  14. package/lib/types/elements/{adw-icon.d.ts → gtk-image.d.ts} +2 -2
  15. package/lib/types/elements/{adw-menu-button.d.ts → gtk-menu-button.d.ts} +13 -4
  16. package/lib/types/elements/{adw-popover.d.ts → gtk-popover.d.ts} +9 -9
  17. package/lib/types/elements/{adw-progress-bar.d.ts → gtk-progress-bar.d.ts} +1 -1
  18. package/lib/types/elements/{adw-switch.d.ts → gtk-switch.d.ts} +2 -2
  19. package/lib/types/elements/view-switcher-dom.d.ts +4 -4
  20. package/lib/types/exported-elements.d.ts +10 -0
  21. package/lib/types/gtk-button.spec.d.ts +1 -0
  22. package/lib/types/gtk-drop-down.spec.d.ts +1 -0
  23. package/lib/types/gtk-entry.spec.d.ts +1 -0
  24. package/lib/types/gtk-image.spec.d.ts +1 -0
  25. package/lib/types/gtk-menu-button.spec.d.ts +1 -0
  26. package/lib/types/gtk-progress-bar.spec.d.ts +1 -0
  27. package/lib/types/gtk-switch.spec.d.ts +1 -0
  28. package/lib/types/icon-registry.d.ts +2 -2
  29. package/lib/types/index.d.ts +13 -51
  30. package/lib/types/namespace/adw.d.ts +44 -0
  31. package/lib/types/namespace/gtk.d.ts +9 -0
  32. package/lib/types/styles.generated.d.ts +1 -1
  33. package/package.json +9 -6
  34. package/scss/_about_dialog.scss +1 -1
  35. package/scss/_button.scss +4 -4
  36. package/scss/_checks.scss +6 -6
  37. package/scss/_drop_down.scss +3 -3
  38. package/scss/_entry.scss +3 -3
  39. package/scss/_expander_row.scss +1 -1
  40. package/scss/_icon.scss +4 -4
  41. package/scss/_menu_button.scss +3 -3
  42. package/scss/_popover.scss +2 -2
  43. package/scss/_progress_bar.scss +4 -4
  44. package/scss/_reset.scss +10 -8
  45. package/scss/_split_button.scss +1 -1
  46. package/scss/_style_classes.scss +9 -9
  47. package/scss/_switch.scss +2 -2
  48. package/scss/_switch_row.scss +1 -1
  49. package/scss/_toast.scss +1 -1
  50. package/scss/adwaita-skin.scss +2 -2
  51. package/src/adw-action-rows.spec.ts +2 -2
  52. package/src/adw-button-content.spec.ts +1 -1
  53. package/src/adw-header-bar.spec.ts +9 -4
  54. package/src/adw-tab-view.spec.ts +71 -0
  55. package/src/bottom-sheet.spec.ts +2 -2
  56. package/src/{adw-checks.spec.ts → checks.spec.ts} +11 -11
  57. package/src/chrome.spec.ts +2 -2
  58. package/src/connect-lifecycle.spec.ts +10 -7
  59. package/src/elements/adw-about-dialog.ts +6 -6
  60. package/src/elements/adw-avatar.ts +4 -4
  61. package/src/elements/adw-button-content.ts +6 -6
  62. package/src/elements/adw-button-row.ts +6 -6
  63. package/src/elements/adw-combo-row.ts +1 -1
  64. package/src/elements/adw-entry-row.ts +5 -5
  65. package/src/elements/adw-expander-row.ts +10 -10
  66. package/src/elements/adw-header-bar.ts +34 -13
  67. package/src/elements/adw-navigation-view.ts +24 -4
  68. package/src/elements/adw-password-entry-row.ts +3 -3
  69. package/src/elements/adw-sidebar.ts +4 -4
  70. package/src/elements/adw-split-button.ts +14 -14
  71. package/src/elements/adw-status-page.ts +4 -4
  72. package/src/elements/adw-switch-row.ts +8 -8
  73. package/src/elements/adw-tab-view.ts +32 -10
  74. package/src/elements/adw-toast-overlay.ts +2 -2
  75. package/src/elements/adw-toggle-group.ts +3 -3
  76. package/src/elements/adw-view-switcher-bar.ts +3 -3
  77. package/src/elements/adw-view-switcher.ts +3 -3
  78. package/src/elements/{adw-checks.ts → checks.ts} +13 -6
  79. package/src/elements/{adw-button.ts → gtk-button.ts} +6 -6
  80. package/src/elements/{adw-drop-down.ts → gtk-drop-down.ts} +18 -18
  81. package/src/elements/{adw-entry.ts → gtk-entry.ts} +4 -4
  82. package/src/elements/{adw-icon.ts → gtk-image.ts} +5 -5
  83. package/src/elements/{adw-menu-button.ts → gtk-menu-button.ts} +27 -18
  84. package/src/elements/{adw-popover.ts → gtk-popover.ts} +18 -18
  85. package/src/elements/{adw-progress-bar.ts → gtk-progress-bar.ts} +5 -5
  86. package/src/elements/{adw-switch.ts → gtk-switch.ts} +4 -4
  87. package/src/elements/view-switcher-dom.ts +5 -5
  88. package/src/exported-elements.ts +50 -0
  89. package/src/{adw-button.spec.ts → gtk-button.spec.ts} +6 -6
  90. package/src/{adw-drop-down.spec.ts → gtk-drop-down.spec.ts} +17 -17
  91. package/src/{adw-entry.spec.ts → gtk-entry.spec.ts} +8 -8
  92. package/src/{adw-icon.spec.ts → gtk-image.spec.ts} +21 -21
  93. package/src/{adw-menu-button.spec.ts → gtk-menu-button.spec.ts} +6 -6
  94. package/src/{adw-progress-bar.spec.ts → gtk-progress-bar.spec.ts} +12 -12
  95. package/src/{adw-switch.spec.ts → gtk-switch.spec.ts} +20 -20
  96. package/src/icon-registry.spec.ts +6 -6
  97. package/src/icon-registry.ts +6 -6
  98. package/src/index.ts +64 -63
  99. package/src/namespace/adw.ts +99 -0
  100. package/src/namespace/gtk.ts +22 -0
  101. package/src/preferences-search.ts +1 -1
  102. package/src/slotted-children.spec.ts +5 -3
  103. package/src/source-view/adw-source-view.ts +2 -2
  104. package/src/split-button.spec.ts +5 -5
  105. package/src/styles.generated.ts +1 -1
  106. package/src/test.browser.mts +15 -15
  107. package/lib/types/adw-button.spec.d.ts +0 -1
  108. package/lib/types/adw-drop-down.spec.d.ts +0 -1
  109. package/lib/types/adw-entry.spec.d.ts +0 -1
  110. package/lib/types/adw-icon.spec.d.ts +0 -1
  111. package/lib/types/adw-menu-button.spec.d.ts +0 -1
  112. package/lib/types/adw-progress-bar.spec.d.ts +0 -1
  113. package/lib/types/adw-switch.spec.d.ts +0 -1
  114. /package/lib/types/{adw-checks.spec.d.ts → checks.spec.d.ts} +0 -0
@@ -0,0 +1,99 @@
1
+ // The libadwaita half of `@gjsify/adwaita-web`'s vocabulary — `Adw.ActionRow`,
2
+ // `Adw.Clamp`, one member per element whose own tag is an `adw-*` tag in the GIR.
3
+ // `export * as Adw from './namespace/adw.js'` in `src/index.ts` turns this module into
4
+ // the namespace object.
5
+ //
6
+ // ADR 0034 clause 2, and since § Amendment 6 this is the ONLY way to reach one of these
7
+ // widget classes: the prefixed `AdwActionRow` / `GtkEntry` exports are gone from the
8
+ // package root. The TAGS are untouched — `<adw-action-row>` and `<gtk-entry>` are what
9
+ // they were, and nothing here changes a registration.
10
+ //
11
+ // It landed additive, and the amendment says why that could not be the end state: a
12
+ // second spelling that never goes away is a permanent second vocabulary, which is the
13
+ // thing clause 2 exists to remove.
14
+ //
15
+ // WHICH NAMESPACE A MEMBER LANDS IN IS NOT A CHOICE MADE HERE. It is read off the GIR tag
16
+ // the element already answers to, which is clause 1 applied rather than restated:
17
+ //
18
+ // * the element's own spelling IS a tag in gtk-host's generated widget table
19
+ // (`adw-action-row`) -> libadwaita owns the GType -> `Adw.ActionRow`, this file;
20
+ // * the element is declared in `WEB_ELEMENT_ALIGNMENT` as an alias of a `gtk-*` tag
21
+ // (`<adw-entry>` is `gtk-entry`) -> GTK owns the GType -> `Gtk.Entry`, `./gtk.ts`.
22
+ // On those the `adw-` prefix names the design system and not the widget, which is
23
+ // what each entry's `why` already says; exporting them under `Adw` would carry the
24
+ // flattening this ADR exists to undo one indirection further in.
25
+ //
26
+ // THE `webOnly` ELEMENTS GET NO MEMBER, and that absence IS the declaration. A
27
+ // `webOnly` entry says no widget in the reference vocabulary stands behind the element,
28
+ // so there is no GIR name to export it under; a member invented for one could only ever
29
+ // be held against this repository's own prose, which ADR 0034 § 5 names as the half that
30
+ // cannot go red. Some of them do name a real libadwaita GType — `AdwTabPage`,
31
+ // `AdwViewStackPage`, `AdwSidebarItem`, `AdwSidebarSection` descend from `GObject.Object`
32
+ // and not `GtkWidget`, so a table of concrete widgets has no row for them — and they are
33
+ // why this is worth stating: the day the reference table starts carrying one, its member
34
+ // appears here by itself, because the derivation reads that table. `<adw-toggle>` already
35
+ // made that move (ADR 0028 § Amendment, 2026-08-28) and needed no edit here.
36
+ //
37
+ // WHY A RE-EXPORT BARREL AND NOT AN OBJECT LITERAL. It was `export const Adw = { … }`
38
+ // beside a merged `export namespace Adw { … }` of instance types, so that `Adw.HeaderBar`
39
+ // could annotate as well as construct — every call site in this repository imports these
40
+ // classes with `import type`. `tsc` accepts that merge; ROLLDOWN'S oxc PARSER DOES NOT,
41
+ // and it fails at PARSE time — `Identifier \`Adw\` has already been declared`, a
42
+ // PARSE_ERROR out of `Bundler::generate` that took every showcase importing this package
43
+ // with it while `gjsify tsc` stayed green. The two check different things and the bundler
44
+ // is the stricter one. An `export { X as Y } from` line needs no merge and no TypeScript
45
+ // construct at all: a module namespace carries the value AND the type meaning of every
46
+ // name in it, so `new Adw.HeaderBar()` and `as Adw.HeaderBar` both work off ONE list.
47
+ // A second list of instance types could drift from the first; this one cannot exist.
48
+ //
49
+ // WHAT HOLDS IT: the namespace half of `scripts/check-vocabulary-alignment.mjs`. It
50
+ // derives the members from the elements `customElements.define` registers and the
51
+ // alignment table, and compares in both directions — an element with no member fails, a
52
+ // member with no element fails, and a member bound to a class that is not that element's
53
+ // fails. `namespaceExport` in `scripts/adwaita-elements.mjs` follows the one hop from
54
+ // `src/index.ts` to this file and reads the LEFT side of each `as` as the binding.
55
+
56
+ export { AdwAboutDialog as AboutDialog } from '../elements/adw-about-dialog.js';
57
+ export { AdwActionRow as ActionRow } from '../elements/adw-action-row.js';
58
+ export { AdwAlertDialog as AlertDialog } from '../elements/adw-alert-dialog.js';
59
+ export { AdwAvatar as Avatar } from '../elements/adw-avatar.js';
60
+ export { AdwBanner as Banner } from '../elements/adw-banner.js';
61
+ export { AdwBottomSheet as BottomSheet } from '../elements/adw-bottom-sheet.js';
62
+ export { AdwButtonContent as ButtonContent } from '../elements/adw-button-content.js';
63
+ export { AdwButtonRow as ButtonRow } from '../elements/adw-button-row.js';
64
+ export { AdwCarousel as Carousel } from '../elements/adw-carousel.js';
65
+ export { AdwCarouselIndicatorDots as CarouselIndicatorDots } from '../elements/adw-carousel.js';
66
+ export { AdwCarouselIndicatorLines as CarouselIndicatorLines } from '../elements/adw-carousel.js';
67
+ export { AdwClamp as Clamp } from '../elements/adw-clamp.js';
68
+ export { AdwComboRow as ComboRow } from '../elements/adw-combo-row.js';
69
+ export { AdwDialog as Dialog } from '../elements/adw-dialog.js';
70
+ export { AdwEntryRow as EntryRow } from '../elements/adw-entry-row.js';
71
+ export { AdwExpanderRow as ExpanderRow } from '../elements/adw-expander-row.js';
72
+ export { AdwHeaderBar as HeaderBar } from '../elements/adw-header-bar.js';
73
+ export { AdwInlineViewSwitcher as InlineViewSwitcher } from '../elements/adw-inline-view-switcher.js';
74
+ export { AdwNavigationPage as NavigationPage } from '../elements/adw-navigation-view.js';
75
+ export { AdwNavigationSplitView as NavigationSplitView } from '../elements/adw-navigation-split-view.js';
76
+ export { AdwNavigationView as NavigationView } from '../elements/adw-navigation-view.js';
77
+ export { AdwOverlaySplitView as OverlaySplitView } from '../elements/adw-overlay-split-view.js';
78
+ export { AdwPasswordEntryRow as PasswordEntryRow } from '../elements/adw-password-entry-row.js';
79
+ export { AdwPreferencesDialog as PreferencesDialog } from '../elements/adw-preferences-dialog.js';
80
+ export { AdwPreferencesGroup as PreferencesGroup } from '../elements/adw-preferences-group.js';
81
+ export { AdwPreferencesPage as PreferencesPage } from '../elements/adw-preferences-dialog.js';
82
+ export { AdwShortcutLabel as ShortcutLabel } from '../elements/adw-shortcut-label.js';
83
+ export { AdwSidebar as Sidebar } from '../elements/adw-sidebar.js';
84
+ export { AdwSpinRow as SpinRow } from '../elements/adw-spin-row.js';
85
+ export { AdwSpinner as Spinner } from '../elements/adw-spinner.js';
86
+ export { AdwSplitButton as SplitButton } from '../elements/adw-split-button.js';
87
+ export { AdwStatusPage as StatusPage } from '../elements/adw-status-page.js';
88
+ export { AdwSwitchRow as SwitchRow } from '../elements/adw-switch-row.js';
89
+ export { AdwTabView as TabView } from '../elements/adw-tab-view.js';
90
+ export { AdwToastOverlay as ToastOverlay } from '../elements/adw-toast-overlay.js';
91
+ export { AdwToggle as Toggle } from '../elements/adw-toggle-group.js';
92
+ export { AdwToggleGroup as ToggleGroup } from '../elements/adw-toggle-group.js';
93
+ export { AdwToolbarView as ToolbarView } from '../elements/adw-toolbar-view.js';
94
+ export { AdwViewStack as ViewStack } from '../elements/adw-view-stack.js';
95
+ export { AdwViewSwitcher as ViewSwitcher } from '../elements/adw-view-switcher.js';
96
+ export { AdwViewSwitcherBar as ViewSwitcherBar } from '../elements/adw-view-switcher-bar.js';
97
+ export { AdwWindow as Window } from '../elements/adw-window.js';
98
+ export { AdwWindowTitle as WindowTitle } from '../elements/adw-window-title.js';
99
+ export { AdwWrapBox as WrapBox } from '../elements/adw-wrap-box.js';
@@ -0,0 +1,22 @@
1
+ // The GTK half of `@gjsify/adwaita-web`'s vocabulary — `Gtk.Entry`, `Gtk.Button`, one
2
+ // member per element that `WEB_ELEMENT_ALIGNMENT` declares an alias of a `gtk-*` tag.
3
+ // `export * as Gtk from './namespace/gtk.js'` in `src/index.ts` makes it the namespace.
4
+ //
5
+ // The derivation, the reason these are NOT `Adw.*`, why the `webOnly` elements have no
6
+ // member, and why this is a re-export barrel rather than an object literal are all in
7
+ // `./adw.ts`. One statement of it, because a second copy is the one that drifts.
8
+ //
9
+ // `Gtk.CheckButton` IS `GtkCheckButton`, NOT `AdwRadio` — the one GIR name two elements
10
+ // declare. GTK4 has no radio type: a radio is a GtkCheckButton with its `group` set,
11
+ // which is what `<adw-radio>`'s own `why` in the ledger says. So the plain form takes the
12
+ // GIR name and the grouped one keeps its flat export in `src/index.ts`.
13
+
14
+ export { GtkButton as Button } from '../elements/gtk-button.js';
15
+ export { GtkCheckButton as CheckButton } from '../elements/checks.js';
16
+ export { GtkDropDown as DropDown } from '../elements/gtk-drop-down.js';
17
+ export { GtkEntry as Entry } from '../elements/gtk-entry.js';
18
+ export { GtkImage as Image } from '../elements/gtk-image.js';
19
+ export { GtkMenuButton as MenuButton } from '../elements/gtk-menu-button.js';
20
+ export { GtkPopover as Popover } from '../elements/gtk-popover.js';
21
+ export { GtkProgressBar as ProgressBar } from '../elements/gtk-progress-bar.js';
22
+ export { GtkSwitch as Switch } from '../elements/gtk-switch.js';
@@ -41,7 +41,7 @@ const ACTION_ROW_TAGS: ReadonlySet<string> = new Set([
41
41
  /**
42
42
  * `ADW_IS_PREFERENCES_ROW` for the browser elements — the first clause of
43
43
  * `row_has_title`. Spelled out rather than inferred from the `adw-` prefix, because a
44
- * group's boxed list legitimately holds other things: a bare `<adw-button>` dropped in as
44
+ * group's boxed list legitimately holds other things: a bare `<gtk-button>` dropped in as
45
45
  * a footer is not a preferences row and must not be searchable.
46
46
  */
47
47
  const PREFERENCES_ROW_TAGS: ReadonlySet<string> = new Set([
@@ -16,6 +16,9 @@
16
16
  import { describe, expect, it } from '@gjsify/unit';
17
17
 
18
18
  import * as adwaitaWeb from './index.js';
19
+ // See `exported-elements.ts`: the widget classes live inside the exported `Adw`/`Gtk`
20
+ // objects, so a top-level `Object.values` finds only the web-only stragglers.
21
+ import { exportedElementClasses } from './exported-elements.js';
19
22
  import { bindSlottedChildren, slottedChildrenOf } from './slotted-children.js';
20
23
 
21
24
  /** One microtask checkpoint — where a MutationObserver callback lands. */
@@ -164,9 +167,8 @@ export const AdwSlottedChildrenTest = async () => {
164
167
  // declared child and an appended one in the same place.
165
168
  await describe('every slotted element adopts a late child where it adopts a declared one', async () => {
166
169
  const tags: string[] = [];
167
- for (const exported of Object.values(adwaitaWeb)) {
168
- if (typeof exported !== 'function' || !(exported.prototype instanceof HTMLElement)) continue;
169
- const tag = customElements.getName(exported as CustomElementConstructor);
170
+ for (const exported of exportedElementClasses(adwaitaWeb)) {
171
+ const tag = customElements.getName(exported);
170
172
  if (tag !== null) tags.push(tag);
171
173
  }
172
174
  tags.sort();
@@ -34,7 +34,7 @@ import { defaultKeymap, history, historyKeymap } from '@codemirror/commands';
34
34
  import { asm6502 } from './asm6502.js';
35
35
  import { adwaitaEditorTheme, adwaitaHighlightStyle, ensureSourceViewStyleInjected } from './theme.js';
36
36
  import { formatHexAddress, formatLineNumber, stripWhitespace } from './hex.js';
37
- import { createAdwIcon } from '../elements/adw-icon.js';
37
+ import { createGtkImage } from '../elements/gtk-image.js';
38
38
 
39
39
  /** A recognisable copy glyph rendered inline so the subpath needs no icon CSS. */
40
40
  const COPY_SVG =
@@ -405,7 +405,7 @@ export class AdwSourceView extends HTMLElement {
405
405
  }
406
406
  // A non-default icon uses the adwaita-web mask class (requires the main
407
407
  // bundle's icon CSS to be present).
408
- this._copyButton.replaceChildren(createAdwIcon(name));
408
+ this._copyButton.replaceChildren(createGtkImage(name));
409
409
  }
410
410
 
411
411
  private _readDeclarativeAttributes(): void {
@@ -328,8 +328,8 @@ export const AdwSplitButtonTest = async () => {
328
328
 
329
329
  // The two behaviours a hand-rolled popover with only an outside-click handler cannot
330
330
  // give: leaving by keyboard, and reaching the items with the arrow keys. Both come
331
- // from `<adw-popover>`, and these cases prove the lift was a lift, not a move.
332
- await describe('adw-split-button menu keyboard (gained with <adw-popover>)', async () => {
331
+ // from `<gtk-popover>`, and these cases prove the lift was a lift, not a move.
332
+ await describe('adw-split-button menu keyboard (gained with <gtk-popover>)', async () => {
333
333
  await it('Escape dismisses the menu and returns focus to the dropdown half', () => {
334
334
  const { el, host } = mount({ menu: '[{"label":"Print"},{"label":"Export"}]' });
335
335
  dropdownHalf(el).click();
@@ -370,7 +370,7 @@ export const AdwSplitButtonTest = async () => {
370
370
  // Opening focuses the first row — without that there is nothing to move from.
371
371
  expect(document.activeElement).toBe(items[0]);
372
372
 
373
- const menu = el.querySelector('adw-popover') as HTMLElement;
373
+ const menu = el.querySelector('gtk-popover') as HTMLElement;
374
374
  const press = (key: string) => menu.dispatchEvent(new KeyboardEvent('keydown', { key, bubbles: true }));
375
375
 
376
376
  press('ArrowDown');
@@ -396,7 +396,7 @@ export const AdwSplitButtonTest = async () => {
396
396
  el.addEventListener('menu-activated', (event) => seen.push((event as CustomEvent).detail.index));
397
397
 
398
398
  dropdownHalf(el).click();
399
- const menu = el.querySelector('adw-popover') as HTMLElement;
399
+ const menu = el.querySelector('gtk-popover') as HTMLElement;
400
400
  menu.dispatchEvent(new KeyboardEvent('keydown', { key: 'ArrowDown', bubbles: true }));
401
401
  menu.dispatchEvent(new KeyboardEvent('keydown', { key: 'Enter', bubbles: true }));
402
402
 
@@ -425,7 +425,7 @@ export const AdwSplitButtonTest = async () => {
425
425
  await it(`draws a ${menuVector?.borderRadius}px surface with ${menuVector?.padding}px padding and a THREE-layer shadow`, () => {
426
426
  const { el, host } = mount({ menu: '[{"label":"Print"}]' });
427
427
  dropdownHalf(el).click();
428
- const surface = el.querySelector('adw-popover') as HTMLElement;
428
+ const surface = el.querySelector('gtk-popover') as HTMLElement;
429
429
  const style = getComputedStyle(surface);
430
430
 
431
431
  expect(style.paddingTop).toBe(`${menuVector?.padding}px`);