@septkit/ui 0.0.87 → 0.0.89

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.
Files changed (34) hide show
  1. package/dist/dialecte/composables/change-id-window.js +14 -0
  2. package/dist/dialecte/composables/use-live-data.js +154 -31
  3. package/dist/dialecte/create-document-store.js +16 -7
  4. package/dist/external/.pnpm/@dialecte_core@0.12.1/node_modules/@dialecte/core/dist/dialecte-DHj8__Ch.js +7293 -0
  5. package/dist/external/.pnpm/@dialecte_core@0.12.1/node_modules/@dialecte/core/dist/helpers-Bfv2XDC-.js +351 -0
  6. package/dist/external/.pnpm/@dialecte_core@0.12.1/node_modules/@dialecte/core/dist/index.js +6 -0
  7. package/dist/external/.pnpm/{@dialecte_core@0.11.0/node_modules/@dialecte/core/dist/open-connections-D59wm6nb.js → @dialecte_core@0.12.1/node_modules/@dialecte/core/dist/open-connections-ClJo0-Af.js} +2 -2
  8. package/dist/external/.pnpm/@dialecte_core@0.12.1/node_modules/@dialecte/core/dist/project-key-DD8DyQ8-.js +1751 -0
  9. package/dist/external/.pnpm/@dialecte_core@0.12.1/node_modules/@dialecte/core/dist/qname-definition-C6GUFWL8.js +56 -0
  10. package/dist/external/.pnpm/{@dialecte_core@0.11.0 → @dialecte_core@0.12.1}/node_modules/@dialecte/core/dist/rolldown-runtime-CYdcPHCu.js +1 -1
  11. package/dist/external/.pnpm/{@dialecte_core@0.11.0/node_modules/@dialecte/core/dist/same-json-value-boJ4pSRe.js → @dialecte_core@0.12.1/node_modules/@dialecte/core/dist/same-json-value-DTtSsGUF.js} +491 -370
  12. package/dist/external/.pnpm/@dialecte_core@0.12.1/node_modules/@dialecte/core/dist/utils-Q5zsKl3Y.js +2449 -0
  13. package/dist/external/.pnpm/@dialecte_core@0.12.1/node_modules/@dialecte/core/dist/utils.js +2 -0
  14. package/dist/external/.pnpm/@tanstack_virtual-core@3.17.3/node_modules/@tanstack/virtual-core/dist/esm/index.js +627 -0
  15. package/dist/external/.pnpm/@tanstack_virtual-core@3.17.3/node_modules/@tanstack/virtual-core/dist/esm/lazy-measurements.js +31 -0
  16. package/dist/external/.pnpm/@tanstack_virtual-core@3.17.3/node_modules/@tanstack/virtual-core/dist/esm/utils.js +38 -0
  17. package/dist/external/.pnpm/@tanstack_vue-virtual@3.13.31_vue@3.5.39_typescript@5.8.3_/node_modules/@tanstack/vue-virtual/dist/esm/index.js +28 -0
  18. package/dist/external/.pnpm/@vueuse_core@14.3.0_vue@3.5.39_typescript@5.8.3_/node_modules/@vueuse/core/dist/index.js +24 -2
  19. package/dist/index.d.ts +266 -7
  20. package/dist/index.js +7 -1
  21. package/dist/ui.css +1 -1
  22. package/dist/virtual/grid-aria.js +16 -0
  23. package/dist/virtual/grid-navigation.js +84 -0
  24. package/dist/virtual/index.js +6 -0
  25. package/dist/virtual/kept-range.js +32 -0
  26. package/dist/virtual/use-virtual-scroller.js +180 -0
  27. package/dist/virtual/virtual.constants.js +7 -0
  28. package/package.json +6 -4
  29. package/dist/external/.pnpm/@dialecte_core@0.11.0/node_modules/@dialecte/core/dist/dialecte-Cs_XRP4I.js +0 -4426
  30. package/dist/external/.pnpm/@dialecte_core@0.11.0/node_modules/@dialecte/core/dist/helpers-D8p0KiJu.js +0 -130
  31. package/dist/external/.pnpm/@dialecte_core@0.11.0/node_modules/@dialecte/core/dist/index.js +0 -6
  32. package/dist/external/.pnpm/@dialecte_core@0.11.0/node_modules/@dialecte/core/dist/project-key-sr4wkl2Q.js +0 -1371
  33. package/dist/external/.pnpm/@dialecte_core@0.11.0/node_modules/@dialecte/core/dist/utils-Cv4oHia0.js +0 -865
  34. package/dist/external/.pnpm/@dialecte_core@0.11.0/node_modules/@dialecte/core/dist/utils.js +0 -2
@@ -0,0 +1,38 @@
1
+ //#region node_modules/.pnpm/@tanstack+virtual-core@3.17.3/node_modules/@tanstack/virtual-core/dist/esm/utils.js
2
+ function e(e, t, n) {
3
+ let r = n.initialDeps ?? [], i, a = !0;
4
+ function o() {
5
+ let o = process.env.NODE_ENV !== "production" && !!n.key && !!n.debug?.call(n), s = 0;
6
+ o && (s = Date.now());
7
+ let c = e();
8
+ if (!(c.length !== r.length || c.some((e, t) => r[t] !== e))) return i;
9
+ r = c;
10
+ let l = 0;
11
+ if (o && (l = Date.now()), i = t(...c), o) {
12
+ let e = Math.round((Date.now() - s) * 100) / 100, t = Math.round((Date.now() - l) * 100) / 100, r = t / 16, i = (e, t) => {
13
+ for (e = String(e); e.length < t;) e = " " + e;
14
+ return e;
15
+ };
16
+ console.info(`%c⏱ ${i(t, 5)} /${i(e, 5)} ms`, `
17
+ font-size: .6rem;
18
+ font-weight: bold;
19
+ color: hsl(${Math.max(0, Math.min(120 - 120 * r, 120))}deg 100% 31%);`, n?.key);
20
+ }
21
+ return n?.onChange && !(a && n.skipInitialOnChange) && n.onChange(i), a = !1, i;
22
+ }
23
+ return o.updateDeps = (e) => {
24
+ r = e;
25
+ }, o;
26
+ }
27
+ function t(e, t) {
28
+ if (e === void 0) throw Error(`Unexpected undefined${t ? `: ${t}` : ""}`);
29
+ return e;
30
+ }
31
+ var n = (e, t) => Math.abs(e - t) < 1.01, r = (e, t, n) => {
32
+ let r;
33
+ return function(...i) {
34
+ e.clearTimeout(r), r = e.setTimeout(() => t.apply(this, i), n);
35
+ };
36
+ };
37
+ //#endregion
38
+ export { n as approxEqual, r as debounce, e as memo, t as notUndefined };
@@ -0,0 +1,28 @@
1
+ import { approxEqual as e, debounce as t, memo as n, notUndefined as r } from "../../../../../../@tanstack_virtual-core@3.17.3/node_modules/@tanstack/virtual-core/dist/esm/utils.js";
2
+ import { Virtualizer as i, defaultKeyExtractor as a, defaultRangeExtractor as o, elementScroll as s, measureElement as c, observeElementOffset as l, observeElementRect as u } from "../../../../../../@tanstack_virtual-core@3.17.3/node_modules/@tanstack/virtual-core/dist/esm/index.js";
3
+ import { computed as d, onScopeDispose as f, shallowRef as p, triggerRef as m, unref as h, watch as g } from "vue";
4
+ //#region node_modules/.pnpm/@tanstack+vue-virtual@3.13.31_vue@3.5.39_typescript@5.8.3_/node_modules/@tanstack/vue-virtual/dist/esm/index.js
5
+ function _(e) {
6
+ let t = new i(h(e)), n = p(t), r = t._didMount();
7
+ return g(() => h(e).getScrollElement(), (e) => {
8
+ e && t._willUpdate();
9
+ }, { immediate: !0 }), g(() => h(e), (e) => {
10
+ t.setOptions({
11
+ ...e,
12
+ onChange: (t, r) => {
13
+ var i;
14
+ m(n), (i = e.onChange) == null || i.call(e, t, r);
15
+ }
16
+ }), t._willUpdate(), m(n);
17
+ }, { immediate: !0 }), f(r), n;
18
+ }
19
+ function v(e) {
20
+ return _(d(() => ({
21
+ observeElementRect: u,
22
+ observeElementOffset: l,
23
+ scrollToFn: s,
24
+ ...h(e)
25
+ })));
26
+ }
27
+ //#endregion
28
+ export { i as Virtualizer, e as approxEqual, t as debounce, a as defaultKeyExtractor, o as defaultRangeExtractor, s as elementScroll, c as measureElement, n as memo, r as notUndefined, l as observeElementOffset, u as observeElementRect, v as useVirtualizer };
@@ -164,7 +164,29 @@ function Z(e = {}) {
164
164
  function Q(e) {
165
165
  return JSON.parse(JSON.stringify(e));
166
166
  }
167
- function $(e, t, n, r = {}) {
167
+ function $(e, t, n = {}) {
168
+ let { window: r = V, ...i } = n, a, o = /* @__PURE__ */ K(() => r && "ResizeObserver" in r), s = () => {
169
+ a &&= (a.disconnect(), void 0);
170
+ }, c = B(A(() => {
171
+ let t = R(e);
172
+ return Array.isArray(t) ? t.map((e) => U(e)) : [U(t)];
173
+ }), (e) => {
174
+ if (s(), o.value && r) {
175
+ a = new ResizeObserver(t);
176
+ for (let t of e) t && a.observe(t, i);
177
+ }
178
+ }, {
179
+ immediate: !0,
180
+ flush: "post"
181
+ }), l = () => {
182
+ s(), c();
183
+ };
184
+ return C(l), {
185
+ isSupported: o,
186
+ stop: l
187
+ };
188
+ }
189
+ function ee(e, t, n, r = {}) {
168
190
  var i, a;
169
191
  let { clone: o = !1, passive: s = !1, eventName: c, deep: u = !1, defaultValue: d, shouldEmit: f } = r, p = j(), m = n || p?.emit || (p == null || (i = p.$emit) == null ? void 0 : i.bind(p)) || (p == null || (a = p.proxy) == null || (a = a.$emit) == null ? void 0 : a.bind(p?.proxy)), h = c;
170
192
  t ||= "modelValue", h ||= `update:${t.toString()}`;
@@ -188,4 +210,4 @@ function $(e, t, n, r = {}) {
188
210
  });
189
211
  }
190
212
  //#endregion
191
- export { e as bypassFilter, Q as cloneFnJSON, t as createEventHook, n as createFilterWrapper, r as createGlobalState, i as createSharedComposable, a as createSingletonPromise, o as debounceFilter, H as defaultNavigator, V as defaultWindow, s as getLifeCycleTarget, c as isClient, l as isDef, u as isIOS, d as isObject, f as noop, J as onKeyStroke, p as pausableFilter, m as promiseTimeout, h as reactiveComputed, g as reactiveOmit, _ as refAutoReset, v as syncRef, y as toArray, b as toReactive, x as toRef, S as tryOnBeforeUnmount, C as tryOnScopeDispose, U as unrefElement, w as until, Y as useAsyncState, Z as useClipboard, T as useDebounceFn, W as useEventListener, G as useMounted, X as usePermission, K as useSupported, E as useTimeoutFn, $ as useVModel, D as watchImmediate, O as watchPausable, k as watchWithFilter };
213
+ export { e as bypassFilter, Q as cloneFnJSON, t as createEventHook, n as createFilterWrapper, r as createGlobalState, i as createSharedComposable, a as createSingletonPromise, o as debounceFilter, H as defaultNavigator, V as defaultWindow, s as getLifeCycleTarget, c as isClient, l as isDef, u as isIOS, d as isObject, f as noop, J as onKeyStroke, p as pausableFilter, m as promiseTimeout, h as reactiveComputed, g as reactiveOmit, _ as refAutoReset, v as syncRef, y as toArray, b as toReactive, x as toRef, S as tryOnBeforeUnmount, C as tryOnScopeDispose, U as unrefElement, w as until, Y as useAsyncState, Z as useClipboard, T as useDebounceFn, W as useEventListener, G as useMounted, X as usePermission, $ as useResizeObserver, K as useSupported, E as useTimeoutFn, ee as useVModel, D as watchImmediate, O as watchPausable, k as watchWithFilter };
package/dist/index.d.ts CHANGED
@@ -4,6 +4,7 @@ import { AsTag } from 'reka-ui';
4
4
  import { Attrs } from 'vue';
5
5
  import { AutocompleteAnchorProps } from 'reka-ui';
6
6
  import { ComboboxInputProps } from 'reka-ui';
7
+ import { CommitChanges } from '@dialecte/core';
7
8
  import { Component } from 'vue';
8
9
  import { ComponentCustomProperties } from 'vue';
9
10
  import { ComponentCustomProps } from 'vue';
@@ -20,10 +21,11 @@ import { ExtensionModule } from '@dialecte/core';
20
21
  import { GlobalComponents } from 'vue';
21
22
  import { GlobalDirectives } from 'vue';
22
23
  import { InjectionKey } from 'vue';
24
+ import { MaybeRef } from 'vue';
23
25
  import { MaybeRefOrGetter } from 'vue';
24
26
  import { nextTick } from 'vue';
25
27
  import { OnCleanup } from '@vue/reactivity';
26
- import { ProjectChannelMessage } from '@dialecte/core';
28
+ import { ProjectChannelEvent } from '@dialecte/core';
27
29
  import { PublicProps } from 'vue';
28
30
  import { Ref } from 'vue';
29
31
  import { ReferenceElement } from 'reka-ui';
@@ -1226,6 +1228,23 @@ export declare const Button: __VLS_WithTemplateSlots<typeof __VLS_component, __V
1226
1228
 
1227
1229
  export declare const CATEGORY_ELEMENTS: Record<string, string[]>;
1228
1230
 
1231
+ export declare type CellAria = {
1232
+ 'aria-colindex': number;
1233
+ };
1234
+
1235
+ /** 1-based position of a mounted data cell, right of the row-header columns. */
1236
+ export declare function cellAria(params: CellAriaParams): CellAria;
1237
+
1238
+ export declare type CellAriaParams = {
1239
+ index: number;
1240
+ headerColumns?: number;
1241
+ };
1242
+
1243
+ export declare type ClampParams = {
1244
+ value: number;
1245
+ max: number;
1246
+ };
1247
+
1229
1248
  declare function closeDropdown(): void;
1230
1249
 
1231
1250
  export declare const CodeBlock: DefineComponent<__VLS_Props_14, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props_14> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, HTMLDivElement>;
@@ -1291,6 +1310,21 @@ export declare const Combobox: __VLS_WithTemplateSlots_3<typeof __VLS_component_
1291
1310
  */
1292
1311
  export declare function computeGroups<TRecord extends LayoutTreeRecord>(visibleIds: string[], recordMap: RecordMapById<TRecord>): GroupNode[];
1293
1312
 
1313
+ /**
1314
+ * Spacer sizes for a flow layout that renders the mounted items as `splitKeptItems` orders them: kept
1315
+ * items before the range take their own space, so the space above shrinks by their size (same below).
1316
+ */
1317
+ export declare function computeSpacers(params: ComputeSpacersParams): Spacers;
1318
+
1319
+ export declare type ComputeSpacersParams = {
1320
+ /** the mounted items in index order */
1321
+ items: readonly Pick<VirtualItem, 'start' | 'size' | 'kept'>[];
1322
+ /** the axis' full size, `paddingStart` included */
1323
+ totalSize: number;
1324
+ /** space before item 0 that the layout already fills (a header band in the scroller) */
1325
+ paddingStart?: number;
1326
+ };
1327
+
1294
1328
  export declare type Connection = {
1295
1329
  id: string;
1296
1330
  source: string;
@@ -1354,6 +1388,12 @@ export declare function createDocumentStore<GenericBaseDocument, GenericAugmente
1354
1388
  * every `layout()` call and can be overridden per call via its `options`. */
1355
1389
  export declare function createElkLayoutEngine(defaults?: LayoutOptions): LayoutEngine;
1356
1390
 
1391
+ /** Items mounted beyond each edge of the viewport, per axis, when the consumer gives none. */
1392
+ export declare const DEFAULT_OVERSCAN: {
1393
+ readonly rows: 5;
1394
+ readonly columns: 3;
1395
+ };
1396
+
1357
1397
  export declare type DiagramLayoutOptions<TRecord extends LayoutTreeRecord, TNode, TEdge> = {
1358
1398
  engine?: LayoutEngine;
1359
1399
  layoutOptions?: LayoutOptions;
@@ -1399,11 +1439,12 @@ rootEl: HTMLDivElement;
1399
1439
  export declare const DiagramNodeGroup: __VLS_WithTemplateSlots_13<typeof __VLS_component_13, __VLS_TemplateResult_13["slots"]>;
1400
1440
 
1401
1441
  /**
1402
- * Message shapes posted on a dialecte project's BroadcastChannel — the public
1403
- * event contract of @dialecte/core. Alias of core's `ProjectChannelMessage`
1404
- * (single source of truth); kept under this name as the @septkit/ui surface.
1442
+ * What a dialecte project's BroadcastChannel carries — the public event contract
1443
+ * of @dialecte/core: each change, and a `resync` (changes may have been missed,
1444
+ * read again). Alias of core's `ProjectChannelEvent` (single source of truth);
1445
+ * kept under this name as the @septkit/ui surface.
1405
1446
  */
1406
- export declare type DialecteChannelMessage = ProjectChannelMessage;
1447
+ export declare type DialecteChannelMessage = ProjectChannelEvent;
1407
1448
 
1408
1449
  export declare const Dialog: __VLS_WithTemplateSlots_4<typeof __VLS_component_4, __VLS_TemplateResult_4["slots"]>;
1409
1450
 
@@ -1570,8 +1611,40 @@ export declare type FilterTreeNode = {
1570
1611
  isTerminal?: boolean;
1571
1612
  };
1572
1613
 
1614
+ /** The next index after (or before) `from` that `isEligible` accepts, within `[0, count)`. */
1615
+ export declare function findNextIndex(params: FindNextIndexParams): number | undefined;
1616
+
1617
+ export declare type FindNextIndexParams = {
1618
+ from: number;
1619
+ direction: 'forward' | 'backward';
1620
+ count: number;
1621
+ isEligible: (index: number) => boolean;
1622
+ };
1623
+
1573
1624
  export declare const FloatingTooltip: __VLS_WithTemplateSlots_5<typeof __VLS_component_5, __VLS_TemplateResult_5["slots"]>;
1574
1625
 
1626
+ export declare type GridAria = {
1627
+ 'aria-rowcount': number;
1628
+ 'aria-colcount'?: number;
1629
+ };
1630
+
1631
+ /** Full counts for the grid (or list) root, header rows and columns included. */
1632
+ export declare function gridAria(params: GridAriaParams): GridAria;
1633
+
1634
+ export declare type GridAriaParams = {
1635
+ rowCount: number;
1636
+ /** omitted for a list */
1637
+ columnCount?: number;
1638
+ headerRows?: number;
1639
+ headerColumns?: number;
1640
+ };
1641
+
1642
+ /** A cell of a grid, both indices 0-based over the data (header rows and columns not counted). */
1643
+ export declare type GridPosition = {
1644
+ row: number;
1645
+ column: number;
1646
+ };
1647
+
1575
1648
  /**
1576
1649
  * Collapsed members viewport: tall enough to show at least two member cards
1577
1650
  * fully; extra members overflow (scroll) - a partial card at the bottom is fine.
@@ -1675,6 +1748,16 @@ export declare function highlightCode(code: string, options?: {
1675
1748
 
1676
1749
  export declare function isGroupId(id: string): boolean;
1677
1750
 
1751
+ /**
1752
+ * The mounted items in the order a flow layout renders them: kept items before the range, the range,
1753
+ * kept items after it. The spacers go between them (`computeSpacers`).
1754
+ */
1755
+ export declare type KeptSplit<T> = {
1756
+ before: T[];
1757
+ inRange: T[];
1758
+ after: T[];
1759
+ };
1760
+
1678
1761
  export declare const KEY_SEPARATOR = "\0";
1679
1762
 
1680
1763
  export declare type LayoutDirection = 'UP' | 'DOWN' | 'LEFT' | 'RIGHT';
@@ -1793,6 +1876,19 @@ export declare type LibraryBrowserSource = {
1793
1876
 
1794
1877
  export declare type LineStatus = 'added' | 'removed' | 'unchanged';
1795
1878
 
1879
+ /** A commit as `LiveDataDependsOn` reads it: its document and the records it changed. */
1880
+ export declare type LiveDataCommit = {
1881
+ documentId: string;
1882
+ changes: CommitChanges;
1883
+ };
1884
+
1885
+ /**
1886
+ * What a live view reads, so a commit that touches none of it refetches nothing: the tag names it reads (a commit
1887
+ * creating, updating or deleting one of them refetches), or a predicate over a commit's changed records. A commit
1888
+ * whose changes are unknown always refetches.
1889
+ */
1890
+ export declare type LiveDataDependsOn = ReadonlyArray<string> | ((commit: LiveDataCommit) => boolean);
1891
+
1796
1892
  /**
1797
1893
  * Minimal slice of a `Document` consumed by `useLiveData`: the id it queries
1798
1894
  * and the project channel it listens on. Structural (not `Pick<Document, ...>`)
@@ -1815,6 +1911,35 @@ export declare function matchName({ match, value }: NameFilter, name: string | u
1815
1911
  */
1816
1912
  export declare function memberCardHeight(hasChildCounts: boolean): number;
1817
1913
 
1914
+ /** The range plus the kept indices that exist, each once, ascending. */
1915
+ export declare function mergeKeptIndices(params: MergeKeptIndicesParams): number[];
1916
+
1917
+ export declare type MergeKeptIndicesParams = {
1918
+ /** the indices the virtualizer would mount (visible + overscan), ascending */
1919
+ range: readonly number[];
1920
+ /** indices that stay mounted wherever they are */
1921
+ keep: readonly number[];
1922
+ count: number;
1923
+ };
1924
+
1925
+ /**
1926
+ * The cell a navigation key leads to, clamped to the grid. `undefined` when the key does not move
1927
+ * (the caller leaves the event alone) or the grid is empty.
1928
+ */
1929
+ export declare function moveGridPosition(params: MoveGridPositionParams): GridPosition | undefined;
1930
+
1931
+ export declare type MoveGridPositionParams = {
1932
+ position: GridPosition;
1933
+ /** `KeyboardEvent.key` */
1934
+ key: string;
1935
+ /** Ctrl or Meta held: Home/End go to the grid's corners */
1936
+ ctrlKey?: boolean;
1937
+ rowCount: number;
1938
+ columnCount: number;
1939
+ /** rows that fit in the viewport; PageUp/PageDown move by this much */
1940
+ rowsPerPage: number;
1941
+ };
1942
+
1818
1943
  export declare const MultiSelect: DefineComponent<__VLS_PublicProps_2, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
1819
1944
  "update:modelValue": (value: string[]) => any;
1820
1945
  "update:open": (value: boolean) => any;
@@ -1978,6 +2103,18 @@ export declare type RecordWithCache<TRecord extends LayoutTreeRecord = LayoutTre
1978
2103
  visibleChildIds: Set<string>;
1979
2104
  };
1980
2105
 
2106
+ export declare type RowAria = {
2107
+ 'aria-rowindex': number;
2108
+ };
2109
+
2110
+ /** 1-based position of a mounted data row, below the header rows. */
2111
+ export declare function rowAria(params: RowAriaParams): RowAria;
2112
+
2113
+ export declare type RowAriaParams = {
2114
+ index: number;
2115
+ headerRows?: number;
2116
+ };
2117
+
1981
2118
  export declare interface RowSortController<TRow, TColId extends string> {
1982
2119
  isSortable: (column: TColId) => boolean;
1983
2120
  getDirection: (column: TColId) => SortDirection | null;
@@ -1995,16 +2132,49 @@ export declare const SclExplorer: __VLS_WithTemplateSlots_7<typeof __VLS_compone
1995
2132
 
1996
2133
  export declare const SclTree: __VLS_WithTemplateSlots_6<typeof __VLS_component_6, __VLS_TemplateResult_6["slots"]>;
1997
2134
 
2135
+ export declare type ScrollAlign = 'start' | 'center' | 'end' | 'auto';
2136
+
2137
+ /** a scroller's visible size in px */
2138
+ export declare type ScrollRect = {
2139
+ width: number;
2140
+ height: number;
2141
+ };
2142
+
2143
+ export declare type ScrollToCellParams = {
2144
+ row: number;
2145
+ column: number;
2146
+ align?: ScrollAlign;
2147
+ };
2148
+
2149
+ export declare type ScrollToIndexParams = {
2150
+ index: number;
2151
+ align?: ScrollAlign;
2152
+ };
2153
+
1998
2154
  export declare const SelectorInput: __VLS_WithTemplateSlots_9<typeof __VLS_component_9, __VLS_TemplateResult_9["slots"]>;
1999
2155
 
2000
2156
  export declare function serializeNoteData({ categories, otherTags, ...rest }: NoteData): string;
2001
2157
 
2002
2158
  export declare type SortDirection = 'asc' | 'desc';
2003
2159
 
2160
+ /** Heights of the spacer rows above and below the mounted items of a flow layout (`<table>`). */
2161
+ export declare type Spacers = {
2162
+ before: number;
2163
+ after: number;
2164
+ };
2165
+
2004
2166
  export declare const Spinner: DefineComponent<__VLS_Props_24, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props_24> & Readonly<{}>, {
2005
2167
  size: number;
2006
2168
  }, {}, {}, {}, string, ComponentProvideOptions, false, {}, HTMLSpanElement>;
2007
2169
 
2170
+ /** Kept items above the range, the range, kept items below it; with no range, every kept item first. */
2171
+ export declare function splitKeptItems<T extends Pick<VirtualItem, 'start' | 'kept'>>(params: SplitKeptItemsParams<T>): KeptSplit<T>;
2172
+
2173
+ export declare type SplitKeptItemsParams<T extends Pick<VirtualItem, 'start' | 'kept'>> = {
2174
+ /** the mounted items in index order */
2175
+ items: readonly T[];
2176
+ };
2177
+
2008
2178
  export declare const SplitLayout: __VLS_WithTemplateSlots_10<typeof __VLS_component_10, __VLS_TemplateResult_10["slots"]>;
2009
2179
 
2010
2180
  export declare const StatusBar: __VLS_WithTemplateSlots_11<typeof __VLS_component_11, __VLS_TemplateResult_11["slots"]>;
@@ -2181,16 +2351,20 @@ export declare function useDocumentState(doc: MaybeRefOrGetter<ReactiveDocument
2181
2351
  * {@link useProjectLiveData}. This lets a caller pass a document that is null
2182
2352
  * before hydration or during a teardown/switch without pre-guarding a value
2183
2353
  * that would otherwise throw.
2354
+ *
2355
+ * `dependsOn` limits the refetch to the commits that touch what the view reads (see {@link LiveDataDependsOn});
2356
+ * without it every commit of the document refetches.
2184
2357
  */
2185
2358
  export declare function useLiveData<T>(params: {
2186
2359
  document: MaybeRefOrGetter<LiveDataDocument | undefined>;
2187
2360
  fetcher: () => Promise<T>;
2188
2361
  initial: T;
2362
+ dependsOn?: LiveDataDependsOn;
2189
2363
  }): {
2190
2364
  state: Ref<T, T>;
2191
2365
  isLoading: Ref<boolean, boolean>;
2192
2366
  error: Ref<unknown, unknown>;
2193
- refresh: (delay?: number) => Promise<T | undefined>;
2367
+ refresh: () => Promise<void>;
2194
2368
  };
2195
2369
 
2196
2370
  export declare function useOptionalRowSortContext(): RowSortHeaderModel | undefined;
@@ -2199,6 +2373,7 @@ export declare function useOptionalRowSortContext(): RowSortHeaderModel | undefi
2199
2373
  * Async data that refetches when anything in the project changes:
2200
2374
  * commits on any document, imports, removals, new documents.
2201
2375
  * Trigger source: the project's BroadcastChannel (see {@link useDialecteChannel}).
2376
+ * `dependsOn` limits the refetch on commits only (see {@link LiveDataDependsOn}).
2202
2377
  */
2203
2378
  export declare function useProjectLiveData<T>(params: {
2204
2379
  project: MaybeRefOrGetter<{
@@ -2206,11 +2381,12 @@ export declare function useProjectLiveData<T>(params: {
2206
2381
  } | undefined>;
2207
2382
  fetcher: () => Promise<T>;
2208
2383
  initial: T;
2384
+ dependsOn?: LiveDataDependsOn;
2209
2385
  }): {
2210
2386
  state: Ref<T, T>;
2211
2387
  isLoading: Ref<boolean, boolean>;
2212
2388
  error: Ref<unknown, unknown>;
2213
- refresh: (delay?: number) => Promise<T | undefined>;
2389
+ refresh: () => Promise<void>;
2214
2390
  };
2215
2391
 
2216
2392
  /**
@@ -2224,10 +2400,86 @@ export declare interface UseRowSortConfig<TRow, TColId extends string> {
2224
2400
  sortAccessors: Partial<Record<TColId, (row: TRow) => string>>;
2225
2401
  }
2226
2402
 
2403
+ export declare type UseVirtualScroller = {
2404
+ /** mounted rows in index order: visible + overscan + kept */
2405
+ rows: ComputedRef<VirtualItem[]>;
2406
+ /** mounted columns in index order; empty without a columns axis */
2407
+ columns: ComputedRef<VirtualItem[]>;
2408
+ totalSize: ComputedRef<{
2409
+ height: number;
2410
+ width: number;
2411
+ }>;
2412
+ /** spacer row heights for a flow layout that renders `rows` in order (`<table>`) */
2413
+ spacers: ComputedRef<Spacers>;
2414
+ /** `{ start: 0, end: -1 }` before the first layout or without rows */
2415
+ visibleRange: ComputedRef<VisibleRange>;
2416
+ /** rows fully visible below the pinned band, at least 1: the PageUp/PageDown step */
2417
+ rowsPerPage: ComputedRef<number>;
2418
+ /** template ref callback for measured rows; the element carries `data-index` */
2419
+ measureRow: (element: unknown) => void;
2420
+ scrollToIndex: (params: ScrollToIndexParams) => void;
2421
+ scrollToCell: (params: ScrollToCellParams) => void;
2422
+ };
2423
+
2424
+ /**
2425
+ * Mounts only the rows (and columns) near the viewport of `scrollElement`. The view keeps its own
2426
+ * markup: it positions `rows` / `columns` by their `start`, or renders them in flow between spacers.
2427
+ */
2428
+ export declare function useVirtualScroller(params: UseVirtualScrollerParams): UseVirtualScroller;
2429
+
2430
+ export declare type UseVirtualScrollerParams = {
2431
+ /** the element that scrolls; sticky headers and pinned rows live inside it */
2432
+ scrollElement: Readonly<Ref<HTMLElement | null | undefined>>;
2433
+ rows: VirtualAxis;
2434
+ /** a grid: columns of fixed width */
2435
+ columns?: Omit<VirtualAxis, 'measured'>;
2436
+ /**
2437
+ * the scroller's size assumed by the first render, used until the scroller is first measured: the
2438
+ * first render then mounts the rows (and columns) of that size instead of none. Read once at setup.
2439
+ */
2440
+ initialRect?: ScrollRect;
2441
+ };
2442
+
2227
2443
  export declare function validateSearchText(value: string): string | undefined;
2228
2444
 
2229
2445
  export declare function validateXpath(xpath: string): string | undefined;
2230
2446
 
2447
+ /** One axis of `useVirtualScroller`. */
2448
+ export declare type VirtualAxis = {
2449
+ count: MaybeRefOrGetter<number>;
2450
+ /**
2451
+ * fixed size in px, or a function of the index (the estimate when `measured`), each optionally in
2452
+ * a ref. The axis is laid out again when the ref gets a new value, and when a reactive value read
2453
+ * by `size(0)` changes. To change per-index sizes, set a new function in the ref.
2454
+ */
2455
+ size: MaybeRef<VirtualSize>;
2456
+ /** rows only: sizes read from the mounted elements (`measureRow`) */
2457
+ measured?: boolean;
2458
+ overscan?: MaybeRefOrGetter<number>;
2459
+ /** indices kept mounted wherever they are (a pinned group row, the focused item) */
2460
+ keep?: MaybeRefOrGetter<readonly number[]>;
2461
+ /** a pinned band at the start (sticky header, pinned row): scrolling to an item lands after it */
2462
+ scrollPaddingStart?: MaybeRefOrGetter<number>;
2463
+ /** space before item 0 inside the scroller (a header band in flow) */
2464
+ paddingStart?: MaybeRefOrGetter<number>;
2465
+ getKey?: (index: number) => VirtualKey;
2466
+ };
2467
+
2468
+ /** One mounted item of an axis. `kept` = mounted only because it is kept, outside the range. */
2469
+ export declare type VirtualItem = {
2470
+ index: number;
2471
+ key: VirtualKey;
2472
+ start: number;
2473
+ size: number;
2474
+ kept: boolean;
2475
+ };
2476
+
2477
+ /** A stable identity for an item across renders (the virtualizer's key). */
2478
+ export declare type VirtualKey = number | string;
2479
+
2480
+ /** A fixed size in px, or the size of each index. */
2481
+ export declare type VirtualSize = number | ((index: number) => number);
2482
+
2231
2483
  /** Options that drive which nodes are initially visible. */
2232
2484
  export declare type VisibilityOptions = {
2233
2485
  expandedNodeIds: Set<string>;
@@ -2235,6 +2487,13 @@ export declare type VisibilityOptions = {
2235
2487
  defaultOpenDepth: number;
2236
2488
  };
2237
2489
 
2490
+ export declare type VisibleRange = {
2491
+ /** first row at least partly visible below the pinned band (`scrollPaddingStart`) */
2492
+ start: number;
2493
+ /** last row at least partly visible */
2494
+ end: number;
2495
+ };
2496
+
2238
2497
  export declare const XmlDiff: DefineComponent<__VLS_Props_15, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props_15> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, HTMLDivElement>;
2239
2498
 
2240
2499
  export declare type XpathBuilderState = {
package/dist/index.js CHANGED
@@ -68,4 +68,10 @@ import { useDiagramLayout as Oe } from "./diagram-layout/use-diagram-layout.js";
68
68
  import ke from "./diagram-layout/diagram-node-card.js";
69
69
  import Ae from "./diagram-layout/diagram-node-group.js";
70
70
  import "./diagram-layout/index.js";
71
- export { s as Button, x as CATEGORY_ELEMENTS, A as CodeBlock, l as Combobox, te as ContextMenu, ke as DiagramNodeCard, Ae as DiagramNodeGroup, p as Dialog, y as DialogHost, b as DocumentProgressBar, c as Dropdown, S as ELEMENT_TO_COLOR, C as ELEMENT_TO_ICON, w as ElementBadge, m as FeedbackDialog, ee as FilterableColumnHeader, u as FloatingTooltip, ve as GROUP_COLLAPSED_MEMBERS_HEIGHT, ye as GROUP_HEADER_HEIGHT, be as GROUP_MEMBER_GAP, xe as GROUP_MEMBER_HEIGHT, Se as GROUP_MEMBER_HEIGHT_COMPACT, B as KEY_SEPARATOR, O as LibraryBrowser, d as MultiSelect, N as NOTE_CATEGORIES, P as NOTE_CATEGORY_LABELS, F as NOTE_STATUSES, V as NO_VALUE_KEY, z as NoteCategoryPicker, R as NoteCategoryTag, de as ProgressBar, D as SclExplorer, E as SclTree, se as SelectorInput, fe as Spinner, ce as SplitLayout, le as StatusBar, ue as StatusBarItem, f as TextInputAutocomplete, M as XmlDiff, pe as applyInitialVisibility, H as buildFlatOptions, U as buildMultiValueOptions, me as buildRecordCache, W as buildTreeOptions, ne as buildXpath, T as collectExpandableNodeIds, G as collectLeafKeys, K as collectParentKeys, he as collectVisibleIds, we as computeGroups, h as createDialogHost, e as createDocumentStore, De as createElkLayoutEngine, g as dialogHostKey, j as diffLines, q as filterTree, _e as groupStackMetrics, ge as hideDescendants, k as highlightCode, Te as isGroupId, Ee as makeGroupId, re as matchName, Ce as memberCardHeight, I as parseNoteData, ie as parseXpath, X as provideColumnFilterHeader, _ as provideDialogHost, Q as provideRowSortHeader, L as serializeNoteData, i as useActiveDocument, Z as useColumnFilterHeaderContext, J as useColumnFilters, Oe as useDiagramLayout, t as useDialecteChannel, v as useDialog, a as useDocumentProgress, o as useDocumentState, n as useLiveData, $ as useOptionalRowSortContext, r as useProjectLiveData, Y as useRowSort, ae as validateSearchText, oe as validateXpath };
71
+ import { DEFAULT_OVERSCAN as je } from "./virtual/virtual.constants.js";
72
+ import { computeSpacers as Me, mergeKeptIndices as Ne, splitKeptItems as Pe } from "./virtual/kept-range.js";
73
+ import { useVirtualScroller as Fe } from "./virtual/use-virtual-scroller.js";
74
+ import { findNextIndex as Ie, moveGridPosition as Le } from "./virtual/grid-navigation.js";
75
+ import { cellAria as Re, gridAria as ze, rowAria as Be } from "./virtual/grid-aria.js";
76
+ import "./virtual/index.js";
77
+ export { s as Button, x as CATEGORY_ELEMENTS, A as CodeBlock, l as Combobox, te as ContextMenu, je as DEFAULT_OVERSCAN, ke as DiagramNodeCard, Ae as DiagramNodeGroup, p as Dialog, y as DialogHost, b as DocumentProgressBar, c as Dropdown, S as ELEMENT_TO_COLOR, C as ELEMENT_TO_ICON, w as ElementBadge, m as FeedbackDialog, ee as FilterableColumnHeader, u as FloatingTooltip, ve as GROUP_COLLAPSED_MEMBERS_HEIGHT, ye as GROUP_HEADER_HEIGHT, be as GROUP_MEMBER_GAP, xe as GROUP_MEMBER_HEIGHT, Se as GROUP_MEMBER_HEIGHT_COMPACT, B as KEY_SEPARATOR, O as LibraryBrowser, d as MultiSelect, N as NOTE_CATEGORIES, P as NOTE_CATEGORY_LABELS, F as NOTE_STATUSES, V as NO_VALUE_KEY, z as NoteCategoryPicker, R as NoteCategoryTag, de as ProgressBar, D as SclExplorer, E as SclTree, se as SelectorInput, fe as Spinner, ce as SplitLayout, le as StatusBar, ue as StatusBarItem, f as TextInputAutocomplete, M as XmlDiff, pe as applyInitialVisibility, H as buildFlatOptions, U as buildMultiValueOptions, me as buildRecordCache, W as buildTreeOptions, ne as buildXpath, Re as cellAria, T as collectExpandableNodeIds, G as collectLeafKeys, K as collectParentKeys, he as collectVisibleIds, we as computeGroups, Me as computeSpacers, h as createDialogHost, e as createDocumentStore, De as createElkLayoutEngine, g as dialogHostKey, j as diffLines, q as filterTree, Ie as findNextIndex, ze as gridAria, _e as groupStackMetrics, ge as hideDescendants, k as highlightCode, Te as isGroupId, Ee as makeGroupId, re as matchName, Ce as memberCardHeight, Ne as mergeKeptIndices, Le as moveGridPosition, I as parseNoteData, ie as parseXpath, X as provideColumnFilterHeader, _ as provideDialogHost, Q as provideRowSortHeader, Be as rowAria, L as serializeNoteData, Pe as splitKeptItems, i as useActiveDocument, Z as useColumnFilterHeaderContext, J as useColumnFilters, Oe as useDiagramLayout, t as useDialecteChannel, v as useDialog, a as useDocumentProgress, o as useDocumentState, n as useLiveData, $ as useOptionalRowSortContext, r as useProjectLiveData, Y as useRowSort, Fe as useVirtualScroller, ae as validateSearchText, oe as validateXpath };