@gjsify/adwaita-web 0.64.2-next.255 → 0.64.3-next.260

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.
@@ -8,7 +8,7 @@
8
8
  // would be a third place to forget.
9
9
 
10
10
  import { describe, expect, it } from '@gjsify/unit';
11
- import { MENU_REFUSAL_VECTORS } from '@gjsify/adwaita-core/conformance';
11
+ import { MENU_LABEL_TEXT_VECTORS, MENU_REFUSAL_VECTORS } from '@gjsify/adwaita-core/conformance';
12
12
  import { flattenMenu } from '@gjsify/adwaita-core';
13
13
  import type { AdwMenuInput, AdwMenuModel } from '@gjsify/adwaita-core';
14
14
 
@@ -258,4 +258,17 @@ export const GtkPopoverMenuTest = async () => {
258
258
  }
259
259
  });
260
260
  });
261
+
262
+ await describe('<gtk-popover-menu> the row text (a GtkLabel with use-underline)', async () => {
263
+ for (const { label, text, rule } of MENU_LABEL_TEXT_VECTORS) {
264
+ await it(`item, submenu and back row: ${rule}`, () => {
265
+ const el = mount();
266
+ el.menuModel = [{ label }, { label, submenu: [{ label }] }];
267
+ expect(labels(el)).toStrictEqual([text, text]);
268
+ el.openSubmenu(label);
269
+ expect(labels(el)).toStrictEqual([text, text]);
270
+ unmountAll();
271
+ });
272
+ }
273
+ });
261
274
  };
@@ -0,0 +1,10 @@
1
+ // What the browser knows of the user's languages, for `GLib.get_language_names()`: the ordered
2
+ // `navigator.languages`, or `navigator.language` where a host has only that. Read at CALL time, never
3
+ // at import — the user can change the list while the page is open, and a module may be evaluated where
4
+ // there is no `navigator` at all (SSR, a worker without one).
5
+
6
+ export function hostLanguageTags(): string[] {
7
+ const host = typeof navigator === 'undefined' ? undefined : navigator;
8
+ if (host?.languages && host.languages.length > 0) return [...host.languages];
9
+ return host?.language ? [host.language] : [];
10
+ }
@@ -7,24 +7,34 @@
7
7
  // in `glib-paths.ts` of the core; the host has no filesystem, so `get_current_dir()` is `"/"` and
8
8
  // `get_system_data_dirs()` is `[]`. A port that knows better replaces the member in its own file.
9
9
  //
10
- // `uri_escape_string` is the core's `glib-uri.ts`, a pure function over UTF-8 bytes.
10
+ // `get_language_names` is the core's `glib-language.ts` over the host's language tags
11
+ // (`language-host.ts`: `navigator.languages`), read when it is CALLED. The tag rule is in the core's header.
12
+ //
13
+ // `uri_escape_string` is the core's `glib-uri.ts`, a pure function over UTF-8 bytes;
14
+ // `unichar_isalpha` is `glib-unichar.ts`, a generated table (no `\p{L}`: no ICU on NativeScript).
11
15
  //
12
16
  // `Bytes` and `Error` are the ADR 0100 subset a `Gio.File` reads and fails with (`get_data`,
13
17
  // `matches`, `code`, `message`), re-exported from the core's `glib-bytes.ts` / `glib-error.ts`.
14
18
  //
19
+ // `Variant` is the ADR 0118 subset (`b i u d s` and arrays of them) `Gio.Settings` stores array
20
+ // keys with, re-exported from the core's `glib-variant.ts`.
21
+ //
15
22
  // A TRUE SUBSET: everything else in GLib (`MainLoop`, `Source`, `timeout_add_seconds`,
16
23
  // `get_home_dir`, …) is absent, and the `gi://GLib` arm refuses it by name.
17
24
 
18
- export { GLibBytes as Bytes, GLibError as Error } from '@gjsify/adwaita-core';
25
+ export { GLibBytes as Bytes, GLibError as Error, GLibVariant as Variant } from '@gjsify/adwaita-core';
19
26
 
20
27
  import {
21
28
  buildFilenamev,
22
29
  createGLibTimers,
23
30
  getCurrentDir,
24
31
  getSystemDataDirs,
32
+ languageNamesFromTags,
25
33
  MAXUINT32 as GLIB_MAXUINT32,
34
+ unicharIsalpha,
26
35
  uriEscapeString,
27
36
  } from '@gjsify/adwaita-core';
37
+ import { hostLanguageTags } from '../language-host.js';
28
38
 
29
39
  const glib = createGLibTimers();
30
40
 
@@ -43,4 +53,6 @@ export const MAXUINT32 = GLIB_MAXUINT32;
43
53
  export const build_filenamev = buildFilenamev;
44
54
  export const get_current_dir = getCurrentDir;
45
55
  export const get_system_data_dirs = getSystemDataDirs;
56
+ export const get_language_names = (): string[] => languageNamesFromTags(hostLanguageTags());
46
57
  export const uri_escape_string = uriEscapeString;
58
+ export const unichar_isalpha = unicharIsalpha;