Commit Graph

23298 Commits

Author SHA1 Message Date
Tienson Qin
174cdfd865 feat: recycle 2026-03-18 06:11:04 +08:00
Tienson Qin
dc829be3f1 fix: lint 2026-03-18 06:11:04 +08:00
Tienson Qin
071677859d refactor(sync): simplify remote sync flow 2026-03-18 06:11:04 +08:00
Rustum Zia
5fe47fb69f fix(left_sidebar): don't activate resizer when sidebar is closed (#12455) 2026-03-17 13:43:09 +08:00
Tienson Qin
b27272828d code cleanup round 2 2026-03-17 00:07:33 +08:00
Tienson Qin
db6fee669a sync client code cleanup 2026-03-17 00:07:33 +08:00
Tienson Qin
917309113f feat: sync checksum 2026-03-17 00:07:33 +08:00
Tienson Qin
6183ba2375 fix(rtc): recover legacy rebased tx tempids 2026-03-17 00:07:33 +08:00
Tienson Qin
33098113ee enhance: returns rejected tx 2026-03-17 00:07:33 +08:00
Tienson Qin
e3366e8e07 enhance(rtc): preserve rebased tx boundaries 2026-03-17 00:07:33 +08:00
Tienson Qin
071d922442 fix: sync tests 2026-03-17 00:07:33 +08:00
Tienson Qin
68476aee3e refactor(outliner): batch ops via temp conn 2026-03-17 00:07:33 +08:00
Tienson Qin
42fec8324e simplify sync by applied txs sequentially 2026-03-17 00:07:33 +08:00
Tienson Qin
b8d7483a81 add scripts to manage graphs 2026-03-17 00:07:33 +08:00
charlie
f023071ac3 fix(ui): improve dropdown menu for the choices values 2026-03-14 15:44:46 +08:00
Tienson Qin
01c1a498cd fix: uploaded graph not ready 2026-03-14 10:11:34 +08:00
scheinriese
e8bddda236 fix(shortcut): limit prefix-conflict detection to same-handler only
Cross-handler prefix overlaps don't cause chord dormancy because each
Closure KeyboardShortcutHandler instance has its own independent key
tree and state machine. Only same-handler prefix conflicts (where
Closure's tree can't have a node be both leaf and branch) cause
actual chord dormancy.

- Change binding-match? to use same-handler? instead of handler-match?
  for prefix overlaps (exact matches still use handler-match?)
- Update test to verify cross-handler prefixes are NOT detected

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 21:10:35 +08:00
Tienson Qin
32d5aaf29d fix: don't show upload-temp graph 2026-03-13 21:00:57 +08:00
Tienson Qin
6a019909cb Merge pull request #12447 from logseq/enhance/shortcut-redesign
enhance(ux): redesign shortcut component and keymap settings page
2026-03-13 20:59:57 +08:00
Tienson Qin
33b2bc0c14 chore: remove unused dict 2026-03-13 20:59:00 +08:00
Tienson Qin
3f6788410a fix: lint 2026-03-13 20:58:36 +08:00
Tienson Qin
088b7be0b0 adjust keymap space 2026-03-13 20:45:58 +08:00
scheinriese
a3471e0406 refactor(shortcut): defer prefix-conflict banner to post-reassign state
Show the amber "Deactivates" banner only after the user confirms
Reassign, not alongside the red "Used by" prompt. Reduces visual
noise during the decision step and shows consequences after the action.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 20:45:58 +08:00
scheinriese
22a165472a feat(shortcut): inline compact keycaps in prefix-conflict banners
Show chord keycaps alongside action names in the amber "Deactivates"
banner so users can see both the chord pattern and what it does.

- n=1: inline keycap + quoted name
- n=2-3: vertical list with keycap + name per row
- n≥4: count-only fallback
- Proportional auto-fade: 6s/8s/10s based on item count
- Chord strokes visually grouped with 6px gap between strokes
- Compact keycaps tinted amber-12 inside warning banners

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 20:45:58 +08:00
scheinriese
1cd7cad8ae feat(shortcut): tiered prefix-conflict banners and cross-handler detection
Prefix conflicts (chord shortcuts that go dormant when a simple key
shadows their leading stroke) are now shown as amber warnings instead
of red blocking errors.  Exact-match conflicts remain red with
Reassign.

Key changes:
- Extend binding-match? from same-handler? to handler-match? so
  cross-handler prefix overlaps between co-active handlers are detected
- Add partition-conflicts-by-type and conflict-has-exact? helpers in
  data_helper to split conflicts into exact vs prefix sub-maps
- Three-way debounce in shortcut dialog: exact → red blocking,
  prefix-only → amber auto-save with undo, mixed → stacked banners
- Widen Closure error catch to handle both chord-prefix conflict
  directions ("shortcut: null" and "shortcut: <id>")
- Add CSS color override for undo link inside amber warning banner
- Add i18n keys: deactivates-chord, deactivates-chords
- Add tests for partition-conflicts-by-type and cross-handler detection

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 20:45:58 +08:00
Tienson Qin
b3c9f75eec fix(shortcut): handle prefix conflicts and disabled edits
Cover the three regression cases from review.

- block same-handler leader/chord prefix collisions in keymap conflict detection so bindings like mod+c cannot silently leave mod+c mod+s or mod+c mod+c dormant at runtime
- collapse canonical-equivalent bindings back to default when saving so recorded meta/cmd variants do not linger as redundant custom overrides
- allow disabled shortcut rows to reopen the customize dialog and normalize false defaults into editable empty bindings
- add focused regression tests for conflict detection and shortcut persistence/editability
2026-03-13 20:45:58 +08:00
Tienson Qin
4956f6aef6 wrong comments
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-03-13 20:45:58 +08:00
scheinriese
57adfb144a Assorted code quality cleanups
- Remove unused clojure.string require in core_test.cljs
- Replace promesa.core p/delay with js/setTimeout, remove import
- Remove redundant final-result binding in print-shortcut-key
- Flatten nested if chain to cond for raw-binding
- Fix nested button inside button (keystroke-active → div)
- Remove dead .cp__shortcut-table-wrap CSS
- Align global-handlers set in get-cross-context-conflicts

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 20:45:58 +08:00
scheinriese
6502bb53f6 Suppress shortcut-row-sweep animation for prefers-reduced-motion
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 20:45:58 +08:00
scheinriese
e7eb6f3241 Add role and aria-expanded to category header toggles in keymap list
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 20:45:58 +08:00
scheinriese
01f9904062 Fix conflict detection between block-editing and editor-global handlers
block-editing-only was missing from the global-handlers set in
get-conflicts-by-keys, so conflicts between block-editing-only and
editor-global shortcuts (e.g. assigning ⌘X to Create new block vs Cut)
showed as amber warnings instead of red blocking conflicts. Also remove
dead chord-prefix code from same-leading-key? and add a comment about
the brittle Closure error string match for chord-prefix detection.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 20:45:58 +08:00
scheinriese
aaa7b566ad Remove console debug block in favor of existing log/error call
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 20:45:58 +08:00
scheinriese
4fa8b43c84 Extract max-key-sequence-length constant for magic number 5
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 20:45:58 +08:00
scheinriese
8d62b4d6bc Use cond-> for container-attrs in shortcut badge components
Replace chained if/assoc rebindings with idiomatic cond-> in
combo-keys, separate-keys, and compact-keys.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 20:45:58 +08:00
scheinriese
e02810f983 Show readable PgUp/PgDn labels in shortcut kbd badges
The page-up and page-down keys were mapped to Private Use Area Unicode
characters (U+F571, U+F572) that don't exist in any font loaded by the
kbd elements, rendering as invisible/empty badges.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 20:45:58 +08:00
scheinriese
3aa5a36d4a Fix tab order accessibility in keymap settings list
Make the shortcut list a single tab stop (<ul> tabindex=0) with arrow
key navigation between rows (tabindex=-1). This eliminates ~583 tab
stops while preserving full keyboard access. Also fix focus restoration
after closing the recording popup by disabling the popup infrastructure's
competing focus logic (focus-trigger? false, onCloseAutoFocus preventDefault)
and using focusVisible:true for visible focus rings on programmatic focus.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 20:45:58 +08:00
scheinriese
b076ce9fc0 Make kbd top inset glow transparent in light mode for better vertical centering
The white-on-white highlight was invisible yet shifted perceived letter
center downward. Variable is preserved so custom themes can still set it.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 20:45:58 +08:00
scheinriese
bf7ebc8d7e Add gradient fade to keymap header when section headers are absent
Uses :has(.th) to detect when category section headers are in the DOM.
When searching/filtering removes them, the header's bottom padding fades
to transparent so list items scroll away smoothly instead of a hard cutoff.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 20:45:58 +08:00
scheinriese
6cfbaf93d1 Add spacing and fix vertical alignment for sidebar shortcut badges
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 20:45:58 +08:00
scheinriese
19c878cba0 Fix Option key recording and show ⌥ symbol on macOS
On macOS, Option+key combos in the shortcut recording dialog were
silently dropped because Google Closure's KeyHandler corrupts the
keyCode (merging keydown/keypress produces Unicode charCodes like ç
instead of the base key). Fall back to the native KeyboardEvent.code
property when the primary key-names lookup fails and a modifier is
held — works cross-platform (also helps AltGr on Windows).

Also replace "Opt" text with the standard ⌥ symbol in shortcut badges,
matching ⌘ and ⇧, and update all round-trip paths (decorate, undecorate,
canonicalize, normalize) to handle the new symbol.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 20:45:58 +08:00
scheinriese
e8542d3028 Fix chord-prefix shortcuts not being stripped during keymap reassign
Chord-prefix overlaps (e.g., CMD+C vs CMD+C CMD+C) are no longer
treated as blocking conflicts in the keymap UI. Previously, assigning
CMD+C to an action would flag chord shortcuts like "Clear Sidebar"
(CMD+C CMD+C) as equal conflicts and strip them on Reassign — with no
way to restore them since the recording UI can't record chords.

Now only exact key matches are blocking. Chord shortcuts stay in config
and become dormant if they share a handler with a conflicting simple
key; they auto-restore when the conflict is removed. Registration
errors for expected chord-prefix tree clashes are downgraded from
console.group+error to log/debug.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 20:45:58 +08:00
scheinriese
00e2a91f25 Refine key press animation with theme-aware glow and brightness filter
- Replace hardcoded rgba shadow colors with --kbd-glow-top/--kbd-glow-bottom
  CSS variables, tuned per theme (light: stronger top highlight, dark: deeper
  bottom shadow)
- Use filter: brightness(0.92) for pressed state instead of manipulating
  box-shadow layers with outer drop shadows — theme-agnostic and physically
  correct (depressed key = in shadow = darker)
- Keep top inset highlight shift (1px → 2px) and bottom inset compression
  (1px → 0.5px) for realistic keycap depression alongside brightness
- Fix bottom clipping on press: change .action-wrap overflow from hidden
  to visible so translateY(1px) doesn't get chopped
- Remove non-glow pressed shadow rules (brightness handles all cases)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 20:45:58 +08:00
scheinriese
4dcdbcc44c Replace flat row flash with accent shimmer sweep and fix combo key press animation
- Row highlight on shortcut trigger now uses a horizontal gradient sweep
  (background-position animation) instead of a static background flash,
  providing a distinct visual language from the focus ring
- Shimmer uses theme-aware accent color via color-mix on keymap page,
  with a neutral fallback in shui.css base styles
- Guard against animation spam: clearTimeout+reset pattern prevents
  stale timeout accumulation during rapid key repeat; reflow only
  forced on first trigger, class stays applied until last trigger ends
- Fix combo key press animation: animate the container (the keycap)
  instead of individual kbd elements, so translateY and box-shadow
  follow the container's border-radius correctly
- Scope row shimmer to .shui-shortcut-row/.shortcut-row elements
  to prevent accidental shimmer on standalone badge containers
- Respect prefers-reduced-motion for all new animations

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 20:45:58 +08:00
scheinriese
e45fb29061 Add arrow key navigation and focus management to keymap settings list
Enable ArrowUp/Down/Home/End keyboard navigation through shortcut rows
and category headers. Add focus-visible ring styling, exclude focused
rows from hover dimming, fix popover close focus restoration to target
the <li> element, and rescue focus to the category header when folding
removes the focused row from DOM.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 20:45:58 +08:00
scheinriese
814acd49fd Normalize undo bindings to prevent false Custom classification
When undoing a Reassign, execute-undo! now checks if the restored
binding matches the default via matches-default-binding? and persists
nil instead of the raw vector, clearing the user override.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 20:45:58 +08:00
scheinriese
a1345f2311 Replace raw Cmd+Enter hint in tag popover with shui shortcut component
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 20:45:58 +08:00
scheinriese
befe49275c Deduplicate binding resolution in ui.cljs and polish keymap UX
Replace hand-rolled binding resolution in dropdown-shortcut and
keyboard-shortcut-from-config with calls to dh/shortcut-binding,
removing direct dependency on shortcut-config/all-built-in-keyboard-shortcuts
and state/custom-shortcuts. Remove unused shortcut-config require.

Return focus to trigger button when filter popover closes, matching
the pattern already used by the customize popover.

Add min-width to active keystroke filter button to prevent width
jitter when toggling between label and key-badge states.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 20:45:58 +08:00
scheinriese
33dcefaa06 Decompose customize dialog, fix reset conflict race, and auto-close popup
Extract key handler and conflict resolution logic from the ~390-line
customize-shortcut-dialog-inner into testable top-level defn- functions:
- customize-key-handler: key event state machine (~70 lines)
- compute-override-plan: pure conflict resolution for reassign
- compute-reset-plan: pure conflict resolution for reset-to-default
- matches-default-binding?: canonical default-binding comparison

Add persist-user-shortcuts-batch! to core.cljs to atomically persist
multiple binding changes in a single config read-modify-write cycle,
fixing a race condition where sequential persist-user-shortcut! calls
clobbered each other (config-handler/set-config! updates state async
via save-file! promise chain, so the second call reads stale data).

Fix reset-fn! to strip conflicting bindings before restoring defaults,
preventing error notifications from goog.ui.KeyboardShortcutHandler
duplicate key registration. Auto-close the customize popup 300ms after
reset so it doesn't float over a now-empty filtered list.

Clear user overrides (persist nil) when conflict stripping leaves a
binding that matches the action's default, so actions correctly
disappear from the "Custom" filter tab.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 20:45:58 +08:00
scheinriese
8088b6f3f8 Fix focus loss in customize popover after Reassign and other state transitions
When the Reassign button (or any focused element inside the feedback
banner) was removed from the DOM during a rec-state transition, browser
focus fell to document.body. The popover's scoped KeyHandler only
receives events that traverse its DOM subtree, so it went deaf to
subsequent keypresses — the user saw row flash animations instead of
conflict detection.

Two fixes:
1. Add a use-effect that re-focuses the popover element whenever
   rec-state changes and focus has drifted outside the popover.
2. After refresh! reinstalls global shortcut handlers, re-suppress
   them if a scoped key handler is still active (refcount > 0),
   preventing the 50ms window where global handlers could intercept
   keypresses meant for the popover.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 20:45:58 +08:00
scheinriese
ed0d6f0142 Address pr-review findings: accessibility, dead code, and consistency fixes
- Add ARIA live regions to feedback banners (role=alert/status)
- Add role=dialog and aria-label to customize popover
- Add aria-pressed to filter pill buttons
- Remove disabled rows from tab order
- Return focus to trigger on popover close
- Add shortcut-badge-in to prefers-reduced-motion
- Remove dead shortcut-conflicts-display component
- Replace js/console.warn with lambdaisland.glogi
- Merge duplicate cond branches in key handler
- Add missing :shortcut-id to left sidebar

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 20:45:58 +08:00