Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
feat[mobile]: improve mobile dock (#1863)
Peter Chinman8882002ad395
diff --git a/js/app/packages/app/component/Layout.tsx b/js/app/packages/app/component/Layout.tsxindex 666e7920b2..e55384ea0c 100644--- a/js/app/packages/app/component/Layout.tsx+++ b/js/app/packages/app/component/Layout.tsx@@ -29,6 +29,8 @@ import {type SidebarState,} from '@app/component/app-sidebar/sidebar';import { isMobile } from '@core/mobile/isMobile';+import { MobileDock } from './mobile/MobileDock';+import { MobileSearchOuter } from './mobile/MobileSearch';const AUTH_URLS = [`${ROUTER_BASE_CONCAT}login`,@@ -101,9 +103,11 @@ export function Layout(props: RouteSectionProps) {<Suspense><Show when={isAuthenticated()}><GlobalShortcuts />- <Suspense>- <CommandMenu />- </Suspense>+ <Show when={!isMobile()}>+ <Suspense>+ <CommandMenu />+ </Suspense>+ </Show><Suspense><PropertyEditorModal /></Suspense>@@ -153,6 +157,12 @@ export function Layout(props: RouteSectionProps) {</ItemDndProvider></Resize.Zone></div>+ <Show when={isMobile() && !virtualKeyboardVisible()}>+ <MobileDock />+ </Show>+ <Show when={isMobile()}>+ <MobileSearchOuter />+ </Show><Suspense><Showwhen={isAuthenticated() && !AUTH_URLS.includes(location.pathname)}diff --git a/js/app/packages/app/component/command/CommandItem.tsx b/js/app/packages/app/component/command/CommandItem.tsxindex ea1926c34a..d9198e343b 100644--- a/js/app/packages/app/component/command/CommandItem.tsx+++ b/js/app/packages/app/component/command/CommandItem.tsx@@ -16,7 +16,7 @@ export interface CommandItemProps {index: number;selected: boolean;onSelect: (item: CommandMenuItem, openInNewSplit: boolean) => void;- onHover: (index: number) => void;+ onHover?: (index: number) => void;}function CommandItemHotkey(props: { item: CommandMenuItem }) {@@ -105,7 +105,7 @@ export function CommandItem(props: CommandItemProps) {'hover:bg-hover/30': !props.selected,})}- onMouseMove={() => props.onHover(props.index)}+ onMouseMove={() => props.onHover?.(props.index)}onClick={(e) => {e.preventDefault();e.stopPropagation();diff --git a/js/app/packages/app/component/command/CommandMenu.tsx b/js/app/packages/app/component/command/CommandMenu.tsxindex 5f983de263..a32d63d889 100644--- a/js/app/packages/app/component/command/CommandMenu.tsx+++ b/js/app/packages/app/component/command/CommandMenu.tsx@@ -52,7 +52,7 @@ const VIRTUAL_ITEM_HEIGHT = 40; // tailwind h-10const MAX_LIST_HEIGHT = VIRTUAL_ITEM_HEIGHT * 8;const EMPTY_STATE_HEIGHT = VIRTUAL_ITEM_HEIGHT * 1.5;-function getBlockNameForEntity(+export function getBlockNameForEntity(item: CommandMenuItem): BlockName | BlockAlias | undefined {if (isEntityItem(item)) {diff --git a/js/app/packages/app/component/mobile/MobileDock.css b/js/app/packages/app/component/mobile/MobileDock.cssnew file mode 100644index 0000000000..0b707ba374--- /dev/null+++ b/js/app/packages/app/component/mobile/MobileDock.css@@ -0,0 +1,22 @@+@keyframes morePopoverShow {+ from {+ transform: translateY(100%);+ }+ to {+ transform: translateY(0);+ }+}+@keyframes morePopoverHide {+ from {+ transform: translateY(0);+ }+ to {+ transform: translateY(100%);+ }+}+.more-popover-content {+ animation: morePopoverHide 100ms ease-in forwards;+}+.more-popover-content[data-expanded] {+ animation: morePopoverShow 100ms ease-out;+}diff --git a/js/app/packages/app/component/mobile/MobileDock.tsx b/js/app/packages/app/component/mobile/MobileDock.tsxindex 42dbf32c8f..e902e7a17e 100644--- a/js/app/packages/app/component/mobile/MobileDock.tsx+++ b/js/app/packages/app/component/mobile/MobileDock.tsx@@ -1,126 +1,259 @@-import WideChannel from '@macro-icons/wide/channel.svg';-import SignalIcon from '@macro-icons/wide/signal.svg';-import WideFolder from '@macro-icons/wide/folder.svg';-import WidePlus from '@macro-icons/wide/plus.svg';-import WideTask from '@macro-icons/wide/task.svg';+import './MobileDock.css';+import ChevronUpIcon from '@icon/regular/caret-up.svg?component-solid';+import { AnimatedInboxIcon } from '@macro-icons/wide/animating/inbox';+import { AnimatedSearchIcon } from '@macro-icons/wide/animating/search';+import { AnimatedPlusIcon } from '@macro-icons/wide/animating/plus';+import { AnimatedChannelIcon } from '@macro-icons/wide/animating/channel';+import { AnimatedFolderIcon } from '@macro-icons/wide/animating/folder';+import { AnimatedSlidersHorizontalIcon } from '@macro-icons/wide/animating/sliders-horizontal';import { impactFeedback } from '@tauri-apps/plugin-haptics';-import type { Component, JSX } from 'solid-js';+import { type Component, createSignal, For, type JSX } from 'solid-js';+import { Dynamic } from 'solid-js/web';+import { Popover } from '@kobalte/core/popover';import { cn } from '@ui/utils/classname';+import { useSplitLayout } from '../split-layout/layout';+import { SIDEBAR_LINKS } from '../app-sidebar/sidebar';+import { type ListView, isListViewID } from '@app/constants/list-views';+import { globalSplitManager } from '@app/signal/splitLayout';+import { SearchState } from './mobileSearchState';+import { useSettingsState } from '@core/constant/SettingsState';import { setCreateMenuOpen } from '../Launcher';-import { useSplitPanelOrThrow } from '../split-layout/layoutUtils';-import { useSoup } from '@app/component/next-soup/soup-context';+import { useLocation } from '@solidjs/router';++const ICON_ANIMATION_DURATION_MS = 500;type MobileDockButtonProps = {- icon: Component<JSX.SvgSVGAttributes<SVGSVGElement>>;+ icon: Component<+ JSX.SvgSVGAttributes<SVGSVGElement> | { triggerAnimation?: boolean }+ >;label: string;onClick: () => void;active?: boolean;+ ref?: HTMLButtonElement | ((el: HTMLButtonElement) => void);+ onTouchMove?: (e: TouchEvent) => void;+ onTouchEnd?: (e: TouchEvent) => void;+ iconClass?: string;};function MobileDockButton(props: MobileDockButtonProps) {+ const [animating, setAnimating] = createSignal(false);+return (<buttontype="button"- onClick={() => {+ ref={props.ref}+ onPointerDown={() => {impactFeedback('light');+ setAnimating(true);+ setTimeout(() => setAnimating(false), ICON_ANIMATION_DURATION_MS);props.onClick();}}+ onTouchMove={props.onTouchMove}+ onTouchEnd={props.onTouchEnd}class={cn(- 'flex flex-col items-center justify-center w-[20%] pt-3',+ 'flex flex-col items-center justify-center w-[20%] pt-3 bg-page border-t border-edge-muted',props.active && 'text-accent')}>- <props.icon class="w-6 h-6" />+ <div class={cn('w-6 h-6 [&_svg]:size-6', props.iconClass)}>+ <Dynamic component={props.icon} triggerAnimation={animating()} />+ </div><span class="text-xs">{props.label}</span></button>);}-export function MobileDock() {- const splitContext = useSplitPanelOrThrow();- const soup = useSoup();-- const splitContent = () => splitContext.handle.content();+const PRIMARY_IDS = ['inbox', 'channels', 'files'] as const;- const splitIsUnifiedList = () => {- const id = splitContent().id;- const type = splitContent().type;+const MORE_VIEWS = SIDEBAR_LINKS.filter(+ (l) => !(PRIMARY_IDS as readonly string[]).includes(l.id)+).reverse();- return type === 'component' && id === 'unified-list';- };+function MorePopover(props: {+ active: boolean;+ isActive: (id: ListView) => boolean;+ onNavigate: (id: ListView) => void;+}) {+ const { toggleSettings } = useSettingsState();+ const [open, setOpen] = createSignal(false);+ const [anchorRef, setAnchorRef] = createSignal<HTMLElement>();+ const [hoveredId, setHoveredId] = createSignal<string | null>(null);- const ensureUnifiedList = () => {- if (splitIsUnifiedList()) return;- splitContext.handle.replace({- next: { type: 'component', id: 'unified-list' },- });+ const handleTouchMove = (e: TouchEvent) => {+ if (!open()) return;+ const touch = e.touches[0];+ const el = document.elementFromPoint(touch.clientX, touch.clientY);+ const button = el?.closest('[data-more-item]') as HTMLElement | null;+ const id = button?.dataset.moreItem ?? null;+ if (id !== hoveredId()) {+ setHoveredId(id);+ if (id) impactFeedback('light');+ }};- const isInboxActive = () =>- soup.filters.isActive('signal') && splitIsUnifiedList();- const isPeopleTeamsActive = () =>- soup.filters.isActive('channels') && splitIsUnifiedList();- const isTasksActive = () =>- soup.filters.isActive('task') && splitIsUnifiedList();- const isAllActive = () =>- !isInboxActive() &&- !isPeopleTeamsActive() &&- !isTasksActive() &&- splitIsUnifiedList();-- const setSignalFilter = (value: boolean) => {- // If we're going to be removing the signal filter,- // we should replace it with the explicit-noise filter- if (!value) {- soup.filters.set({ and: ['explicit-noise'] });- } else {- soup.filters.set({ and: ['signal', 'not-done'] });+ const handleTouchEnd = () => {+ const id = hoveredId();+ setHoveredId(null);+ if (id === 'settings') {+ toggleSettings();+ setOpen(false);+ } else if (id === 'create') {+ setCreateMenuOpen(true);+ setOpen(false);+ } else if (isListViewID(id)) {+ props.onNavigate(id);+ setOpen(false);}};return (- <div class="flex flex-row justify-between bg-page border-t border-edge-muted">+ <><MobileDockButton- icon={WideFolder}- label="All"- active={isAllActive()}- onClick={() => {- ensureUnifiedList();- soup.filters.clear();- }}+ icon={ChevronUpIcon}+ label="More"+ active={props.active}+ onClick={() => setOpen((prev) => !prev)}+ ref={setAnchorRef}+ onTouchMove={handleTouchMove}+ onTouchEnd={handleTouchEnd}+ iconClass={cn(+ 'transition-transform duration-200 [perspective:200px]',+ open() && '[transform:rotateX(180deg)]'+ )}/>+ <Popover+ open={open()}+ onOpenChange={(isOpen) => {+ setOpen(isOpen);+ if (!isOpen) setHoveredId(null);+ }}+ placement="top"+ overflowPadding={10}+ anchorRef={anchorRef}+ >+ <Popover.Content class="more-popover-content -z-2 bg-page border-t border-l border-r border-edge-muted rounded-t-sm flex flex-col gap-1 w-[calc(100vw-20px)] shadow-lg">+ <button+ type="button"+ data-more-item="settings"+ class={cn(+ 'flex items-center gap-2 px-3 h-11 text-sm text-ink',+ hoveredId() === 'settings' ? 'bg-hover' : 'hover:bg-hover'+ )}+ onClick={() => {+ impactFeedback('light');+ toggleSettings();+ setOpen(false);+ }}+ >+ <div class="w-4 h-4 shrink-0 [&_svg]:size-4">+ <AnimatedSlidersHorizontalIcon+ triggerAnimation={hoveredId() === 'settings'}+ />+ </div>+ <span>Settings</span>+ </button>+ <button+ type="button"+ data-more-item="create"+ class={cn(+ 'flex items-center gap-2 px-3 h-11 text-sm text-ink border-b border-edge-muted',+ hoveredId() === 'create' ? 'bg-hover' : 'hover:bg-hover'+ )}+ onClick={() => {+ impactFeedback('light');+ setCreateMenuOpen(true);+ setOpen(false);+ }}+ >+ <div class="w-4 h-4 shrink-0 [&_svg]:size-4">+ <AnimatedPlusIcon triggerAnimation={hoveredId() === 'create'} />+ </div>+ <span>Create</span>+ </button>+ <For each={MORE_VIEWS}>+ {(item) => (+ <button+ type="button"+ data-more-item={item.id}+ class={cn(+ 'flex items-center gap-2 px-3 h-11 text-sm',+ props.isActive(item.id) ? 'text-accent' : 'text-ink',+ hoveredId() === item.id ? 'bg-hover' : 'hover:bg-hover'+ )}+ onClick={() => {+ impactFeedback('light');+ props.onNavigate(item.id);+ setOpen(false);+ }}+ >+ <div class="w-4 h-4 shrink-0 [&_svg]:size-4">+ <Dynamic+ component={item.icon}+ triggerAnimation={hoveredId() === item.id}+ />+ </div>+ <span>{item.label}</span>+ </button>+ )}+ </For>+ </Popover.Content>+ </Popover>+ </>+ );+}++export function MobileDock() {+ const { openWithSplit } = useSplitLayout();+ const layoutManager = globalSplitManager();++ const location = useLocation();++ const isActive = (id: ListView) => {+ const activeContent = layoutManager?.activeSplit()?.content();+ if (!activeContent) {+ return location.pathname.split('/').filter(Boolean).includes(id);+ }+ return activeContent?.id === id;+ };++ const isMoreActive = () => MORE_VIEWS.some((v) => isActive(v.id));++ const navigate = (id: ListView) => {+ openWithSplit({ type: 'component', id }, { mergeHistory: true });+ };++ return (+ <div class="relative z-mobile-nav-bar flex flex-row justify-between">+ <div class="-z-1 absolute left-0 top-0 right-0 w-screen h-40 bg-page" /><MobileDockButton- icon={SignalIcon}+ icon={AnimatedInboxIcon}label="Inbox"- active={isInboxActive()}- onClick={() => {- ensureUnifiedList();- setSignalFilter(true);- }}+ active={isActive('inbox')}+ onClick={() => navigate('inbox')}/><MobileDockButton- icon={WideChannel}- label="People"- active={isPeopleTeamsActive()}- onClick={() => {- ensureUnifiedList();- soup.filters.set({ and: ['explicit-noise', 'channels'] });- }}+ icon={AnimatedChannelIcon}+ label="Channels"+ active={isActive('channels')}+ onClick={() => navigate('channels')}/><MobileDockButton- icon={WideTask}- label="Tasks"- active={isTasksActive()}- onClick={() => {- ensureUnifiedList();- soup.filters.set({ and: ['explicit-noise', 'task'] });- }}+ icon={AnimatedFolderIcon}+ label="Files"+ active={isActive('files')}+ onClick={() => navigate('files')}+ />+ <MorePopover+ active={isMoreActive()}+ isActive={isActive}+ onNavigate={navigate}/><MobileDockButton- icon={WidePlus}- label="Create"+ icon={AnimatedSearchIcon}+ label="Search"onClick={() => {- setCreateMenuOpen(true);+ SearchState.maybeResetState();+ SearchState.open();}}/></div>diff --git a/js/app/packages/app/component/mobile/MobileSearch.tsx b/js/app/packages/app/component/mobile/MobileSearch.tsxnew file mode 100644index 0000000000..d1312b9eec--- /dev/null+++ b/js/app/packages/app/component/mobile/MobileSearch.tsx@@ -0,0 +1,459 @@+/** Mobile Search is based on Command Menu. */+import { getActiveCommandsFromScope } from '@core/hotkey/getCommands';+import { runCommand } from '@core/hotkey/utils';+import { Dialog } from '@kobalte/core/dialog';+import { Tabs } from '@kobalte/core/tabs';+import {+ createMemo,+ createSignal,+ For,+ Match,+ onCleanup,+ onMount,+ Show,+ Switch,+} from 'solid-js';+import { VList } from 'virtua/solid';+import { useSplitLayout } from '../split-layout/layout';+import { cn } from '@ui/utils/classname';+import Macro from '@macro-icons/macro-logo.svg';+import ArrowLeft from '@icon/regular/arrow-left.svg';+import SearchIcon from '@phosphor-icons/core/regular/magnifying-glass.svg?component-solid';+import { debouncedDependent } from '@core/util/debounce';+import { Entity, type WithSearch, type EntityData } from '@entity';+import { SearchContent } from '@entity/extractors-search/search-content';+import { itemToBlockName } from '@core/constant/allBlocks';+import { isMobile } from '@core/mobile/isMobile';+import { virtualKeyboardVisible } from '@core/mobile/virtualKeyboard';+import type { CategoryFilter } from '../command/types';+import {+ type CommandMenuItem,+ isCommandItem,+ isEntityItem,+ useCommandItems,+} from '../command/useCommandItems';+import { SearchState } from './mobileSearchState';+import { CommandItem } from '../command/CommandItem';+import { getBlockNameForEntity } from '../command/CommandMenu';+import { useFullTextSearch } from '@queries/soup/useFullTextSearch';+import { windowSearchMatch } from '@core/util/searchHighlight';+import { TailSpinner } from '@core/component/TailSpinner';+import { ScrollIndicators } from '@core/component/VerticalScrollIndicators';++const CATEGORIES: { id: CategoryFilter; label: string }[] = [+ { id: 'all', label: 'All' },+ { id: 'channels', label: 'Channels' },+ { id: 'dms', label: 'Dms' },+ { id: 'notes', label: 'Notes' },+ { id: 'tasks', label: 'Tasks' },+ { id: 'documents', label: 'Docs' },+ { id: 'chats', label: 'Chats' },+ { id: 'projects', label: 'Projects' },+ { id: 'commands', label: 'Commands' },+];++export function MobileSearchOuter() {+ return (+ <Dialog open={SearchState.isOpen()} onOpenChange={SearchState.setIsOpen}>+ <Dialog.Portal>+ <Dialog.Content+ class={cn(+ 'fixed inset-0 z-modal flex flex-col h-[calc(var(--dvh,1dvh)*100)] pt-[var(--safe-top)] pl-[var(--safe-left)] pr-[var(--safe-right)]',+ {+ 'pb-[var(--safe-bottom)]': !virtualKeyboardVisible(),+ }+ )}+ >+ <MobileSearchInner />+ </Dialog.Content>+ </Dialog.Portal>+ </Dialog>+ );+}++export function MobileSearchInner() {+ const { openWithSplit } = useSplitLayout();++ const query = debouncedDependent(SearchState.query, 60);++ const filteredItems = useCommandItems(query, SearchState.categoryFilter);+ const { results: fullTextResults, isLoading: isFullTextLoading } =+ useFullTextSearch(SearchState.query);++ function handleItemAction(item: CommandMenuItem, openInNewSplit = false) {+ if (!item) return;++ if (isCommandItem(item)) {+ const command = item.data;++ // Check if this is a multi-stage command+ if (command.activateCommandScopeId) {+ // Get commands from the nested scope+ const nestedCommands = getActiveCommandsFromScope(+ command.activateCommandScopeId,+ {+ sortByScopeLevel: false,+ hideShadowedCommands: false,+ hideCommandsWithoutHotkeys: false,+ limitToCurrentScope: true,+ }+ );+ SearchState.setQuery('');+ SearchState.setCommandScopeCommands(nestedCommands);+ return;+ }++ // Regular command - close and run+ SearchState.close();+ SearchState.setQuery('');+ runCommand(command);+ return;+ }++ // Handle entity items (documents, channels, chats, etc.)+ if (isEntityItem(item)) {+ const blockName = getBlockNameForEntity(item);+ if (blockName) {+ openWithSplit(+ { type: blockName, id: item.id },+ {+ referredFrom: 'kommand-menu',+ preferNewSplit: openInNewSplit,+ }+ );+ }+ SearchState.close();+ SearchState.setQuery('');+ return;+ }++ SearchState.close();+ SearchState.setQuery('');+ }++ function handleFullTextItemAction(+ entity: WithSearch<EntityData>,+ openInNewSplit = false+ ) {+ const blockName = itemToBlockName(entity);+ if (blockName) {+ openWithSplit(+ { type: blockName, id: entity.id },+ { referredFrom: 'kommand-menu', preferNewSplit: openInNewSplit }+ );+ }+ SearchState.onMenuClose();+ SearchState.close();+ }++ const isInCommandScope = createMemo(+ () => SearchState.commandScopeCommands().length > 0+ );++ const handleBackFromCommandScope = () => {+ SearchState.clearCommandScopeCommands();+ };++ // Show back button only in command scope (entity action mode just closes)+ const showBackButton = () => isInCommandScope() || isMobile();++ const handleBack = () => {+ if (isInCommandScope()) {+ handleBackFromCommandScope();+ } else {+ SearchState.close();+ }+ };++ return (+ <div class="flex flex-col h-full bg-panel">+ <Show when={!isInCommandScope() && !SearchState.isFullTextMode()}>+ <CategoryFilterTabs />+ </Show>++ <ResultsContainer+ nameMatchItems={filteredItems()}+ fullTextItems={fullTextResults()}+ onSelectNameMatch={(item, openInNewSplit) =>+ handleItemAction(item, openInNewSplit)+ }+ onSelectFullText={(entity, openInNewSplit) =>+ handleFullTextItemAction(entity, openInNewSplit)+ }+ isLoading={() => SearchState.isFullTextMode() && isFullTextLoading()}+ onFullTextSearch={() => SearchState.enableFullTextMode()}+ query={SearchState.query}+ />+ {/* Search Input */}+ <div class="flex items-center gap-2 bg-page px-2 border-t border-edge-muted">+ <Show+ when={showBackButton()}+ fallback={+ <span class="pl-2 text-accent">+ <Macro class="size-3" />+ </span>+ }+ >+ <button+ class="text-ink-muted flex flex-col items-center justify-center pl-2 pt-3"+ onClick={handleBack}+ title="Back (Esc)"+ >+ <ArrowLeft class="size-6" />+ <div class="text-xs text-transparent">Back</div>+ </button>+ </Show>+ <input+ ref={(el) => setTimeout(() => el.focus(), 50)} // setTimeout needed: iOS only allows focus() within the user gesture window+ type="text"+ class="flex-1 bg-transparent border-0 outline-none focus:outline-none ring-0 focus:ring-0 text-ink-muted placeholder:text-ink-placeholder/50"+ placeholder={'Search...'}+ value={SearchState.query()}+ onInput={(e) => SearchState.setQuery(e.currentTarget.value)}+ />+ </div>+ </div>+ );+}++function ResultsContainer(props: {+ nameMatchItems: CommandMenuItem[];+ fullTextItems: WithSearch<EntityData>[];+ onSelectNameMatch: (item: CommandMenuItem, openInNewSplit: boolean) => void;+ onSelectFullText: (+ entity: WithSearch<EntityData>,+ openInNewSplit: boolean+ ) => void;+ isLoading?: () => boolean;+ onFullTextSearch: () => void;+ query: () => string;+}) {+ let ref: HTMLDivElement | undefined;+ const [availableHeight, setAvailableHeight] = createSignal(0);++ onMount(() => {+ if (!ref) return;+ const observer = new ResizeObserver((entries) => {+ const entry = entries[0];+ if (entry) setAvailableHeight(entry.contentRect.height);+ });+ observer.observe(ref);+ onCleanup(() => observer.disconnect());+ });++ const [rowHeight, setRowHeight] = createSignal(0);+ const heightOfNameMatchList = () => props.nameMatchItems.length * rowHeight();+ const showFullTextSearchButton = () => {+ if (SearchState.isFullTextMode()) return false;+ // Always show when there are no name matches (rowHeight stays 0 since list isn't rendered)+ if (props.nameMatchItems.length === 0) return true;+ const rh = rowHeight();+ return rh > 0 && availableHeight() - heightOfNameMatchList() > rh;+ };++ return (+ <div class="flex-1 min-h-0 bg-panel" ref={ref}>+ <Switch>+ <Match when={props.isLoading?.()}>+ <div class="flex items-center gap-2 text-ink-muted h-10 px-2">+ <TailSpinner width={16} height={16} />+ Searching...+ </div>+ </Match>+ <Match+ when={+ SearchState.isFullTextMode() &&+ SearchState.query().trim().length < 3+ }+ >+ <div class="flex items-center gap-2 text-ink-muted h-10 px-2">+ At least 3 characters required for search.+ </div>+ </Match>+ <Match+ when={SearchState.isFullTextMode() && props.fullTextItems.length > 0}+ >+ <div class="h-full overflow-hidden">+ <FullTextResultList+ items={props.fullTextItems}+ onSelect={props.onSelectFullText}+ />+ </div>+ </Match>+ <Match+ when={+ !SearchState.isFullTextMode() && props.nameMatchItems.length > 0+ }+ >+ <div+ class="overflow-hidden shrink-0"+ style={{+ height:+ heightOfNameMatchList() < availableHeight()+ ? `${heightOfNameMatchList()}px`+ : `100%`,+ }}+ >+ <VirtualizedCommandList+ items={props.nameMatchItems}+ onSelect={props.onSelectNameMatch}+ onRowHeightMeasured={setRowHeight}+ />+ </div>+ </Match>+ <Match when={true}>+ <div class="flex items-center text-ink-extra-muted text-sm h-10 px-2">+ No matches+ </div>+ </Match>+ </Switch>++ <Show when={showFullTextSearchButton()}>+ <button+ onClick={props.onFullTextSearch}+ class="flex items-center px-2 text-sm gap-2 h-10"+ >+ <SearchIcon class="size-5 p-0.5" />+ {`Search${props.query() ? ` "${props.query()}"` : ''}`}+ </button>+ </Show>+ </div>+ );+}++/** Virtualized command list for name-match results */+function VirtualizedCommandList(props: {+ items: CommandMenuItem[];+ onSelect: (item: CommandMenuItem, openInNewSplit: boolean) => void;+ onRowHeightMeasured?: (height: number) => void;+}) {+ return (+ <VList+ data={props.items}+ style={{ height: '100%' }}+ class="scrollbar-hidden overscroll-none"+ >+ {(item, index) => (+ <div+ ref={(el) => {+ if (index() !== 0) return;+ const onMeasured = props.onRowHeightMeasured;+ if (!onMeasured) return;+ const ro = new ResizeObserver(([entry]) => {+ if (entry) onMeasured(entry.contentRect.height);+ });+ ro.observe(el);+ onCleanup(() => ro.disconnect());+ }}+ >+ <CommandItem+ item={item}+ index={index()}+ selected={false}+ onSelect={props.onSelect}+ />+ </div>+ )}+ </VList>+ );+}++/** Virtualized list for full-text search results */+function FullTextResultList(props: {+ items: WithSearch<EntityData>[];+ onSelect: (entity: WithSearch<EntityData>, openInNewSplit: boolean) => void;+}) {+ return (+ <VList+ data={props.items}+ style={{ height: '100%' }}+ class="scrollbar-hidden"+ >+ {(entity) => (+ <FullTextResultItem entity={entity} onSelect={props.onSelect} />+ )}+ </VList>+ );+}++/** Single full-text search result: entity header + first content snippet */+function FullTextResultItem(props: {+ entity: WithSearch<EntityData>;+ onSelect: (entity: WithSearch<EntityData>, openInNewSplit: boolean) => void;+}) {+ const hit = () => {+ const hitData = props.entity.search.contentHitData?.[0];+ return hitData+ ? // The char length for windowSearchMatch below is a magic number to keep the highlighted result in approximately the first two lines of the search content snippet. In the future it would be nice to handle this more robustly.+ { ...hitData, content: windowSearchMatch(hitData.content, 50) }+ : null;+ };++ return (+ <div+ class="px-2 py-2 text-sm font-semibold cursor-pointer"+ onClick={(e) => props.onSelect(props.entity, e.shiftKey)}+ >+ <div class="flex items-center gap-2 min-w-0">+ <div class="size-5 p-0.5 flex items-center justify-center text-ink-muted shrink-0">+ <Entity.Icon entity={props.entity} />+ </div>+ <Entity.Title entity={props.entity} />+ </div>+ <Show when={hit()}>+ {(h) => (+ <div class="ml-7 mt-1 border-l-2 border-edge-muted pl-2 text-xs font-normal text-ink-muted">+ {/*<p class="line-clamp-3">{h()}</p>*/}+ <SearchContent twoLineClamp hit={h()} />+ </div>+ )}+ </Show>+ </div>+ );+}++function CategoryFilterTabs() {+ const [listRef, setListRef] = createSignal<HTMLElement>();++ return (+ <Tabs+ value={SearchState.categoryFilter()}+ onChange={(value) => {+ if (value) {+ SearchState.setCategoryFilter(value as CategoryFilter);+ }+ }}+ class="border-b border-edge-muted/50"+ >+ <div class="relative">+ <ScrollIndicators+ scrollRef={listRef}+ direction="horizontal"+ noBorderStart+ noBorderEnd+ />+ <Tabs.List+ ref={setListRef}+ class="flex items-center px-2 py-1.5 overflow-x-auto scrollbar-hidden"+ >+ <For each={CATEGORIES}>+ {(category) => (+ <Tabs.Trigger+ value={category.id}+ class={cn(+ 'px-2 py-1 text-xs border first:border-l-1 border-l-0 border-edge-muted/50 font-semibold',+ SearchState.categoryFilter() === category.id+ ? 'text-ink pattern bg-edge-muted'+ : 'text-ink-muted/70 hover:text-ink hover:bg-hover'+ )}+ tabIndex={-1}+ >+ {category.label}+ </Tabs.Trigger>+ )}+ </For>+ </Tabs.List>+ </div>+ </Tabs>+ );+}diff --git a/js/app/packages/app/component/mobile/mobileSearchState.ts b/js/app/packages/app/component/mobile/mobileSearchState.tsnew file mode 100644index 0000000000..701ce867e0--- /dev/null+++ b/js/app/packages/app/component/mobile/mobileSearchState.ts@@ -0,0 +1,152 @@+import { createControlledOpenSignal } from '@core/util/createControlledOpenSignal';+import { createSignal, type Accessor, type Setter } from 'solid-js';+import type { CommandWithInfo } from '@core/hotkey/getCommands';+import type { CategoryFilter } from '../command/types';++/** timestamp threshold for resetting state after menu close */+const STATE_RESET_THRESHOLD_MS = 2_000;++export interface ICommandState {+ /** visibility */+ isOpen: Accessor<boolean>;+ setIsOpen: Setter<boolean>;+ toggle: () => void;+ open: () => void;+ close: () => void;++ /** query */+ query: Accessor<string>;+ setQuery: Setter<string>;+ clearQuery: () => void;++ /** category filter */+ categoryFilter: Accessor<CategoryFilter>;+ setCategoryFilter: Setter<CategoryFilter>;+ resetCategoryFilter: () => void;++ /** command scope (for multi-stage commands) */+ commandScopeCommands: Accessor<CommandWithInfo[]>;+ setCommandScopeCommands: Setter<CommandWithInfo[]>;+ clearCommandScopeCommands: () => void;+ isInCommandScope: Accessor<boolean>;++ /** full text search mode */+ isFullTextMode: Accessor<boolean>;+ enableFullTextMode: () => void;+ disableFullTextMode: () => void;++ /** lifecycle */+ maybeResetState: () => void;+ forceReset: () => void;+ onMenuClose: () => void;+ onMenuOpen: () => void;+}++function createSearchState(): ICommandState {+ const [isOpen, setIsOpen] = createControlledOpenSignal(false, {+ id: 'command',+ });+ const [query, setQuery] = createSignal('');+ const [categoryFilter, setCategoryFilter] =+ createSignal<CategoryFilter>('all');+ const [lastClosedTime, setLastClosedTime] = createSignal(0);+ const [commandScopeCommands, setCommandScopeCommands] = createSignal<+ CommandWithInfo[]+ >([]);+ const [isFullTextMode, setIsFullTextMode] = createSignal(false);++ function toggle() {+ setIsOpen((prev) => !prev);+ }++ function open() {+ setIsOpen(true);+ }++ function close() {+ setIsOpen(false);+ }++ function clearQuery() {+ setQuery('');+ }++ function resetCategoryFilter() {+ setCategoryFilter('all');+ }++ function clearCommandScopeCommands() {+ setCommandScopeCommands([]);+ }++ function enableFullTextMode() {+ setIsFullTextMode(true);+ }++ function disableFullTextMode() {+ setIsFullTextMode(false);+ }++ function isInCommandScope() {+ return commandScopeCommands().length > 0;+ }++ function maybeResetState() {+ const now = Date.now();+ if (now - lastClosedTime() >= STATE_RESET_THRESHOLD_MS) {+ forceReset();+ }+ }++ function forceReset() {+ clearQuery();+ resetCategoryFilter();+ clearCommandScopeCommands();+ disableFullTextMode();+ setIsFullTextMode(false);+ }++ function onMenuClose() {+ setLastClosedTime(Date.now());+ clearCommandScopeCommands();+ disableFullTextMode();+ }++ function onMenuOpen() {+ clearQuery();+ setIsFullTextMode(false);+ }++ return {+ isOpen,+ setIsOpen,+ toggle,+ open,+ close,++ query,+ setQuery,+ clearQuery,++ categoryFilter,+ setCategoryFilter,+ resetCategoryFilter,++ commandScopeCommands,+ setCommandScopeCommands,+ clearCommandScopeCommands,+ isInCommandScope,++ isFullTextMode,+ enableFullTextMode,+ disableFullTextMode,++ maybeResetState,+ forceReset,+ onMenuClose,+ onMenuOpen,+ };+}++/** Global command menu state singleton */+export const SearchState = createSearchState();diff --git a/js/app/packages/app/component/split-layout/SplitLayout.tsx b/js/app/packages/app/component/split-layout/SplitLayout.tsxindex 438bf57bc2..11be24a680 100644--- a/js/app/packages/app/component/split-layout/SplitLayout.tsx+++ b/js/app/packages/app/component/split-layout/SplitLayout.tsx@@ -38,6 +38,7 @@ import {import { decodePairs } from './layoutUtils';import { registerSplitHotkeys } from './registerSplitHotkeys';import { isListViewID } from '@app/constants/list-views';+import { isMobile } from '@core/mobile/isMobile';type SplitLayoutContainerProps = {pairs: string[];@@ -405,15 +406,17 @@ function SplitPanel(props: SplitPanelProps) {props.setPanelRef(ref);attachHotKeys(ref);}}- tl={props.index === 0}- bl={props.index === 0}+ tl={props.index === 0 && !isMobile()}+ bl={props.index === 0 && !isMobile()}tr={splitLayoutHelpers.getSplitCount() > 1 &&- props.index === splitLayoutHelpers.getSplitCount() - 1+ props.index === splitLayoutHelpers.getSplitCount() - 1 &&+ !isMobile()}br={splitLayoutHelpers.getSplitCount() > 1 &&- props.index === splitLayoutHelpers.getSplitCount() - 1+ props.index === splitLayoutHelpers.getSplitCount() - 1 &&+ !isMobile()}><Suspense>diff --git a/js/app/packages/app/component/split-layout/components/SplitContainer.tsx b/js/app/packages/app/component/split-layout/components/SplitContainer.tsxindex 85ab82facf..59d8613fa3 100644--- a/js/app/packages/app/component/split-layout/components/SplitContainer.tsx+++ b/js/app/packages/app/component/split-layout/components/SplitContainer.tsx@@ -15,8 +15,12 @@ import { SplitDrawerGroup } from './SplitDrawerContext';import { SplitHeader } from './SplitHeader';import { SplitModalProvider } from './SplitModalContext';import { SplitToolbar } from './SplitToolbar';-import { ClippedPanel } from '@core/component/ClippedPanel';+import {+ ClippedPanel,+ type ClippedPanelProps,+} from '@core/component/ClippedPanel';import { globalSplitManager } from '@app/signal/splitLayout';+import { isMobile } from '@core/mobile/isMobile';export function SplitContainer(props: ParentProps<{@@ -57,6 +61,14 @@ export function SplitContainer(return Boolean(splits && splits.length > 1);}+ function MaybeClippedPanel(props: ClippedPanelProps) {+ return (+ <Show when={!isMobile()} fallback={props.children}>+ <ClippedPanel {...props} />+ </Show>+ );+ }+return (<SplitModalProvider><SplitDrawerGroup@@ -90,7 +102,7 @@ export function SplitContainer(data-modal={panel.handle.isSpotLight()}tabindex={-1}>- <ClippedPanel+ <MaybeClippedPanelactive={panel.handle.isActive() &&multipleSplits() &&@@ -113,11 +125,8 @@ export function SplitContainer(<Show when={panel.handle.isSpotLight()}><MacroJump tabbableParent={ref} /></Show>- {/* <Show when={isMobile() && !virtualKeyboardVisible()}> */}- {/* <MobileDock /> */}- {/* </Show> */}</div>- </ClippedPanel>+ </MaybeClippedPanel></div></SplitDrawerGroup></SplitModalProvider>diff --git a/js/app/packages/app/component/split-layout/components/SplitHeader.tsx b/js/app/packages/app/component/split-layout/components/SplitHeader.tsxindex f2d6a2cb44..b391aeb9b0 100644--- a/js/app/packages/app/component/split-layout/components/SplitHeader.tsx+++ b/js/app/packages/app/component/split-layout/components/SplitHeader.tsx@@ -7,7 +7,6 @@ import {import { TOKENS } from '@core/hotkey/tokens';import { isMobile } from '@core/mobile/isMobile';import { isTouchDevice } from '@core/mobile/isTouchDevice';-import HamburgerIcon from '@phosphor-icons/core/bold/list-bold.svg?component-solid';import CollapseIcon from '@icon/regular/arrows-in.svg';import ExpandIcon from '@icon/regular/arrows-out.svg';import CaretLeft from '@icon/regular/caret-left.svg';@@ -29,7 +28,6 @@ import { SplitLayoutContext, SplitPanelContext } from '../context';import { canSpotlight } from '../utils/canSpotlight';import { cn } from '@ui/utils/classname';import { isListViewID } from '@app/constants/list-views';-import { setSidebarState } from '@app/component/Layout';function SplitBackButton() {const context = useContext(SplitPanelContext);@@ -187,19 +185,6 @@ export function SplitHeader(props: { ref: Setter<HTMLDivElement | null> }) {><div class="absolute inset-0 flex justify-start items-center bg-panel"><div class="z-2 relative flex items-center bg-panel pl-2 mobile:pl-0 h-full">- <div class="hidden mobile:block">- <button- type="button"- class="p-2"- onClick={() => {- setSidebarState((p) =>- p === 'expanded' ? 'hidden' : 'expanded'- );- }}- >- <HamburgerIcon class="size-6" />- </button>- </div><div class="mobile:hidden"><SplitCloseButton /></div>diff --git a/js/app/packages/app/component/useAppSquishHandlers.ts b/js/app/packages/app/component/useAppSquishHandlers.tsindex aec87ef720..44ceaf4daa 100644--- a/js/app/packages/app/component/useAppSquishHandlers.ts+++ b/js/app/packages/app/component/useAppSquishHandlers.ts@@ -11,7 +11,37 @@ import { onCleanup, onMount } from 'solid-js';* Functionality for responding to virtual keyboard appearance in web app and native mobile app.*/export function useAppSquishHandlers() {- if (isIOS) {+ if (isNativeMobilePlatform()) {+ type VirtualKeyboardEvent = CustomEventInit<{+ height: number;+ duration: number;+ }>;++ const handleKeyboardWillShow = (event: VirtualKeyboardEvent) => {+ setVirtualKeyboardVisible(true);+ setVirtualKeyboardHeight(event.detail?.height ?? 0);+ const newViewportHeight =+ (window.visualViewport?.height ?? 0) - (event.detail?.height ?? 0);+ const vh = newViewportHeight * 0.01;+ document.documentElement.style.setProperty('--dvh', `${vh}px`);+ };++ const handleKeyboardWillHide = () => {+ setVirtualKeyboardVisible(false);+ setVirtualKeyboardHeight(0);+ document.documentElement.style.setProperty('--dvh', '1dvh');+ };++ onMount(() => {+ window.addEventListener('keyboardWillShow', handleKeyboardWillShow);+ window.addEventListener('keyboardWillHide', handleKeyboardWillHide);++ onCleanup(() => {+ window.removeEventListener('keyboardWillShow', handleKeyboardWillShow);+ window.removeEventListener('keyboardWillHide', handleKeyboardWillHide);+ });+ });+ } else if (isIOS) {// We are tracking viewport height, and using that to set a CSS variable,// so that we can properly constrain the viewport-height for mobile in response to changes such as// the virtual keyboard appearing.@@ -64,36 +94,4 @@ export function useAppSquishHandlers() {});});}-- if (isNativeMobilePlatform()) {- type VirtualKeyboardEvent = CustomEventInit<{- height: number;- duration: number;- }>;-- const handleKeyboardWillShow = (event: VirtualKeyboardEvent) => {- setVirtualKeyboardVisible(true);- setVirtualKeyboardHeight(event.detail?.height ?? 0);- const newViewportHeight =- (window.visualViewport?.height ?? 0) - (event.detail?.height ?? 0);- const vh = newViewportHeight * 0.01;- document.documentElement.style.setProperty('--dvh', `${vh}px`);- };-- const handleKeyboardWillHide = () => {- setVirtualKeyboardVisible(false);- setVirtualKeyboardHeight(0);- document.documentElement.style.setProperty('--dvh', '1dvh');- };-- onMount(() => {- window.addEventListener('keyboardWillShow', handleKeyboardWillShow);- window.addEventListener('keyboardWillHide', handleKeyboardWillHide);-- onCleanup(() => {- window.removeEventListener('keyboardWillShow', handleKeyboardWillShow);- window.removeEventListener('keyboardWillHide', handleKeyboardWillHide);- });- });- }}diff --git a/js/app/packages/core/component/ClippedPanel.tsx b/js/app/packages/core/component/ClippedPanel.tsxindex 1e767a023d..59871518a1 100644--- a/js/app/packages/core/component/ClippedPanel.tsx+++ b/js/app/packages/core/component/ClippedPanel.tsx@@ -3,7 +3,7 @@ import { createMemo, splitProps, type JSX } from 'solid-js';import { beveledCorners } from '../../block-theme/signals/themeSignals';import { cn } from '@ui/utils/classname';-type PanelProps = JSX.HTMLAttributes<HTMLDivElement> & {+export type ClippedPanelProps = JSX.HTMLAttributes<HTMLDivElement> & {active?: boolean;edgeColor?: JSX.CSSProperties['color'];/**@@ -19,7 +19,7 @@ type PanelProps = JSX.HTMLAttributes<HTMLDivElement> & {br?: boolean;};-export function ClippedPanel(props: PanelProps) {+export function ClippedPanel(props: ClippedPanelProps) {const [local, rest] = splitProps(props, ['active','edgeColor',diff --git a/js/app/packages/core/component/ForwardToChannel.tsx b/js/app/packages/core/component/ForwardToChannel.tsxindex c9e0d38d07..999ed26089 100644--- a/js/app/packages/core/component/ForwardToChannel.tsx+++ b/js/app/packages/core/component/ForwardToChannel.tsx@@ -30,7 +30,7 @@ import {import { getDestinationFromOptions } from './NewMessage';import { Permissions } from './SharePermissions';import { toast } from './Toast/Toast';-import { VerticalScrollIndicators } from './VerticalScrollIndicators';+import { ScrollIndicators } from './VerticalScrollIndicators';interface ForwardToChannelProps {submitPermissionInfo?: {@@ -292,7 +292,7 @@ export function ForwardToChannel(props: ForwardToChannelProps) {</div><div class="grow-1 shrink-1 min-h-0 flex flex-col w-full border-t-1 border-edge-muted/50"><div class="relative grow-1 shrink-1 min-h-0 flex flex-col">- <VerticalScrollIndicators scrollRef={mdScrollRef} noBorderTop />+ <ScrollIndicators scrollRef={mdScrollRef} noBorderStart /><divclass="grow-1 shrink-1 min-h-20 overflow-y-auto scrollbar-hidden px-[12px] py-[6px] w-full text-sm"onClick={() => focusMarkdownArea()}diff --git a/js/app/packages/core/component/LexicalMarkdown/theme.ts b/js/app/packages/core/component/LexicalMarkdown/theme.tsindex 2d8614bae2..d0a783d6bd 100644--- a/js/app/packages/core/component/LexicalMarkdown/theme.ts+++ b/js/app/packages/core/component/LexicalMarkdown/theme.ts@@ -227,3 +227,14 @@ export const searchContentHitMarkdownTheme = createTheme({...unifiedListMarkdownTheme,root: `${theme.root} pr-[2px] cursor-default overflow-x-auto`,});++export const searchContentHitTwoLineClampMarkdownTheme = createTheme({+ ...unifiedListMarkdownTheme,+ root: `${theme.root} pr-[2px] cursor-default`,+ paragraph: 'md-p text-[1em] line-clamp-2',+ // .md .search-match sets display:inline-block, which iOS Safari treats as a+ // box item inside -webkit-line-clamp, causing the clamp to count one fewer+ // visual line (line-clamp-3 appears as 2 lines). Override to inline so the+ // span participates in normal inline text flow and clamping is counted correctly.+ searchMatch: 'search-match !inline',+});diff --git a/js/app/packages/core/component/TopBar/ShareButton.tsx b/js/app/packages/core/component/TopBar/ShareButton.tsxindex 757e442e09..1c7329836f 100644--- a/js/app/packages/core/component/TopBar/ShareButton.tsx+++ b/js/app/packages/core/component/TopBar/ShareButton.tsx@@ -78,7 +78,7 @@ import { Permissions } from '../SharePermissions';import { toast } from '../Toast/Toast';import { Tooltip } from '../Tooltip';import { openLoginModal } from './LoginButton';-import { VerticalScrollIndicators } from '../VerticalScrollIndicators';+import { ScrollIndicators } from '../VerticalScrollIndicators';false && clickOutside;@@ -567,10 +567,10 @@ export function ShareModal(props: ShareModalProps) {<Show when={(recipients()?.length ?? 0) > 0}><div class="grow-2 shrink-1 min-h-[118px] flex flex-col border-t-1 border-edge-muted relative">- <VerticalScrollIndicators+ <ScrollIndicatorsscrollRef={recipientScrollRef}- noBorderBottom- noBorderTop+ noBorderStart+ noBorderEnd/><divclass="overflow-y-auto scrollbar-hidden"diff --git a/js/app/packages/core/component/VerticalScrollIndicators.tsx b/js/app/packages/core/component/VerticalScrollIndicators.tsxindex 8490a3a192..e8930d4355 100644--- a/js/app/packages/core/component/VerticalScrollIndicators.tsx+++ b/js/app/packages/core/component/VerticalScrollIndicators.tsx@@ -5,27 +5,40 @@ const SCROLL_THRESHOLD = 20;/*** Used to add decorative indications that content is scrollable, in scenarios where the scrollbar is hidden.+ * Supports both vertical (default) and horizontal scroll directions.*/-export const VerticalScrollIndicators = (props: {+export const ScrollIndicators = (props: {scrollRef: Accessor<HTMLElement | undefined>;- noBorderTop?: boolean;- noBorderBottom?: boolean;+ direction?: 'vertical' | 'horizontal';+ noBorderStart?: boolean;+ noBorderEnd?: boolean;}) => {- const [topOpacity, setTopOpacity] = createSignal(0);- const [bottomOpacity, setBottomOpacity] = createSignal(0);+ const [startOpacity, setStartOpacity] = createSignal(0);+ const [endOpacity, setEndOpacity] = createSignal(0);++ const isHorizontal = () => props.direction === 'horizontal';const updateIndicators = () => {const ref = props.scrollRef();if (!ref) return;- const { scrollTop, scrollHeight, clientHeight } = ref;-- const topAmount = Math.min(scrollTop, SCROLL_THRESHOLD);- setTopOpacity(topAmount / SCROLL_THRESHOLD);- const maxScroll = scrollHeight - clientHeight;- const remainingScroll = maxScroll - scrollTop;- const bottomAmount = Math.min(remainingScroll, SCROLL_THRESHOLD);- setBottomOpacity(bottomAmount / SCROLL_THRESHOLD);+ if (isHorizontal()) {+ const { scrollLeft, scrollWidth, clientWidth } = ref;+ setStartOpacity(+ Math.min(scrollLeft, SCROLL_THRESHOLD) / SCROLL_THRESHOLD+ );+ setEndOpacity(+ Math.min(scrollWidth - clientWidth - scrollLeft, SCROLL_THRESHOLD) /+ SCROLL_THRESHOLD+ );+ } else {+ const { scrollTop, scrollHeight, clientHeight } = ref;+ setStartOpacity(Math.min(scrollTop, SCROLL_THRESHOLD) / SCROLL_THRESHOLD);+ setEndOpacity(+ Math.min(scrollHeight - clientHeight - scrollTop, SCROLL_THRESHOLD) /+ SCROLL_THRESHOLD+ );+ }};createEffect(() => {@@ -34,7 +47,6 @@ export const VerticalScrollIndicators = (props: {ref.addEventListener('scroll', updateIndicators);- // Watch for content size changes (e.g. recipients added/removed)const resizeObserver = new ResizeObserver(updateIndicators);resizeObserver.observe(ref);@@ -43,27 +55,42 @@ export const VerticalScrollIndicators = (props: {resizeObserver.disconnect();});- // Initial calculationupdateIndicators();});return (<>- {/* Top scroll boundary indicator */}+ {/* Start scroll boundary indicator */}<divclass={cn(- 'absolute pointer-events-none left-px right-px top-0 h-3 z-2 pattern-diagonal-4 pattern-edge mask-b-from-0%',- !props.noBorderTop && 'border-t border-edge-muted'+ 'absolute pointer-events-none z-2 pattern-diagonal-4 pattern-edge',+ isHorizontal()+ ? cn(+ 'top-px bottom-px left-0 w-3 mask-r-from-0%',+ !props.noBorderStart && 'border-l border-edge-muted'+ )+ : cn(+ 'left-px right-px top-0 h-3 mask-b-from-0%',+ !props.noBorderStart && 'border-t border-edge-muted'+ ))}- style={{ opacity: topOpacity() }}+ style={{ opacity: startOpacity() }}/>- {/* Bottom scroll boundary indicator */}+ {/* End scroll boundary indicator */}<divclass={cn(- 'absolute pointer-events-none left-px right-px bottom-0 h-3 z-2 pattern-diagonal-4 pattern-edge mask-t-from-0% ',- !props.noBorderBottom && 'border-b border-edge-muted'+ 'absolute pointer-events-none z-2 pattern-diagonal-4 pattern-edge',+ isHorizontal()+ ? cn(+ 'top-px bottom-px right-0 w-3 mask-l-from-0%',+ !props.noBorderEnd && 'border-r border-edge-muted'+ )+ : cn(+ 'left-px right-px bottom-0 h-3 mask-t-from-0%',+ !props.noBorderEnd && 'border-b border-edge-muted'+ ))}- style={{ opacity: bottomOpacity() }}+ style={{ opacity: endOpacity() }}/></>);diff --git a/js/app/packages/entity/src/extractors-search/search-content.tsx b/js/app/packages/entity/src/extractors-search/search-content.tsxindex 314a174908..c69ae25ce2 100644--- a/js/app/packages/entity/src/extractors-search/search-content.tsx+++ b/js/app/packages/entity/src/extractors-search/search-content.tsx@@ -2,13 +2,13 @@ import { Show } from 'solid-js';import { StaticMarkdown } from '@core/component/LexicalMarkdown/component/core/StaticMarkdown';import {searchContentHitMarkdownTheme,- unifiedListMarkdownTheme,+ searchContentHitTwoLineClampMarkdownTheme,} from '@core/component/LexicalMarkdown/theme';import type { ContentHitData } from '../types/search';interface SearchContentProps {hit?: ContentHitData;- singleLine?: boolean;+ twoLineClamp?: boolean;}/**@@ -16,6 +16,13 @@ interface SearchContentProps {*/export function SearchContent(props: SearchContentProps) {const content = () => props.hit?.content ?? '';+ const theme = () => {+ if (props.twoLineClamp) {+ return searchContentHitTwoLineClampMarkdownTheme;+ } else {+ return searchContentHitMarkdownTheme;+ }+ };return (<Show when={content()}>@@ -25,15 +32,7 @@ export function SearchContent(props: SearchContentProps) {fallback={<span class="italic text-ink-disabled">No content</span>}>{(trimmedContent) => (- <StaticMarkdown- markdown={trimmedContent()}- theme={- props.singleLine- ? unifiedListMarkdownTheme- : searchContentHitMarkdownTheme- }- singleLine={props.singleLine}- />+ <StaticMarkdown markdown={trimmedContent()} theme={theme()} />)}</Show>)}diff --git a/js/app/packages/queries/soup/useFullTextSearch.ts b/js/app/packages/queries/soup/useFullTextSearch.tsnew file mode 100644index 0000000000..ebd66971a6--- /dev/null+++ b/js/app/packages/queries/soup/useFullTextSearch.ts@@ -0,0 +1,34 @@+import { debouncedDependent } from '@core/util/debounce';+import type { Accessor } from 'solid-js';+import { useSearchSoupQuery, validateSearchServiceText } from './search';++/**+ * Minimal full-text search hook for contexts that just need a query string →+ * results, without the filter state, local fuzzy search, featured results, and+ * soup-view wiring that `createSearchState` carries. Introduced for the mobile+ * search panel, which manages its own query state externally.+ */+export function useFullTextSearch(query: Accessor<string>) {+ const debouncedQuery = debouncedDependent(query, 300);++ const searchQuery = useSearchSoupQuery(+ () => ({+ params: { page_size: 100 },+ body: {+ search_on: 'name_content',+ match_type: 'partial',+ terms:+ debouncedQuery().trim().length > 0+ ? [debouncedQuery().trim()]+ : undefined,+ include: [],+ },+ }),+ () => ({ enabled: validateSearchServiceText(debouncedQuery()) })+ );++ return {+ results: () => searchQuery.data ?? [],+ isLoading: () => searchQuery.isFetching && !searchQuery.isFetchingNextPage,+ };+}