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(growth): slideshow onboarding rough outline needs polish (#2068)
Seamus3642f2fbca57
diff --git a/js/app/packages/app/component/Launcher.tsx b/js/app/packages/app/component/Launcher.tsxindex 3dd4ec45f4..6d441fe1fb 100644--- a/js/app/packages/app/component/Launcher.tsx+++ b/js/app/packages/app/component/Launcher.tsx@@ -218,7 +218,7 @@ export function runCreateAction(}}-type CreatableBlock = Omit<HotkeyRegistrationOptions, 'scopeId'> & {+export type CreatableBlock = Omit<HotkeyRegistrationOptions, 'scopeId'> & {label: string;blockName: BlockName;altHotkeyToken?: HotkeyToken;@@ -469,9 +469,11 @@ const LauncherMenuItem = (props: LauncherMenuItemProps) => {type LauncherInnerProps = {onClose: (shouldReturnFocus?: boolean) => void;+ blocks?: CreatableBlock[];};-const LauncherInner = (props: LauncherInnerProps) => {+export const LauncherInner = (props: LauncherInnerProps) => {+ const blocks = () => props.blocks ?? CREATABLE_BLOCKS;const [attachHotkeys, launcherScope] = useHotkeyDOMScope('create-menu', true);let ref!: HTMLDivElement;@@ -496,7 +498,7 @@ const LauncherInner = (props: LauncherInnerProps) => {// Mirrors the grid-cols-2 / sm:grid-cols-4 / xl:grid-cols-N classes in the JSXconst getColumnCount = () => {const width = window.innerWidth;- const length = CREATABLE_BLOCKS.length;+ const length = blocks().length;if (width >= 1280) {if (length >= 8) return 8;if (length >= 7) return 7;@@ -531,7 +533,7 @@ const LauncherInner = (props: LauncherInnerProps) => {return true;};- CREATABLE_BLOCKS.forEach((item) => {+ blocks().forEach((item) => {registerHotkey({hotkeyToken: item.hotkeyToken,hotkey: item.hotkey,@@ -618,7 +620,7 @@ const LauncherInner = (props: LauncherInnerProps) => {scopeId: launcherScope,description: 'Open in new split',keyDownHandler: () => {- CREATABLE_BLOCKS[focusedIndex()].keyDownHandler();+ blocks()[focusedIndex()]?.keyDownHandler();props.onClose();return true;},@@ -631,7 +633,7 @@ const LauncherInner = (props: LauncherInnerProps) => {scopeId: launcherScope,description: 'Open in current split',keyDownHandler: () => {- CREATABLE_BLOCKS[focusedIndex()].keyDownHandler();+ blocks()[focusedIndex()]?.keyDownHandler();props.onClose();return true;},@@ -657,7 +659,7 @@ const LauncherInner = (props: LauncherInnerProps) => {attachHotkeys(ref);setTimeout(() => {- const firstItem = CREATABLE_BLOCKS[0];+ const firstItem = blocks()[0];if (firstItem) {focusMenuItem(firstItem.label);@@ -667,7 +669,7 @@ const LauncherInner = (props: LauncherInnerProps) => {// horrible but tailwind requires the full stringsconst gridColsClass = () => {- const length = CREATABLE_BLOCKS.length;+ const length = blocks().length;if (length >= 8) return 'xl:grid-cols-8';if (length >= 7) return 'xl:grid-cols-7';if (length >= 6) return 'xl:grid-cols-6';@@ -711,7 +713,7 @@ const LauncherInner = (props: LauncherInnerProps) => {)}ref={ref}>- <For each={CREATABLE_BLOCKS}>+ <For each={blocks()}>{(item, index) => (<LauncherMenuItemcreatableBlock={item}diff --git a/js/app/packages/app/component/Layout.tsx b/js/app/packages/app/component/Layout.tsxindex 5fc4d1de69..b89e32fdaf 100644--- a/js/app/packages/app/component/Layout.tsx+++ b/js/app/packages/app/component/Layout.tsx@@ -40,6 +40,7 @@ const AUTH_URLS = [`${ROUTER_BASE_CONCAT}onboarding`,`${ROUTER_BASE_CONCAT}signup`,`${ROUTER_BASE_CONCAT}email-signup-callback`,+ `${ROUTER_BASE_CONCAT}welcome`,];export const [sidebarState, setSidebarState] = makePersisted(@@ -135,7 +136,9 @@ export function Layout(props: RouteSectionProps) {<Paywall /></Show><div class="max-h-full grow-1 flex">- <Show when={isAuthenticated() && !isMobile()}>+ <Show+ when={isAuthenticated() && !AUTH_URLS.includes(location.pathname)}+ ><AppSidebarsidebarState={sidebarState()}onOpenChange={(open) => {diff --git a/js/app/packages/app/component/Root.tsx b/js/app/packages/app/component/Root.tsxindex 7f18c20c29..4bf430ea94 100644--- a/js/app/packages/app/component/Root.tsx+++ b/js/app/packages/app/component/Root.tsx@@ -73,7 +73,12 @@ import MacroJump from './MacroJump';import Onboarding from './Onboarding';import { ReactiveFavicon } from './ReactiveFavicon';import { SuspenseContextComp } from './SuspenseContext';+import { lazy } from 'solid-js';import { LAYOUT_ROUTE } from './split-layout/SplitLayoutRoute';++const InteractiveOnboarding = lazy(+ () => import('./interactive-onboarding/InteractiveOnboarding')+);import Visor from './Visor';import { QuickAccessProvider } from '@core/context/quickAccess';import { AnalyticsContextProvider } from '@app/component/analytics-context';@@ -291,6 +296,14 @@ const ROUTES: RouteDefinition[] = [</div>),},+ {+ path: '/welcome',+ component: () => (+ <div class="flex *:flex-1 w-full h-dvh overflow-y-hidden">+ <InteractiveOnboarding />+ </div>+ ),+ },{// This splat route must be last to catch all unmatched routespath: '*404',diff --git a/js/app/packages/app/component/command/CommandMenu.tsx b/js/app/packages/app/component/command/CommandMenu.tsxindex 83f688dfb1..0f75536140 100644--- a/js/app/packages/app/component/command/CommandMenu.tsx+++ b/js/app/packages/app/component/command/CommandMenu.tsx@@ -91,8 +91,10 @@ export function CommandMenu() {);}-function CommandMenuInner(props: {+export function CommandMenuInner(props: {commandMenuRef: () => HTMLDivElement | undefined;+ /** Override items source with custom data (e.g. sandbox entities for tutorial) */+ items?: () => CommandMenuItem[];}) {const { openWithSplit } = useSplitLayout();@@ -100,7 +102,10 @@ function CommandMenuInner(props: {const query = debouncedDependent(CommandState.query, 60);- const filteredItems = useCommandItems(query, CommandState.categoryFilter);+ const defaultFilteredItems = props.items+ ? undefined+ : useCommandItems(query, CommandState.categoryFilter);+ const filteredItems = props.items ?? defaultFilteredItems!;createEffect(() => {const items = filteredItems();diff --git a/js/app/packages/app/component/command/index.ts b/js/app/packages/app/component/command/index.tsindex f8b0ed6596..5d670875ae 100644--- a/js/app/packages/app/component/command/index.ts+++ b/js/app/packages/app/component/command/index.ts@@ -1,4 +1,4 @@-export { CommandMenu } from './CommandMenu';+export { CommandMenu, CommandMenuInner } from './CommandMenu';export { CommandState } from './state';export type { ICommandState } from './state';export type { CategoryFilter } from './types';@@ -9,3 +9,4 @@ export {isUserItem,isCommandItem,} from './useCommandItems';+export type { CommandMenuItem } from './useCommandItems';diff --git a/js/app/packages/app/component/interactive-onboarding/InteractiveOnboarding.tsx b/js/app/packages/app/component/interactive-onboarding/InteractiveOnboarding.tsxnew file mode 100644index 0000000000..e6b86186cc--- /dev/null+++ b/js/app/packages/app/component/interactive-onboarding/InteractiveOnboarding.tsx@@ -0,0 +1,371 @@+import { useSplitPanel } from '@app/component/split-layout/layoutUtils';+import MacroLogo from '@core/component/MacroLogo';+import { registerHotkey, useHotkeyDOMScope } from '@core/hotkey/hotkeys';+import { useLocation } from '@solidjs/router';+import {+ createEffect,+ createSignal,+ on,+ onCleanup,+ onMount,+ Show,+} from 'solid-js';+import { Dynamic } from 'solid-js/web';+import { useCompleteTutorialMutation } from '@queries/auth/tutorial';+import { CommandState } from '@app/component/command';+import { resetSandbox } from './sandbox/sandbox-store';+import { commandKOpen, setCommandKOpen } from './lessons/command-k';+import { createOnboardingState } from './create-onboarding-state';+import { LESSONS } from './lessons';+import { ContinueButton, SkipButton } from './components-lib';+import { OnboardingProgress } from './OnboardingProgress';+import {+ clearCompletedLessons,+ loadCompletedLessons,+ saveCompletedLesson,+} from './persistence';++import { ClippedPanel } from '@core/component/ClippedPanel';+import { PcNoiseGrid } from '@core/component/PcNoiseGrid';++export default function InteractiveOnboarding() {+ const splitPanel = useSplitPanel();+ const completeTutorial = useCompleteTutorialMutation();+ const location = useLocation();++ const testMode = new URLSearchParams(location.search).has('test');+ if (testMode) {+ clearCompletedLessons();+ }++ const state = createOnboardingState({+ definitions: LESSONS,+ initialCompleted: testMode ? new Set() : loadCompletedLessons(),+ });++ const [readyToContinue, setReadyToContinue] = createSignal(false);+ const [continueLabel, setContinueLabel] = createSignal<string | undefined>(+ undefined+ );+ const [lessonKey, setLessonKey] = createSignal(0);++ const navigateAway = () => {+ splitPanel?.handle.replace({+ next: { type: 'component', id: 'unified-list' },+ });+ };++ let continueButtonRef: HTMLButtonElement | undefined;++ const handleLessonComplete = (buttonLabel?: string) => {+ setContinueLabel(buttonLabel);+ setReadyToContinue(true);+ requestAnimationFrame(() => continueButtonRef?.focus());+ };++ const handleContinue = () => {+ const current = state.currentLesson();+ if (!current || !readyToContinue()) return;++ state.completeLesson(current.definition.id);+ if (!testMode) {+ saveCompletedLesson(current.definition.id);+ }+ setReadyToContinue(false);+ setContinueLabel(undefined);+ setLessonKey((k) => k + 1);+ };++ const handleSkip = () => {+ const current = state.currentLesson();+ if (current) {+ state.skipLesson(current.definition.id);+ setReadyToContinue(false);+ setContinueLabel(undefined);+ setLessonKey((k) => k + 1);+ }+ };++ // cmd+enter hotkey to continue+ let shellRef: HTMLDivElement | undefined;+ const [attachHotkeys, scopeId] = useHotkeyDOMScope('onboarding-shell');++ onMount(() => {+ if (shellRef) {+ attachHotkeys(shellRef);+ shellRef.focus();+ }+ });++ const reg = registerHotkey({+ scopeId,+ hotkey: 'cmd+enter',+ description: 'Continue',+ runWithInputFocused: true,+ keyDownHandler: () => {+ if (readyToContinue()) {+ handleContinue();+ return true;+ }+ return false;+ },+ });++ const skipReg = registerHotkey({+ scopeId,+ hotkey: 'escape',+ description: 'Skip',+ runWithInputFocused: true,+ keyDownHandler: () => {+ if (!state.currentLesson()?.definition.skippable) return false;+ handleSkip();+ return true;+ },+ });++ // Block global cmd+k during the entire tutorial.+ // On the command-k lesson slide this opens/closes the sandbox command menu.+ const cmdkReg = registerHotkey({+ scopeId,+ hotkey: 'cmd+k',+ description: 'Command menu (onboarding)',+ runWithInputFocused: true,+ keyDownHandler: () => {+ setCommandKOpen((v) => !v);+ return true; // swallow — prevents global handler+ },+ });++ // Patch CommandState so the global cmd+k handler (which calls toggle/open)+ // cannot open the real command menu while we're in the tutorial. Instead+ // it drives our sandbox dialog. Also patch close() so escape inside+ // CommandMenuInner closes the sandbox dialog.+ const origToggle = CommandState.toggle.bind(CommandState);+ const origOpen = CommandState.open.bind(CommandState);+ const origClose = CommandState.close.bind(CommandState);++ CommandState.toggle = () => {+ setCommandKOpen((v) => !v);+ };+ CommandState.open = () => {+ setCommandKOpen(true);+ };+ CommandState.close = () => {+ origClose();+ setCommandKOpen(false);+ };++ onCleanup(() => {+ CommandState.toggle = origToggle;+ CommandState.open = origOpen;+ CommandState.close = origClose;+ });+ onCleanup(() => reg.dispose());+ onCleanup(() => skipReg.dispose());+ onCleanup(() => cmdkReg.dispose());+ onCleanup(() => resetSandbox());++ // When the sandbox command menu dialog closes, return focus to the+ // onboarding shell so DOM-scoped hotkeys (including cmd+k) keep working.+ createEffect(+ on(commandKOpen, (open) => {+ if (!open) {+ shellRef?.focus();+ }+ })+ );++ createEffect(+ on(+ () => state.isFinished(),+ (finished) => {+ if (finished && !testMode) {+ completeTutorial.mutate(undefined);+ navigateAway();+ }+ }+ )+ );++ createEffect(+ on(+ () => state.dismissed(),+ (dismissed) => {+ if (dismissed) navigateAway();+ }+ )+ );++ const bodyStyle = () => ({+ animation: `onboarding-fade-up 300ms ease-out both`,+ '--onboarding-key': String(lessonKey()),+ });++ const headerStyle = () => ({+ animation: `onboarding-fade-up 200ms ease-out both`,+ '--onboarding-key': String(lessonKey()),+ });++ return (+ <div+ ref={shellRef}+ class="flex items-center justify-center h-full w-full p-8 overflow-hidden relative"+ tabIndex={-1}+ >+ {/* Scoped keyframes */}+ <style>{+ /*css*/ `+ @keyframes onboarding-fade-up {+ from { opacity: 0; transform: translateY(8px); }+ to { opacity: 1; transform: translateY(0); }+ }+ @keyframes onboarding-scale-in {+ from { opacity: 0; transform: scale(0.92); }+ to { opacity: 1; transform: scale(1); }+ }+ .onboarding-stagger > * {+ animation: onboarding-fade-up 300ms ease-out both;+ }+ .onboarding-stagger > *:nth-child(1) { animation-delay: 50ms; }+ .onboarding-stagger > *:nth-child(2) { animation-delay: 120ms; }+ .onboarding-stagger > *:nth-child(3) { animation-delay: 190ms; }+ .onboarding-stagger > *:nth-child(4) { animation-delay: 260ms; }+ .onboarding-stagger > *:nth-child(5) { animation-delay: 330ms; }+ `+ }</style>+ <div class="inset-0 absolute text-edge bg-panel opacity-10 -z-1">+ <PcNoiseGrid+ cellSize={30}+ warp={0}+ crunch={0.2}+ freq={0.001}+ size={[0, 0.3]}+ rounding={0}+ fill={0}+ stroke={1}+ speed={[0.017, 0.209]}+ />+ </div>++ {/* Centered card */}+ <div class="size-full max-w-[1600px] max-h-[900px]">+ <ClippedPanel+ cornerRadius={'4px'}+ class="bg-panel size-full shadow-lg shadow-[#1111]"+ >+ <div class="size-full flex">+ <Show+ when={state.currentLesson()}+ fallback={+ <Show when={testMode && state.isFinished()}>+ <div+ class="flex flex-col items-center justify-center w-full gap-4"+ style={{+ animation: 'onboarding-scale-in 300ms ease-out both',+ }}+ >+ <p class="text-sm text-ink/60">All lessons complete.</p>+ <button+ type="button"+ class="px-3 py-1.5 text-sm bg-accent text-white rounded hover:bg-accent/80 transition-colors"+ onClick={() => window.location.reload()}+ >+ Replay+ </button>+ </div>+ </Show>+ }+ >+ {(lesson) => (+ <>+ {/* Left panel — text content (~1/3) */}+ <div class="w-1/3 h-full min-w-0 flex flex-col border-r border-edge-muted">+ {/* Header */}+ <div class="p-4">+ <div style={headerStyle()}>+ <div class="bg-ink text-panel text-xs font-mono size-4 flex items-center justify-center font-bold rounded-xs">+ {lesson().index + 1}+ </div>+ <h2 class="text-3xl font-semibold text-ink-muted mt-12">+ {lesson().definition.title}+ </h2>+ </div>+ </div>++ {/* Body */}+ <div class="flex-1 overflow-y-auto px-4 flex flex-col">+ <div style={bodyStyle()}>+ <Show when={lesson().definition.subtitle}>+ <p class="text-sm text-ink/60 mb-4">+ {lesson().definition.subtitle}+ </p>+ </Show>+ <Dynamic+ component={lesson().definition.content}+ onComplete={handleLessonComplete}+ isActive={true}+ scopeId={scopeId}+ />+ </div>+ <div class="mt-8 pt-4 flex flex-col gap-2">+ <ContinueButton+ ref={(el) => {+ continueButtonRef = el;+ }}+ onClick={handleContinue}+ label={continueLabel()}+ ghost={!readyToContinue()}+ />+ <Show when={lesson().definition.skippable}>+ <SkipButton onClick={handleSkip} />+ </Show>+ </div>+ </div>++ {/* Footer */}+ <div class="flex flex-col gap-3 px-4 py-3 border-t border-ink/10">+ <div class="flex items-center justify-between gap-2">+ <OnboardingProgress+ lessons={[...state.lessons()]}+ currentIndex={state.currentIndex()}+ />+ <span class="text-xs text-ink-extra-muted/50 font-mono">+ {state.currentIndex() + 1} / {state.lessons().length}+ </span>+ </div>+ </div>+ </div>++ {/* Right panel — demo (~2/3) */}+ <div class="flex-1 min-w-0 flex items-center justify-center bg-surface-secondary/30 overflow-hidden">+ <div style={bodyStyle()} class="w-full h-full">+ <Show+ when={lesson().definition.demo}+ fallback={+ <div class="flex items-center justify-center h-full">+ <div class="w-full m-12 opacity-10 max-w-80">+ <MacroLogo class="fill-ink" />+ </div>+ </div>+ }+ >+ {(Demo) => (+ <Dynamic+ component={Demo()}+ onComplete={handleLessonComplete}+ isActive={true}+ scopeId={scopeId}+ />+ )}+ </Show>+ </div>+ </div>+ </>+ )}+ </Show>+ </div>+ </ClippedPanel>+ </div>+ </div>+ );+}diff --git a/js/app/packages/app/component/interactive-onboarding/OnboardingEntityList.tsx b/js/app/packages/app/component/interactive-onboarding/OnboardingEntityList.tsxnew file mode 100644index 0000000000..9ce0b371cc--- /dev/null+++ b/js/app/packages/app/component/interactive-onboarding/OnboardingEntityList.tsx@@ -0,0 +1,57 @@+import { Entity } from '@entity/entity';+import type { EntityData } from '@entity';+import type { SoupState } from '@app/component/next-soup/create-soup-state';+import { createEffect, For } from 'solid-js';+import { cn } from '@ui/utils/classname';++interface OnboardingEntityListProps {+ soup: SoupState;+}++export function OnboardingEntityList(props: OnboardingEntityListProps) {+ return (+ <div+ class="flex flex-col w-full h-full scrollbar-hidden overflow-scroll"+ role="listbox"+ >+ <For each={props.soup.data()}>+ {(entity) => {+ const isFocused = () => props.soup.focus.id() === entity.id;+ let rowRef: HTMLDivElement | undefined;++ createEffect(() => {+ if (isFocused()) {+ rowRef?.scrollIntoView({ block: 'nearest' });+ }+ });++ return (+ <Entity.Root+ ref={rowRef}+ entity={entity as EntityData}+ class={cn(+ 'relative w-full min-h-10 flex items-center gap-2 px-3 text-sm font-semibold',+ {+ 'bg-accent/5 outline-1 outline-accent/20 outline-offset-[-1px]':+ isFocused(),+ 'hover:bg-hover/30': !isFocused(),+ }+ )}+ >+ <div+ class={cn(+ 'absolute h-full w-[3px] left-0 top-0 bg-accent opacity-0',+ { 'opacity-100': isFocused() }+ )}+ />+ <div class="size-4 shrink-0">+ <Entity.Icon entity={entity as EntityData} />+ </div>+ <Entity.Title entity={entity as EntityData} />+ </Entity.Root>+ );+ }}+ </For>+ </div>+ );+}diff --git a/js/app/packages/app/component/interactive-onboarding/OnboardingProgress.tsx b/js/app/packages/app/component/interactive-onboarding/OnboardingProgress.tsxnew file mode 100644index 0000000000..52936a620b--- /dev/null+++ b/js/app/packages/app/component/interactive-onboarding/OnboardingProgress.tsx@@ -0,0 +1,25 @@+import { For } from 'solid-js';+import { cn } from '@ui/utils/classname';+import type { LessonState } from './types';++interface OnboardingProgressProps {+ lessons: LessonState[];+ currentIndex: number;+}++export function OnboardingProgress(props: OnboardingProgressProps) {+ return (+ <div class="flex items-center gap-1">+ <For each={props.lessons}>+ {(lesson, i) => (+ <div+ class={cn('size-2 border border-edge-muted rounded-full', {+ 'bg-ink/10': lesson.completed,+ 'border-edge bg-edge': i() === props.currentIndex,+ })}+ />+ )}+ </For>+ </div>+ );+}diff --git a/js/app/packages/app/component/interactive-onboarding/components-lib.tsx b/js/app/packages/app/component/interactive-onboarding/components-lib.tsxnew file mode 100644index 0000000000..14297da0f4--- /dev/null+++ b/js/app/packages/app/component/interactive-onboarding/components-lib.tsx@@ -0,0 +1,200 @@+import { createSignal, For, onCleanup, onMount } from 'solid-js';+import { cn } from '@ui/utils/classname';+import { Hotkey } from '@core/component/Hotkey';++const DISPLAY_TO_EVENT_KEY: Record<string, string> = {+ '↓': 'arrowdown',+ '↑': 'arrowup',+ '←': 'arrowleft',+ '→': 'arrowright',+ esc: 'escape',+ enter: 'enter',+ cmd: 'meta',+ '⌘': 'meta',+};++function displayToEventKey(display: string): string {+ const lower = display.toLowerCase();+ return DISPLAY_TO_EVENT_KEY[lower] ?? lower;+}++interface HotkeyCalloutProps {+ keys: string[];+ label: string;+ size?: 'lg' | 'sm';+ separator?: string;+ /** When true, all keys stay permanently highlighted. */+ completed?: boolean;+}++export function HotkeyCallout(props: HotkeyCalloutProps) {+ const isLarge = () => (props.size ?? 'lg') === 'lg';+ const [activeKeys, setActiveKeys] = createSignal<Set<string>>(new Set());+ // Keys that have been pressed at least once (for progressive chord feedback)+ const [everPressed, setEverPressed] = createSignal<Set<string>>(new Set());+ // Whether the full chord was completed (all keys held simultaneously)+ const [chordDone, setChordDone] = createSignal(false);++ onMount(() => {+ const onKeyDown = (e: KeyboardEvent) => {+ if (chordDone() || props.completed) return;+ const pressed = e.key.toLowerCase();+ const match = props.keys.find((k) => displayToEventKey(k) === pressed);+ if (match) {+ setActiveKeys((prev) => {+ const next = new Set(prev);+ next.add(match);+ // Check if all keys in the chord are now active+ if (next.size === props.keys.length) {+ setChordDone(true);+ }+ return next;+ });+ setEverPressed((prev) => {+ const next = new Set(prev);+ next.add(match);+ return next;+ });+ }+ };+ const onKeyUp = (e: KeyboardEvent) => {+ if (chordDone() || props.completed) return;+ const released = e.key.toLowerCase();+ const isModifier = released === 'meta' || released === 'control';+ if (isModifier) {+ setActiveKeys(new Set<string>());+ } else {+ setActiveKeys((prev) => {+ const matched = props.keys.find(+ (k) => displayToEventKey(k) === released+ );+ if (!matched) return prev;+ const next = new Set(prev);+ next.delete(matched);+ return next;+ });+ }+ };+ const onBlur = () => {+ if (!chordDone() && !props.completed) {+ setActiveKeys(new Set<string>());+ }+ };+ document.addEventListener('keydown', onKeyDown, { capture: true });+ document.addEventListener('keyup', onKeyUp, { capture: true });+ window.addEventListener('blur', onBlur);+ onCleanup(() => {+ document.removeEventListener('keydown', onKeyDown, { capture: true });+ document.removeEventListener('keyup', onKeyUp, { capture: true });+ window.removeEventListener('blur', onBlur);+ });+ });++ const isLocked = () => props.completed || chordDone();++ /** Per-key highlight state: 'full' | 'partial' | 'none' */+ const keyState = (key: string): 'full' | 'partial' | 'none' => {+ if (isLocked()) return 'full';+ if (activeKeys().has(key)) return 'full';+ if (everPressed().has(key)) return 'partial';+ return 'none';+ };++ return (+ <div+ class={cn(+ isLarge()+ ? 'flex items-center gap-3 rounded-xs bg-hover/50 px-4 py-3 border border-edge-muted'+ : 'inline-flex items-center gap-1.5'+ )}+ >+ <div class="flex items-center gap-1.5">+ <For each={props.keys}>+ {(key, i) => (+ <>+ {i() > 0 && props.separator && (+ <span+ class={cn('text-ink/40', isLarge() ? 'text-sm' : 'text-xs')}+ >+ {props.separator}+ </span>+ )}+ <span+ class={cn(+ 'rounded-sm border',+ isLarge() ? 'px-2.5 py-1 text-base' : 'px-1.5 py-0.5 text-xs',+ keyState(key) === 'full'+ ? 'bg-ink border-ink text-panel'+ : keyState(key) === 'partial'+ ? 'bg-ink/15 border-edge-muted text-ink'+ : 'bg-hover/50 border-edge-muted text-ink'+ )}+ >+ {key}+ </span>+ </>+ )}+ </For>+ </div>+ <span+ class={cn(isLarge() ? 'text-sm text-ink/70' : 'text-sm text-ink/70')}+ >+ {props.label}+ </span>+ </div>+ );+}++interface ContinueButtonProps {+ onClick: () => void;+ label?: string;+ ghost?: boolean;+ ref?: (el: HTMLButtonElement) => void;+}++export function ContinueButton(props: ContinueButtonProps) {+ return (+ <button+ ref={props.ref}+ type="button"+ class={cn(+ 'w-full px-4 py-2.5 text-lg font-bold rounded-xs flex items-center justify-between gap-2 bracket-never',+ props.ghost+ ? 'bg-transparent text-ink/40 font-normal'+ : 'bg-accent text-panel hover:bg-accent hover:ring-2 ring-accent ring-offset-1 focus:ring-2'+ )}+ onClick={props.onClick}+ >+ {props.label ?? 'Continue'}+ <span+ class={cn(+ 'text-sm px-3 py-1 border rounded-sm',+ props.ghost+ ? 'border-edge-muted text-ink/30'+ : 'border-panel/50 text-panel'+ )}+ >+ <Hotkey shortcut="cmd+enter" />+ </span>+ </button>+ );+}++interface SkipButtonProps {+ onClick: () => void;+}++export function SkipButton(props: SkipButtonProps) {+ return (+ <button+ type="button"+ class="w-full px-4 py-2.5 text-lg rounded-xs flex items-center justify-between gap-2 bg-transparent text-ink/40 hover:bg-hover/60"+ onClick={props.onClick}+ >+ Skip+ <span class="text-sm px-3 py-1 border rounded-sm border-edge-muted text-ink/30">+ esc+ </span>+ </button>+ );+}diff --git a/js/app/packages/app/component/interactive-onboarding/components/MockAppChrome.tsx b/js/app/packages/app/component/interactive-onboarding/components/MockAppChrome.tsxnew file mode 100644index 0000000000..5f9df82e3d--- /dev/null+++ b/js/app/packages/app/component/interactive-onboarding/components/MockAppChrome.tsx@@ -0,0 +1,42 @@+import { SIDEBAR_LINKS } from '@app/component/app-sidebar/sidebar';+import { For, type JSX } from 'solid-js';+import MacroIcon from '@macro-icons/macro-logo.svg';+import { Dynamic } from 'solid-js/web';++interface MockAppChromeProps {+ viewTitle?: string;+ children?: JSX.Element;+}++export function MockAppChrome(props: MockAppChromeProps) {+ return (+ <div class="size-full p-4 bg-panel">+ <div class="flex size-full bg-page rounded-sm border border-edge-muted">+ {/* Mock sidebar */}+ <div class="px-3 shrink-0 bg-surface-secondary/50 flex flex-col items-center py-3 gap-3">+ <MacroIcon class="size-5 text-accent" />+ <For each={SIDEBAR_LINKS}>+ {(link) => (+ <div class="size-5 text-ink rounded-xs p-1 opacity-50">+ {link.icon && <Dynamic component={link.icon} />}+ </div>+ )}+ </For>+ </div>++ {/* Main area */}+ <div class="flex-1 min-w-0 flex flex-col m-1 ml-0 bg-panel border border-edge-muted rounded-sm">+ {/* Mock top bar */}+ <div class="h-10 shrink-0 border-b border-edge-muted flex items-center px-3">+ <span class="text-sm font-semibold text-ink/60">+ {props.viewTitle ?? 'Inbox'}+ </span>+ </div>++ {/* Content area */}+ <div class="flex-1 min-h-0 overflow-y-auto">{props.children}</div>+ </div>+ </div>+ </div>+ );+}diff --git a/js/app/packages/app/component/interactive-onboarding/create-onboarding-state.test.ts b/js/app/packages/app/component/interactive-onboarding/create-onboarding-state.test.tsnew file mode 100644index 0000000000..824e74815e--- /dev/null+++ b/js/app/packages/app/component/interactive-onboarding/create-onboarding-state.test.ts@@ -0,0 +1,290 @@+import { createRoot } from 'solid-js';+import { describe, expect, it } from 'vitest';+import type { LessonDefinition, LessonContentProps } from './types';+import { createOnboardingState } from './create-onboarding-state';++const NoopContent = (_props: LessonContentProps) => null;++const createTestLesson = (id: string, order?: number): LessonDefinition => ({+ id,+ title: `Lesson ${id}`,+ subtitle: `Description for ${id}`,+ content: NoopContent,+ order,+});++describe('createOnboardingState', () => {+ describe('initial state', () => {+ it('should start with all lessons incomplete', () => {+ createRoot((dispose) => {+ const state = createOnboardingState({+ definitions: [createTestLesson('a'), createTestLesson('b')],+ });++ expect(state.lessons().length).toBe(2);+ expect(state.currentIndex()).toBe(0);+ expect(state.isFinished()).toBe(false);+ expect(state.dismissed()).toBe(false);++ dispose();+ });+ });++ it('should sort lessons by order', () => {+ createRoot((dispose) => {+ const state = createOnboardingState({+ definitions: [+ createTestLesson('b', 2),+ createTestLesson('a', 1),+ createTestLesson('c', 3),+ ],+ });++ expect(state.lessons()[0].definition.id).toBe('a');+ expect(state.lessons()[1].definition.id).toBe('b');+ expect(state.lessons()[2].definition.id).toBe('c');++ dispose();+ });+ });++ it('should mark initial completed lessons', () => {+ createRoot((dispose) => {+ const state = createOnboardingState({+ definitions: [createTestLesson('a'), createTestLesson('b')],+ initialCompleted: new Set(['a']),+ });++ expect(state.lessons()[0].completed).toBe(true);+ expect(state.lessons()[1].completed).toBe(false);+ expect(state.currentIndex()).toBe(1);++ dispose();+ });+ });++ it('should be finished if all initially completed', () => {+ createRoot((dispose) => {+ const state = createOnboardingState({+ definitions: [createTestLesson('a'), createTestLesson('b')],+ initialCompleted: new Set(['a', 'b']),+ });++ expect(state.isFinished()).toBe(true);+ expect(state.currentIndex()).toBe(2);+ expect(state.currentLesson()).toBeUndefined();++ dispose();+ });+ });+ });++ describe('currentLesson', () => {+ it('should return the first incomplete lesson', () => {+ createRoot((dispose) => {+ const state = createOnboardingState({+ definitions: [createTestLesson('a'), createTestLesson('b')],+ });++ expect(state.currentLesson()?.definition.id).toBe('a');++ dispose();+ });+ });++ it('should return undefined when all done', () => {+ createRoot((dispose) => {+ const state = createOnboardingState({+ definitions: [createTestLesson('a')],+ });++ state.completeLesson('a');+ expect(state.currentLesson()).toBeUndefined();++ dispose();+ });+ });+ });++ describe('completeLesson', () => {+ it('should mark a lesson as completed', () => {+ createRoot((dispose) => {+ const state = createOnboardingState({+ definitions: [createTestLesson('a'), createTestLesson('b')],+ });++ state.completeLesson('a');++ expect(state.lessons()[0].completed).toBe(true);+ expect(state.currentIndex()).toBe(1);+ expect(state.currentLesson()?.definition.id).toBe('b');++ dispose();+ });+ });++ it('should set isFinished when all completed', () => {+ createRoot((dispose) => {+ const state = createOnboardingState({+ definitions: [createTestLesson('a'), createTestLesson('b')],+ });++ state.completeLesson('a');+ state.completeLesson('b');++ expect(state.isFinished()).toBe(true);++ dispose();+ });+ });++ it('should be a no-op for unknown id', () => {+ createRoot((dispose) => {+ const state = createOnboardingState({+ definitions: [createTestLesson('a')],+ });++ state.completeLesson('unknown');+ expect(state.lessons()[0].completed).toBe(false);++ dispose();+ });+ });+ });++ describe('skipLesson', () => {+ it('should mark a lesson as skipped and advance', () => {+ createRoot((dispose) => {+ const state = createOnboardingState({+ definitions: [createTestLesson('a'), createTestLesson('b')],+ });++ state.skipLesson('a');++ expect(state.lessons()[0].skipped).toBe(true);+ expect(state.currentIndex()).toBe(1);++ dispose();+ });+ });++ it('should set isFinished when all skipped', () => {+ createRoot((dispose) => {+ const state = createOnboardingState({+ definitions: [createTestLesson('a'), createTestLesson('b')],+ });++ state.skipLesson('a');+ state.skipLesson('b');++ expect(state.isFinished()).toBe(true);++ dispose();+ });+ });+ });++ describe('advanceToNext', () => {+ it('should skip the current lesson', () => {+ createRoot((dispose) => {+ const state = createOnboardingState({+ definitions: [createTestLesson('a'), createTestLesson('b')],+ });++ state.advanceToNext();++ expect(state.lessons()[0].skipped).toBe(true);+ expect(state.currentLesson()?.definition.id).toBe('b');++ dispose();+ });+ });++ it('should be a no-op when all done', () => {+ createRoot((dispose) => {+ const state = createOnboardingState({+ definitions: [createTestLesson('a')],+ });++ state.completeLesson('a');+ state.advanceToNext();++ expect(state.isFinished()).toBe(true);++ dispose();+ });+ });+ });++ describe('goToLesson', () => {+ it('should un-skip a previously skipped lesson', () => {+ createRoot((dispose) => {+ const state = createOnboardingState({+ definitions: [createTestLesson('a'), createTestLesson('b')],+ });++ state.skipLesson('a');+ expect(state.currentLesson()?.definition.id).toBe('b');++ state.goToLesson(0);+ expect(state.currentLesson()?.definition.id).toBe('a');++ dispose();+ });+ });++ it('should ignore out-of-bounds index', () => {+ createRoot((dispose) => {+ const state = createOnboardingState({+ definitions: [createTestLesson('a')],+ });++ state.goToLesson(-1);+ state.goToLesson(99);+ expect(state.currentLesson()?.definition.id).toBe('a');++ dispose();+ });+ });+ });++ describe('dismiss', () => {+ it('should set dismissed to true', () => {+ createRoot((dispose) => {+ const state = createOnboardingState({+ definitions: [createTestLesson('a')],+ });++ state.dismiss();+ expect(state.dismissed()).toBe(true);++ dispose();+ });+ });+ });++ describe('mixed completion and skipping', () => {+ it('should handle mixed complete and skip correctly', () => {+ createRoot((dispose) => {+ const state = createOnboardingState({+ definitions: [+ createTestLesson('a'),+ createTestLesson('b'),+ createTestLesson('c'),+ ],+ });++ state.completeLesson('a');+ state.skipLesson('b');++ expect(state.currentLesson()?.definition.id).toBe('c');+ expect(state.isFinished()).toBe(false);++ state.completeLesson('c');+ expect(state.isFinished()).toBe(true);++ dispose();+ });+ });+ });+});diff --git a/js/app/packages/app/component/interactive-onboarding/create-onboarding-state.ts b/js/app/packages/app/component/interactive-onboarding/create-onboarding-state.tsnew file mode 100644index 0000000000..241857e125--- /dev/null+++ b/js/app/packages/app/component/interactive-onboarding/create-onboarding-state.ts@@ -0,0 +1,84 @@+import { createSignal } from 'solid-js';+import { createStore } from 'solid-js/store';+import type { LessonDefinition, LessonId, LessonState } from './types';++interface OnboardingStateOptions {+ definitions: LessonDefinition[];+ initialCompleted?: Set<LessonId>;+}++export function createOnboardingState(options: OnboardingStateOptions) {+ const sorted = [...options.definitions].sort(+ (a, b) => (a.order ?? 0) - (b.order ?? 0)+ );++ const [store, setStore] = createStore<LessonState[]>(+ sorted.map((def, index) => ({+ definition: def,+ index,+ completed: options.initialCompleted?.has(def.id) ?? false,+ skipped: false,+ }))+ );++ const [dismissed, setDismissed] = createSignal(false);++ const lessons = () => store;++ const currentIndex = () => {+ const idx = store.findIndex((l) => !l.completed && !l.skipped);+ return idx === -1 ? store.length : idx;+ };++ const currentLesson = () => {+ const idx = currentIndex();+ return idx < store.length ? store[idx] : undefined;+ };++ const isFinished = () =>+ store.length > 0 && store.every((l) => l.completed || l.skipped);++ const findIndexById = (id: LessonId): number =>+ store.findIndex((l) => l.definition.id === id);++ const completeLesson = (id: LessonId) => {+ const idx = findIndexById(id);+ if (idx !== -1) setStore(idx, 'completed', true);+ };++ const skipLesson = (id: LessonId) => {+ const idx = findIndexById(id);+ if (idx !== -1) setStore(idx, 'skipped', true);+ };++ const advanceToNext = () => {+ const current = currentLesson();+ if (current) {+ skipLesson(current.definition.id);+ }+ };++ const goToLesson = (index: number) => {+ if (index < 0 || index >= store.length) return;+ setStore(index, 'skipped', false);+ };++ const dismiss = () => {+ setDismissed(true);+ };++ return {+ lessons,+ currentIndex,+ currentLesson,+ isFinished,+ dismissed,+ completeLesson,+ skipLesson,+ advanceToNext,+ goToLesson,+ dismiss,+ };+}++export type OnboardingState = ReturnType<typeof createOnboardingState>;diff --git a/js/app/packages/app/component/interactive-onboarding/lessons/choose-plan.tsx b/js/app/packages/app/component/interactive-onboarding/lessons/choose-plan.tsxnew file mode 100644index 0000000000..fad80f6940--- /dev/null+++ b/js/app/packages/app/component/interactive-onboarding/lessons/choose-plan.tsx@@ -0,0 +1,100 @@+import { onMount, For } from 'solid-js';+import type { LessonContentProps, LessonDefinition } from '../types';++const PLANS: {+ name: string;+ price: number;+ description: string;+ calls: string;+ popular?: boolean;+}[] = [+ {+ name: 'Haiku',+ price: 20,+ description: "Access to Anthropic's fast, lightweight model",+ calls: '1,000',+ },+ {+ name: 'Sonnet',+ price: 60,+ description: "Access to Anthropic's balanced frontier model",+ calls: '5,000',+ popular: true,+ },+ {+ name: 'Opus',+ price: 120,+ description: "Access to Anthropic's most capable model",+ calls: 'Unlimited',+ },+];++function ChoosePlanContent(props: LessonContentProps) {+ onMount(() => props.onComplete());++ return (+ <div class="flex flex-col gap-3 onboarding-stagger">+ <p>Pick the plan that works best for your team.</p>+ </div>+ );+}++function ChoosePlanDemo() {+ return (+ <div class="h-full w-full flex items-center justify-center px-8">+ <div class="flex gap-4 w-full max-w-2xl">+ <For each={PLANS}>+ {(plan) => (+ <div+ class="flex-1 rounded-sm border bg-panel flex flex-col overflow-hidden"+ classList={{+ 'border-accent ring-1 ring-accent': !!plan.popular,+ 'border-edge-muted': !plan.popular,+ }}+ >+ {plan.popular && (+ <div class="bg-accent text-panel text-[10px] font-semibold text-center py-0.5">+ Most popular+ </div>+ )}+ <div class="p-4 flex flex-col gap-3 flex-1">+ <div>+ <h3 class="text-lg font-semibold text-ink">{plan.name}</h3>+ <p class="text-xs text-ink/50 mt-0.5">{plan.description}</p>+ </div>+ <div class="flex items-baseline gap-0.5">+ <span class="text-3xl font-bold text-ink">${plan.price}</span>+ <span class="text-sm text-ink/40">/mo</span>+ </div>+ <div class="text-xs text-ink/60">+ <span class="font-semibold text-ink">{plan.calls}</span> AI+ tool calls per month+ </div>+ <div class="mt-auto pt-2">+ <button+ type="button"+ class="w-full py-2 rounded-xs text-sm font-semibold"+ classList={{+ 'bg-accent text-panel': !!plan.popular,+ 'bg-ink/8 text-ink hover:bg-ink/12': !plan.popular,+ }}+ >+ Get {plan.name}+ </button>+ </div>+ </div>+ </div>+ )}+ </For>+ </div>+ </div>+ );+}++export const choosePlanLesson: LessonDefinition = {+ id: 'choose-plan',+ title: 'Choose your plan',+ content: ChoosePlanContent,+ demo: ChoosePlanDemo,+ order: 80,+};diff --git a/js/app/packages/app/component/interactive-onboarding/lessons/command-k.tsx b/js/app/packages/app/component/interactive-onboarding/lessons/command-k.tsxnew file mode 100644index 0000000000..a1decb3e00--- /dev/null+++ b/js/app/packages/app/component/interactive-onboarding/lessons/command-k.tsx@@ -0,0 +1,193 @@+import { CommandMenuInner, CommandState } from '@app/component/command';+import type { CategoryFilter } from '@app/component/command';+import { createSoupState } from '@app/component/next-soup/create-soup-state';+import { ClippedPanel } from '@core/component/ClippedPanel';+import { createFreshSearch } from '@core/util/freshSort';+import { Dialog } from '@kobalte/core/dialog';+import {+ sandboxEntities,+ sandboxToCommandItems,+} from '../sandbox/sandbox-store';+import {+ createEffect,+ createMemo,+ createSignal,+ on,+ onCleanup,+ onMount,+} from 'solid-js';+import { HotkeyCallout } from '../components-lib';+import { MockAppChrome } from '../components/MockAppChrome';+import { OnboardingEntityList } from '../OnboardingEntityList';+import type { LessonContentProps, LessonDefinition } from '../types';++/** Module-level signal toggled by the onboarding shell's cmd+k handler. */+export const [commandKOpen, setCommandKOpen] = createSignal(false);++/** Map category filter to the bucket values used by sandbox items. */+const CATEGORY_TO_BUCKETS: Record<CategoryFilter, string[] | null> = {+ all: null, // no filter+ channels: ['channel'],+ dms: ['dm'],+ notes: ['note'],+ tasks: ['task'],+ documents: ['document'],+ chats: ['chat'],+ projects: ['project'],+ commands: [], // sandbox has no commands — show nothing+ people: [], // sandbox has no people — show nothing+};++function CommandKContent(props: LessonContentProps) {+ const [completed, setCompleted] = createSignal(false);++ // Complete as soon as the user opens the command menu+ createEffect(+ on(commandKOpen, (open) => {+ if (open && !completed()) {+ setCompleted(true);+ props.onComplete();+ }+ })+ );++ return (+ <div class="flex flex-col gap-3 onboarding-stagger">+ <HotkeyCallout keys={['⌘', 'K']} label="to open the command menu" />+ <p>+ Search for anything — documents, emails, tasks, channels — and navigate+ to it instantly.+ </p>+ <p>+ Press <strong>⌘K</strong> to try it out.+ </p>+ </div>+ );+}++function CommandKDemo(_props: LessonContentProps) {+ const [commandMenuRef, setCommandMenuRef] = createSignal<HTMLDivElement>();++ onMount(() => {+ CommandState.forceReset();+ });++ onCleanup(() => {+ CommandState.forceReset();+ setCommandKOpen(false);+ });++ const allItems = () => sandboxToCommandItems();++ const search = createMemo(() => {+ const q = CommandState.query();+ const hasQuery = q.trim().length > 0;+ return createFreshSearch({+ config: {+ useViewedAt: true,+ fuzzyWeight: hasQuery ? 0.7 : 0.0,+ timeWeight: hasQuery ? 0.3 : 0.9,+ minFuzzyThreshold: hasQuery ? 0.1 : 0,+ },+ getName: (item: ReturnType<typeof sandboxToCommandItems>[number]) =>+ item.searchText,+ getTimestamp: (item: ReturnType<typeof sandboxToCommandItems>[number]) =>+ item.timestamps,+ });+ });++ const filteredItems = createMemo(() => {+ let items = allItems();++ // Filter by category+ const category = CommandState.categoryFilter();+ const allowedBuckets = CATEGORY_TO_BUCKETS[category];+ if (allowedBuckets !== null) {+ items = items.filter((item) => allowedBuckets.includes(item.bucket));+ }++ // Filter by query+ const q = CommandState.query();+ if (q.trim()) {+ return search()(items, q).map((result) => result.item);+ }++ return items;+ });++ // Capture the initial height on first render so the top offset stays fixed+ // even as the list shrinks from filtering.+ const [topOffset, setTopOffset] = createSignal<number | undefined>(undefined);+ let contentEl: HTMLDivElement | undefined;++ const measureOnce = () => {+ if (topOffset() !== undefined || !contentEl) return;+ // Wait a frame for the menu to fully render+ requestAnimationFrame(() => {+ if (!contentEl) return;+ const h = contentEl.getBoundingClientRect().height;+ setTopOffset(Math.max(0, (window.innerHeight - h) / 2));+ });+ };++ // Re-measure each time the dialog opens+ createEffect(() => {+ if (commandKOpen()) {+ setTopOffset(undefined);+ requestAnimationFrame(measureOnce);+ }+ });++ const soup = createSoupState({+ initialData: sandboxEntities(),+ wrapNavigation: true,+ });++ createEffect(() => {+ soup.setData(sandboxEntities());+ });++ return (+ <>+ {/* Entity list visible behind the modal */}+ <MockAppChrome viewTitle="Documents">+ <OnboardingEntityList soup={soup} />+ </MockAppChrome>++ <Dialog open={commandKOpen()} onOpenChange={setCommandKOpen}>+ <Dialog.Portal>+ <Dialog.Overlay class="z-modal fixed inset-0 bg-modal-overlay pattern-edge-muted pattern-diagonal-4" />+ <div class="z-modal fixed inset-0 flex items-start justify-center">+ <Dialog.Content+ ref={contentEl}+ class="max-w-[calc(100vw-16px)] overflow-hidden portal-scope"+ style={{+ width: '800px',+ 'margin-top':+ topOffset() !== undefined ? `${topOffset()}px` : '20vh',+ }}+ >+ <ClippedPanel active cornerRadius="4px">+ <div class="[&>*]:max-h-[75vh]" ref={setCommandMenuRef}>+ <CommandMenuInner+ commandMenuRef={commandMenuRef}+ items={filteredItems}+ />+ </div>+ </ClippedPanel>+ </Dialog.Content>+ </div>+ </Dialog.Portal>+ </Dialog>+ </>+ );+}++export const commandKLesson: LessonDefinition = {+ id: 'command-k',+ title: 'Command Menu',+ content: CommandKContent,+ demo: CommandKDemo,+ skippable: true,+ order: 40,+};diff --git a/js/app/packages/app/component/interactive-onboarding/lessons/composers-preview.tsx b/js/app/packages/app/component/interactive-onboarding/lessons/composers-preview.tsxnew file mode 100644index 0000000000..0b1103a3e4--- /dev/null+++ b/js/app/packages/app/component/interactive-onboarding/lessons/composers-preview.tsx@@ -0,0 +1,143 @@+import { onMount } from 'solid-js';+import type { LessonContentProps, LessonDefinition } from '../types';++import CheckIcon from '@icon/regular/check.svg';+import UsersIcon from '@icon/regular/users.svg';+import CircleDashedIcon from '@icon/regular/circle-dashed.svg';+import CalendarBlankIcon from '@icon/regular/calendar-blank.svg';+import FlagIcon from '@icon/regular/flag.svg';+import PlusIcon from '@icon/regular/plus.svg';+import PaperclipIcon from '@icon/regular/paperclip.svg';+import TextAaIcon from '@icon/regular/text-aa.svg';+import ClockIcon from '@icon/regular/clock.svg';+import ArrowUpIcon from '@icon/regular/arrow-up.svg';++function ComposersPreviewContent(props: LessonContentProps) {+ onMount(() => setTimeout(() => props.onComplete('Got it')));++ return (+ <div class="flex flex-col gap-3 onboarding-stagger">+ <p>+ Macro has dedicated composers for tasks, emails, and more — each+ tailored to its content type.+ </p>+ <p>Open any item to start editing with the right tools built in.</p>+ </div>+ );+}++function ComposersPreviewDemo() {+ return (+ <div class="h-full w-full flex flex-col items-center justify-center gap-6 px-10 py-8">+ {/* Task composer */}+ <div class="w-full max-w-lg rounded-sm border border-edge-muted bg-panel flex flex-col overflow-hidden">+ <div class="px-4 pt-3 pb-1">+ <div class="flex items-center gap-2">+ <div class="size-5 rounded-xs bg-task-bg flex items-center justify-center">+ <CheckIcon class="size-3 text-task" />+ </div>+ <span class="text-lg text-ink/40">Task Title</span>+ </div>+ <p class="text-xs text-ink/30 mt-1 pl-7">Add description...</p>+ </div>++ {/* Properties grid */}+ <div class="px-4 py-3 flex flex-wrap gap-x-6 gap-y-2 text-[11px]">+ <div class="flex items-center gap-1.5">+ <UsersIcon class="size-3.5 text-ink/50" />+ <span class="text-ink/50">Assignees</span>+ <span class="bg-accent/15 text-accent text-[10px] px-1.5 py-0.5 rounded-xs font-medium">+ seam+ </span>+ <PlusIcon class="size-3 text-ink/30" />+ </div>+ <div class="flex items-center gap-1.5">+ <CircleDashedIcon class="size-3.5 text-ink/50" />+ <span class="text-ink/50">Status</span>+ <span class="text-ink/50 border border-edge-muted px-1.5 py-0.5 rounded-xs">+ Not Started+ </span>+ </div>+ <div class="flex items-center gap-1.5">+ <CalendarBlankIcon class="size-3.5 text-ink/50" />+ <span class="text-ink/50">Due Date</span>+ <span class="text-ink/30 border border-edge-muted px-1.5 py-0.5 rounded-xs">+ Empty+ </span>+ </div>+ <div class="flex items-center gap-1.5">+ <FlagIcon class="size-3.5 text-ink/50" />+ <span class="text-ink/50">Priority</span>+ <PlusIcon class="size-3 text-ink/30" />+ </div>+ </div>++ {/* Footer */}+ <div class="px-4 py-2 border-t border-edge-muted flex items-center justify-between">+ <div class="flex items-center gap-1.5 text-[11px] text-ink/40">+ <span>Create More</span>+ <div class="w-6 h-3.5 rounded-full bg-ink/10" />+ </div>+ <div class="flex items-center gap-1 text-[11px] text-ink/40 border border-edge-muted px-2.5 py-1 rounded-xs">+ <CheckIcon class="size-3" />+ <span>Create Task</span>+ </div>+ </div>+ </div>++ {/* Email composer */}+ <div class="w-full max-w-lg rounded-sm border border-edge-muted bg-panel flex flex-col overflow-hidden">+ {/* From line */}+ <div class="px-4 py-2.5 flex items-center justify-between text-xs">+ <span class="text-ink/40">from [email protected]</span>+ <div class="flex items-center gap-2 text-ink/50">+ <span>+ Cc</span>+ <span>+ Bcc</span>+ </div>+ </div>++ {/* To field */}+ <div class="px-4 py-2 flex items-center gap-3">+ <span class="text-sm text-ink/40">To</span>+ <span class="text-sm text-ink/30">+ Macro users or email addresses+ </span>+ </div>+ <div class="mx-4 h-px bg-email" />++ {/* Subject field */}+ <div class="px-4 py-2 flex items-center gap-3">+ <span class="text-sm text-ink/40">Subject</span>+ <span class="text-sm text-ink/30">Subject</span>+ </div>+ <div class="mx-4 h-px bg-edge-muted" />++ {/* Body */}+ <div class="px-4 py-4 flex-1 min-h-[80px]">+ <span class="text-sm text-ink/25">Use `@` to reference files</span>+ </div>++ {/* Footer */}+ <div class="px-4 py-2.5 border-t border-edge-muted flex items-center justify-between">+ <div class="flex items-center gap-3 text-ink/40">+ <PaperclipIcon class="size-4" />+ <TextAaIcon class="size-4" />+ <ClockIcon class="size-4" />+ </div>+ <div class="size-7 rounded-full border-2 border-email flex items-center justify-center">+ <ArrowUpIcon class="size-3.5 text-email" />+ </div>+ </div>+ </div>+ </div>+ );+}++export const composersPreviewLesson: LessonDefinition = {+ id: 'composers-preview',+ title: 'Composers',+ subtitle: 'Purpose-built editors for every content type.',+ content: ComposersPreviewContent,+ demo: ComposersPreviewDemo,+ order: 60,+};diff --git a/js/app/packages/app/component/interactive-onboarding/lessons/create-entity.tsx b/js/app/packages/app/component/interactive-onboarding/lessons/create-entity.tsxnew file mode 100644index 0000000000..808617b47c--- /dev/null+++ b/js/app/packages/app/component/interactive-onboarding/lessons/create-entity.tsx@@ -0,0 +1,171 @@+import { createSoupState } from '@app/component/next-soup/create-soup-state';+import type { SoupState } from '@app/component/next-soup/create-soup-state';+import {+ LauncherInner,+ CREATABLE_BLOCKS,+ type CreatableBlock,+} from '@app/component/Launcher';+import { createHotkeyGroup, registerHotkey } from '@core/hotkey/hotkeys';+import { Dialog } from '@kobalte/core/dialog';+import {+ createEffect,+ createSignal,+ on,+ onCleanup,+ onMount,+ Show,+} from 'solid-js';+import { useListNavigation } from '../use-list-navigation';+import { OnboardingEntityList } from '../OnboardingEntityList';+import { MockAppChrome } from '../components/MockAppChrome';+import { HotkeyCallout } from '../components-lib';+import type { LessonContentProps, LessonDefinition } from '../types';+import {+ sandboxEntities,+ addSandboxEntity,+ createSandboxEntity,+ type SandboxEntityType,+} from '../sandbox/sandbox-store';++const BLOCK_TO_SANDBOX: Record<string, SandboxEntityType> = {+ md: 'md',+ email: 'email',+ task: 'task',+ channel: 'channel',+ chat: 'chat',+ canvas: 'canvas',+ project: 'project',+ code: 'code',+};++// Module-level signals shared between content (left) and demo (right)+const [sharedSoup, setSharedSoup] = createSignal<SoupState | undefined>();+const [onCreated, setOnCreated] = createSignal<(() => void) | undefined>();+const [launcherOpen, setLauncherOpen] = createSignal(false);++function CreateEntityContent(props: LessonContentProps) {+ const [completed, setCompleted] = createSignal(false);++ setOnCreated(() => () => {+ if (!completed()) {+ setCompleted(true);+ props.onComplete();+ }+ });++ let containerRef: HTMLDivElement | undefined;+ const group = createHotkeyGroup();++ onMount(() => {+ registerHotkey({+ scopeId: props.scopeId,+ hotkey: 'c',+ description: 'Open Create menu',+ keyDownHandler: () => {+ setLauncherOpen(true);+ return true;+ },+ }).withGroup(group);+ });++ // Return focus to content panel when launcher closes+ createEffect(+ on(launcherOpen, (open, prevOpen) => {+ if (!open && prevOpen) {+ containerRef?.focus();+ }+ })+ );++ onCleanup(() => {+ group.dispose();+ setLauncherOpen(false);+ setOnCreated(undefined);+ });++ return (+ <div+ ref={containerRef}+ tabIndex={0}+ class="flex flex-col gap-3 outline-none onboarding-stagger"+ >+ <div class="bracket-never">+ <HotkeyCallout keys={['C']} label="to open the Create menu" />+ </div>+ </div>+ );+}++function CreateEntityDemo(props: LessonContentProps) {+ const soup = createSoupState({+ initialData: sandboxEntities(),+ wrapNavigation: true,+ });++ setSharedSoup(soup);++ useListNavigation(soup, props.scopeId);++ // Keep soup synced with sandbox store+ createEffect(() => {+ soup.setData(sandboxEntities());+ });++ // Build sandbox versions of all creatable blocks+ const sandboxBlocks: CreatableBlock[] = CREATABLE_BLOCKS.map((block) => ({+ ...block,+ keyDownHandler: () => {+ const sandboxType = BLOCK_TO_SANDBOX[block.blockName];+ if (sandboxType) {+ const entity = createSandboxEntity(sandboxType);+ addSandboxEntity(entity);+ onCreated()?.();+ }+ setLauncherOpen(false);+ return true;+ },+ }));++ onCleanup(() => {+ setSharedSoup(undefined);+ });++ return (+ <div class="flex flex-col h-full relative">+ <MockAppChrome viewTitle="Documents">+ <Show when={sharedSoup()}>+ {(s) => <OnboardingEntityList soup={s()} />}+ </Show>+ </MockAppChrome>++ <Dialog open={launcherOpen()} onOpenChange={setLauncherOpen} modal={true}>+ <Dialog.Portal>+ <Dialog.Overlay class="fixed inset-0 z-modal bg-modal-overlay pattern-diagonal-4 pattern-edge-muted" />+ <Dialog.Content>+ <div+ class="fixed inset-0 z-modal w-screen h-screen flex items-center justify-center"+ onClick={(e) => {+ if (e.target === e.currentTarget) setLauncherOpen(false);+ }}+ >+ <LauncherInner+ blocks={sandboxBlocks}+ onClose={() => setLauncherOpen(false)}+ />+ </div>+ </Dialog.Content>+ </Dialog.Portal>+ </Dialog>+ </div>+ );+}++export const createEntityLesson: LessonDefinition = {+ id: 'create-entity',+ title: 'Create',+ subtitle: 'Use the launcher to create docs, emails, and more.',+ content: CreateEntityContent,+ demo: CreateEntityDemo,+ order: 45,+ skippable: true,+};diff --git a/js/app/packages/app/component/interactive-onboarding/lessons/email-invite.tsx b/js/app/packages/app/component/interactive-onboarding/lessons/email-invite.tsxnew file mode 100644index 0000000000..cb88a6bd0b--- /dev/null+++ b/js/app/packages/app/component/interactive-onboarding/lessons/email-invite.tsx@@ -0,0 +1,76 @@+import { createSignal, For } from 'solid-js';+import type { LessonContentProps, LessonDefinition } from '../types';++function EmailInviteContent(_props: LessonContentProps) {+ return (+ <div class="flex flex-col gap-3 onboarding-stagger">+ <p>+ Macro is better with your team. Invite collaborators to your workspace+ by email.+ </p>+ </div>+ );+}++function EmailInviteDemo(props: LessonContentProps) {+ const [emails, setEmails] = createSignal(['']);++ const updateEmail = (index: number, value: string) => {+ setEmails((prev) => {+ const next = [...prev];+ next[index] = value;+ return next;+ });+ };++ const addField = () => {+ setEmails((prev) => [...prev, '']);+ };++ const handleSend = () => {+ props.onComplete();+ };++ return (+ <div class="h-full w-full flex items-center justify-center px-6">+ <div class="w-full max-w-sm flex flex-col gap-3">+ <p class="text-sm font-semibold text-ink/70">Invite teammates</p>+ <For each={emails()}>+ {(email, i) => (+ <input+ type="email"+ placeholder="[email protected]"+ value={email}+ onInput={(e) => updateEmail(i(), e.currentTarget.value)}+ class="w-full px-3 py-2 text-sm border border-edge-muted rounded-xs bg-panel text-ink placeholder:text-ink/30 outline-none focus:border-accent/50"+ />+ )}+ </For>+ <button+ type="button"+ class="self-start text-xs text-accent hover:text-accent/80"+ onClick={addField}+ >+ + Add another+ </button>+ <button+ type="button"+ class="w-full px-4 py-2 text-sm font-semibold bg-accent text-panel rounded-xs hover:bg-accent/90"+ onClick={handleSend}+ >+ Send Invites+ </button>+ </div>+ </div>+ );+}++export const emailInviteLesson: LessonDefinition = {+ id: 'email-invite',+ title: 'Invite Your Team',+ subtitle: 'Bring your teammates into Macro.',+ content: EmailInviteContent,+ demo: EmailInviteDemo,+ order: 70,+ skippable: true,+};diff --git a/js/app/packages/app/component/interactive-onboarding/lessons/home.tsx b/js/app/packages/app/component/interactive-onboarding/lessons/home.tsxnew file mode 100644index 0000000000..cb2712241f--- /dev/null+++ b/js/app/packages/app/component/interactive-onboarding/lessons/home.tsx@@ -0,0 +1,41 @@+import { createSoupState } from '@app/component/next-soup/create-soup-state';+import { sandboxEntities } from '../sandbox/sandbox-store';+import { onMount } from 'solid-js';+import { OnboardingEntityList } from '../OnboardingEntityList';+import { MockAppChrome } from '../components/MockAppChrome';+import type { LessonContentProps, LessonDefinition } from '../types';++function HomeContent(props: LessonContentProps) {+ onMount(() => setTimeout(() => props.onComplete('Got it')));++ return (+ <div class="flex flex-col gap-3 onboarding-stagger">+ <p>+ The Macro workspace has a the left-hand <strong>Sidebar</strong>+ and <strong>Splits</strong> which can contain{' '}+ <strong>List Views</strong> or content.+ </p>+ </div>+ );+}++function HomeDemo() {+ const soup = createSoupState({+ initialData: sandboxEntities(),+ wrapNavigation: true,+ });++ return (+ <MockAppChrome viewTitle="Documents">+ <OnboardingEntityList soup={soup} />+ </MockAppChrome>+ );+}++export const homeLesson: LessonDefinition = {+ id: 'home',+ title: 'Workspace',+ content: HomeContent,+ demo: HomeDemo,+ order: 1,+};diff --git a/js/app/packages/app/component/interactive-onboarding/lessons/index.ts b/js/app/packages/app/component/interactive-onboarding/lessons/index.tsnew file mode 100644index 0000000000..5bcd0d70ab--- /dev/null+++ b/js/app/packages/app/component/interactive-onboarding/lessons/index.ts@@ -0,0 +1,22 @@+import type { LessonDefinition } from '../types';+import { welcomeLesson } from './welcome';+import { homeLesson } from './home';+import { navigateListLesson } from './navigate-list';+import { commandKLesson } from './command-k';+import { createEntityLesson } from './create-entity';+import { markdownMentionsLesson } from './markdown-mentions';+import { composersPreviewLesson } from './composers-preview';+import { emailInviteLesson } from './email-invite';+import { choosePlanLesson } from './choose-plan';++export const LESSONS: LessonDefinition[] = [+ welcomeLesson,+ homeLesson,+ navigateListLesson,+ commandKLesson,+ createEntityLesson,+ markdownMentionsLesson,+ composersPreviewLesson,+ emailInviteLesson,+ choosePlanLesson,+];diff --git a/js/app/packages/app/component/interactive-onboarding/lessons/markdown-mentions.tsx b/js/app/packages/app/component/interactive-onboarding/lessons/markdown-mentions.tsxnew file mode 100644index 0000000000..78c87d3258--- /dev/null+++ b/js/app/packages/app/component/interactive-onboarding/lessons/markdown-mentions.tsx@@ -0,0 +1,69 @@+import { buildConfig } from '@core/component/LexicalMarkdown/builder/MarkdownConfigBuilder';+import { MarkdownShell } from '@core/component/LexicalMarkdown/builder/MarkdownShell';+import { sandboxToCommandItems, SANDBOX_USERS } from '../sandbox/sandbox-store';+import { createSignal } from 'solid-js';+import { HotkeyCallout } from '../components-lib';+import { MockAppChrome } from '../components/MockAppChrome';+import type { LessonContentProps, LessonDefinition } from '../types';++function MarkdownMentionsContent(_props: LessonContentProps) {+ return (+ <div class="flex flex-col gap-3 onboarding-stagger">+ <HotkeyCallout keys={['@']} label="to mention someone" />+ <p>+ Macro's editor supports rich markdown, mentions, and emoji. Try typing+ something or mentioning a teammate with <strong>@</strong>.+ </p>+ </div>+ );+}++function MarkdownMentionsDemo(props: LessonContentProps) {+ const [mentioned, setMentioned] = createSignal(false);++ const sandboxEntities = () =>+ sandboxToCommandItems().map((item) => ({+ ...item,+ kind: 'entity' as const,+ }));++ const config = buildConfig('markdown')+ .namespace('onboarding-editor')+ .withMentions({+ entities: sandboxEntities,+ users: () => SANDBOX_USERS,+ disableMentionTracking: true,+ onCreate: () => {+ if (!mentioned()) {+ setMentioned(true);+ props.onComplete();+ }+ },+ })+ .withEmojis()+ .withHistory()+ .withSkipPreviewFetch();++ return (+ <MockAppChrome viewTitle="Daily Note">+ <div class="px-8 py-6">+ <h1 class="text-3xl font-semibold text-ink mb-4">Daily Note</h1>+ <MarkdownShell+ config={config}+ placeholder="Start typing... use @ to mention"+ autofocus+ />+ </div>+ </MockAppChrome>+ );+}++export const markdownMentionsLesson: LessonDefinition = {+ id: 'markdown-mentions',+ title: 'Editor',+ subtitle: 'Rich text with mentions and emoji.',+ content: MarkdownMentionsContent,+ demo: MarkdownMentionsDemo,+ order: 50,+ skippable: true,+};diff --git a/js/app/packages/app/component/interactive-onboarding/lessons/navigate-list.tsx b/js/app/packages/app/component/interactive-onboarding/lessons/navigate-list.tsxnew file mode 100644index 0000000000..ac64e7e9a0--- /dev/null+++ b/js/app/packages/app/component/interactive-onboarding/lessons/navigate-list.tsx@@ -0,0 +1,74 @@+import { createSoupState } from '@app/component/next-soup/create-soup-state';+import type { SoupState } from '@app/component/next-soup/create-soup-state';+import { sandboxEntities } from '../sandbox/sandbox-store';+import { createEffect, createSignal, onCleanup, Show } from 'solid-js';+import { OnboardingEntityList } from '../OnboardingEntityList';+import { HotkeyCallout } from '../components-lib';+import type { LessonContentProps, LessonDefinition } from '../types';+import { useListNavigation } from '../use-list-navigation';+import { MockAppChrome } from '../components/MockAppChrome';++const REQUIRED_NAVIGATIONS = 3;++const [sharedSoup, setSharedSoup] = createSignal<SoupState | undefined>();++function NavigateListContent(props: LessonContentProps) {+ const soup = createSoupState({+ initialData: sandboxEntities(),+ wrapNavigation: true,+ });++ setSharedSoup(soup);++ // Keep soup synced with sandbox store (entities created in earlier lesson)+ createEffect(() => {+ soup.setData(sandboxEntities());+ });++ let navCount = 0;++ useListNavigation(soup, props.scopeId, () => {+ navCount++;+ if (navCount >= REQUIRED_NAVIGATIONS) {+ props.onComplete();+ }+ });++ onCleanup(() => {+ setSharedSoup(undefined);+ });++ return (+ <div class="flex flex-col gap-3 onboarding-stagger">+ <HotkeyCallout+ keys={['J', '↓']}+ separator="or"+ label="Move to next item"+ />+ <HotkeyCallout keys={['K', '↑']} separator="or" label="Move back up" />+ </div>+ );+}++function NavigateListDemo() {+ return (+ <MockAppChrome viewTitle="Documents">+ <Show when={sharedSoup()}>+ {(soup) => (+ <div class="h-full overflow-y-auto">+ <OnboardingEntityList soup={soup()} />+ </div>+ )}+ </Show>+ </MockAppChrome>+ );+}++export const navigateListLesson: LessonDefinition = {+ id: 'navigate-list',+ title: 'The List',+ content: NavigateListContent,+ demo: NavigateListDemo,+ order: 20,+ skippable: true,+};diff --git a/js/app/packages/app/component/interactive-onboarding/lessons/welcome.tsx b/js/app/packages/app/component/interactive-onboarding/lessons/welcome.tsxnew file mode 100644index 0000000000..07fec28d91--- /dev/null+++ b/js/app/packages/app/component/interactive-onboarding/lessons/welcome.tsx@@ -0,0 +1,22 @@+import { onMount } from 'solid-js';+import type { LessonContentProps, LessonDefinition } from '../types';++function WelcomeContent(props: LessonContentProps) {+ onMount(() => props.onComplete('Get Started'));++ return (+ <div class="flex flex-col gap-3 onboarding-stagger">+ <p>+ Macro is a powerful, keyboard-first workspace. Let's learn a few core+ features.+ </p>+ </div>+ );+}++export const welcomeLesson: LessonDefinition = {+ id: 'welcome',+ title: 'Welcome to Macro',+ content: WelcomeContent,+ order: 0,+};diff --git a/js/app/packages/app/component/interactive-onboarding/persistence.ts b/js/app/packages/app/component/interactive-onboarding/persistence.tsnew file mode 100644index 0000000000..92479bb81d--- /dev/null+++ b/js/app/packages/app/component/interactive-onboarding/persistence.ts@@ -0,0 +1,25 @@+import type { LessonId } from './types';++const STORAGE_KEY = 'macro:onboarding:completed';++export function loadCompletedLessons(): Set<LessonId> {+ try {+ const raw = localStorage.getItem(STORAGE_KEY);+ if (!raw) return new Set();+ const parsed: unknown = JSON.parse(raw);+ if (!Array.isArray(parsed)) return new Set();+ return new Set(parsed.filter((v): v is string => typeof v === 'string'));+ } catch {+ return new Set();+ }+}++export function saveCompletedLesson(id: LessonId): void {+ const current = loadCompletedLessons();+ current.add(id);+ localStorage.setItem(STORAGE_KEY, JSON.stringify([...current]));+}++export function clearCompletedLessons(): void {+ localStorage.removeItem(STORAGE_KEY);+}diff --git a/js/app/packages/app/component/interactive-onboarding/sandbox/sandbox-store.ts b/js/app/packages/app/component/interactive-onboarding/sandbox/sandbox-store.tsnew file mode 100644index 0000000000..676b27b2b3--- /dev/null+++ b/js/app/packages/app/component/interactive-onboarding/sandbox/sandbox-store.ts@@ -0,0 +1,297 @@+import type { EntityData } from '@entity';+import type { IUser } from '@core/user/types';+import {+ MOCK_DOCUMENT_BASIC,+ MOCK_EMAIL_UNREAD,+ MOCK_TASK_TODO,+ MOCK_CHANNEL_PUBLIC,+ MOCK_PROJECT_1,+} from '../../../../entity/mocks/mockEntityData';+import { createSignal } from 'solid-js';++const now = new Date();++function seedDoc(id: string, name: string, fileType = 'md'): EntityData {+ return {+ type: 'document',+ id,+ name,+ ownerId: 'sandbox',+ fileType,+ createdAt: now,+ updatedAt: now,+ frecencyScore: 1,+ };+}+function seedTask(id: string, name: string): EntityData {+ return {+ type: 'document',+ id,+ name,+ ownerId: 'sandbox',+ fileType: 'md',+ subType: { type: 'task', is_completed: false },+ createdAt: now,+ updatedAt: now,+ frecencyScore: 1,+ };+}+function seedEmail(+ id: string,+ name: string,+ senderName: string,+ senderEmail: string+): EntityData {+ return {+ type: 'email',+ id,+ name,+ ownerId: 'sandbox',+ isRead: false,+ isDraft: false,+ isImportant: false,+ done: false,+ senderEmail,+ senderName,+ snippet: '',+ participants: [],+ createdAt: now,+ updatedAt: now,+ frecencyScore: 1,+ };+}+function seedChannel(id: string, name: string): EntityData {+ return {+ type: 'channel',+ id,+ name,+ ownerId: 'sandbox',+ channelType: 'public',+ createdAt: now,+ updatedAt: now,+ frecencyScore: 1,+ };+}+function seedProject(id: string, name: string): EntityData {+ return {+ type: 'project',+ id,+ name,+ ownerId: 'sandbox',+ createdAt: now,+ updatedAt: now,+ frecencyScore: 1,+ };+}+function seedChat(id: string, name: string): EntityData {+ return {+ type: 'chat',+ id,+ name,+ ownerId: 'sandbox',+ createdAt: now,+ updatedAt: now,+ frecencyScore: 1,+ };+}++const SEED_ENTITIES: EntityData[] = [+ MOCK_PROJECT_1,+ seedDoc('seed_doc_1', 'Q3 Product Roadmap'),+ seedTask('seed_task_1', 'Review design mockups'),+ seedEmail(+ 'seed_email_1',+ 'Re: Launch checklist',+ 'Sarah Chen',+ ),+ seedChannel('seed_channel_1', 'engineering'),+ seedDoc('seed_doc_2', 'Architecture Decision Record'),+ seedTask('seed_task_2', 'Write release notes'),+ seedProject('seed_project_2', 'Website Redesign'),+ seedChat('seed_chat_1', 'Brainstorm: onboarding flow'),+ seedEmail(+ 'seed_email_2',+ 'Budget approval needed',+ 'Marcus Lee',+ ),+ seedDoc('seed_doc_3', 'Meeting Notes — All Hands'),+ seedTask('seed_task_3', 'Set up CI pipeline'),+ seedChannel('seed_channel_2', 'design'),+ seedDoc('seed_doc_4', 'Customer Interview Summary', 'canvas'),+ seedEmail(+ 'seed_email_3',+ 'Investor update Q3',+ 'Jordan Rivera',+ ),+ seedTask('seed_task_4', 'Fix login page regression'),+ seedProject('seed_project_3', 'Mobile App v2'),+ seedDoc('seed_doc_5', 'API Reference', 'py'),+ seedChat('seed_chat_2', 'Draft: pricing page copy'),+ seedChannel('seed_channel_3', 'announcements'),+ seedEmail(+ 'seed_email_4',+ 'Contract renewal — action required',+ 'Alex Kim',+ ),+ seedTask('seed_task_5', 'Update dependencies'),+ seedDoc('seed_doc_6', 'Brand Guidelines'),+ seedTask('seed_task_6', 'Schedule user research sessions'),+ MOCK_DOCUMENT_BASIC,+ MOCK_EMAIL_UNREAD,+ MOCK_TASK_TODO,+ MOCK_CHANNEL_PUBLIC,+];++const [entities, setEntities] = createSignal<EntityData[]>([...SEED_ENTITIES]);++let entityCounter = 0;++export function sandboxEntities() {+ return entities();+}++export function addSandboxEntity(entity: EntityData) {+ setEntities((prev) => [entity, ...prev]);+}++export type SandboxEntityType =+ | 'md'+ | 'email'+ | 'task'+ | 'channel'+ | 'chat'+ | 'canvas'+ | 'project'+ | 'code';++const SAMPLE_NAMES: Record<SandboxEntityType, string> = {+ md: 'My Sample Document',+ email: 'My Sample Email Draft',+ task: 'My Sample Task',+ channel: 'My Sample Message',+ chat: 'My Sample Agent Chat',+ canvas: 'My Sample Canvas',+ project: 'My Sample Folder',+ code: 'My Sample Code File',+};++export function createSandboxEntity(type: SandboxEntityType): EntityData {+ entityCounter++;+ const id = `sandbox_${type}_${entityCounter}`;+ const base = {+ id,+ name: SAMPLE_NAMES[type],+ ownerId: 'sandbox',+ createdAt: new Date(),+ updatedAt: new Date(),+ frecencyScore: 1,+ };++ switch (type) {+ case 'md':+ return { ...base, type: 'document', fileType: 'md' };+ case 'canvas':+ return { ...base, type: 'document', fileType: 'canvas' };+ case 'code':+ return { ...base, type: 'document', fileType: 'py' };+ case 'task':+ return {+ ...base,+ type: 'document',+ fileType: 'md',+ subType: { type: 'task', is_completed: false },+ };+ case 'email':+ return {+ ...base,+ type: 'email',+ isRead: false,+ isDraft: true,+ isImportant: false,+ done: false,+ senderEmail: '[email protected]',+ senderName: 'You',+ snippet: '',+ participants: [],+ };+ case 'channel':+ return { ...base, type: 'channel', channelType: 'public' };+ case 'chat':+ return { ...base, type: 'chat' };+ case 'project':+ return { ...base, type: 'project' };+ }+}++export function resetSandbox() {+ entityCounter = 0;+ setEntities([...SEED_ENTITIES]);+}++// -- Command menu helpers --++type EntityBucketType =+ | 'note'+ | 'task'+ | 'email'+ | 'channel'+ | 'chat'+ | 'project'+ | 'dm'+ | 'document';++function entityToBucket(entity: EntityData): EntityBucketType {+ switch (entity.type) {+ case 'document':+ return entity.subType?.type === 'task' ? 'task' : 'note';+ case 'email':+ return 'email';+ case 'channel':+ return 'channel';+ case 'chat':+ return 'chat';+ case 'project':+ return 'project';+ default:+ return 'note';+ }+}++// -- Sandbox contacts --++export const SANDBOX_USERS: IUser[] = [+ { id: 'user_1', name: 'Sarah Chen', email: '[email protected]' },+ { id: 'user_2', name: 'Marcus Lee', email: '[email protected]' },+ { id: 'user_3', name: 'Jordan Rivera', email: '[email protected]' },+ { id: 'user_4', name: 'Alex Kim', email: '[email protected]' },+ { id: 'user_5', name: 'Priya Patel', email: '[email protected]' },+ { id: 'user_6', name: 'David Okafor', email: '[email protected]' },+ { id: 'user_7', name: 'Emily Zhang', email: '[email protected]' },+ { id: 'user_8', name: 'Carlos Ruiz', email: '[email protected]' },+ { id: 'user_9', name: 'Aisha Mohammed', email: '[email protected]' },+ { id: 'user_10', name: 'Tom Brennan', email: '[email protected]' },+ { id: 'user_11', name: 'Yuki Tanaka', email: '[email protected]' },+ { id: 'user_12', name: 'Fatima Al-Hassan', email: '[email protected]' },+ { id: 'user_13', name: 'Liam Murphy', email: '[email protected]' },+ { id: 'user_14', name: 'Sofia Andersson', email: '[email protected]' },+ { id: 'user_15', name: 'Raj Gupta', email: '[email protected]' },+];++export function sandboxToCommandItems() {+ return sandboxEntities().map((entity) => ({+ id: entity.id,+ kind: 'entity' as const,+ bucket: entityToBucket(entity),+ searchText: entity.name,+ sortTimestamp:+ entity.updatedAt instanceof Date+ ? entity.updatedAt.getTime()+ : new Date(entity.updatedAt ?? Date.now()).getTime(),+ timestamps: { updatedAt: entity.updatedAt ?? null },+ data: entity,+ }));+}diff --git a/js/app/packages/app/component/interactive-onboarding/types.ts b/js/app/packages/app/component/interactive-onboarding/types.tsnew file mode 100644index 0000000000..d076969a98--- /dev/null+++ b/js/app/packages/app/component/interactive-onboarding/types.ts@@ -0,0 +1,31 @@+import type { Component } from 'solid-js';++export type LessonId = string;++export interface LessonDefinition {+ id: LessonId;+ title: string;+ subtitle?: string;+ content: Component<LessonContentProps>;+ /** Optional component rendered in the right demo panel. When omitted the Macro logo is shown. */+ demo?: Component<LessonContentProps>;+ order?: number;+ /** Whether the user can skip this lesson. Defaults to false. */+ skippable?: boolean;+}++export interface LessonContentProps {+ /** Call when the user has demonstrated understanding. Pass a string to customise the "Get Started" button label. */+ onComplete: (buttonLabel?: string) => void;+ /** Whether this lesson is currently visible */+ isActive: boolean;+ /** Hotkey scope ID from the shell — register all lesson hotkeys into this scope */+ scopeId: string;+}++export interface LessonState {+ definition: LessonDefinition;+ completed: boolean;+ skipped: boolean;+ index: number;+}diff --git a/js/app/packages/app/component/interactive-onboarding/use-list-navigation.ts b/js/app/packages/app/component/interactive-onboarding/use-list-navigation.tsnew file mode 100644index 0000000000..2a1a2a1f40--- /dev/null+++ b/js/app/packages/app/component/interactive-onboarding/use-list-navigation.ts@@ -0,0 +1,44 @@+import { createHotkeyGroup, registerHotkey } from '@core/hotkey/hotkeys';+import type { SoupState } from '@app/component/next-soup/create-soup-state';+import { onCleanup, onMount } from 'solid-js';++/**+ * Registers J / ↓ and K / ↑ navigation hotkeys into the given scope for the+ * provided soup state. Call this in any component that renders a navigable list+ * so keyboard navigation is always available while the list is visible.+ *+ * @param soup The soup state to navigate+ * @param scopeId The hotkey scope to register into (use the shell's scopeId)+ * @param onNavigate Optional callback fired after each navigation step+ */+export function useListNavigation(+ soup: SoupState,+ scopeId: string,+ onNavigate?: (direction: 'down' | 'up') => void+) {+ const group = createHotkeyGroup();++ onMount(() => {+ const handle = (direction: 'down' | 'up') => {+ soup.navigate[direction]();+ onNavigate?.(direction);+ return true;+ };++ registerHotkey({+ scopeId,+ hotkey: ['j', 'arrowdown'],+ description: 'Navigate down',+ keyDownHandler: () => handle('down'),+ }).withGroup(group);++ registerHotkey({+ scopeId,+ hotkey: ['k', 'arrowup'],+ description: 'Navigate up',+ keyDownHandler: () => handle('up'),+ }).withGroup(group);+ });++ onCleanup(() => group.dispose());+}diff --git a/js/app/packages/app/component/split-layout/componentRegistry.tsx b/js/app/packages/app/component/split-layout/componentRegistry.tsxindex 5f2d7484ad..2858c26776 100644--- a/js/app/packages/app/component/split-layout/componentRegistry.tsx+++ b/js/app/packages/app/component/split-layout/componentRegistry.tsx@@ -236,6 +236,12 @@ registerComponent();registerComponent('settings', () => <SettingsPanelComponentWrapper />);registerComponent('notification', () => <NotificationRoute />);+registerComponent(+ 'welcome',+ lazy(+ () => import('@app/component/interactive-onboarding/InteractiveOnboarding')+ )+);if (LOCAL_ONLY) {registerComponent(diff --git a/js/app/packages/block-canvas/component/CanvasRenderer.tsx b/js/app/packages/block-canvas/component/CanvasRenderer.tsxindex bedcd81bf6..788c3fcc1e 100644--- a/js/app/packages/block-canvas/component/CanvasRenderer.tsx+++ b/js/app/packages/block-canvas/component/CanvasRenderer.tsx@@ -179,7 +179,7 @@ export function CanvasRenderer() {lineSelection: lineSelectionLayerRef,})}>- <div class="absolute inset-0 w-full h-full pointer-events-none">+ <div class="absolute inset-0 w-full h-full pointer-events-none bracket-never"><DotPattern scale={scale} x={canvasX} y={canvasY} /></div>diff --git a/js/app/packages/core/component/LexicalMarkdown/builder/MarkdownConfigBuilder.ts b/js/app/packages/core/component/LexicalMarkdown/builder/MarkdownConfigBuilder.tsindex d9b6552b5f..3d35d50b37 100644--- a/js/app/packages/core/component/LexicalMarkdown/builder/MarkdownConfigBuilder.ts+++ b/js/app/packages/core/component/LexicalMarkdown/builder/MarkdownConfigBuilder.ts@@ -37,6 +37,7 @@ export class EditorConfigBuilder implements EditorBuilder {withIds: false,selectionData: false,actions: false as const,+ skipPreviewFetch: false,};}@@ -108,6 +109,12 @@ export class EditorConfigBuilder implements EditorBuilder {return this;}+ /** Skip backend fetches in decorator components (e.g. mention preview API). */+ withSkipPreviewFetch(): this {+ this.state.skipPreviewFetch = true;+ return this;+ }+withActions(config: ActionsOptions = {}): this {this.state.actions = config;return this;diff --git a/js/app/packages/core/component/LexicalMarkdown/builder/MarkdownShell.tsx b/js/app/packages/core/component/LexicalMarkdown/builder/MarkdownShell.tsxindex 77b28625f2..451e145b4d 100644--- a/js/app/packages/core/component/LexicalMarkdown/builder/MarkdownShell.tsx+++ b/js/app/packages/core/component/LexicalMarkdown/builder/MarkdownShell.tsx@@ -235,6 +235,11 @@ export const MarkdownShell: Component<useSnapshotForDocuments={builderConfig.mentions?.useSnapshotForDocuments}+ entities={builderConfig.mentions?.entities}+ users={builderConfig.mentions?.users}+ disableMentionTracking={+ builderConfig.mentions?.disableMentionTracking+ }/>)}</Show>diff --git a/js/app/packages/core/component/LexicalMarkdown/builder/buildHandleFromConfig.ts b/js/app/packages/core/component/LexicalMarkdown/builder/buildHandleFromConfig.tsindex f408a8533c..ca5fad49b3 100644--- a/js/app/packages/core/component/LexicalMarkdown/builder/buildHandleFromConfig.ts+++ b/js/app/packages/core/component/LexicalMarkdown/builder/buildHandleFromConfig.ts@@ -56,6 +56,10 @@ export function buildHandleFromConfig(config: EditorConfig): EditorHandle {isInteractable,});+ if (config.skipPreviewFetch) {+ lexicalWrapper.skipPreviewFetch = true;+ }+const { editor, plugins, cleanup: cleanupLexical } = lexicalWrapper;const [markdownState, setMarkdownState] = createSignal<string>('');diff --git a/js/app/packages/core/component/LexicalMarkdown/builder/types.ts b/js/app/packages/core/component/LexicalMarkdown/builder/types.tsindex 97f934057a..2a44d60b7a 100644--- a/js/app/packages/core/component/LexicalMarkdown/builder/types.ts+++ b/js/app/packages/core/component/LexicalMarkdown/builder/types.ts@@ -24,6 +24,12 @@ export interface MentionsOptions {showOpenTabs?: boolean;useSnapshotForDocuments?: boolean;sourceDocumentId?: string;+ /** Override entity data source (e.g. sandbox data for onboarding). Bypasses quickAccess. */+ entities?: () => import('@core/context/quickAccess').EntityItem[];+ /** Override users data source (e.g. sandbox contacts for onboarding). */+ users?: () => import('@core/user/types').IUser[];+ /** Skip backend mention tracking (e.g. for sandbox/onboarding). */+ disableMentionTracking?: boolean;}/** Intentional extension point — no options yet. */@@ -117,6 +123,8 @@ export interface EditorConfig {withIds: boolean;selectionData: boolean;actions: ActionsOptions | false;+ /** When true, decorator components skip backend fetches (e.g. preview API). */+ skipPreviewFetch: boolean;}/** @internal consumed by MarkdownShell; do not access directly */diff --git a/js/app/packages/core/component/LexicalMarkdown/component/decorator/DocumentMention.tsx b/js/app/packages/core/component/LexicalMarkdown/component/decorator/DocumentMention.tsxindex 9b0c985af7..7ecfa1a27e 100644--- a/js/app/packages/core/component/LexicalMarkdown/component/decorator/DocumentMention.tsx+++ b/js/app/packages/core/component/LexicalMarkdown/component/decorator/DocumentMention.tsx@@ -4,6 +4,7 @@ import {useMaybeBlockId,useMaybeBlockName,} from '@core/block';+import { EntityIcon } from '@core/component/EntityIcon';import {getMentionsIcon,mentionsAccessories,@@ -165,6 +166,10 @@ function InlinePreview(props: {}export function DocumentMention(props: DocumentMentionDecoratorProps) {+ const lexicalWrapper = useContext(LexicalWrapperContext);+ if (lexicalWrapper?.skipPreviewFetch) {+ return <DocumentMentionStatic {...props} />;+ }return (<Suspense><DocumentMentionInner {...props} />@@ -172,6 +177,25 @@ export function DocumentMention(props: DocumentMentionDecoratorProps) {);}+/** Lightweight mention display that skips all backend fetches. Uses only the stored name. */+function DocumentMentionStatic(props: DocumentMentionDecoratorProps) {+ return (+ <MentionContainer+ icon={<EntityIcon targetType={props.blockName as any} size="fill" />}+ text={+ <span+ data-document-mention="true"+ data-document-id={props.documentId}+ data-block-name={props.blockName}+ data-document-name={props.documentName}+ >+ {props.documentName ?? props.documentId}+ </span>+ }+ />+ );+}+export function DocumentMentionInner(props: DocumentMentionDecoratorProps) {const currentBlockId = useMaybeBlockId();const currentBlockName = useMaybeBlockName();diff --git a/js/app/packages/core/component/LexicalMarkdown/component/menu/MentionsMenu/MentionsMenu.tsx b/js/app/packages/core/component/LexicalMarkdown/component/menu/MentionsMenu/MentionsMenu.tsxindex eac374602d..51ae08a7a8 100644--- a/js/app/packages/core/component/LexicalMarkdown/component/menu/MentionsMenu/MentionsMenu.tsx+++ b/js/app/packages/core/component/LexicalMarkdown/component/menu/MentionsMenu/MentionsMenu.tsx@@ -42,7 +42,10 @@ import { MentionsMenuItem } from './components/MentionsMenuItem';import { createItemHandler } from './utils/mentionHandlers';import { useMenuKeyboardNavigation } from '../useMenuKeyboardNavigation';import { useUsersMention } from './hooks/useUsersMention';-import { useEntityMention } from './hooks/useEntityMention';+import {+ useEntityMention,+ useEntityMentionFromList,+} from './hooks/useEntityMention';import { useEmailSearchMention } from './hooks/useEmailSearchMention';import { isMobile } from '@core/mobile/isMobile';@@ -56,6 +59,8 @@ export type MentionsMenuProps = {menu: MenuOperations;/** pass in a custom users list if necessary */users?: Accessor<IUser[]>;+ /** pass in custom entity items to replace quickAccess data (e.g. sandbox data for onboarding) */+ entities?: Accessor<EntityItem[]>;/** whether the menu checks against block boundary in floating middleware. uses floating-ui default if false. */useBlockBoundary?: boolean;portalScope?: PortalScope;@@ -81,9 +86,11 @@ export function MentionsMenu(props: MentionsMenuProps) {function MentionsMenuInner(props: MentionsMenuProps) {const searchTerm = debouncedDependent(props.menu.searchTerm, 60);- const quickAccess = useQuickAccess();+ const hasCustomEntities = () => !!props.entities;++ const quickAccess = hasCustomEntities() ? undefined : useQuickAccess();- const allItems = quickAccess.useList();+ const allItems = props.entities ?? quickAccess!.useList();const { isKeypressActive } = useIsKeyPressActive();@@ -96,21 +103,50 @@ function MentionsMenuInner(props: MentionsMenuProps) {blockId: useMaybeBlockId(),});- const { searchedEntities: docs } = useEntityMention({- buckets: ['note', 'task', 'document', 'project', 'chat'],- searchTerm,- });+ const customDocs = props.entities+ ? useEntityMentionFromList({+ items: props.entities,+ buckets: ['note', 'task', 'document', 'project', 'chat'],+ searchTerm,+ })+ : undefined;- const { searchedEntities: channels } = useEntityMention({- buckets: ['channel'],- searchTerm,- });+ const customChannels = props.entities+ ? useEntityMentionFromList({+ items: props.entities,+ buckets: ['channel'],+ searchTerm,+ })+ : undefined;- const { emails, emailSearchQuery: emailUnifiedSearchInfiniteQuery } =- useEmailSearchMention({+ const { searchedEntities: docs } =+ customDocs ??+ useEntityMention({+ buckets: ['note', 'task', 'document', 'project', 'chat'],+ searchTerm,+ });++ const { searchedEntities: channels } =+ customChannels ??+ useEntityMention({+ buckets: ['channel'],searchTerm,});+ const { emails, emailSearchQuery: emailUnifiedSearchInfiniteQuery } =+ hasCustomEntities()+ ? {+ emails: () => [],+ emailSearchQuery: {+ hasNextPage: false,+ isFetching: false,+ fetchNextPage: () => {},+ } as any,+ }+ : useEmailSearchMention({+ searchTerm,+ });+const dateOptions = useDateSearch({ query: searchTerm });const dates = createLazyMemo((): DateMentionItem[] => {return dateOptions().map(diff --git a/js/app/packages/core/component/LexicalMarkdown/component/menu/MentionsMenu/hooks/useEntityMention.ts b/js/app/packages/core/component/LexicalMarkdown/component/menu/MentionsMenu/hooks/useEntityMention.tsindex 9ccc786e27..29452eb055 100644--- a/js/app/packages/core/component/LexicalMarkdown/component/menu/MentionsMenu/hooks/useEntityMention.ts+++ b/js/app/packages/core/component/LexicalMarkdown/component/menu/MentionsMenu/hooks/useEntityMention.ts@@ -49,3 +49,42 @@ export function useEntityMention(allEntities: entitiesList,};}++export type UseEntityMentionFromListOptions = {+ items: Accessor<EntityItem[]>;+ searchTerm: Accessor<string>;+ buckets: EntityBucket[];+};++/**+ * Like useEntityMention but takes a pre-built list of EntityItems+ * instead of reading from quickAccess. Useful for sandbox/onboarding scenarios.+ */+export function useEntityMentionFromList(+ options: UseEntityMentionFromListOptions+): UseEntityMentionResult {+ const { items, searchTerm, buckets } = options;+ const bucketSet = new Set<string>(buckets);++ const entitiesList = createLazyMemo(() =>+ items().filter((item) => bucketSet.has(item.bucket))+ );++ const entitySearch = createFreshSearch<EntityItem>({+ config: { useViewedAt: true },+ getName: (item) => item.searchText,+ isChannelItem: (item) => item.bucket === 'channel',+ getTimestamp: (item) => item.timestamps,+ });++ const entities = createLazyMemo(() => {+ const term = searchTerm();+ if (!term) return entitiesList();+ return entitySearch(entitiesList(), term).map(({ item }) => item);+ });++ return {+ searchedEntities: entities,+ allEntities: entitiesList,+ };+}diff --git a/js/app/packages/core/component/LexicalMarkdown/context/LexicalWrapperContext.tsx b/js/app/packages/core/component/LexicalMarkdown/context/LexicalWrapperContext.tsxindex 2c17e81517..c34b2ee15f 100644--- a/js/app/packages/core/component/LexicalMarkdown/context/LexicalWrapperContext.tsx+++ b/js/app/packages/core/component/LexicalMarkdown/context/LexicalWrapperContext.tsx@@ -41,6 +41,8 @@ export type LexicalWrapperBase = {cleanup: () => void;isInteractable: () => boolean;selection?: Store<SelectionData>;+ /** When true, decorator components should skip backend fetches (e.g. preview API). */+ skipPreviewFetch?: boolean;};export type LexicalWrapperWithMapping = LexicalWrapperBase & {diff --git a/js/app/packages/macro-entity/src/components/Provider.tsx b/js/app/packages/macro-entity/src/components/Provider.tsxindex 8f2b4b48fd..64b7808f2a 100644--- a/js/app/packages/macro-entity/src/components/Provider.tsx+++ b/js/app/packages/macro-entity/src/components/Provider.tsx@@ -1,7 +1,5 @@import { QueryClientProvider } from '@tanstack/solid-query';-import { SolidQueryDevtools } from '@tanstack/solid-query-devtools';-import { LOCAL_ONLY } from '@core/constant/featureFlags';-import { Show, type ParentProps } from 'solid-js';+import type { ParentProps } from 'solid-js';import { fetchApiToken } from '../queries/auth';import { queryClient } from '@queries/client';import { queryKeys } from '../queries/key';@@ -19,9 +17,9 @@ export function Provider(props: ParentProps) {return (<QueryClientProvider client={queryClient}>{props.children}- <Show when={LOCAL_ONLY}>+ {/* <Show when={LOCAL_ONLY}><SolidQueryDevtools initialIsOpen={false} />- </Show>+ </Show> */}</QueryClientProvider>);}diff --git a/js/app/packages/queries/auth/tutorial.ts b/js/app/packages/queries/auth/tutorial.tsnew file mode 100644index 0000000000..ec43f4f316--- /dev/null+++ b/js/app/packages/queries/auth/tutorial.ts@@ -0,0 +1,31 @@+import { throwOnErr } from '@core/util/maybeResult';+import { authServiceClient } from '@service-auth/client';+import { useMutation } from '@tanstack/solid-query';+import { type MutationCallbacks, withCallbacks } from '../utils';+import { queryClient } from '../client';+import { authKeys } from './keys';++type CompleteTutorialCallbacks = MutationCallbacks<void, Error, void>;++export function useCompleteTutorialMutation(+ callbacks?: CompleteTutorialCallbacks+) {+ return useMutation(() => ({+ mutationFn: async () => {+ await throwOnErr(+ async () =>+ await authServiceClient.patchUserTutorial({ tutorialComplete: true })+ );+ },+ ...withCallbacks<void, Error, void>(+ {+ onSuccess: () => {+ queryClient.invalidateQueries({+ queryKey: authKeys.userInfo.queryKey,+ });+ },+ },+ callbacks+ ),+ }));+}