@flytedan/flytebot-design-system 0.49.0 → 0.49.1

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/dist/index.d.cts CHANGED
@@ -158,6 +158,27 @@ declare function usePopoverPosition(open: boolean, anchorRef: React.RefObject<HT
158
158
  /** The rendered layer, so its real size replaces the estimates once it exists. */
159
159
  layerRef?: React.RefObject<HTMLElement>;
160
160
  }): PopoverPosition | null;
161
+ /**
162
+ * MP-268: a portalled overlay's z-index is no longer decided here. It used to be a second,
163
+ * independently-timed mechanism (MP-142) — a value passed down through its own React context,
164
+ * separate from the layer stack's ownership context (`kits/layerStack.tsx`) that already
165
+ * decides Escape and Tab order. The two could disagree: a child overlay opened in the very
166
+ * same commit as its parent could read the parent's not-yet-registered placeholder z-index
167
+ * and mistake itself for a root overlay, racing its own parent for a root slot instead of
168
+ * always outranking it (the reported bug — a Modal opened in the same commit as its Drawer
169
+ * painted under it, though focus was correctly inside the Modal).
170
+ *
171
+ * Every overlay that escapes the DOM via `portal()` or `createPortal` directly — Popover
172
+ * (and everything built on it), Drawer, Modal, Tooltip — now reads its z-index from
173
+ * `useLayerZIndex(layer)` (`kits/layerStack.tsx`), passing the SAME `layer` object
174
+ * `useStackedLayer` gave it. That function derives the number purely from `layer.parent` —
175
+ * the same ownership fact already used for focus — so the two can never disagree again:
176
+ * one fact, one mechanism. See `useLayerZIndex`'s own comment for the exact rule (child
177
+ * always LAYER_STEP+ above its resolved parent; a root layer ranks by position among the
178
+ * other currently-open root layers). Import `useLayerZIndex`/`LAYER_STEP`/`ROOT_STEP`/
179
+ * `OVERLAY_CEILING`/`__resetLayerStackForTests` from `kits/layerStack` directly — this file
180
+ * no longer re-exports them; there is exactly one place they live now.
181
+ */
161
182
  /**
162
183
  * An anchored floating surface: menus, pickers, disclosure panels, meters.
163
184
  * Owns placement, dismissal, focus return — and its own layout, which is the one rule
@@ -4870,6 +4891,24 @@ interface StackedLayerOptions {
4870
4891
  interface StackedLayer {
4871
4892
  readonly parent: StackedLayer | null;
4872
4893
  }
4894
+ /** How far a layer's z-index sits above its parent's — also the spacing between two open
4895
+ * layers that share a parent (siblings stack by open order, oldest lowest). */
4896
+ declare const LAYER_STEP = 10;
4897
+ /** The z-index a root layer (no parent) claims: `(index + 1) * ROOT_STEP`, where `index` is
4898
+ * its position among the currently-open root layers, oldest first. Static, always-mounted
4899
+ * page chrome (a sticky header, the off-canvas rail's own resting z-index) must stay under
4900
+ * this, so no page z-index can ever outrank an overlay. */
4901
+ declare const ROOT_STEP = 100;
4902
+ /** Guaranteed to sit above any z-index this mechanism can ever compute — see Popover.tsx's
4903
+ * TransferList drag-ghost use. Not part of the layer tree; nothing derives from it. */
4904
+ declare const OVERLAY_CEILING = 10000;
4905
+ /** The z-index `layer` should render at right now — 0 while it is closed (nothing should be
4906
+ * positioning off it then). Re-renders whenever any layer anywhere opens or closes, since
4907
+ * a sibling or a parent opening/closing can change this layer's own slot. */
4908
+ declare function useLayerZIndex(layer: StackedLayer): number;
4909
+ /** Test-only escape hatch: forces every currently-open layer closed and the shared order
4910
+ * counter back to zero. Production code never needs this. */
4911
+ declare const __resetLayerStackForTests: () => void;
4873
4912
  /** Joins the stack while `active`. Returns the layer, for `StackedLayerProvider`. */
4874
4913
  declare function useStackedLayer(options: StackedLayerOptions): StackedLayer;
4875
4914
  /** Makes `layer` the owner of every layer opened from inside `children`, across portals. */
@@ -4957,4 +4996,4 @@ declare function formatDocumentTitle(routeTitle: string | undefined | null, appN
4957
4996
  */
4958
4997
  declare function useDocumentTitle(routeTitle: string | undefined | null, appName: string): void;
4959
4998
 
4960
- export { AccountMenu, type AccountMenuLink, type AccountMenuProps, AgentChatPanel, type AgentChatPanelProps, AnchoredPopover, type AnchoredPopoverProps, AnimNum, type AnimNumProps, ApiSpecBrowser, type ApiSpecBrowserProps, type AppEntry, AppShell, type AppShellProps, AppSwitcher, type AppSwitcherProps, AppearanceMenu, type AppearanceMenuProps, type AppearancePrefs, type AppearanceStore, type AppearanceStoreOptions, type Attachment, Avatar, type AvatarProps, AvatarStack, type AvatarStackProps, Badge, type BadgeProps, Banner, type BannerProps, type BannerTone, BarList, type BarListProps, type BarListRow, BudgetReallocator, type BudgetReallocatorProps, Button, type ButtonProps, CHANNELS, CHANNEL_WEIGHTS, CHAT_UNAVAILABLE, Calendar, type CalendarProps, Card, CardGrid, type CardGridProps, type CardProps, CardRow, type CardRowProps, ChannelContribution, type ChannelContributionChannel, type ChannelContributionProps, ChannelMeta, type ChannelMetaRecord, ChannelTag, type ChannelTagProps, ChannelWeightOf, type ChatAdapter, ChatComposer, type ChatComposerProps, type ChatEngine, type ChatEngineOptions, ChatKit, type ChatMessage, type ChatRenderContext, ChatSessionBar, type ChatSessionBarProps, ChatTranscript, type ChatTranscriptProps, ChatTurn, type ChatTurnProps, Checkbox, type CheckboxProps, type Citation, Citations, type CitationsProps, Clamp, type ClampProps, ClockFace, type ClockFaceProps, CodeBlock, type CodeBlockProps, CodeEditor, type CodeEditorDiagnostic, type CodeEditorProps, Collapsible, type CollapsibleProps, ComingSoon, type ComingSoonProps, type ContextUsage, type CreateVersionStoreOptions, CsiBadge, type CsiBadgeProps, CsiHero, type CsiHeroProps, CsiMeter, type CsiMeterProps, DEFAULT_PREFS, DEFAULT_STORAGE_KEY, DataTable, type DataTableColumn, type DataTableProps, DatePicker, type DatePickerProps, type DemoSessionControls, DemoSessionProvider, type DeviceSession, DiffBlock, type DiffBlockProps, DonutChart, type DonutChartProps, type DonutSegment, Drawer, type DrawerProps, Dropzone, DropzoneKit, type DropzoneProps, ENTITY_ROW_METRIC_WIDTH, type EditorTrigger, EmptyState, type EmptyStateProps, type EndpointSpec, EntityRow, type EntityRowAction, type EntityRowContent, type EntityRowMetric, EntityRowMetrics, type EntityRowMetricsProps, type EntityRowProps, FILE_VIEWER_CSV_ROW_LIMIT, FILE_VIEWER_TEXT_LIMIT, FeatureGate, type FeatureGateProps, type FeatureStatus, FileBrowser, type FileBrowserFile, type FileBrowserFolder, type FileBrowserPermissions, type FileBrowserProps, FileChip, type FileChipProps, FileGrid, type FileGridProps, FileKit, FilePickButton, type FilePickButtonProps, type FileRejection, FileStrip, type FileStripProps, FileTile, type FileTileProps, type FileUploadHandler, FileViewer, type FileViewerProps, FilterBar, type FilterBarProps, type FilterDateValue, type FilterField, type FilterFieldDate, type FilterFieldMultiSelect, type FilterFieldOption, type FilterFieldRange, type FilterFieldSelect, type FilterFieldText, type FilterMultiSelectValue, type FilterOperator, type FilterRangeValue, type FilterResolveMatch, type FilterResolveResult, type FilterValidation, type FilterValue, Flag$1 as Flag, type FlagExplanation, type FlagProps, FlytedeskBrand, type FlytedeskBrandProps, FlytedeskMark, type FlytedeskMarkProps, FormatEta, FunnelChart, type FunnelChartProps, type FunnelStep, Gate, GatePending, type GatePendingProps, type GateProps, IMPORTANCE_LEVELS, IconButton, type IconButtonProps, type ImportanceLevel, type ImportanceLevelId, ImportanceTag, type ImportanceTagProps, type ImportanceTokens, Input, type InputProps, type Job, type JobAction, type JobCardStatus, type JobStatus, JobTray, type JobTrayProps, Json, KeyHint, type KeyHintProps, type ListEnvelope, LoadingRegion, type LoadingRegionProps, Markdown, MarkdownEditor, type MarkdownEditorHandle, type MarkdownEditorProps, MarkdownInline, type MarkdownProps, type MentionSource, Menu, MenuButton, type MenuButtonProps, type MenuItem, type MenuProps, MessageBody, type MessageBodyProps, type MessageGroup, Meter, type MeterProps, type MeterSegment, type MeterSegmentInput, MixGap, type MixGapProps, type MixGapRow, MockJobKit, type MockJobStatus, Modal, type ModalProps, ModeSwitch, type ModeSwitchProps, type Model, ModelControls, type ModelControlsProps, NumberInput, type NumberInputProps, POPOVER_BODY_MIN, type Packet, PacketCard, type PacketCardProps, type PacketSchema, type Pager, Pagination, type PaginationProps, PermissionDenied, type PermissionDeniedProps, type PermissionGroup, PermissionHint, type PermissionItem, type Phase, type PhaseStatus, PhasedProgress, type PhasedProgressProps, type Placement, type PollOptions, Popover, type PopoverProps, type PreferenceCriterion, PreferenceMeter, type PreferenceMeterProps, type ProfileFieldDef, type ProfileFieldType, type ProfileNotificationDef, ProfilePage, type ProfilePageProps, ProgressBar, type ProgressBarProps, QueryKit, type QueuedTurn, QuotaRow, type QuotaRowProps, Radio, type RadioProps, RangeSlider, type RangeSliderProps, RelativeTime, type RelativeTimeProps, type RoadmapItem, type RoadmapResult, RoadmapTimeline, type RoadmapTimelineProps, type Role, RunActions, type RunActionsProps, type RunConfig, RuntimeKit, type RuntimeSummary, SaturationDistribution, type SaturationDistributionCampus, type SaturationDistributionProps, ScoreMeter, type ScoreMeterProps, ScreenHead, type ScreenHeadProps, SearchField, type SearchFieldProps, SegmentedControl, type SegmentedControlProps, SegmentedMeter, type SegmentedMeterProps, Select, type SelectOption, type SelectProps, type SendMessageResult, type ServerTable, type Session, type SessionContextValue, type Flag as SessionFlag, SessionKit, SessionProvider, type SessionProviderProps, type SessionRole, type SessionStats, type SessionUser, SidebarNav, type SidebarNavItem, type SidebarNavProps, type SignInContinueAs, SignInPage, type SignInPageProps, Skeleton, type SkeletonProps, SkeletonText, type SkeletonTextProps, type SlashCommand, Slider, type SliderProps, SortMenu, type SortMenuField, type SortMenuProps, type SpecModule, Spinner, type SpinnerProps, type StackedLayer, type StackedLayerOptions, StackedLayerProvider, StatTile, type StatTileProps, type Step, StepList, type StepListProps, type StreamHandlers, type Suggestion, SurroundSound, type SurroundSoundProps, Switch, type SwitchProps, type TableQuery, Tabs, type TabsProps, Tag, type TagProps, TestModeBar, type TestModeBarProps, type TextScale, Textarea, type TextareaProps, type ThemeMode, ThinkingBlock, type ThinkingBlockProps, type ThreadSummary, TimePicker, type TimePickerProps, Toast, type ToastProps, Tooltip, type TooltipProps, Topbar, type TopbarProps, TranscriptKit, TransferList, type TransferListProps, type TransferListSide, type TransferListSideProps, TrendChart, type TrendChartProps, type TrendSeries, type UsageLimit, UseFeatureStatus, type UseResponsiveRailOptions, type UseResponsiveRailResult, UseRuntimeMode, type UseServerTableOptions, type User, VIRTUAL_LIST_BUFFER_ROWS, VIRTUAL_LIST_ROW_GAP, type VersionRecord, type VersionStore, VirtualList, type VirtualListProps, type VirtualLoadedBand, type VirtualWindow, type VoiceHandler, acceptMatches, anyOfFilter, applyPrefs, channelWeightOf, computeNeedMore, computeVirtualWindow, createLocalStorageAppearanceStore, createVersionStore, eqFilter, extensionOf, extractClipboardFiles, filterFiles, formatAbsolute, formatBytes, formatClock, formatDocumentTitle, formatDuration, formatEta, formatRelative, groupMessages, hasModifier, iconForMime, importanceLevel, importanceTokens, installFlytedeskFavicon, isImage, isSystemMessage, isWithinLayerTree, jobBucket, languageLabel, loadPrefs, markdownToText, meterFormats, modifierLabel, parseDelimited, pastedTextName, pluralizeUnit, preferenceScore, preferenceSegments, rangeFilter, resolveTheme, revokeAttachment, savePrefs, toAttachment, tokenize, useAppearancePrefs, useChatEngine, useDocumentTitle, useFeatureStatus, usePopoverPosition, useResponsiveRail, useRuntimeMode, useServerTable, useSessionContext, useStackedLayer, useStagedFiles, validateFilterValue, visibleMessages };
4999
+ export { AccountMenu, type AccountMenuLink, type AccountMenuProps, AgentChatPanel, type AgentChatPanelProps, AnchoredPopover, type AnchoredPopoverProps, AnimNum, type AnimNumProps, ApiSpecBrowser, type ApiSpecBrowserProps, type AppEntry, AppShell, type AppShellProps, AppSwitcher, type AppSwitcherProps, AppearanceMenu, type AppearanceMenuProps, type AppearancePrefs, type AppearanceStore, type AppearanceStoreOptions, type Attachment, Avatar, type AvatarProps, AvatarStack, type AvatarStackProps, Badge, type BadgeProps, Banner, type BannerProps, type BannerTone, BarList, type BarListProps, type BarListRow, BudgetReallocator, type BudgetReallocatorProps, Button, type ButtonProps, CHANNELS, CHANNEL_WEIGHTS, CHAT_UNAVAILABLE, Calendar, type CalendarProps, Card, CardGrid, type CardGridProps, type CardProps, CardRow, type CardRowProps, ChannelContribution, type ChannelContributionChannel, type ChannelContributionProps, ChannelMeta, type ChannelMetaRecord, ChannelTag, type ChannelTagProps, ChannelWeightOf, type ChatAdapter, ChatComposer, type ChatComposerProps, type ChatEngine, type ChatEngineOptions, ChatKit, type ChatMessage, type ChatRenderContext, ChatSessionBar, type ChatSessionBarProps, ChatTranscript, type ChatTranscriptProps, ChatTurn, type ChatTurnProps, Checkbox, type CheckboxProps, type Citation, Citations, type CitationsProps, Clamp, type ClampProps, ClockFace, type ClockFaceProps, CodeBlock, type CodeBlockProps, CodeEditor, type CodeEditorDiagnostic, type CodeEditorProps, Collapsible, type CollapsibleProps, ComingSoon, type ComingSoonProps, type ContextUsage, type CreateVersionStoreOptions, CsiBadge, type CsiBadgeProps, CsiHero, type CsiHeroProps, CsiMeter, type CsiMeterProps, DEFAULT_PREFS, DEFAULT_STORAGE_KEY, DataTable, type DataTableColumn, type DataTableProps, DatePicker, type DatePickerProps, type DemoSessionControls, DemoSessionProvider, type DeviceSession, DiffBlock, type DiffBlockProps, DonutChart, type DonutChartProps, type DonutSegment, Drawer, type DrawerProps, Dropzone, DropzoneKit, type DropzoneProps, ENTITY_ROW_METRIC_WIDTH, type EditorTrigger, EmptyState, type EmptyStateProps, type EndpointSpec, EntityRow, type EntityRowAction, type EntityRowContent, type EntityRowMetric, EntityRowMetrics, type EntityRowMetricsProps, type EntityRowProps, FILE_VIEWER_CSV_ROW_LIMIT, FILE_VIEWER_TEXT_LIMIT, FeatureGate, type FeatureGateProps, type FeatureStatus, FileBrowser, type FileBrowserFile, type FileBrowserFolder, type FileBrowserPermissions, type FileBrowserProps, FileChip, type FileChipProps, FileGrid, type FileGridProps, FileKit, FilePickButton, type FilePickButtonProps, type FileRejection, FileStrip, type FileStripProps, FileTile, type FileTileProps, type FileUploadHandler, FileViewer, type FileViewerProps, FilterBar, type FilterBarProps, type FilterDateValue, type FilterField, type FilterFieldDate, type FilterFieldMultiSelect, type FilterFieldOption, type FilterFieldRange, type FilterFieldSelect, type FilterFieldText, type FilterMultiSelectValue, type FilterOperator, type FilterRangeValue, type FilterResolveMatch, type FilterResolveResult, type FilterValidation, type FilterValue, Flag$1 as Flag, type FlagExplanation, type FlagProps, FlytedeskBrand, type FlytedeskBrandProps, FlytedeskMark, type FlytedeskMarkProps, FormatEta, FunnelChart, type FunnelChartProps, type FunnelStep, Gate, GatePending, type GatePendingProps, type GateProps, IMPORTANCE_LEVELS, IconButton, type IconButtonProps, type ImportanceLevel, type ImportanceLevelId, ImportanceTag, type ImportanceTagProps, type ImportanceTokens, Input, type InputProps, type Job, type JobAction, type JobCardStatus, type JobStatus, JobTray, type JobTrayProps, Json, KeyHint, type KeyHintProps, LAYER_STEP, type ListEnvelope, LoadingRegion, type LoadingRegionProps, Markdown, MarkdownEditor, type MarkdownEditorHandle, type MarkdownEditorProps, MarkdownInline, type MarkdownProps, type MentionSource, Menu, MenuButton, type MenuButtonProps, type MenuItem, type MenuProps, MessageBody, type MessageBodyProps, type MessageGroup, Meter, type MeterProps, type MeterSegment, type MeterSegmentInput, MixGap, type MixGapProps, type MixGapRow, MockJobKit, type MockJobStatus, Modal, type ModalProps, ModeSwitch, type ModeSwitchProps, type Model, ModelControls, type ModelControlsProps, NumberInput, type NumberInputProps, OVERLAY_CEILING, POPOVER_BODY_MIN, type Packet, PacketCard, type PacketCardProps, type PacketSchema, type Pager, Pagination, type PaginationProps, PermissionDenied, type PermissionDeniedProps, type PermissionGroup, PermissionHint, type PermissionItem, type Phase, type PhaseStatus, PhasedProgress, type PhasedProgressProps, type Placement, type PollOptions, Popover, type PopoverProps, type PreferenceCriterion, PreferenceMeter, type PreferenceMeterProps, type ProfileFieldDef, type ProfileFieldType, type ProfileNotificationDef, ProfilePage, type ProfilePageProps, ProgressBar, type ProgressBarProps, QueryKit, type QueuedTurn, QuotaRow, type QuotaRowProps, ROOT_STEP, Radio, type RadioProps, RangeSlider, type RangeSliderProps, RelativeTime, type RelativeTimeProps, type RoadmapItem, type RoadmapResult, RoadmapTimeline, type RoadmapTimelineProps, type Role, RunActions, type RunActionsProps, type RunConfig, RuntimeKit, type RuntimeSummary, SaturationDistribution, type SaturationDistributionCampus, type SaturationDistributionProps, ScoreMeter, type ScoreMeterProps, ScreenHead, type ScreenHeadProps, SearchField, type SearchFieldProps, SegmentedControl, type SegmentedControlProps, SegmentedMeter, type SegmentedMeterProps, Select, type SelectOption, type SelectProps, type SendMessageResult, type ServerTable, type Session, type SessionContextValue, type Flag as SessionFlag, SessionKit, SessionProvider, type SessionProviderProps, type SessionRole, type SessionStats, type SessionUser, SidebarNav, type SidebarNavItem, type SidebarNavProps, type SignInContinueAs, SignInPage, type SignInPageProps, Skeleton, type SkeletonProps, SkeletonText, type SkeletonTextProps, type SlashCommand, Slider, type SliderProps, SortMenu, type SortMenuField, type SortMenuProps, type SpecModule, Spinner, type SpinnerProps, type StackedLayer, type StackedLayerOptions, StackedLayerProvider, StatTile, type StatTileProps, type Step, StepList, type StepListProps, type StreamHandlers, type Suggestion, SurroundSound, type SurroundSoundProps, Switch, type SwitchProps, type TableQuery, Tabs, type TabsProps, Tag, type TagProps, TestModeBar, type TestModeBarProps, type TextScale, Textarea, type TextareaProps, type ThemeMode, ThinkingBlock, type ThinkingBlockProps, type ThreadSummary, TimePicker, type TimePickerProps, Toast, type ToastProps, Tooltip, type TooltipProps, Topbar, type TopbarProps, TranscriptKit, TransferList, type TransferListProps, type TransferListSide, type TransferListSideProps, TrendChart, type TrendChartProps, type TrendSeries, type UsageLimit, UseFeatureStatus, type UseResponsiveRailOptions, type UseResponsiveRailResult, UseRuntimeMode, type UseServerTableOptions, type User, VIRTUAL_LIST_BUFFER_ROWS, VIRTUAL_LIST_ROW_GAP, type VersionRecord, type VersionStore, VirtualList, type VirtualListProps, type VirtualLoadedBand, type VirtualWindow, type VoiceHandler, __resetLayerStackForTests, acceptMatches, anyOfFilter, applyPrefs, channelWeightOf, computeNeedMore, computeVirtualWindow, createLocalStorageAppearanceStore, createVersionStore, eqFilter, extensionOf, extractClipboardFiles, filterFiles, formatAbsolute, formatBytes, formatClock, formatDocumentTitle, formatDuration, formatEta, formatRelative, groupMessages, hasModifier, iconForMime, importanceLevel, importanceTokens, installFlytedeskFavicon, isImage, isSystemMessage, isWithinLayerTree, jobBucket, languageLabel, loadPrefs, markdownToText, meterFormats, modifierLabel, parseDelimited, pastedTextName, pluralizeUnit, preferenceScore, preferenceSegments, rangeFilter, resolveTheme, revokeAttachment, savePrefs, toAttachment, tokenize, useAppearancePrefs, useChatEngine, useDocumentTitle, useFeatureStatus, useLayerZIndex, usePopoverPosition, useResponsiveRail, useRuntimeMode, useServerTable, useSessionContext, useStackedLayer, useStagedFiles, validateFilterValue, visibleMessages };
package/dist/index.d.ts CHANGED
@@ -158,6 +158,27 @@ declare function usePopoverPosition(open: boolean, anchorRef: React.RefObject<HT
158
158
  /** The rendered layer, so its real size replaces the estimates once it exists. */
159
159
  layerRef?: React.RefObject<HTMLElement>;
160
160
  }): PopoverPosition | null;
161
+ /**
162
+ * MP-268: a portalled overlay's z-index is no longer decided here. It used to be a second,
163
+ * independently-timed mechanism (MP-142) — a value passed down through its own React context,
164
+ * separate from the layer stack's ownership context (`kits/layerStack.tsx`) that already
165
+ * decides Escape and Tab order. The two could disagree: a child overlay opened in the very
166
+ * same commit as its parent could read the parent's not-yet-registered placeholder z-index
167
+ * and mistake itself for a root overlay, racing its own parent for a root slot instead of
168
+ * always outranking it (the reported bug — a Modal opened in the same commit as its Drawer
169
+ * painted under it, though focus was correctly inside the Modal).
170
+ *
171
+ * Every overlay that escapes the DOM via `portal()` or `createPortal` directly — Popover
172
+ * (and everything built on it), Drawer, Modal, Tooltip — now reads its z-index from
173
+ * `useLayerZIndex(layer)` (`kits/layerStack.tsx`), passing the SAME `layer` object
174
+ * `useStackedLayer` gave it. That function derives the number purely from `layer.parent` —
175
+ * the same ownership fact already used for focus — so the two can never disagree again:
176
+ * one fact, one mechanism. See `useLayerZIndex`'s own comment for the exact rule (child
177
+ * always LAYER_STEP+ above its resolved parent; a root layer ranks by position among the
178
+ * other currently-open root layers). Import `useLayerZIndex`/`LAYER_STEP`/`ROOT_STEP`/
179
+ * `OVERLAY_CEILING`/`__resetLayerStackForTests` from `kits/layerStack` directly — this file
180
+ * no longer re-exports them; there is exactly one place they live now.
181
+ */
161
182
  /**
162
183
  * An anchored floating surface: menus, pickers, disclosure panels, meters.
163
184
  * Owns placement, dismissal, focus return — and its own layout, which is the one rule
@@ -4870,6 +4891,24 @@ interface StackedLayerOptions {
4870
4891
  interface StackedLayer {
4871
4892
  readonly parent: StackedLayer | null;
4872
4893
  }
4894
+ /** How far a layer's z-index sits above its parent's — also the spacing between two open
4895
+ * layers that share a parent (siblings stack by open order, oldest lowest). */
4896
+ declare const LAYER_STEP = 10;
4897
+ /** The z-index a root layer (no parent) claims: `(index + 1) * ROOT_STEP`, where `index` is
4898
+ * its position among the currently-open root layers, oldest first. Static, always-mounted
4899
+ * page chrome (a sticky header, the off-canvas rail's own resting z-index) must stay under
4900
+ * this, so no page z-index can ever outrank an overlay. */
4901
+ declare const ROOT_STEP = 100;
4902
+ /** Guaranteed to sit above any z-index this mechanism can ever compute — see Popover.tsx's
4903
+ * TransferList drag-ghost use. Not part of the layer tree; nothing derives from it. */
4904
+ declare const OVERLAY_CEILING = 10000;
4905
+ /** The z-index `layer` should render at right now — 0 while it is closed (nothing should be
4906
+ * positioning off it then). Re-renders whenever any layer anywhere opens or closes, since
4907
+ * a sibling or a parent opening/closing can change this layer's own slot. */
4908
+ declare function useLayerZIndex(layer: StackedLayer): number;
4909
+ /** Test-only escape hatch: forces every currently-open layer closed and the shared order
4910
+ * counter back to zero. Production code never needs this. */
4911
+ declare const __resetLayerStackForTests: () => void;
4873
4912
  /** Joins the stack while `active`. Returns the layer, for `StackedLayerProvider`. */
4874
4913
  declare function useStackedLayer(options: StackedLayerOptions): StackedLayer;
4875
4914
  /** Makes `layer` the owner of every layer opened from inside `children`, across portals. */
@@ -4957,4 +4996,4 @@ declare function formatDocumentTitle(routeTitle: string | undefined | null, appN
4957
4996
  */
4958
4997
  declare function useDocumentTitle(routeTitle: string | undefined | null, appName: string): void;
4959
4998
 
4960
- export { AccountMenu, type AccountMenuLink, type AccountMenuProps, AgentChatPanel, type AgentChatPanelProps, AnchoredPopover, type AnchoredPopoverProps, AnimNum, type AnimNumProps, ApiSpecBrowser, type ApiSpecBrowserProps, type AppEntry, AppShell, type AppShellProps, AppSwitcher, type AppSwitcherProps, AppearanceMenu, type AppearanceMenuProps, type AppearancePrefs, type AppearanceStore, type AppearanceStoreOptions, type Attachment, Avatar, type AvatarProps, AvatarStack, type AvatarStackProps, Badge, type BadgeProps, Banner, type BannerProps, type BannerTone, BarList, type BarListProps, type BarListRow, BudgetReallocator, type BudgetReallocatorProps, Button, type ButtonProps, CHANNELS, CHANNEL_WEIGHTS, CHAT_UNAVAILABLE, Calendar, type CalendarProps, Card, CardGrid, type CardGridProps, type CardProps, CardRow, type CardRowProps, ChannelContribution, type ChannelContributionChannel, type ChannelContributionProps, ChannelMeta, type ChannelMetaRecord, ChannelTag, type ChannelTagProps, ChannelWeightOf, type ChatAdapter, ChatComposer, type ChatComposerProps, type ChatEngine, type ChatEngineOptions, ChatKit, type ChatMessage, type ChatRenderContext, ChatSessionBar, type ChatSessionBarProps, ChatTranscript, type ChatTranscriptProps, ChatTurn, type ChatTurnProps, Checkbox, type CheckboxProps, type Citation, Citations, type CitationsProps, Clamp, type ClampProps, ClockFace, type ClockFaceProps, CodeBlock, type CodeBlockProps, CodeEditor, type CodeEditorDiagnostic, type CodeEditorProps, Collapsible, type CollapsibleProps, ComingSoon, type ComingSoonProps, type ContextUsage, type CreateVersionStoreOptions, CsiBadge, type CsiBadgeProps, CsiHero, type CsiHeroProps, CsiMeter, type CsiMeterProps, DEFAULT_PREFS, DEFAULT_STORAGE_KEY, DataTable, type DataTableColumn, type DataTableProps, DatePicker, type DatePickerProps, type DemoSessionControls, DemoSessionProvider, type DeviceSession, DiffBlock, type DiffBlockProps, DonutChart, type DonutChartProps, type DonutSegment, Drawer, type DrawerProps, Dropzone, DropzoneKit, type DropzoneProps, ENTITY_ROW_METRIC_WIDTH, type EditorTrigger, EmptyState, type EmptyStateProps, type EndpointSpec, EntityRow, type EntityRowAction, type EntityRowContent, type EntityRowMetric, EntityRowMetrics, type EntityRowMetricsProps, type EntityRowProps, FILE_VIEWER_CSV_ROW_LIMIT, FILE_VIEWER_TEXT_LIMIT, FeatureGate, type FeatureGateProps, type FeatureStatus, FileBrowser, type FileBrowserFile, type FileBrowserFolder, type FileBrowserPermissions, type FileBrowserProps, FileChip, type FileChipProps, FileGrid, type FileGridProps, FileKit, FilePickButton, type FilePickButtonProps, type FileRejection, FileStrip, type FileStripProps, FileTile, type FileTileProps, type FileUploadHandler, FileViewer, type FileViewerProps, FilterBar, type FilterBarProps, type FilterDateValue, type FilterField, type FilterFieldDate, type FilterFieldMultiSelect, type FilterFieldOption, type FilterFieldRange, type FilterFieldSelect, type FilterFieldText, type FilterMultiSelectValue, type FilterOperator, type FilterRangeValue, type FilterResolveMatch, type FilterResolveResult, type FilterValidation, type FilterValue, Flag$1 as Flag, type FlagExplanation, type FlagProps, FlytedeskBrand, type FlytedeskBrandProps, FlytedeskMark, type FlytedeskMarkProps, FormatEta, FunnelChart, type FunnelChartProps, type FunnelStep, Gate, GatePending, type GatePendingProps, type GateProps, IMPORTANCE_LEVELS, IconButton, type IconButtonProps, type ImportanceLevel, type ImportanceLevelId, ImportanceTag, type ImportanceTagProps, type ImportanceTokens, Input, type InputProps, type Job, type JobAction, type JobCardStatus, type JobStatus, JobTray, type JobTrayProps, Json, KeyHint, type KeyHintProps, type ListEnvelope, LoadingRegion, type LoadingRegionProps, Markdown, MarkdownEditor, type MarkdownEditorHandle, type MarkdownEditorProps, MarkdownInline, type MarkdownProps, type MentionSource, Menu, MenuButton, type MenuButtonProps, type MenuItem, type MenuProps, MessageBody, type MessageBodyProps, type MessageGroup, Meter, type MeterProps, type MeterSegment, type MeterSegmentInput, MixGap, type MixGapProps, type MixGapRow, MockJobKit, type MockJobStatus, Modal, type ModalProps, ModeSwitch, type ModeSwitchProps, type Model, ModelControls, type ModelControlsProps, NumberInput, type NumberInputProps, POPOVER_BODY_MIN, type Packet, PacketCard, type PacketCardProps, type PacketSchema, type Pager, Pagination, type PaginationProps, PermissionDenied, type PermissionDeniedProps, type PermissionGroup, PermissionHint, type PermissionItem, type Phase, type PhaseStatus, PhasedProgress, type PhasedProgressProps, type Placement, type PollOptions, Popover, type PopoverProps, type PreferenceCriterion, PreferenceMeter, type PreferenceMeterProps, type ProfileFieldDef, type ProfileFieldType, type ProfileNotificationDef, ProfilePage, type ProfilePageProps, ProgressBar, type ProgressBarProps, QueryKit, type QueuedTurn, QuotaRow, type QuotaRowProps, Radio, type RadioProps, RangeSlider, type RangeSliderProps, RelativeTime, type RelativeTimeProps, type RoadmapItem, type RoadmapResult, RoadmapTimeline, type RoadmapTimelineProps, type Role, RunActions, type RunActionsProps, type RunConfig, RuntimeKit, type RuntimeSummary, SaturationDistribution, type SaturationDistributionCampus, type SaturationDistributionProps, ScoreMeter, type ScoreMeterProps, ScreenHead, type ScreenHeadProps, SearchField, type SearchFieldProps, SegmentedControl, type SegmentedControlProps, SegmentedMeter, type SegmentedMeterProps, Select, type SelectOption, type SelectProps, type SendMessageResult, type ServerTable, type Session, type SessionContextValue, type Flag as SessionFlag, SessionKit, SessionProvider, type SessionProviderProps, type SessionRole, type SessionStats, type SessionUser, SidebarNav, type SidebarNavItem, type SidebarNavProps, type SignInContinueAs, SignInPage, type SignInPageProps, Skeleton, type SkeletonProps, SkeletonText, type SkeletonTextProps, type SlashCommand, Slider, type SliderProps, SortMenu, type SortMenuField, type SortMenuProps, type SpecModule, Spinner, type SpinnerProps, type StackedLayer, type StackedLayerOptions, StackedLayerProvider, StatTile, type StatTileProps, type Step, StepList, type StepListProps, type StreamHandlers, type Suggestion, SurroundSound, type SurroundSoundProps, Switch, type SwitchProps, type TableQuery, Tabs, type TabsProps, Tag, type TagProps, TestModeBar, type TestModeBarProps, type TextScale, Textarea, type TextareaProps, type ThemeMode, ThinkingBlock, type ThinkingBlockProps, type ThreadSummary, TimePicker, type TimePickerProps, Toast, type ToastProps, Tooltip, type TooltipProps, Topbar, type TopbarProps, TranscriptKit, TransferList, type TransferListProps, type TransferListSide, type TransferListSideProps, TrendChart, type TrendChartProps, type TrendSeries, type UsageLimit, UseFeatureStatus, type UseResponsiveRailOptions, type UseResponsiveRailResult, UseRuntimeMode, type UseServerTableOptions, type User, VIRTUAL_LIST_BUFFER_ROWS, VIRTUAL_LIST_ROW_GAP, type VersionRecord, type VersionStore, VirtualList, type VirtualListProps, type VirtualLoadedBand, type VirtualWindow, type VoiceHandler, acceptMatches, anyOfFilter, applyPrefs, channelWeightOf, computeNeedMore, computeVirtualWindow, createLocalStorageAppearanceStore, createVersionStore, eqFilter, extensionOf, extractClipboardFiles, filterFiles, formatAbsolute, formatBytes, formatClock, formatDocumentTitle, formatDuration, formatEta, formatRelative, groupMessages, hasModifier, iconForMime, importanceLevel, importanceTokens, installFlytedeskFavicon, isImage, isSystemMessage, isWithinLayerTree, jobBucket, languageLabel, loadPrefs, markdownToText, meterFormats, modifierLabel, parseDelimited, pastedTextName, pluralizeUnit, preferenceScore, preferenceSegments, rangeFilter, resolveTheme, revokeAttachment, savePrefs, toAttachment, tokenize, useAppearancePrefs, useChatEngine, useDocumentTitle, useFeatureStatus, usePopoverPosition, useResponsiveRail, useRuntimeMode, useServerTable, useSessionContext, useStackedLayer, useStagedFiles, validateFilterValue, visibleMessages };
4999
+ export { AccountMenu, type AccountMenuLink, type AccountMenuProps, AgentChatPanel, type AgentChatPanelProps, AnchoredPopover, type AnchoredPopoverProps, AnimNum, type AnimNumProps, ApiSpecBrowser, type ApiSpecBrowserProps, type AppEntry, AppShell, type AppShellProps, AppSwitcher, type AppSwitcherProps, AppearanceMenu, type AppearanceMenuProps, type AppearancePrefs, type AppearanceStore, type AppearanceStoreOptions, type Attachment, Avatar, type AvatarProps, AvatarStack, type AvatarStackProps, Badge, type BadgeProps, Banner, type BannerProps, type BannerTone, BarList, type BarListProps, type BarListRow, BudgetReallocator, type BudgetReallocatorProps, Button, type ButtonProps, CHANNELS, CHANNEL_WEIGHTS, CHAT_UNAVAILABLE, Calendar, type CalendarProps, Card, CardGrid, type CardGridProps, type CardProps, CardRow, type CardRowProps, ChannelContribution, type ChannelContributionChannel, type ChannelContributionProps, ChannelMeta, type ChannelMetaRecord, ChannelTag, type ChannelTagProps, ChannelWeightOf, type ChatAdapter, ChatComposer, type ChatComposerProps, type ChatEngine, type ChatEngineOptions, ChatKit, type ChatMessage, type ChatRenderContext, ChatSessionBar, type ChatSessionBarProps, ChatTranscript, type ChatTranscriptProps, ChatTurn, type ChatTurnProps, Checkbox, type CheckboxProps, type Citation, Citations, type CitationsProps, Clamp, type ClampProps, ClockFace, type ClockFaceProps, CodeBlock, type CodeBlockProps, CodeEditor, type CodeEditorDiagnostic, type CodeEditorProps, Collapsible, type CollapsibleProps, ComingSoon, type ComingSoonProps, type ContextUsage, type CreateVersionStoreOptions, CsiBadge, type CsiBadgeProps, CsiHero, type CsiHeroProps, CsiMeter, type CsiMeterProps, DEFAULT_PREFS, DEFAULT_STORAGE_KEY, DataTable, type DataTableColumn, type DataTableProps, DatePicker, type DatePickerProps, type DemoSessionControls, DemoSessionProvider, type DeviceSession, DiffBlock, type DiffBlockProps, DonutChart, type DonutChartProps, type DonutSegment, Drawer, type DrawerProps, Dropzone, DropzoneKit, type DropzoneProps, ENTITY_ROW_METRIC_WIDTH, type EditorTrigger, EmptyState, type EmptyStateProps, type EndpointSpec, EntityRow, type EntityRowAction, type EntityRowContent, type EntityRowMetric, EntityRowMetrics, type EntityRowMetricsProps, type EntityRowProps, FILE_VIEWER_CSV_ROW_LIMIT, FILE_VIEWER_TEXT_LIMIT, FeatureGate, type FeatureGateProps, type FeatureStatus, FileBrowser, type FileBrowserFile, type FileBrowserFolder, type FileBrowserPermissions, type FileBrowserProps, FileChip, type FileChipProps, FileGrid, type FileGridProps, FileKit, FilePickButton, type FilePickButtonProps, type FileRejection, FileStrip, type FileStripProps, FileTile, type FileTileProps, type FileUploadHandler, FileViewer, type FileViewerProps, FilterBar, type FilterBarProps, type FilterDateValue, type FilterField, type FilterFieldDate, type FilterFieldMultiSelect, type FilterFieldOption, type FilterFieldRange, type FilterFieldSelect, type FilterFieldText, type FilterMultiSelectValue, type FilterOperator, type FilterRangeValue, type FilterResolveMatch, type FilterResolveResult, type FilterValidation, type FilterValue, Flag$1 as Flag, type FlagExplanation, type FlagProps, FlytedeskBrand, type FlytedeskBrandProps, FlytedeskMark, type FlytedeskMarkProps, FormatEta, FunnelChart, type FunnelChartProps, type FunnelStep, Gate, GatePending, type GatePendingProps, type GateProps, IMPORTANCE_LEVELS, IconButton, type IconButtonProps, type ImportanceLevel, type ImportanceLevelId, ImportanceTag, type ImportanceTagProps, type ImportanceTokens, Input, type InputProps, type Job, type JobAction, type JobCardStatus, type JobStatus, JobTray, type JobTrayProps, Json, KeyHint, type KeyHintProps, LAYER_STEP, type ListEnvelope, LoadingRegion, type LoadingRegionProps, Markdown, MarkdownEditor, type MarkdownEditorHandle, type MarkdownEditorProps, MarkdownInline, type MarkdownProps, type MentionSource, Menu, MenuButton, type MenuButtonProps, type MenuItem, type MenuProps, MessageBody, type MessageBodyProps, type MessageGroup, Meter, type MeterProps, type MeterSegment, type MeterSegmentInput, MixGap, type MixGapProps, type MixGapRow, MockJobKit, type MockJobStatus, Modal, type ModalProps, ModeSwitch, type ModeSwitchProps, type Model, ModelControls, type ModelControlsProps, NumberInput, type NumberInputProps, OVERLAY_CEILING, POPOVER_BODY_MIN, type Packet, PacketCard, type PacketCardProps, type PacketSchema, type Pager, Pagination, type PaginationProps, PermissionDenied, type PermissionDeniedProps, type PermissionGroup, PermissionHint, type PermissionItem, type Phase, type PhaseStatus, PhasedProgress, type PhasedProgressProps, type Placement, type PollOptions, Popover, type PopoverProps, type PreferenceCriterion, PreferenceMeter, type PreferenceMeterProps, type ProfileFieldDef, type ProfileFieldType, type ProfileNotificationDef, ProfilePage, type ProfilePageProps, ProgressBar, type ProgressBarProps, QueryKit, type QueuedTurn, QuotaRow, type QuotaRowProps, ROOT_STEP, Radio, type RadioProps, RangeSlider, type RangeSliderProps, RelativeTime, type RelativeTimeProps, type RoadmapItem, type RoadmapResult, RoadmapTimeline, type RoadmapTimelineProps, type Role, RunActions, type RunActionsProps, type RunConfig, RuntimeKit, type RuntimeSummary, SaturationDistribution, type SaturationDistributionCampus, type SaturationDistributionProps, ScoreMeter, type ScoreMeterProps, ScreenHead, type ScreenHeadProps, SearchField, type SearchFieldProps, SegmentedControl, type SegmentedControlProps, SegmentedMeter, type SegmentedMeterProps, Select, type SelectOption, type SelectProps, type SendMessageResult, type ServerTable, type Session, type SessionContextValue, type Flag as SessionFlag, SessionKit, SessionProvider, type SessionProviderProps, type SessionRole, type SessionStats, type SessionUser, SidebarNav, type SidebarNavItem, type SidebarNavProps, type SignInContinueAs, SignInPage, type SignInPageProps, Skeleton, type SkeletonProps, SkeletonText, type SkeletonTextProps, type SlashCommand, Slider, type SliderProps, SortMenu, type SortMenuField, type SortMenuProps, type SpecModule, Spinner, type SpinnerProps, type StackedLayer, type StackedLayerOptions, StackedLayerProvider, StatTile, type StatTileProps, type Step, StepList, type StepListProps, type StreamHandlers, type Suggestion, SurroundSound, type SurroundSoundProps, Switch, type SwitchProps, type TableQuery, Tabs, type TabsProps, Tag, type TagProps, TestModeBar, type TestModeBarProps, type TextScale, Textarea, type TextareaProps, type ThemeMode, ThinkingBlock, type ThinkingBlockProps, type ThreadSummary, TimePicker, type TimePickerProps, Toast, type ToastProps, Tooltip, type TooltipProps, Topbar, type TopbarProps, TranscriptKit, TransferList, type TransferListProps, type TransferListSide, type TransferListSideProps, TrendChart, type TrendChartProps, type TrendSeries, type UsageLimit, UseFeatureStatus, type UseResponsiveRailOptions, type UseResponsiveRailResult, UseRuntimeMode, type UseServerTableOptions, type User, VIRTUAL_LIST_BUFFER_ROWS, VIRTUAL_LIST_ROW_GAP, type VersionRecord, type VersionStore, VirtualList, type VirtualListProps, type VirtualLoadedBand, type VirtualWindow, type VoiceHandler, __resetLayerStackForTests, acceptMatches, anyOfFilter, applyPrefs, channelWeightOf, computeNeedMore, computeVirtualWindow, createLocalStorageAppearanceStore, createVersionStore, eqFilter, extensionOf, extractClipboardFiles, filterFiles, formatAbsolute, formatBytes, formatClock, formatDocumentTitle, formatDuration, formatEta, formatRelative, groupMessages, hasModifier, iconForMime, importanceLevel, importanceTokens, installFlytedeskFavicon, isImage, isSystemMessage, isWithinLayerTree, jobBucket, languageLabel, loadPrefs, markdownToText, meterFormats, modifierLabel, parseDelimited, pastedTextName, pluralizeUnit, preferenceScore, preferenceSegments, rangeFilter, resolveTheme, revokeAttachment, savePrefs, toAttachment, tokenize, useAppearancePrefs, useChatEngine, useDocumentTitle, useFeatureStatus, useLayerZIndex, usePopoverPosition, useResponsiveRail, useRuntimeMode, useServerTable, useSessionContext, useStackedLayer, useStagedFiles, validateFilterValue, visibleMessages };
package/dist/index.js CHANGED
@@ -202,6 +202,8 @@ function open(layer) {
202
202
  layer.order = ++lastOrder;
203
203
  lastClosed = null;
204
204
  if (layer.options.trap && !contains(scopeOf(layer), document.activeElement)) focusInto(layer);
205
+ zIndexVersion++;
206
+ notifyZIndexListeners();
205
207
  }
206
208
  function close(layer) {
207
209
  openLayers.delete(layer);
@@ -212,7 +214,53 @@ function close(layer) {
212
214
  document.removeEventListener("keydown", onKeydown);
213
215
  pendingEscape = null;
214
216
  }
217
+ zIndexVersion++;
218
+ notifyZIndexListeners();
215
219
  }
220
+ var LAYER_STEP = 10;
221
+ var ROOT_STEP = 100;
222
+ var OVERLAY_CEILING = 1e4;
223
+ var zIndexListeners = /* @__PURE__ */ new Set();
224
+ var notifyZIndexListeners = () => {
225
+ zIndexListeners.forEach((listener) => listener());
226
+ };
227
+ var subscribeZIndex = (listener) => {
228
+ zIndexListeners.add(listener);
229
+ return () => {
230
+ zIndexListeners.delete(listener);
231
+ };
232
+ };
233
+ var zIndexVersion = 0;
234
+ var getZIndexVersion = () => zIndexVersion;
235
+ function openSiblingsOf(layer) {
236
+ const siblings = [];
237
+ for (const l of openLayers) if (l.parent === layer.parent) siblings.push(l);
238
+ return siblings.sort((a, b) => a.order - b.order);
239
+ }
240
+ function computeZIndex(layer) {
241
+ const path = [];
242
+ for (let l = layer; l; l = l.parent) path.push(l);
243
+ path.reverse();
244
+ let z = 0;
245
+ for (const l of path) {
246
+ const siblings = openSiblingsOf(l);
247
+ const index = Math.max(0, siblings.indexOf(l));
248
+ z = l.parent === null ? (index + 1) * ROOT_STEP : z + LAYER_STEP + index;
249
+ }
250
+ return z;
251
+ }
252
+ function useLayerZIndex(layer) {
253
+ React2.useSyncExternalStore(subscribeZIndex, getZIndexVersion, getZIndexVersion);
254
+ const l = layer;
255
+ return l.order > 0 ? computeZIndex(l) : 0;
256
+ }
257
+ var __resetLayerStackForTests = () => {
258
+ openLayers.clear();
259
+ lastOrder = 0;
260
+ pendingEscape = null;
261
+ lastClosed = null;
262
+ notifyZIndexListeners();
263
+ };
216
264
  function returnFocus(layer) {
217
265
  if (layer.options.returnFocus === false) return;
218
266
  const current2 = document.activeElement;
@@ -369,50 +417,6 @@ var portal = (node) => {
369
417
  if (typeof document !== "undefined") return createPortal(node, document.body);
370
418
  return node;
371
419
  };
372
- var ROOT_LAYER = 0;
373
- var LAYER_STEP = 10;
374
- var ROOT_STEP = 100;
375
- var OVERLAY_CEILING = 1e4;
376
- var LayerContext2 = React3.createContext(ROOT_LAYER);
377
- var openRootIds = [];
378
- var rootListeners = /* @__PURE__ */ new Set();
379
- var notifyRootListeners = () => {
380
- rootListeners.forEach((listener) => listener());
381
- };
382
- var subscribeRootOverlays = (listener) => {
383
- rootListeners.add(listener);
384
- return () => {
385
- rootListeners.delete(listener);
386
- };
387
- };
388
- var getRootOverlaysSnapshot = () => openRootIds;
389
- var registerRootOverlay = (id) => {
390
- if (openRootIds.includes(id)) return;
391
- openRootIds = [...openRootIds, id];
392
- notifyRootListeners();
393
- };
394
- var unregisterRootOverlay = (id) => {
395
- if (!openRootIds.includes(id)) return;
396
- openRootIds = openRootIds.filter((existing) => existing !== id);
397
- notifyRootListeners();
398
- };
399
- var useLayer = () => React3.useContext(LayerContext2);
400
- var useOverlayLayer = (isOpen) => {
401
- const parent = useLayer();
402
- const isRoot = parent === ROOT_LAYER;
403
- const id = React3.useId();
404
- const openIds = React3.useSyncExternalStore(subscribeRootOverlays, getRootOverlaysSnapshot, getRootOverlaysSnapshot);
405
- React3.useLayoutEffect(() => {
406
- if (!isRoot || !isOpen) return;
407
- registerRootOverlay(id);
408
- return () => unregisterRootOverlay(id);
409
- }, [isRoot, isOpen, id]);
410
- if (!isRoot) return parent + LAYER_STEP;
411
- if (!isOpen) return ROOT_LAYER;
412
- const index = openIds.indexOf(id);
413
- return index === -1 ? ROOT_LAYER : (index + 1) * ROOT_STEP;
414
- };
415
- var LayerProvider = ({ zIndex, children }) => /* @__PURE__ */ jsx4(LayerContext2.Provider, { value: zIndex, children });
416
420
  function Popover({
417
421
  open: open2,
418
422
  anchorRef,
@@ -448,8 +452,8 @@ function Popover({
448
452
  onDetach: onClose,
449
453
  layerRef: ref
450
454
  });
451
- const zIndex = useOverlayLayer(!!open2);
452
455
  const layer = useStackedLayer({ active: !!open2, containerRef: ref, onEscape: closeOnEscape ? onClose : void 0, returnFocus: returnFocus2 });
456
+ const zIndex = useLayerZIndex(layer);
453
457
  React3.useEffect(() => {
454
458
  if (!open2) return;
455
459
  const away = (e) => {
@@ -465,7 +469,7 @@ function Popover({
465
469
  }, [open2, closeOnOutside, onClose, anchorRef, triggerRef, layer]);
466
470
  if (!open2 || !pos) return null;
467
471
  return portal(
468
- /* @__PURE__ */ jsx4(LayerProvider, { zIndex, children: /* @__PURE__ */ jsx4(StackedLayerProvider, { layer, children: /* @__PURE__ */ jsxs3(
472
+ /* @__PURE__ */ jsx4(StackedLayerProvider, { layer, children: /* @__PURE__ */ jsxs3(
469
473
  "div",
470
474
  {
471
475
  ref,
@@ -508,7 +512,7 @@ function Popover({
508
512
  footer != null ? /* @__PURE__ */ jsx4("div", { className: "fd-pop-footer", children: footer }) : null
509
513
  ]
510
514
  }
511
- ) }) })
515
+ ) })
512
516
  );
513
517
  }
514
518
  var isItem = (it) => !!it && it.kind !== "separator" && it.kind !== "section" && it.kind !== "custom" && !it.disabled;
@@ -760,6 +764,7 @@ import { jsx as jsx6 } from "react/jsx-runtime";
760
764
  function AnchoredPopover({ rect, width = 620, onClose, children }) {
761
765
  const ref = React4.useRef(null);
762
766
  const layer = useStackedLayer({ active: !!rect, containerRef: ref, onEscape: onClose });
767
+ const zIndex = useLayerZIndex(layer);
763
768
  const w = Math.min(width, window.innerWidth - 32);
764
769
  const [h, setH] = React4.useState(0);
765
770
  React4.useLayoutEffect(() => {
@@ -801,7 +806,7 @@ function AnchoredPopover({ rect, width = 620, onClose, children }) {
801
806
  left,
802
807
  top,
803
808
  width: w,
804
- zIndex: 150,
809
+ zIndex,
805
810
  maxHeight: `calc(100vh - ${PAD * 2}px)`,
806
811
  overflowY: "auto",
807
812
  background: "var(--surface)",
@@ -924,7 +929,6 @@ import * as React6 from "react";
924
929
  import { createPortal as createPortal2 } from "react-dom";
925
930
  import { jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
926
931
  function Drawer({ open: open2 = true, title, onClose, footer, children, className = "", ...rest }) {
927
- const zIndex = useOverlayLayer(open2);
928
932
  const asideRef = React6.useRef(null);
929
933
  const [closing, setClosing] = React6.useState(false);
930
934
  const close2 = React6.useCallback(() => {
@@ -933,9 +937,10 @@ function Drawer({ open: open2 = true, title, onClose, footer, children, classNam
933
937
  setTimeout(onClose, 210);
934
938
  }, [onClose]);
935
939
  const layer = useStackedLayer({ active: !!open2, containerRef: asideRef, trap: true, onEscape: onClose ? close2 : void 0 });
940
+ const zIndex = useLayerZIndex(layer);
936
941
  if (!open2) return null;
937
942
  return createPortal2(
938
- /* @__PURE__ */ jsx9(LayerProvider, { zIndex, children: /* @__PURE__ */ jsxs6(StackedLayerProvider, { layer, children: [
943
+ /* @__PURE__ */ jsxs6(StackedLayerProvider, { layer, children: [
939
944
  /* @__PURE__ */ jsx9("div", { className: "fd-scrim" + (closing ? " is-closing" : ""), style: { display: "block", zIndex: zIndex - LAYER_STEP }, onClick: close2 }),
940
945
  /* @__PURE__ */ jsxs6("aside", { ref: asideRef, className: ["fd-drawer", closing ? "is-closing" : "", className].filter(Boolean).join(" "), role: "dialog", "aria-modal": "true", ...rest, style: { zIndex }, children: [
941
946
  /* @__PURE__ */ jsxs6("div", { className: "fd-card-head", style: { flex: "none" }, children: [
@@ -945,7 +950,7 @@ function Drawer({ open: open2 = true, title, onClose, footer, children, classNam
945
950
  /* @__PURE__ */ jsx9("div", { style: { flex: "1 1 auto", minHeight: 0, overflow: "auto", padding: 20 }, children }),
946
951
  footer ? /* @__PURE__ */ jsx9("div", { className: "fd-card-foot", style: { flex: "none" }, children: typeof footer === "function" ? footer(close2) : footer }) : null
947
952
  ] })
948
- ] }) }),
953
+ ] }),
949
954
  document.body
950
955
  );
951
956
  }
@@ -957,16 +962,16 @@ import { jsx as jsx10, jsxs as jsxs7 } from "react/jsx-runtime";
957
962
  function Modal({ open: open2 = true, title, description, onClose, footer, wide = false, children, className = "", ...rest }) {
958
963
  const [closing, setClosing] = React7.useState(false);
959
964
  const boxRef = React7.useRef(null);
960
- const zIndex = useOverlayLayer(!!open2);
961
965
  const close2 = React7.useCallback(() => {
962
966
  if (!onClose) return;
963
967
  setClosing(true);
964
968
  setTimeout(onClose, 190);
965
969
  }, [onClose]);
966
970
  const layer = useStackedLayer({ active: !!open2, containerRef: boxRef, trap: true, onEscape: onClose ? close2 : void 0 });
971
+ const zIndex = useLayerZIndex(layer);
967
972
  if (!open2) return null;
968
973
  return createPortal3(
969
- /* @__PURE__ */ jsx10(LayerProvider, { zIndex, children: /* @__PURE__ */ jsx10(StackedLayerProvider, { layer, children: /* @__PURE__ */ jsx10(
974
+ /* @__PURE__ */ jsx10(StackedLayerProvider, { layer, children: /* @__PURE__ */ jsx10(
970
975
  "div",
971
976
  {
972
977
  className: "fd-scrim" + (closing ? " is-closing" : ""),
@@ -997,7 +1002,7 @@ function Modal({ open: open2 = true, title, description, onClose, footer, wide =
997
1002
  }
998
1003
  )
999
1004
  }
1000
- ) }) }),
1005
+ ) }),
1001
1006
  document.body
1002
1007
  );
1003
1008
  }
@@ -1860,8 +1865,8 @@ function Tooltip({ label, placement = "top", children, className = "" }) {
1860
1865
  layerRef: bubbleRef,
1861
1866
  onDetach: hide
1862
1867
  });
1863
- const zIndex = useOverlayLayer(open2);
1864
- useStackedLayer({ active: open2, containerRef: bubbleRef, onEscape: hide, returnFocus: false });
1868
+ const layer = useStackedLayer({ active: open2, containerRef: bubbleRef, onEscape: hide, returnFocus: false });
1869
+ const zIndex = useLayerZIndex(layer);
1865
1870
  React14.useEffect(() => {
1866
1871
  if (!open2) return;
1867
1872
  const away = (e) => {
@@ -5184,9 +5189,9 @@ import * as React31 from "react";
5184
5189
  import { jsx as jsx54 } from "react/jsx-runtime";
5185
5190
  function useInlinePanel() {
5186
5191
  const [open2, setOpen] = React31.useState(false);
5187
- const zIndex = useOverlayLayer(open2);
5188
5192
  const ref = React31.useRef(null);
5189
5193
  const layer = useStackedLayer({ active: open2, containerRef: ref, onEscape: () => setOpen(false) });
5194
+ const zIndex = useLayerZIndex(layer);
5190
5195
  React31.useEffect(() => {
5191
5196
  if (!open2) return;
5192
5197
  const away = (e) => {
@@ -5198,7 +5203,7 @@ function useInlinePanel() {
5198
5203
  return { open: open2, setOpen, ref, zIndex, layer };
5199
5204
  }
5200
5205
  function InlinePanelLayers({ panel, children }) {
5201
- return /* @__PURE__ */ jsx54(LayerProvider, { zIndex: panel.zIndex, children: /* @__PURE__ */ jsx54(StackedLayerProvider, { layer: panel.layer, children }) });
5206
+ return /* @__PURE__ */ jsx54(StackedLayerProvider, { layer: panel.layer, children });
5202
5207
  }
5203
5208
 
5204
5209
  // src/components/data/SortMenu.tsx
@@ -10728,7 +10733,9 @@ function ComingSoon({
10728
10733
  function InlineSoon({ label, detail, backend, eta, effort, onRoadmap, allowed, onBypass, blur, tip, className, rest, children }) {
10729
10734
  const [open2, setOpen] = React55.useState(false);
10730
10735
  const [anchor, pos] = useHoverCard(open2);
10731
- const zIndex = useOverlayLayer(open2);
10736
+ const hoverCardRef = React55.useRef(null);
10737
+ const hoverLayer = useStackedLayer({ active: open2, containerRef: hoverCardRef, returnFocus: false });
10738
+ const zIndex = useLayerZIndex(hoverLayer);
10732
10739
  const close2 = React55.useRef(null);
10733
10740
  const show = () => {
10734
10741
  if (close2.current) {
@@ -10775,9 +10782,10 @@ function InlineSoon({ label, detail, backend, eta, effort, onRoadmap, allowed, o
10775
10782
  }
10776
10783
  ),
10777
10784
  open2 && pos ? createPortal5(
10778
- /* @__PURE__ */ jsx80(LayerProvider, { zIndex, children: /* @__PURE__ */ jsx80(
10785
+ /* @__PURE__ */ jsx80(
10779
10786
  "div",
10780
10787
  {
10788
+ ref: hoverCardRef,
10781
10789
  className: "fd-soon-note fd-soon-hovercard",
10782
10790
  role: "tooltip",
10783
10791
  style: { position: "fixed", left: pos.left, top: pos.top, bottom: pos.bottom, width: pos.width, zIndex },
@@ -10797,7 +10805,7 @@ function InlineSoon({ label, detail, backend, eta, effort, onRoadmap, allowed, o
10797
10805
  }
10798
10806
  )
10799
10807
  }
10800
- ) }),
10808
+ ),
10801
10809
  document.body
10802
10810
  ) : null
10803
10811
  ]
@@ -14351,6 +14359,7 @@ export {
14351
14359
  JobTray,
14352
14360
  Json,
14353
14361
  KeyHint,
14362
+ LAYER_STEP,
14354
14363
  LoadingRegion,
14355
14364
  Markdown,
14356
14365
  MarkdownEditor,
@@ -14365,6 +14374,7 @@ export {
14365
14374
  ModeSwitch,
14366
14375
  ModelControls,
14367
14376
  NumberInput,
14377
+ OVERLAY_CEILING,
14368
14378
  POPOVER_BODY_MIN,
14369
14379
  PacketCard,
14370
14380
  Pagination,
@@ -14377,6 +14387,7 @@ export {
14377
14387
  ProgressBar,
14378
14388
  QueryKit,
14379
14389
  QuotaRow,
14390
+ ROOT_STEP,
14380
14391
  Radio,
14381
14392
  RangeSlider,
14382
14393
  RelativeTime,
@@ -14421,6 +14432,7 @@ export {
14421
14432
  VIRTUAL_LIST_BUFFER_ROWS,
14422
14433
  VIRTUAL_LIST_ROW_GAP,
14423
14434
  VirtualList,
14435
+ __resetLayerStackForTests,
14424
14436
  acceptMatches,
14425
14437
  anyOfFilter,
14426
14438
  applyPrefs,
@@ -14470,6 +14482,7 @@ export {
14470
14482
  useChatEngine,
14471
14483
  useDocumentTitle,
14472
14484
  useFeatureStatus,
14485
+ useLayerZIndex,
14473
14486
  usePopoverPosition,
14474
14487
  useResponsiveRail,
14475
14488
  useRuntimeMode,