* fix(ui): avoid tooltip trigger overlap when a side fits
* feat(ui): add navigation entry customization
* fix(test): keep tooltip geometry independent of JSX types
* fix(ui): align customization catalogs and integration fixtures
* test(ui): complete customization lifecycle and release integration coverage
* fix(ui): return entry discovery to the installed plugin list
* docs: refresh module graph for entry customization
* build: refresh workspace links for the moved entry customization package
* docs: regenerate catalogs and pairing hashes for the moved entry customization package
* test(web): cover default-loaded entry customization in the Web e2e
* test(ui): describe entry customization as a browser plugin in the host entry spec
* build: order entry customization publication files as workspace constraints require
* test(release): drop the moved entry customization package from the experimental family list
* style(ui): use the shared focus ring color on entry customization triggers
* test(web): re-record goldens for the default-loaded More navigation menus
* test(web): add the More conversation views trigger to the remaining CI-reported goldens
* docs: record region-owned pins for plugin entry customization
* refactor(ui): rebuild entry customization on region-owned pins and More menus
- Each navigation region (left sidebar, Conversation header, right sidebar
guide) persists its own unpinned list under
dsh.slot.manual-order.<list slot key>.v1, filters its own launchers, and
draws its own More button and Menu around its actions slot.
- ui-entry-customization only registers the shared menu rows (entries with
pin buttons, Browse other plugins, Create your plugin) into the three
actions slots and keeps no state.
- Remove ctx.layout.entryVisibility, the plugin store, left-sidebar drag
reordering, and agentPresetNavigation; ui-layout and ui-agent-preset match
release/dsh-0.2.1 again.
- Keep the release <nav> and Conversation tab-bar visibility conditions.
- Move the More glyph into ui-primitives as IconAppsAddOutline{Regular,Medium}.
* docs: compile the entry customization owner props example
* docs(ui): describe the wrapping Conversation tab row in the header comment
* fix(ui): return New Session to the Workspace blank and its unsent draft
- New Session (startSession without options) takes the blank-reuse path
again instead of creating a fresh Session on every call, which hid the
previous blank and its unsent draft since a5c9c2aaeef (#5775).
- A request that names an Agent preset skips blanks listing a different
preset, so Creator entries no longer take over an ordinary draft.
- Record the change in a v0.2.1-rc.2 upgrade guide; the Host refresh of a
stale loaded blank stays deferred (see the Agent Note).
* docs: regenerate the Cordis inspect catalog for New Session blank reuse
* fix(ui): keep the selected entry visible while unpinned
- Left-sidebar rows and View tabs keep the selected entry, with aria-current or aria-selected, until another entry is selected.
- Entry menu Creator action takes no region argument; the registration's region selects the prompt.
- Document the 2px panel-row and 32px View-tab gaps; drop commit hashes from the New Session Agent Note.
* fix(ui): leave a blank of another preset unstaged when starting Creator
startCreatorDraft stages cordis only when the main blank lists no preset or already lists cordis; navigation opens a separate Creator blank otherwise, so a Standard draft blank keeps its preset.
* feat(ui): choose whether a draft prompt replaces, appends to, or keeps an existing draft
- DraftInitializationOptions gains whenDraftExists ('replace' | 'append' | 'keep', default 'keep'); clearPreviousDraft stays and maps to 'replace' only when whenDraftExists is omitted.
- Append adds the prompt as new paragraphs after the existing text and references; attachments stay in every mode.
- The three Create your plugin entries append their regional prompt.
* test(web): align e2e with New Session blank reuse and the visible selected entry
* refactor(ui): share the draft paragraph writer between setDraft and appendDraft
---------
Co-authored-by: Yif <[email protected]>
Co-authored-by: imccyu <[email protected]>
93 lines
3.9 KiB
TypeScript
93 lines
3.9 KiB
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import { placeTooltip, type TooltipSide } from '../src/tooltip-placement.ts'
|
|
|
|
const input = {
|
|
anchor: { left: 400, right: 422, top: 400, bottom: 422 },
|
|
width: 118, height: 26, viewportWidth: 1280, viewportHeight: 900,
|
|
side: 'right' as TooltipSide, align: 'center' as const, gap: 8,
|
|
}
|
|
|
|
function expectSeparated(options: typeof input, result: ReturnType<typeof placeTooltip>) {
|
|
expect(result.left).toBeGreaterThanOrEqual(12)
|
|
expect(result.top).toBeGreaterThanOrEqual(12)
|
|
expect(result.left + result.width).toBeLessThanOrEqual(options.viewportWidth - 12)
|
|
expect(result.top + result.height).toBeLessThanOrEqual(options.viewportHeight - 12)
|
|
const a = options.anchor
|
|
expect(result.left >= a.right || result.left + result.width <= a.left
|
|
|| result.top >= a.bottom || result.top + result.height <= a.top).toBe(true)
|
|
}
|
|
|
|
describe('tooltip placement', () => {
|
|
it('moves the reported right-edge bubble left without covering its 22px trigger', () => {
|
|
const options = { ...input, anchor: { left: 1150.5, right: 1172.5, top: 736.08, bottom: 758.08 } }
|
|
const result = placeTooltip(options)
|
|
expect(result).toMatchInlineSnapshot(`
|
|
{
|
|
"height": 26,
|
|
"left": 1022.5,
|
|
"overflow": false,
|
|
"side": "left",
|
|
"top": 734.08,
|
|
"width": 118,
|
|
}
|
|
`)
|
|
expectSeparated(options, result)
|
|
})
|
|
|
|
it.each([
|
|
['right', 432, 398], ['left', 272, 398], ['bottom', 352, 430], ['top', 352, 366],
|
|
] as const)('preserves normal %s coordinates and default gaps', (side, left, top) => {
|
|
const options = { ...input, side }
|
|
const result = placeTooltip(options)
|
|
expect(result).toMatchObject({ side, left, top, overflow: false })
|
|
expectSeparated(options, result)
|
|
})
|
|
|
|
it('flips left to right at the left edge', () => {
|
|
const options = { ...input, side: 'left' as const, anchor: { left: 20, right: 42, top: 200, bottom: 222 } }
|
|
const result = placeTooltip(options)
|
|
expect(result.side).toBe('right')
|
|
expectSeparated(options, result)
|
|
})
|
|
|
|
it.each(['top', 'bottom'] as const)('preserves end alignment and a custom gap on %s', (side) => {
|
|
expect(placeTooltip({ ...input, side, align: 'end', gap: 17 })).toMatchObject({
|
|
left: 304, top: side === 'top' ? 357 : 439, side,
|
|
})
|
|
})
|
|
|
|
it.each(['right', 'left'] as const)('uses a perpendicular side when neither horizontal side fits (%s)', (side) => {
|
|
const options = { ...input, side, viewportWidth: 390, width: 195, anchor: { left: 180, right: 202, top: 400, bottom: 422 } }
|
|
const result = placeTooltip(options)
|
|
expect(result.side).toBe('bottom')
|
|
expectSeparated(options, result)
|
|
})
|
|
|
|
it.each(['top', 'bottom'] as const)('uses a horizontal side when neither vertical side fits (%s)', (side) => {
|
|
const options = { ...input, side, height: 500 }
|
|
const result = placeTooltip(options)
|
|
expect(result.side).toBe('right')
|
|
expectSeparated(options, result)
|
|
})
|
|
|
|
it('slides a horizontal bubble vertically without losing its trigger gap', () => {
|
|
const options = { ...input, anchor: { left: 400, right: 422, top: 2, bottom: 24 } }
|
|
const result = placeTooltip(options)
|
|
expect(result).toMatchObject({ left: 432, top: 12, side: 'right' })
|
|
expectSeparated(options, result)
|
|
})
|
|
|
|
it('bounds extreme text when no side fits and returns the same fallback repeatedly', () => {
|
|
const options = { ...input, width: 4000, height: 8000 }
|
|
const result = placeTooltip(options)
|
|
expect(result).toEqual({ left: 12, top: 12, width: 1256, height: 876, side: 'right', overflow: true })
|
|
for (let i = 0; i < 3; i++) expect(placeTooltip({ ...options, width: result.width, height: result.height })).toEqual(result)
|
|
})
|
|
|
|
it('returns to the preferred side after the viewport grows', () => {
|
|
const options = { ...input, viewportWidth: 500 }
|
|
expect(placeTooltip(options).side).toBe('left')
|
|
expect(placeTooltip({ ...options, viewportWidth: 1280 }).side).toBe('right')
|
|
})
|
|
})
|