vlist 0.1.3 → 1.5.5

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 (88) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +558 -0
  3. package/dist/builder/a11y.d.ts +16 -0
  4. package/dist/builder/api.d.ts +21 -0
  5. package/dist/builder/context.d.ts +36 -0
  6. package/dist/builder/core.d.ts +16 -0
  7. package/dist/builder/data.d.ts +69 -0
  8. package/dist/builder/dom.d.ts +15 -0
  9. package/dist/builder/index.d.ts +25 -0
  10. package/dist/builder/materialize.d.ts +165 -0
  11. package/dist/builder/pool.d.ts +10 -0
  12. package/dist/builder/range.d.ts +10 -0
  13. package/dist/builder/scroll.d.ts +24 -0
  14. package/dist/builder/types.d.ts +464 -0
  15. package/dist/builder/velocity.d.ts +23 -0
  16. package/dist/constants.d.ts +58 -0
  17. package/dist/events/emitter.d.ts +18 -0
  18. package/dist/events/index.d.ts +6 -0
  19. package/dist/features/async/feature.d.ts +72 -0
  20. package/dist/features/async/index.d.ts +9 -0
  21. package/dist/features/async/manager.d.ts +103 -0
  22. package/dist/features/async/placeholder.d.ts +54 -0
  23. package/dist/features/async/sparse.d.ts +91 -0
  24. package/dist/features/autosize/feature.d.ts +34 -0
  25. package/dist/features/autosize/index.d.ts +2 -0
  26. package/dist/features/grid/feature.d.ts +48 -0
  27. package/dist/features/grid/index.d.ts +9 -0
  28. package/dist/features/grid/layout.d.ts +29 -0
  29. package/dist/features/grid/renderer.d.ts +71 -0
  30. package/dist/features/grid/types.d.ts +71 -0
  31. package/dist/features/groups/feature.d.ts +74 -0
  32. package/dist/features/groups/index.d.ts +10 -0
  33. package/dist/features/groups/layout.d.ts +47 -0
  34. package/dist/features/groups/sticky.d.ts +21 -0
  35. package/dist/features/groups/types.d.ts +86 -0
  36. package/dist/features/masonry/feature.d.ts +45 -0
  37. package/dist/features/masonry/index.d.ts +9 -0
  38. package/dist/features/masonry/layout.d.ts +29 -0
  39. package/dist/features/masonry/renderer.d.ts +55 -0
  40. package/dist/features/masonry/types.d.ts +68 -0
  41. package/dist/features/page/feature.d.ts +53 -0
  42. package/dist/features/page/index.d.ts +8 -0
  43. package/dist/features/scale/feature.d.ts +42 -0
  44. package/dist/features/scale/index.d.ts +10 -0
  45. package/dist/features/scrollbar/controller.d.ts +121 -0
  46. package/dist/features/scrollbar/feature.d.ts +60 -0
  47. package/dist/features/scrollbar/index.d.ts +8 -0
  48. package/dist/features/scrollbar/scrollbar.d.ts +73 -0
  49. package/dist/features/selection/feature.d.ts +75 -0
  50. package/dist/features/selection/index.d.ts +7 -0
  51. package/dist/features/selection/state.d.ts +115 -0
  52. package/dist/features/snapshots/feature.d.ts +79 -0
  53. package/dist/features/snapshots/index.d.ts +9 -0
  54. package/dist/features/table/feature.d.ts +67 -0
  55. package/dist/features/table/header.d.ts +49 -0
  56. package/dist/features/table/index.d.ts +10 -0
  57. package/dist/features/table/layout.d.ts +26 -0
  58. package/dist/features/table/renderer.d.ts +72 -0
  59. package/dist/features/table/types.d.ts +239 -0
  60. package/dist/index.d.ts +28 -0
  61. package/dist/index.js +1 -0
  62. package/dist/internals.d.ts +21 -0
  63. package/dist/internals.js +1 -0
  64. package/dist/rendering/index.d.ts +12 -0
  65. package/dist/rendering/measured.d.ts +52 -0
  66. package/dist/rendering/renderer.d.ts +111 -0
  67. package/dist/rendering/scale.d.ts +121 -0
  68. package/dist/rendering/scroll.d.ts +23 -0
  69. package/dist/rendering/sizes.d.ts +63 -0
  70. package/dist/rendering/sort.d.ts +33 -0
  71. package/dist/rendering/viewport.d.ts +139 -0
  72. package/dist/size.json +1 -0
  73. package/dist/types.d.ts +487 -0
  74. package/dist/utils/padding.d.ts +38 -0
  75. package/dist/utils/stats.d.ts +49 -0
  76. package/dist/vlist-extras.css +1 -0
  77. package/dist/vlist-grid.css +1 -0
  78. package/dist/vlist-masonry.css +1 -0
  79. package/dist/vlist-table.css +1 -0
  80. package/dist/vlist.css +1 -0
  81. package/package.json +66 -14
  82. package/README.MD +0 -80
  83. package/index.d.ts +0 -3
  84. package/index.js +0 -196
  85. package/virtual-scroll.component.d.ts +0 -34
  86. package/vlist.d.ts +0 -4
  87. package/vlist.metadata.json +0 -1
  88. package/vlist.umd.js +0 -197
@@ -0,0 +1,49 @@
1
+ export interface StatsConfig {
2
+ /** Returns the current scroll position (scrollTop or scrollLeft) */
3
+ getScrollPosition: () => number;
4
+ /** Returns the total number of items */
5
+ getTotal: () => number;
6
+ /** Returns the item size along the scroll axis (height for vertical, width for horizontal) */
7
+ getItemSize: () => number;
8
+ /** Returns the viewport size in px (clientHeight for vertical, clientWidth for horizontal) */
9
+ getContainerSize: () => number;
10
+ /** Returns the column count for grid/masonry layouts (defaults to 1) */
11
+ getColumns?: () => number;
12
+ }
13
+ export interface StatsState {
14
+ /** Progress through the list as 0–100 */
15
+ progress: number;
16
+ /** Current instantaneous velocity in px/ms */
17
+ velocity: number;
18
+ /** Running average velocity in px/ms (filtered samples only) */
19
+ velocityAvg: number;
20
+ /** Number of items visible up to the current scroll position */
21
+ itemCount: number;
22
+ /** Total number of items */
23
+ total: number;
24
+ }
25
+ export interface Stats {
26
+ /** Return the current computed state. Pure read — no side effects. */
27
+ getState: () => StatsState;
28
+ /** Feed a velocity sample. Call from the `velocity:change` event. */
29
+ onVelocity: (velocity: number) => void;
30
+ }
31
+ /**
32
+ * Create a stats tracker.
33
+ *
34
+ * All inputs are provided via callbacks so the tracker always reflects
35
+ * the latest values without needing to be recreated when the list changes.
36
+ *
37
+ * ```ts
38
+ * const stats = createStats({
39
+ * getScrollPosition: () => list.getScrollPosition(),
40
+ * getTotal: () => items.length,
41
+ * getItemSize: () => ITEM_HEIGHT,
42
+ * getContainerSize: () => containerEl.clientHeight,
43
+ * })
44
+ *
45
+ * const { progress, itemCount, total } = stats.getState()
46
+ * ```
47
+ */
48
+ export declare function createStats(config: StatsConfig): Stats;
49
+ //# sourceMappingURL=stats.d.ts.map
@@ -0,0 +1 @@
1
+ .vlist--compact .vlist-item{padding:0.5rem 0.75rem}.vlist--comfortable .vlist-item{padding:1rem 1.25rem}.vlist--borderless{border:none;border-radius:0}.vlist--borderless .vlist-item{border-bottom:none}.vlist-loading{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;background-color:color-mix(in srgb,var(--vlist-bg) 80%,transparent);backdrop-filter:blur(4px);z-index:20}.vlist-loading-spinner{width:2rem;height:2rem;border:4px solid var(--vlist-border);border-top-color:var(--vlist-focus-ring);border-radius:50%;animation:vlist-spin 1s linear infinite}@keyframes vlist-spin{to{transform:rotate(360deg)}}.vlist-empty{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;color:var(--vlist-text-muted);padding:2rem;text-align:center}.vlist-empty-icon{width:3rem;height:3rem;margin-bottom:1rem;opacity:0.5}.vlist-empty-text{font-size:1.125rem;font-weight:500}.vlist-empty-subtext{font-size:0.875rem;margin-top:0.25rem;opacity:0.75}@keyframes vlist-item-enter{from{opacity:0;transform:translateY(-8px)}to{opacity:1;transform:translateY(0)}}.vlist-item--enter{animation:vlist-item-enter 0.2s ease-out}
@@ -0,0 +1 @@
1
+ .vlist--grid .vlist-items{contain:layout style}.vlist-grid-item{position:absolute;top:0;left:0;display:flex;align-items:center;justify-content:center;padding:var(--vlist-item-padding-y) var(--vlist-item-padding-x);background-color:var(--vlist-bg);cursor:default;user-select:none;transition:background-color var(--vlist-transition-duration) var(--vlist-transition-timing);contain:content;box-sizing:border-box;overflow:hidden}.vlist--grid .vlist-item{right:auto;border-bottom:none}.vlist--scrolling .vlist-grid-item{transition:none}.vlist--selectable .vlist-grid-item{cursor:pointer}.vlist--selectable .vlist-grid-item:hover{background-color:var(--vlist-bg-hover)}.vlist-grid-item.vlist-item--odd{background:var(--vlist-bg-striped)}.vlist-grid-item.vlist-item--selected{background-color:var(--vlist-bg-selected)}.vlist-grid-item.vlist-item--odd.vlist-item--selected{background:var(--vlist-bg-selected)}.vlist--selectable .vlist-grid-item.vlist-item--selected:hover{background-color:var(--vlist-bg-selected-hover)}.vlist--selectable .vlist-grid-item.vlist-item--odd.vlist-item--selected:hover{background:var(--vlist-bg-selected-hover)}.vlist-grid-item.vlist-item--focused{outline:2px solid var(--vlist-focus-ring,#3b82f6);outline-offset:-2px;z-index:1}
@@ -0,0 +1 @@
1
+ .vlist--masonry .vlist-items{contain:layout style}.vlist-masonry-item{position:absolute;top:0;left:0;display:flex;align-items:center;justify-content:center;padding:var(--vlist-item-padding-y) var(--vlist-item-padding-x);background-color:var(--vlist-bg);cursor:default;user-select:none;transition:background-color var(--vlist-transition-duration) var(--vlist-transition-timing);contain:content;box-sizing:border-box;overflow:hidden}.vlist--masonry .vlist-item{right:auto;border-bottom:none}.vlist--scrolling .vlist-masonry-item{transition:none}.vlist--selectable .vlist-masonry-item{cursor:pointer}.vlist--selectable .vlist-masonry-item:hover{background-color:var(--vlist-bg-hover)}.vlist-masonry-item.vlist-item--odd{background:var(--vlist-bg-striped)}.vlist-masonry-item.vlist-item--selected{background-color:var(--vlist-bg-selected)}.vlist-masonry-item.vlist-item--odd.vlist-item--selected{background:var(--vlist-bg-selected)}.vlist--selectable .vlist-masonry-item.vlist-item--selected:hover{background-color:var(--vlist-bg-selected-hover)}.vlist--selectable .vlist-masonry-item.vlist-item--odd.vlist-item--selected:hover{background:var(--vlist-bg-selected-hover)}.vlist-masonry-item.vlist-item--focused{outline:2px solid var(--vlist-focus-ring,#3b82f6);outline-offset:-2px;z-index:1}
@@ -0,0 +1 @@
1
+ .vlist--table{overflow:hidden;min-height:inherit}.vlist--table .vlist-viewport{overflow:auto}.vlist--table .vlist-items{contain:layout style}.vlist-table-header{position:absolute;top:0;left:0;right:0;z-index:5;overflow:hidden;display:flex;align-items:stretch;box-sizing:border-box;will-change:scroll-position;contain:layout style;background-color:var(--vlist-bg,#ffffff);border-bottom:1px solid var(--vlist-border,#e5e7eb);font-weight:600;font-size:0.8125rem;letter-spacing:0.01em;color:var(--vlist-text-muted,#6b7280)}.vlist-table-header-scroll{position:relative;display:flex;align-items:stretch;height:100%;min-width:100%;flex-shrink:0}.vlist-table-header-cell{position:relative;display:flex;align-items:center;height:100%;box-sizing:border-box;flex-shrink:0;user-select:none;padding-left:var(--vlist-item-padding-x,0.75rem);padding-right:var(--vlist-item-padding-x,0.75rem);border-right:1px solid transparent;transition:background-color 0.15s ease}.vlist-table-header-cell:hover{background-color:var(--vlist-bg-hover,rgba(0,0,0,0.04))}.vlist-table-header-cell--sortable{cursor:pointer}.vlist-table-header-cell--sortable:active{background-color:var(--vlist-bg-selected,rgba(59,130,246,0.12))}.vlist-table-header-cell--center{justify-content:center}.vlist-table-header-cell--right{justify-content:flex-end}.vlist-table-header-content{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;pointer-events:none}.vlist-table-header-sort{margin-left:4px;flex-shrink:0;opacity:0;font-size:0.7em;transition:opacity 0.15s ease;pointer-events:none;color:var(--vlist-text-muted,#6b7280)}.vlist-table-header-resize{position:absolute;top:0;right:-3px;bottom:0;width:5px;cursor:col-resize;z-index:2;touch-action:none;opacity:0;transition:opacity 0.15s ease}.vlist-table-header-resize::after{content:"";position:absolute;top:0;bottom:0;left:50%;width:1px;transform:translateX(-50%);background-color:var(--vlist-border,#e5e7eb);transition:background-color 0.15s ease}.vlist-table-header-cell:hover .vlist-table-header-resize{opacity:1}.vlist-table-header-resize:hover::after{background-color:var(--vlist-focus-ring,#3b82f6)}.vlist-table-header-resize--active{opacity:1}.vlist-table-header-resize--active::after{background-color:var(--vlist-border-selected,#3b82f6)}.vlist--col-resizing,.vlist--col-resizing *{cursor:col-resize !important;user-select:none !important}.vlist-table-row{position:absolute;top:0;left:0;display:flex;box-sizing:border-box;contain:content;border-bottom:none;background-color:var(--vlist-bg,#ffffff);cursor:default;user-select:none;transition:background-color var(--vlist-transition-duration,150ms) var(--vlist-transition-timing,ease-in-out);will-change:transform}.vlist--scrolling .vlist-table-row{transition:none}.vlist-table-row.vlist-item--odd{background:var( --vlist-bg-striped,var(--vlist-bg-hover,rgba(0,0,0,0.02)) )}.vlist--selectable .vlist-table-row{cursor:pointer}.vlist--selectable .vlist-table-row:hover{background-color:var(--vlist-bg-hover,rgba(0,0,0,0.04))}.vlist-table-row.vlist-item--selected{background-color:var(--vlist-bg-selected,rgba(59,130,246,0.12))}.vlist-table-row.vlist-item--odd.vlist-item--selected{background:var(--vlist-bg-selected,rgba(59,130,246,0.12))}.vlist--selectable .vlist-table-row.vlist-item--selected:hover{background-color:var(--vlist-bg-selected-hover,rgba(59,130,246,0.18))}.vlist--selectable .vlist-table-row.vlist-item--odd.vlist-item--selected:hover{background:var(--vlist-bg-selected-hover,rgba(59,130,246,0.18))}.vlist-table-row.vlist-item--focused{outline:2px solid var(--vlist-focus-ring,#3b82f6);outline-offset:-2px;z-index:1}.vlist-table-cell{position:absolute;top:0;bottom:0;display:flex;align-items:center;box-sizing:border-box;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;padding-left:var(--vlist-item-padding-x,0.75rem);padding-right:var(--vlist-item-padding-x,0.75rem);font-size:0.875rem;color:var(--vlist-text,#111827)}.vlist-table-cell--center{text-align:center;justify-content:center}.vlist-table-cell--right{text-align:right;justify-content:flex-end}.vlist--table-row-borders .vlist-table-row{border-bottom:1px solid var(--vlist-border,#e5e7eb)}.vlist--table-col-borders .vlist-table-cell{border-right:1px solid var(--vlist-border,#e5e7eb)}.vlist--table-col-borders .vlist-table-header-cell{border-right-color:var(--vlist-border,#e5e7eb)}.vlist-table-group-header{display:flex;align-items:center;background-color:var(--vlist-bg,#ffffff);cursor:default;user-select:none;pointer-events:none}.vlist-table-group-header-content{flex:1;min-width:0;padding-left:var(--vlist-item-padding-x,0.75rem);padding-right:var(--vlist-item-padding-x,0.75rem)}.vlist--table-row-borders .vlist-table-group-header{border-bottom:none;border-top:1px solid var(--vlist-border,#e5e7eb)}.vlist--table.vlist--grouped .vlist-sticky-header{z-index:4}[data-theme-mode="dark"] .vlist-table-header,.dark .vlist-table-header{background-color:var(--vlist-bg,#111827);color:var(--vlist-text-muted,#9ca3af);border-bottom-color:var(--vlist-border,#374151)}[data-theme-mode="dark"] .vlist-table-header-cell:hover,.dark .vlist-table-header-cell:hover{background-color:var(--vlist-bg-hover,rgba(255,255,255,0.06))}[data-theme-mode="dark"] .vlist-table-header-resize::after,.dark .vlist-table-header-resize::after{background-color:var(--vlist-border,#374151)}[data-theme-mode="dark"] .vlist-table-header-resize:hover::after,.dark .vlist-table-header-resize:hover::after{background-color:var(--vlist-focus-ring,#3b82f6)}[data-theme-mode="dark"] .vlist-table-group-header,.dark .vlist-table-group-header{background-color:var(--vlist-bg,#111827)}@media (prefers-color-scheme:dark){:root:not([data-theme-mode="light"]):not([data-theme-mode="dark"]) .vlist-table-header{background-color:var(--vlist-bg,#111827);color:var(--vlist-text-muted,#9ca3af);border-bottom-color:var(--vlist-border,#374151)}:root:not([data-theme-mode="light"]):not([data-theme-mode="dark"]) .vlist-table-header-cell:hover{background-color:var(--vlist-bg-hover,rgba(255,255,255,0.06))}:root:not([data-theme-mode="light"]):not([data-theme-mode="dark"]) .vlist-table-header-resize::after{background-color:var(--vlist-border,#374151)}:root:not([data-theme-mode="light"]):not([data-theme-mode="dark"]) .vlist-table-header-resize:hover::after{background-color:var(--vlist-focus-ring,#3b82f6)}:root:not([data-theme-mode="light"]):not([data-theme-mode="dark"]) .vlist-table-group-header{background-color:var(--vlist-bg,#111827)}}.vlist-table-row.vlist-item--placeholder .vlist-table-cell{color:transparent}.vlist-table-row.vlist-item--placeholder .vlist-table-cell>*{color:transparent;background-color:var(--vlist-border,#e5e7eb);border-radius:4px;animation:vlist-placeholder-pulse 2s ease-in-out infinite;line-height:1;min-width:1em}.vlist-table-row.vlist-item--placeholder .vlist-table-cell>*>*{visibility:hidden}.vlist-table-row.vlist-item--placeholder .vlist-table-cell>*[style]{background:var(--vlist-border,#e5e7eb) !important;color:transparent !important}[data-theme-mode="dark"] .vlist--table-row-borders .vlist-table-group-header,.dark .vlist--table-row-borders .vlist-table-group-header{border-top-color:var(--vlist-border,#374151)}@media (prefers-color-scheme:dark){:root:not([data-theme-mode="light"]):not([data-theme-mode="dark"]) .vlist--table-row-borders .vlist-table-group-header{border-top-color:var(--vlist-border,#374151)}}
package/dist/vlist.css ADDED
@@ -0,0 +1 @@
1
+ @keyframes vlist-fade-in{from{opacity:0.6}to{opacity:1}}@keyframes vlist-placeholder-pulse{0%,100%{opacity:0.6}50%{opacity:0.4}}:root{--vlist-scrollbar-width:8px;--vlist-scrollbar-track-bg:transparent;--vlist-scrollbar-custom-thumb-radius:4px;--vlist-item-padding-x:1rem;--vlist-item-padding-y:0.75rem;--vlist-border-radius:0.5rem;--vlist-transition-duration:150ms;--vlist-transition-timing:ease-in-out;--vlist-bg:#ffffff;--vlist-bg-hover:rgba(0,0,0,0.04);--vlist-bg-striped:rgba(0,0,0,0.02);--vlist-bg-selected:rgba(59,130,246,0.12);--vlist-bg-selected-hover:rgba(59,130,246,0.18);--vlist-border:#e5e7eb;--vlist-border-selected:#3b82f6;--vlist-text:#111827;--vlist-text-muted:#6b7280;--vlist-focus-ring:#3b82f6;--vlist-group-header-bg:#f3f4f6;--vlist-scrollbar-thumb:#d1d5db;--vlist-scrollbar-thumb-hover:#9ca3af;--vlist-scrollbar-custom-thumb-bg:rgba(0,0,0,0.3);--vlist-scrollbar-custom-thumb-hover-bg:rgba(0,0,0,0.5);--vlist-placeholder-bg:rgba(0,0,0,0.2)}[data-theme-mode="dark"]{--vlist-bg:#111827;--vlist-bg-hover:rgba(255,255,255,0.06);--vlist-bg-striped:rgba(255,255,255,0.02);--vlist-bg-selected:rgba(59,130,246,0.2);--vlist-bg-selected-hover:rgba(59,130,246,0.28);--vlist-border:#374151;--vlist-border-selected:#3b82f6;--vlist-text:#f9fafb;--vlist-text-muted:#9ca3af;--vlist-focus-ring:#3b82f6;--vlist-group-header-bg:#1e2433;--vlist-scrollbar-thumb:#4b5563;--vlist-scrollbar-thumb-hover:#6b7280;--vlist-scrollbar-custom-thumb-bg:rgba(255,255,255,0.3);--vlist-scrollbar-custom-thumb-hover-bg:rgba(255,255,255,0.5);--vlist-placeholder-bg:rgba(255,255,255,0.3)}@media (prefers-color-scheme:dark){:root:not([data-theme-mode="light"]):not([data-theme-mode="dark"]){--vlist-bg:#111827;--vlist-bg-hover:rgba(255,255,255,0.06);--vlist-bg-striped:rgba(255,255,255,0.02);--vlist-bg-selected:rgba(59,130,246,0.2);--vlist-bg-selected-hover:rgba(59,130,246,0.28);--vlist-border:#374151;--vlist-border-selected:#3b82f6;--vlist-text:#f9fafb;--vlist-text-muted:#9ca3af;--vlist-focus-ring:#3b82f6;--vlist-group-header-bg:#1e2433;--vlist-scrollbar-thumb:#4b5563;--vlist-scrollbar-thumb-hover:#6b7280;--vlist-scrollbar-custom-thumb-bg:rgba(255,255,255,0.3);--vlist-scrollbar-custom-thumb-hover-bg:rgba(255,255,255,0.5);--vlist-placeholder-bg:rgba(255,255,255,0.3)}}.dark{--vlist-bg:#111827;--vlist-bg-hover:rgba(255,255,255,0.06);--vlist-bg-striped:rgba(255,255,255,0.02);--vlist-bg-selected:rgba(59,130,246,0.2);--vlist-bg-selected-hover:rgba(59,130,246,0.28);--vlist-border:#374151;--vlist-border-selected:#3b82f6;--vlist-text:#f9fafb;--vlist-text-muted:#9ca3af;--vlist-focus-ring:#3b82f6;--vlist-group-header-bg:#1e2433;--vlist-scrollbar-thumb:#4b5563;--vlist-scrollbar-thumb-hover:#6b7280;--vlist-scrollbar-custom-thumb-bg:rgba(255,255,255,0.3);--vlist-scrollbar-custom-thumb-hover-bg:rgba(255,255,255,0.5);--vlist-placeholder-bg:rgba(255,255,255,0.3)}.vlist{position:relative;width:100%;height:100%;overflow:hidden;background-color:var(--vlist-bg);color:var(--vlist-text);color-scheme:light;border:1px solid var(--vlist-border);border-radius:var(--vlist-border-radius);outline:none}[data-theme-mode="dark"] .vlist,.dark .vlist{color-scheme:dark}@media (prefers-color-scheme:dark){:root:not([data-theme-mode="light"]) .vlist{color-scheme:dark}}.vlist:focus,.vlist:focus-visible{outline:none}.vlist-viewport{width:100%;height:100%;overflow:auto;scrollbar-width:thin;scrollbar-color:var(--vlist-scrollbar-thumb) transparent}.vlist-viewport::-webkit-scrollbar{width:6px;height:6px}.vlist-viewport::-webkit-scrollbar-track{background:transparent}.vlist-viewport::-webkit-scrollbar-thumb{background-color:var(--vlist-scrollbar-thumb);border-radius:3px}.vlist-viewport::-webkit-scrollbar-thumb:hover{background-color:var(--vlist-scrollbar-thumb-hover)}.vlist-content{position:relative;width:100%}.vlist-items{position:relative;width:100%;contain:layout style}.vlist-item{position:absolute;top:0;left:0;right:0;display:flex;align-items:center;background-color:var(--vlist-bg);cursor:default;user-select:none;opacity:1;transition:background-color var(--vlist-transition-duration) var(--vlist-transition-timing),opacity var(--vlist-transition-duration) var(--vlist-transition-timing);contain:content;box-sizing:border-box;will-change:transform}.vlist--scrolling .vlist-item{transition:none}.vlist--selectable .vlist-item{cursor:pointer}.vlist--selectable .vlist-item:hover{background-color:var(--vlist-bg-hover)}.vlist-item.vlist-item--odd{background:var(--vlist-bg-striped)}.vlist-item.vlist-item--selected{background-color:var(--vlist-bg-selected)}.vlist-item.vlist-item--odd.vlist-item--selected{background:var(--vlist-bg-selected)}.vlist-item.vlist-item--selected:hover{background-color:var(--vlist-bg-selected-hover)}.vlist-item.vlist-item--odd.vlist-item--selected:hover{background:var(--vlist-bg-selected-hover)}.vlist-item.vlist-item--focused{outline:2px solid var(--vlist-focus-ring,#3b82f6);outline-offset:-2px;z-index:1}.vlist-item--replaced{animation:vlist-fade-in 0.3s ease-out}.vlist-item--placeholder{opacity:0.6;animation:vlist-placeholder-pulse 2s ease-in-out infinite}.vlist-item.vlist-item--selected.vlist-item--focused{outline-color:var(--vlist-border-selected)}.vlist-scrollbar{position:absolute;top:0;right:0;width:var(--vlist-scrollbar-width);height:100%;background-color:var(--vlist-scrollbar-track-bg);opacity:0;transition:opacity 0.2s ease-out;z-index:10;pointer-events:none}.vlist-scrollbar-hover{position:absolute;top:0;right:0;height:100%;z-index:9;pointer-events:auto}.vlist-scrollbar-hover--horizontal{top:auto;right:auto;bottom:0;left:0;width:100%;height:auto}.vlist-scrollbar--visible{opacity:1;pointer-events:auto}.vlist-scrollbar-thumb{position:absolute;top:0;left:0;right:0;width:100%;background-color:var(--vlist-scrollbar-custom-thumb-bg);border-radius:var(--vlist-scrollbar-custom-thumb-radius);cursor:pointer;transition:background-color 0.15s ease-out}.vlist-scrollbar-thumb:hover{background-color:var(--vlist-scrollbar-custom-thumb-hover-bg)}.vlist-scrollbar--dragging{opacity:1;pointer-events:auto}.vlist-scrollbar--dragging .vlist-scrollbar-thumb{background-color:var(--vlist-scrollbar-custom-thumb-hover-bg)}.vlist--grouped .vlist-item[data-id^="__group_header_"]{cursor:default;background-color:var(--vlist-group-header-bg,#f3f4f6);border-bottom:1px solid var(--vlist-border);z-index:1;overflow:hidden}.vlist--grouped .vlist-item[data-id^="__group_header_"]:hover{background-color:var(--vlist-group-header-bg,#f3f4f6)}.vlist-sticky-header{left:0;right:0;background-color:var(--vlist-group-header-bg,#f3f4f6);border-bottom:1px solid var(--vlist-border)}.vlist--horizontal{overflow:hidden}.vlist--horizontal .vlist-viewport{overflow-x:auto;overflow-y:hidden}.vlist--horizontal .vlist-content{height:100%;width:auto}.vlist--horizontal .vlist-items{height:100%;width:auto}.vlist--horizontal .vlist-item{position:absolute;top:0;bottom:0;left:0;right:auto;display:flex;align-items:center;justify-content:center;border-bottom:none;border-right:1px solid var(--vlist-border)}.vlist-scrollbar--horizontal{top:auto;right:auto;bottom:0;left:0;width:100%;height:var(--vlist-scrollbar-width)}.vlist-scrollbar--horizontal .vlist-scrollbar-thumb{top:0;left:0;width:auto;height:100%}.vlist-viewport--custom-scrollbar{scrollbar-width:none;-ms-overflow-style:none}.vlist-viewport--custom-scrollbar::-webkit-scrollbar{display:none}.vlist-viewport--no-scrollbar{scrollbar-width:none;-ms-overflow-style:none}.vlist-viewport--no-scrollbar::-webkit-scrollbar{display:none}.vlist-viewport--gutter-stable{scrollbar-gutter:stable}
package/package.json CHANGED
@@ -1,26 +1,78 @@
1
1
  {
2
2
  "name": "vlist",
3
- "version": "0.1.3",
3
+ "version": "1.5.5",
4
+ "description": "Lightweight, high-performance virtual list with zero dependencies",
5
+ "author": {
6
+ "name": "Floor IO",
7
+ "url": "https://floor.io"
8
+ },
4
9
  "repository": {
5
10
  "type": "git",
6
- "url": "https://github.com/givve/angular-virtual-scroll.git"
7
- },
8
- "author": {
9
- "name": "Alexander Klaiber",
10
- "email": "aklaiber@givve.com"
11
+ "url": "git+https://github.com/floor/vlist.git"
11
12
  },
12
13
  "keywords": [
13
- "angular"
14
+ "virtual-list",
15
+ "virtual-scroll",
16
+ "virtualized-list",
17
+ "infinite-scroll",
18
+ "windowing",
19
+ "list-virtualization",
20
+ "dom-recycling",
21
+ "large-list",
22
+ "performance",
23
+ "typescript",
24
+ "zero-dependencies"
14
25
  ],
15
26
  "license": "MIT",
27
+ "type": "module",
28
+ "main": "./dist/index.js",
29
+ "module": "./dist/index.js",
30
+ "types": "./dist/index.d.ts",
31
+ "exports": {
32
+ ".": {
33
+ "types": "./dist/index.d.ts",
34
+ "import": "./dist/index.js",
35
+ "default": "./dist/index.js"
36
+ },
37
+ "./internals": {
38
+ "types": "./dist/internals.d.ts",
39
+ "import": "./dist/internals.js",
40
+ "default": "./dist/internals.js"
41
+ },
42
+ "./styles": "./dist/vlist.css",
43
+ "./styles/grid": "./dist/vlist-grid.css",
44
+ "./styles/masonry": "./dist/vlist-masonry.css",
45
+ "./styles/table": "./dist/vlist-table.css",
46
+ "./styles/extras": "./dist/vlist-extras.css",
47
+ "./package.json": "./package.json"
48
+ },
49
+ "files": [
50
+ "dist/index.js",
51
+ "dist/internals.js",
52
+ "dist/**/*.d.ts",
53
+ "dist/**/*.css",
54
+ "dist/size.json",
55
+ "!dist/**/*.d.ts.map"
56
+ ],
57
+ "sideEffects": [
58
+ "*.css"
59
+ ],
60
+ "scripts": {
61
+ "build": "bun run build.ts",
62
+ "dev": "bun run build.ts --watch",
63
+ "test": "bun test",
64
+ "typecheck": "tsc --noEmit && tsc --noEmit -p tsconfig.test.json",
65
+ "size": "bun run scripts/measure-size.ts",
66
+ "prepublishOnly": "bun run build --types"
67
+ },
16
68
  "bugs": {
17
- "url": "https://github.com/givve/angular-virtual-scroll.git/issues"
69
+ "url": "https://github.com/floor/vlist/issues"
18
70
  },
19
- "module": "vlist.js",
20
- "typings": "vlist.d.ts",
21
- "peerDependencies": {
22
- "@angular/core": "^4.0.0",
23
- "rxjs": "^5.1.0",
24
- "zone.js": "^0.8.4"
71
+ "homepage": "https://vlist.io",
72
+ "devDependencies": {
73
+ "@types/bun": "^1.0.0",
74
+ "@types/jsdom": "^27.0.0",
75
+ "jsdom": "^28.0.0",
76
+ "typescript": "^5.0.0"
25
77
  }
26
78
  }
package/README.MD DELETED
@@ -1,80 +0,0 @@
1
- # angular-virtual-scroll
2
-
3
- Easy to use virtual scroll list for angular. VirtualScroll separate large lists into smaller chunks for a fast rendering.
4
-
5
-
6
- [Demo](https://givve.github.io/angular-virtual-scroll/)
7
-
8
- ## Usage
9
-
10
- ```xml
11
- <virtual-scroll [items]="items" (update)="viewPortItems = $event">
12
- <div *ngFor="let item of viewPortItems" class="item">
13
- {{ item }}
14
- </div>
15
- </virtual-scroll>
16
- ```
17
-
18
- ## Get Started
19
-
20
- **Step 1:** Install `vlist`
21
-
22
- ```bash
23
- $ npm install vlist --save
24
- ```
25
-
26
- **Step2:** Import `VListModule`
27
-
28
- ```typescript
29
- ....
30
- import { VListModule } from 'vlist';
31
-
32
- @NgModule({
33
- ....
34
- imports: [
35
- ....
36
- VListModule
37
- ],
38
- ....
39
- })
40
- export class AppModule { }
41
- ```
42
-
43
- **Step 3:** Wrap `<virtual-scroll>...</virtual-scroll>` around the list items
44
-
45
- ```xml
46
- <virtual-scroll [items]="items" (update)="viewPortItems = $event">
47
- <div *ngFor="let item of viewPortItems" class="item">
48
- {{ item }}
49
- </div>
50
- </virtual-scroll>
51
- ```
52
-
53
- ## API
54
-
55
- | Attribute | Type | Description
56
- |----------------|--------|------------
57
- | items | any[] |
58
-
59
-
60
- ## Contributing
61
-
62
- Pull requests are welcome!
63
-
64
- ## Development
65
-
66
- To generate all `*.js`, `*.d.ts` and `*.metadata.json` files:
67
-
68
- ```bash
69
- $ npm run build
70
- ```
71
-
72
- To lint all `*.ts` files:
73
-
74
- ```bash
75
- $ npm run lint
76
- ```
77
-
78
- ## License
79
-
80
- MIT © [Alexander Klaiber](mailto:dev@givve.com)
package/index.d.ts DELETED
@@ -1,3 +0,0 @@
1
- export * from './virtual-scroll.component';
2
- export declare class VListModule {
3
- }
package/index.js DELETED
@@ -1,196 +0,0 @@
1
- import { Component, ElementRef, EventEmitter, HostListener, Input, NgModule, Output, ViewChild } from '@angular/core';
2
- import { CommonModule } from '@angular/common';
3
- import { Observable } from 'rxjs/Observable';
4
- import 'rxjs/add/observable/of';
5
- import 'rxjs/add/observable/fromEvent';
6
- import 'rxjs/add/operator/debounceTime';
7
- import 'rxjs/add/operator/map';
8
- import 'rxjs/add/operator/retryWhen';
9
- import 'rxjs/add/operator/delay';
10
-
11
- var VirtualScrollComponent = (function () {
12
- /**
13
- * @param {?} element
14
- */
15
- function VirtualScrollComponent(element) {
16
- this.element = element;
17
- this.items = [];
18
- this.update = new EventEmitter();
19
- this.itemHeight = 0;
20
- this.viewportPosition = 0;
21
- this.latestStartChunk = 0;
22
- this.latestEndChunk = 0;
23
- this.latestScrollTop = 0;
24
- this.ticking = false;
25
- }
26
- /**
27
- * @return {?}
28
- */
29
- VirtualScrollComponent.prototype.ngOnInit = function () {
30
- var _this = this;
31
- Observable.fromEvent(window, 'resize').debounceTime(50).subscribe(function () { return _this.updateChunk(); });
32
- Observable.of(this.viewportElementRef.nativeElement.getElementsByClassName('item')).map(function (items) {
33
- if (items.length == 0) {
34
- throw 'ex';
35
- }
36
- return items[0];
37
- }).retryWhen(function (errors) { return errors.delay(100); }).subscribe(function (item) {
38
- _this.itemHeight = item.getBoundingClientRect().height;
39
- _this.updateChunk();
40
- });
41
- };
42
- /**
43
- * @param {?} changes
44
- * @return {?}
45
- */
46
- VirtualScrollComponent.prototype.ngOnChanges = function (changes) {
47
- if (changes.items.currentValue.length > 0) {
48
- if (this.itemHeight == 0) {
49
- /** Render one item to get the item height. **/
50
- this.update.emit(this.items.slice(0, 1));
51
- }
52
- }
53
- /** Clear and update chunk. **/
54
- if (this.itemHeight > 0) {
55
- this.latestStartChunk = 0;
56
- this.latestEndChunk = 0;
57
- this.updateChunk();
58
- }
59
- };
60
- /**
61
- * @param {?} e
62
- * @return {?}
63
- */
64
- VirtualScrollComponent.prototype.onScroll = function (e) {
65
- var _this = this;
66
- this.latestScrollTop = this.getCurrentScrollTop();
67
- if (!this.ticking) {
68
- requestAnimationFrame(function () {
69
- _this.ticking = false;
70
- _this.updateChunk();
71
- _this.updateViewPort();
72
- });
73
- }
74
- this.ticking = true;
75
- };
76
- /**
77
- * @return {?}
78
- */
79
- VirtualScrollComponent.prototype.updateChunk = function () {
80
- if (this.latestStartChunk != this.startChunk() || this.latestEndChunk != this.endChunk()) {
81
- this.latestStartChunk = this.startChunk();
82
- this.latestEndChunk = this.endChunk();
83
- this.update.emit(this.items.slice(this.latestStartChunk, this.latestEndChunk));
84
- }
85
- };
86
- /**
87
- * @return {?}
88
- */
89
- VirtualScrollComponent.prototype.updateViewPort = function () {
90
- if (this.isBottom()) {
91
- this.viewportPosition = this.latestScrollTop - this.itemHeight;
92
- }
93
- else {
94
- this.viewportPosition = this.latestScrollTop;
95
- }
96
- };
97
- /**
98
- * @return {?}
99
- */
100
- VirtualScrollComponent.prototype.isBottom = function () {
101
- return this.getCurrentScrollHeight() - this.getCurrentScrollTop() === this.getCurrentHeight();
102
- };
103
- /**
104
- * @return {?}
105
- */
106
- VirtualScrollComponent.prototype.startChunk = function () {
107
- return Math.floor(this.getCurrentScrollTop() / this.itemHeight);
108
- };
109
- /**
110
- * @return {?}
111
- */
112
- VirtualScrollComponent.prototype.endChunk = function () {
113
- return this.startChunk() + this.totalPossibleItems();
114
- };
115
- /**
116
- * @return {?}
117
- */
118
- VirtualScrollComponent.prototype.getHeight = function () {
119
- return this.items.length * this.itemHeight;
120
- };
121
- /**
122
- * @return {?}
123
- */
124
- VirtualScrollComponent.prototype.getCurrentHeight = function () {
125
- return this.element.nativeElement.clientHeight;
126
- };
127
- /**
128
- * @return {?}
129
- */
130
- VirtualScrollComponent.prototype.getCurrentWidth = function () {
131
- return this.element.nativeElement.clientWidth;
132
- };
133
- /**
134
- * @return {?}
135
- */
136
- VirtualScrollComponent.prototype.getCurrentScrollHeight = function () {
137
- return this.element.nativeElement.scrollHeight;
138
- };
139
- /**
140
- * @return {?}
141
- */
142
- VirtualScrollComponent.prototype.getCurrentScrollTop = function () {
143
- return this.element.nativeElement.scrollTop;
144
- };
145
- /**
146
- * @return {?}
147
- */
148
- VirtualScrollComponent.prototype.totalPossibleItems = function () {
149
- return Math.round(this.getCurrentHeight() / this.itemHeight) + 1;
150
- };
151
- return VirtualScrollComponent;
152
- }());
153
- VirtualScrollComponent.decorators = [
154
- { type: Component, args: [{
155
- selector: 'virtual-scroll',
156
- template: "<div id=\"scrollport\" [style.height.px]=\"getHeight()\"></div> <div id=\"viewport\" #viewport [style.margin-top.px]=\"-getHeight()\" [style.transform]=\"'translateY(' + viewportPosition + 'px)'\"> <ng-content></ng-content> </div> ",
157
- styles: [":host { overflow: hidden; overflow-y: auto; -webkit-overflow-scrolling: touch; height: 100%; display: block; position: relative; } #scrollport { width: 1px; opacity: 0; } #viewport { position: absolute; width: 100%; } "]
158
- },] },
159
- ];
160
- /**
161
- * @nocollapse
162
- */
163
- VirtualScrollComponent.ctorParameters = function () { return [
164
- { type: ElementRef, },
165
- ]; };
166
- VirtualScrollComponent.propDecorators = {
167
- 'items': [{ type: Input },],
168
- 'update': [{ type: Output },],
169
- 'viewportElementRef': [{ type: ViewChild, args: ['viewport', { read: ElementRef },] },],
170
- 'onScroll': [{ type: HostListener, args: ['scroll',] },],
171
- };
172
-
173
- var VListModule = (function () {
174
- function VListModule() {
175
- }
176
- return VListModule;
177
- }());
178
- VListModule.decorators = [
179
- { type: NgModule, args: [{
180
- imports: [
181
- CommonModule
182
- ],
183
- declarations: [
184
- VirtualScrollComponent
185
- ],
186
- exports: [
187
- VirtualScrollComponent
188
- ]
189
- },] },
190
- ];
191
- /**
192
- * @nocollapse
193
- */
194
- VListModule.ctorParameters = function () { return []; };
195
-
196
- export { VListModule, VirtualScrollComponent };
@@ -1,34 +0,0 @@
1
- import { ElementRef, EventEmitter, OnChanges, OnInit, SimpleChanges } from '@angular/core';
2
- import 'rxjs/add/observable/of';
3
- import 'rxjs/add/observable/fromEvent';
4
- import 'rxjs/add/operator/debounceTime';
5
- import 'rxjs/add/operator/map';
6
- import 'rxjs/add/operator/retryWhen';
7
- import 'rxjs/add/operator/delay';
8
- export declare class VirtualScrollComponent implements OnInit, OnChanges {
9
- private element;
10
- items: any[];
11
- update: EventEmitter<any[]>;
12
- viewportElementRef: ElementRef;
13
- itemHeight: number;
14
- viewportPosition: number;
15
- latestStartChunk: number;
16
- latestEndChunk: number;
17
- latestScrollTop: number;
18
- ticking: boolean;
19
- constructor(element: ElementRef);
20
- ngOnInit(): void;
21
- ngOnChanges(changes: SimpleChanges): void;
22
- onScroll(e: Event): void;
23
- private updateChunk();
24
- private updateViewPort();
25
- private isBottom();
26
- private startChunk();
27
- private endChunk();
28
- getHeight(): number;
29
- private getCurrentHeight();
30
- private getCurrentWidth();
31
- private getCurrentScrollHeight();
32
- private getCurrentScrollTop();
33
- private totalPossibleItems();
34
- }
package/vlist.d.ts DELETED
@@ -1,4 +0,0 @@
1
- /**
2
- * Generated bundle index. Do not edit.
3
- */
4
- export * from './index';
@@ -1 +0,0 @@
1
- {"__symbolic":"module","version":3,"metadata":{"VListModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule"},"arguments":[{"imports":[{"__symbolic":"reference","module":"@angular/common","name":"CommonModule"}],"declarations":[{"__symbolic":"reference","name":"VirtualScrollComponent"}],"exports":[{"__symbolic":"reference","name":"VirtualScrollComponent"}]}]}],"members":{}},"VirtualScrollComponent":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component"},"arguments":[{"selector":"virtual-scroll","template":"<div id=\"scrollport\" [style.height.px]=\"getHeight()\"></div> <div id=\"viewport\" #viewport [style.margin-top.px]=\"-getHeight()\" [style.transform]=\"'translateY(' + viewportPosition + 'px)'\"> <ng-content></ng-content> </div> ","styles":[":host { overflow: hidden; overflow-y: auto; -webkit-overflow-scrolling: touch; height: 100%; display: block; position: relative; } #scrollport { width: 1px; opacity: 0; } #viewport { position: absolute; width: 100%; } "]}]}],"members":{"items":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"update":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output"}}]}],"viewportElementRef":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"ViewChild"},"arguments":["viewport",{"read":{"__symbolic":"reference","module":"@angular/core","name":"ElementRef"}}]}]}],"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ElementRef"}]}],"ngOnInit":[{"__symbolic":"method"}],"ngOnChanges":[{"__symbolic":"method"}],"onScroll":[{"__symbolic":"method","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"HostListener"},"arguments":["scroll"]}]}],"updateChunk":[{"__symbolic":"method"}],"updateViewPort":[{"__symbolic":"method"}],"isBottom":[{"__symbolic":"method"}],"startChunk":[{"__symbolic":"method"}],"endChunk":[{"__symbolic":"method"}],"getHeight":[{"__symbolic":"method"}],"getCurrentHeight":[{"__symbolic":"method"}],"getCurrentWidth":[{"__symbolic":"method"}],"getCurrentScrollHeight":[{"__symbolic":"method"}],"getCurrentScrollTop":[{"__symbolic":"method"}],"totalPossibleItems":[{"__symbolic":"method"}]}}},"origins":{"VListModule":"./index","VirtualScrollComponent":"./virtual-scroll.component"},"importAs":"vlist"}