v0.7.0 438604c

nefergui.go RawHistoryFolder

1// Package nefergui is a pure-Go immediate-mode GUI renderer styled with a
2// bounded CSS dialect (see docs/css.md). It draws with Vulkan into DMA-BUF
3// buffers and imports no Wayland library: the application owns the Wayland
4// client (for example with github.com/bnema/neferclient) and feeds events to a
5// Renderer.
6//
7// A view function builds each frame from a Frame; Frame and its Node handles
8// are valid only during that call. Key identifies a child among its siblings
9// across frames; without a key, position and type determine identity. ID is
10// CSS metadata, not frame identity.
11//
12// The frame tree, controls, editors and input routing are implemented in
13// internal/ui; this package is the public facade and re-exports those types.
14//
15// Builds support CGO_ENABLED=0. At runtime NeferGUI requires libvulkan.so.1 and
16// a GPU with DMA-BUF export and DRM syncobj timelines. See docs/runtime.md and
17// docs/troubleshooting.md.
18package nefergui
19
20import "github.com/bnema/nefergui/internal/ui"
21
22// Frame is valid only during one call to the view function. Root builds the
23// application element; Diagnostics reports identity problems in debug builds.
24// Alias methods are listed by go doc github.com/bnema/nefergui/internal/ui.Frame.
25type Frame = ui.Frame
26
27// Node is an ephemeral handle into the current frame. Do not retain it between
28// frames. Container methods (Box, Row, Column, Stack, Scroll, Header, Nav,
29// Main, Section, Aside, Footer, Element) return child nodes; control methods
30// (Button, Checkbox, Radio, Slider, Input, Textarea, Text, Heading, Image,
31// Icon, Separator, Spacer) declare controls. Interactive controls return event
32// snapshots.
33// Alias methods are listed by go doc github.com/bnema/nefergui/internal/ui.Node.
34type Node = ui.Node
35
36// ButtonEvent is an immutable snapshot queried with Activated.
37// Alias methods are listed by go doc github.com/bnema/nefergui/internal/ui.ButtonEvent.
38type ButtonEvent = ui.ButtonEvent
39
40// EditEvent is an immutable snapshot queried with Changed and Submitted.
41// Alias methods are listed by go doc github.com/bnema/nefergui/internal/ui.EditEvent.
42type EditEvent = ui.EditEvent
43
44// ChangeEvent is an immutable snapshot queried with Changed.
45// Alias methods are listed by go doc github.com/bnema/nefergui/internal/ui.ChangeEvent.
46type ChangeEvent = ui.ChangeEvent
47
48// Option families are sealed: ContainerOption, ButtonOption, EditOption,
49// ValueOption and HeadingOption accept the common CSS options (Key, ID,
50// Class, Inline) plus the control-specific options listed on each function.
51type (
52	ContainerOption = ui.ContainerOption
53	ButtonOption    = ui.ButtonOption
54	EditOption      = ui.EditOption
55	ValueOption     = ui.ValueOption
56	HeadingOption   = ui.HeadingOption
57)
58
59// commonOption belongs to every option family; disabledOption to every
60// interactive control family. Both are concrete internal types, aliased so
61// the constructors below can return them without a second implementation.
62type (
63	commonOption   = ui.CommonOption
64	disabledOption = ui.DisabledOption
65)
66
67// Key identifies an element among its siblings across frames.
68func Key(key string) commonOption { return ui.Key(key) }
69
70// ID sets the CSS ID; it does not affect frame identity.
71func ID(id string) commonOption { return ui.ID(id) }
72
73// Class adds a CSS class.
74func Class(class string) commonOption { return ui.Class(class) }
75
76// Inline applies inline CSS declarations.
77func Inline(src string) commonOption { return ui.Inline(src) }
78
79// Disabled blocks focus and interaction on an interactive control.
80func Disabled(v bool) disabledOption { return ui.Disabled(v) }
81
82// Level sets the accessibility heading level (1 through 6).
83func Level(level int) HeadingOption { return ui.Level(level) }
84
85// Placeholder sets the text shown in an empty editor.
86func Placeholder(v string) EditOption { return ui.Placeholder(v) }
87
88// Password masks displayed editor text and blocks copy and cut.
89func Password(v bool) EditOption { return ui.Password(v) }
90
91// Rect is an integer logical-pixel rectangle in surface coordinates, used by
92// Frame.SetInputRects and Output.InputRects.
93type Rect = ui.Rect
94
95// InputKind classifies an Input; Modifiers is a bit set of held modifiers and
96// latched Caps Lock and Num Lock state.
97type (
98	InputKind = ui.InputKind
99	Modifiers = ui.Modifiers
100)
101
102const (
103	InputPointerMotion  = ui.InputPointerMotion
104	InputPointerPress   = ui.InputPointerPress
105	InputPointerRelease = ui.InputPointerRelease
106	InputPointerAxis    = ui.InputPointerAxis
107	InputPointerLeave   = ui.InputPointerLeave
108	InputKey            = ui.InputKey
109	InputFocusIn        = ui.InputFocusIn
110	InputFocusOut       = ui.InputFocusOut
111	InputReset          = ui.InputReset
112
113	ModShift = ui.ModShift
114	ModCtrl  = ui.ModCtrl
115	ModAlt   = ui.ModAlt
116	ModSuper = ui.ModSuper
117
118	ModCapsLock = ui.ModCapsLock
119	ModNumLock  = ui.ModNumLock
120)

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 1

Tags 12

↑↓ moveenter openesc close