You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
73 lines
1.8 KiB
73 lines
1.8 KiB
import type { Morfo } from '../types';
|
|
import { v } from '../types';
|
|
|
|
/**
|
|
* STextVirtualList — virtualised list of strings with per-row height
|
|
* computed via the canvas-text engine (no DOM reflow).
|
|
*
|
|
* "S" matches `<SText>`: Segmented. The same engine that powers
|
|
* SText's exact line counting drives row heights here — `prepare()`
|
|
* caches per-text segment widths, `layout()` walks them with pure
|
|
* arithmetic to compute height. Only items in the viewport (plus
|
|
* overscan) mount; the rest contribute height via a spacer.
|
|
*
|
|
* Designed for long lists of short strings (comments, log entries,
|
|
* search results). For mixed-component rows use the canonical
|
|
* `<VirtualList>`.
|
|
*
|
|
* 0-event surface.
|
|
*/
|
|
export const sTextVirtualListMorfo = {
|
|
name: 'STextVirtualList',
|
|
kebab: 's-text-virtual-list',
|
|
scope: ['eidos'],
|
|
parts: [
|
|
{
|
|
name: 'Provider',
|
|
kebab: 'provider',
|
|
archetype: 'provider',
|
|
kind: 'public',
|
|
defaultElement: 'div',
|
|
optional: false,
|
|
data: [],
|
|
aria: []
|
|
},
|
|
{
|
|
name: 'Scroller',
|
|
kebab: 'scroller',
|
|
archetype: 'viewport',
|
|
kind: 'public',
|
|
defaultElement: 'div',
|
|
role: 'list',
|
|
optional: false,
|
|
data: [],
|
|
aria: []
|
|
},
|
|
{
|
|
name: 'Spacer',
|
|
kebab: 'spacer',
|
|
archetype: 'content',
|
|
kind: 'public',
|
|
defaultElement: 'div',
|
|
optional: false,
|
|
data: [],
|
|
aria: []
|
|
},
|
|
{
|
|
// Display row — NO archetype on purpose: `item` would pull the
|
|
// transversal interactive styling (cursor: pointer, user-select:
|
|
// none, hover accent, control-height floor) onto plain text rows
|
|
// whose height the canvas engine already computed, and it flips
|
|
// the audit classifier to "interactive" (0-event display surface).
|
|
name: 'Row',
|
|
kebab: 'row',
|
|
kind: 'public',
|
|
defaultElement: 'div',
|
|
role: 'listitem',
|
|
optional: true,
|
|
data: [],
|
|
aria: []
|
|
}
|
|
]
|
|
} as const satisfies Morfo;
|