@gjsify/adwaita-web 0.59.1 → 0.61.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 (55) hide show
  1. package/README.md +11 -0
  2. package/dist/adwaita-web.css +4 -0
  3. package/dist/adwaita-web.css.map +1 -1
  4. package/lib/types/elements/gtk-button.d.ts +13 -0
  5. package/lib/types/elements/gtk-drop-down.d.ts +4 -0
  6. package/lib/types/elements/gtk-label.d.ts +4 -0
  7. package/lib/types/elements/gtk-text-view.d.ts +15 -0
  8. package/lib/types/file-chooser-host.d.ts +55 -0
  9. package/lib/types/file-chooser.spec.d.ts +1 -0
  10. package/lib/types/gtk-platform.spec.d.ts +1 -0
  11. package/lib/types/namespace/adw.d.ts +1 -0
  12. package/lib/types/namespace/gdk.d.ts +2 -0
  13. package/lib/types/namespace/gio.d.ts +3 -0
  14. package/lib/types/namespace/glib.d.ts +1 -0
  15. package/lib/types/namespace/gtk-enums.d.ts +22 -0
  16. package/lib/types/namespace/gtk-platform.d.ts +13 -0
  17. package/lib/types/namespace/gtk.d.ts +4 -1
  18. package/lib/types/platform-host.d.ts +2 -0
  19. package/lib/types/registered-styles.d.ts +2 -0
  20. package/lib/types/style-manager.d.ts +7 -0
  21. package/lib/types/styles.generated.d.ts +1 -1
  22. package/lib/types/template-classes.d.ts +2 -0
  23. package/lib/types/widget-members.spec.d.ts +1 -0
  24. package/package.json +23 -10
  25. package/scss/_viewport.scss +9 -0
  26. package/src/capabilities.mjs +1 -4
  27. package/src/construct-vectors.spec.ts +10 -1
  28. package/src/elements/gtk-button.ts +34 -0
  29. package/src/elements/gtk-drop-down.ts +10 -0
  30. package/src/elements/gtk-label.ts +10 -0
  31. package/src/elements/gtk-text-view.ts +40 -0
  32. package/src/file-chooser-host.ts +421 -0
  33. package/src/file-chooser.spec.ts +376 -0
  34. package/src/gobject-door.ts +15 -2
  35. package/src/gobject-elements.ts +4 -0
  36. package/src/gtk-drop-down.spec.ts +11 -0
  37. package/src/gtk-label.spec.ts +12 -0
  38. package/src/gtk-platform.spec.ts +19 -0
  39. package/src/gtk-text-view.spec.ts +22 -0
  40. package/src/namespace/adw.ts +1 -0
  41. package/src/namespace/gdk.ts +18 -1
  42. package/src/namespace/gio.ts +20 -2
  43. package/src/namespace/glib.ts +6 -1
  44. package/src/namespace/gtk-enums.ts +7 -2
  45. package/src/namespace/gtk-platform.ts +16 -0
  46. package/src/namespace/gtk.ts +12 -1
  47. package/src/platform-host.ts +88 -0
  48. package/src/registered-styles.ts +73 -0
  49. package/src/shared-tree-builder.ts +46 -2
  50. package/src/shared-trees.spec.ts +36 -0
  51. package/src/style-manager.ts +10 -1
  52. package/src/styles.generated.ts +1 -1
  53. package/src/template-classes.ts +6 -0
  54. package/src/test.browser.mts +6 -0
  55. package/src/widget-members.spec.ts +147 -0
@@ -8,6 +8,19 @@ export declare class GtkButton extends HTMLElement {
8
8
  /** `Gtk.Button:child`, or `null` while the icon and the label fill the button. */
9
9
  private _child;
10
10
  static get observedAttributes(): string[];
11
+ /**
12
+ * `Gtk.Button:icon-name` and `Gtk.Widget:tooltip-text`, the GObject spellings: a class that
13
+ * holds a button as a template child writes `button.icon_name = …`, which must reach the DOM.
14
+ */
15
+ get icon_name(): string | null;
16
+ set icon_name(value: string | null);
17
+ get iconName(): string | null;
18
+ set iconName(value: string | null);
19
+ get tooltip_text(): string | null;
20
+ set tooltip_text(value: string | null);
21
+ get tooltipText(): string | null;
22
+ set tooltipText(value: string | null);
23
+ private reflect;
11
24
  /** The inner native button (for focus/imperative access). */
12
25
  get button(): HTMLButtonElement;
13
26
  connectedCallback(): void;
@@ -28,6 +28,10 @@ export declare class GtkDropDown extends HTMLElement {
28
28
  /** The selected index. Out-of-range values are ignored (Gtk.DropDown:selected). */
29
29
  get selected(): number;
30
30
  set selected(value: number);
31
+ /** `gtk_drop_down_get_selected`. */
32
+ get_selected(): number;
33
+ /** `gtk_drop_down_set_selected`; an out-of-range index is ignored, as the `selected` property does. */
34
+ set_selected(position: number): void;
31
35
  /** The selected option's value, or '' when empty (Gtk.DropDown:selected-item). */
32
36
  get selectedValue(): string;
33
37
  set selectedValue(value: string);
@@ -82,6 +82,10 @@ export declare class GtkLabel extends HTMLElement {
82
82
  /** `Gtk.Label:selectable` — whether the text can be selected. GTK's default is not. */
83
83
  get selectable(): boolean;
84
84
  set selectable(value: boolean);
85
+ /** `gtk_label_get_label`. */
86
+ get_label(): string;
87
+ /** `gtk_label_set_label`. */
88
+ set_label(str: string): void;
85
89
  /** `gtk_label_get_text` — the text as SHOWN, markup reduced and the marker removed. */
86
90
  getText(): string;
87
91
  connectedCallback(): void;
@@ -2,6 +2,13 @@ import { type LabelJustification } from '@gjsify/adwaita-core';
2
2
  /** `Gtk.WrapMode`'s four nicks, in enum order — Pango's enum, and the DEFAULT is `none`. */
3
3
  declare const WRAP_MODES: readonly ["none", "char", "word", "word-char"];
4
4
  type TextViewWrapMode = (typeof WRAP_MODES)[number];
5
+ /** The members of `Gtk.TextBuffer` this element has: text in and out, and the insertion cursor. */
6
+ export interface GtkTextBufferSubset {
7
+ readonly cursor_position: number;
8
+ insert_at_cursor(text: string, len?: number): void;
9
+ set_text(text: string, len?: number): void;
10
+ get_text(): string;
11
+ }
5
12
  export declare class GtkTextView extends HTMLElement {
6
13
  private _area;
7
14
  private _initialized;
@@ -39,6 +46,14 @@ export declare class GtkTextView extends HTMLElement {
39
46
  /** `Gtk.TextView:right-margin` — pixels of blank space to the right of the text. */
40
47
  get rightMargin(): number;
41
48
  set rightMargin(value: number);
49
+ /**
50
+ * `gtk_text_view_get_buffer`: the part of `Gtk.TextBuffer` a program writes through. The text
51
+ * stays the element's own, so the buffer is a view onto it: the cursor is the textarea's caret,
52
+ * and a length of -1 means "the whole string", as in GTK.
53
+ */
54
+ get buffer(): GtkTextBufferSubset;
55
+ /** `gtk_text_view_get_buffer`. */
56
+ get_buffer(): GtkTextBufferSubset;
42
57
  /** The inner native textarea, for focus and selection. */
43
58
  get textarea(): HTMLTextAreaElement;
44
59
  connectedCallback(): void;
@@ -0,0 +1,55 @@
1
+ import { type FileChooserDriver, type FileChooserRequest, type FileFilterSpec } from '@gjsify/adwaita-core';
2
+ import './elements/adw-dialog.js';
3
+ import './elements/adw-overlay-split-view.js';
4
+ import './elements/adw-toolbar-view.js';
5
+ import './elements/gtk-button.js';
6
+ import './elements/gtk-drop-down.js';
7
+ import './elements/gtk-entry.js';
8
+ import './elements/gtk-list-box.js';
9
+ import './elements/gtk-list-box-row.js';
10
+ /** What the drawn dialog hands back: an OPFS entry by name, or a file the `<input>` picked. */
11
+ export type OpfsChoice = {
12
+ readonly name: string;
13
+ } | {
14
+ readonly upload: File;
15
+ };
16
+ /** File System Access `showOpenFilePicker`/`showSaveFilePicker` options, as far as the door fills them. */
17
+ export interface FilePickerOptions {
18
+ types?: {
19
+ description: string;
20
+ accept: Record<string, string[]>;
21
+ }[];
22
+ excludeAcceptAllOption?: boolean;
23
+ suggestedName?: string;
24
+ }
25
+ /** The platform the driver reads. {@link browserFileChooserEnv} is the real one; a spec passes fakes. */
26
+ export interface WebFileChooserEnv {
27
+ showOpenFilePicker?: (options: FilePickerOptions) => Promise<FileSystemFileHandle[]>;
28
+ showSaveFilePicker?: (options: FilePickerOptions) => Promise<FileSystemFileHandle>;
29
+ /** Transient user activation; an environment that cannot say answers `true`. */
30
+ isActive(): boolean;
31
+ opfsRoot(): Promise<FileSystemDirectoryHandle>;
32
+ /** The drawn dialog over `root`; `null` when the user closed it. */
33
+ choose(kind: 'open' | 'save', request: FileChooserRequest, root: FileSystemDirectoryHandle): Promise<OpfsChoice | null>;
34
+ /** Whether `handle` writes through `createWritable`; the worker writes otherwise. */
35
+ canStreamWrite(handle: FileSystemFileHandle): boolean;
36
+ }
37
+ /**
38
+ * The File System Access options for `request`. An extension-only filter needs a MIME key, and
39
+ * `application/octet-stream` is the one that claims nothing about the content. A filter that
40
+ * accepts everything is the picker's own accept-all option, so it is not a type.
41
+ */
42
+ export declare function filePickerOptions(request: FileChooserRequest, kind: 'open' | 'save'): FilePickerOptions;
43
+ /** `<input type=file accept>` for one filter: extensions and MIME types; `null` accepts every file. */
44
+ export declare function inputAccept(spec: FileFilterSpec | null): string | null;
45
+ export declare function createWebFileChooserDriver(env: WebFileChooserEnv): FileChooserDriver;
46
+ /**
47
+ * Lets the user pick an OPFS file (`open`) or name one (`save`). Resolves the choice, or `null`
48
+ * when the dialog closes without one. On `open`, "Upload…" picks a file through `<input type=file>`;
49
+ * its `cancel` event dismisses the whole open, as ADR 0100 § 5 maps it.
50
+ *
51
+ * The dialog sets `data-ready` once the list is filled, which is what a spec waits for.
52
+ */
53
+ export declare function presentOpfsDialog(kind: 'open' | 'save', request: FileChooserRequest, root: FileSystemDirectoryHandle): Promise<OpfsChoice | null>;
54
+ export declare function browserFileChooserEnv(): WebFileChooserEnv;
55
+ export declare const webFileChooserDriver: FileChooserDriver;
@@ -0,0 +1 @@
1
+ export declare const FileChooserTest: () => Promise<void>;
@@ -0,0 +1 @@
1
+ export declare const GtkPlatformTest: () => Promise<void>;
@@ -56,3 +56,4 @@ export { AdwWindowTitle as WindowTitle } from '../elements/adw-window-title.js';
56
56
  export { AdwWrapBox as WrapBox } from '../elements/adw-wrap-box.js';
57
57
  export { AdwApplication as Application } from '../application.js';
58
58
  export { AdwStyleManager as StyleManager } from '../style-manager.js';
59
+ export { ColorScheme } from '@gjsify/adwaita-core';
@@ -5,3 +5,5 @@ export declare const Display: {
5
5
  export declare const Clipboard: typeof import("@gjsify/adwaita-core").Clipboard;
6
6
  export declare const ContentProvider: Pick<typeof import("@gjsify/adwaita-core").ContentProvider, "new_for_value">;
7
7
  export declare const ContentFormats: typeof import("@gjsify/adwaita-core").ContentFormats;
8
+ export declare const CURRENT_TIME = 0;
9
+ export declare const KEY_space: 32, KEY_a: 97, KEY_d: 100, KEY_e: 101, KEY_q: 113, KEY_s: 115, KEY_w: 119, KEY_Return: 65293, KEY_Escape: 65307, KEY_Left: 65361, KEY_Up: 65362, KEY_Right: 65363, KEY_Down: 65364;
@@ -1,3 +1,6 @@
1
+ import '../file-chooser-host.js';
1
2
  export { GioMenu as Menu, GioMenuItem as MenuItem } from '@gjsify/adwaita-core';
3
+ export { GioFile as File, GioListStore as ListStore, GioOutputStream as OutputStream, GioFileOutputStream as FileOutputStream, FileCreateFlags, IOErrorEnum, promisify as _promisify, } from '@gjsify/adwaita-core';
2
4
  export { SimpleAction, SimpleActionGroup, ApplicationFlags } from '@gjsify/adwaita-core';
3
5
  export { GioApplication as Application } from '../application.js';
6
+ export { Settings } from '@gjsify/app-settings/browser';
@@ -1,3 +1,4 @@
1
+ export { GLibBytes as Bytes, GLibError as Error } from '@gjsify/adwaita-core';
1
2
  import { buildFilenamev, getCurrentDir, getSystemDataDirs } from '@gjsify/adwaita-core';
2
3
  export declare const PRIORITY_HIGH: number;
3
4
  export declare const PRIORITY_DEFAULT: number;
@@ -25,3 +25,25 @@ export declare const TextExtendSelection: Readonly<{
25
25
  readonly WORD: 0;
26
26
  readonly LINE: 1;
27
27
  }>;
28
+ /** `Gtk.License`, the table `Adw.AboutDialog` reads. */
29
+ export declare const License: {
30
+ readonly UNKNOWN: 0;
31
+ readonly CUSTOM: 1;
32
+ readonly GPL_2_0: 2;
33
+ readonly GPL_3_0: 3;
34
+ readonly LGPL_2_1: 4;
35
+ readonly LGPL_3_0: 5;
36
+ readonly BSD: 6;
37
+ readonly MIT_X11: 7;
38
+ readonly ARTISTIC: 8;
39
+ readonly GPL_2_0_ONLY: 9;
40
+ readonly GPL_3_0_ONLY: 10;
41
+ readonly LGPL_2_1_ONLY: 11;
42
+ readonly LGPL_3_0_ONLY: 12;
43
+ readonly AGPL_3_0: 13;
44
+ readonly AGPL_3_0_ONLY: 14;
45
+ readonly BSD_3: 15;
46
+ readonly APACHE_2_0: 16;
47
+ readonly MPL_2_0: 17;
48
+ readonly '0BSD': 18;
49
+ };
@@ -0,0 +1,13 @@
1
+ export declare const CssProvider: typeof import("@gjsify/adwaita-core").CssProvider;
2
+ export declare const StyleContext: {
3
+ add_provider_for_display(display: unknown, provider: import("@gjsify/adwaita-core").CssProvider, priority: number): void;
4
+ remove_provider_for_display(display: unknown, provider: import("@gjsify/adwaita-core").CssProvider): void;
5
+ };
6
+ export declare const Settings: {
7
+ get_default(): import("@gjsify/adwaita-core").GtkSettings;
8
+ };
9
+ export declare const IconTheme: {
10
+ get_for_display(display: unknown): import("@gjsify/adwaita-core").IconTheme;
11
+ };
12
+ export declare const EventControllerKey: typeof import("@gjsify/adwaita-core").EventControllerKey;
13
+ export declare const show_uri: (parent: unknown, uri: string, timestamp: number) => void;
@@ -1,5 +1,6 @@
1
1
  export { GtkAdjustment as Adjustment } from '@gjsify/adwaita-core';
2
- export { PolicyType, TextDirection, TextExtendSelection, TextWindowType } from './gtk-enums.js';
2
+ export { GtkFileDialog as FileDialog, GtkFileFilter as FileFilter, DialogError } from '@gjsify/adwaita-core';
3
+ export { License, PolicyType, TextDirection, TextExtendSelection, TextWindowType } from './gtk-enums.js';
3
4
  export { GtkAboutDialog as AboutDialog } from '../elements/gtk-about-dialog.js';
4
5
  export { GtkActionBar as ActionBar } from '../elements/gtk-action-bar.js';
5
6
  export { GtkApplicationWindow as ApplicationWindow } from '../elements/gtk-application-window.js';
@@ -75,3 +76,5 @@ export { GtkWindowControls as WindowControls } from '../elements/gtk-window-cont
75
76
  export { GtkViewport as Viewport } from '../elements/gtk-viewport.js';
76
77
  export { GtkWindowHandle as WindowHandle } from '../elements/gtk-window-handle.js';
77
78
  export { GtkApplication as Application } from '../application.js';
79
+ export { STYLE_PROVIDER_PRIORITY_APPLICATION, STYLE_PROVIDER_PRIORITY_FALLBACK, STYLE_PROVIDER_PRIORITY_SETTINGS, STYLE_PROVIDER_PRIORITY_THEME, STYLE_PROVIDER_PRIORITY_USER, } from '@gjsify/adwaita-core';
80
+ export { CssProvider, EventControllerKey, IconTheme, show_uri, StyleContext, Settings } from './gtk-platform.js';
@@ -0,0 +1,2 @@
1
+ import type { PlatformHost } from '@gjsify/adwaita-core';
2
+ export declare const webPlatformHost: PlatformHost;
@@ -0,0 +1,2 @@
1
+ /** Gives `tag` the rules that `base` has in the page's stylesheets. Runs once per tag. */
2
+ export declare function inheritStyles(tag: string, base: string | null | undefined): void;
@@ -1,5 +1,12 @@
1
1
  import { StyleManagerBase, type StyleSource } from '@gjsify/adwaita-core';
2
2
  export declare const webStyleSource: StyleSource;
3
3
  export declare class AdwStyleManager extends StyleManagerBase {
4
+ static readonly ColorScheme: {
5
+ readonly DEFAULT: 0;
6
+ readonly FORCE_LIGHT: 1;
7
+ readonly PREFER_LIGHT: 2;
8
+ readonly PREFER_DARK: 3;
9
+ readonly FORCE_DARK: 4;
10
+ };
4
11
  static source: StyleSource;
5
12
  }