Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Every text file is checked out with LF, on Windows too: Git for Windows otherwise makes them
# CRLF, and tests that compare files byte for byte, and what is built in, then differ by system.
* text=auto eol=lf
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
What changed in WittyModule, newest first. What changed before it had a repository of its own is in the
[WittyMediaServer changelog](https://github.com/wittywilla/WittyMediaServer/blob/master/CHANGELOG.md).

## 0.5.5

- SDUI core synced from the server (a focusable list's rows stay focus stops; a List's rows carry their items' buttons). Text files are checked out with LF, and module-kit gives every module a .gitattributes that says so (#7).

## 0.5.4

- **Module API 5 only.** `MinAPI` is 5: `check` refuses a manifest of API 3 or 4, and `Supports` says to install a version built for module API 5. `SDUIFromAPI` and `IntegrationFromAPI` are gone: every helper, program and web module carries `sdui.json` and `integration.json`. This module's own manifest says API 5. Specification 5.0.
Expand Down
1 change: 1 addition & 0 deletions kit/module-kit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ To take a version back, run the *withdraw* workflow from the *Actions* tab. It a
esac
render "$templates/dependabot.yml" "$dir/.github/dependabot.yml"
[ -f "$dir/.gitignore" ] || cp "$templates/gitignore" "$dir/.gitignore"
[ -f "$dir/.gitattributes" ] || cp "$templates/gitattributes" "$dir/.gitattributes"
web_package "$dir"
case " $words " in
*" webpart "*) sdui_kit "$dir" ;;
Expand Down
3 changes: 3 additions & 0 deletions kit/templates/gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Every text file is checked out with LF, on Windows too: Git for Windows otherwise makes them
# CRLF, and tests that compare files byte for byte, and what is built in, then differ by system.
* text=auto eol=lf
2 changes: 1 addition & 1 deletion module.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "wittymodule",
"name": "WittyModule",
"version": "0.5.4",
"version": "0.5.5",
"license": "AGPL-3.0-or-later",
"repo": "wittywilla/WittyModule",
"delivery": "library",
Expand Down
16 changes: 12 additions & 4 deletions sdui/core/focus.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ func Focusable(n *Node, inHero bool) bool {
if c, ok := n.Props["control"].(*Control); ok && c != nil {
return !c.Disabled || n.Action != nil
}
return n.Action != nil
// A row of a focusable list stays a stop without an action, so focus isn't lost when a
// refresh sends it without one for a while (Scan for changes while a scan runs).
return n.Action != nil || n.Props["focusable"] == true
case "Hero":
return len(n.Children) > 0
case "DetailHeader":
Expand All @@ -50,14 +52,17 @@ func focusGroup(n *Node) bool {
// 1. a SearchBox with autofocus;
// 2. else the page's DetailHeader;
// 3. else the first focusable node that isn't a Tab, a FilterBar or a
// SearchBox: the content, not the controls above it;
// SearchBox: the content, not the controls above it. A row of a
// focusable List that has no action (a line that only says how things
// stand, such as "Last scanned") is passed over for the next one;
// 4. else the first focusable node.
func stampFocus(root *Node) {
order := 0
var first, content, header, search *Node
var walk func(n *Node, group string, inHero bool)
var stamp func(n *Node, group string, inHero bool)
inDock := false // the Dock's buttons are controls, not content: focus doesn't start there
inDock := false // the Dock's buttons are controls, not content: focus doesn't start there
passive := false // in a focusable List, whose rows without an action are stops but not starts
walk = func(n *Node, group string, inHero bool) {
if n.Type == "Dock" {
inDock = true
Expand All @@ -82,9 +87,12 @@ func stampFocus(root *Node) {
if focusGroup(n) {
group = n.ID
}
was := passive
passive = listLike(n.Type) && n.Props["focusable"] == true
for i := range n.Children {
walk(&n.Children[i], group, inHero || n.Type == "Hero")
}
passive = was
}
stamp = func(n *Node, group string, inHero bool) {
n.Focus = nil
Expand All @@ -106,7 +114,7 @@ func stampFocus(root *Node) {
}
fallthrough
default:
if content == nil && !inDock {
if content == nil && !inDock && !(passive && n.Action == nil) {
content = n
}
}
Expand Down
7 changes: 7 additions & 0 deletions sdui/core/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -1197,6 +1197,9 @@ func (r *renderer) collectionPage(n *Node, in instance, offset, limit int, allow
row.Props["number"] = strconv.Itoa(num)
}
}
if propBool(p, "focusable", false) {
row.Props["focusable"] = true // a stop even while it has no action (a scan's choices while it runs)
}
n.Children = append(n.Children, row)
continue
}
Expand Down Expand Up @@ -1292,6 +1295,10 @@ func (r *renderer) listItem(parent string, it *Item) Node {
if c := cleanControl(it.Control); c != nil {
n.Props["control"] = c
}
// The item's own buttons (a friend's Invite, a room's Join and Leave), as a card carries them.
if acts := cleanActions(it.Actions); len(acts) > 0 {
n.Props["actions"] = acts
}
switch {
case it.Action != nil:
n.Action = it.Action
Expand Down
Loading