@adea-ai/ui 0.161.9 → 0.162.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/components/composites/appearance-editor/appearance-choices.d.ts.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-choices.js +11 -3
- package/dist/components/composites/appearance-editor/appearance-choices.js.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-editor.d.ts.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-editor.js +1 -4
- package/dist/components/composites/appearance-editor/appearance-editor.js.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-rows.d.ts +2 -0
- package/dist/components/composites/appearance-editor/appearance-rows.d.ts.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-rows.js +4 -1
- package/dist/components/composites/appearance-editor/appearance-rows.js.map +1 -1
- package/dist/components/composites/catalog-browser/catalog-browser.d.ts.map +1 -1
- package/dist/components/composites/catalog-browser/catalog-browser.js +77 -40
- package/dist/components/composites/catalog-browser/catalog-browser.js.map +1 -1
- package/dist/components/composites/catalog-browser/catalog-types.d.ts +5 -0
- package/dist/components/composites/catalog-browser/catalog-types.d.ts.map +1 -1
- package/dist/components/composites/settings/settings-navigation.d.ts.map +1 -1
- package/dist/components/composites/settings/settings-navigation.js +13 -4
- package/dist/components/composites/settings/settings-navigation.js.map +1 -1
- package/dist/r/src/components/composites/appearance-editor/appearance-choices.tsx +9 -3
- package/dist/r/src/components/composites/appearance-editor/appearance-editor.tsx +3 -7
- package/dist/r/src/components/composites/appearance-editor/appearance-rows.tsx +8 -1
- package/dist/r/src/components/composites/catalog-browser/catalog-browser.tsx +27 -6
- package/dist/r/src/components/composites/catalog-browser/catalog-types.ts +5 -0
- package/dist/r/src/components/composites/settings/settings-navigation.tsx +33 -6
- package/package.json +1 -1
- package/src/components/composites/appearance-editor/appearance-choices.tsx +9 -3
- package/src/components/composites/appearance-editor/appearance-editor.tsx +3 -7
- package/src/components/composites/appearance-editor/appearance-rows.tsx +8 -1
- package/src/components/composites/catalog-browser/catalog-browser.tsx +27 -6
- package/src/components/composites/catalog-browser/catalog-types.ts +5 -0
- package/src/components/composites/settings/settings-navigation.tsx +33 -6
|
@@ -102,12 +102,6 @@ export function AppearanceEditor(props: AppearanceEditorProps) {
|
|
|
102
102
|
? `Theme ${offered.label.toLowerCase()} · The theme’s own color.`
|
|
103
103
|
: 'Theme default · This theme has no such accent.'
|
|
104
104
|
}
|
|
105
|
-
const glassDescription = () =>
|
|
106
|
-
props.draft.surface === 'opaque'
|
|
107
|
-
? 'Solid surfaces for every theme.'
|
|
108
|
-
: props.draft.surface === 'frosted'
|
|
109
|
-
? 'Theme-colored glass where supported.'
|
|
110
|
-
: (props.surfaceCapability.themeDefaultDescription ?? "Uses this theme's default surface.")
|
|
111
105
|
// One list when no section is asked for; otherwise only that section's rows.
|
|
112
106
|
const shows = (section: AppearanceEditorTab) =>
|
|
113
107
|
props.section === undefined || props.section === section
|
|
@@ -232,7 +226,9 @@ export function AppearanceEditor(props: AppearanceEditorProps) {
|
|
|
232
226
|
the closing slot to them for hosts whose order is palette and
|
|
233
227
|
surface first, text last. */}
|
|
234
228
|
<Show when={props.fontSettingsPlacement !== 'end'}>{fontRows()}</Show>
|
|
235
|
-
|
|
229
|
+
{/* No subtitle: the three choices fit beside the title, and each explains itself on
|
|
230
|
+
hover. */}
|
|
231
|
+
<SettingsRow title="Glass" icon={<PanelsTopLeft />} compact>
|
|
236
232
|
<GlassChoices {...props} />
|
|
237
233
|
</SettingsRow>
|
|
238
234
|
<Show when={!props.surfaceCapability.frosted && props.surfaceCapability.reason}>
|
|
@@ -62,6 +62,8 @@ export function SettingsRow(props: {
|
|
|
62
62
|
icon: JSX.Element
|
|
63
63
|
description?: JSX.Element
|
|
64
64
|
stacked?: boolean
|
|
65
|
+
/** A short title with no subtitle: the control keeps the title's line at a narrow width. */
|
|
66
|
+
compact?: boolean
|
|
65
67
|
children: JSX.Element
|
|
66
68
|
}) {
|
|
67
69
|
return (
|
|
@@ -74,7 +76,12 @@ export function SettingsRow(props: {
|
|
|
74
76
|
{/* Reserve readable copy before choosing a side-by-side control row.
|
|
75
77
|
Wrapping follows the actual host width and enlarged text, rather
|
|
76
78
|
than a viewport breakpoint that also matches a narrow popover. */}
|
|
77
|
-
<div
|
|
79
|
+
<div
|
|
80
|
+
class={cn('flex min-w-0 flex-1 items-center gap-3', {
|
|
81
|
+
'basis-48': !props.stacked && !props.compact,
|
|
82
|
+
'basis-24': !props.stacked && props.compact,
|
|
83
|
+
})}
|
|
84
|
+
>
|
|
78
85
|
<span
|
|
79
86
|
class="flex size-9 shrink-0 items-center justify-center rounded-lg border bg-foreground/5 text-muted-foreground [&_svg]:size-4"
|
|
80
87
|
aria-hidden="true"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createEffect, createMemo, createSignal, For, onSettled, Show } from 'solid-js'
|
|
1
|
+
import { children, createEffect, createMemo, createSignal, For, onSettled, Show } from 'solid-js'
|
|
2
2
|
import {
|
|
3
3
|
ArrowLeft as LucideArrowLeft,
|
|
4
4
|
Blocks as LucideBlocks,
|
|
@@ -114,6 +114,7 @@ export function CatalogBrowser<Value>(props: CatalogBrowserProps<Value>) {
|
|
|
114
114
|
const countLabel = () =>
|
|
115
115
|
props.status === 'loading' ? props.loadingLabel : props.resultLabel(props.resultCount)
|
|
116
116
|
const supplementalContent = () => props.renderSupplementalView?.(props.tab)
|
|
117
|
+
const tabsLeading = children(() => props.tabsLeading)
|
|
117
118
|
|
|
118
119
|
return (
|
|
119
120
|
<div class={cn('flex min-h-0 min-w-0 flex-1 flex-col', props.class)}>
|
|
@@ -125,11 +126,31 @@ export function CatalogBrowser<Value>(props: CatalogBrowserProps<Value>) {
|
|
|
125
126
|
value={props.tab}
|
|
126
127
|
onChange={(value: string | undefined) => value && props.onTabChange(value)}
|
|
127
128
|
>
|
|
128
|
-
<
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
129
|
+
<Show
|
|
130
|
+
when={tabsLeading()}
|
|
131
|
+
fallback={
|
|
132
|
+
<TabsList
|
|
133
|
+
aria-label={props.tabsLabel}
|
|
134
|
+
class="ms-auto max-w-full flex-wrap px-4 pt-2"
|
|
135
|
+
>
|
|
136
|
+
<For each={props.tabs}>
|
|
137
|
+
{(tab) => <TabsTrigger value={tab.id}>{tab.label}</TabsTrigger>}
|
|
138
|
+
</For>
|
|
139
|
+
</TabsList>
|
|
140
|
+
}
|
|
141
|
+
>
|
|
142
|
+
<div
|
|
143
|
+
class="flex min-w-0 shrink-0 flex-wrap items-center gap-2 px-4 pt-2"
|
|
144
|
+
data-slot="catalog-browser-tabs-row"
|
|
145
|
+
>
|
|
146
|
+
{tabsLeading()}
|
|
147
|
+
<TabsList aria-label={props.tabsLabel} class="ms-auto max-w-full flex-wrap">
|
|
148
|
+
<For each={props.tabs}>
|
|
149
|
+
{(tab) => <TabsTrigger value={tab.id}>{tab.label}</TabsTrigger>}
|
|
150
|
+
</For>
|
|
151
|
+
</TabsList>
|
|
152
|
+
</div>
|
|
153
|
+
</Show>
|
|
133
154
|
<TabsContent value={props.tab} class="flex min-h-0 min-w-0 flex-1 flex-col gap-3">
|
|
134
155
|
<Show
|
|
135
156
|
when={supplemental()}
|
|
@@ -45,6 +45,11 @@ export type CatalogBrowserProps<Value> = Readonly<{
|
|
|
45
45
|
tabs: readonly CatalogBrowserTab[]
|
|
46
46
|
tab: string
|
|
47
47
|
tabsLabel: string
|
|
48
|
+
/**
|
|
49
|
+
* A host control drawn at the start of the tabs row, such as a switch between two
|
|
50
|
+
* catalogs that share this frame. Without it the row holds the tabs alone.
|
|
51
|
+
*/
|
|
52
|
+
tabsLeading?: JSX.Element
|
|
48
53
|
onTabChange: (tab: string) => void
|
|
49
54
|
/** A host-owned view is rendered in the same tab frame without catalog assumptions. */
|
|
50
55
|
renderSupplementalView?: (tab: string) => JSX.Element | undefined
|
|
@@ -67,8 +67,22 @@ function scrollsOn(value: string): boolean {
|
|
|
67
67
|
return value === 'auto' || value === 'scroll'
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
/**
|
|
71
|
-
|
|
70
|
+
/**
|
|
71
|
+
* The nearest-edge delta that brings `[start, end]` inside `[min, max]`. A range longer than
|
|
72
|
+
* the viewport cannot fit, so it aligns its leading edge (`leadingEnd` for a right-to-left
|
|
73
|
+
* inline axis), where the label starts. Settling on whichever edge overflows instead flips
|
|
74
|
+
* between the two on every reveal: a row-forced strip's full-width rows are wider than its
|
|
75
|
+
* scroller, so each reveal of the same row moved it the other way and the row's position
|
|
76
|
+
* depended on how many reveals had run, leaving it scrolled out of view half the time.
|
|
77
|
+
*/
|
|
78
|
+
function nearestDelta(
|
|
79
|
+
start: number,
|
|
80
|
+
end: number,
|
|
81
|
+
min: number,
|
|
82
|
+
max: number,
|
|
83
|
+
leadingEnd = false
|
|
84
|
+
): number {
|
|
85
|
+
if (end - start > max - min) return leadingEnd ? end - max : start - min
|
|
72
86
|
if (start < min) return start - min
|
|
73
87
|
if (end > max) return end - max
|
|
74
88
|
return 0
|
|
@@ -88,12 +102,25 @@ function nearestDelta(start: number, end: number, min: number, max: number): num
|
|
|
88
102
|
* which is exactly where the browser would report it after that write.
|
|
89
103
|
*/
|
|
90
104
|
function revealNearest(row: HTMLElement): void {
|
|
91
|
-
const scrollers: {
|
|
105
|
+
const scrollers: {
|
|
106
|
+
container: HTMLElement
|
|
107
|
+
x: boolean
|
|
108
|
+
y: boolean
|
|
109
|
+
rtl: boolean
|
|
110
|
+
box: DOMRect
|
|
111
|
+
}[] = []
|
|
92
112
|
for (let container = row.parentElement; container; container = container.parentElement) {
|
|
93
113
|
const style = window.getComputedStyle(container)
|
|
94
114
|
const x = scrollsOn(style.overflowX)
|
|
95
115
|
const y = scrollsOn(style.overflowY)
|
|
96
|
-
if (x || y)
|
|
116
|
+
if (x || y)
|
|
117
|
+
scrollers.push({
|
|
118
|
+
container,
|
|
119
|
+
x,
|
|
120
|
+
y,
|
|
121
|
+
rtl: style.direction === 'rtl',
|
|
122
|
+
box: container.getBoundingClientRect(),
|
|
123
|
+
})
|
|
97
124
|
}
|
|
98
125
|
if (scrollers.length === 0) return
|
|
99
126
|
const rowBox = row.getBoundingClientRect()
|
|
@@ -102,8 +129,8 @@ function revealNearest(row: HTMLElement): void {
|
|
|
102
129
|
let top = rowBox.top
|
|
103
130
|
let bottom = rowBox.bottom
|
|
104
131
|
const writes: { container: HTMLElement; dx: number; dy: number }[] = []
|
|
105
|
-
for (const { container, x, y, box } of scrollers) {
|
|
106
|
-
const dx = x ? nearestDelta(left, right, box.left, box.right) : 0
|
|
132
|
+
for (const { container, x, y, rtl, box } of scrollers) {
|
|
133
|
+
const dx = x ? nearestDelta(left, right, box.left, box.right, rtl) : 0
|
|
107
134
|
const dy = y ? nearestDelta(top, bottom, box.top, box.bottom) : 0
|
|
108
135
|
if (dx === 0 && dy === 0) continue
|
|
109
136
|
writes.push({ container, dx, dy })
|
package/package.json
CHANGED
|
@@ -46,10 +46,11 @@ const MODES = [
|
|
|
46
46
|
{ value: 'light', label: 'Light' },
|
|
47
47
|
{ value: 'dark', label: 'Dark' },
|
|
48
48
|
] as const
|
|
49
|
+
// Short labels keep the three choices on the Glass row's own line; each says the rest on hover.
|
|
49
50
|
const SURFACES = [
|
|
50
|
-
{ value: 'theme', label: 'Theme
|
|
51
|
-
{ value: 'frosted', label: 'Frosted' },
|
|
52
|
-
{ value: 'opaque', label: 'Opaque' },
|
|
51
|
+
{ value: 'theme', label: 'Theme', hint: "Uses this theme's default surface." },
|
|
52
|
+
{ value: 'frosted', label: 'Frosted', hint: 'Theme-colored glass where supported.' },
|
|
53
|
+
{ value: 'opaque', label: 'Opaque', hint: 'Solid surfaces for every theme.' },
|
|
53
54
|
] as const
|
|
54
55
|
const MODE_ICONS = { system: Monitor, light: Sun, dark: Moon } as const
|
|
55
56
|
|
|
@@ -267,6 +268,11 @@ export function GlassChoices(props: AppearanceEditorProps) {
|
|
|
267
268
|
<div class="rounded-md focus-within:ring-3 focus-within:ring-ring/50">
|
|
268
269
|
<SdkRadio
|
|
269
270
|
value={option.value}
|
|
271
|
+
title={
|
|
272
|
+
option.value === 'theme'
|
|
273
|
+
? (props.surfaceCapability.themeDefaultDescription ?? option.hint)
|
|
274
|
+
: option.hint
|
|
275
|
+
}
|
|
270
276
|
disabled={option.value === 'frosted' && !props.surfaceCapability.frosted}
|
|
271
277
|
class="flex h-7 w-full cursor-pointer items-center rounded-md border px-2 text-xs whitespace-nowrap outline-none data-[checked]:border-primary data-[checked]:ring-1 data-[checked]:ring-primary data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50"
|
|
272
278
|
>
|
|
@@ -102,12 +102,6 @@ export function AppearanceEditor(props: AppearanceEditorProps) {
|
|
|
102
102
|
? `Theme ${offered.label.toLowerCase()} · The theme’s own color.`
|
|
103
103
|
: 'Theme default · This theme has no such accent.'
|
|
104
104
|
}
|
|
105
|
-
const glassDescription = () =>
|
|
106
|
-
props.draft.surface === 'opaque'
|
|
107
|
-
? 'Solid surfaces for every theme.'
|
|
108
|
-
: props.draft.surface === 'frosted'
|
|
109
|
-
? 'Theme-colored glass where supported.'
|
|
110
|
-
: (props.surfaceCapability.themeDefaultDescription ?? "Uses this theme's default surface.")
|
|
111
105
|
// One list when no section is asked for; otherwise only that section's rows.
|
|
112
106
|
const shows = (section: AppearanceEditorTab) =>
|
|
113
107
|
props.section === undefined || props.section === section
|
|
@@ -232,7 +226,9 @@ export function AppearanceEditor(props: AppearanceEditorProps) {
|
|
|
232
226
|
the closing slot to them for hosts whose order is palette and
|
|
233
227
|
surface first, text last. */}
|
|
234
228
|
<Show when={props.fontSettingsPlacement !== 'end'}>{fontRows()}</Show>
|
|
235
|
-
|
|
229
|
+
{/* No subtitle: the three choices fit beside the title, and each explains itself on
|
|
230
|
+
hover. */}
|
|
231
|
+
<SettingsRow title="Glass" icon={<PanelsTopLeft />} compact>
|
|
236
232
|
<GlassChoices {...props} />
|
|
237
233
|
</SettingsRow>
|
|
238
234
|
<Show when={!props.surfaceCapability.frosted && props.surfaceCapability.reason}>
|
|
@@ -62,6 +62,8 @@ export function SettingsRow(props: {
|
|
|
62
62
|
icon: JSX.Element
|
|
63
63
|
description?: JSX.Element
|
|
64
64
|
stacked?: boolean
|
|
65
|
+
/** A short title with no subtitle: the control keeps the title's line at a narrow width. */
|
|
66
|
+
compact?: boolean
|
|
65
67
|
children: JSX.Element
|
|
66
68
|
}) {
|
|
67
69
|
return (
|
|
@@ -74,7 +76,12 @@ export function SettingsRow(props: {
|
|
|
74
76
|
{/* Reserve readable copy before choosing a side-by-side control row.
|
|
75
77
|
Wrapping follows the actual host width and enlarged text, rather
|
|
76
78
|
than a viewport breakpoint that also matches a narrow popover. */}
|
|
77
|
-
<div
|
|
79
|
+
<div
|
|
80
|
+
class={cn('flex min-w-0 flex-1 items-center gap-3', {
|
|
81
|
+
'basis-48': !props.stacked && !props.compact,
|
|
82
|
+
'basis-24': !props.stacked && props.compact,
|
|
83
|
+
})}
|
|
84
|
+
>
|
|
78
85
|
<span
|
|
79
86
|
class="flex size-9 shrink-0 items-center justify-center rounded-lg border bg-foreground/5 text-muted-foreground [&_svg]:size-4"
|
|
80
87
|
aria-hidden="true"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createEffect, createMemo, createSignal, For, onSettled, Show } from 'solid-js'
|
|
1
|
+
import { children, createEffect, createMemo, createSignal, For, onSettled, Show } from 'solid-js'
|
|
2
2
|
import {
|
|
3
3
|
ArrowLeft as LucideArrowLeft,
|
|
4
4
|
Blocks as LucideBlocks,
|
|
@@ -114,6 +114,7 @@ export function CatalogBrowser<Value>(props: CatalogBrowserProps<Value>) {
|
|
|
114
114
|
const countLabel = () =>
|
|
115
115
|
props.status === 'loading' ? props.loadingLabel : props.resultLabel(props.resultCount)
|
|
116
116
|
const supplementalContent = () => props.renderSupplementalView?.(props.tab)
|
|
117
|
+
const tabsLeading = children(() => props.tabsLeading)
|
|
117
118
|
|
|
118
119
|
return (
|
|
119
120
|
<div class={cn('flex min-h-0 min-w-0 flex-1 flex-col', props.class)}>
|
|
@@ -125,11 +126,31 @@ export function CatalogBrowser<Value>(props: CatalogBrowserProps<Value>) {
|
|
|
125
126
|
value={props.tab}
|
|
126
127
|
onChange={(value: string | undefined) => value && props.onTabChange(value)}
|
|
127
128
|
>
|
|
128
|
-
<
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
129
|
+
<Show
|
|
130
|
+
when={tabsLeading()}
|
|
131
|
+
fallback={
|
|
132
|
+
<TabsList
|
|
133
|
+
aria-label={props.tabsLabel}
|
|
134
|
+
class="ms-auto max-w-full flex-wrap px-4 pt-2"
|
|
135
|
+
>
|
|
136
|
+
<For each={props.tabs}>
|
|
137
|
+
{(tab) => <TabsTrigger value={tab.id}>{tab.label}</TabsTrigger>}
|
|
138
|
+
</For>
|
|
139
|
+
</TabsList>
|
|
140
|
+
}
|
|
141
|
+
>
|
|
142
|
+
<div
|
|
143
|
+
class="flex min-w-0 shrink-0 flex-wrap items-center gap-2 px-4 pt-2"
|
|
144
|
+
data-slot="catalog-browser-tabs-row"
|
|
145
|
+
>
|
|
146
|
+
{tabsLeading()}
|
|
147
|
+
<TabsList aria-label={props.tabsLabel} class="ms-auto max-w-full flex-wrap">
|
|
148
|
+
<For each={props.tabs}>
|
|
149
|
+
{(tab) => <TabsTrigger value={tab.id}>{tab.label}</TabsTrigger>}
|
|
150
|
+
</For>
|
|
151
|
+
</TabsList>
|
|
152
|
+
</div>
|
|
153
|
+
</Show>
|
|
133
154
|
<TabsContent value={props.tab} class="flex min-h-0 min-w-0 flex-1 flex-col gap-3">
|
|
134
155
|
<Show
|
|
135
156
|
when={supplemental()}
|
|
@@ -45,6 +45,11 @@ export type CatalogBrowserProps<Value> = Readonly<{
|
|
|
45
45
|
tabs: readonly CatalogBrowserTab[]
|
|
46
46
|
tab: string
|
|
47
47
|
tabsLabel: string
|
|
48
|
+
/**
|
|
49
|
+
* A host control drawn at the start of the tabs row, such as a switch between two
|
|
50
|
+
* catalogs that share this frame. Without it the row holds the tabs alone.
|
|
51
|
+
*/
|
|
52
|
+
tabsLeading?: JSX.Element
|
|
48
53
|
onTabChange: (tab: string) => void
|
|
49
54
|
/** A host-owned view is rendered in the same tab frame without catalog assumptions. */
|
|
50
55
|
renderSupplementalView?: (tab: string) => JSX.Element | undefined
|
|
@@ -67,8 +67,22 @@ function scrollsOn(value: string): boolean {
|
|
|
67
67
|
return value === 'auto' || value === 'scroll'
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
/**
|
|
71
|
-
|
|
70
|
+
/**
|
|
71
|
+
* The nearest-edge delta that brings `[start, end]` inside `[min, max]`. A range longer than
|
|
72
|
+
* the viewport cannot fit, so it aligns its leading edge (`leadingEnd` for a right-to-left
|
|
73
|
+
* inline axis), where the label starts. Settling on whichever edge overflows instead flips
|
|
74
|
+
* between the two on every reveal: a row-forced strip's full-width rows are wider than its
|
|
75
|
+
* scroller, so each reveal of the same row moved it the other way and the row's position
|
|
76
|
+
* depended on how many reveals had run, leaving it scrolled out of view half the time.
|
|
77
|
+
*/
|
|
78
|
+
function nearestDelta(
|
|
79
|
+
start: number,
|
|
80
|
+
end: number,
|
|
81
|
+
min: number,
|
|
82
|
+
max: number,
|
|
83
|
+
leadingEnd = false
|
|
84
|
+
): number {
|
|
85
|
+
if (end - start > max - min) return leadingEnd ? end - max : start - min
|
|
72
86
|
if (start < min) return start - min
|
|
73
87
|
if (end > max) return end - max
|
|
74
88
|
return 0
|
|
@@ -88,12 +102,25 @@ function nearestDelta(start: number, end: number, min: number, max: number): num
|
|
|
88
102
|
* which is exactly where the browser would report it after that write.
|
|
89
103
|
*/
|
|
90
104
|
function revealNearest(row: HTMLElement): void {
|
|
91
|
-
const scrollers: {
|
|
105
|
+
const scrollers: {
|
|
106
|
+
container: HTMLElement
|
|
107
|
+
x: boolean
|
|
108
|
+
y: boolean
|
|
109
|
+
rtl: boolean
|
|
110
|
+
box: DOMRect
|
|
111
|
+
}[] = []
|
|
92
112
|
for (let container = row.parentElement; container; container = container.parentElement) {
|
|
93
113
|
const style = window.getComputedStyle(container)
|
|
94
114
|
const x = scrollsOn(style.overflowX)
|
|
95
115
|
const y = scrollsOn(style.overflowY)
|
|
96
|
-
if (x || y)
|
|
116
|
+
if (x || y)
|
|
117
|
+
scrollers.push({
|
|
118
|
+
container,
|
|
119
|
+
x,
|
|
120
|
+
y,
|
|
121
|
+
rtl: style.direction === 'rtl',
|
|
122
|
+
box: container.getBoundingClientRect(),
|
|
123
|
+
})
|
|
97
124
|
}
|
|
98
125
|
if (scrollers.length === 0) return
|
|
99
126
|
const rowBox = row.getBoundingClientRect()
|
|
@@ -102,8 +129,8 @@ function revealNearest(row: HTMLElement): void {
|
|
|
102
129
|
let top = rowBox.top
|
|
103
130
|
let bottom = rowBox.bottom
|
|
104
131
|
const writes: { container: HTMLElement; dx: number; dy: number }[] = []
|
|
105
|
-
for (const { container, x, y, box } of scrollers) {
|
|
106
|
-
const dx = x ? nearestDelta(left, right, box.left, box.right) : 0
|
|
132
|
+
for (const { container, x, y, rtl, box } of scrollers) {
|
|
133
|
+
const dx = x ? nearestDelta(left, right, box.left, box.right, rtl) : 0
|
|
107
134
|
const dy = y ? nearestDelta(top, bottom, box.top, box.bottom) : 0
|
|
108
135
|
if (dx === 0 && dy === 0) continue
|
|
109
136
|
writes.push({ container, dx, dy })
|