@gjsify/adwaita-web 0.15.1 → 0.16.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.
- package/dist/adwaita-web.css +408 -0
- package/dist/adwaita-web.css.map +1 -1
- package/lib/types/adw-data-grid.spec.d.ts +1 -0
- package/lib/types/adw-dialog.spec.d.ts +1 -0
- package/lib/types/adw-drop-down.spec.d.ts +1 -0
- package/lib/types/elements/adw-data-grid.d.ts +60 -0
- package/lib/types/elements/adw-dialog.d.ts +51 -0
- package/lib/types/elements/adw-drop-down.d.ts +63 -0
- package/lib/types/index.d.ts +6 -0
- package/lib/types/styles.generated.d.ts +1 -1
- package/package.json +7 -5
- package/scss/_data_grid.scss +144 -0
- package/scss/_dialog.scss +220 -0
- package/scss/_drop_down.scss +185 -0
- package/scss/_theme.scss +2 -0
- package/scss/_variables.scss +4 -0
- package/scss/adwaita-skin.scss +3 -0
- package/src/adw-data-grid.spec.ts +243 -0
- package/src/adw-dialog.spec.ts +169 -0
- package/src/adw-drop-down.spec.ts +186 -0
- package/src/elements/adw-data-grid.ts +335 -0
- package/src/elements/adw-dialog.ts +329 -0
- package/src/elements/adw-drop-down.ts +405 -0
- package/src/index.ts +11 -0
- package/src/test.browser.mts +14 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const AdwDataGridTest: () => Promise<void>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const AdwDialogTest: () => Promise<void>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const AdwDropDownTest: () => Promise<void>;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/** Horizontal alignment of a column's header + cells. */
|
|
2
|
+
export type AdwDataGridAlign = 'start' | 'end' | 'center';
|
|
3
|
+
/** Accounting row emphasis. `normal` is the default plain data row. */
|
|
4
|
+
export type AdwDataGridRowVariant = 'normal' | 'section' | 'subtotal' | 'total';
|
|
5
|
+
/** A column descriptor — what to read (`key`), how to label + align it. */
|
|
6
|
+
export interface AdwDataGridColumn {
|
|
7
|
+
/** The row-object key this column renders. */
|
|
8
|
+
key: string;
|
|
9
|
+
/** Header text (defaults to `key`). */
|
|
10
|
+
label?: string;
|
|
11
|
+
/** 'start' | 'end' | 'center'. Defaults to 'start' (or 'end' when numeric). */
|
|
12
|
+
align?: AdwDataGridAlign;
|
|
13
|
+
/** Fixed CSS track size (e.g. '80px', '6rem') — pins the column width. */
|
|
14
|
+
width?: string;
|
|
15
|
+
/** Fractional track weight (→ `<flex>fr`) — lets the column grow. */
|
|
16
|
+
flex?: number;
|
|
17
|
+
/** Render cells in a monospace family (tabular figures apply regardless). */
|
|
18
|
+
monospace?: boolean;
|
|
19
|
+
/** Convenience: right-align + tabular-nums (numeric columns of figures). */
|
|
20
|
+
numeric?: boolean;
|
|
21
|
+
}
|
|
22
|
+
/** A row: cell values keyed by column key + optional accounting metadata. */
|
|
23
|
+
export interface AdwDataGridRow {
|
|
24
|
+
/** Accounting emphasis. Default 'normal'. */
|
|
25
|
+
variant?: AdwDataGridRowVariant;
|
|
26
|
+
/** Make just this row clickable (overrides the element-level flag). */
|
|
27
|
+
interactive?: boolean;
|
|
28
|
+
/** Cell values keyed by column key (pre-formatted strings, or numbers). */
|
|
29
|
+
[key: string]: string | number | boolean | AdwDataGridRowVariant | undefined;
|
|
30
|
+
}
|
|
31
|
+
export declare class AdwDataGrid extends HTMLElement {
|
|
32
|
+
private _captionEl;
|
|
33
|
+
private _scrollEl;
|
|
34
|
+
private _tableEl;
|
|
35
|
+
private _columns;
|
|
36
|
+
private _rows;
|
|
37
|
+
private _initialized;
|
|
38
|
+
static get observedAttributes(): string[];
|
|
39
|
+
/** The column descriptors. Setting rebuilds the grid. */
|
|
40
|
+
get columns(): AdwDataGridColumn[];
|
|
41
|
+
set columns(value: ReadonlyArray<AdwDataGridColumn>);
|
|
42
|
+
/** The row objects. Setting rebuilds the body. */
|
|
43
|
+
get rows(): AdwDataGridRow[];
|
|
44
|
+
set rows(value: ReadonlyArray<AdwDataGridRow>);
|
|
45
|
+
/** The optional grid caption/title (reflected to the attribute). */
|
|
46
|
+
get caption(): string;
|
|
47
|
+
set caption(value: string);
|
|
48
|
+
/** Whether every `normal` row is clickable (element-level flag). */
|
|
49
|
+
get interactive(): boolean;
|
|
50
|
+
set interactive(value: boolean);
|
|
51
|
+
connectedCallback(): void;
|
|
52
|
+
attributeChangedCallback(name: string, _old: string | null, value: string | null): void;
|
|
53
|
+
private _parseJsonAttr;
|
|
54
|
+
private _renderCaption;
|
|
55
|
+
/** The CSS `grid-template-columns` value derived from the column descriptors. */
|
|
56
|
+
private _trackTemplate;
|
|
57
|
+
private _columnClasses;
|
|
58
|
+
private _render;
|
|
59
|
+
private _activate;
|
|
60
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/** Adaptive presentation of the dialog — mirrors Adw.DialogPresentationMode. */
|
|
2
|
+
export type AdwDialogPresentationMode = 'auto' | 'floating' | 'bottom-sheet';
|
|
3
|
+
export declare class AdwDialog extends HTMLElement {
|
|
4
|
+
private _initialized;
|
|
5
|
+
private _scrimEl;
|
|
6
|
+
private _boxEl;
|
|
7
|
+
private _headerEl;
|
|
8
|
+
private _titleEl;
|
|
9
|
+
private _closeBtn;
|
|
10
|
+
private _contentEl;
|
|
11
|
+
private _previouslyFocused;
|
|
12
|
+
static get observedAttributes(): string[];
|
|
13
|
+
/** Whether the dialog is currently revealed. */
|
|
14
|
+
get open(): boolean;
|
|
15
|
+
set open(value: boolean);
|
|
16
|
+
/** The header title (Adw.Dialog:title). Setting a title renders the header. */
|
|
17
|
+
get title(): string;
|
|
18
|
+
set title(value: string);
|
|
19
|
+
/** Whether the user can dismiss the dialog (scrim / Escape / close button). */
|
|
20
|
+
get canClose(): boolean;
|
|
21
|
+
set canClose(value: boolean);
|
|
22
|
+
/** The dialog's preferred/max content width in px (Adw.Dialog:content-width). */
|
|
23
|
+
get contentWidth(): number;
|
|
24
|
+
set contentWidth(value: number);
|
|
25
|
+
/** The dialog's max content height in px, or 0 for "unconstrained" (Adw.Dialog:content-height). */
|
|
26
|
+
get contentHeight(): number;
|
|
27
|
+
set contentHeight(value: number);
|
|
28
|
+
/** The adaptive presentation mode (Adw.Dialog:presentation-mode). */
|
|
29
|
+
get presentationMode(): AdwDialogPresentationMode;
|
|
30
|
+
set presentationMode(value: AdwDialogPresentationMode);
|
|
31
|
+
/** The content container — arbitrary child markup lives here after connect. */
|
|
32
|
+
get contentArea(): HTMLDivElement;
|
|
33
|
+
/** Reveal the dialog (mirrors Adw.Dialog.present). Auto-attaches if disconnected. */
|
|
34
|
+
present(parent?: Element): void;
|
|
35
|
+
/** Dismiss the dialog, respecting `can-close` (mirrors Adw.Dialog.close). */
|
|
36
|
+
close(): void;
|
|
37
|
+
/** Dismiss the dialog regardless of `can-close` (mirrors Adw.Dialog.force_close). */
|
|
38
|
+
forceClose(): void;
|
|
39
|
+
connectedCallback(): void;
|
|
40
|
+
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
41
|
+
/** A dismissal was requested: honour `can-close`, else raise close-attempt. */
|
|
42
|
+
private _attemptClose;
|
|
43
|
+
/** Focus trap + Escape while the box has focus. */
|
|
44
|
+
private _onBoxKeyDown;
|
|
45
|
+
private _focusables;
|
|
46
|
+
/** On present: remember focus, then move it into the dialog. */
|
|
47
|
+
private _onPresented;
|
|
48
|
+
/** On close: emit `closed` and return focus to where it was before present. */
|
|
49
|
+
private _onClosed;
|
|
50
|
+
private _render;
|
|
51
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/** A dropdown option — `value` is the stable id, `label` the shown text. */
|
|
2
|
+
export interface AdwDropDownOption {
|
|
3
|
+
value: string;
|
|
4
|
+
label: string;
|
|
5
|
+
}
|
|
6
|
+
type RawOption = string | {
|
|
7
|
+
value?: unknown;
|
|
8
|
+
label?: unknown;
|
|
9
|
+
};
|
|
10
|
+
export declare class AdwDropDown extends HTMLElement {
|
|
11
|
+
private _buttonEl;
|
|
12
|
+
private _labelEl;
|
|
13
|
+
private _popoverEl;
|
|
14
|
+
private _listEl;
|
|
15
|
+
private _searchEl;
|
|
16
|
+
private _options;
|
|
17
|
+
private _itemButtons;
|
|
18
|
+
private _selected;
|
|
19
|
+
private _active;
|
|
20
|
+
private _initialized;
|
|
21
|
+
private _typeAheadBuffer;
|
|
22
|
+
private _typeAheadTimer;
|
|
23
|
+
private _onDocumentPointerDown;
|
|
24
|
+
private _onDocumentKeyDown;
|
|
25
|
+
static get observedAttributes(): string[];
|
|
26
|
+
/** The options list. Setting it rebuilds the popover and clamps the selection. */
|
|
27
|
+
get options(): AdwDropDownOption[];
|
|
28
|
+
set options(value: ReadonlyArray<RawOption>);
|
|
29
|
+
/** Alias of `options` (Gtk.DropDown's model is often called "items"). */
|
|
30
|
+
get items(): AdwDropDownOption[];
|
|
31
|
+
set items(value: ReadonlyArray<RawOption>);
|
|
32
|
+
/** The selected index. Out-of-range values are ignored (Gtk.DropDown:selected). */
|
|
33
|
+
get selected(): number;
|
|
34
|
+
set selected(value: number);
|
|
35
|
+
/** The selected option's value, or '' when empty (Gtk.DropDown:selected-item). */
|
|
36
|
+
get selectedValue(): string;
|
|
37
|
+
set selectedValue(value: string);
|
|
38
|
+
/** The selected option descriptor, or null when empty. */
|
|
39
|
+
get selectedItem(): AdwDropDownOption | null;
|
|
40
|
+
/** Whether the search entry is shown in the popover. */
|
|
41
|
+
get enableSearch(): boolean;
|
|
42
|
+
set enableSearch(value: boolean);
|
|
43
|
+
/** Whether the popover is currently open. */
|
|
44
|
+
get active(): boolean;
|
|
45
|
+
connectedCallback(): void;
|
|
46
|
+
disconnectedCallback(): void;
|
|
47
|
+
attributeChangedCallback(name: string, _old: string | null, value: string | null): void;
|
|
48
|
+
private _parseOptionsAttr;
|
|
49
|
+
private _selectIndex;
|
|
50
|
+
private _setActive;
|
|
51
|
+
private _onButtonKeyDown;
|
|
52
|
+
private _onPopoverKeyDown;
|
|
53
|
+
/** Type-ahead: accumulate keys, focus/select the next matching option. */
|
|
54
|
+
private _typeAhead;
|
|
55
|
+
/** Filter the visible items by a search query (case-insensitive substring). */
|
|
56
|
+
private _filter;
|
|
57
|
+
private _visibleItems;
|
|
58
|
+
private _renderAll;
|
|
59
|
+
private _updateLabel;
|
|
60
|
+
private _updateSelectedStates;
|
|
61
|
+
private _renderPopover;
|
|
62
|
+
}
|
|
63
|
+
export {};
|
package/lib/types/index.d.ts
CHANGED
|
@@ -2,6 +2,8 @@ import '@gjsify/adwaita-fonts';
|
|
|
2
2
|
export { AdwAvatar } from './elements/adw-avatar.js';
|
|
3
3
|
export { AdwBanner } from './elements/adw-banner.js';
|
|
4
4
|
export { AdwCard } from './elements/adw-card.js';
|
|
5
|
+
export { AdwDataGrid } from './elements/adw-data-grid.js';
|
|
6
|
+
export type { AdwDataGridAlign, AdwDataGridColumn, AdwDataGridRow, AdwDataGridRowVariant, } from './elements/adw-data-grid.js';
|
|
5
7
|
export { AdwClamp } from './elements/adw-clamp.js';
|
|
6
8
|
export { AdwSpinner } from './elements/adw-spinner.js';
|
|
7
9
|
export { AdwStatusPage } from './elements/adw-status-page.js';
|
|
@@ -36,9 +38,13 @@ export type { AdwViewStackPageInfo } from './elements/adw-view-stack.js';
|
|
|
36
38
|
export { AdwViewSwitcherBar } from './elements/adw-view-switcher-bar.js';
|
|
37
39
|
export { AdwMenuButton } from './elements/adw-menu-button.js';
|
|
38
40
|
export type { AdwMenuItem } from './elements/adw-menu-button.js';
|
|
41
|
+
export { AdwDropDown } from './elements/adw-drop-down.js';
|
|
42
|
+
export type { AdwDropDownOption } from './elements/adw-drop-down.js';
|
|
39
43
|
export { AdwNavigationPage, AdwNavigationView } from './elements/adw-navigation-view.js';
|
|
40
44
|
export { AdwBottomSheet, AdwBottomSheetContent, AdwBottomSheetSheet } from './elements/adw-bottom-sheet.js';
|
|
41
45
|
export { AdwSidebar, AdwSidebarItem, AdwSidebarSection } from './elements/adw-sidebar.js';
|
|
42
46
|
export { AdwAboutDialog } from './elements/adw-about-dialog.js';
|
|
43
47
|
export { AdwAlertDialog, AdwAlertResponse } from './elements/adw-alert-dialog.js';
|
|
44
48
|
export { AdwPreferencesDialog, AdwPreferencesPage } from './elements/adw-preferences-dialog.js';
|
|
49
|
+
export { AdwDialog } from './elements/adw-dialog.js';
|
|
50
|
+
export type { AdwDialogPresentationMode } from './elements/adw-dialog.js';
|