@northgraindata/dsui 0.4.2 → 0.5.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/bin/dsui.mjs +1 -1
- package/dist/plugin-sdk.mjs +1 -1
- package/dist/runtime/plugins/code-repository.browser.mjs +60 -0
- package/dist/runtime/plugins/code-repository.mjs +2 -2
- package/dist/runtime/plugins/example-plugin.mjs +1 -1
- package/dist/runtime/plugins/health.browser.mjs +202 -68
- package/dist/runtime/plugins/health.mjs +97 -6
- package/dist/runtime/plugins/monitoring.mjs +11 -1
- package/dist/runtime/plugins/status-pages.browser.mjs +5033 -0
- package/dist/runtime/plugins/status-pages.mjs +52 -0
- package/dist/server.mjs +185 -187
- package/package.json +1 -1
- package/sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@northgraindata/dsui-ui/src/components/input.tsx +2 -5
- package/sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@northgraindata/dsui-ui/src/components/suggest-input.tsx +197 -0
- package/sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@northgraindata/dsui-ui/src/index.tsx +5 -0
- package/sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@northgraindata/dsui-ui/src/styles.css +54 -0
- package/sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@tanstack/react-virtual/dist/cjs/index.cjs +3 -2
- package/sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@tanstack/react-virtual/dist/cjs/index.cjs.map +1 -1
- package/sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@tanstack/react-virtual/dist/esm/index.js +3 -2
- package/sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@tanstack/react-virtual/dist/esm/index.js.map +1 -1
- package/sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@tanstack/react-virtual/package.json +2 -2
- package/sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@tanstack/react-virtual/src/index.tsx +11 -2
- package/sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@tanstack/virtual-core/dist/cjs/index.cjs +79 -26
- package/sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@tanstack/virtual-core/dist/cjs/index.cjs.map +1 -1
- package/sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@tanstack/virtual-core/dist/cjs/index.d.cts +12 -1
- package/sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@tanstack/virtual-core/dist/cjs/scroll-classifier.cjs +14 -2
- package/sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@tanstack/virtual-core/dist/cjs/scroll-classifier.cjs.map +1 -1
- package/sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@tanstack/virtual-core/dist/cjs/scroll-classifier.d.cts +3 -2
- package/sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@tanstack/virtual-core/dist/esm/index.d.ts +12 -1
- package/sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@tanstack/virtual-core/dist/esm/index.js +79 -26
- package/sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@tanstack/virtual-core/dist/esm/index.js.map +1 -1
- package/sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@tanstack/virtual-core/dist/esm/scroll-classifier.d.ts +3 -2
- package/sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@tanstack/virtual-core/dist/esm/scroll-classifier.js +14 -2
- package/sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@tanstack/virtual-core/dist/esm/scroll-classifier.js.map +1 -1
- package/sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@tanstack/virtual-core/package.json +1 -1
- package/sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@tanstack/virtual-core/src/index.ts +135 -24
- package/sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@tanstack/virtual-core/src/scroll-classifier.ts +31 -3
- package/sdk/node_modules/@northgraindata/dsui-adapter-sdk/src/adapter/define.ts +22 -1
- package/sdk/node_modules/@northgraindata/dsui-adapter-sdk/src/adapter/index.ts +1 -0
- package/sdk/node_modules/@northgraindata/dsui-adapter-sdk/src/adapter/presentation.test.ts +73 -0
- package/sdk/node_modules/@northgraindata/dsui-adapter-sdk/src/adapter/presentation.ts +34 -0
- package/sdk/node_modules/@northgraindata/dsui-adapter-sdk/src/adapter/types.ts +23 -0
- package/sdk/node_modules/@northgraindata/dsui-adapter-sdk/src/components/ui/layout/gauge.tsx +14 -2
- package/sdk/node_modules/@northgraindata/dsui-adapter-sdk/src/dataset/dataset.test.ts +134 -0
- package/sdk/node_modules/@northgraindata/dsui-adapter-sdk/src/dataset/index.ts +141 -0
- package/sdk/node_modules/@northgraindata/dsui-adapter-sdk/src/index.ts +23 -0
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@tanstack/react-virtual/dist/cjs/index.cjs +3 -2
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@tanstack/react-virtual/dist/cjs/index.cjs.map +1 -1
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@tanstack/react-virtual/dist/esm/index.js +3 -2
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@tanstack/react-virtual/dist/esm/index.js.map +1 -1
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@tanstack/react-virtual/package.json +2 -2
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@tanstack/react-virtual/src/index.tsx +11 -2
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@tanstack/virtual-core/dist/cjs/index.cjs +79 -26
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@tanstack/virtual-core/dist/cjs/index.cjs.map +1 -1
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@tanstack/virtual-core/dist/cjs/index.d.cts +12 -1
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@tanstack/virtual-core/dist/cjs/scroll-classifier.cjs +14 -2
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@tanstack/virtual-core/dist/cjs/scroll-classifier.cjs.map +1 -1
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@tanstack/virtual-core/dist/cjs/scroll-classifier.d.cts +3 -2
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@tanstack/virtual-core/dist/esm/index.d.ts +12 -1
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@tanstack/virtual-core/dist/esm/index.js +79 -26
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@tanstack/virtual-core/dist/esm/index.js.map +1 -1
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@tanstack/virtual-core/dist/esm/scroll-classifier.d.ts +3 -2
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@tanstack/virtual-core/dist/esm/scroll-classifier.js +14 -2
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@tanstack/virtual-core/dist/esm/scroll-classifier.js.map +1 -1
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@tanstack/virtual-core/package.json +1 -1
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@tanstack/virtual-core/src/index.ts +135 -24
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@northgraindata/dsui-adapter-sdk/node_modules/@tanstack/virtual-core/src/scroll-classifier.ts +31 -3
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@northgraindata/dsui-adapter-sdk/src/adapter/define.ts +22 -1
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@northgraindata/dsui-adapter-sdk/src/adapter/index.ts +1 -0
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@northgraindata/dsui-adapter-sdk/src/adapter/presentation.test.ts +73 -0
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@northgraindata/dsui-adapter-sdk/src/adapter/presentation.ts +34 -0
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@northgraindata/dsui-adapter-sdk/src/adapter/types.ts +23 -0
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@northgraindata/dsui-adapter-sdk/src/components/ui/layout/gauge.tsx +14 -2
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@northgraindata/dsui-adapter-sdk/src/dataset/dataset.test.ts +134 -0
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@northgraindata/dsui-adapter-sdk/src/dataset/index.ts +141 -0
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@northgraindata/dsui-adapter-sdk/src/index.ts +23 -0
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@tanstack/react-virtual/dist/cjs/index.cjs +3 -2
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@tanstack/react-virtual/dist/cjs/index.cjs.map +1 -1
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@tanstack/react-virtual/dist/esm/index.js +3 -2
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@tanstack/react-virtual/dist/esm/index.js.map +1 -1
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@tanstack/react-virtual/package.json +2 -2
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@tanstack/react-virtual/src/index.tsx +11 -2
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@tanstack/virtual-core/dist/cjs/index.cjs +79 -26
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@tanstack/virtual-core/dist/cjs/index.cjs.map +1 -1
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@tanstack/virtual-core/dist/cjs/index.d.cts +12 -1
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@tanstack/virtual-core/dist/cjs/scroll-classifier.cjs +14 -2
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@tanstack/virtual-core/dist/cjs/scroll-classifier.cjs.map +1 -1
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@tanstack/virtual-core/dist/cjs/scroll-classifier.d.cts +3 -2
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@tanstack/virtual-core/dist/esm/index.d.ts +12 -1
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@tanstack/virtual-core/dist/esm/index.js +79 -26
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@tanstack/virtual-core/dist/esm/index.js.map +1 -1
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@tanstack/virtual-core/dist/esm/scroll-classifier.d.ts +3 -2
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@tanstack/virtual-core/dist/esm/scroll-classifier.js +14 -2
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@tanstack/virtual-core/dist/esm/scroll-classifier.js.map +1 -1
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@tanstack/virtual-core/package.json +1 -1
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@tanstack/virtual-core/src/index.ts +135 -24
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@tanstack/virtual-core/src/scroll-classifier.ts +31 -3
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/package.json +2 -1
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/src/diagnostics.ts +24 -0
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/src/events.ts +6 -0
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/src/index.ts +162 -2
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/src/modal.test.ts +76 -0
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/src/modal.ts +200 -0
- package/sdk/node_modules/@northgraindata/dsui-ui/src/components/input.tsx +2 -5
- package/sdk/node_modules/@northgraindata/dsui-ui/src/components/suggest-input.tsx +197 -0
- package/sdk/node_modules/@northgraindata/dsui-ui/src/index.tsx +5 -0
- package/sdk/node_modules/@northgraindata/dsui-ui/src/styles.css +54 -0
- package/web/assets/index-DQkPkPN7.css +1 -0
- package/web/assets/index-w07fgRf1.js +218 -0
- package/web/index.html +2 -2
- package/sdk/node_modules/@northgraindata/dsui-adapter-sdk/src/components/ui/keyed-items.test.ts +0 -23
- package/sdk/node_modules/@northgraindata/dsui-adapter-sdk/src/components/ui/query-editor/column-profile.test.ts +0 -109
- package/sdk/node_modules/@northgraindata/dsui-adapter-sdk/src/components/ui/query-editor/query-explorer.test.ts +0 -29
- package/sdk/node_modules/@northgraindata/dsui-adapter-sdk/src/components/ui/table-data.test.ts +0 -65
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@northgraindata/dsui-adapter-sdk/src/components/ui/keyed-items.test.ts +0 -23
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@northgraindata/dsui-adapter-sdk/src/components/ui/query-editor/column-profile.test.ts +0 -109
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@northgraindata/dsui-adapter-sdk/src/components/ui/query-editor/query-explorer.test.ts +0 -29
- package/sdk/node_modules/@northgraindata/dsui-plugin-sdk/node_modules/@northgraindata/dsui-adapter-sdk/src/components/ui/table-data.test.ts +0 -65
- package/web/assets/index-D-ALFhle.css +0 -1
- package/web/assets/index-DfLcPXiR.js +0 -98
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/index.tsx"],"sourcesContent":["import * as React from 'react'\nimport { flushSync } from 'react-dom'\nimport {\n Virtualizer,\n elementScroll,\n observeElementOffset,\n observeElementRect,\n observeWindowOffset,\n observeWindowRect,\n windowScroll,\n} from '@tanstack/virtual-core'\nimport type {\n PartialKeys,\n VirtualItem,\n VirtualizerOptions,\n} from '@tanstack/virtual-core'\n\nexport * from '@tanstack/virtual-core'\n\nconst useIsomorphicLayoutEffect =\n typeof document !== 'undefined' ? React.useLayoutEffect : React.useEffect\n\nexport type ReactVirtualizer<\n TScrollElement extends Element | Window,\n TItemElement extends Element,\n> = Virtualizer<TScrollElement, TItemElement> & {\n /**\n * Ref callback for the inner size container element. Only meaningful when\n * `directDomUpdates: true` — the virtualizer writes the container's\n * main-axis size (`height` or `width`) directly to skip React re-renders.\n */\n containerRef: (node: HTMLElement | null) => void\n}\n\nexport type ReactVirtualizerOptions<\n TScrollElement extends Element | Window,\n TItemElement extends Element,\n> = VirtualizerOptions<TScrollElement, TItemElement> & {\n useFlushSync?: boolean\n /**\n * Skip React re-renders for scroll-only updates. The virtualizer writes\n * item positions (`top`/`left`) and the container size (`height`/`width`)\n * directly to the DOM, and only re-renders when the visible index range\n * or `isScrolling` changes.\n *\n * Requirements when enabled:\n * - Item elements must be `position: absolute`; in `'transform'` mode they\n * must also be anchored with `top: 0` / `left: 0`.\n * - Item elements must NOT set the main-axis position in their style — the\n * virtualizer owns `top` / `left` in `'position'` mode and `transform` in\n * `'transform'` mode.\n * - The inner size container must receive `virtualizer.containerRef` and\n * must NOT set `height` / `width` in its style.\n * - For multi-lane layouts (grids / masonry), the cross-axis position\n * (e.g. `left: ${(item.lane * 100) / lanes}%`) is stable per item and\n * must still be set in your JSX — only the main axis is automated.\n *\n * This flag is intended to be set once at mount. Toggling it (or\n * `directDomUpdatesMode`) at runtime can leave stale inline styles on\n * items and the container.\n */\n directDomUpdates?: boolean\n /**\n * How `directDomUpdates` positions item elements.\n * - `'transform'` (default): writes `transform: translate3d(...)`.\n * Promotes items to their own compositor layer — usually smoother on long\n * lists, but creates a stacking context and can interfere with\n * `position: fixed` descendants. Item elements must still be anchored with\n * `position: absolute`, `top: 0`, and `left: 0`.\n * - `'position'`: writes `top` / `left`. Item elements must be\n * `position: absolute`.\n */\n directDomUpdatesMode?: 'position' | 'transform'\n}\n\nfunction useVirtualizerBase<\n TScrollElement extends Element | Window,\n TItemElement extends Element,\n>({\n useFlushSync = true,\n directDomUpdates = false,\n directDomUpdatesMode = 'transform',\n ...options\n}: ReactVirtualizerOptions<TScrollElement, TItemElement>): ReactVirtualizer<\n TScrollElement,\n TItemElement\n> {\n const rerender = React.useReducer((x: number) => x + 1, 0)[1]\n\n // Mutable across renders so the onChange closure captured by setOptions\n // always reads the latest values without us having to re-create it.\n const directRef = React.useRef({\n enabled: directDomUpdates,\n mode: directDomUpdatesMode,\n container: null as HTMLElement | null,\n lastSize: null as number | null,\n // Keyed by the element itself so a remounted node (same key, new DOM\n // node — e.g. when `enabled` is toggled off then on) is treated as fresh\n // and gets its style written.\n lastPositions: new WeakMap<HTMLElement, number>(),\n prevRange: null as {\n startIndex: number\n endIndex: number\n isScrolling: boolean\n } | null,\n })\n directRef.current.enabled = directDomUpdates\n directRef.current.mode = directDomUpdatesMode\n\n // Set while the virtualizer measures an item through `measureElement`, which is\n // passed as a ref and therefore runs while React is committing.\n const measuringFromRef = React.useRef(false)\n\n // Writes the size container's total extent to the DOM. Idempotent — guarded\n // by lastSize. Split out from applyDirectStyles so it can run *before* the\n // scroll-position sync in the _willUpdate effect: an end-anchored prepend\n // grows the total and bumps scrollOffset in the same pass, and if scrollTop\n // is written before the container has grown the browser clamps it to the\n // stale (shorter) scrollHeight, leaving a gap at the top until the next\n // scroll (visible only in directDomUpdates mode — React-rendered sizers get\n // their height during render).\n const applyContainerSize = (\n instance: Virtualizer<TScrollElement, TItemElement>,\n ) => {\n const state = directRef.current\n if (!state.enabled || !state.container) return\n\n const totalSize = instance.getTotalSize()\n if (totalSize !== state.lastSize) {\n state.lastSize = totalSize\n const sizeAxis = instance.options.horizontal ? 'width' : 'height'\n state.container.style[sizeAxis] = `${totalSize}px`\n }\n }\n\n // Writes one item's main-axis position to its element. Idempotent — guarded\n // by lastPositions.\n const applyItemPosition = (\n instance: Virtualizer<TScrollElement, TItemElement>,\n item: VirtualItem,\n el: HTMLElement,\n ) => {\n const state = directRef.current\n const horizontal = !!instance.options.horizontal\n const next = item.start - instance.options.scrollMargin\n if (state.lastPositions.get(el) === next) return\n state.lastPositions.set(el, next)\n if (state.mode === 'transform') {\n el.style.transform = horizontal\n ? `translate3d(${next}px, 0, 0)`\n : `translate3d(0, ${next}px, 0)`\n } else {\n el.style[horizontal ? 'left' : 'top'] = `${next}px`\n }\n }\n\n // Writes container size + item positions to the DOM. Idempotent — guarded\n // by lastSize / lastPositions. Called from onChange (covers scroll-driven\n // updates) and from a layout effect (covers post-render commits when refs\n // have just registered new items in elementsCache).\n const applyDirectStyles = (\n instance: Virtualizer<TScrollElement, TItemElement>,\n ) => {\n const state = directRef.current\n if (!state.enabled || !state.container) return\n\n applyContainerSize(instance)\n\n for (const item of instance.getVirtualItems()) {\n const el = instance.elementsCache.get(item.key) as HTMLElement | undefined\n if (el) applyItemPosition(instance, item, el)\n }\n }\n\n const resolvedOptions: VirtualizerOptions<TScrollElement, TItemElement> = {\n ...options,\n onChange: (instance, sync) => {\n const state = directRef.current\n let shouldRerender = true\n\n if (state.enabled) {\n applyDirectStyles(instance)\n\n // Only re-render on range / isScrolling changes\n const range = instance.range\n const prev = state.prevRange\n shouldRerender =\n !prev ||\n prev.isScrolling !== instance.isScrolling ||\n prev.startIndex !== range?.startIndex ||\n prev.endIndex !== range?.endIndex\n if (shouldRerender) {\n state.prevRange = range\n ? {\n startIndex: range.startIndex,\n endIndex: range.endIndex,\n isScrolling: instance.isScrolling,\n }\n : null\n }\n }\n\n if (shouldRerender) {\n // A sync notify raised from `measureElement` reaches us while React is\n // committing, because `measureElement` is a ref callback. `flushSync`\n // cannot flush there: React still runs the callback at sync priority, but\n // it skips the flush and warns in development. The commit phase already\n // runs at discrete (sync) priority, so leaving `flushSync` out for that\n // window keeps the same lane and the same flush point — without the\n // warning. Every other sync notify (ResizeObserver re-measures, scroll\n // adjustments) still flushes synchronously.\n if (useFlushSync && sync && !measuringFromRef.current) {\n flushSync(rerender)\n } else {\n rerender()\n }\n }\n\n options.onChange?.(instance, sync)\n },\n }\n\n const [instance] = React.useState(() => {\n const v = new Virtualizer<TScrollElement, TItemElement>(resolvedOptions)\n const measureElement = v.measureElement\n v.measureElement = (node: TItemElement | null) => {\n measuringFromRef.current = true\n try {\n measureElement(node)\n } finally {\n measuringFromRef.current = false\n }\n // A row can mount in a commit that does not include this component — a\n // child re-rendering on its own state, context or a resolved Suspense\n // boundary — which the `applyDirectStyles` effect below never sees.\n // Position it as it registers; a row the effect does cover is skipped by\n // `lastPositions`.\n const state = directRef.current\n if (node !== null && state.enabled && state.container) {\n const item = v.measurementsCache[v.indexFromElement(node)]\n if (item) applyItemPosition(v, item, node as unknown as HTMLElement)\n }\n }\n return Object.assign(v, {\n containerRef: (node: HTMLElement | null) => {\n const state = directRef.current\n state.container = node\n state.lastSize = null\n // Sizes the container, and positions the rows that mounted with it:\n // React attaches children's refs before their parent's, so they have\n // already registered but found no container to be positioned in.\n if (node !== null) {\n applyDirectStyles(v)\n }\n },\n })\n })\n\n instance.setOptions(resolvedOptions)\n\n useIsomorphicLayoutEffect(() => {\n return instance._didMount()\n }, [])\n\n useIsomorphicLayoutEffect(() => {\n // Grow the size container to the new total BEFORE _willUpdate syncs the\n // scroll position. On an end-anchored prepend the scroll target lands at\n // the new bottom; if the container is still at its old (shorter) height the\n // browser clamps the scrollTop write and the list is left with a gap at the\n // top until the next scroll. Positions are written afterwards by the\n // applyDirectStyles effect below.\n applyContainerSize(instance)\n return instance._willUpdate()\n })\n\n // After every render commit, newly mounted item refs have registered in\n // elementsCache; write their positions to the DOM so the user doesn't see\n // them at (0, 0) until the next onChange.\n useIsomorphicLayoutEffect(() => {\n applyDirectStyles(instance)\n })\n\n return instance\n}\n\nexport function useVirtualizer<\n TScrollElement extends Element,\n TItemElement extends Element,\n>(\n options: PartialKeys<\n ReactVirtualizerOptions<TScrollElement, TItemElement>,\n 'observeElementRect' | 'observeElementOffset' | 'scrollToFn'\n >,\n): ReactVirtualizer<TScrollElement, TItemElement> {\n return useVirtualizerBase<TScrollElement, TItemElement>({\n observeElementRect: observeElementRect,\n observeElementOffset: observeElementOffset,\n scrollToFn: elementScroll,\n ...options,\n })\n}\n\nexport function useWindowVirtualizer<TItemElement extends Element>(\n options: PartialKeys<\n ReactVirtualizerOptions<Window, TItemElement>,\n | 'getScrollElement'\n | 'observeElementRect'\n | 'observeElementOffset'\n | 'scrollToFn'\n >,\n): ReactVirtualizer<Window, TItemElement> {\n return useVirtualizerBase<Window, TItemElement>({\n getScrollElement: () => (typeof document !== 'undefined' ? window : null),\n observeElementRect: observeWindowRect,\n observeElementOffset: observeWindowOffset,\n scrollToFn: windowScroll,\n initialOffset: () => (typeof document !== 'undefined' ? window.scrollY : 0),\n ...options,\n })\n}\n"],"names":["instance"],"mappings":";;;;AAmBA,MAAM,4BACJ,OAAO,aAAa,cAAc,MAAM,kBAAkB,MAAM;AAuDlE,SAAS,mBAG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AO,EAAE,kBAAkB,EAAE,iBAAiB,IAAI,CAAC;AACzD,YAAI,KAAM,mBAAkB,GAAG,MAAM,IAA8B;AAAA,MACrE;AAAA,IACF;AACA,WAAO,OAAO,OAAO,GAAG;AAAA,MACtB,cAAc,CAAC,SAA6B;AAC1C,cAAM,QAAQ,UAAU;AACxB,cAAM,YAAY;AAClB,cAAM,WAAW;AAIjB,YAAI,SAAS,MAAM;AACjB,4BAAkB,CAAC;AAAA,QACrB;AAAA,MACF;AAAA,IAAA,CACD;AAAA,EACH,CAAC;AAED,WAAS,WAAW,eAAe;AAEnC,4BAA0B,MAAM;AAC9B,WAAO,SAAS,UAAA;AAAA,EAClB,GAAG,CAAA,CAAE;AAEL,4BAA0B,MAAM;AAO9B,uBAAmB,QAAQ;AAC3B,WAAO,SAAS,YAAA;AAAA,EAClB,CAAC;AAKD,4BAA0B,MAAM;AAC9B,sBAAkB,QAAQ;AAAA,EAC5B,CAAC;AAED,SAAO;AACT;AAEO,SAAS,eAId,SAIgD;AAChD,SAAO,mBAAiD;AAAA,IACtD;AAAA,IACA;AAAA,IACA,YAAY;AAAA,IACZ,GAAG;AAAA,EAAA,CACJ;AACH;AAEO,SAAS,qBACd,SAOwC;AACxC,SAAO,mBAAyC;AAAA,IAC9C,kBAAkB,MAAO,OAAO,aAAa,cAAc,SAAS;AAAA,IACpE,oBAAoB;AAAA,IACpB,sBAAsB;AAAA,IACtB,YAAY;AAAA,IACZ,eAAe,MAAO,OAAO,aAAa,cAAc,OAAO,UAAU;AAAA,IACzE,GAAG;AAAA,EAAA,CACJ;AACH;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/index.tsx"],"sourcesContent":["import * as React from 'react'\nimport { flushSync } from 'react-dom'\nimport {\n Virtualizer,\n elementScroll,\n observeElementOffset,\n observeElementRect,\n observeWindowOffset,\n observeWindowRect,\n windowScroll,\n} from '@tanstack/virtual-core'\nimport type {\n PartialKeys,\n VirtualItem,\n VirtualizerOptions,\n} from '@tanstack/virtual-core'\n\nexport * from '@tanstack/virtual-core'\n\nconst useIsomorphicLayoutEffect =\n typeof document !== 'undefined' ? React.useLayoutEffect : React.useEffect\n\nexport type ReactVirtualizer<\n TScrollElement extends Element | Window,\n TItemElement extends Element,\n> = Virtualizer<TScrollElement, TItemElement> & {\n /**\n * Ref callback for the inner size container element. Only meaningful when\n * `directDomUpdates: true` — the virtualizer writes the container's\n * main-axis size (`height` or `width`) directly to skip React re-renders.\n */\n containerRef: (node: HTMLElement | null) => void\n}\n\nexport type ReactVirtualizerOptions<\n TScrollElement extends Element | Window,\n TItemElement extends Element,\n> = VirtualizerOptions<TScrollElement, TItemElement> & {\n useFlushSync?: boolean\n /**\n * Skip React re-renders for scroll-only updates. The virtualizer writes\n * item positions (`top`/`left`) and the container size (`height`/`width`)\n * directly to the DOM, and only re-renders when the visible index range\n * or `isScrolling` changes.\n *\n * Requirements when enabled:\n * - Item elements must be `position: absolute`; in `'transform'` mode they\n * must also be anchored with `top: 0` / `left: 0`.\n * - Item elements must NOT set the main-axis position in their style — the\n * virtualizer owns `top` / `left` in `'position'` mode and `transform` in\n * `'transform'` mode.\n * - The inner size container must receive `virtualizer.containerRef` and\n * must NOT set `height` / `width` in its style.\n * - For multi-lane layouts (grids / masonry), the cross-axis position\n * (e.g. `left: ${(item.lane * 100) / lanes}%`) is stable per item and\n * must still be set in your JSX — only the main axis is automated.\n *\n * This flag is intended to be set once at mount. Toggling it (or\n * `directDomUpdatesMode`) at runtime can leave stale inline styles on\n * items and the container.\n */\n directDomUpdates?: boolean\n /**\n * How `directDomUpdates` positions item elements.\n * - `'transform'` (default): writes `transform: translate3d(...)`.\n * Promotes items to their own compositor layer — usually smoother on long\n * lists, but creates a stacking context and can interfere with\n * `position: fixed` descendants. Item elements must still be anchored with\n * `position: absolute`, `top: 0`, and `left: 0`.\n * - `'position'`: writes `top` / `left`. Item elements must be\n * `position: absolute`.\n */\n directDomUpdatesMode?: 'position' | 'transform'\n}\n\nfunction useVirtualizerBase<\n TScrollElement extends Element | Window,\n TItemElement extends Element,\n>({\n useFlushSync = true,\n directDomUpdates = false,\n directDomUpdatesMode = 'transform',\n ...options\n}: ReactVirtualizerOptions<TScrollElement, TItemElement>): ReactVirtualizer<\n TScrollElement,\n TItemElement\n> {\n const [, dispatch] = React.useReducer((x: number) => x + 1, 0)\n // React DevTools replays hooks with a no-op dispatch while inspecting them.\n // Keep the original dispatch so that setOptions below cannot replace the\n // virtualizer's render callback with the inspector's no-op.\n const rerender = React.useRef(dispatch).current\n\n // Mutable across renders so the onChange closure captured by setOptions\n // always reads the latest values without us having to re-create it.\n const directRef = React.useRef({\n enabled: directDomUpdates,\n mode: directDomUpdatesMode,\n container: null as HTMLElement | null,\n lastSize: null as number | null,\n // Keyed by the element itself so a remounted node (same key, new DOM\n // node — e.g. when `enabled` is toggled off then on) is treated as fresh\n // and gets its style written.\n lastPositions: new WeakMap<HTMLElement, number>(),\n prevRange: null as {\n startIndex: number\n endIndex: number\n isScrolling: boolean\n } | null,\n })\n directRef.current.enabled = directDomUpdates\n directRef.current.mode = directDomUpdatesMode\n\n // Set while the virtualizer measures an item through `measureElement`, which is\n // passed as a ref and therefore runs while React is committing.\n const measuringFromRef = React.useRef(false)\n\n // Writes the size container's total extent to the DOM. Idempotent — guarded\n // by lastSize. Split out from applyDirectStyles so it can run *before* the\n // scroll-position sync in the _willUpdate effect: an end-anchored prepend\n // grows the total and bumps scrollOffset in the same pass, and if scrollTop\n // is written before the container has grown the browser clamps it to the\n // stale (shorter) scrollHeight, leaving a gap at the top until the next\n // scroll (visible only in directDomUpdates mode — React-rendered sizers get\n // their height during render).\n const applyContainerSize = (\n instance: Virtualizer<TScrollElement, TItemElement>,\n ) => {\n const state = directRef.current\n if (!state.enabled || !state.container) return\n\n const totalSize = instance.getTotalSize()\n if (totalSize !== state.lastSize) {\n state.lastSize = totalSize\n const sizeAxis = instance.options.horizontal ? 'width' : 'height'\n state.container.style[sizeAxis] = `${totalSize}px`\n }\n }\n\n // Writes one item's main-axis position to its element. Idempotent — guarded\n // by lastPositions.\n const applyItemPosition = (\n instance: Virtualizer<TScrollElement, TItemElement>,\n item: VirtualItem,\n el: HTMLElement,\n ) => {\n const state = directRef.current\n const horizontal = !!instance.options.horizontal\n const next = item.start - instance.options.scrollMargin\n if (state.lastPositions.get(el) === next) return\n state.lastPositions.set(el, next)\n if (state.mode === 'transform') {\n el.style.transform = horizontal\n ? `translate3d(${next}px, 0, 0)`\n : `translate3d(0, ${next}px, 0)`\n } else {\n el.style[horizontal ? 'left' : 'top'] = `${next}px`\n }\n }\n\n // Writes container size + item positions to the DOM. Idempotent — guarded\n // by lastSize / lastPositions. Called from onChange (covers scroll-driven\n // updates) and from a layout effect (covers post-render commits when refs\n // have just registered new items in elementsCache).\n const applyDirectStyles = (\n instance: Virtualizer<TScrollElement, TItemElement>,\n ) => {\n const state = directRef.current\n if (!state.enabled || !state.container) return\n\n applyContainerSize(instance)\n\n for (const item of instance.getVirtualItems()) {\n const el = instance.elementsCache.get(item.key) as HTMLElement | undefined\n if (el) applyItemPosition(instance, item, el)\n }\n }\n\n const resolvedOptions: VirtualizerOptions<TScrollElement, TItemElement> = {\n ...options,\n onChange: (instance, sync) => {\n const state = directRef.current\n let shouldRerender = true\n\n if (state.enabled) {\n applyDirectStyles(instance)\n\n // Only re-render on range / isScrolling changes\n const range = instance.range\n const prev = state.prevRange\n shouldRerender =\n !prev ||\n prev.isScrolling !== instance.isScrolling ||\n prev.startIndex !== range?.startIndex ||\n prev.endIndex !== range?.endIndex\n if (shouldRerender) {\n state.prevRange = range\n ? {\n startIndex: range.startIndex,\n endIndex: range.endIndex,\n isScrolling: instance.isScrolling,\n }\n : null\n }\n }\n\n if (shouldRerender) {\n // A sync notify raised from `measureElement` reaches us while React is\n // committing, because `measureElement` is a ref callback. `flushSync`\n // cannot flush there: React still runs the callback at sync priority, but\n // it skips the flush and warns in development. The commit phase already\n // runs at discrete (sync) priority, so leaving `flushSync` out for that\n // window keeps the same lane and the same flush point — without the\n // warning. Every other sync notify (ResizeObserver re-measures, scroll\n // adjustments) still flushes synchronously.\n if (useFlushSync && sync && !measuringFromRef.current) {\n flushSync(rerender)\n } else {\n rerender()\n }\n }\n\n options.onChange?.(instance, sync)\n },\n }\n\n const [instance] = React.useState(() => {\n const v = new Virtualizer<TScrollElement, TItemElement>(resolvedOptions)\n const measureElement = v.measureElement\n v.measureElement = (node: TItemElement | null) => {\n measuringFromRef.current = true\n try {\n measureElement(node)\n } finally {\n measuringFromRef.current = false\n }\n // A row can mount in a commit that does not include this component — a\n // child re-rendering on its own state, context or a resolved Suspense\n // boundary — which the `applyDirectStyles` effect below never sees.\n // Position it as it registers; a row the effect does cover is skipped by\n // `lastPositions`.\n const state = directRef.current\n if (node !== null && state.enabled && state.container) {\n const item = v.measurementsCache[v.indexFromElement(node)]\n if (item) applyItemPosition(v, item, node as unknown as HTMLElement)\n }\n }\n return Object.assign(v, {\n containerRef: (node: HTMLElement | null) => {\n const state = directRef.current\n state.container = node\n state.lastSize = null\n // Sizes the container, and positions the rows that mounted with it:\n // React attaches children's refs before their parent's, so they have\n // already registered but found no container to be positioned in.\n if (node !== null) {\n applyDirectStyles(v)\n }\n },\n })\n })\n\n instance.setOptions(resolvedOptions)\n\n useIsomorphicLayoutEffect(() => {\n return instance._didMount()\n }, [])\n\n useIsomorphicLayoutEffect(() => {\n // Grow the size container to the new total BEFORE _willUpdate syncs the\n // scroll position. On an end-anchored prepend the scroll target lands at\n // the new bottom; if the container is still at its old (shorter) height the\n // browser clamps the scrollTop write and the list is left with a gap at the\n // top until the next scroll. Positions are written afterwards by the\n // applyDirectStyles effect below.\n applyContainerSize(instance)\n return instance._willUpdate()\n })\n\n // After every render commit, newly mounted item refs have registered in\n // elementsCache; write their positions to the DOM so the user doesn't see\n // them at (0, 0) until the next onChange.\n useIsomorphicLayoutEffect(() => {\n applyDirectStyles(instance)\n })\n\n return instance\n}\n\nexport function useVirtualizer<\n TScrollElement extends Element,\n TItemElement extends Element,\n>(\n options: PartialKeys<\n ReactVirtualizerOptions<TScrollElement, TItemElement>,\n 'observeElementRect' | 'observeElementOffset' | 'scrollToFn'\n >,\n): ReactVirtualizer<TScrollElement, TItemElement> {\n return useVirtualizerBase<TScrollElement, TItemElement>({\n observeElementRect: observeElementRect,\n observeElementOffset: observeElementOffset,\n scrollToFn: elementScroll,\n ...options,\n })\n}\n\nexport function useWindowVirtualizer<TItemElement extends Element>(\n options: PartialKeys<\n ReactVirtualizerOptions<Window, TItemElement>,\n | 'getScrollElement'\n | 'observeElementRect'\n | 'observeElementOffset'\n | 'scrollToFn'\n >,\n): ReactVirtualizer<Window, TItemElement> {\n return useVirtualizerBase<Window, TItemElement>({\n getScrollElement: () => (typeof document !== 'undefined' ? window : null),\n observeElementRect: observeWindowRect,\n observeElementOffset: observeWindowOffset,\n scrollToFn: windowScroll,\n initialOffset: () =>\n typeof document !== 'undefined'\n ? options.horizontal\n ? window.scrollX\n : window.scrollY\n : 0,\n ...options,\n })\n}\n"],"names":["instance"],"mappings":";;;;AAmBA,MAAM,4BACJ,OAAO,aAAa,cAAc,MAAM,kBAAkB,MAAM;AAuDlE,SAAS,mBAGP;AAAA,EACA,eAAe;AAAA,EACf,mBAAmB;AAAA,EACnB,uBAAuB;AAAA,EACvB,GAAG;AACL,GAGE;AACA,QAAM,CAAA,EAAG,QAAQ,IAAI,MAAM,WAAW,CAAC,MAAc,IAAI,GAAG,CAAC;AAI7D,QAAM,WAAW,MAAM,OAAO,QAAQ,EAAE;AAIxC,QAAM,YAAY,MAAM,OAAO;AAAA,IAC7B,SAAS;AAAA,IACT,MAAM;AAAA,IACN,WAAW;AAAA,IACX,UAAU;AAAA;AAAA;AAAA;AAAA,IAIV,mCAAmB,QAAA;AAAA,IACnB,WAAW;AAAA,EAAA,CAKZ;AACD,YAAU,QAAQ,UAAU;AAC5B,YAAU,QAAQ,OAAO;AAIzB,QAAM,mBAAmB,MAAM,OAAO,KAAK;AAU3C,QAAM,qBAAqB,CACzBA,cACG;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uBAAmB,QAAQ;AAC3B,WAAO,SAAS,YAAA;AAAA,EAClB,CAAC;AAKD,4BAA0B,MAAM;AAC9B,sBAAkB,QAAQ;AAAA,EAC5B,CAAC;AAED,SAAO;AACT;AAEO,SAAS,eAId,SAIgD;AAChD,SAAO,mBAAiD;AAAA,IACtD;AAAA,IACA;AAAA,IACA,YAAY;AAAA,IACZ,GAAG;AAAA,EAAA,CACJ;AACH;AAEO,SAAS,qBACd,SAOwC;AACxC,SAAO,mBAAyC;AAAA,IAC9C,kBAAkB,MAAO,OAAO,aAAa,cAAc,SAAS;AAAA,IACpE,oBAAoB;AAAA,IACpB,sBAAsB;AAAA,IACtB,YAAY;AAAA,IACZ,eAAe,MACb,OAAO,aAAa,cAChB,QAAQ,aACN,OAAO,UACP,OAAO,UACT;AAAA,IACN,GAAG;AAAA,EAAA,CACJ;AACH;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/react-virtual",
|
|
3
|
-
"version": "3.14.
|
|
3
|
+
"version": "3.14.28",
|
|
4
4
|
"description": "Headless UI for virtualizing scrollable elements in React",
|
|
5
5
|
"author": "Tanner Linsley",
|
|
6
6
|
"license": "MIT",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"src"
|
|
46
46
|
],
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@tanstack/virtual-core": "3.19.
|
|
48
|
+
"@tanstack/virtual-core": "3.19.13"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@testing-library/react": "^16.3.0",
|
|
@@ -85,7 +85,11 @@ function useVirtualizerBase<
|
|
|
85
85
|
TScrollElement,
|
|
86
86
|
TItemElement
|
|
87
87
|
> {
|
|
88
|
-
const
|
|
88
|
+
const [, dispatch] = React.useReducer((x: number) => x + 1, 0)
|
|
89
|
+
// React DevTools replays hooks with a no-op dispatch while inspecting them.
|
|
90
|
+
// Keep the original dispatch so that setOptions below cannot replace the
|
|
91
|
+
// virtualizer's render callback with the inspector's no-op.
|
|
92
|
+
const rerender = React.useRef(dispatch).current
|
|
89
93
|
|
|
90
94
|
// Mutable across renders so the onChange closure captured by setOptions
|
|
91
95
|
// always reads the latest values without us having to re-create it.
|
|
@@ -314,7 +318,12 @@ export function useWindowVirtualizer<TItemElement extends Element>(
|
|
|
314
318
|
observeElementRect: observeWindowRect,
|
|
315
319
|
observeElementOffset: observeWindowOffset,
|
|
316
320
|
scrollToFn: windowScroll,
|
|
317
|
-
initialOffset: () =>
|
|
321
|
+
initialOffset: () =>
|
|
322
|
+
typeof document !== 'undefined'
|
|
323
|
+
? options.horizontal
|
|
324
|
+
? window.scrollX
|
|
325
|
+
: window.scrollY
|
|
326
|
+
: 0,
|
|
318
327
|
...options,
|
|
319
328
|
})
|
|
320
329
|
}
|
|
@@ -203,17 +203,23 @@ class Virtualizer {
|
|
|
203
203
|
this._singleLaneMeasurements = null;
|
|
204
204
|
this.itemSizeCache = /* @__PURE__ */ new Map();
|
|
205
205
|
this.itemSizeCacheVersion = 0;
|
|
206
|
+
this.builtMeasurementOptions = null;
|
|
207
|
+
this.builtItemSizeCacheVersion = -1;
|
|
208
|
+
this.pendingResizes = [];
|
|
206
209
|
this.laneAssignments = /* @__PURE__ */ new Map();
|
|
207
210
|
this.pendingMin = null;
|
|
208
211
|
this.prevLanes = void 0;
|
|
209
212
|
this.lanesChangedFlag = false;
|
|
210
213
|
this.lanesSettling = false;
|
|
214
|
+
this.initialMeasurementsCacheApplied = false;
|
|
211
215
|
this.pendingScrollAnchor = null;
|
|
212
216
|
this.scrollRect = null;
|
|
213
217
|
this.scrollOffset = null;
|
|
214
218
|
this.scrollDirection = null;
|
|
215
219
|
this._holdOffset = 0;
|
|
216
220
|
this._reportedOverscroll = false;
|
|
221
|
+
this._trailing = 0;
|
|
222
|
+
this._drawnListEnd = Infinity;
|
|
217
223
|
this._iosGesture = new iosGesture.IosGesture({
|
|
218
224
|
getWindow: () => this.targetWindow,
|
|
219
225
|
now: () => this.now(),
|
|
@@ -248,6 +254,7 @@ class Virtualizer {
|
|
|
248
254
|
});
|
|
249
255
|
this._lastElementOffset = null;
|
|
250
256
|
this.pendingWrite = null;
|
|
257
|
+
this._ownWriteAt = null;
|
|
251
258
|
this._clampedAdjustment = null;
|
|
252
259
|
this.elementsCache = /* @__PURE__ */ new Map();
|
|
253
260
|
this._resizeBatch = null;
|
|
@@ -456,7 +463,7 @@ class Virtualizer {
|
|
|
456
463
|
this.pendingScrollAnchor = { kind: "anchor", delta: anchorDelta };
|
|
457
464
|
} else {
|
|
458
465
|
this._holdOffset += anchorDelta;
|
|
459
|
-
this.
|
|
466
|
+
this._followAnchor(anchorDelta);
|
|
460
467
|
}
|
|
461
468
|
}
|
|
462
469
|
};
|
|
@@ -502,8 +509,10 @@ class Virtualizer {
|
|
|
502
509
|
this.scrollDirection = null;
|
|
503
510
|
this._holdOffset = 0;
|
|
504
511
|
this._reportedOverscroll = false;
|
|
512
|
+
this._trailing = 0;
|
|
505
513
|
this._clampedAdjustment = null;
|
|
506
514
|
this.pendingWrite = null;
|
|
515
|
+
this._ownWriteAt = null;
|
|
507
516
|
this.scrollElement = null;
|
|
508
517
|
this.targetWindow = null;
|
|
509
518
|
};
|
|
@@ -540,6 +549,7 @@ class Virtualizer {
|
|
|
540
549
|
this.options.observeElementOffset(this, (offset, isScrolling) => {
|
|
541
550
|
var _a2, _b, _c, _d;
|
|
542
551
|
const elementMax = isScrolling ? this._elementMaxScrollOffset() : null;
|
|
552
|
+
this._readTrailing(elementMax);
|
|
543
553
|
const wasOverscrolled = this._reportedOverscroll;
|
|
544
554
|
this._reportedOverscroll = offset < 0 || elementMax !== null && offset > elementMax + 1;
|
|
545
555
|
const elementOffset = offset;
|
|
@@ -565,6 +575,11 @@ class Virtualizer {
|
|
|
565
575
|
this.scrollState = null;
|
|
566
576
|
}
|
|
567
577
|
this.pendingWrite = null;
|
|
578
|
+
if (kind === "readBack" || kind === "clampedReadBack" || kind === "clampedEcho") {
|
|
579
|
+
this._ownWriteAt = offset;
|
|
580
|
+
} else if (kind !== "restEcho") {
|
|
581
|
+
this._ownWriteAt = null;
|
|
582
|
+
}
|
|
568
583
|
if (this._clampedAdjustment !== null && Math.abs(offset - this._clampedAdjustment.maxAtWrite) >= 1.5) {
|
|
569
584
|
this._clampedAdjustment = null;
|
|
570
585
|
}
|
|
@@ -615,6 +630,8 @@ class Virtualizer {
|
|
|
615
630
|
);
|
|
616
631
|
}
|
|
617
632
|
this._scrollToOffset(this.getScrollOffset());
|
|
633
|
+
this._readTrailing(this._elementMaxScrollOffset());
|
|
634
|
+
this.maybeNotify();
|
|
618
635
|
}
|
|
619
636
|
this._noteClampMax();
|
|
620
637
|
const anchor = this.pendingScrollAnchor;
|
|
@@ -623,14 +640,11 @@ class Virtualizer {
|
|
|
623
640
|
if (anchor.kind === "anchor") {
|
|
624
641
|
if (!this._canWriteScroll()) {
|
|
625
642
|
this._holdOffset += anchor.delta;
|
|
626
|
-
this.
|
|
643
|
+
this._followAnchor(anchor.delta);
|
|
627
644
|
this.notify(false);
|
|
628
|
-
} else if (isSmoothScroll(this.scrollState) && !
|
|
629
|
-
this.getScrollOffset() - anchor.delta,
|
|
630
|
-
this.scrollState.lastTargetOffset
|
|
631
|
-
)) ;
|
|
645
|
+
} else if (isSmoothScroll(this.scrollState) && !this._landedBeforeAnchor(this.scrollState, anchor.delta)) ;
|
|
632
646
|
else {
|
|
633
|
-
this.
|
|
647
|
+
this._followAnchor(anchor.delta);
|
|
634
648
|
this._scrollToOffset(this.getScrollOffset());
|
|
635
649
|
}
|
|
636
650
|
} else {
|
|
@@ -649,7 +663,8 @@ class Virtualizer {
|
|
|
649
663
|
holdOffset: this._holdOffset,
|
|
650
664
|
scrollOffset: this.scrollOffset,
|
|
651
665
|
pendingWrite: this.pendingWrite,
|
|
652
|
-
clampedMaxAtWrite: ((_a = this._clampedAdjustment) == null ? void 0 : _a.maxAtWrite) ?? null
|
|
666
|
+
clampedMaxAtWrite: ((_a = this._clampedAdjustment) == null ? void 0 : _a.maxAtWrite) ?? null,
|
|
667
|
+
ownWriteAt: this._ownWriteAt
|
|
653
668
|
});
|
|
654
669
|
};
|
|
655
670
|
this._retryClampedAdjustment = () => {
|
|
@@ -759,23 +774,28 @@ class Virtualizer {
|
|
|
759
774
|
this.isIndexInRange = (index) => index >= 0 && index < this.options.count;
|
|
760
775
|
this.getMeasurements = utils.memo(
|
|
761
776
|
() => [this.getMeasurementOptions(), this.itemSizeCacheVersion],
|
|
762
|
-
({
|
|
763
|
-
count,
|
|
764
|
-
paddingStart,
|
|
765
|
-
scrollMargin,
|
|
766
|
-
getItemKey,
|
|
767
|
-
enabled,
|
|
768
|
-
lanes,
|
|
769
|
-
laneAssignmentMode,
|
|
770
|
-
gap
|
|
771
|
-
}, _itemSizeCacheVersion) => {
|
|
777
|
+
(measurementOptions, itemSizeCacheVersion) => {
|
|
772
778
|
var _a;
|
|
779
|
+
const {
|
|
780
|
+
count,
|
|
781
|
+
paddingStart,
|
|
782
|
+
scrollMargin,
|
|
783
|
+
getItemKey,
|
|
784
|
+
enabled,
|
|
785
|
+
lanes,
|
|
786
|
+
laneAssignmentMode,
|
|
787
|
+
gap
|
|
788
|
+
} = measurementOptions;
|
|
789
|
+
this.builtMeasurementOptions = measurementOptions;
|
|
790
|
+
this.builtItemSizeCacheVersion = itemSizeCacheVersion;
|
|
791
|
+
this.pendingResizes = [];
|
|
773
792
|
const itemSizeCache = this.itemSizeCache;
|
|
774
793
|
if (!enabled) {
|
|
775
794
|
this.measurementsCache = [];
|
|
776
795
|
this._singleLaneMeasurements = null;
|
|
777
796
|
this.itemSizeCache.clear();
|
|
778
797
|
this.laneAssignments.clear();
|
|
798
|
+
this.initialMeasurementsCacheApplied = false;
|
|
779
799
|
return [];
|
|
780
800
|
}
|
|
781
801
|
if (this.laneAssignments.size > count) {
|
|
@@ -794,7 +814,8 @@ class Virtualizer {
|
|
|
794
814
|
this.laneAssignments.clear();
|
|
795
815
|
this.pendingMin = null;
|
|
796
816
|
}
|
|
797
|
-
if (this.measurementsCache.length === 0 && !this.lanesSettling) {
|
|
817
|
+
if (!this.initialMeasurementsCacheApplied && this.measurementsCache.length === 0 && !this.lanesSettling) {
|
|
818
|
+
this.initialMeasurementsCacheApplied = true;
|
|
798
819
|
this.measurementsCache = this.options.initialMeasurementsCache;
|
|
799
820
|
this.measurementsCache.forEach((item) => {
|
|
800
821
|
this.itemSizeCache.set(item.key, item.size);
|
|
@@ -915,14 +936,15 @@ class Virtualizer {
|
|
|
915
936
|
this.options.lanes,
|
|
916
937
|
// scrollOffset is measured in the scroll element and the layout total
|
|
917
938
|
// from the list start, so the list ends scrollMargin further down.
|
|
918
|
-
this._getLayoutTotalSize() + this.options.scrollMargin
|
|
939
|
+
this._getLayoutTotalSize() + this.options.scrollMargin,
|
|
940
|
+
this._trailing
|
|
919
941
|
],
|
|
920
|
-
(measurements, outerSize, scrollOffset, lanes, listEnd) => {
|
|
942
|
+
(measurements, outerSize, scrollOffset, lanes, listEnd, trailing) => {
|
|
921
943
|
if (measurements.length === 0 || outerSize === 0) {
|
|
922
944
|
this.range = null;
|
|
923
945
|
return null;
|
|
924
946
|
}
|
|
925
|
-
const maxScrollOffset = Math.max(listEnd - outerSize, 0);
|
|
947
|
+
const maxScrollOffset = Math.max(listEnd + trailing - outerSize, 0);
|
|
926
948
|
this.range = calculateRangeImpl(
|
|
927
949
|
measurements,
|
|
928
950
|
outerSize,
|
|
@@ -1028,17 +1050,27 @@ class Virtualizer {
|
|
|
1028
1050
|
this.resizeItem(index, this.options.measureElement(node, void 0, this));
|
|
1029
1051
|
}
|
|
1030
1052
|
};
|
|
1053
|
+
this.canShiftFromPendingResizes = () => this.options.lanes === 1 && this._singleLaneMeasurements !== null && this.shouldAdjustScrollPositionOnItemSizeChange === void 0 && !this.lanesChangedFlag && !this.lanesSettling && this.getMeasurementOptions() === this.builtMeasurementOptions && this.itemSizeCacheVersion === this.builtItemSizeCacheVersion + this.pendingResizes.length;
|
|
1031
1054
|
this.resizeItem = (index, size) => {
|
|
1032
1055
|
var _a, _b, _c;
|
|
1033
1056
|
if (!this.isIndexInRange(index)) return;
|
|
1034
|
-
|
|
1057
|
+
let startShift = 0;
|
|
1058
|
+
if ((_a = this._resizeBatch) == null ? void 0 : _a.sync) {
|
|
1059
|
+
if (this.canShiftFromPendingResizes()) {
|
|
1060
|
+
for (const resize of this.pendingResizes) {
|
|
1061
|
+
if (resize.index < index) startShift += resize.delta;
|
|
1062
|
+
}
|
|
1063
|
+
} else {
|
|
1064
|
+
this.getMeasurements();
|
|
1065
|
+
}
|
|
1066
|
+
}
|
|
1035
1067
|
let cachedSize;
|
|
1036
1068
|
let itemStart;
|
|
1037
1069
|
let key;
|
|
1038
1070
|
const flat = (_b = this._singleLaneMeasurements) == null ? void 0 : _b.flat;
|
|
1039
1071
|
if (this.options.lanes === 1 && flat != null) {
|
|
1040
1072
|
key = this.options.getItemKey(index);
|
|
1041
|
-
itemStart = flat[index * 2];
|
|
1073
|
+
itemStart = flat[index * 2] + startShift;
|
|
1042
1074
|
cachedSize = flat[index * 2 + 1];
|
|
1043
1075
|
} else {
|
|
1044
1076
|
const item = this.measurementsCache[index];
|
|
@@ -1088,6 +1120,7 @@ class Virtualizer {
|
|
|
1088
1120
|
}
|
|
1089
1121
|
this.itemSizeCache.set(key, size);
|
|
1090
1122
|
this.itemSizeCacheVersion++;
|
|
1123
|
+
this.pendingResizes.push({ index, delta });
|
|
1091
1124
|
let adjustedSync = false;
|
|
1092
1125
|
if (!this._awaitingCommandReadBack()) {
|
|
1093
1126
|
if (wasAtEnd) {
|
|
@@ -1107,6 +1140,9 @@ class Virtualizer {
|
|
|
1107
1140
|
this._noteClampMax();
|
|
1108
1141
|
this._flushHoldIfReady(true);
|
|
1109
1142
|
this._retryClampedAdjustment();
|
|
1143
|
+
} else if (this.options.lanes > 1 && !this.options.useCachedMeasurements && !this.laneAssignments.has(index)) {
|
|
1144
|
+
const item = this.getMeasurements()[index];
|
|
1145
|
+
if (item) this.laneAssignments.set(index, item.lane);
|
|
1110
1146
|
}
|
|
1111
1147
|
};
|
|
1112
1148
|
this.getVirtualItems = utils.memo(
|
|
@@ -1166,6 +1202,11 @@ class Virtualizer {
|
|
|
1166
1202
|
}
|
|
1167
1203
|
return offset;
|
|
1168
1204
|
};
|
|
1205
|
+
this._readTrailing = (elementMax) => {
|
|
1206
|
+
if (elementMax === null) return;
|
|
1207
|
+
const trailing = elementMax + this.getSize() - this._drawnListEnd;
|
|
1208
|
+
this._trailing = trailing > 0 ? trailing : 0;
|
|
1209
|
+
};
|
|
1169
1210
|
this._elementMaxScrollOffset = () => {
|
|
1170
1211
|
const el = this.scrollElement;
|
|
1171
1212
|
if (el === null) return null;
|
|
@@ -1331,13 +1372,17 @@ class Virtualizer {
|
|
|
1331
1372
|
}
|
|
1332
1373
|
this.scrollState = null;
|
|
1333
1374
|
};
|
|
1334
|
-
this.getTotalSize = () =>
|
|
1375
|
+
this.getTotalSize = () => {
|
|
1376
|
+
const total = Math.max(this._getLayoutTotalSize() - this._holdOffset, 0);
|
|
1377
|
+
this._drawnListEnd = total + this.options.scrollMargin;
|
|
1378
|
+
return total;
|
|
1379
|
+
};
|
|
1335
1380
|
this._getLayoutTotalSize = () => {
|
|
1336
1381
|
var _a, _b;
|
|
1337
1382
|
const measurements = this.getMeasurements();
|
|
1338
1383
|
let end;
|
|
1339
1384
|
if (measurements.length === 0) {
|
|
1340
|
-
end = this.options.paddingStart;
|
|
1385
|
+
end = this.options.scrollMargin + this.options.paddingStart;
|
|
1341
1386
|
} else if (this.options.lanes === 1) {
|
|
1342
1387
|
const lastIdx = measurements.length - 1;
|
|
1343
1388
|
const flat = (_a = this._singleLaneMeasurements) == null ? void 0 : _a.flat;
|
|
@@ -1407,6 +1452,14 @@ class Virtualizer {
|
|
|
1407
1452
|
this.scrollState.lastTargetOffset += delta;
|
|
1408
1453
|
}
|
|
1409
1454
|
};
|
|
1455
|
+
this._landedBeforeAnchor = (state, delta) => state.phase !== "queued" && (state.stableFrames > 0 || utils.approxEqual(this.getScrollOffset() - delta, state.lastTargetOffset));
|
|
1456
|
+
this._followAnchor = (delta) => {
|
|
1457
|
+
this._followOffsetTarget(delta);
|
|
1458
|
+
const state = this.scrollState;
|
|
1459
|
+
if ((state == null ? void 0 : state.index) != null && !state.toEnd && this._landedBeforeAnchor(state, delta)) {
|
|
1460
|
+
this.scrollState = null;
|
|
1461
|
+
}
|
|
1462
|
+
};
|
|
1410
1463
|
this.measure = () => {
|
|
1411
1464
|
this.pendingMin = null;
|
|
1412
1465
|
this.itemSizeCache.clear();
|