@gjsify/adwaita-web 0.14.0 → 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/README.md +58 -0
- package/dist/adwaita-web.css +617 -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/elements/adw-menu-button.d.ts +34 -0
- package/lib/types/elements/adw-view-stack.d.ts +37 -0
- package/lib/types/elements/adw-view-switcher-bar.d.ts +27 -0
- package/lib/types/index.d.ts +11 -0
- package/lib/types/source-view/adw-source-view.d.ts +75 -0
- package/lib/types/source-view/asm6502.d.ts +28 -0
- package/lib/types/source-view/hex.d.ts +27 -0
- package/lib/types/source-view/index.d.ts +4 -0
- package/lib/types/source-view/theme.d.ts +15 -0
- package/lib/types/styles.generated.d.ts +1 -1
- package/package.json +24 -12
- package/scss/_data_grid.scss +144 -0
- package/scss/_dialog.scss +220 -0
- package/scss/_drop_down.scss +185 -0
- package/scss/_menu_button.scss +151 -0
- package/scss/_root.scss +22 -0
- package/scss/_theme.scss +5 -0
- package/scss/_variables.scss +9 -0
- package/scss/_view_stack.scss +29 -0
- package/scss/_view_switcher_bar.scss +94 -0
- package/scss/adwaita-skin.scss +7 -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/elements/adw-menu-button.ts +247 -0
- package/src/elements/adw-view-stack.ts +174 -0
- package/src/elements/adw-view-switcher-bar.ts +168 -0
- package/src/index.ts +16 -0
- package/src/source-view/adw-source-view.ts +436 -0
- package/src/source-view/asm6502.ts +232 -0
- package/src/source-view/hex.ts +43 -0
- package/src/source-view/index.ts +28 -0
- package/src/source-view/theme.ts +224 -0
- package/src/test.browser.mts +14 -0
- package/src/index.js +0 -1
- package/src/styles.generated.js +0 -2976
- package/src/styles2.generated.js +0 -2976
|
@@ -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 {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/** A menu entry. `id` defaults to `label` on activation; `icon` is optional. */
|
|
2
|
+
export interface AdwMenuItem {
|
|
3
|
+
id?: string;
|
|
4
|
+
label: string;
|
|
5
|
+
icon?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare class AdwMenuButton extends HTMLElement {
|
|
8
|
+
private _buttonEl;
|
|
9
|
+
private _popoverEl;
|
|
10
|
+
private _items;
|
|
11
|
+
private _menuTitle;
|
|
12
|
+
private _active;
|
|
13
|
+
private _initialized;
|
|
14
|
+
private _itemButtons;
|
|
15
|
+
private _onDocumentPointerDown;
|
|
16
|
+
private _onDocumentKeyDown;
|
|
17
|
+
static get observedAttributes(): string[];
|
|
18
|
+
/** Whether the popover menu is currently open. */
|
|
19
|
+
get active(): boolean;
|
|
20
|
+
/** The menu entries. Setting rebuilds the popover. */
|
|
21
|
+
get menuItems(): AdwMenuItem[];
|
|
22
|
+
set menuItems(value: AdwMenuItem[]);
|
|
23
|
+
/** The optional popover heading. */
|
|
24
|
+
get menuTitle(): string;
|
|
25
|
+
set menuTitle(value: string);
|
|
26
|
+
connectedCallback(): void;
|
|
27
|
+
disconnectedCallback(): void;
|
|
28
|
+
attributeChangedCallback(name: string): void;
|
|
29
|
+
private _parseMenuAttr;
|
|
30
|
+
private _setActive;
|
|
31
|
+
private _onMenuKeyDown;
|
|
32
|
+
private _render;
|
|
33
|
+
private _renderMenu;
|
|
34
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/** A page descriptor exposed via `pages` (consumed by a bound switcher bar). */
|
|
2
|
+
export interface AdwViewStackPageInfo {
|
|
3
|
+
/** Stable id used by visibleChildName + switcher binding. */
|
|
4
|
+
name: string;
|
|
5
|
+
/** Human-facing title shown by a bound switcher. */
|
|
6
|
+
title: string;
|
|
7
|
+
/** Symbolic icon name (no `-symbolic` suffix), or '' for none. */
|
|
8
|
+
icon: string;
|
|
9
|
+
/** The page's content container (the visibility-toggled node). */
|
|
10
|
+
element: HTMLElement;
|
|
11
|
+
}
|
|
12
|
+
export declare class AdwViewStack extends HTMLElement {
|
|
13
|
+
private _pages;
|
|
14
|
+
private _visibleIndex;
|
|
15
|
+
private _initialized;
|
|
16
|
+
static get observedAttributes(): string[];
|
|
17
|
+
/** All pages in declaration/add order. A bound switcher reads this. */
|
|
18
|
+
get pages(): readonly AdwViewStackPageInfo[];
|
|
19
|
+
/** Zero-based index of the visible page. Out-of-range/same values no-op. */
|
|
20
|
+
get visibleChildIndex(): number;
|
|
21
|
+
set visibleChildIndex(value: number);
|
|
22
|
+
/** Name of the visible page, or '' when the stack is empty. */
|
|
23
|
+
get visibleChildName(): string;
|
|
24
|
+
set visibleChildName(name: string);
|
|
25
|
+
/** The visible page's content element, or null when empty. */
|
|
26
|
+
get visibleChild(): HTMLElement | null;
|
|
27
|
+
connectedCallback(): void;
|
|
28
|
+
attributeChangedCallback(name: string, _old: string | null, value: string | null): void;
|
|
29
|
+
/**
|
|
30
|
+
* Append a page. The FIRST page added becomes visible automatically; later
|
|
31
|
+
* pages are added hidden. Mirrors Adw.ViewStack.add()/the NS twin's add().
|
|
32
|
+
*/
|
|
33
|
+
add(content: HTMLElement, name: string, title?: string, icon?: string): AdwViewStackPageInfo;
|
|
34
|
+
/** Convenience alias mirroring Adw.ViewStack.add_titled() (no icon). */
|
|
35
|
+
addTitled(content: HTMLElement, name: string, title: string): AdwViewStackPageInfo;
|
|
36
|
+
private _apply;
|
|
37
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { AdwViewStack } from './adw-view-stack.js';
|
|
2
|
+
export declare class AdwViewSwitcherBar extends HTMLElement {
|
|
3
|
+
private _barEl;
|
|
4
|
+
private _buttons;
|
|
5
|
+
private _stack;
|
|
6
|
+
private _revealed;
|
|
7
|
+
private _initialized;
|
|
8
|
+
private _onStackNotify;
|
|
9
|
+
static get observedAttributes(): string[];
|
|
10
|
+
/** The bound stack element, or null when unbound. */
|
|
11
|
+
get stack(): AdwViewStack | null;
|
|
12
|
+
set stack(value: AdwViewStack | string | null);
|
|
13
|
+
/** Whether the bar is revealed (shown). Hidden when false. */
|
|
14
|
+
get revealed(): boolean;
|
|
15
|
+
set revealed(value: boolean);
|
|
16
|
+
connectedCallback(): void;
|
|
17
|
+
disconnectedCallback(): void;
|
|
18
|
+
attributeChangedCallback(name: string, _old: string | null, value: string | null): void;
|
|
19
|
+
/** Bind to a stack element (or null). Unbinds the previous one and rebuilds. */
|
|
20
|
+
setStack(stack: AdwViewStack | null): void;
|
|
21
|
+
/** Rebuild the buttons — call after adding pages to the bound stack. */
|
|
22
|
+
refresh(): void;
|
|
23
|
+
private _resolveStack;
|
|
24
|
+
private _rebuild;
|
|
25
|
+
private _syncActive;
|
|
26
|
+
private _applyRevealed;
|
|
27
|
+
}
|
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';
|
|
@@ -31,9 +33,18 @@ export { AdwCarousel, AdwCarouselIndicatorDots, AdwCarouselIndicatorLines } from
|
|
|
31
33
|
export { AdwTabPage, AdwTabView } from './elements/adw-tab-view.js';
|
|
32
34
|
export { AdwViewSwitcher, AdwViewSwitcherPage } from './elements/adw-view-switcher.js';
|
|
33
35
|
export { AdwInlineViewSwitcher, AdwViewStackPage } from './elements/adw-inline-view-switcher.js';
|
|
36
|
+
export { AdwViewStack } from './elements/adw-view-stack.js';
|
|
37
|
+
export type { AdwViewStackPageInfo } from './elements/adw-view-stack.js';
|
|
38
|
+
export { AdwViewSwitcherBar } from './elements/adw-view-switcher-bar.js';
|
|
39
|
+
export { AdwMenuButton } from './elements/adw-menu-button.js';
|
|
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';
|
|
34
43
|
export { AdwNavigationPage, AdwNavigationView } from './elements/adw-navigation-view.js';
|
|
35
44
|
export { AdwBottomSheet, AdwBottomSheetContent, AdwBottomSheetSheet } from './elements/adw-bottom-sheet.js';
|
|
36
45
|
export { AdwSidebar, AdwSidebarItem, AdwSidebarSection } from './elements/adw-sidebar.js';
|
|
37
46
|
export { AdwAboutDialog } from './elements/adw-about-dialog.js';
|
|
38
47
|
export { AdwAlertDialog, AdwAlertResponse } from './elements/adw-alert-dialog.js';
|
|
39
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';
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { EditorView } from '@codemirror/view';
|
|
2
|
+
export declare class AdwSourceView extends HTMLElement {
|
|
3
|
+
private _view?;
|
|
4
|
+
private _editorHost;
|
|
5
|
+
private _copyButton;
|
|
6
|
+
private _initialized;
|
|
7
|
+
private _suppressChangeEvent;
|
|
8
|
+
private _code;
|
|
9
|
+
private _editable;
|
|
10
|
+
private _selectable;
|
|
11
|
+
private _lineNumbers;
|
|
12
|
+
private _lineNumberStart;
|
|
13
|
+
private _hexAddresses;
|
|
14
|
+
private _language;
|
|
15
|
+
private _copyable;
|
|
16
|
+
private _copyButtonIcon;
|
|
17
|
+
private _copyButtonTooltip;
|
|
18
|
+
private readonly _editableComp;
|
|
19
|
+
private readonly _lineNumbersComp;
|
|
20
|
+
private readonly _selectableComp;
|
|
21
|
+
private readonly _languageComp;
|
|
22
|
+
private readonly _copyComp;
|
|
23
|
+
static get observedAttributes(): string[];
|
|
24
|
+
/** The document text. Programmatic assignment does NOT emit `code-changed`. */
|
|
25
|
+
get code(): string;
|
|
26
|
+
set code(value: string);
|
|
27
|
+
/** Whether the user can edit the buffer (drives readOnly + active-line). */
|
|
28
|
+
get editable(): boolean;
|
|
29
|
+
set editable(value: boolean);
|
|
30
|
+
/** Inverse of `editable` — mirrors the native widget's readonly prop. */
|
|
31
|
+
get readonly(): boolean;
|
|
32
|
+
set readonly(value: boolean);
|
|
33
|
+
/** Whether the content is selectable by the user. */
|
|
34
|
+
get selectable(): boolean;
|
|
35
|
+
set selectable(value: boolean);
|
|
36
|
+
/** Whether the gutter is shown. */
|
|
37
|
+
get lineNumbers(): boolean;
|
|
38
|
+
set lineNumbers(value: boolean);
|
|
39
|
+
/** First gutter value: decimal offset, or the base ADDRESS in hex mode. */
|
|
40
|
+
get lineNumberStart(): number | undefined;
|
|
41
|
+
set lineNumberStart(value: number | undefined);
|
|
42
|
+
/** Render the gutter as 4-digit hex addresses (monitor / hexdump panes). */
|
|
43
|
+
get hexAddresses(): boolean;
|
|
44
|
+
set hexAddresses(value: boolean);
|
|
45
|
+
/** `6502` / `6502-assembler` enables highlighting; anything else = plain. */
|
|
46
|
+
get language(): string;
|
|
47
|
+
set language(value: string);
|
|
48
|
+
/** Whether the floating copy button is shown. */
|
|
49
|
+
get copyable(): boolean;
|
|
50
|
+
set copyable(value: boolean);
|
|
51
|
+
/** Icon name for the copy button (`edit-copy`/`copy` render an inline SVG). */
|
|
52
|
+
get copyButtonIcon(): string;
|
|
53
|
+
set copyButtonIcon(value: string);
|
|
54
|
+
/** Accessible label / tooltip for the copy button. */
|
|
55
|
+
get copyButtonTooltip(): string;
|
|
56
|
+
set copyButtonTooltip(value: string);
|
|
57
|
+
/** Whether the editor fills its host's height (vs. auto-sizing to content). */
|
|
58
|
+
get fillHeight(): boolean;
|
|
59
|
+
set fillHeight(value: boolean);
|
|
60
|
+
/** The live CodeMirror EditorView (null until connected). Escape hatch. */
|
|
61
|
+
get view(): EditorView | null;
|
|
62
|
+
connectedCallback(): void;
|
|
63
|
+
disconnectedCallback(): void;
|
|
64
|
+
attributeChangedCallback(name: string, _old: string | null, value: string | null): void;
|
|
65
|
+
private _baseExtensions;
|
|
66
|
+
private _editableExtension;
|
|
67
|
+
private _lineNumbersExtension;
|
|
68
|
+
private _selectableExtension;
|
|
69
|
+
private _languageExtension;
|
|
70
|
+
private _copyExtension;
|
|
71
|
+
private _reconfigure;
|
|
72
|
+
private _onCopyButtonClick;
|
|
73
|
+
private _renderCopyIcon;
|
|
74
|
+
private _readDeclarativeAttributes;
|
|
75
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type StreamParser, type StringStream } from '@codemirror/language';
|
|
2
|
+
import { type Extension } from '@codemirror/state';
|
|
3
|
+
import { type Tag } from '@lezer/highlight';
|
|
4
|
+
/** The 56 official NMOS 6502 mnemonics (uppercased for case-insensitive match). */
|
|
5
|
+
export declare const OPCODES: ReadonlySet<string>;
|
|
6
|
+
/** The registers that appear as bare operands (`ASL A`, `LDA $00,X`). */
|
|
7
|
+
export declare const REGISTERS: ReadonlySet<string>;
|
|
8
|
+
/** Assembler pseudo-ops. `define`/`dcb` are the easy6502 dialect; the rest are
|
|
9
|
+
* common cross-assembler directives (with the leading dot handled separately). */
|
|
10
|
+
export declare const DIRECTIVE_WORDS: ReadonlySet<string>;
|
|
11
|
+
/**
|
|
12
|
+
* Classify an identifier-shaped token. Pure + side-effect-free so it is unit
|
|
13
|
+
* testable without a CodeMirror stream. `atLineStart` decides whether an
|
|
14
|
+
* unknown word is a label DEFINITION (column 0) or a symbol REFERENCE.
|
|
15
|
+
*/
|
|
16
|
+
export declare function classifyWord(word: string, atLineStart: boolean): string;
|
|
17
|
+
/**
|
|
18
|
+
* Tokenize one token from the stream. Exported for unit tests (feed it a
|
|
19
|
+
* `StringStream`). Returns a token-class name (see file header) or `null` for
|
|
20
|
+
* whitespace/unclassified punctuation.
|
|
21
|
+
*/
|
|
22
|
+
export declare function token6502(stream: StringStream): string | null;
|
|
23
|
+
/** Maps this mode's token-class names to @lezer/highlight tags. */
|
|
24
|
+
export declare const asm6502TokenTable: Record<string, Tag>;
|
|
25
|
+
/** The StreamParser powering the 6502 mode. */
|
|
26
|
+
export declare const asm6502Parser: StreamParser<unknown>;
|
|
27
|
+
/** The 6502 assembly language extension for a CodeMirror EditorState. */
|
|
28
|
+
export declare function asm6502(): Extension;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/** Bytes represented per visual line in the hex monitor / hexdump gutter. */
|
|
2
|
+
export declare const HEX_ADDRESS_STRIDE = 16;
|
|
3
|
+
/**
|
|
4
|
+
* Format a 1-based CodeMirror line number as a 4-digit uppercase hex address,
|
|
5
|
+
* the way the native GtkSourceView hex gutter renders monitor/hexdump rows:
|
|
6
|
+
* each row advances the address by `stride` bytes from `start`.
|
|
7
|
+
*
|
|
8
|
+
* @param lineNo 1-based line number (CodeMirror's `formatNumber` contract).
|
|
9
|
+
* @param start base address of the first row (e.g. 0x0600 for a 6502 program).
|
|
10
|
+
* @param stride bytes per row (default 16 — one hexdump row).
|
|
11
|
+
*/
|
|
12
|
+
export declare function formatHexAddress(lineNo: number, start: number, stride?: number): string;
|
|
13
|
+
/**
|
|
14
|
+
* Format a 1-based CodeMirror line number for the normal (decimal) gutter,
|
|
15
|
+
* offset by `start` so a pane can begin numbering at an arbitrary value —
|
|
16
|
+
* the web twin of the native renderer's `line + startValue`.
|
|
17
|
+
*
|
|
18
|
+
* @param lineNo 1-based line number.
|
|
19
|
+
* @param start value shown on the first line (default 1 → identity).
|
|
20
|
+
*/
|
|
21
|
+
export declare function formatLineNumber(lineNo: number, start?: number): string;
|
|
22
|
+
/**
|
|
23
|
+
* Strip every whitespace character from `text` — the copy-without-spaces
|
|
24
|
+
* transform the native hex monitor applies so a copied address/byte run pastes
|
|
25
|
+
* as a compact hex string. Mirrors `text.replace(/\s/g, '')` in the GTK widget.
|
|
26
|
+
*/
|
|
27
|
+
export declare function stripWhitespace(text: string): string;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { AdwSourceView } from './adw-source-view.js';
|
|
2
|
+
export { asm6502, asm6502Parser, asm6502TokenTable, classifyWord, token6502, OPCODES, REGISTERS, DIRECTIVE_WORDS, } from './asm6502.js';
|
|
3
|
+
export { adwaitaEditorTheme, adwaitaHighlightStyle, ensureSourceViewStyleInjected, SOURCE_VIEW_CSS, SOURCE_VIEW_STYLE_ID, } from './theme.js';
|
|
4
|
+
export { formatHexAddress, formatLineNumber, stripWhitespace, HEX_ADDRESS_STRIDE } from './hex.js';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { HighlightStyle } from '@codemirror/language';
|
|
2
|
+
/** The CodeMirror EditorView theme mapping `.cm-*` chrome to Adwaita tokens. */
|
|
3
|
+
export declare const adwaitaEditorTheme: import("@codemirror/state").Extension;
|
|
4
|
+
/** Syntax highlighting mapping tags → the `--adw-src-*` palette variables. */
|
|
5
|
+
export declare const adwaitaHighlightStyle: HighlightStyle;
|
|
6
|
+
/** Element id of the injected stylesheet (idempotency guard). */
|
|
7
|
+
export declare const SOURCE_VIEW_STYLE_ID = "adw-source-view-style";
|
|
8
|
+
/** The chrome stylesheet: container, copy button, LTR pin, syntax palette. */
|
|
9
|
+
export declare const SOURCE_VIEW_CSS = "\n.adw-source-view {\n --adw-src-comment: #5e5c64;\n --adw-src-keyword: #1c71d8;\n --adw-src-number: #c64600;\n --adw-src-string: #26a269;\n --adw-src-label: #813d9c;\n --adw-src-register: #007e8a;\n --adw-src-directive: #a51d2d;\n --adw-src-operator: rgba(0, 0, 6, 0.55);\n --adw-src-selection: color-mix(in srgb, var(--accent-bg-color, #3584e4) 26%, transparent);\n --adw-src-gutter-bg: var(--view-bg-color, #ffffff);\n --adw-src-gutter-fg: rgba(0, 0, 6, 0.35);\n --adw-src-active-line: color-mix(in srgb, var(--view-fg-color, #00000a) 4%, transparent);\n\n /* Source code is inherently LTR \u2014 pin the whole widget so the gutter,\n scrollbar and copy button never mirror under an RTL page. */\n direction: ltr;\n position: relative;\n display: block;\n box-sizing: border-box;\n overflow: hidden;\n border-radius: var(--card-radius, 12px);\n background-color: var(--view-bg-color, #ffffff);\n color: var(--view-fg-color, rgba(0, 0, 6, 0.8));\n}\n\n.adw-source-view .cm-editor {\n border-radius: inherit;\n max-height: 100%;\n}\n\n.adw-source-view.adw-source-view--fill,\n.adw-source-view.adw-source-view--fill .cm-editor {\n height: 100%;\n}\n\n.adw-source-view .cm-editor.cm-focused {\n outline: none;\n}\n\n.adw-source-view__copy {\n position: absolute;\n top: 6px;\n right: 6px;\n z-index: 2;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 30px;\n height: 30px;\n padding: 0;\n border: none;\n border-radius: var(--button-radius, 9px);\n background-color: color-mix(in srgb, var(--view-bg-color, #ffffff) 82%, transparent);\n color: var(--view-fg-color, rgba(0, 0, 6, 0.75));\n opacity: 0.72;\n cursor: pointer;\n transition: opacity 0.15s ease, background-color 0.15s ease;\n -webkit-backdrop-filter: blur(6px);\n backdrop-filter: blur(6px);\n}\n\n.adw-source-view__copy:hover {\n opacity: 1;\n background-color: var(--button-hover-color, rgba(0, 0, 6, 0.13));\n}\n\n.adw-source-view__copy:active {\n background-color: var(--button-active-color, rgba(0, 0, 6, 0.19));\n}\n\n.adw-source-view__copy:focus-visible {\n opacity: 1;\n outline: 2px solid var(--accent-color, #1c71d8);\n outline-offset: 1px;\n}\n\n.adw-source-view__copy[hidden] {\n display: none;\n}\n\n.adw-source-view__copy svg {\n width: 16px;\n height: 16px;\n display: block;\n}\n\n.adw-source-view__copy .adw-icon {\n width: 16px;\n height: 16px;\n background-color: currentColor;\n -webkit-mask-repeat: no-repeat;\n mask-repeat: no-repeat;\n -webkit-mask-position: center;\n mask-position: center;\n}\n\n@media (prefers-color-scheme: dark) {\n :root:not(.theme-light) .adw-source-view {\n --adw-src-comment: #9a9996;\n --adw-src-keyword: #78aeed;\n --adw-src-number: #ffa348;\n --adw-src-string: #8ff0a4;\n --adw-src-label: #dc8add;\n --adw-src-register: #33d1c9;\n --adw-src-directive: #f66151;\n --adw-src-operator: rgba(255, 255, 255, 0.55);\n --adw-src-gutter-fg: rgba(255, 255, 255, 0.35);\n --adw-src-active-line: color-mix(in srgb, #ffffff 6%, transparent);\n }\n}\n\n:root.theme-dark .adw-source-view {\n --adw-src-comment: #9a9996;\n --adw-src-keyword: #78aeed;\n --adw-src-number: #ffa348;\n --adw-src-string: #8ff0a4;\n --adw-src-label: #dc8add;\n --adw-src-register: #33d1c9;\n --adw-src-directive: #f66151;\n --adw-src-operator: rgba(255, 255, 255, 0.55);\n --adw-src-gutter-fg: rgba(255, 255, 255, 0.35);\n --adw-src-active-line: color-mix(in srgb, #ffffff 6%, transparent);\n}\n";
|
|
10
|
+
/**
|
|
11
|
+
* Inject the chrome stylesheet once (browser-only, idempotent). Matches the
|
|
12
|
+
* self-injection pattern of `@gjsify/adwaita-web`'s main entry, so importing
|
|
13
|
+
* the source-view subpath is enough to style it under any bundler.
|
|
14
|
+
*/
|
|
15
|
+
export declare function ensureSourceViewStyleInjected(): void;
|