Skip to content

Commit

Permalink
meta: Update from upstream.
Browse files Browse the repository at this point in the history
  • Loading branch information
sleepy-monax committed Feb 18, 2025
1 parent bdb4bfb commit feae874
Show file tree
Hide file tree
Showing 250 changed files with 8,163 additions and 5,442 deletions.
8 changes: 6 additions & 2 deletions src/apps/hideo-apps/app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,12 @@ Ui::Child app() {
return Kr::scaffold({
.icon = Mdi::BASKET,
.title = "Apps"s,
.sidebar = slot$(sidebar()),
.body = slot$(pageContent() | Ui::grow()),
.sidebar = [] {
return sidebar();
},
.body = [] {
return pageContent() | Ui::grow();
},
});
}

Expand Down
4 changes: 3 additions & 1 deletion src/apps/hideo-avplayer/app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ Ui::Child app() {
return Kr::scaffold({
.icon = Mdi::PLAY_CIRCLE,
.title = "Media Player"s,
.body = slot$(player()),
.body = [] {
return player();
},
});
}

Expand Down
10 changes: 6 additions & 4 deletions src/apps/hideo-calculator/app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,12 @@ Ui::Child app() {
.icon = Mdi::CALCULATOR,
.title = "Calculator"s,
.titlebar = Kr::TitlebarStyle::DIALOG,
.body = slot$(Ui::vflow(
screen(state) | Ui::dragRegion(),
keypad(state) | Ui::grow()
)),
.body = [&] {
return Ui::vflow(
screen(state) | Ui::dragRegion(),
keypad(state) | Ui::grow()
);
},
.size = {300, 332},
});
});
Expand Down
4 changes: 3 additions & 1 deletion src/apps/hideo-calendar/app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ Ui::Child app() {
return Kr::scaffold({
.icon = Mdi::CALENDAR,
.title = "Calendar"s,
.body = slot$(Ui::empty()),
.body = [] {
return Ui::empty();
},
});
}

Expand Down
4 changes: 3 additions & 1 deletion src/apps/hideo-canvas/app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ Ui::Child app() {
return Kr::scaffold({
.icon = Mdi::DRAW,
.title = "Canvas"s,
.body = slot$(Ui::empty()),
.body = [] {
return Ui::empty();
},
});
}

Expand Down
4 changes: 3 additions & 1 deletion src/apps/hideo-chat/app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ Ui::Child app() {
return Kr::scaffold({
.icon = Mdi::MESSAGE,
.title = "Chat"s,
.body = slot$(Ui::empty()),
.body = [] {
return Ui::empty();
},
});
}

Expand Down
4 changes: 3 additions & 1 deletion src/apps/hideo-code/app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ Ui::Child app() {
return Kr::scaffold({
.icon = Mdi::CODE_BRACES,
.title = "Code"s,
.body = slot$(Ui::empty()),
.body = [] {
return Ui::empty();
},
});
}

Expand Down
58 changes: 23 additions & 35 deletions src/apps/hideo-demos/demo-text.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,41 +16,29 @@ static inline Demo TEXT_DEMO{
"Typography",
[] {
return Ui::vflow(
Kr::treeRow(
slot$(Ui::icon(Mdi::TEXT)), "Display"s, NONE,
slots$(
Ui::displayLarge("Display Large"),
Ui::displayMedium("Display Medium"),
Ui::displaySmall("Display Small")
)
),

Kr::treeRow(
slot$(Ui::icon(Mdi::TEXT)), "Headlines"s, NONE,
slots$(
Ui::headlineLarge("Headline Large"),
Ui::headlineMedium("Headline Medium"),
Ui::headlineSmall("Headline Small")
)
),

Kr::treeRow(
slot$(Ui::icon(Mdi::TEXT)), "Titles"s, NONE,
slots$(
Ui::titleLarge("Title Large"),
Ui::titleMedium("Title Medium"),
Ui::titleSmall("Title Small")
)
),

Kr::treeRow(
slot$(Ui::icon(Mdi::TEXT)), "Body"s, NONE,
slots$(
Ui::bodyLarge("Body Large"),
Ui::bodyMedium("Body Medium"),
Ui::bodySmall("Body Small")
)
)
Ui::displayLarge("Display Large"),
Ui::displayMedium("Display Medium"),
Ui::displaySmall("Display Small"),

Ui::headlineLarge("Headline Large"),
Ui::headlineMedium("Headline Medium"),
Ui::headlineSmall("Headline Small"),

Ui::titleLarge("Title Large"),
Ui::titleMedium("Title Medium"),
Ui::titleSmall("Title Small"),

Ui::labelLarge("Label Large"),
Ui::labelMedium("Label Medium"),
Ui::labelSmall("Label Small"),

Ui::bodyLarge("Body Large"),
Ui::bodyMedium("Body Medium"),
Ui::bodySmall("Body Small"),

Ui::codeLarge("Code Large"),
Ui::codeMedium("Code Medium"),
Ui::codeSmall("Code Small")
) |
Ui::vscroll();
},
Expand Down
34 changes: 24 additions & 10 deletions src/apps/hideo-files/app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Ui::Child pageContent(State const& state) {
: alert(
state,
"Can't access this location"s,
Io::toStr(dir.none()).unwrap()
Io::toStr(dir.none())
);

return listing | Ui::grow();
Expand All @@ -61,15 +61,29 @@ Ui::Child app() {
return Kr::scaffold({
.icon = Mdi::FOLDER,
.title = "Files"s,
.startTools = slots$(
goBackTool(s),
goForwardTool(s),
goParentTool(s)
),
.midleTools = slots$(breadcrumb(s) | Ui::grow()),
.endTools = slots$(moreTool(s)),
.sidebar = slot$(sidebar(s)),
.body = slot$(pageContent(s)),
.startTools = [&] -> Ui::Children {
return {
goBackTool(s),
goForwardTool(s),
goParentTool(s),
};
},
.middleTools = [&] -> Ui::Children {
return {
breadcrumb(s) | Ui::grow(),
};
},
.endTools = [&] -> Ui::Children {
return {
moreTool(s),
};
},
.sidebar = [&] {
return sidebar(s);
},
.body = [&] {
return pageContent(s);
},
});
});
}
Expand Down
21 changes: 13 additions & 8 deletions src/apps/hideo-files/model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,25 @@
namespace Hideo::Files {

Ui::Task<Action> reduce(State& s, Action a) {
a.visit(Visitor{
return a.visit(Visitor{
[&](GoRoot) {
reduce(s, GoTo{"file:/"_url}).unwrap();
return reduce(s, GoTo{"file:/"_url});
},
[&](GoBack) {
if (s.canGoBack())
s.currentIndex--;
return NONE;
},
[&](GoForward) {
if (s.canGoForward())
s.currentIndex++;
return NONE;
},
[&](GoParent p) {
auto parent = s.currentUrl().parent(p.index);
reduce(s, GoTo{parent}).unwrap();
return reduce(s, GoTo{parent});
},
[&](Navigate navigate) {
[&](Navigate navigate) -> Ui::Task<Action> {
auto dest = s.currentUrl();
dest.append(navigate.item);

Expand All @@ -33,27 +35,30 @@ Ui::Task<Action> reduce(State& s, Action a) {
.objects = {dest},
});
} else {
reduce(s, GoTo{dest}).unwrap();
return reduce(s, GoTo{dest});
}
return NONE;
},
[&](GoTo gotTo) {
if (s.currentUrl() == gotTo.url)
return;
return NONE;

s.history.trunc(s.currentIndex + 1);
s.history.pushBack(gotTo.url);
s.currentIndex++;
return NONE;
},
[&](Refresh) {
return NONE;
},
[&](AddBookmark) {
return NONE;
},
[&](ToggleHidden) {
s.showHidden = not s.showHidden;
return NONE;
},
});

return NONE;
}

} // namespace Hideo::Files
4 changes: 2 additions & 2 deletions src/apps/hideo-files/widgets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ Ui::Child directorEntry(Sys::DirEntry const& entry, bool odd) {
: Mime::iconFor(Mime::sniffSuffix(Mime::suffixOf(entry.name)).unwrapOr("file"s)),
entry.name
) |
Kr::contextMenu(slot$(directoryContextMenu()));
Kr::contextMenu(directoryContextMenu);
}

Ui::Child directoryListing(State const& s, Sys::Dir const& dir) {
Expand Down Expand Up @@ -301,7 +301,7 @@ Ui::Child openFileDialog() {
: alert(
d,
"Can't access this location"s,
Io::toStr(maybeDir.none()).unwrap()
Io::toStr(maybeDir.none())
)
) | Ui::pinSize({400, 260}),
Ui::separator(),
Expand Down
18 changes: 13 additions & 5 deletions src/apps/hideo-fonts/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,15 +106,15 @@ Ui::Child fontfaceTags(Text::FontAttrs const& attrs) {
}

if (attrs.style != Text::FontStyle::NORMAL) {
children.pushBack(fontfaceTag(Io::toStr(attrs.style).unwrap()));
children.pushBack(fontfaceTag(Io::toStr(attrs.style)));
}

if (attrs.stretch != Text::FontStretch::NORMAL) {
children.pushBack(fontfaceTag(Io::toStr(attrs.stretch).unwrap()));
children.pushBack(fontfaceTag(Io::toStr(attrs.stretch)));
}

if (attrs.weight != Text::FontWeight::REGULAR) {
children.pushBack(fontfaceTag(Io::toStr(attrs.weight).unwrap()));
children.pushBack(fontfaceTag(Io::toStr(attrs.weight)));
}

return Ui::hflow(4, children);
Expand Down Expand Up @@ -208,8 +208,16 @@ Ui::Child app(Text::FontBook book) {
return Kr::scaffold({
.icon = Mdi::FORMAT_FONT,
.title = "Fonts"s,
.startTools = slots$(Ui::button(Model::bindIf<GoBack>(s.canGoBack()), Ui::ButtonStyle::subtle(), Mdi::ARROW_LEFT)),
.body = slot$(appContent(s)),
.startTools = [&] -> Ui::Children {
return {Ui::button(
Model::bindIf<GoBack>(s.canGoBack()),
Ui::ButtonStyle::subtle(),
Mdi::ARROW_LEFT
)};
},
.body = [&] {
return appContent(s);
},
});
});
}
Expand Down
12 changes: 6 additions & 6 deletions src/apps/hideo-images/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ namespace Hideo::Images {
Ui::Child app(State initial) {
return Ui::reducer<Model>(
initial,
[](auto const& state) {
[](auto const& s) {
return Kr::scaffold({
.icon = Mdi::IMAGE,
.title = "Images"s,
.body = slot$(
state.isEditor
? editor(state)
: viewer(state)
),
.body = [&] {
return s.isEditor
? editor(s)
: viewer(s);
},
});
}
);
Expand Down
4 changes: 3 additions & 1 deletion src/apps/hideo-map/app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ Ui::Child app() {
return Kr::scaffold({
.icon = Mdi::MAP,
.title = "Map"s,
.body = slot$(Ui::empty()),
.body = [] {
return Ui::empty();
},
});
}

Expand Down
4 changes: 3 additions & 1 deletion src/apps/hideo-mines/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ Ui::Child game() {
return Kr::scaffold({
.icon = Mdi::MINE,
.title = "Mines"s,
.body = slot$(Ui::empty()),
.body = [] {
return Ui::empty();
},
});
}

Expand Down
4 changes: 3 additions & 1 deletion src/apps/hideo-notes/app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ Ui::Child app() {
return Kr::scaffold({
.icon = Mdi::FORMAT_LIST_BULLETED,
.title = "Notes"s,
.body = slot$(Ui::empty()),
.body = [] {
return Ui::empty();
},
});
}

Expand Down
4 changes: 3 additions & 1 deletion src/apps/hideo-peoples/app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ Ui::Child app() {
return Kr::scaffold({
.icon = Mdi::ACCOUNT,
.title = "Peoples"s,
.body = slot$(Ui::empty()),
.body = [] {
return Ui::empty();
},
});
}

Expand Down
4 changes: 3 additions & 1 deletion src/apps/hideo-recorder/app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ Ui::Child app() {
return Kr::scaffold({
.icon = Mdi::MICROPHONE,
.title = "Recorder"s,
.body = slot$(Ui::empty()),
.body = [] {
return Ui::empty();
},
});
}

Expand Down
Loading

0 comments on commit feae874

Please sign in to comment.