Skip to content

Commit ce99f0f

Browse files
authored
restore composer + sidebar toggle to pre-port design (and e2e fixes) (#24)
* composer: restore horizontal asset scroll + tap-to-focus on expanded card Two behaviors dropped in the OCaml port vs the previous LG design: the asset strip scrolled vertically (missing :orientation), and tapping the expanded composer card no longer focused the field (missing on-press -> FocusComposer; containers have no ~on_press in the typed DSL so a with_press helper registers PressEnabled). * restore sidebar toggle glass circle size + bump lui for borderless textarea The header sidebar button lost its ~44pt circle when lui c90fe35 dropped the iOS default 44pt button height (system metrics is intentional — pin the hit target explicitly instead). Also pins lui to 079b13b which keeps .textarea borderless, restoring the composer's bare text field on the glass card. * bump lui pin for flutter menuTrigger render * retrigger android e2e (emulator SDK zip corrupt on previous run) * bump lui pin for press-enabled column support * bump lui pin for flutter column tap fix * retrigger android e2e (Pixel Launcher ANR dialog on previous run) * restore overflow menu icon and pulse composer refocus - Apple overflow menu: drop the gear shortcut shown when only settings is visible; always render the previous horizontal-ellipsis menu. - FocusComposer toggles composer_autofocus so every request emits an autofocus prop edge (the flag could already read true while the field was unfocused, producing no diff and no refocus). * bump lui pin for autofocus edge + flutter semantics fixes * bump lui pin for hoisted toolbar identifier * retrigger e2e (launcher ANR + cognito webview flakes on previous run) * bump lui pin + lockfile for per-frame semantics refresh * pin lui to merged main (d2b3b07) * merge fixup: Package.resolved -> lui d2b3b07, restore ocaml-signal b9cb81f
1 parent b797eb6 commit ce99f0f

10 files changed

Lines changed: 47 additions & 40 deletions

File tree

‎apple/Package.resolved‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎apple/Package.swift‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ let package = Package(
3434
.library(name: "LogseqChatModel", type: .dynamic, targets: ["LogseqChatModel"]),
3535
],
3636
dependencies: [
37-
.package(url: "ssh://git@github.com/logseq/lui.git", revision: "5c8ee0bf82fde5257bfbe70562c8649a13c56c59"),
37+
.package(url: "ssh://git@github.com/logseq/lui.git", revision: "d2b3b07"),
3838
.package(url: "https://github.com/gonzalezreal/swiftui-math", from: "0.1.0"),
3939
.package(url: "https://github.com/appstefan/highlightswift.git", from: "1.1.0")
4040
],

‎apple/Sources/LogseqChat/LGChatOverflowMenuExtension.swift‎

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -34,27 +34,7 @@ private struct LGChatOverflowMenu: View {
3434
let context: LUIAppleExtensionViewContext
3535

3636
var body: some View {
37-
if settingsVisible && !pageActionsVisible {
38-
Button {
39-
emit("settings")
40-
} label: {
41-
ZStack {
42-
Circle()
43-
.stroke(lineWidth: 2)
44-
Image(systemName: "gearshape")
45-
.resizable()
46-
.scaledToFit()
47-
.frame(width: 16, height: 16)
48-
}
49-
.frame(width: 24, height: 24)
50-
}
51-
.frame(width: 44, height: 44)
52-
.foregroundStyle(.primary)
53-
.accessibilityLabel(Text("Settings", bundle: .module))
54-
.accessibilityIdentifier("button.connection")
55-
} else {
56-
menuBody
57-
}
37+
menuBody
5838
}
5939

6040
private var menuBody: some View {

‎flutter/pubspec.lock‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,8 @@ packages:
159159
dependency: "direct main"
160160
description:
161161
path: "platform/flutter"
162-
ref: 5c8ee0bf82fde5257bfbe70562c8649a13c56c59
163-
resolved-ref: 5c8ee0bf82fde5257bfbe70562c8649a13c56c59
162+
ref: d2b3b0739bf047a1df5d22d3f316a45e430a68bd
163+
resolved-ref: d2b3b0739bf047a1df5d22d3f316a45e430a68bd
164164
url: "ssh://git@github.com/logseq/lui.git"
165165
source: git
166166
version: "0.1.0"

‎flutter/pubspec.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ dependencies:
1515
lui_flutter_backend:
1616
git:
1717
url: ssh://git@github.com/logseq/lui.git
18-
ref: 5c8ee0bf82fde5257bfbe70562c8649a13c56c59
18+
ref: d2b3b0739bf047a1df5d22d3f316a45e430a68bd
1919
path: platform/flutter
2020
webview_flutter: ^4.14.1
2121

‎logseq_chat.opam‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ pin-depends: [
3131
["melange-transit-core.0.1.2" "git+https://github.com/logseq/melange-transit.git#main"]
3232
["melange-transit-native.0.1.2" "git+https://github.com/logseq/melange-transit.git#main"]
3333
["melange-transit-melange.0.1.2" "git+https://github.com/logseq/melange-transit.git#main"]
34-
["lui.0.1.0" "git+ssh://git@github.com/logseq/lui.git#5c8ee0bf82fde5257bfbe70562c8649a13c56c59"]
34+
["lui.0.1.0" "git+ssh://git@github.com/logseq/lui.git#d2b3b07"]
3535
["drive.dev" "git+https://github.com/logseq/drive.git#7f407b07f18e68596cb0dcb3ba1781cb0572a2bb"]
3636
["ocaml-signal.0.1.0" "git+https://github.com/logseq/ocaml-signal.git#b9cb81fc910519fc579a90960267acb851483bca"]
3737
["mldoc.dev" "git+https://github.com/logseq/mldoc.git#553dea6ed8694352527a189747f787365469c9cb"]

‎shared/src/logseq_chat/model.ml‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1770,7 +1770,11 @@ let rec update (current : chat_model) action =
17701770
enqueue_close_search_effects closed path
17711771
| ExpandComposer ->
17721772
{ current with composer_expanded = true; composer_autofocus = true }
1773-
| FocusComposer -> { current with composer_autofocus = true }
1773+
| FocusComposer ->
1774+
(* autofocus is an edge-triggered focus request: toggling guarantees a
1775+
prop diff (and therefore a refocus edge) even when the flag already
1776+
reads true while the field is unfocused *)
1777+
{ current with composer_autofocus = not current.composer_autofocus }
17741778
| ApplyComposerDraft draft -> { current with composer_draft = draft }
17751779
| ChangeComposerDraft draft ->
17761780
let updated =

‎shared/src/logseq_chat/view_composer.ml‎

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
open Lui_protocol
22
open Lui_elements
33

4+
let with_press handler (elem : t) : t =
5+
fun context parent ->
6+
let node = elem context parent in
7+
enable context node PressEnabled;
8+
register_press context node handler;
9+
node
10+
411
let attachment_menu send : t =
512
context_menu
613
[
@@ -213,23 +220,24 @@ let composer_view (context : Lui_ui.ui_context) model_source send : t =
213220
if_
214221
~test:(Signal.map View_base.composer_expanded_ model_source)
215222
(View_base.with_liquid_glass "rounded-rectangle"
216-
(column ~grow:1.0 ~main:`end_ ~gap:0
217-
~padding_horizontal:
218-
(if Lui_ui.host context = FlutterHost then 12 else 16)
219-
~padding_vertical:
220-
(if Lui_ui.host context = FlutterHost then 12 else 8)
221-
~background:
222-
(if Lui_ui.host context = FlutterHost then
223-
"surface-container-high"
224-
else "glass-fallback")
225-
~corner_radius:24
223+
(with_press (press send Model.FocusComposer)
224+
(column ~grow:1.0 ~main:`end_ ~gap:0
225+
~padding_horizontal:
226+
(if Lui_ui.host context = FlutterHost then 12 else 16)
227+
~padding_vertical:
228+
(if Lui_ui.host context = FlutterHost then 12 else 8)
229+
~background:
230+
(if Lui_ui.host context = FlutterHost then
231+
"surface-container-high"
232+
else "glass-fallback")
233+
~corner_radius:24
226234
[
227235
box ~height:6 ~accessibility_identifier:"spacer.composer.top"
228236
[];
229237
if_
230238
~test:(Signal.map View_base.composer_assets_present_
231239
model_source)
232-
(scroll ~height:140
240+
(scroll ~orientation:`horizontal ~height:140
233241
[
234242
row ~gap:8
235243
[
@@ -287,7 +295,7 @@ let composer_view (context : Lui_ui.ui_context) model_source send : t =
287295
(reactive View_base.composer_send_disabled_ model_source)
288296
send;
289297
];
290-
]));
298+
])));
291299
if_
292300
~test:(Signal.map View_base.composer_collapsed_ model_source)
293301
(collapsed_composer_button context send);

‎shared/src/logseq_chat/view_screens.ml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,7 @@ let main_header_leading (context : Lui_ui.ui_context) model_source send :
494494
(Signal.map View_base.primary_sidebar_button_visible_
495495
model_source)
496496
(button ~icon:(`app "sidebar-toggle") ~variant:`ghost ~size:`icon
497+
~width:44 ~height:44
497498
~label:"Open sidebar"
498499
~accessibility_identifier:"button.sidebar"
499500
~disabled_signal:

‎shared/test/logseq_chat/app_test.ml‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4729,6 +4729,19 @@ let composer_draft_restore_focus_and_dismissal_are_owned_by_lg () =
47294729
check_eq ~msg:"dismissal keeps the persisted capture text"
47304730
dismissed.composer_draft "Later"
47314731

4732+
let composer_refocus_always_emits_an_autofocus_edge () =
4733+
let expanded =
4734+
Model.update (Model.initial ()) Model.ExpandComposer
4735+
in
4736+
(* the armed flag reads true but the host field may be unfocused; every
4737+
FocusComposer must still flip the prop so the edge reaches the host *)
4738+
let first = Model.update expanded Model.FocusComposer in
4739+
let second = Model.update first Model.FocusComposer in
4740+
check ~msg:"expanding arms the autofocus edge" expanded.composer_autofocus;
4741+
check ~msg:"a refocus request while armed flips the flag"
4742+
(not first.composer_autofocus);
4743+
check ~msg:"the next refocus request flips it back" second.composer_autofocus
4744+
47324745
let composer_renders_autofocus_and_native_outside_dismissal () =
47334746
let application = App.create (ios_backend ()) in
47344747
start application;
@@ -8602,6 +8615,7 @@ let cases =
86028615
case "hide-keyboard-optimistically-finishes-outliner-editing" hide_keyboard_optimistically_finishes_outliner_editing;
86038616
case "outliner-return-handoff-retains-one-native-editor-node" outliner_return_handoff_retains_one_native_editor_node;
86048617
case "composer-draft-restore-focus-and-dismissal-are-owned-by-lg" composer_draft_restore_focus_and_dismissal_are_owned_by_lg;
8618+
case "composer-refocus-always-emits-an-autofocus-edge" composer_refocus_always_emits_an_autofocus_edge;
86058619
case "composer-renders-autofocus-and-native-outside-dismissal" composer_renders_autofocus_and_native_outside_dismissal;
86068620
case "flutter-composer-uses-a-tonal-material-dock" flutter_composer_uses_a_tonal_material_dock;
86078621
case "flutter-sidebar-uses-compact-material-drawer-metrics" flutter_sidebar_uses_compact_material_drawer_metrics;

0 commit comments

Comments
 (0)