@vectojs/core 1.39.0 → 1.40.0
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 +43 -135
- package/dist/{chunk-RUM2KEDI.mjs → chunk-AISSDI6U.mjs} +15 -8
- package/dist/{chunk-KRUDTGNR.js → chunk-BKXERWAD.js} +15 -8
- package/dist/{chunk-7PYD5UDX.mjs → chunk-CIRZ3S2Z.mjs} +48 -3
- package/dist/{chunk-POPXUPKR.js → chunk-HC5EZOZJ.js} +80 -35
- package/dist/components/VirtualizedSetAggregate.d.ts +110 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +1130 -216
- package/dist/index.mjs +927 -13
- package/dist/renderer.js +2 -2
- package/dist/renderer.mjs +1 -1
- package/dist/text.js +2 -2
- package/dist/text.mjs +1 -1
- package/dist/tree/Entity.d.ts +59 -1
- package/dist/tree/Scene.d.ts +212 -1
- package/dist/tree/scene/HitResult.d.ts +50 -0
- package/dist/tree/scene/HitTester.d.ts +30 -0
- package/dist/tree/scene/ProjectionBackend.d.ts +64 -0
- package/dist/tree/scene/ProjectionPolicy.d.ts +162 -0
- package/dist/tree/scene/SemanticProjectionPolicy.d.ts +119 -0
- package/dist/wasm/vectojs_core.wasm +0 -0
- package/package.json +4 -4
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { Entity, type A11yAttributes } from '../tree/Entity';
|
|
2
|
+
import type { IRenderer } from '../renderer/IRenderer';
|
|
3
|
+
/**
|
|
4
|
+
* One item in a {@link VirtualizedSetAggregate}: the stable identity and the
|
|
5
|
+
* accessible name a hotspot announces for it.
|
|
6
|
+
*/
|
|
7
|
+
export interface VirtualizedSetItem {
|
|
8
|
+
/** Stable identity across re-binds; survives reordering and filtering. */
|
|
9
|
+
id: string;
|
|
10
|
+
/** Accessible name announced for the item. */
|
|
11
|
+
label: string;
|
|
12
|
+
}
|
|
13
|
+
export interface VirtualizedSetAggregateOptions {
|
|
14
|
+
/** Full item set; the container label always states this count. Default `[]`. */
|
|
15
|
+
items?: VirtualizedSetItem[];
|
|
16
|
+
/** Container name; the count is appended (`'Messages, 10000 items'`). */
|
|
17
|
+
label?: string;
|
|
18
|
+
/** Container role. Default `'list'` (owns `listitem` per `A11Y_REQUIRED_OWNED`). */
|
|
19
|
+
role?: string;
|
|
20
|
+
/** Hotspot role. Default `'listitem'`. */
|
|
21
|
+
itemRole?: string;
|
|
22
|
+
/** Row height in local px; hotspots stack vertically at this stride. Default `28`. */
|
|
23
|
+
rowHeight?: number;
|
|
24
|
+
/** Hotspot pool size. Default: enough slots to cover `height`, at least 1. */
|
|
25
|
+
visibleCapacity?: number;
|
|
26
|
+
/** Container width in local px. Default `0` (set it — a zero box never projects). */
|
|
27
|
+
width?: number;
|
|
28
|
+
/** Container height in local px. Default `0`. */
|
|
29
|
+
height?: number;
|
|
30
|
+
/** Called when an item is activated (Enter/Space/click-through). */
|
|
31
|
+
onActivate?: (item: VirtualizedSetItem, index: number) => void;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Aggregate semantics for a virtualized set (RFC3 §4.4, CTX-0599).
|
|
35
|
+
*
|
|
36
|
+
* One persistent container (`role` + `aria-label` with the count) plus roving
|
|
37
|
+
* focus plus a small pool of hotspot entities re-bound to whichever items
|
|
38
|
+
* currently occupy each visible slot — O(viewport) DOM nodes for an
|
|
39
|
+
* arbitrarily large dataset. The pattern is the `Tree`/`Table` hotspot
|
|
40
|
+
* precedent (`packages/ui/src/Tree.ts:98-113`, `packages/table/src/Table.ts`):
|
|
41
|
+
* a transparent, focusable child per visible row with a roving `tabIndex` and
|
|
42
|
+
* `pointerEvents: 'none'`, while the parent owns the keyboard model and the
|
|
43
|
+
* pool.
|
|
44
|
+
*
|
|
45
|
+
* Pointer ownership: neither the container nor the hotspots take the pointer
|
|
46
|
+
* (both project `pointer-events: none`), so a real click/drag reaches the
|
|
47
|
+
* owner's canvas handling or an underlying selectable-text mirror underneath.
|
|
48
|
+
* Keyboard focus and AT-synthesized `click` still work — the same contract the
|
|
49
|
+
* `Tree`/`Table` hotspots rely on. A mouse/touch owner forwards its own tap
|
|
50
|
+
* path into {@link activateItem}; `'onDemand'` alone is deliberately not the
|
|
51
|
+
* story here (also `content/reference/core-a11y.md:207-214`).
|
|
52
|
+
*
|
|
53
|
+
* Painting belongs to the owner: `render` is a no-op (like `RowHotspot`), so
|
|
54
|
+
* pair this with canvas-painted rows or subclass and override `render`.
|
|
55
|
+
*/
|
|
56
|
+
export declare class VirtualizedSetAggregate extends Entity {
|
|
57
|
+
private _items;
|
|
58
|
+
private _label;
|
|
59
|
+
private _role;
|
|
60
|
+
private _itemRole;
|
|
61
|
+
private _rowHeight;
|
|
62
|
+
private _visibleCapacity;
|
|
63
|
+
private _onActivate;
|
|
64
|
+
/** First item index currently bound to the pool (the scroll window). */
|
|
65
|
+
private _visibleStart;
|
|
66
|
+
/** Item id owning the roving tab stop / keyboard focus. */
|
|
67
|
+
private _activeId;
|
|
68
|
+
private _selectedId;
|
|
69
|
+
/** One focusable hotspot per visible slot; re-bound, never rebuilt per item. */
|
|
70
|
+
private _hotspots;
|
|
71
|
+
constructor(opts?: VirtualizedSetAggregateOptions);
|
|
72
|
+
/** Full item count — the number the container label states. */
|
|
73
|
+
get itemCount(): number;
|
|
74
|
+
/** Live pool size (bounded by the visible capacity, never by the item count). */
|
|
75
|
+
get poolSize(): number;
|
|
76
|
+
/** First item index currently bound to the pool. */
|
|
77
|
+
get visibleStart(): number;
|
|
78
|
+
getA11yAttributes(): A11yAttributes;
|
|
79
|
+
render(_renderer: IRenderer): void;
|
|
80
|
+
/** Axis-aligned hit-test against the container box (the `UIComponent` default). */
|
|
81
|
+
isPointInside(globalX: number, globalY: number): boolean;
|
|
82
|
+
/** Replace the item set; the pool re-binds and the label count follows. */
|
|
83
|
+
setItems(items: VirtualizedSetItem[]): void;
|
|
84
|
+
/** Move the pool window to start at `start` (the scroll position). */
|
|
85
|
+
setVisibleStart(start: number): void;
|
|
86
|
+
/**
|
|
87
|
+
* Keep one hotspot per visible slot, positioned over it. The pool is sized
|
|
88
|
+
* to the viewport (capacity), each slot re-bound to whatever item currently
|
|
89
|
+
* occupies it — the `Tree._syncHotspots` shape, minus tree structure.
|
|
90
|
+
*/
|
|
91
|
+
private _syncHotspots;
|
|
92
|
+
/** Whether `id` owns the roving tab stop: active, else selected, else first. */
|
|
93
|
+
isTabStop(id: string): boolean;
|
|
94
|
+
isSelected(id: string): boolean;
|
|
95
|
+
/** Item role the hotspots announce (kept on the parent: one source of truth). */
|
|
96
|
+
get itemRole(): string;
|
|
97
|
+
/** Activate an item (pointer tap-through or Enter/Space): selects and notifies. */
|
|
98
|
+
activateItem(id: string, focusIt?: boolean): void;
|
|
99
|
+
/** Move keyboard focus to the hotspot currently bound to `id`, if any. */
|
|
100
|
+
focusItem(id: string): void;
|
|
101
|
+
/**
|
|
102
|
+
* Aggregate keyboard model: Up/Down move the active item (scrolling the pool
|
|
103
|
+
* window so it stays bound), Home/End jump, Enter/Space activate. The active
|
|
104
|
+
* item is focused as it moves so focus is never stranded on a re-bound slot.
|
|
105
|
+
*/
|
|
106
|
+
handleItemKey(e: KeyboardEvent, id: string): void;
|
|
107
|
+
/** Scroll the pool window just enough to keep `index` bound. */
|
|
108
|
+
private _ensureVisible;
|
|
109
|
+
update(_dt: number, _time: number): void;
|
|
110
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -10,7 +10,12 @@ export * from './renderer/TextRasterCache';
|
|
|
10
10
|
export * from './performance/UserTiming';
|
|
11
11
|
export * from './tree/Entity';
|
|
12
12
|
export * from './tree/Scene';
|
|
13
|
+
export * from './tree/scene/HitResult';
|
|
14
|
+
export * from './tree/scene/ProjectionBackend';
|
|
15
|
+
export * from './tree/scene/ProjectionPolicy';
|
|
16
|
+
export * from './tree/scene/SemanticProjectionPolicy';
|
|
13
17
|
export * from './components/TextEntity';
|
|
18
|
+
export * from './components/VirtualizedSetAggregate';
|
|
14
19
|
export * from './components/GridTextEntity';
|
|
15
20
|
export * from './components/SplineEntity';
|
|
16
21
|
export * from './components/Rect';
|