@adea-ai/ui 0.151.2 → 0.151.8
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 +5 -0
- package/dist/components/composites/action-button/action-button.d.ts.map +1 -1
- package/dist/components/composites/action-button/action-button.js +8 -2
- package/dist/components/composites/action-button/action-button.js.map +1 -1
- package/dist/components/composites/inline-citation/inline-citation.d.ts.map +1 -1
- package/dist/components/composites/inline-citation/inline-citation.js +39 -36
- package/dist/components/composites/inline-citation/inline-citation.js.map +1 -1
- package/dist/components/conversation/scroll-follow-core.d.ts +13 -0
- package/dist/components/conversation/scroll-follow-core.d.ts.map +1 -1
- package/dist/components/conversation/scroll-follow-core.js +12 -1
- package/dist/components/conversation/scroll-follow-core.js.map +1 -1
- package/dist/components/conversation/scroll-follow.d.ts.map +1 -1
- package/dist/components/conversation/scroll-follow.js +52 -21
- package/dist/components/conversation/scroll-follow.js.map +1 -1
- package/dist/components/ui/calendar/calendar.d.ts.map +1 -1
- package/dist/components/ui/calendar/calendar.js +109 -115
- package/dist/components/ui/calendar/calendar.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/r/src/components/composites/action-button/action-button.tsx +11 -1
- package/dist/r/src/components/composites/inline-citation/inline-citation.tsx +112 -105
- package/dist/r/src/components/conversation/scroll-follow-core.ts +23 -0
- package/dist/r/src/components/conversation/scroll-follow.ts +69 -17
- package/dist/r/src/components/ui/calendar/calendar.tsx +99 -104
- package/package.json +8 -2
- package/src/components/composites/action-button/action-button.tsx +11 -1
- package/src/components/composites/inline-citation/inline-citation.tsx +112 -105
- package/src/components/conversation/scroll-follow-core.ts +23 -0
- package/src/components/conversation/scroll-follow.ts +69 -17
- package/src/components/ui/calendar/calendar.tsx +99 -104
- package/src/index.ts +1 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { For, Show, splitProps, type ComponentProps, type JSX } from 'solid-js'
|
|
1
|
+
import { createMemo, For, Show, splitProps, type ComponentProps, type JSX } from 'solid-js'
|
|
2
2
|
import Calendar, {
|
|
3
3
|
type RootProps as CorvuCalendarProps,
|
|
4
4
|
type RootSingleProps,
|
|
@@ -73,22 +73,6 @@ const EXTRAS = ['weekdayLabels', 'previousLabel', 'nextLabel', 'formatMonth', 'c
|
|
|
73
73
|
|
|
74
74
|
const MONTH_FORMAT: Intl.DateTimeFormatOptions = { month: 'long', year: 'numeric' }
|
|
75
75
|
|
|
76
|
-
function monthLabel(month: Date, format?: (month: Date) => string): string {
|
|
77
|
-
return format ? format(month) : new Intl.DateTimeFormat(undefined, MONTH_FORMAT).format(month)
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* A day's accessible name: the full date, because the visible number is only
|
|
82
|
-
* meaningful next to its column heading.
|
|
83
|
-
*/
|
|
84
|
-
function dayLabel(day: Date): string {
|
|
85
|
-
return new Intl.DateTimeFormat(undefined, {
|
|
86
|
-
day: 'numeric',
|
|
87
|
-
month: 'long',
|
|
88
|
-
year: 'numeric',
|
|
89
|
-
}).format(day)
|
|
90
|
-
}
|
|
91
|
-
|
|
92
76
|
/** The locale's short weekday names, Sunday first — which is the order corvu's `weeks` use. */
|
|
93
77
|
function defaultWeekdays(): string[] {
|
|
94
78
|
const format = new Intl.DateTimeFormat(undefined, { weekday: 'short' })
|
|
@@ -108,82 +92,92 @@ function CalendarGrid(props: {
|
|
|
108
92
|
formatMonth?: (month: Date) => string
|
|
109
93
|
}) {
|
|
110
94
|
const context = Calendar.useContext()
|
|
111
|
-
const weekdays = () => props.weekdayLabels ?? defaultWeekdays()
|
|
112
|
-
|
|
113
95
|
return (
|
|
114
96
|
<For each={context.months()}>
|
|
115
|
-
{(month, index) =>
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
<
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
97
|
+
{(month, index) => {
|
|
98
|
+
const weekdays = createMemo(() => props.weekdayLabels ?? defaultWeekdays())
|
|
99
|
+
// Recreate per month so navigation picks up changed locale and time-zone defaults.
|
|
100
|
+
const dayFormatter = new Intl.DateTimeFormat(undefined, {
|
|
101
|
+
day: 'numeric',
|
|
102
|
+
month: 'long',
|
|
103
|
+
year: 'numeric',
|
|
104
|
+
})
|
|
105
|
+
const monthLabel = (date: Date) =>
|
|
106
|
+
props.formatMonth
|
|
107
|
+
? props.formatMonth(date)
|
|
108
|
+
: new Intl.DateTimeFormat(undefined, MONTH_FORMAT).format(date)
|
|
109
|
+
return (
|
|
110
|
+
<div class="flex flex-col gap-2">
|
|
111
|
+
<div class="flex items-center justify-between gap-2">
|
|
112
|
+
<Calendar.Nav
|
|
113
|
+
action="prev-month"
|
|
114
|
+
as={Button}
|
|
115
|
+
variant="ghost"
|
|
116
|
+
size="icon-sm"
|
|
117
|
+
aria-label={props.previousLabel}
|
|
118
|
+
>
|
|
119
|
+
<ChevronLeft aria-hidden="true" />
|
|
120
|
+
</Calendar.Nav>
|
|
121
|
+
<Calendar.Label index={index()} class="text-sm font-semibold text-foreground">
|
|
122
|
+
{monthLabel(month.month)}
|
|
123
|
+
</Calendar.Label>
|
|
124
|
+
<Calendar.Nav
|
|
125
|
+
action="next-month"
|
|
126
|
+
as={Button}
|
|
127
|
+
variant="ghost"
|
|
128
|
+
size="icon-sm"
|
|
129
|
+
aria-label={props.nextLabel}
|
|
130
|
+
>
|
|
131
|
+
<ChevronRight aria-hidden="true" />
|
|
132
|
+
</Calendar.Nav>
|
|
133
|
+
</div>
|
|
134
|
+
<Calendar.Table class="w-full border-collapse">
|
|
135
|
+
<thead>
|
|
136
|
+
<tr>
|
|
137
|
+
<For each={weekdays()}>
|
|
138
|
+
{(label) => (
|
|
139
|
+
<Calendar.HeadCell
|
|
140
|
+
as="th"
|
|
141
|
+
scope="col"
|
|
142
|
+
class="pb-1 text-2xs font-medium text-muted-foreground"
|
|
143
|
+
>
|
|
144
|
+
{label}
|
|
145
|
+
</Calendar.HeadCell>
|
|
146
|
+
)}
|
|
147
|
+
</For>
|
|
148
|
+
</tr>
|
|
149
|
+
</thead>
|
|
150
|
+
<tbody>
|
|
151
|
+
<For each={month.weeks}>
|
|
152
|
+
{(week) => (
|
|
153
|
+
<tr>
|
|
154
|
+
<For each={week}>
|
|
155
|
+
{(day) => (
|
|
156
|
+
<Calendar.Cell as="td" class="p-0.5 text-center">
|
|
157
|
+
<Calendar.CellTrigger
|
|
158
|
+
as="button"
|
|
159
|
+
day={day}
|
|
160
|
+
month={month.month}
|
|
161
|
+
class={cn(
|
|
162
|
+
'w-full rounded-md text-xs text-foreground transition-colors',
|
|
163
|
+
'min-h-control-xs',
|
|
164
|
+
'hover:bg-muted focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none',
|
|
165
|
+
// Styled from data states, so a day can be a range
|
|
166
|
+
// end and today at once without a prop per pair.
|
|
167
|
+
'data-selected:bg-primary data-selected:text-primary-foreground',
|
|
168
|
+
// corvu marks every day of a range selected, so the
|
|
169
|
+
// span between the ends steps back to the subtle
|
|
170
|
+
// fill and the ends take the solid one again.
|
|
171
|
+
'data-in-range:bg-primary-subtle data-in-range:text-foreground',
|
|
172
|
+
'data-range-start:bg-primary data-range-start:text-primary-foreground',
|
|
173
|
+
'data-range-end:bg-primary data-range-end:text-primary-foreground',
|
|
174
|
+
'data-range-start:rounded-r-none data-range-end:rounded-l-none',
|
|
175
|
+
'data-today:ring-1 data-today:ring-ring',
|
|
176
|
+
'data-disabled:text-muted-foreground data-disabled:line-through',
|
|
177
|
+
'data-disabled:hover:bg-transparent'
|
|
178
|
+
)}
|
|
179
|
+
>
|
|
180
|
+
{/*
|
|
187
181
|
The trigger renders no children of its own, so the
|
|
188
182
|
day number is the caller's — without it every cell
|
|
189
183
|
is an unnamed button (`button-name`).
|
|
@@ -194,19 +188,20 @@ function CalendarGrid(props: {
|
|
|
194
188
|
is hidden from the accessibility tree and the date
|
|
195
189
|
supplies the name.
|
|
196
190
|
*/}
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
191
|
+
<span aria-hidden="true">{day.getDate()}</span>
|
|
192
|
+
<span class="visually-hidden">{dayFormatter.format(day)}</span>
|
|
193
|
+
</Calendar.CellTrigger>
|
|
194
|
+
</Calendar.Cell>
|
|
195
|
+
)}
|
|
196
|
+
</For>
|
|
197
|
+
</tr>
|
|
198
|
+
)}
|
|
199
|
+
</For>
|
|
200
|
+
</tbody>
|
|
201
|
+
</Calendar.Table>
|
|
202
|
+
</div>
|
|
203
|
+
)
|
|
204
|
+
}}
|
|
210
205
|
</For>
|
|
211
206
|
)
|
|
212
207
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adea-ai/ui",
|
|
3
|
-
"version": "0.151.
|
|
3
|
+
"version": "0.151.8",
|
|
4
4
|
"description": "The Adea design system: Kobalte-backed Solid components, semantic OKLCH tokens, and the app-shell layout primitives shared by Adea and Cortana.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"adea",
|
|
@@ -91,6 +91,12 @@
|
|
|
91
91
|
"development": "./src/components/theme/lazy.ts",
|
|
92
92
|
"import": "./dist/components/theme/lazy.js"
|
|
93
93
|
},
|
|
94
|
+
"./components/ui/kbd/platform-modifier": {
|
|
95
|
+
"types": "./dist/components/ui/kbd/platform-modifier.d.ts",
|
|
96
|
+
"solid": "./src/components/ui/kbd/platform-modifier.ts",
|
|
97
|
+
"development": "./src/components/ui/kbd/platform-modifier.ts",
|
|
98
|
+
"import": "./dist/components/ui/kbd/platform-modifier.js"
|
|
99
|
+
},
|
|
94
100
|
"./components/layout/split-layout/model": {
|
|
95
101
|
"types": "./dist/components/layout/split-layout/model.d.ts",
|
|
96
102
|
"solid": "./src/components/layout/split-layout/model.ts",
|
|
@@ -120,7 +126,7 @@
|
|
|
120
126
|
"build": "bun run cn:build && vite build && tsc -p tsconfig.json --emitDeclarationOnly",
|
|
121
127
|
"dev": "bun run cn:build && vite build --watch",
|
|
122
128
|
"lint": "oxlint",
|
|
123
|
-
"test": "bun run cn:check && bun test --conditions=browser --preload ./src/testing/solid-transform.ts tests src",
|
|
129
|
+
"test": "bun run cn:check && bun test --timeout=${ADEA_TEST_TIMEOUT_MS:-5000} --conditions=browser --preload ./src/testing/solid-transform.ts tests src",
|
|
124
130
|
"typecheck": "bun check -p tsconfig.check.json",
|
|
125
131
|
"cn:build": "bun scripts/build-cn-tables.ts",
|
|
126
132
|
"cn:check": "bun scripts/check-cn-tables.ts",
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Show,
|
|
3
|
+
createRoot,
|
|
3
4
|
createSignal,
|
|
4
5
|
splitProps,
|
|
5
6
|
type ComponentProps,
|
|
@@ -66,7 +67,16 @@ function guardedClick(
|
|
|
66
67
|
onActivate: (event: MouseEvent) => void = () => {}
|
|
67
68
|
) {
|
|
68
69
|
return (event: MouseEvent) => {
|
|
69
|
-
|
|
70
|
+
// A polymorphic trigger can provide a getter that creates reactive work.
|
|
71
|
+
// Event callbacks have no owner, so dispose any such work after the read.
|
|
72
|
+
const isDisabled = createRoot((dispose) => {
|
|
73
|
+
try {
|
|
74
|
+
return disabled()
|
|
75
|
+
} finally {
|
|
76
|
+
dispose()
|
|
77
|
+
}
|
|
78
|
+
})
|
|
79
|
+
if (isDisabled) {
|
|
70
80
|
event.preventDefault()
|
|
71
81
|
event.stopImmediatePropagation()
|
|
72
82
|
return
|
|
@@ -157,116 +157,123 @@ export function InlineCitation(props: InlineCitationProps) {
|
|
|
157
157
|
if (wasPeeking) queueMicrotask(() => content?.focus())
|
|
158
158
|
}
|
|
159
159
|
|
|
160
|
+
// The badge and the popover's portal marker share one wrapper. Without it they
|
|
161
|
+
// are loose siblings in the host's node list, and when the portal marker comes
|
|
162
|
+
// and goes as the card opens and closes, a host that renders its inline nodes
|
|
163
|
+
// as one array (MessageText) reconciles that array and can move the badge,
|
|
164
|
+
// which drops keyboard focus to <body> on the badge the reader just reached.
|
|
160
165
|
return (
|
|
161
166
|
<Show when={count() > 0}>
|
|
162
|
-
<
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
placement="bottom"
|
|
168
|
-
gutter={6}
|
|
169
|
-
>
|
|
170
|
-
<PopoverTrigger
|
|
171
|
-
as={Button}
|
|
172
|
-
variant="subtle"
|
|
173
|
-
size="2xs"
|
|
174
|
-
touchTarget="comfortable"
|
|
175
|
-
data-slot="inline-citation"
|
|
176
|
-
aria-label={citationName(local.sources, local.index)}
|
|
177
|
-
class={cn('mx-0.5 align-baseline tabular-nums', local.class)}
|
|
178
|
-
onClick={onClick}
|
|
179
|
-
onPointerEnter={onPointerEnter}
|
|
180
|
-
onPointerLeave={onPointerLeave}
|
|
181
|
-
onFocus={(event: FocusEvent & { currentTarget: HTMLElement }) => {
|
|
182
|
-
// Mouse focus follows the press; only keyboard focus peeks.
|
|
183
|
-
if (restoringFocus) return
|
|
184
|
-
if (event.currentTarget.matches(':focus-visible')) dispatch('focus')
|
|
167
|
+
<span data-slot="inline-citation-root">
|
|
168
|
+
<Popover
|
|
169
|
+
open={mode() !== 'closed'}
|
|
170
|
+
onOpenChange={(next) => {
|
|
171
|
+
if (!next && !pressing) dispatch('dismiss')
|
|
185
172
|
}}
|
|
186
|
-
|
|
173
|
+
placement="bottom"
|
|
174
|
+
gutter={6}
|
|
187
175
|
>
|
|
188
|
-
<
|
|
189
|
-
{
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
aria-
|
|
253
|
-
|
|
254
|
-
onClick={() => setPosition((value) => wrapIndex(value + 1, count()))}
|
|
176
|
+
<PopoverTrigger
|
|
177
|
+
as={Button}
|
|
178
|
+
variant="subtle"
|
|
179
|
+
size="2xs"
|
|
180
|
+
touchTarget="comfortable"
|
|
181
|
+
data-slot="inline-citation"
|
|
182
|
+
aria-label={citationName(local.sources, local.index)}
|
|
183
|
+
class={cn('mx-0.5 align-baseline tabular-nums', local.class)}
|
|
184
|
+
onClick={onClick}
|
|
185
|
+
onPointerEnter={onPointerEnter}
|
|
186
|
+
onPointerLeave={onPointerLeave}
|
|
187
|
+
onFocus={(event: FocusEvent & { currentTarget: HTMLElement }) => {
|
|
188
|
+
// Mouse focus follows the press; only keyboard focus peeks.
|
|
189
|
+
if (restoringFocus) return
|
|
190
|
+
if (event.currentTarget.matches(':focus-visible')) dispatch('focus')
|
|
191
|
+
}}
|
|
192
|
+
onBlur={() => dispatch('blur')}
|
|
193
|
+
>
|
|
194
|
+
<span aria-hidden="true" class="max-w-32 truncate">
|
|
195
|
+
{citationLabel(local.index, local.sources[0])}
|
|
196
|
+
</span>
|
|
197
|
+
<Show when={count() > 1}>
|
|
198
|
+
<span aria-hidden="true">+{count() - 1}</span>
|
|
199
|
+
</Show>
|
|
200
|
+
</PopoverTrigger>
|
|
201
|
+
<PopoverContent
|
|
202
|
+
ref={(element: HTMLElement) => (content = element)}
|
|
203
|
+
inert={keyboardPeek() || mode() === 'closed' || undefined}
|
|
204
|
+
class="w-72 max-w-full"
|
|
205
|
+
onOpenAutoFocus={(event: Event) => {
|
|
206
|
+
if (mode() === 'peek') event.preventDefault()
|
|
207
|
+
}}
|
|
208
|
+
onFocusIn={() => {
|
|
209
|
+
focusInCard = true
|
|
210
|
+
}}
|
|
211
|
+
onKeyDown={(event: KeyboardEvent) => {
|
|
212
|
+
if (event.key !== 'Escape' || escapeClosedTooltip || mode() !== 'pinned') return
|
|
213
|
+
dispatch('dismiss')
|
|
214
|
+
}}
|
|
215
|
+
onCloseAutoFocus={(event: Event) => {
|
|
216
|
+
const returnFocus = focusInCard
|
|
217
|
+
focusInCard = false
|
|
218
|
+
if (!returnFocus) {
|
|
219
|
+
event.preventDefault()
|
|
220
|
+
return
|
|
221
|
+
}
|
|
222
|
+
// The focus move that follows is synchronous; the microtask ends the window.
|
|
223
|
+
restoringFocus = true
|
|
224
|
+
queueMicrotask(() => {
|
|
225
|
+
restoringFocus = false
|
|
226
|
+
})
|
|
227
|
+
}}
|
|
228
|
+
onPointerEnter={(event: PointerEvent) => {
|
|
229
|
+
if (event.pointerType !== 'touch') clear()
|
|
230
|
+
}}
|
|
231
|
+
onPointerLeave={onPointerLeave}
|
|
232
|
+
>
|
|
233
|
+
<Show when={active()}>
|
|
234
|
+
{(source) => (
|
|
235
|
+
<div class="flex min-w-0 flex-col gap-1.5 px-2 py-1.5">
|
|
236
|
+
<Show when={count() > 1}>
|
|
237
|
+
<div class="flex items-center justify-between gap-2">
|
|
238
|
+
<span
|
|
239
|
+
role="status"
|
|
240
|
+
aria-live="polite"
|
|
241
|
+
class="text-xs text-muted-foreground tabular-nums"
|
|
255
242
|
>
|
|
256
|
-
|
|
257
|
-
</
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
243
|
+
Source {wrapIndex(position(), count()) + 1} of {count()}
|
|
244
|
+
</span>
|
|
245
|
+
<span class="flex items-center gap-0.5">
|
|
246
|
+
<ActionButton
|
|
247
|
+
variant="ghost"
|
|
248
|
+
size="icon-xs"
|
|
249
|
+
aria-label="Previous source"
|
|
250
|
+
tooltip="Previous source"
|
|
251
|
+
onClick={() => setPosition((value) => wrapIndex(value - 1, count()))}
|
|
252
|
+
>
|
|
253
|
+
<ChevronLeft />
|
|
254
|
+
</ActionButton>
|
|
255
|
+
<ActionButton
|
|
256
|
+
variant="ghost"
|
|
257
|
+
size="icon-xs"
|
|
258
|
+
aria-label="Next source"
|
|
259
|
+
tooltip="Next source"
|
|
260
|
+
onClick={() => setPosition((value) => wrapIndex(value + 1, count()))}
|
|
261
|
+
>
|
|
262
|
+
<ChevronRight />
|
|
263
|
+
</ActionButton>
|
|
264
|
+
</span>
|
|
265
|
+
</div>
|
|
266
|
+
</Show>
|
|
267
|
+
<PopoverTitle class="p-0 [overflow-wrap:anywhere]">
|
|
268
|
+
{sourceTitle(source())}
|
|
269
|
+
</PopoverTitle>
|
|
270
|
+
<CitationDetails source={source()} />
|
|
271
|
+
</div>
|
|
272
|
+
)}
|
|
273
|
+
</Show>
|
|
274
|
+
</PopoverContent>
|
|
275
|
+
</Popover>
|
|
276
|
+
</span>
|
|
270
277
|
</Show>
|
|
271
278
|
)
|
|
272
279
|
}
|
|
@@ -86,6 +86,29 @@ export function isSelfScroll(
|
|
|
86
86
|
return lastWriteTop >= 0 && Math.abs(scrollTop - lastWriteTop) <= epsilon
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
+
/**
|
|
90
|
+
* A viewport can clamp our bottom write before its scroll/resize notification,
|
|
91
|
+
* then streamed content can reopen the gap before either callback runs. Accept
|
|
92
|
+
* only the exact offset explained by that growth, with no reader input. Other
|
|
93
|
+
* offsets still belong to the reader. A programmatic reveal landing at this
|
|
94
|
+
* same offset cannot be distinguished from native clamping by geometry alone.
|
|
95
|
+
*/
|
|
96
|
+
export function isViewportGrowthClamp(args: {
|
|
97
|
+
geom: ScrollGeom
|
|
98
|
+
lastWriteTop: number
|
|
99
|
+
lastWriteClientHeight: number
|
|
100
|
+
readerMovedSinceWrite: boolean
|
|
101
|
+
}): boolean {
|
|
102
|
+
const growth = args.geom.clientHeight - args.lastWriteClientHeight
|
|
103
|
+
return (
|
|
104
|
+
!args.readerMovedSinceWrite &&
|
|
105
|
+
args.lastWriteTop >= 0 &&
|
|
106
|
+
args.lastWriteClientHeight >= 0 &&
|
|
107
|
+
growth > SELF_SCROLL_EPSILON &&
|
|
108
|
+
Math.abs(args.geom.scrollTop - Math.max(0, args.lastWriteTop - growth)) <= SELF_SCROLL_EPSILON
|
|
109
|
+
)
|
|
110
|
+
}
|
|
111
|
+
|
|
89
112
|
/**
|
|
90
113
|
* Distance (px) from the true bottom within which a user scroll RE-ENGAGES
|
|
91
114
|
* follow. Deliberately much tighter than DEFAULT_BOTTOM_THRESHOLD: that 100px
|