@arbidocs/react 0.4.4 → 0.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -0
- package/dist/artifacts/index.cjs +458 -0
- package/dist/artifacts/index.cjs.map +1 -0
- package/dist/artifacts/index.d.cts +276 -0
- package/dist/artifacts/index.d.ts +276 -0
- package/dist/artifacts/index.js +434 -0
- package/dist/artifacts/index.js.map +1 -0
- package/dist/artifacts/redline-core.cjs +20 -0
- package/dist/artifacts/redline-core.cjs.map +1 -0
- package/dist/artifacts/redline-core.d.cts +36 -0
- package/dist/artifacts/redline-core.d.ts +36 -0
- package/dist/artifacts/redline-core.js +3 -0
- package/dist/artifacts/redline-core.js.map +1 -0
- package/dist/chunk-2DXS7L7M.cjs +302 -0
- package/dist/chunk-2DXS7L7M.cjs.map +1 -0
- package/dist/{chunk-ORKGCXG3.cjs → chunk-7BDGLRQX.cjs} +123 -427
- package/dist/chunk-7BDGLRQX.cjs.map +1 -0
- package/dist/chunk-7V7B7OEM.cjs +318 -0
- package/dist/chunk-7V7B7OEM.cjs.map +1 -0
- package/dist/{chunk-MIJRORQL.js → chunk-DVRJFLE7.js} +8 -302
- package/dist/chunk-DVRJFLE7.js.map +1 -0
- package/dist/{chunk-EJ2BMHYK.js → chunk-FSMIN5VX.js} +4 -3
- package/dist/chunk-FSMIN5VX.js.map +1 -0
- package/dist/chunk-H7ZZQ4ZV.js +305 -0
- package/dist/chunk-H7ZZQ4ZV.js.map +1 -0
- package/dist/{chunk-JKO3NR5L.js → chunk-HDCRPPBW.js} +5 -23
- package/dist/chunk-HDCRPPBW.js.map +1 -0
- package/dist/chunk-J4MX2W4H.js +26 -0
- package/dist/chunk-J4MX2W4H.js.map +1 -0
- package/dist/{chunk-6ALMBER7.js → chunk-N5SVBDLC.js} +4 -9
- package/dist/chunk-N5SVBDLC.js.map +1 -0
- package/dist/{chunk-RZQACYNQ.cjs → chunk-OBNTJEEO.cjs} +14 -20
- package/dist/chunk-OBNTJEEO.cjs.map +1 -0
- package/dist/{chunk-BXP6S34V.cjs → chunk-PGLV23SB.cjs} +13 -12
- package/dist/chunk-PGLV23SB.cjs.map +1 -0
- package/dist/chunk-RKWNX32A.js +299 -0
- package/dist/chunk-RKWNX32A.js.map +1 -0
- package/dist/chunk-S6A6FSG7.cjs +13 -0
- package/dist/chunk-S6A6FSG7.cjs.map +1 -0
- package/dist/chunk-SN5YV6FF.js +11 -0
- package/dist/chunk-SN5YV6FF.js.map +1 -0
- package/dist/{chunk-7IOCMCC5.cjs → chunk-TMPDW7J5.cjs} +3 -23
- package/dist/chunk-TMPDW7J5.cjs.map +1 -0
- package/dist/chunk-VJWAP2HJ.cjs +303 -0
- package/dist/chunk-VJWAP2HJ.cjs.map +1 -0
- package/dist/chunk-ZMTLGO3K.cjs +29 -0
- package/dist/chunk-ZMTLGO3K.cjs.map +1 -0
- package/dist/chunk-ZY53R6I4.js +276 -0
- package/dist/chunk-ZY53R6I4.js.map +1 -0
- package/dist/index.cjs +497 -690
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +17 -282
- package/dist/index.js.map +1 -1
- package/dist/shell/index.cjs +8 -7
- package/dist/shell/index.js +3 -2
- package/dist/ui/index.cjs +156 -154
- package/dist/ui/index.js +4 -2
- package/dist/viewers/index.cjs +9 -8
- package/dist/viewers/index.cjs.map +1 -1
- package/dist/viewers/index.js +3 -2
- package/dist/viewers/index.js.map +1 -1
- package/package.json +19 -3
- package/dist/chunk-6ALMBER7.js.map +0 -1
- package/dist/chunk-7IOCMCC5.cjs.map +0 -1
- package/dist/chunk-BXP6S34V.cjs.map +0 -1
- package/dist/chunk-EJ2BMHYK.js.map +0 -1
- package/dist/chunk-JKO3NR5L.js.map +0 -1
- package/dist/chunk-MIJRORQL.js.map +0 -1
- package/dist/chunk-ORKGCXG3.cjs.map +0 -1
- package/dist/chunk-RZQACYNQ.cjs.map +0 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent,
|
|
1
|
+
import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem, ScrollArea } from './chunk-N5SVBDLC.js';
|
|
2
|
+
import { cn } from './chunk-SN5YV6FF.js';
|
|
2
3
|
import { Toaster as Toaster$1, toast } from 'sonner';
|
|
3
4
|
export { toast } from 'sonner';
|
|
4
5
|
import { create } from 'zustand';
|
|
@@ -268,5 +269,5 @@ function Toaster({ toastOptions, ...props }) {
|
|
|
268
269
|
}
|
|
269
270
|
|
|
270
271
|
export { DEFAULT_NOTIFY_TONE, NotificationBell, Toaster, formatRelativeTime, notify, seedNotifications, selectUnread, useNotify };
|
|
271
|
-
//# sourceMappingURL=chunk-
|
|
272
|
-
//# sourceMappingURL=chunk-
|
|
272
|
+
//# sourceMappingURL=chunk-FSMIN5VX.js.map
|
|
273
|
+
//# sourceMappingURL=chunk-FSMIN5VX.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/notifications/notify-store.ts","../src/lib/format-relative-time.ts","../src/notifications/NotificationBell.tsx","../src/notifications/Toaster.tsx"],"names":["jsx","Sonner"],"mappings":";;;;;;;;AA+EA,IAAI,GAAA,GAAM,CAAA;AACV,IAAM,GAAA,GAAM,MAAM,CAAA,CAAA,EAAI,IAAA,CAAK,GAAA,EAAI,CAAE,QAAA,CAAS,EAAE,CAAC,CAAA,EAAA,CAAI,GAAA,EAAA,EAAO,QAAA,CAAS,EAAE,CAAC,CAAA,CAAA;AAE7D,IAAM,SAAA,GAAY,MAAA,CAAoB,CAAC,GAAA,MAAS;AAAA,EACrD,eAAe,EAAC;AAAA,EAChB,QAAA,EAAU,CAAC,EAAA,KACT,GAAA,CAAI,CAAC,CAAA,MAAO;AAAA,IACV,aAAA,EAAe,CAAA,CAAE,aAAA,CAAc,GAAA,CAAI,CAAC,CAAA,KAAO,CAAA,CAAE,EAAA,KAAO,EAAA,GAAK,EAAE,GAAG,CAAA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MACV,cAAc,YAAA,IAAgB,qBAAA;AAAA,MAC7B,GAAG;AAAA;AAAA,GACN;AAEJ","file":"chunk-FSMIN5VX.js","sourcesContent":["/**\n * App notification store — the one shared toast + notification-centre. A single\n * `notify.*` call pops a transient toast (rendered by <Toaster/>, on sonner) and,\n * unless `{ record: false }`, records a persistent entry for the topbar bell.\n *\n * notify.success('Saved') // toast + centre entry\n * notify.error('Upload failed', { record: false }) // toast only\n *\n * sonner owns the transient toast lifecycle (stacking, timing, dismissal); this\n * store owns only the persistent centre history (what the <NotificationBell/>\n * shows). Brand-neutral: no seed data (inject via `seedNotifications`), no app\n * imports. For full sonner power (custom content, `toast.dismiss`, …) the raw\n * `toast` is re-exported.\n */\nimport { type ReactNode } from 'react'\n// This module IS the sanctioned toast engine home — the app-level rule that\n// steers callers to sendNotification()/notify() doesn't apply here.\n// eslint-disable-next-line no-restricted-imports\nimport { toast } from 'sonner'\nimport { create } from 'zustand'\n\nexport { toast }\n\nexport type NotifyVariant = 'success' | 'error' | 'info' | 'warning'\n\nexport interface AppNotification {\n id: string\n title: string\n description?: string\n variant: NotifyVariant\n /** Epoch ms the entry was recorded. */\n ts: number\n read: boolean\n /** Optional in-app link the entry deep-links to (passed to the bell's onNavigate). */\n href?: string\n /** Optional click action — wins over `href` when both are present. Session\n * history only; entries are never serialized, so a closure is safe here. */\n onSelect?: () => void\n /** Routine session activity (\"Opening workspace…\", \"Saved\") — kept for the\n * log but not something that demands attention: excluded from the unread\n * badge and from the bell's default list (shown under \"All activity\"). */\n ambient?: boolean\n /** Where the entry comes from. Session entries (`record`) have none; a\n * backend bridge stamps its own (e.g. 'server') so {@link syncSource} can\n * replace exactly its slice on every refetch without touching the rest. */\n source?: string\n}\n\nexport interface NotifyOptions {\n description?: string\n /** Also record a persistent notification-centre entry (default true). */\n record?: boolean\n href?: string\n duration?: number\n /** A toast action button (sonner). */\n action?: { label: ReactNode; onClick: () => void }\n /** Override the toast glyph (sonner). */\n icon?: ReactNode\n /** Record as routine session activity (see {@link AppNotification.ambient}). */\n ambient?: boolean\n}\n\ninterface NotifyState {\n notifications: AppNotification[]\n markRead: (id: string) => void\n markAllRead: () => void\n removeNotification: (id: string) => void\n clearNotifications: () => void\n /** Replace the centre's history (e.g. seed a demo/initial set). */\n seed: (items: AppNotification[]) => void\n /** Record a centre entry (used by `notify.*`; sonner renders the toast). */\n record: (note: AppNotification) => void\n /** Reconcile one source's slice with fresh truth (e.g. a backend list on\n * every refetch): entries stamped with `source` are replaced wholesale —\n * including their read state, which the source owns — while entries from\n * other sources (session activity) stay untouched. Newest first. */\n syncSource: (source: string, items: AppNotification[]) => void\n}\n\nlet seq = 0\nconst uid = () => `n${Date.now().toString(36)}${(seq++).toString(36)}`\n\nexport const useNotify = create<NotifyState>((set) => ({\n notifications: [],\n markRead: (id) =>\n set((s) => ({\n notifications: s.notifications.map((n) => (n.id === id ? { ...n, read: true } : n)),\n })),\n markAllRead: () =>\n set((s) => ({ notifications: s.notifications.map((n) => ({ ...n, read: true })) })),\n removeNotification: (id) =>\n set((s) => ({ notifications: s.notifications.filter((n) => n.id !== id) })),\n clearNotifications: () => set({ notifications: [] }),\n seed: (items) => set({ notifications: items }),\n record: (note) => set((s) => ({ notifications: [note, ...s.notifications].slice(0, 50) })),\n syncSource: (source, items) =>\n set((s) => ({\n notifications: [\n ...items.map((n) => ({ ...n, source })),\n ...s.notifications.filter((n) => n.source !== source),\n ]\n .sort((a, b) => b.ts - a.ts)\n .slice(0, 100),\n })),\n}))\n\n/** Ergonomic helper — `notify.success('Saved')` — toast (sonner) + optional centre entry. */\nfunction make(variant: NotifyVariant) {\n return (title: string, opts: NotifyOptions = {}): string => {\n toast[variant](title, {\n description: opts.description,\n duration: opts.duration,\n action: opts.action,\n icon: opts.icon,\n })\n const id = uid()\n if (opts.record !== false) {\n useNotify.getState().record({\n id,\n title,\n description: opts.description,\n variant,\n ts: Date.now(),\n read: false,\n href: opts.href,\n ambient: opts.ambient,\n })\n }\n return id\n }\n}\nexport const notify = {\n success: make('success'),\n error: make('error'),\n info: make('info'),\n warning: make('warning'),\n}\n\n/** Replace the notification centre's history — inject a seed/initial set. */\nexport function seedNotifications(items: AppNotification[]): void {\n useNotify.getState().seed(items)\n}\n\n/** Unread count selector for the topbar bell — ambient session activity never\n * demands attention, so it never counts. */\nexport const selectUnread = (s: NotifyState): number =>\n s.notifications.filter((n) => !n.read && !n.ambient).length\n\n/** Default glyph colour per variant (raw palette, override via `toneClassNames`). */\nexport const DEFAULT_NOTIFY_TONE: Record<NotifyVariant, string> = {\n success: 'text-green-600',\n error: 'text-destructive',\n warning: 'text-amber-500',\n info: 'text-blue-500',\n}\n","/** Relative-time formatting shared by the notification bell and the DM kit (no type imports, so the\n * SDK-free `/shell` entry can use it). */\n\nconst RELATIVE = new Intl.RelativeTimeFormat(undefined, { numeric: 'auto' })\nconst DIVISIONS: Array<{ amount: number; unit: Intl.RelativeTimeFormatUnit }> = [\n { amount: 60, unit: 'seconds' },\n { amount: 60, unit: 'minutes' },\n { amount: 24, unit: 'hours' },\n { amount: 7, unit: 'days' },\n { amount: 4.34524, unit: 'weeks' },\n { amount: 12, unit: 'months' },\n { amount: Number.POSITIVE_INFINITY, unit: 'years' },\n]\n\n/** Compact relative time, e.g. \"2 hours ago\", \"just now\". */\nexport function formatRelativeTime(iso: string): string {\n const then = Date.parse(iso)\n if (Number.isNaN(then)) return ''\n let duration = (then - Date.now()) / 1000\n if (Math.abs(duration) < 45) return 'just now'\n for (const division of DIVISIONS) {\n if (Math.abs(duration) < division.amount) {\n return RELATIVE.format(Math.round(duration), division.unit)\n }\n duration /= division.amount\n }\n return ''\n}\n","/**\n * NotificationBell — the topbar notification centre: a bell with an unread badge\n * that opens a dropdown of recorded entries (newest first) with an unread dot,\n * relative time and optional deep-link. \"Mark all read\" clears the badge. Backed\n * by the shared {@link useNotify} store (the same one the <Toaster/> renders).\n *\n * Firm-agnostic: navigation is a callback (`onNavigate`), styling tracks semantic\n * tokens, and per-variant glyph colours are overridable via `toneClassNames`.\n */\nimport type { ReactElement } from 'react'\nimport {\n Bell,\n BellOff,\n CheckCheck,\n CheckCircle2,\n AlertTriangle,\n XCircle,\n Info,\n X,\n} from 'lucide-react'\nimport {\n DropdownMenu,\n DropdownMenuTrigger,\n DropdownMenuContent,\n DropdownMenuItem,\n} from '../ui/dropdown-menu'\nimport { ScrollArea } from '../ui/scroll-area'\nimport { cn } from '../lib/utils'\nimport { formatRelativeTime } from '../lib/format-relative-time'\nimport { useNotify, selectUnread, DEFAULT_NOTIFY_TONE, type NotifyVariant } from './notify-store'\n\nconst GLYPH: Record<NotifyVariant, typeof Info> = {\n success: CheckCircle2,\n error: XCircle,\n warning: AlertTriangle,\n info: Info,\n}\n\n/** What a custom bell trigger needs to render itself. */\nexport interface NotificationBellTriggerState {\n /** Unread count (0 when none). */\n unread: number\n /** Accessible name, including the count: \"Notifications, 2 unread\". */\n ariaLabel: string\n testId: string\n}\n\nexport interface NotificationBellProps {\n /**\n * Replaces the default icon button with the host's own trigger (for example a labelled sidebar\n * row). It must forward its ref and rest props: it is mounted as the dropdown trigger.\n */\n renderTrigger?: (state: NotificationBellTriggerState) => ReactElement\n /** Called with an entry's `href` when it's clicked (e.g. router navigate). */\n onNavigate?: (href: string) => void\n /** Called after an entry is locally marked read — the hook for a backend\n * bridge to propagate read state upstream (filter by the ids it owns). */\n onMarkRead?: (id: string) => void\n /** Called after \"Mark all read\" — same upstream-propagation hook. */\n onMarkAllRead?: () => void\n /** Toast muting — the bell is where notification behaviour is controlled, so\n * the mute switch lives in its header. Omit `onToggleMute` to hide it. */\n muted?: boolean\n onToggleMute?: () => void\n /** Override per-variant glyph colours (e.g. brand emerald for success). */\n toneClassNames?: Partial<Record<NotifyVariant, string>>\n emptyText?: string\n /** Footer link to the app's full notification surface. Omit to hide. */\n onViewAll?: () => void\n viewAllLabel?: string\n testId?: string\n /** Where the panel opens relative to the bell (a sidebar-footer bell opens upward). */\n side?: 'top' | 'right' | 'bottom' | 'left'\n align?: 'start' | 'center' | 'end'\n}\n\nexport function NotificationBell({\n renderTrigger,\n onNavigate,\n onMarkRead,\n onMarkAllRead,\n muted = false,\n onToggleMute,\n toneClassNames,\n emptyText = \"You're all caught up.\",\n onViewAll,\n viewAllLabel = 'View all',\n testId = 'notifications',\n side = 'bottom',\n align = 'end',\n}: NotificationBellProps) {\n const notifications = useNotify((s) => s.notifications)\n const unread = useNotify(selectUnread)\n const markAllRead = useNotify((s) => s.markAllRead)\n const markRead = useNotify((s) => s.markRead)\n const tone = (v: NotifyVariant) => toneClassNames?.[v] ?? DEFAULT_NOTIFY_TONE[v]\n\n // Ambient entries (routine session activity — \"Opening workspace…\") are kept\n // for the log but never surfaced in the bell panel: they never badge and are\n // always filtered out here.\n const visible = notifications.filter((n) => !n.ambient)\n\n return (\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n {renderTrigger ? (\n renderTrigger({\n unread,\n ariaLabel: `Notifications${unread ? `, ${unread} unread` : ''}`,\n testId,\n })\n ) : (\n <button\n className=\"relative flex size-9 pointer-coarse:size-11 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground\"\n data-testid={testId}\n aria-label={`Notifications${unread ? `, ${unread} unread` : ''}`}\n title=\"Notifications\"\n >\n <Bell className=\"size-5\" />\n {unread > 0 && (\n <span\n className=\"absolute -right-0.5 -top-0.5 flex min-w-4 items-center justify-center rounded-full bg-primary px-1 text-xs font-semibold leading-4 text-primary-foreground\"\n data-testid={`${testId}-badge`}\n >\n {unread > 9 ? '9+' : unread}\n </span>\n )}\n </button>\n )}\n </DropdownMenuTrigger>\n <DropdownMenuContent\n align={align}\n side={side}\n sideOffset={8}\n collisionPadding={12}\n className=\"w-[360px] rounded-lg border-border/60 p-0 shadow-lg\"\n data-testid={`${testId}-panel`}\n data-topbar-popover=\"\"\n >\n <div className=\"flex items-center justify-between gap-3 border-b border-border px-3.5 py-2.5 pointer-coarse:py-0\">\n <p className=\"text-sm font-semibold text-foreground\">Notifications</p>\n <div className=\"flex items-center gap-3 pointer-coarse:gap-1\">\n {unread > 0 && (\n <button\n onClick={() => {\n markAllRead()\n onMarkAllRead?.()\n }}\n className=\"flex items-center gap-1 text-xs font-medium text-primary transition-colors hover:opacity-80 pointer-coarse:min-h-11 pointer-coarse:px-2\"\n data-testid={`${testId}-mark-all`}\n >\n <CheckCheck className=\"size-3.5\" /> Mark all read\n </button>\n )}\n {onToggleMute && (\n <button\n onClick={onToggleMute}\n aria-pressed={muted}\n title={muted ? 'Unmute notifications' : 'Mute notifications'}\n aria-label={muted ? 'Unmute notifications' : 'Mute notifications'}\n className={cn(\n 'flex size-6 items-center justify-center rounded-md transition-colors hover:bg-accent pointer-coarse:size-11',\n muted ? 'text-foreground' : 'text-muted-foreground hover:text-foreground'\n )}\n data-testid={`${testId}-mute`}\n >\n <BellOff className=\"size-3.5\" />\n </button>\n )}\n {/* Explicit close — the dropdown otherwise only dismisses via\n tap-outside/Escape, which isn't discoverable on touch and (at\n mobile width, see blocks.css) the panel covers most\n of the screen so there's nothing to tap outside of. Radix\n closes a DropdownMenu on any item select by default, so a\n plain item with no other effect doubles as a close button. */}\n <DropdownMenuItem\n className=\"flex size-6 items-center justify-center rounded-md p-0 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground focus:bg-accent pointer-coarse:size-11\"\n aria-label=\"Close notifications\"\n data-testid={`${testId}-close`}\n >\n <X className=\"size-3.5\" />\n </DropdownMenuItem>\n </div>\n </div>\n {muted && (\n <p\n className=\"border-b border-border/60 bg-amber-500/10 px-3.5 py-1.5 text-xs text-muted-foreground\"\n data-testid={`${testId}-muted-note`}\n >\n Toasts are muted — everything still lands here.\n </p>\n )}\n\n {visible.length === 0 ? (\n <div className=\"px-3.5 py-10 text-center text-sm text-muted-foreground\">{emptyText}</div>\n ) : (\n <ScrollArea className=\"max-h-[380px]\">\n <ul data-testid={`${testId}-list`}>\n {visible.map((n) => {\n const Glyph = GLYPH[n.variant]\n return (\n <li key={n.id}>\n <button\n onClick={() => {\n markRead(n.id)\n if (!n.read) onMarkRead?.(n.id)\n // The specific action wins over the generic deep link.\n if (n.onSelect) n.onSelect()\n else if (n.href) onNavigate?.(n.href)\n }}\n className={cn(\n 'flex w-full items-start gap-3 border-b border-border/60 px-3.5 py-3 text-left transition-colors hover:bg-accent',\n !n.read && 'bg-accent/40'\n )}\n data-testid={`${testId}-item`}\n >\n <Glyph className={cn('mt-0.5 size-4 shrink-0', tone(n.variant))} />\n <div className=\"min-w-0 flex-1\">\n <p className=\"text-sm font-medium leading-snug text-foreground\">\n {n.title}\n </p>\n {n.description && (\n <p className=\"mt-0.5 line-clamp-2 text-xs leading-relaxed text-muted-foreground\">\n {n.description}\n </p>\n )}\n <p className=\"mt-1 text-xs text-muted-foreground/80\">\n {formatRelativeTime(new Date(n.ts).toISOString())}\n </p>\n </div>\n {!n.read && (\n <span className=\"mt-1.5 size-2 shrink-0 rounded-full bg-primary\" />\n )}\n </button>\n </li>\n )\n })}\n </ul>\n </ScrollArea>\n )}\n {onViewAll && (\n // A real menu item, not a bare button: selecting it must CLOSE the\n // dropdown on its way to the full surface.\n <DropdownMenuItem\n onClick={onViewAll}\n className=\"justify-center rounded-none border-t border-border px-3.5 py-2.5 text-xs font-medium text-primary focus:text-primary pointer-coarse:min-h-11\"\n data-testid={`${testId}-view-all`}\n >\n {viewAllLabel}\n </DropdownMenuItem>\n )}\n </DropdownMenuContent>\n </DropdownMenu>\n )\n}\n","/**\n * Toaster — the one shared toast surface, built on sonner (the mature engine:\n * stacking, swipe-to-dismiss, a11y, timing). Mount once near the app root; any\n * code then calls `notify.*(...)` (or the re-exported `toast`) from anywhere.\n *\n * Firm-agnostic: every sonner `ToasterProps` passes through, so a consumer sets\n * its own `position` / `theme` / `toastOptions`. The defaults give a neutral\n * shadcn-token card that both apps can override.\n */\nimport { Toaster as Sonner, type ToasterProps } from 'sonner'\n\nexport type { ToasterProps }\n\nconst DEFAULT_TOAST_OPTIONS: ToasterProps['toastOptions'] = {\n classNames: {\n toast:\n 'group toast group-[.toaster]:bg-card group-[.toaster]:text-foreground group-[.toaster]:border group-[.toaster]:border-border group-[.toaster]:shadow-lg group-[.toaster]:rounded-lg',\n description: 'group-[.toast]:text-muted-foreground',\n actionButton: 'group-[.toast]:bg-primary group-[.toast]:text-primary-foreground',\n cancelButton: 'group-[.toast]:bg-muted group-[.toast]:text-muted-foreground',\n },\n}\n\nexport function Toaster({ toastOptions, ...props }: ToasterProps) {\n return (\n <Sonner\n className=\"toaster group\"\n toastOptions={toastOptions ?? DEFAULT_TOAST_OPTIONS}\n {...props}\n />\n )\n}\n"]}
|
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
import { cn } from './chunk-SN5YV6FF.js';
|
|
2
|
+
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
3
|
+
import React, { createContext, useMemo, useState } from 'react';
|
|
4
|
+
import Markdown from 'react-markdown';
|
|
5
|
+
import remarkGfm from 'remark-gfm';
|
|
6
|
+
import rehypeRaw from 'rehype-raw';
|
|
7
|
+
import { Check, Copy } from 'lucide-react';
|
|
8
|
+
|
|
9
|
+
var markdownBaseComponents = {
|
|
10
|
+
h1: ({ children, ...props }) => /* @__PURE__ */ jsx("h1", { className: "text-lg font-semibold", "data-testid": "markdown-heading-1", ...props, children }),
|
|
11
|
+
h2: ({ children, ...props }) => /* @__PURE__ */ jsx("h2", { className: "font-semibold text-base", "data-testid": "markdown-heading-2", ...props, children }),
|
|
12
|
+
h3: ({ children, ...props }) => /* @__PURE__ */ jsx("h3", { className: "font-semibold text-base", "data-testid": "markdown-heading-3", ...props, children }),
|
|
13
|
+
h4: ({ children, ...props }) => /* @__PURE__ */ jsx("h4", { className: "font-semibold text-base", ...props, children }),
|
|
14
|
+
h5: ({ children, ...props }) => /* @__PURE__ */ jsx("h5", { className: "font-medium", ...props, children }),
|
|
15
|
+
strong: ({ children, ...props }) => /* @__PURE__ */ jsx("strong", { className: "font-semibold", ...props, children }),
|
|
16
|
+
blockquote: ({ children, ...props }) => /* @__PURE__ */ jsx("blockquote", { className: "border-l-2 border-primary pl-4", ...props, children }),
|
|
17
|
+
ol: ({ children, ...props }) => /* @__PURE__ */ jsx("ol", { className: "list-decimal space-y-2 pl-6", "data-testid": "markdown-ordered-list", ...props, children }),
|
|
18
|
+
ul: ({ children, ...props }) => /* @__PURE__ */ jsx("ul", { className: "list-none space-y-2 pl-6", "data-testid": "markdown-unordered-list", ...props, children }),
|
|
19
|
+
li: ({ children, ...props }) => /* @__PURE__ */ jsx("li", { className: "my-1.5", ...props, children }),
|
|
20
|
+
table: ({ children, ...props }) => /* @__PURE__ */ jsx("table", { "data-testid": "markdown-table", ...props, children }),
|
|
21
|
+
th: ({ children, ...props }) => /* @__PURE__ */ jsx("th", { ...props, children }),
|
|
22
|
+
td: ({ children, ...props }) => /* @__PURE__ */ jsx("td", { ...props, children }),
|
|
23
|
+
tr: ({ children, ...props }) => /* @__PURE__ */ jsx("tr", { ...props, children }),
|
|
24
|
+
p: ({ children, ...props }) => /* @__PURE__ */ jsx("p", { className: "whitespace-pre-wrap", ...props, children }),
|
|
25
|
+
hr: (props) => /* @__PURE__ */ jsx("hr", { className: "border-foreground/20", ...props }),
|
|
26
|
+
sup: ({ children, ...props }) => /* @__PURE__ */ jsx("sup", { className: "text-xs", ...props, children }),
|
|
27
|
+
sub: ({ children, ...props }) => /* @__PURE__ */ jsx("sub", { className: "text-xs", ...props, children }),
|
|
28
|
+
div: ({ children, className, ...props }) => /* @__PURE__ */ jsx("div", { className, ...props, children }),
|
|
29
|
+
br: (props) => /* @__PURE__ */ jsx("br", { ...props }),
|
|
30
|
+
kbd: ({ children, ...props }) => /* @__PURE__ */ jsx(
|
|
31
|
+
"kbd",
|
|
32
|
+
{
|
|
33
|
+
className: "px-1.5 py-0.5 text-xs font-mono bg-muted border border-border rounded",
|
|
34
|
+
...props,
|
|
35
|
+
children
|
|
36
|
+
}
|
|
37
|
+
),
|
|
38
|
+
abbr: ({ children, title, ...props }) => /* @__PURE__ */ jsx("abbr", { title, className: "underline decoration-dotted cursor-help", ...props, children }),
|
|
39
|
+
cite: ({ children, ...props }) => /* @__PURE__ */ jsx("cite", { className: "italic", ...props, children })
|
|
40
|
+
};
|
|
41
|
+
var MarkdownStreamingContext = createContext(false);
|
|
42
|
+
|
|
43
|
+
// src/ai/split-markdown-blocks.ts
|
|
44
|
+
var LIST_ITEM_RE = /^\s*([-*+]|\d+[.)])\s/;
|
|
45
|
+
var BLOCKQUOTE_RE = /^\s*>/;
|
|
46
|
+
function splitMarkdownBlocks(content) {
|
|
47
|
+
if (!content) return [];
|
|
48
|
+
const blocks = [];
|
|
49
|
+
let start = 0;
|
|
50
|
+
let inFence = false;
|
|
51
|
+
let i = 0;
|
|
52
|
+
while (i < content.length) {
|
|
53
|
+
if (content.startsWith("```", i)) {
|
|
54
|
+
inFence = !inFence;
|
|
55
|
+
i += 3;
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
if (!inFence && content[i] === "\n" && content[i + 1] === "\n") {
|
|
59
|
+
const before = content.slice(start, i);
|
|
60
|
+
const lastLine = before.slice(before.lastIndexOf("\n") + 1);
|
|
61
|
+
const afterStart = i + 2;
|
|
62
|
+
const nextNewline = content.indexOf("\n", afterStart);
|
|
63
|
+
const nextLine = content.slice(afterStart, nextNewline === -1 ? void 0 : nextNewline);
|
|
64
|
+
const bothListItems = LIST_ITEM_RE.test(lastLine) && LIST_ITEM_RE.test(nextLine);
|
|
65
|
+
const bothBlockquotes = BLOCKQUOTE_RE.test(lastLine) && BLOCKQUOTE_RE.test(nextLine);
|
|
66
|
+
if (bothListItems || bothBlockquotes) {
|
|
67
|
+
i += 2;
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
blocks.push(content.slice(start, afterStart));
|
|
71
|
+
start = afterStart;
|
|
72
|
+
i = afterStart;
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
i++;
|
|
76
|
+
}
|
|
77
|
+
if (start < content.length) blocks.push(content.slice(start));
|
|
78
|
+
return blocks;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// src/ai/normalize-citations.ts
|
|
82
|
+
var CITE_LINK = /\[([^\]\n]+)\]\((#cite-[\w-]+)\)/g;
|
|
83
|
+
var BLOCK_MARKER = /^(?:[-*+]|\d{1,9}[.)]|#{1,6})[ \t]+/;
|
|
84
|
+
var LEADING_EMPHASIS = /^(?:\*\*|__|\*|_)+/;
|
|
85
|
+
var TRAILING_EMPHASIS = /(\*\*|__|\*|_)(:?)$/;
|
|
86
|
+
function countToken(text, token) {
|
|
87
|
+
const double = token + token;
|
|
88
|
+
if (token.length === 2) return text.split(token).length - 1;
|
|
89
|
+
const withoutDouble = text.split(double).join("");
|
|
90
|
+
return withoutDouble.split(token).length - 1;
|
|
91
|
+
}
|
|
92
|
+
function emphasisTokens(run) {
|
|
93
|
+
const char = run[0];
|
|
94
|
+
const tokens = [];
|
|
95
|
+
let rest = run;
|
|
96
|
+
while (rest.length > 0) {
|
|
97
|
+
const size = rest.length >= 2 ? 2 : 1;
|
|
98
|
+
tokens.push(char.repeat(size));
|
|
99
|
+
rest = rest.slice(size);
|
|
100
|
+
}
|
|
101
|
+
return tokens;
|
|
102
|
+
}
|
|
103
|
+
function hoistFromLink(text, before, after) {
|
|
104
|
+
let body = text;
|
|
105
|
+
let prefix = "";
|
|
106
|
+
let suffix = "";
|
|
107
|
+
if (before.trim() === "") {
|
|
108
|
+
const marker = BLOCK_MARKER.exec(body);
|
|
109
|
+
if (marker) {
|
|
110
|
+
prefix += marker[0];
|
|
111
|
+
body = body.slice(marker[0].length);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
const leading = LEADING_EMPHASIS.exec(body);
|
|
115
|
+
if (leading) {
|
|
116
|
+
let kept = "";
|
|
117
|
+
let rest = body.slice(leading[0].length);
|
|
118
|
+
for (const token of emphasisTokens(leading[0]).reverse()) {
|
|
119
|
+
if (countToken(rest, token) % 2 === 1) {
|
|
120
|
+
kept = token + kept;
|
|
121
|
+
continue;
|
|
122
|
+
}
|
|
123
|
+
if (countToken(after, token) % 2 === 1) prefix += token;
|
|
124
|
+
else kept = token + kept;
|
|
125
|
+
}
|
|
126
|
+
body = kept + rest;
|
|
127
|
+
rest = "";
|
|
128
|
+
}
|
|
129
|
+
const trailing = TRAILING_EMPHASIS.exec(body);
|
|
130
|
+
if (trailing) {
|
|
131
|
+
const token = trailing[1];
|
|
132
|
+
const inner = body.slice(0, body.length - trailing[0].length);
|
|
133
|
+
const openedBefore = countToken(before + prefix, token) % 2 === 1;
|
|
134
|
+
if (countToken(inner, token) % 2 === 0 && openedBefore) {
|
|
135
|
+
body = inner;
|
|
136
|
+
suffix = trailing[0];
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
return [prefix, body, suffix];
|
|
140
|
+
}
|
|
141
|
+
function normalizeLine(line) {
|
|
142
|
+
if (!line.includes("](#cite-")) return line;
|
|
143
|
+
return line.replace(CITE_LINK, (match, text, href, offset) => {
|
|
144
|
+
const before = line.slice(0, offset);
|
|
145
|
+
const after = line.slice(offset + match.length);
|
|
146
|
+
const [prefix, body, suffix] = hoistFromLink(text, before, after);
|
|
147
|
+
if (!prefix && !suffix && body === text) return match;
|
|
148
|
+
return `${prefix}[${body}](${href})${suffix}`;
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
function normalizeCitationMarkup(markdown) {
|
|
152
|
+
if (!markdown.includes("](#cite-")) return markdown;
|
|
153
|
+
let inFence = false;
|
|
154
|
+
return markdown.split("\n").map((line) => {
|
|
155
|
+
if (/^\s*(```|~~~)/.test(line)) {
|
|
156
|
+
inFence = !inFence;
|
|
157
|
+
return line;
|
|
158
|
+
}
|
|
159
|
+
return inFence ? line : normalizeLine(line);
|
|
160
|
+
}).join("\n");
|
|
161
|
+
}
|
|
162
|
+
function CodeBlock({ language, code }) {
|
|
163
|
+
const [copied, setCopied] = useState(false);
|
|
164
|
+
const handleCopy = async () => {
|
|
165
|
+
try {
|
|
166
|
+
await navigator.clipboard.writeText(code);
|
|
167
|
+
setCopied(true);
|
|
168
|
+
setTimeout(() => setCopied(false), 2e3);
|
|
169
|
+
} catch {
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
return /* @__PURE__ */ jsxs(
|
|
173
|
+
"div",
|
|
174
|
+
{
|
|
175
|
+
className: "code-block relative my-3 overflow-hidden rounded-md border border-current/20 bg-current/5",
|
|
176
|
+
"data-testid": "markdown-code-block",
|
|
177
|
+
children: [
|
|
178
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between border-b border-current/20 px-3 py-1.5", children: [
|
|
179
|
+
/* @__PURE__ */ jsx("span", { className: "font-mono text-xs text-muted-foreground", children: language || "code" }),
|
|
180
|
+
/* @__PURE__ */ jsxs(
|
|
181
|
+
"button",
|
|
182
|
+
{
|
|
183
|
+
type: "button",
|
|
184
|
+
onClick: handleCopy,
|
|
185
|
+
className: "flex items-center gap-1 text-xs text-muted-foreground transition-colors hover:text-foreground",
|
|
186
|
+
title: copied ? "Copied!" : "Copy code",
|
|
187
|
+
children: [
|
|
188
|
+
copied ? /* @__PURE__ */ jsx(Check, { size: 12 }) : /* @__PURE__ */ jsx(Copy, { size: 12 }),
|
|
189
|
+
/* @__PURE__ */ jsx("span", { children: copied ? "Copied" : "Copy" })
|
|
190
|
+
]
|
|
191
|
+
}
|
|
192
|
+
)
|
|
193
|
+
] }),
|
|
194
|
+
/* @__PURE__ */ jsx("pre", { className: "overflow-x-auto p-3 text-sm leading-relaxed", children: /* @__PURE__ */ jsx("code", { className: cn("font-mono", language && `language-${language}`), children: code }) })
|
|
195
|
+
]
|
|
196
|
+
}
|
|
197
|
+
);
|
|
198
|
+
}
|
|
199
|
+
var defaultComponents = {
|
|
200
|
+
...markdownBaseComponents,
|
|
201
|
+
a: ({ href, children, ...props }) => {
|
|
202
|
+
if (href?.startsWith("#cite-")) {
|
|
203
|
+
return /* @__PURE__ */ jsx(
|
|
204
|
+
"span",
|
|
205
|
+
{
|
|
206
|
+
className: "cited-text underline decoration-dotted underline-offset-4",
|
|
207
|
+
"data-cite": href.slice(6),
|
|
208
|
+
children
|
|
209
|
+
}
|
|
210
|
+
);
|
|
211
|
+
}
|
|
212
|
+
const isInternal = !href || href.startsWith("#") || href.startsWith("cite:");
|
|
213
|
+
return /* @__PURE__ */ jsx(
|
|
214
|
+
"a",
|
|
215
|
+
{
|
|
216
|
+
className: "text-primary underline underline-offset-2",
|
|
217
|
+
href,
|
|
218
|
+
...isInternal ? {} : { target: "_blank", rel: "noopener noreferrer" },
|
|
219
|
+
...props,
|
|
220
|
+
children
|
|
221
|
+
}
|
|
222
|
+
);
|
|
223
|
+
},
|
|
224
|
+
em: ({ children, ...props }) => /* @__PURE__ */ jsx("em", { className: "italic", ...props, children }),
|
|
225
|
+
code: function MarkdownCode({
|
|
226
|
+
className,
|
|
227
|
+
children,
|
|
228
|
+
...props
|
|
229
|
+
}) {
|
|
230
|
+
const match = /language-(\w+)/.exec(className || "");
|
|
231
|
+
if (!match) {
|
|
232
|
+
return /* @__PURE__ */ jsx(
|
|
233
|
+
"code",
|
|
234
|
+
{
|
|
235
|
+
className: "rounded bg-current/10 px-1 py-0.5 font-mono text-[0.9em]",
|
|
236
|
+
"data-testid": "markdown-inline-code",
|
|
237
|
+
...props,
|
|
238
|
+
children
|
|
239
|
+
}
|
|
240
|
+
);
|
|
241
|
+
}
|
|
242
|
+
return /* @__PURE__ */ jsx(CodeBlock, { language: match[1], code: String(children).replace(/\n$/, "") });
|
|
243
|
+
},
|
|
244
|
+
// The CodeBlock renders its own <pre>; unwrap react-markdown's wrapper so we
|
|
245
|
+
// don't nest <pre><pre>.
|
|
246
|
+
pre: ({ children }) => /* @__PURE__ */ jsx(Fragment, { children }),
|
|
247
|
+
blockquote: ({ children, ...props }) => /* @__PURE__ */ jsx("blockquote", { className: "border-l-2 border-border pl-4 italic text-muted-foreground", ...props, children }),
|
|
248
|
+
table: ({ children, ...props }) => /* @__PURE__ */ jsx("div", { className: "my-3 overflow-x-auto rounded-lg border border-border", children: /* @__PURE__ */ jsx("table", { "data-testid": "markdown-table", className: "w-full border-collapse text-sm", ...props, children }) }),
|
|
249
|
+
thead: ({ children, ...props }) => /* @__PURE__ */ jsx("thead", { className: "bg-current/10", ...props, children }),
|
|
250
|
+
th: ({ children, ...props }) => /* @__PURE__ */ jsx("th", { className: "border-b border-border px-3 py-2 text-left font-semibold", ...props, children }),
|
|
251
|
+
td: ({ children, ...props }) => /* @__PURE__ */ jsx("td", { className: "border-b border-border px-3 py-2 align-top", ...props, children }),
|
|
252
|
+
// General emphasis marks (GFM `~~strikethrough~~` → <del>, raw <ins>/<mark>).
|
|
253
|
+
del: ({ children, ...props }) => /* @__PURE__ */ jsx("del", { className: "text-muted-foreground line-through", ...props, children }),
|
|
254
|
+
ins: ({ children, ...props }) => /* @__PURE__ */ jsx("ins", { className: "underline decoration-primary/60", ...props, children }),
|
|
255
|
+
mark: ({ children, ...props }) => /* @__PURE__ */ jsx("mark", { className: "rounded bg-primary/15 px-0.5 text-inherit", ...props, children })
|
|
256
|
+
};
|
|
257
|
+
var remarkPlugins = [remarkGfm];
|
|
258
|
+
var rehypePlugins = [rehypeRaw];
|
|
259
|
+
var MemoizedBlock = React.memo(function MarkdownBlock({
|
|
260
|
+
content,
|
|
261
|
+
components
|
|
262
|
+
}) {
|
|
263
|
+
return /* @__PURE__ */ jsx(Markdown, { remarkPlugins, rehypePlugins, components, children: content });
|
|
264
|
+
});
|
|
265
|
+
var MarkdownErrorBoundary = class extends React.Component {
|
|
266
|
+
state = { hasError: false };
|
|
267
|
+
static getDerivedStateFromError() {
|
|
268
|
+
return { hasError: true };
|
|
269
|
+
}
|
|
270
|
+
render() {
|
|
271
|
+
return this.state.hasError ? this.props.fallback : this.props.children;
|
|
272
|
+
}
|
|
273
|
+
};
|
|
274
|
+
function MarkdownRendererComponent({
|
|
275
|
+
children,
|
|
276
|
+
components: customComponents,
|
|
277
|
+
isStreaming = false,
|
|
278
|
+
className,
|
|
279
|
+
testId = "markdown-renderer"
|
|
280
|
+
}) {
|
|
281
|
+
const components = useMemo(
|
|
282
|
+
() => customComponents ? { ...defaultComponents, ...customComponents } : defaultComponents,
|
|
283
|
+
[customComponents]
|
|
284
|
+
);
|
|
285
|
+
const blocks = useMemo(() => splitMarkdownBlocks(normalizeCitationMarkup(children)), [children]);
|
|
286
|
+
return /* @__PURE__ */ jsx(
|
|
287
|
+
MarkdownErrorBoundary,
|
|
288
|
+
{
|
|
289
|
+
fallback: /* @__PURE__ */ jsx("div", { className: cn("whitespace-pre-wrap break-words", className), children }),
|
|
290
|
+
children: /* @__PURE__ */ jsx(MarkdownStreamingContext.Provider, { value: isStreaming, children: /* @__PURE__ */ jsx(
|
|
291
|
+
"div",
|
|
292
|
+
{
|
|
293
|
+
className: cn("markdown-content space-y-3 break-words leading-relaxed", className),
|
|
294
|
+
"data-testid": testId,
|
|
295
|
+
children: blocks.map((block, index) => /* @__PURE__ */ jsx(MemoizedBlock, { content: block, components }, index))
|
|
296
|
+
}
|
|
297
|
+
) })
|
|
298
|
+
}
|
|
299
|
+
);
|
|
300
|
+
}
|
|
301
|
+
var MarkdownRenderer = React.memo(MarkdownRendererComponent);
|
|
302
|
+
|
|
303
|
+
export { MarkdownRenderer, MarkdownStreamingContext, markdownBaseComponents, normalizeCitationMarkup, splitMarkdownBlocks };
|
|
304
|
+
//# sourceMappingURL=chunk-H7ZZQ4ZV.js.map
|
|
305
|
+
//# sourceMappingURL=chunk-H7ZZQ4ZV.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/ai/markdown-base-components.tsx","../src/ai/markdown-streaming-context.ts","../src/ai/split-markdown-blocks.ts","../src/ai/normalize-citations.ts","../src/ai/MarkdownRenderer.tsx"],"names":["jsx"],"mappings":";;;;;;;;AAeO,IAAM,sBAAA,GAA8C;AAAA,EACzD,EAAA,EAAI,CAAC,EAAE,QAAA,EAAU,GAAG,KAAA,EAAM,qBACxB,GAAA,CAAC,IAAA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AAAA,MACC,QAAA,kBAAUA,GAAAA,CAAC,KAAA,EAAA,EAAI,WAAW,EAAA,CAAG,iCAAA,EAAmC,SAAS,CAAA,EAAI,QAAA,EAAS,CAAA;AAAA,MAEtF,0BAAAA,GAAAA,CAAC,wBAAA,CAAyB,UAAzB,EAAkC,KAAA,EAAO,aACxC,QAAA,kBAAAA,GAAAA;AAAA,QAAC,KAAA;AAAA,QAAA;AAAA,UACC,SAAA,EAAW,EAAA,CAAG,wDAAA,EAA0D,SAAS,CAAA;AAAA,UACjF,aAAA,EAAa,MAAA;AAAA,UAEZ,QAAA,EAAA,MAAA,CAAO,GAAA,CAAI,CAAC,KAAA,EAAO,KAAA,qBAClBA,GAAAA,CAAC,aAAA,EAAA,EAA0B,OAAA,EAAS,KAAA,EAAO,UAAA,EAAA,EAAvB,KAA+C,CACpE;AAAA;AAAA,OACH,EACF;AAAA;AAAA,GACF;AAEJ;AAOO,IAAM,gBAAA,GAAmB,KAAA,CAAM,IAAA,CAAK,yBAAyB","file":"chunk-H7ZZQ4ZV.js","sourcesContent":["import React from 'react'\nimport type { Components } from 'react-markdown'\n\n/**\n * Brand-neutral presentational component overrides for react-markdown, shared by\n * every markdown surface in the workspace (the monolith's `MarkdownRenderer` and\n * the AI kit's `AiMarkdown`). One house style for headings, lists, tables and the\n * inline text elements — token-based, so it themes per app.\n *\n * Deliberately excluded (kept per-consumer): `a` (external-link confirm vs\n * plain), `code`/`pre` (rich CodeBlock + Mermaid vs inline), `span` (doc-entity\n * pills), and `del`/`ins`/`mark` (general emphasis vs redline tracked-changes) —\n * these differ by intent or carry heavy/coupled behaviour, so each renderer owns\n * them and spreads this base underneath.\n */\nexport const markdownBaseComponents: Partial<Components> = {\n h1: ({ children, ...props }: React.ComponentPropsWithoutRef<'h1'>) => (\n <h1 className=\"text-lg font-semibold\" data-testid=\"markdown-heading-1\" {...props}>\n {children}\n </h1>\n ),\n h2: ({ children, ...props }: React.ComponentPropsWithoutRef<'h2'>) => (\n <h2 className=\"font-semibold text-base\" data-testid=\"markdown-heading-2\" {...props}>\n {children}\n </h2>\n ),\n h3: ({ children, ...props }: React.ComponentPropsWithoutRef<'h3'>) => (\n <h3 className=\"font-semibold text-base\" data-testid=\"markdown-heading-3\" {...props}>\n {children}\n </h3>\n ),\n h4: ({ children, ...props }: React.ComponentPropsWithoutRef<'h4'>) => (\n <h4 className=\"font-semibold text-base\" {...props}>\n {children}\n </h4>\n ),\n h5: ({ children, ...props }: React.ComponentPropsWithoutRef<'h5'>) => (\n <h5 className=\"font-medium\" {...props}>\n {children}\n </h5>\n ),\n strong: ({ children, ...props }: React.ComponentPropsWithoutRef<'strong'>) => (\n <strong className=\"font-semibold\" {...props}>\n {children}\n </strong>\n ),\n blockquote: ({ children, ...props }: React.ComponentPropsWithoutRef<'blockquote'>) => (\n <blockquote className=\"border-l-2 border-primary pl-4\" {...props}>\n {children}\n </blockquote>\n ),\n ol: ({ children, ...props }: React.ComponentPropsWithoutRef<'ol'>) => (\n <ol className=\"list-decimal space-y-2 pl-6\" data-testid=\"markdown-ordered-list\" {...props}>\n {children}\n </ol>\n ),\n ul: ({ children, ...props }: React.ComponentPropsWithoutRef<'ul'>) => (\n <ul className=\"list-none space-y-2 pl-6\" data-testid=\"markdown-unordered-list\" {...props}>\n {children}\n </ul>\n ),\n li: ({ children, ...props }: React.ComponentPropsWithoutRef<'li'>) => (\n <li className=\"my-1.5\" {...props}>\n {children}\n </li>\n ),\n table: ({ children, ...props }: React.ComponentPropsWithoutRef<'table'>) => (\n <table data-testid=\"markdown-table\" {...props}>\n {children}\n </table>\n ),\n th: ({ children, ...props }: React.ComponentPropsWithoutRef<'th'>) => (\n <th {...props}>{children}</th>\n ),\n td: ({ children, ...props }: React.ComponentPropsWithoutRef<'td'>) => (\n <td {...props}>{children}</td>\n ),\n tr: ({ children, ...props }: React.ComponentPropsWithoutRef<'tr'>) => (\n <tr {...props}>{children}</tr>\n ),\n p: ({ children, ...props }: React.ComponentPropsWithoutRef<'p'>) => (\n <p className=\"whitespace-pre-wrap\" {...props}>\n {children}\n </p>\n ),\n hr: (props: React.ComponentPropsWithoutRef<'hr'>) => (\n <hr className=\"border-foreground/20\" {...props} />\n ),\n sup: ({ children, ...props }: React.ComponentPropsWithoutRef<'sup'>) => (\n <sup className=\"text-xs\" {...props}>\n {children}\n </sup>\n ),\n sub: ({ children, ...props }: React.ComponentPropsWithoutRef<'sub'>) => (\n <sub className=\"text-xs\" {...props}>\n {children}\n </sub>\n ),\n div: ({ children, className, ...props }: React.ComponentPropsWithoutRef<'div'>) => (\n <div className={className} {...props}>\n {children}\n </div>\n ),\n br: (props: React.ComponentPropsWithoutRef<'br'>) => <br {...props} />,\n kbd: ({ children, ...props }: React.ComponentPropsWithoutRef<'kbd'>) => (\n <kbd\n className=\"px-1.5 py-0.5 text-xs font-mono bg-muted border border-border rounded\"\n {...props}\n >\n {children}\n </kbd>\n ),\n abbr: ({ children, title, ...props }: React.ComponentPropsWithoutRef<'abbr'>) => (\n <abbr title={title} className=\"underline decoration-dotted cursor-help\" {...props}>\n {children}\n </abbr>\n ),\n cite: ({ children, ...props }: React.ComponentPropsWithoutRef<'cite'>) => (\n <cite className=\"italic\" {...props}>\n {children}\n </cite>\n ),\n}\n","import { createContext } from 'react'\n\n/**\n * Signals to `MarkdownRenderer`'s component overrides that the surrounding\n * message is still streaming tokens. Heavy renderers can defer their work while\n * this is true to avoid burning CPU on partially complete fences and to keep the\n * UI responsive during long generations.\n *\n * Default `false` means non-streaming usages (parsed documents, static answers,\n * DM bubbles) get the full rendering with no behaviour change.\n */\nexport const MarkdownStreamingContext = createContext(false)\n","/**\n * Splits a markdown string into top-level blocks at `\\n\\n` boundaries.\n *\n * Streaming AI responses arrive token-by-token; passing the full string to\n * react-markdown re-parses the entire AST on every flush. By splitting into\n * blocks and memoizing each, only the trailing (still-growing) block re-parses\n * — completed blocks stay frozen in the DOM.\n *\n * The split avoids three correctness pitfalls:\n * - never splits inside an open ``` code fence (would corrupt the language)\n * - never splits between two adjacent list items (would render as two lists)\n * - never splits between two blockquote lines (would render as two quotes)\n */\nconst LIST_ITEM_RE = /^\\s*([-*+]|\\d+[.)])\\s/\nconst BLOCKQUOTE_RE = /^\\s*>/\n\nexport function splitMarkdownBlocks(content: string): string[] {\n if (!content) return []\n const blocks: string[] = []\n let start = 0\n let inFence = false\n let i = 0\n while (i < content.length) {\n if (content.startsWith('```', i)) {\n inFence = !inFence\n i += 3\n continue\n }\n if (!inFence && content[i] === '\\n' && content[i + 1] === '\\n') {\n const before = content.slice(start, i)\n const lastLine = before.slice(before.lastIndexOf('\\n') + 1)\n const afterStart = i + 2\n const nextNewline = content.indexOf('\\n', afterStart)\n const nextLine = content.slice(afterStart, nextNewline === -1 ? undefined : nextNewline)\n const bothListItems = LIST_ITEM_RE.test(lastLine) && LIST_ITEM_RE.test(nextLine)\n const bothBlockquotes = BLOCKQUOTE_RE.test(lastLine) && BLOCKQUOTE_RE.test(nextLine)\n if (bothListItems || bothBlockquotes) {\n i += 2\n continue\n }\n blocks.push(content.slice(start, afterStart))\n start = afterStart\n i = afterStart\n continue\n }\n i++\n }\n if (start < content.length) blocks.push(content.slice(start))\n return blocks\n}\n","/**\n * Citation markup normaliser.\n *\n * The backend marks a cited statement as a markdown link, `[statement](#cite-N)`, and the\n * statement can include the markdown that surrounds it: a list marker, a heading marker or the\n * opener of a bold/italic span whose closer sits after the link. Inside link text those tokens\n * are not parsed as block or inline syntax, so they show literally and break lists and bold:\n *\n * [- **Claimed quantum (by Claimant)](#cite-1):** **USD 47 million**\n *\n * `normalizeCitationMarkup` hoists the leading tokens out of the link text (and a trailing\n * emphasis closer after it), so the link only wraps the words:\n *\n * - **[Claimed quantum (by Claimant)](#cite-1):** **USD 47 million**\n *\n * It is conservative: emphasis that opens and closes inside the link text is valid markdown and\n * is left alone, an opener is only hoisted when its closer follows on the same line, and fenced\n * code blocks are never touched. The result is idempotent.\n */\n\nconst CITE_LINK = /\\[([^\\]\\n]+)\\]\\((#cite-[\\w-]+)\\)/g\nconst BLOCK_MARKER = /^(?:[-*+]|\\d{1,9}[.)]|#{1,6})[ \\t]+/\nconst LEADING_EMPHASIS = /^(?:\\*\\*|__|\\*|_)+/\nconst TRAILING_EMPHASIS = /(\\*\\*|__|\\*|_)(:?)$/\n\n/** Occurrences of `token` in `text`; a single `*` is counted outside any `**` pair. */\nfunction countToken(text: string, token: string): number {\n const double = token + token\n if (token.length === 2) return text.split(token).length - 1\n const withoutDouble = text.split(double).join('')\n return withoutDouble.split(token).length - 1\n}\n\n/** Split a run of emphasis characters (`***`, `**`, `*`...) into its parser-level tokens. */\nfunction emphasisTokens(run: string): string[] {\n const char = run[0]\n const tokens: string[] = []\n let rest = run\n while (rest.length > 0) {\n const size = rest.length >= 2 ? 2 : 1\n tokens.push(char.repeat(size))\n rest = rest.slice(size)\n }\n return tokens\n}\n\nfunction hoistFromLink(text: string, before: string, after: string): [string, string, string] {\n let body = text\n let prefix = ''\n let suffix = ''\n\n if (before.trim() === '') {\n const marker = BLOCK_MARKER.exec(body)\n if (marker) {\n prefix += marker[0]\n body = body.slice(marker[0].length)\n }\n }\n\n const leading = LEADING_EMPHASIS.exec(body)\n if (leading) {\n let kept = ''\n let rest = body.slice(leading[0].length)\n for (const token of emphasisTokens(leading[0]).reverse()) {\n // Balanced inside the link text: valid as written.\n if (countToken(rest, token) % 2 === 1) {\n kept = token + kept\n continue\n }\n // Unmatched here: hoist only if the line closes it after the link.\n if (countToken(after, token) % 2 === 1) prefix += token\n else kept = token + kept\n }\n body = kept + rest\n rest = ''\n }\n\n const trailing = TRAILING_EMPHASIS.exec(body)\n if (trailing) {\n const token = trailing[1]\n const inner = body.slice(0, body.length - trailing[0].length)\n const openedBefore = countToken(before + prefix, token) % 2 === 1\n if (countToken(inner, token) % 2 === 0 && openedBefore) {\n body = inner\n suffix = trailing[0]\n }\n }\n\n return [prefix, body, suffix]\n}\n\nfunction normalizeLine(line: string): string {\n if (!line.includes('](#cite-')) return line\n return line.replace(CITE_LINK, (match, text: string, href: string, offset: number) => {\n const before = line.slice(0, offset)\n const after = line.slice(offset + match.length)\n const [prefix, body, suffix] = hoistFromLink(text, before, after)\n if (!prefix && !suffix && body === text) return match\n return `${prefix}[${body}](${href})${suffix}`\n })\n}\n\nexport function normalizeCitationMarkup(markdown: string): string {\n if (!markdown.includes('](#cite-')) return markdown\n let inFence = false\n return markdown\n .split('\\n')\n .map((line) => {\n if (/^\\s*(```|~~~)/.test(line)) {\n inFence = !inFence\n return line\n }\n return inFence ? line : normalizeLine(line)\n })\n .join('\\n')\n}\n","import React, { useMemo, useState } from 'react'\nimport Markdown, { type Components } from 'react-markdown'\nimport remarkGfm from 'remark-gfm'\nimport rehypeRaw from 'rehype-raw'\nimport { Copy, Check } from 'lucide-react'\nimport { cn } from '../lib/utils'\nimport { markdownBaseComponents } from './markdown-base-components'\nimport { MarkdownStreamingContext } from './markdown-streaming-context'\nimport { splitMarkdownBlocks } from './split-markdown-blocks'\nimport { normalizeCitationMarkup } from './normalize-citations'\n\n/**\n * MarkdownRenderer — the single, full-featured markdown surface for the kit.\n *\n * Renders AI answers, chat/DM messages and parsed-document panes with one house\n * style: headings, paragraphs, bold/italic, ordered/unordered lists, GFM tables,\n * fenced code blocks (monospace + copy button), inline code, blockquotes, safe\n * links (`rel=\"noopener\"`, new tab) and horizontal rules.\n *\n * Styling is 100% semantic Tailwind tokens (`text-foreground`,\n * `text-muted-foreground`, `border-border`, `bg-muted`, `text-primary`) so it\n * themes per firm — no hardcoded brand colours. It sizes to its container, so it\n * looks right in a compact chat bubble and in a full-width document pane alike.\n *\n * Streaming: the content is split into block-level chunks (see\n * `splitMarkdownBlocks`) and each chunk is memoised, so streaming token updates\n * only re-parse the trailing block instead of the whole message. Pass\n * `isStreaming` to let heavy custom components defer via `MarkdownStreamingContext`.\n *\n * Extending: pass `components` to override any element (the kit's `AiMarkdown`\n * and `CitationRenderer` layer their accent links / citation popovers on top).\n */\n\n/** Fenced code block with a language label and copy-to-clipboard button. */\nfunction CodeBlock({ language, code }: { language: string; code: string }) {\n const [copied, setCopied] = useState(false)\n\n const handleCopy = async () => {\n try {\n await navigator.clipboard.writeText(code)\n setCopied(true)\n setTimeout(() => setCopied(false), 2000)\n } catch {\n // Clipboard unavailable (insecure context / permissions) — no-op.\n }\n }\n\n return (\n <div\n className=\"code-block relative my-3 overflow-hidden rounded-md border border-current/20 bg-current/5\"\n data-testid=\"markdown-code-block\"\n >\n <div className=\"flex items-center justify-between border-b border-current/20 px-3 py-1.5\">\n <span className=\"font-mono text-xs text-muted-foreground\">{language || 'code'}</span>\n <button\n type=\"button\"\n onClick={handleCopy}\n className=\"flex items-center gap-1 text-xs text-muted-foreground transition-colors hover:text-foreground\"\n title={copied ? 'Copied!' : 'Copy code'}\n >\n {copied ? <Check size={12} /> : <Copy size={12} />}\n <span>{copied ? 'Copied' : 'Copy'}</span>\n </button>\n </div>\n <pre className=\"overflow-x-auto p-3 text-sm leading-relaxed\">\n <code className={cn('font-mono', language && `language-${language}`)}>{code}</code>\n </pre>\n </div>\n )\n}\n\n/**\n * Default component overrides. Spreads the shared brand-neutral base\n * (`markdownBaseComponents`: headings, lists, paragraphs, emphasis, hr…) and adds\n * the elements that carry behaviour or need self-contained styling: safe links,\n * code (inline + fenced), bordered tables and blockquotes. Module-scoped so the\n * reference is stable across renders and react-markdown can skip re-parsing.\n */\nconst defaultComponents: Partial<Components> = {\n ...markdownBaseComponents,\n a: ({ href, children, ...props }: React.ComponentPropsWithoutRef<'a'>) => {\n // Internal hash/anchor links stay in-page; everything else opens safely in a\n // new tab. `rel=\"noopener noreferrer\"` prevents reverse-tabnabbing.\n // Backend citation markers (`#cite-N`) have no popover here: show the cited words as\n // plain text in the surface's own colour instead of a link that would jump the page.\n if (href?.startsWith('#cite-')) {\n return (\n <span\n className=\"cited-text underline decoration-dotted underline-offset-4\"\n data-cite={href.slice(6)}\n >\n {children}\n </span>\n )\n }\n const isInternal = !href || href.startsWith('#') || href.startsWith('cite:')\n return (\n <a\n className=\"text-primary underline underline-offset-2\"\n href={href}\n {...(isInternal ? {} : { target: '_blank', rel: 'noopener noreferrer' })}\n {...props}\n >\n {children}\n </a>\n )\n },\n em: ({ children, ...props }: React.ComponentPropsWithoutRef<'em'>) => (\n <em className=\"italic\" {...props}>\n {children}\n </em>\n ),\n code: function MarkdownCode({\n className,\n children,\n ...props\n }: React.ComponentPropsWithoutRef<'code'>) {\n const match = /language-(\\w+)/.exec(className || '')\n if (!match) {\n return (\n <code\n className=\"rounded bg-current/10 px-1 py-0.5 font-mono text-[0.9em]\"\n data-testid=\"markdown-inline-code\"\n {...props}\n >\n {children}\n </code>\n )\n }\n return <CodeBlock language={match[1]} code={String(children).replace(/\\n$/, '')} />\n },\n // The CodeBlock renders its own <pre>; unwrap react-markdown's wrapper so we\n // don't nest <pre><pre>.\n pre: ({ children }: React.ComponentPropsWithoutRef<'pre'>) => <>{children}</>,\n blockquote: ({ children, ...props }: React.ComponentPropsWithoutRef<'blockquote'>) => (\n <blockquote className=\"border-l-2 border-border pl-4 italic text-muted-foreground\" {...props}>\n {children}\n </blockquote>\n ),\n table: ({ children, ...props }: React.ComponentPropsWithoutRef<'table'>) => (\n <div className=\"my-3 overflow-x-auto rounded-lg border border-border\">\n <table data-testid=\"markdown-table\" className=\"w-full border-collapse text-sm\" {...props}>\n {children}\n </table>\n </div>\n ),\n thead: ({ children, ...props }: React.ComponentPropsWithoutRef<'thead'>) => (\n <thead className=\"bg-current/10\" {...props}>\n {children}\n </thead>\n ),\n th: ({ children, ...props }: React.ComponentPropsWithoutRef<'th'>) => (\n <th className=\"border-b border-border px-3 py-2 text-left font-semibold\" {...props}>\n {children}\n </th>\n ),\n td: ({ children, ...props }: React.ComponentPropsWithoutRef<'td'>) => (\n <td className=\"border-b border-border px-3 py-2 align-top\" {...props}>\n {children}\n </td>\n ),\n // General emphasis marks (GFM `~~strikethrough~~` → <del>, raw <ins>/<mark>).\n del: ({ children, ...props }: React.ComponentPropsWithoutRef<'del'>) => (\n <del className=\"text-muted-foreground line-through\" {...props}>\n {children}\n </del>\n ),\n ins: ({ children, ...props }: React.ComponentPropsWithoutRef<'ins'>) => (\n <ins className=\"underline decoration-primary/60\" {...props}>\n {children}\n </ins>\n ),\n mark: ({ children, ...props }: React.ComponentPropsWithoutRef<'mark'>) => (\n <mark className=\"rounded bg-primary/15 px-0.5 text-inherit\" {...props}>\n {children}\n </mark>\n ),\n}\n\n// Stable module-scope plugin arrays so react-markdown compares them by reference\n// and skips re-running the remark/rehype pipeline when nothing else changed.\n// `rehype-raw` enables inline HTML (e.g. redline <del>/<ins>); no math/mermaid\n// plugins are bundled to keep the kit light.\nconst remarkPlugins = [remarkGfm]\nconst rehypePlugins = [rehypeRaw]\n\n/**\n * One parsed markdown block, memoised on (content, components) so already-rendered\n * blocks don't re-parse when a later block streams new tokens. This is the core\n * of the streaming-rendering optimisation.\n */\nconst MemoizedBlock = React.memo(function MarkdownBlock({\n content,\n components,\n}: {\n content: string\n components: Partial<Components>\n}) {\n return (\n <Markdown remarkPlugins={remarkPlugins} rehypePlugins={rehypePlugins} components={components}>\n {content}\n </Markdown>\n )\n})\n\n/** Prevents a malformed-markdown render error from crashing the whole surface. */\nclass MarkdownErrorBoundary extends React.Component<\n { fallback: React.ReactNode; children: React.ReactNode },\n { hasError: boolean }\n> {\n state = { hasError: false }\n static getDerivedStateFromError() {\n return { hasError: true }\n }\n render() {\n return this.state.hasError ? this.props.fallback : this.props.children\n }\n}\n\nexport interface MarkdownRendererProps {\n /** Markdown content to render. */\n children: string\n /** Custom component overrides merged on top of the defaults. */\n components?: Partial<Components>\n /**\n * When true, signals heavy custom components (via `MarkdownStreamingContext`)\n * to defer their work while tokens are still arriving. Defaults to false.\n */\n isStreaming?: boolean\n /** Extra classes on the wrapper (font-size, prose width, etc.). */\n className?: string\n /** Overrides the `data-testid` on the wrapper (default `markdown-renderer`). */\n testId?: string\n}\n\nfunction MarkdownRendererComponent({\n children,\n components: customComponents,\n isStreaming = false,\n className,\n testId = 'markdown-renderer',\n}: MarkdownRendererProps) {\n const components = useMemo(\n () => (customComponents ? { ...defaultComponents, ...customComponents } : defaultComponents),\n [customComponents]\n )\n\n const blocks = useMemo(() => splitMarkdownBlocks(normalizeCitationMarkup(children)), [children])\n\n return (\n <MarkdownErrorBoundary\n fallback={<div className={cn('whitespace-pre-wrap break-words', className)}>{children}</div>}\n >\n <MarkdownStreamingContext.Provider value={isStreaming}>\n <div\n className={cn('markdown-content space-y-3 break-words leading-relaxed', className)}\n data-testid={testId}\n >\n {blocks.map((block, index) => (\n <MemoizedBlock key={index} content={block} components={components} />\n ))}\n </div>\n </MarkdownStreamingContext.Provider>\n </MarkdownErrorBoundary>\n )\n}\n\n/**\n * Memoised so a stable message in a long thread doesn't re-parse when unrelated\n * tokens arrive elsewhere; a streaming message gets a fresh `children` each flush\n * and re-renders (only its trailing block re-parses, thanks to `MemoizedBlock`).\n */\nexport const MarkdownRenderer = React.memo(MarkdownRendererComponent)\n"]}
|
|
@@ -1,25 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Arbi } from '@arbidocs/sdk/browser';
|
|
1
|
+
import { useState, useEffect } from 'react';
|
|
3
2
|
import { jsx } from 'react/jsx-runtime';
|
|
4
3
|
|
|
5
|
-
// src/
|
|
6
|
-
var ArbiContext = createContext(null);
|
|
7
|
-
function ArbiProvider({ children, ...options }) {
|
|
8
|
-
const arbi = useMemo(
|
|
9
|
-
() => new Arbi(options),
|
|
10
|
-
// Stable on url + deploymentDomain — re-creating the instance on every render would be wrong
|
|
11
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
12
|
-
[options.url, options.deploymentDomain, options.credentials]
|
|
13
|
-
);
|
|
14
|
-
return /* @__PURE__ */ jsx(ArbiContext.Provider, { value: arbi, children });
|
|
15
|
-
}
|
|
16
|
-
function useArbi() {
|
|
17
|
-
const arbi = useContext(ArbiContext);
|
|
18
|
-
if (!arbi) {
|
|
19
|
-
throw new Error("useArbi() must be used within an <ArbiProvider>");
|
|
20
|
-
}
|
|
21
|
-
return arbi;
|
|
22
|
-
}
|
|
4
|
+
// src/viewers/AudioViewer.tsx
|
|
23
5
|
function AudioViewer({ blob, title }) {
|
|
24
6
|
const [objectUrl, setObjectUrl] = useState("");
|
|
25
7
|
useEffect(() => {
|
|
@@ -88,6 +70,6 @@ function VideoViewer({ blob, title }) {
|
|
|
88
70
|
);
|
|
89
71
|
}
|
|
90
72
|
|
|
91
|
-
export {
|
|
92
|
-
//# sourceMappingURL=chunk-
|
|
93
|
-
//# sourceMappingURL=chunk-
|
|
73
|
+
export { AudioViewer, ImageViewer, VideoViewer };
|
|
74
|
+
//# sourceMappingURL=chunk-HDCRPPBW.js.map
|
|
75
|
+
//# sourceMappingURL=chunk-HDCRPPBW.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/viewers/AudioViewer.tsx","../src/viewers/ImageViewer.tsx","../src/viewers/VideoViewer.tsx"],"names":["useState","useEffect","jsx"],"mappings":";;;;AAQO,SAAS,WAAA,CAAY,EAAE,IAAA,EAAM,KAAA,EAAM,EAAqB;AAC7D,EAAA,MAAM,CAAC,SAAA,EAAW,YAAY,CAAA,GAAI,SAAiB,EAAE,CAAA;AAErD,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,MAAM,GAAA,GAAM,GAAA,CAAI,eAAA,CAAgB,IAAI,CAAA;AACpC,IAAA,YAAA,CAAa,GAAG,CAAA;AAChB,IAAA,OAAO,MAAM,GAAA,CAAI,eAAA,CAAgB,GAAG,CAAA;AAAA,EACtC,CAAA,EAAG,CAAC,IAAI,CAAC,CAAA;AAET,EAAA,IAAI,CAAC,WAAW,OAAO,IAAA;AAEvB,EAAA,uBACE,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,SAAA,EAAU,gEAAA;AAAA,MACV,aAAA,EAAY,cAAA;AAAA,MAEZ,QAAA,kBAAA,GAAA,CAAC,WAAM,GAAA,EAAK,SAAA,EAAW,UAAQ,IAAA,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,GAAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,SAAA,EAAU,8EAAA;AAAA,MACV,aAAA,EAAY,cAAA;AAAA,MAEZ,QAAA,kBAAAA,GAAAA;AAAA,QAAC,OAAA;AAAA,QAAA;AAAA,UACC,GAAA,EAAK,SAAA;AAAA,UACL,QAAA,EAAQ,IAAA;AAAA,UACR,KAAA;AAAA,UACA,SAAA,EAAU;AAAA;AAAA;AACZ;AAAA,GACF;AAEJ","file":"chunk-HDCRPPBW.js","sourcesContent":["import { useEffect, useState } from 'react'\n\nexport interface AudioViewerProps {\n blob: Blob\n title: string\n}\n\n/** Renders an audio blob with the browser's native transport controls. */\nexport function AudioViewer({ blob, title }: AudioViewerProps) {\n const [objectUrl, setObjectUrl] = useState<string>('')\n\n useEffect(() => {\n const url = URL.createObjectURL(blob)\n setObjectUrl(url)\n return () => URL.revokeObjectURL(url)\n }, [blob])\n\n if (!objectUrl) return null\n\n return (\n <div\n className=\"h-full w-full flex items-center justify-center p-4 bg-muted/30\"\n data-testid=\"audio-viewer\"\n >\n <audio src={objectUrl} controls title={title} className=\"w-full max-w-lg\" />\n </div>\n )\n}\n","import { useEffect, useState } from 'react'\n\nexport interface ImageViewerProps {\n blob: Blob\n alt: string\n}\n\n/** Renders an image blob, scaled to fit its container. */\nexport function ImageViewer({ blob, alt }: ImageViewerProps) {\n const [objectUrl, setObjectUrl] = useState<string>('')\n\n useEffect(() => {\n const url = URL.createObjectURL(blob)\n setObjectUrl(url)\n return () => URL.revokeObjectURL(url)\n }, [blob])\n\n if (!objectUrl) return null\n\n return (\n <div\n className=\"h-full w-full overflow-auto flex items-center justify-center p-4 bg-muted/30\"\n data-testid=\"image-viewer\"\n >\n <img\n src={objectUrl}\n alt={alt}\n className=\"max-w-full max-h-full object-contain rounded shadow-sm\"\n data-testid=\"image-viewer-img\"\n />\n </div>\n )\n}\n","import { useEffect, useState } from 'react'\n\nexport interface VideoViewerProps {\n blob: Blob\n title: string\n}\n\n/** Renders a video blob with the browser's native transport controls. */\nexport function VideoViewer({ blob, title }: VideoViewerProps) {\n const [objectUrl, setObjectUrl] = useState<string>('')\n\n useEffect(() => {\n const url = URL.createObjectURL(blob)\n setObjectUrl(url)\n return () => URL.revokeObjectURL(url)\n }, [blob])\n\n if (!objectUrl) return null\n\n return (\n <div\n className=\"h-full w-full overflow-auto flex items-center justify-center p-4 bg-muted/30\"\n data-testid=\"video-viewer\"\n >\n <video\n src={objectUrl}\n controls\n title={title}\n className=\"max-w-full max-h-full rounded shadow-sm\"\n />\n </div>\n )\n}\n"]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { createContext, useMemo, useContext } from 'react';
|
|
2
|
+
import { Arbi } from '@arbidocs/sdk/browser';
|
|
3
|
+
import { jsx } from 'react/jsx-runtime';
|
|
4
|
+
|
|
5
|
+
// src/ArbiProvider.tsx
|
|
6
|
+
var ArbiContext = createContext(null);
|
|
7
|
+
function ArbiProvider({ children, ...options }) {
|
|
8
|
+
const arbi = useMemo(
|
|
9
|
+
() => new Arbi(options),
|
|
10
|
+
// Stable on url + deploymentDomain — re-creating the instance on every render would be wrong
|
|
11
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
12
|
+
[options.url, options.deploymentDomain, options.credentials]
|
|
13
|
+
);
|
|
14
|
+
return /* @__PURE__ */ jsx(ArbiContext.Provider, { value: arbi, children });
|
|
15
|
+
}
|
|
16
|
+
function useArbi() {
|
|
17
|
+
const arbi = useContext(ArbiContext);
|
|
18
|
+
if (!arbi) {
|
|
19
|
+
throw new Error("useArbi() must be used within an <ArbiProvider>");
|
|
20
|
+
}
|
|
21
|
+
return arbi;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export { ArbiProvider, useArbi };
|
|
25
|
+
//# sourceMappingURL=chunk-J4MX2W4H.js.map
|
|
26
|
+
//# sourceMappingURL=chunk-J4MX2W4H.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/ArbiProvider.tsx","../src/useArbi.ts"],"names":[],"mappings":";;;;;AAYO,IAAM,WAAA,GAAc,cAA2B,IAAI,CAAA;AAMnD,SAAS,YAAA,CAAa,EAAE,QAAA,EAAU,GAAG,SAAQ,EAAsB;AACxE,EAAA,MAAM,IAAA,GAAO,OAAA;AAAA,IACX,MAAM,IAAI,IAAA,CAAK,OAAO,CAAA;AAAA;AAAA;AAAA,IAGtB,CAAC,OAAA,CAAQ,GAAA,EAAK,OAAA,CAAQ,gBAAA,EAAkB,QAAQ,WAAW;AAAA,GAC7D;AAEA,EAAA,2BAAQ,WAAA,CAAY,QAAA,EAAZ,EAAqB,KAAA,EAAO,MAAO,QAAA,EAAS,CAAA;AACtD;ACnBO,SAAS,OAAA,GAAgB;AAC9B,EAAA,MAAM,IAAA,GAAO,WAAW,WAAW,CAAA;AACnC,EAAA,IAAI,CAAC,IAAA,EAAM;AACT,IAAA,MAAM,IAAI,MAAM,iDAAiD,CAAA;AAAA,EACnE;AACA,EAAA,OAAO,IAAA;AACT","file":"chunk-J4MX2W4H.js","sourcesContent":["/**\n * ArbiProvider — React context that holds an Arbi instance.\n *\n * Usage:\n * <ArbiProvider url=\"https://arbi.mycompany.com\">\n * <App />\n * </ArbiProvider>\n */\n\nimport { createContext, useMemo, type ReactNode } from 'react'\nimport { Arbi, type ArbiOptions } from '@arbidocs/sdk/browser'\n\nexport const ArbiContext = createContext<Arbi | null>(null)\n\nexport interface ArbiProviderProps extends ArbiOptions {\n children: ReactNode\n}\n\nexport function ArbiProvider({ children, ...options }: ArbiProviderProps) {\n const arbi = useMemo(\n () => new Arbi(options),\n // Stable on url + deploymentDomain — re-creating the instance on every render would be wrong\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [options.url, options.deploymentDomain, options.credentials]\n )\n\n return <ArbiContext.Provider value={arbi}>{children}</ArbiContext.Provider>\n}\n","/**\n * Hook to access the Arbi instance from the nearest ArbiProvider.\n */\n\nimport { useContext } from 'react'\nimport type { Arbi } from '@arbidocs/sdk/browser'\nimport { ArbiContext } from './ArbiProvider'\n\nexport function useArbi(): Arbi {\n const arbi = useContext(ArbiContext)\n if (!arbi) {\n throw new Error('useArbi() must be used within an <ArbiProvider>')\n }\n return arbi\n}\n"]}
|
|
@@ -1,15 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { twMerge } from 'tailwind-merge';
|
|
1
|
+
import { cn } from './chunk-SN5YV6FF.js';
|
|
3
2
|
import * as React2 from 'react';
|
|
4
3
|
import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
|
|
5
4
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
6
5
|
import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
|
|
7
6
|
import { ChevronRight, Check, Circle } from 'lucide-react';
|
|
8
7
|
|
|
9
|
-
// src/lib/utils.ts
|
|
10
|
-
function cn(...inputs) {
|
|
11
|
-
return twMerge(clsx(inputs));
|
|
12
|
-
}
|
|
13
8
|
var ScrollArea = React2.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
|
|
14
9
|
ScrollAreaPrimitive.Root,
|
|
15
10
|
{
|
|
@@ -171,6 +166,6 @@ var DropdownMenuShortcut = ({ className, ...props }) => {
|
|
|
171
166
|
};
|
|
172
167
|
DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
|
|
173
168
|
|
|
174
|
-
export { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, ScrollArea, ScrollBar,
|
|
175
|
-
//# sourceMappingURL=chunk-
|
|
176
|
-
//# sourceMappingURL=chunk-
|
|
169
|
+
export { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, ScrollArea, ScrollBar, getCollisionPadding };
|
|
170
|
+
//# sourceMappingURL=chunk-N5SVBDLC.js.map
|
|
171
|
+
//# sourceMappingURL=chunk-N5SVBDLC.js.map
|