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(app): add selective corner clip to splits (#276)
Fake-User4391d667488e
diff --git a/js/app/packages/app/component/Soup.tsx b/js/app/packages/app/component/Soup.tsxindex 157e1f2f28..68df771e1c 100644--- a/js/app/packages/app/component/Soup.tsx+++ b/js/app/packages/app/component/Soup.tsx@@ -413,7 +413,7 @@ export function Soup() {<TabContextMenu value={value} label={label} />)}newButton={- <div class="flex items-center px-2 border-t border-t-edge-muted border-b border-b-edge-muted h-full">+ <div class="flex items-center px-2 h-full"><Buttonsize="Base"classList={{diff --git a/js/app/packages/app/component/dock/Dock.tsx b/js/app/packages/app/component/dock/Dock.tsxindex 8fcc6a9666..8d11440986 100644--- a/js/app/packages/app/component/dock/Dock.tsx+++ b/js/app/packages/app/component/dock/Dock.tsx@@ -3,7 +3,6 @@ import { GlobalNotificationBell } from '@core/component/GlobalNotificationBell';import { createMemo, createSignal, onCleanup, onMount, Show } from 'solid-js';import { isRightPanelOpen, useToggleRightPanel } from '@core/signal/layout';import { ENABLE_DOCK_NOTITIFCATIONS } from '@core/constant/featureFlags';-import { activeScope, hotkeyScopeTree } from '@core/hotkey/state';import SplitIcon from '@icon/regular/square-split-horizontal.svg';import { useGlobalNotificationSource } from '../GlobalAppState';@@ -162,12 +161,13 @@ export function Dock(){<ClippedPanel bl br><div style={{'grid-template-columns':'min-content 1fr min-content',+ 'box-sizing': 'border-box','scrollbar-width': 'none','align-content': 'center','overflow-y': 'hidden','padding': '0 7px','display': 'grid',- 'height': '40px',+ 'height': '100%','gap': '7px',}}>diff --git a/js/app/packages/app/component/split-layout/components/SplitContainer.tsx b/js/app/packages/app/component/split-layout/components/SplitContainer.tsxindex 5bf5c87b2f..f708aefd1e 100644--- a/js/app/packages/app/component/split-layout/components/SplitContainer.tsx+++ b/js/app/packages/app/component/split-layout/components/SplitContainer.tsx@@ -1,5 +1,7 @@import MacroJump from '@app/component/MacroJump';-import { cornerClip } from '@core/util/clipPath';+import { globalSplitManager } from '@app/signal/splitLayout';+import { ClippedPanel } from '@core/component/ClippedPanel';+import { isRightPanelOpen } from '@core/signal/layout';import { createElementSize } from '@solid-primitives/resize-observer';import {type Accessor,@@ -16,30 +18,22 @@ import { SplitDrawerGroup } from './SplitDrawerContext';import { SplitHeader } from './SplitHeader';import { SplitModalProvider } from './SplitModalContext';import { SplitToolbar } from './SplitToolbar';-import './splitContainer.css';-import { globalSplitManager } from '@app/signal/splitLayout';-import { ClippedPanel } from '@core/component/ClippedPanel';--function EdgeDecor(props: { isActive: boolean }) {- return (- <div- class="absolute inset-0 border border-accent opacity-50 pointer-events-none mask-anim"- classList={{ active: props.isActive }}- style={{- 'clip-path': cornerClip('0.5rem', 0, 0, 0),- }}- >- <div class="size-[0.465rem] bg-accent [clip-path:polygon(0%_0%,100%_0%,0%_100%)]"></div>- </div>- );-}export function SplitContainer(- props: ParentProps<{ id: string; ref: (elem: HTMLDivElement) => void }>+ props: ParentProps<{+ ref: (elem: HTMLDivElement) => void;+ active?: boolean;+ tl?: boolean;+ tr?: boolean;+ br?: boolean;+ bl?: boolean;+ id: string;+ }>) {const panel = useSplitPanelOrThrow();- if (!panel)+ if (!panel) {throw new Error('<SplitContainer /> must be used within a <SplitLayout />');+ }const [ref, setRef] = createSignal<HTMLDivElement>();createEffect(@@ -47,10 +41,9 @@ export function SplitContainer(ref()?.focus();}));- const isSpotLight = () => panel.handle.isSpotLight();- const [headerRef, setHeaderRef] = createSignal<HTMLDivElement | null>(null);const [toolbarRef, setToolbarRef] = createSignal<HTMLDivElement | null>(null);+ const [headerRef, setHeaderRef] = createSignal<HTMLDivElement | null>(null);const headerSize = createElementSize(headerRef);const toolbarSize = createElementSize(toolbarRef);@@ -60,10 +53,10 @@ export function SplitContainer(return offset;});- const multipleSplits = () => {+ function multipleSplits() {const splits = globalSplitManager()?.splits?.();return Boolean(splits && splits.length > 1);- };+ }return (<SplitModalProvider>@@ -71,51 +64,54 @@ export function SplitContainer(contentOffsetTop={offsetTop}panelSize={panel.panelSize}>- <Show when={isSpotLight()}>+ <Show when={panel.handle.isSpotLight()}><divclass="fixed inset-0 w-screen h-screen z-modal-overlay bg-modal-overlay pattern-diagonal-4 pattern-edge-muted"onClick={() => panel.handle.toggleSpotlight(false)}/><div class="fixed inset-[4rem] bg-panel shadow-xl rounded-tl-[1.5rem]" /></Show>+<div- class="pointer-events-none text-accent"classList={{- 'absolute inset-0 z-1': !isSpotLight(),+ 'fixed inset-[4rem] z-modal-overlay isolate opacity-50':+ panel.handle.isSpotLight(),+ 'opacity-100':+ panel.handle.isActive() || panel.handle.isSpotLight(),+ 'size-full': !panel.handle.isSpotLight(),+ 'opacity-85': !panel.handle.isActive(),}}- >- <EdgeDecor- isActive={- panel.handle.isActive() && multipleSplits() && !isSpotLight()- }- />- </div>- <div- data-split-id={props.id}- data-split-container- tabindex={-1}ref={(ref) => {setRef(ref);props.ref(ref);}}- class="@container/split flex flex-col border-edge-muted border border-t-0 min-h-0 bg-panel bracket-never"- classList={{- 'opacity-85': !panel.handle.isActive(),- 'opacity-100': panel.handle.isActive() || isSpotLight(),- 'size-full': !isSpotLight(),- 'fixed inset-[4rem] z-modal-overlay isolate opacity-50':- isSpotLight(),- }}- style={{- 'clip-path': cornerClip('0.5rem', 0, 0, 0),- }}+ data-split-id={props.id}+ class="bracket-never"+ data-split-container+ tabindex={-1}>- <SplitHeader ref={setHeaderRef} />- <SplitToolbar ref={setToolbarRef} />- <div class="size-full overflow-hidden">{props.children}</div>- <Show when={isSpotLight()}>- <MacroJump tabbableParent={ref} />- </Show>+ <ClippedPanel+ active={+ panel.handle.isActive() &&+ multipleSplits() &&+ !panel.handle.isSpotLight()+ }+ tr={+ panel.handle.isLast() &&+ !isRightPanelOpen() &&+ !panel.handle.isSpotLight()+ }+ tl={panel.handle.isFirst() && !panel.handle.isSpotLight()}+ >+ <div class="flex flex-col min-h-0 size-full">+ <SplitHeader ref={setHeaderRef} />+ <SplitToolbar ref={setToolbarRef} />+ <div class="size-full overflow-hidden">{props.children}</div>+ <Show when={panel.handle.isSpotLight()}>+ <MacroJump tabbableParent={ref} />+ </Show>+ </div>+ </ClippedPanel></div></SplitDrawerGroup></SplitModalProvider>@@ -149,14 +145,14 @@ export function SplitlikeContainer(</Show><div- data-split-container- tabindex={-1}- ref={setPanel}class="@container/split flex flex-col min-h-0 bracket-never"classList={{- 'size-full': !props.spotlight(),'fixed inset-[4rem] z-modal isolate': props.spotlight(),+ 'size-full': !props.spotlight(),}}+ data-split-container+ tabindex={-1}+ ref={setPanel}><ClippedPanelactive={props.active}@@ -165,7 +161,7 @@ export function SplitlikeContainer(bl={props.bl}br={props.br}>- <div class="size-full overflow-hidden">{props.children}</div>+ <div class="size-full">{props.children}</div></ClippedPanel></div></SplitDrawerGroup>diff --git a/js/app/packages/app/component/split-layout/components/SplitHeader.tsx b/js/app/packages/app/component/split-layout/components/SplitHeader.tsxindex 8b34077998..73bed4e692 100644--- a/js/app/packages/app/component/split-layout/components/SplitHeader.tsx+++ b/js/app/packages/app/component/split-layout/components/SplitHeader.tsx@@ -2,7 +2,6 @@ import EntityNavigationIndicator from '@app/component/EntityNavigationIndicator'import { IconButton } from '@core/component/IconButton';import { ENABLE_PREVIEW } from '@core/constant/featureFlags';import { TOKENS } from '@core/hotkey/tokens';-import { cornerClip } from '@core/util/clipPath';import CollapseIcon from '@icon/regular/arrows-in.svg';import ExpandIcon from '@icon/regular/arrows-out.svg';import CaretLeft from '@icon/regular/caret-left.svg';@@ -121,7 +120,7 @@ function SplitPreviewToggle() {function SplitControlButtons() {return (- <div class="flex flex-row items-center px-2 border-t border-t-edge-muted border-b border-b-edge-muted h-full shrink-0">+ <div class="flex flex-row items-center px-2 h-full shrink-0"><SplitCloseButton /><SplitBackButton /><SplitForwardButton />@@ -136,16 +135,11 @@ export function SplitHeader(props: { ref: Setter<HTMLDivElement | null> }) {return (<div- class="isolate relative bg-edge-muted w-full h-10 overflow-clip text-ink shrink-0"+ class="isolate relative w-full h-10 overflow-clip text-ink shrink-0"data-split-headerref={props.ref}>- <div- class="absolute inset-0 flex justify-start items-center bg-panel"- style={{- 'clip-path': cornerClip('calc(0.5rem + 0.5px)', 0, 0, 0),- }}- >+ <div class="absolute inset-0 flex justify-start items-center bg-panel border-b border-b-edge-muted"><SplitControlButtons /><divclass="relative w-fit min-w-0 h-full shrink"@@ -155,15 +149,15 @@ export function SplitHeader(props: { ref: Setter<HTMLDivElement | null> }) {/>{/* space filler */}- <div class="border-t border-t-edge-muted border-b border-b-edge-muted h-full grow-1" />+ <div class="h-full grow-1" /><div- class="border-t border-t-edge-muted border-b border-b-edge-muted min-w-4 h-full shrink-0"+ class="min-w-4 h-full shrink-0"ref={(ref) => {ctx.layoutRefs.headerRight = ref;}}/>- <div class="z-2 relative flex items-center bg-panel pr-2 border-t border-t-edge-muted border-b border-b-edge-muted h-full">+ <div class="z-2 relative flex items-center bg-panel pr-2 h-full"><EntityNavigationIndicator /><SplitPreviewToggle /><SplitSpotlightButton />diff --git a/js/app/packages/app/component/split-layout/components/SplitLabel.tsx b/js/app/packages/app/component/split-layout/components/SplitLabel.tsxindex 4edfcbdae8..6048ffb539 100644--- a/js/app/packages/app/component/split-layout/components/SplitLabel.tsx+++ b/js/app/packages/app/component/split-layout/components/SplitLabel.tsx@@ -29,7 +29,7 @@ export function StaticSplitLabel(props: {panel.handle.setDisplayName(props.label);});return (- <div class="z-3 relative flex items-center gap-2 border-y border-edge-muted w-screen max-w-full h-full shrink">+ <div class="z-3 relative flex items-center gap-2 w-screen max-w-full h-full shrink"><Show when={props.iconType}><EntityIconclass="shrink-0"@@ -154,7 +154,7 @@ export function BlockItemSplitLabel(props: {});return (- <div class="z-3 relative flex items-center gap-2 border-y border-edge-muted w-screen max-w-full h-full shrink">+ <div class="z-3 relative flex items-center gap-2 w-screen max-w-full h-full shrink"><EntityIcon class="shrink-0" targetType={targetType()} size="xs" /><Show when={props.badges}>{props.badges}</Show><SplitLabeldiff --git a/js/app/packages/app/component/split-layout/components/SplitTabs.tsx b/js/app/packages/app/component/split-layout/components/SplitTabs.tsxindex 4b0590c140..91087e4ba4 100644--- a/js/app/packages/app/component/split-layout/components/SplitTabs.tsx+++ b/js/app/packages/app/component/split-layout/components/SplitTabs.tsx@@ -164,9 +164,8 @@ export function SplitTabs(props: {tabIndex={-1}class="min-w-12 max-w-[40cqw] shrink-0 text-sm relative h-full flex items-center px-2"classList={{- 'z-1 border-y border-edge-muted text-accent text-glow-sm':- isActive(),- 'border-y border-edge-muted text-ink-disabled hover:text-accent/70 hover-transition-text':+ 'z-1 text-accent text-glow-sm': isActive(),+ 'text-ink-disabled hover:text-accent/70 hover-transition-text':!isActive(),}}>diff --git a/js/app/packages/app/component/split-layout/components/splitContainer.css b/js/app/packages/app/component/split-layout/components/splitContainer.cssdeleted file mode 100644index 108c6f0e4c..0000000000--- a/js/app/packages/app/component/split-layout/components/splitContainer.css+++ /dev/null@@ -1,12 +0,0 @@-.mask-anim {- mask-image: linear-gradient(0deg, transparent 30%, black 50%);- mask-size: 100% 0;- transition: mask-size 0.25s, opacity 0.1s ease;- mask-repeat: no-repeat;- opacity: 0;-}--.mask-anim.active {- mask-size: 100% 100%;- opacity: 0.4-}diff --git a/js/app/packages/app/component/split-layout/layoutManager.ts b/js/app/packages/app/component/split-layout/layoutManager.tsindex 320c44865b..d6705d47c0 100644--- a/js/app/packages/app/component/split-layout/layoutManager.ts+++ b/js/app/packages/app/component/split-layout/layoutManager.ts@@ -150,27 +150,29 @@ export type SplitManager = {} & UrlCapabilities;export type SplitHandle = {- id: SplitId;- activate: () => void;- content: () => SplitContent;- canGoBack: () => boolean;- canGoForward: () => boolean;- goBack: () => void;- goForward: () => void;- reset: () => void;- replace: (next: SplitContent, mergeHistory?: boolean) => void;- close: () => void;- isActive: () => boolean;- isSpotLight: () => boolean;- toggleSpotlight: (force?: boolean) => void;- registerContentChangeListener: (+ unregisterContentChangeListener: (cb: (payload: SplitEventPayload[SplitEvent.ContentChange]) => void) => void;- unregisterContentChangeListener: (+ registerContentChangeListener: (cb: (payload: SplitEventPayload[SplitEvent.ContentChange]) => void) => void;- displayName: () => string;+ replace: (next: SplitContent, mergeHistory?: boolean) => void;+ toggleSpotlight: (force?: boolean) => void;setDisplayName: (name: string) => void;+ canGoForward: () => boolean;+ content: () => SplitContent;+ isSpotLight: () => boolean;+ displayName: () => string;+ canGoBack: () => boolean;+ isActive: () => boolean;+ isFirst: () => boolean;+ goForward: () => void;+ isLast: () => boolean;+ activate: () => void;+ goBack: () => void;+ close: () => void;+ reset: () => void;+ id: SplitId;} & UrlCapabilities;function newSplitId(): SplitId {@@ -481,6 +483,8 @@ export function createSplitLayout(},getUrlSegments: () => [content().type, content().id].map(String),getUrl: () => content().type + '/' + content().id,+ isFirst: () => state.splits.at(0)?.id === id,+ isLast: () => state.splits.at(-1)?.id === id,isActive: () => currentSplit.id === state.activeSplitId,isSpotLight: () => state.spotlightId === currentSplit.id,toggleSpotlight: (force?: boolean) => {diff --git a/js/app/packages/core/component/ClippedPanel.tsx b/js/app/packages/core/component/ClippedPanel.tsxindex fe99c0d5c7..bec6878a1b 100644--- a/js/app/packages/core/component/ClippedPanel.tsx+++ b/js/app/packages/core/component/ClippedPanel.tsx@@ -14,7 +14,8 @@ export function ClippedPanel(props: PanelProps) {return (<divstyle={{- 'background-image': `linear-gradient(${props.active ? 'var(--color-accent)' : 'var(--color-edge-muted)'}, var(--color-edge-muted))`,+ 'background-image': `linear-gradient(var(--color-accent), var(--color-edge-muted) ${props.active ? '80%' : '0%'})`,+ transition: 'background-image var(--transition)','box-sizing': 'border-box','clip-path': cornerClip(props.tl ? '0.5rem' : 0,@@ -30,12 +31,14 @@ export function ClippedPanel(props: PanelProps) {<divstyle={{'background-color': 'var(--color-panel)',+ 'box-sizing': 'border-box','clip-path': cornerClip(props.tl ? 'calc(0.5rem - 0.5px)' : 0,props.tr ? 'calc(0.5rem - 0.5px)' : 0,props.br ? 'calc(0.5rem - 0.5px)' : 0,props.bl ? 'calc(0.5rem - 0.5px)' : 0),+ overflow: 'hidden',height: '100%',width: '100%',}}