@gjsify/adwaita-web 0.57.0 → 0.59.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 (38) hide show
  1. package/lib/types/clipboard-host.d.ts +7 -0
  2. package/lib/types/gdk.spec.d.ts +1 -0
  3. package/lib/types/gio.spec.d.ts +1 -0
  4. package/lib/types/gtksource/gtk-source-view.d.ts +11 -4
  5. package/lib/types/gtksource/web-editor-driver.d.ts +18 -0
  6. package/lib/types/index.d.ts +1 -0
  7. package/lib/types/namespace/adw.d.ts +1 -0
  8. package/lib/types/namespace/gdk.d.ts +7 -0
  9. package/lib/types/namespace/gio.d.ts +1 -1
  10. package/lib/types/namespace/glib.d.ts +5 -0
  11. package/lib/types/namespace/gobject.d.ts +2 -0
  12. package/lib/types/namespace/gtk-enums.d.ts +5 -0
  13. package/lib/types/namespace/gtk.d.ts +1 -1
  14. package/lib/types/namespace/gtksource.d.ts +1 -1
  15. package/lib/types/style-manager.d.ts +5 -0
  16. package/lib/types/style-manager.spec.d.ts +1 -0
  17. package/package.json +9 -9
  18. package/src/application.spec.ts +1 -1
  19. package/src/clipboard-host.ts +47 -0
  20. package/src/gdk.spec.ts +122 -0
  21. package/src/gio.spec.ts +23 -0
  22. package/src/glib.spec.ts +17 -2
  23. package/src/gobject-door.ts +7 -0
  24. package/src/gtksource/gtk-source-view.spec.ts +154 -5
  25. package/src/gtksource/gtk-source-view.ts +35 -12
  26. package/src/gtksource/web-editor-driver.ts +144 -15
  27. package/src/index.ts +2 -0
  28. package/src/namespace/adw.ts +1 -0
  29. package/src/namespace/gdk.ts +17 -0
  30. package/src/namespace/gio.ts +2 -2
  31. package/src/namespace/glib.ts +17 -2
  32. package/src/namespace/gobject.ts +2 -0
  33. package/src/namespace/gtk-enums.ts +24 -5
  34. package/src/namespace/gtk.ts +1 -1
  35. package/src/namespace/gtksource.ts +14 -3
  36. package/src/style-manager.spec.ts +36 -0
  37. package/src/style-manager.ts +27 -0
  38. package/src/test.browser.mts +6 -0
@@ -21,7 +21,7 @@
21
21
  // are the same write and nothing in this package had to learn a second input shape.
22
22
 
23
23
  export { GtkAdjustment as Adjustment } from '@gjsify/adwaita-core';
24
- export { PolicyType, TextDirection, TextWindowType } from './gtk-enums.js';
24
+ export { PolicyType, TextDirection, TextExtendSelection, TextWindowType } from './gtk-enums.js';
25
25
  export { GtkAboutDialog as AboutDialog } from '../elements/gtk-about-dialog.js';
26
26
  export { GtkActionBar as ActionBar } from '../elements/gtk-action-bar.js';
27
27
  export { GtkApplicationWindow as ApplicationWindow } from '../elements/gtk-application-window.js';
@@ -3,7 +3,18 @@
3
3
  // the NativeScript port publishes. `export * as GtkSource from './namespace/gtksource.js'` in
4
4
  // `src/index.ts` makes it the namespace the `gi://GtkSource` arm answers from.
5
5
  //
6
- // A TRUE SUBSET: GtkSource's gutters, completion, search and the rest are absent, and the arm
7
- // refuses each by name.
8
- export { Buffer, Language, LanguageManager, StyleScheme, StyleSchemeManager, init } from '@gjsify/gtksource-core';
6
+ // A TRUE SUBSET: GtkSource's completion, search and the rest are absent, and the arm refuses each
7
+ // by name.
8
+ export {
9
+ Buffer,
10
+ Gutter,
11
+ GutterLines,
12
+ GutterRenderer,
13
+ GutterRendererText,
14
+ Language,
15
+ LanguageManager,
16
+ StyleScheme,
17
+ StyleSchemeManager,
18
+ init,
19
+ } from '@gjsify/gtksource-core';
9
20
  export { GtkSourceView as View } from '../gtksource/gtk-source-view.js';
@@ -0,0 +1,36 @@
1
+ // The `Adw.StyleManager` door of adwaita-web, held to the shared vectors (real GJS is their oracle, in
2
+ // adwaita-core's `style-manager.gjs.spec.ts`). The page is made dark the way an app does it: the
3
+ // `.theme-dark` / `.theme-light` class on the root.
4
+
5
+ import { STYLE_MANAGER_VECTORS, driveStyleManagerVectors, type AdwStyleLike } from '@gjsify/adwaita-core/conformance';
6
+ import { describe, expect, it } from '@gjsify/unit';
7
+
8
+ import * as Adw from './namespace/adw.js';
9
+
10
+ export const StyleManagerTest = async () => {
11
+ const root = document.documentElement;
12
+ const before = root.className;
13
+ try {
14
+ await driveStyleManagerVectors(
15
+ {
16
+ name: 'adwaita-web',
17
+ isOracle: false,
18
+ Adw: Adw as unknown as AdwStyleLike,
19
+ setDark(dark) {
20
+ root.classList.remove('theme-dark', 'theme-light');
21
+ root.classList.add(dark ? 'theme-dark' : 'theme-light');
22
+ },
23
+ // A MutationObserver reports in a microtask; a task later it has been heard.
24
+ settle: () => new Promise((resolve) => setTimeout(resolve, 0)),
25
+ },
26
+ { describe, it, expect },
27
+ );
28
+ await describe('adwaita-web: Adw.StyleManager door', async () => {
29
+ await it('has a vector row for every vector', () => {
30
+ expect(STYLE_MANAGER_VECTORS.length > 0).toBe(true);
31
+ });
32
+ });
33
+ } finally {
34
+ root.className = before;
35
+ }
36
+ };
@@ -0,0 +1,27 @@
1
+ // `Adw.StyleManager` on the browser: `dark` is what the page shows — a `.theme-dark` / `.theme-light`
2
+ // on the root outranks `prefers-color-scheme` (ADR 0078, `isAdwaitaDark`). The behaviour is the
3
+ // core's (`style-manager.ts`); this file is the SOURCE: the root's `class` attribute and the media
4
+ // query are the two things that can flip it. Without a `document` (SSR) it is light and never changes.
5
+
6
+ import { StyleManagerBase, type StyleSource } from '@gjsify/adwaita-core';
7
+
8
+ import { isAdwaitaDark } from './accent.js';
9
+
10
+ export const webStyleSource: StyleSource = {
11
+ dark: () => typeof document !== 'undefined' && isAdwaitaDark(document.documentElement),
12
+ subscribe(changed) {
13
+ if (typeof document === 'undefined') return () => {};
14
+ const media = globalThis.matchMedia?.('(prefers-color-scheme: dark)');
15
+ media?.addEventListener('change', changed);
16
+ const observer = new MutationObserver(changed);
17
+ observer.observe(document.documentElement, { attributes: true, attributeFilter: ['class'] });
18
+ return () => {
19
+ media?.removeEventListener('change', changed);
20
+ observer.disconnect();
21
+ };
22
+ },
23
+ };
24
+
25
+ export class AdwStyleManager extends StyleManagerBase {
26
+ static override source = webStyleSource;
27
+ }
@@ -141,7 +141,10 @@ import { AdwFontsTest } from './adw-fonts.spec.js';
141
141
  import { AdwConstructVectorsTest } from './construct-vectors.spec.js';
142
142
  import { GObjectDoorTest } from './gobject-door.spec.js';
143
143
  import { ApplicationTest } from './application.spec.js';
144
+ import { GdkTest } from './gdk.spec.js';
144
145
  import { GLibTest } from './glib.spec.js';
146
+ import { StyleManagerTest } from './style-manager.spec.js';
147
+ import { GioActionsTest } from './gio.spec.js';
145
148
  import { MenuActionsTest } from './menu-actions.spec.js';
146
149
  import { AdwSharedTreesTest } from './shared-trees.spec.js';
147
150
  import { AdwBlueprintTreeTest } from './blueprint-tree.spec.js';
@@ -158,7 +161,10 @@ run({
158
161
  AdwConstructVectorsTest,
159
162
  GObjectDoorTest,
160
163
  ApplicationTest,
164
+ GdkTest,
161
165
  GLibTest,
166
+ StyleManagerTest,
167
+ GioActionsTest,
162
168
  MenuActionsTest,
163
169
  AdwBlueprintTreeTest,
164
170
  AdwValueListsTest,