@gjsify/adwaita-web 0.55.0 → 0.57.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 (127) hide show
  1. package/README.md +8 -0
  2. package/dist/adwaita-web.css +137 -29
  3. package/dist/adwaita-web.css.map +1 -1
  4. package/lib/types/adw-status-page.spec.d.ts +1 -0
  5. package/lib/types/application.d.ts +24 -0
  6. package/lib/types/application.spec.d.ts +1 -0
  7. package/lib/types/attributes.d.ts +19 -0
  8. package/lib/types/elements/adw-action-row.d.ts +4 -0
  9. package/lib/types/elements/adw-application-window.d.ts +2 -0
  10. package/lib/types/elements/adw-combo-row.d.ts +4 -0
  11. package/lib/types/elements/adw-entry-row.d.ts +6 -0
  12. package/lib/types/elements/adw-expander-row.d.ts +2 -0
  13. package/lib/types/elements/adw-header-bar.d.ts +6 -0
  14. package/lib/types/elements/adw-overlay-split-view.d.ts +13 -0
  15. package/lib/types/elements/adw-sidebar.d.ts +3 -2
  16. package/lib/types/elements/adw-spin-row.d.ts +6 -0
  17. package/lib/types/elements/adw-switch-row.d.ts +4 -0
  18. package/lib/types/elements/adw-toggle-group.d.ts +17 -0
  19. package/lib/types/elements/adw-view-stack.d.ts +3 -0
  20. package/lib/types/elements/checks.d.ts +6 -0
  21. package/lib/types/elements/gtk-application-window.d.ts +2 -0
  22. package/lib/types/elements/gtk-drop-down.d.ts +3 -0
  23. package/lib/types/elements/gtk-entry.d.ts +10 -0
  24. package/lib/types/elements/gtk-menu-button.d.ts +2 -0
  25. package/lib/types/elements/gtk-scrolled-window.d.ts +26 -2
  26. package/lib/types/elements/gtk-stack.d.ts +3 -0
  27. package/lib/types/elements/gtk-switch.d.ts +3 -0
  28. package/lib/types/elements/gtk-window.d.ts +8 -2
  29. package/lib/types/glib.spec.d.ts +1 -0
  30. package/lib/types/gobject-door.d.ts +4 -0
  31. package/lib/types/gobject-door.spec.d.ts +1 -0
  32. package/lib/types/gobject-elements.d.ts +17 -0
  33. package/lib/types/gtksource/gtk-source-view.d.ts +77 -0
  34. package/lib/types/gtksource/gtk-source-view.spec.d.ts +2 -0
  35. package/lib/types/gtksource/web-editor-driver.d.ts +44 -0
  36. package/lib/types/index.d.ts +4 -1
  37. package/lib/types/menu-actions.spec.d.ts +1 -0
  38. package/lib/types/namespace/adw.d.ts +1 -0
  39. package/lib/types/namespace/gio.d.ts +2 -0
  40. package/lib/types/namespace/glib.d.ts +10 -0
  41. package/lib/types/namespace/gobject.d.ts +27 -0
  42. package/lib/types/namespace/gtk-enums.d.ts +22 -0
  43. package/lib/types/namespace/gtk.d.ts +2 -0
  44. package/lib/types/namespace/gtksource.d.ts +2 -0
  45. package/lib/types/row-line-clamp.d.ts +20 -0
  46. package/lib/types/row-tooltip.d.ts +8 -0
  47. package/lib/types/row-tooltip.spec.d.ts +1 -0
  48. package/lib/types/shared-tree-builder.d.ts +69 -20
  49. package/lib/types/shared-tree-mount.spec.d.ts +1 -0
  50. package/lib/types/styles.generated.d.ts +1 -1
  51. package/lib/types/widget-size.spec.d.ts +1 -0
  52. package/package.json +11 -9
  53. package/scss/_action_row.scss +39 -15
  54. package/scss/_button_row.scss +5 -0
  55. package/scss/_expander_row.scss +36 -3
  56. package/scss/_headerbar.scss +2 -1
  57. package/scss/_preferences_row.scss +9 -0
  58. package/scss/_reset.scss +1 -1
  59. package/scss/_row.scss +16 -0
  60. package/scss/_status_page.scss +1 -1
  61. package/scss/_toggle_group.scss +28 -0
  62. package/scss/_widget.scss +14 -3
  63. package/scss/_window.scss +13 -1
  64. package/src/adw-action-rows.spec.ts +255 -0
  65. package/src/adw-header-bar.spec.ts +18 -0
  66. package/src/adw-status-page.spec.ts +124 -0
  67. package/src/application.spec.ts +75 -0
  68. package/src/application.ts +92 -0
  69. package/src/attributes.ts +52 -0
  70. package/src/capabilities.mjs +3 -0
  71. package/src/construct-vectors.spec.ts +156 -1
  72. package/src/elements/adw-action-row.ts +31 -2
  73. package/src/elements/adw-alert-dialog.ts +4 -1
  74. package/src/elements/adw-application-window.ts +5 -0
  75. package/src/elements/adw-button-row.ts +7 -1
  76. package/src/elements/adw-combo-row.ts +26 -1
  77. package/src/elements/adw-entry-row.ts +22 -12
  78. package/src/elements/adw-expander-row.ts +34 -1
  79. package/src/elements/adw-header-bar.ts +18 -4
  80. package/src/elements/adw-overlay-split-view.ts +29 -6
  81. package/src/elements/adw-preferences-row.ts +5 -2
  82. package/src/elements/adw-sidebar.ts +33 -5
  83. package/src/elements/adw-spin-row.ts +37 -2
  84. package/src/elements/adw-split-button.ts +5 -1
  85. package/src/elements/adw-status-page.ts +10 -2
  86. package/src/elements/adw-switch-row.ts +25 -1
  87. package/src/elements/adw-toggle-group.ts +119 -10
  88. package/src/elements/adw-view-stack.ts +14 -0
  89. package/src/elements/adw-window.ts +9 -4
  90. package/src/elements/checks.ts +25 -1
  91. package/src/elements/gtk-application-window.ts +5 -0
  92. package/src/elements/gtk-drop-down.ts +16 -0
  93. package/src/elements/gtk-entry.ts +45 -7
  94. package/src/elements/gtk-menu-button.ts +12 -1
  95. package/src/elements/gtk-popover-menu.ts +7 -2
  96. package/src/elements/gtk-scrolled-window.ts +76 -7
  97. package/src/elements/gtk-stack.ts +8 -0
  98. package/src/elements/gtk-switch.ts +8 -0
  99. package/src/elements/gtk-window.ts +9 -3
  100. package/src/glib.spec.ts +34 -0
  101. package/src/gobject-door.spec.ts +119 -0
  102. package/src/gobject-door.ts +137 -0
  103. package/src/gobject-elements.ts +172 -0
  104. package/src/gtk-window.spec.ts +12 -0
  105. package/src/gtksource/gtk-source-view.spec.ts +69 -0
  106. package/src/gtksource/gtk-source-view.ts +379 -0
  107. package/src/gtksource/web-editor-driver.ts +260 -0
  108. package/src/index.ts +11 -1
  109. package/src/keyboard-operable.spec.ts +47 -11
  110. package/src/menu-actions.spec.ts +47 -0
  111. package/src/namespace/adw.ts +1 -0
  112. package/src/namespace/gio.ts +2 -0
  113. package/src/namespace/glib.ts +22 -0
  114. package/src/namespace/gobject.ts +37 -0
  115. package/src/namespace/gtk-enums.ts +15 -0
  116. package/src/namespace/gtk.ts +2 -0
  117. package/src/namespace/gtksource.ts +9 -0
  118. package/src/row-line-clamp.ts +74 -0
  119. package/src/row-tooltip.spec.ts +313 -0
  120. package/src/row-tooltip.ts +52 -0
  121. package/src/shared-tree-builder.ts +230 -42
  122. package/src/shared-tree-mount.spec.ts +130 -0
  123. package/src/shared-trees.spec.ts +15 -0
  124. package/src/split-button.spec.ts +2 -0
  125. package/src/styles.generated.ts +1 -1
  126. package/src/test.browser.mts +18 -0
  127. package/src/widget-size.spec.ts +117 -0
@@ -0,0 +1,10 @@
1
+ export declare const PRIORITY_HIGH: number;
2
+ export declare const PRIORITY_DEFAULT: number;
3
+ export declare const PRIORITY_HIGH_IDLE: number;
4
+ export declare const PRIORITY_DEFAULT_IDLE: number;
5
+ export declare const PRIORITY_LOW: number;
6
+ export declare const SOURCE_REMOVE: boolean;
7
+ export declare const SOURCE_CONTINUE: boolean;
8
+ export declare const idle_add: (priority: number, run: import("@gjsify/adwaita-core").SourceFunc) => number;
9
+ export declare const timeout_add: (priority: number, milliseconds: number, run: import("@gjsify/adwaita-core").SourceFunc) => number;
10
+ export declare const source_remove: (sourceId: number) => boolean;
@@ -0,0 +1,27 @@
1
+ declare const GObjectObject: import("@gjsify/adwaita-core").GObjectConstructor;
2
+ export { GObjectObject as Object };
3
+ export declare const registerClass: import("@gjsify/adwaita-core").RegisterClass;
4
+ export declare const type_ensure: (gtype: import("@gjsify/adwaita-core").GType) => void;
5
+ export declare const ParamSpec: typeof import("@gjsify/adwaita-core").ParamSpec;
6
+ export declare const ParamFlags: {
7
+ readonly READABLE: 1;
8
+ readonly WRITABLE: 2;
9
+ readonly READWRITE: 3;
10
+ readonly CONSTRUCT: 4;
11
+ readonly CONSTRUCT_ONLY: 8;
12
+ };
13
+ export declare const TYPE_STRING: import("@gjsify/adwaita-core").GType;
14
+ export declare const TYPE_BOOLEAN: import("@gjsify/adwaita-core").GType;
15
+ export declare const TYPE_INT: import("@gjsify/adwaita-core").GType;
16
+ export declare const TYPE_UINT: import("@gjsify/adwaita-core").GType;
17
+ export declare const TYPE_DOUBLE: import("@gjsify/adwaita-core").GType;
18
+ export declare const GTypeName: symbol;
19
+ export declare const GTypeFlags: symbol;
20
+ export declare const interfaces: symbol;
21
+ export declare const properties: symbol;
22
+ export declare const signals: symbol;
23
+ export declare const requires: symbol;
24
+ export declare const __gtkTemplate__: symbol;
25
+ export declare const __gtkCssName__: symbol;
26
+ export declare const __gtkChildren__: symbol;
27
+ export declare const __gtkInternalChildren__: symbol;
@@ -0,0 +1,22 @@
1
+ /** `Gtk.PolicyType`: `ALWAYS` 0, `AUTOMATIC` 1, `NEVER` 2, `EXTERNAL` 3. */
2
+ export declare const PolicyType: Readonly<{
3
+ readonly ALWAYS: 0;
4
+ readonly AUTOMATIC: 1;
5
+ readonly NEVER: 2;
6
+ readonly EXTERNAL: 3;
7
+ }>;
8
+ /** `Gtk.TextDirection`: `NONE` 0, `LTR` 1, `RTL` 2. */
9
+ export declare const TextDirection: Readonly<{
10
+ readonly NONE: 0;
11
+ readonly LTR: 1;
12
+ readonly RTL: 2;
13
+ }>;
14
+ /** `Gtk.TextWindowType`: `WIDGET` 1, `TEXT` 2, `LEFT` 3, `RIGHT` 4, `TOP` 5, `BOTTOM` 6. */
15
+ export declare const TextWindowType: Readonly<{
16
+ readonly WIDGET: 1;
17
+ readonly TEXT: 2;
18
+ readonly LEFT: 3;
19
+ readonly RIGHT: 4;
20
+ readonly TOP: 5;
21
+ readonly BOTTOM: 6;
22
+ }>;
@@ -1,4 +1,5 @@
1
1
  export { GtkAdjustment as Adjustment } from '@gjsify/adwaita-core';
2
+ export { PolicyType, TextDirection, TextWindowType } from './gtk-enums.js';
2
3
  export { GtkAboutDialog as AboutDialog } from '../elements/gtk-about-dialog.js';
3
4
  export { GtkActionBar as ActionBar } from '../elements/gtk-action-bar.js';
4
5
  export { GtkApplicationWindow as ApplicationWindow } from '../elements/gtk-application-window.js';
@@ -73,3 +74,4 @@ export { GtkWindow as Window } from '../elements/gtk-window.js';
73
74
  export { GtkWindowControls as WindowControls } from '../elements/gtk-window-controls.js';
74
75
  export { GtkViewport as Viewport } from '../elements/gtk-viewport.js';
75
76
  export { GtkWindowHandle as WindowHandle } from '../elements/gtk-window-handle.js';
77
+ export { GtkApplication as Application } from '../application.js';
@@ -0,0 +1,2 @@
1
+ export { Buffer, Language, LanguageManager, StyleScheme, StyleSchemeManager, init } from '@gjsify/gtksource-core';
2
+ export { GtkSourceView as View } from '../gtksource/gtk-source-view.js';
@@ -0,0 +1,20 @@
1
+ export interface RowLineClampConfig {
2
+ titleEl: HTMLElement;
3
+ subtitleEl: HTMLElement;
4
+ textContainerEl: HTMLElement;
5
+ getTitleLines: () => number;
6
+ getSubtitleLines: () => number;
7
+ }
8
+ /**
9
+ * Apply or remove line clamping based on title-lines/subtitle-lines values.
10
+ * Uses CSS custom properties and class toggle (not inline styles).
11
+ */
12
+ export declare function applyRowLineClamp(config: RowLineClampConfig): void;
13
+ /**
14
+ * Parse a lines attribute value following AdwActionRow semantics:
15
+ * - Missing/null/empty → 0 (unlimited)
16
+ * - Invalid/non-numeric → 0 (unlimited)
17
+ * - n > 0 → n (clamp to n lines)
18
+ * - n <= 0 → 0 (unlimited; pspec range is 0..G_MAXINT)
19
+ */
20
+ export declare function parseRowLinesAttribute(value: string | null): number;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Apply `row`'s `tooltip-text` to `parts`, or clear it when the attribute is absent.
3
+ *
4
+ * `parts` are the row's OWN sections, never a slotted consumer widget — see the header.
5
+ * Each one is marked `data-row-tooltip`, which is the hook `scss/_row.scss` stretches so
6
+ * the tooltip covers the row rather than the label text inside it.
7
+ */
8
+ export declare function applyRowTooltip(row: HTMLElement, parts: readonly Element[]): void;
@@ -0,0 +1 @@
1
+ export declare const AdwRowTooltipTest: () => Promise<void>;
@@ -1,4 +1,4 @@
1
- import { type BreakpointSize } from '@gjsify/adwaita-core';
1
+ import { type BreakpointSize, type TemplateScope } from '@gjsify/adwaita-core';
2
2
  import { type SharedTreeNode } from '@gjsify/adwaita-core/conformance';
3
3
  /** One authored placement, kept so {@link mountSharedTree} can hold the renderer to it. */
4
4
  interface PlacedChild {
@@ -30,6 +30,10 @@ interface BuildRecord {
30
30
  observeSize?: SizeSource;
31
31
  /** The object a signal handler's NAME is resolved against (ADR 0093 § 3), as `Gtk.BuilderScope` does. */
32
32
  scope?: Readonly<Record<string, unknown>>;
33
+ /** The root menus of the tree (ADR 0097), which a `menu-model: id` anywhere below resolves against. */
34
+ menus?: SharedTreeNode['menus'];
35
+ /** Present when the tree is the template of a registered class (ADR 0096): handlers and binds go through it. */
36
+ template?: TemplateScope;
33
37
  }
34
38
  /** Calls `onSize` with the host's measured size, now and on every change; returns its disposer. */
35
39
  export type SizeSource = (element: Element, onSize: (size: BreakpointSize) => void) => () => void;
@@ -44,21 +48,22 @@ interface PendingBind {
44
48
  * A `SharedTreeNode`, realised as a DETACHED element tree: a tag, its authored properties as
45
49
  * attributes, its style classes as classes, its extensions (ADR 0072) as the markup the element
46
50
  * reads, its placement as `slot=`, its children, in that order — recursive and total,
47
- * no tag list, no per-block case. A boolean authored property is the ATTRIBUTE'S PRESENCE
48
- * (`toggleAttribute`), which is what every element in the corpus reads
49
- * (`hasAttribute('revealed')`, `hasAttribute('expanded')`); spelling `"true"` would set a
50
- * present attribute for `false` as well.
51
+ * no tag list, no per-block case.
51
52
  *
52
- * EXCEPT AN AUTHORED `false` ON A PROPERTY THE ELEMENT DECLARES. Absence cannot say `false`
53
- * where the GTK default is TRUE — `AdwNavigationPage:can-pop`, `GtkActionBar:revealed` —
54
- * because those elements read an absent attribute as that default, so `can-pop: false`
55
- * reached the page as `can-pop` unset and the page stayed poppable. The element's own
56
- * property setter knows its attribute convention, so an authored `false` is written
57
- * through it when the element (already upgraded: `createElement` of a defined tag
58
- * constructs it) declares one; everything else keeps the presence rule. "Declares" means a
59
- * member it can WRITE ({@link isWritable}): a getter-only accessor of the same name — the
60
- * split button's and the menu button's read-only `active` — would throw a bare `TypeError`
61
- * out of the assignment, so such a property falls back to the presence rule too.
53
+ * BOOLEAN ATTRIBUTES are written per (widget, property), not per attribute name. The same
54
+ * attribute name (e.g. `revealed`) can be VALUE-BASED for one widget (`gtk-action-bar`,
55
+ * default TRUE) and PRESENCE-BASED for another (`adw-banner`, default FALSE). The
56
+ * per-widget map in `@gjsify/adwaita-core/tags` ({@link isValueBasedBooleanAttr}) records this.
57
+ *
58
+ * - VALUE-BASED: `attr="false"` means false, absent means true (the GTK default).
59
+ * The builder writes `attr="true"|"false"` directly via {@link writeBooleanAttribute}.
60
+ * - PRESENCE-BASED (style classes like `flat`, `round`, `compact`): `toggleAttribute`
61
+ * writes the bare attribute for `true`, removes it for `false`.
62
+ *
63
+ * EXCEPT an authored `false` on a NON-value-based, WRITABLE property: the property is set
64
+ * directly (bypassing the attribute) because the element's setter will reflect it correctly.
65
+ * A getter-only property of the same name (e.g. `AdwSplitButton.active`) falls back to the
66
+ * presence rule since assignment would throw.
62
67
  *
63
68
  * THE SLOT IS WRITTEN AS THE ATTRIBUTE THIS RENDERER ALREADY ROUTES ON, not translated:
64
69
  * `src/slotted-children.ts` reads `slot=` off every light-DOM child and keeps the routing
@@ -72,21 +77,65 @@ interface PendingBind {
72
77
  * upgraded has declared no slots yet, so the refusal below belongs to the mount.
73
78
  */
74
79
  export declare function buildSharedTree(node: SharedTreeNode, record?: BuildRecord): HTMLElement;
80
+ /**
81
+ * One authored property, written as the element reads it; a breakpoint setter takes the same door.
82
+ *
83
+ * BOOLEAN ATTRIBUTES are written per (widget, property), not per attribute name. The same
84
+ * attribute name (e.g. `revealed`) can be VALUE-BASED for one widget (`gtk-action-bar`,
85
+ * default TRUE) and PRESENCE-BASED for another (`adw-banner`, default FALSE). The
86
+ * per-widget map in `@gjsify/adwaita-core/tags` ({@link isValueBasedBooleanAttr}) records this.
87
+ *
88
+ * - VALUE-BASED: `attr="false"` means false, absent means true (the GTK default).
89
+ * The builder writes `attr="true"|"false"` directly via {@link writeBooleanAttribute}.
90
+ * - PRESENCE-BASED (style classes like `flat`, `round`, `compact`): `toggleAttribute`
91
+ * writes the bare attribute for `true`, removes it for `false`.
92
+ *
93
+ * EXCEPT an authored `false` on a NON-value-based, WRITABLE property: the property is set
94
+ * directly (bypassing the attribute) because the element's setter will reflect it correctly.
95
+ * A getter-only property of the same name (e.g. `AdwSplitButton.active`) falls back to the
96
+ * presence rule since assignment would throw. `hexpand` / `vexpand` keep an authored `false`
97
+ * as the attribute `"false"` and a later `true` rewrites it — `GTK_WIDGET_EXPAND` says why.
98
+ */
99
+ export declare function writeProp(el: HTMLElement, prop: string, value: string | number | boolean): void;
100
+ /** A template tree built for a registered class: its children are not attached, its look is not written. */
101
+ export interface BuiltTemplateTree {
102
+ readonly children: HTMLElement[];
103
+ /** Every object the template names with an `id`. */
104
+ readonly objects: Record<string, HTMLElement>;
105
+ /** Writes the root's own properties, classes and extensions onto the host — at its first connect. */
106
+ finish(): void;
107
+ }
108
+ /**
109
+ * The template of a registered class (ADR 0096 § 3), built into `host`: children created and wired
110
+ * to their handlers and binds through `scope`, none appended and nothing written to `host`'s
111
+ * attributes, because `host` is still inside its constructor. `finish` and the caller's own append
112
+ * belong to the first `connectedCallback`.
113
+ */
114
+ export declare function buildTemplateTree(tree: SharedTreeNode, scope: TemplateScope, host: HTMLElement): BuiltTemplateTree;
75
115
  /** A tree {@link mountSharedTree} built and connected. */
76
116
  export interface MountedSharedTree {
77
117
  /** The authored root — connected, so every custom element under it has upgraded and run. */
78
118
  root: HTMLElement;
79
- /** Disconnects and discards the mount point. */
119
+ /** Disconnects the tree, and discards the mount point when this call made one. */
80
120
  unmount: () => void;
81
121
  }
122
+ /** What {@link mountSharedTree} takes beside the tree. */
123
+ export interface MountOptions {
124
+ /** The object a handler NAME is looked up on (ADR 0093 § 3). */
125
+ scope?: Readonly<Record<string, unknown>>;
126
+ /** The size source a `breakpoints` node is driven from. */
127
+ observeSize?: SizeSource;
128
+ /**
129
+ * Where the root is appended — a showcase's own container, which then lays the window out.
130
+ * Without it the tree gets a fresh host `<div>` in `document.body`, discarded on `unmount`.
131
+ */
132
+ into?: HTMLElement;
133
+ }
82
134
  /**
83
135
  * {@link buildSharedTree}, attached under a fresh host `<div>` in `document.body` so the tree
84
136
  * — and every custom element in it — is REAL rather than merely constructed. This is the
85
137
  * instantiation half a caller reading the corpus's elements normally wants; a bare
86
138
  * `buildSharedTree` is for a caller that already has somewhere of its own to attach it.
87
139
  */
88
- export declare function mountSharedTree(node: SharedTreeNode, options?: {
89
- scope?: Readonly<Record<string, unknown>>;
90
- observeSize?: SizeSource;
91
- }): MountedSharedTree;
140
+ export declare function mountSharedTree(node: SharedTreeNode, options?: MountOptions): MountedSharedTree;
92
141
  export {};
@@ -0,0 +1 @@
1
+ export declare const AdwSharedTreeMountTest: () => Promise<void>;