react-virtuoso 2.2.4 → 2.2.6-beta.2

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 (106) hide show
  1. package/dist/__examples.cc6a8f9f.js +162195 -0
  2. package/dist/__examples.cc6a8f9f.js.map +1 -0
  3. package/dist/__examples.html +27 -0
  4. package/dist/__examples.js +392 -0
  5. package/dist/__examples.js.map +1 -0
  6. package/dist/align-to-bottom.7fcd2087.js +196 -0
  7. package/dist/align-to-bottom.7fcd2087.js.map +1 -0
  8. package/dist/auto-prepend-items.bd7e9b90.js +263 -0
  9. package/dist/auto-prepend-items.bd7e9b90.js.map +1 -0
  10. package/dist/benchmark.66d31485.js +161 -0
  11. package/dist/benchmark.66d31485.js.map +1 -0
  12. package/dist/chat.d4f93b8b.js +365 -0
  13. package/dist/chat.d4f93b8b.js.map +1 -0
  14. package/dist/custom-components.5aeaa7ef.js +202 -0
  15. package/dist/custom-components.5aeaa7ef.js.map +1 -0
  16. package/dist/custom-scroller.b0240d14.js +180 -0
  17. package/dist/custom-scroller.b0240d14.js.map +1 -0
  18. package/dist/data.26707046.js +186 -0
  19. package/dist/data.26707046.js.map +1 -0
  20. package/dist/decrease-items.e2211e50.js +180 -0
  21. package/dist/decrease-items.e2211e50.js.map +1 -0
  22. package/dist/default-item-height.b77ada36.js +155 -0
  23. package/dist/default-item-height.b77ada36.js.map +1 -0
  24. package/dist/empty-placeholder.00607a6e.js +185 -0
  25. package/dist/empty-placeholder.00607a6e.js.map +1 -0
  26. package/dist/end-reached.8531e5b1.js +199 -0
  27. package/dist/end-reached.8531e5b1.js.map +1 -0
  28. package/dist/endless-scrolling.bc4101f0.js +205 -0
  29. package/dist/endless-scrolling.bc4101f0.js.map +1 -0
  30. package/dist/expandable-cards.5439f51b.js +222 -0
  31. package/dist/expandable-cards.5439f51b.js.map +1 -0
  32. package/dist/follow-output.4e36fca8.js +225 -0
  33. package/dist/follow-output.4e36fca8.js.map +1 -0
  34. package/dist/grid-optimize-rendering.b49e36f5.js +247 -0
  35. package/dist/grid-optimize-rendering.b49e36f5.js.map +1 -0
  36. package/dist/grid.d5d77b6a.js +244 -0
  37. package/dist/grid.d5d77b6a.js.map +1 -0
  38. package/dist/grouped-endless-scrolling.24985a0f.js +301 -0
  39. package/dist/grouped-endless-scrolling.24985a0f.js.map +1 -0
  40. package/dist/grouped-load-more.bce8f6e4.js +300 -0
  41. package/dist/grouped-load-more.bce8f6e4.js.map +1 -0
  42. package/dist/grouped-topmost-item.34960f5e.js +161 -0
  43. package/dist/grouped-topmost-item.34960f5e.js.map +1 -0
  44. package/dist/grouped.a2908632.js +160 -0
  45. package/dist/grouped.a2908632.js.map +1 -0
  46. package/dist/header-footer.49733d45.js +171 -0
  47. package/dist/header-footer.49733d45.js.map +1 -0
  48. package/dist/hello.54765c26.js +155 -0
  49. package/dist/hello.54765c26.js.map +1 -0
  50. package/dist/index.js +1 -1
  51. package/dist/index.js.map +1 -1
  52. package/dist/index.m.js +1 -1
  53. package/dist/index.m.js.map +1 -1
  54. package/dist/initial-from-zero.22ad1626.js +195 -0
  55. package/dist/initial-from-zero.22ad1626.js.map +1 -0
  56. package/dist/initial-scroll-top.90db1920.js +156 -0
  57. package/dist/initial-scroll-top.90db1920.js.map +1 -0
  58. package/dist/initial-topmost-item-default-height.43a95247.js +157 -0
  59. package/dist/initial-topmost-item-default-height.43a95247.js.map +1 -0
  60. package/dist/initial-topmost-item.61c0e169.js +158 -0
  61. package/dist/initial-topmost-item.61c0e169.js.map +1 -0
  62. package/dist/long-last-item.b56ff89c.js +157 -0
  63. package/dist/long-last-item.b56ff89c.js.map +1 -0
  64. package/dist/prepend-items.f2bda34b.js +188 -0
  65. package/dist/prepend-items.f2bda34b.js.map +1 -0
  66. package/dist/prepend-last-tall-item.168a9e65.js +175 -0
  67. package/dist/prepend-last-tall-item.168a9e65.js.map +1 -0
  68. package/dist/react-beautiful-dnd-window-scroller.0a227511.js +280 -0
  69. package/dist/react-beautiful-dnd-window-scroller.0a227511.js.map +1 -0
  70. package/dist/react-beautiful-dnd.817e9251.js +277 -0
  71. package/dist/react-beautiful-dnd.817e9251.js.map +1 -0
  72. package/dist/rerender.ddd61b7c.js +195 -0
  73. package/dist/rerender.ddd61b7c.js.map +1 -0
  74. package/dist/resize-loop.309b1dac.js +183 -0
  75. package/dist/resize-loop.309b1dac.js.map +1 -0
  76. package/dist/resizing-items.c09b5e1b.js +189 -0
  77. package/dist/resizing-items.c09b5e1b.js.map +1 -0
  78. package/dist/scroll-into-view.39b77fe9.js +203 -0
  79. package/dist/scroll-into-view.39b77fe9.js.map +1 -0
  80. package/dist/scroll-seek-placeholder.69fb85c6.js +179 -0
  81. package/dist/scroll-seek-placeholder.69fb85c6.js.map +1 -0
  82. package/dist/scroll-to-index.e72249cf.js +212 -0
  83. package/dist/scroll-to-index.e72249cf.js.map +1 -0
  84. package/dist/ssr.8f31b042.js +154 -0
  85. package/dist/ssr.8f31b042.js.map +1 -0
  86. package/dist/start-reached.2990ece7.js +219 -0
  87. package/dist/start-reached.2990ece7.js.map +1 -0
  88. package/dist/tall-item-reverse-scrolling.58bcd140.js +158 -0
  89. package/dist/tall-item-reverse-scrolling.58bcd140.js.map +1 -0
  90. package/dist/test-case-446.dce9595c.js +223 -0
  91. package/dist/test-case-446.dce9595c.js.map +1 -0
  92. package/dist/test-case-460.6d75ad1f.js +246 -0
  93. package/dist/test-case-460.6d75ad1f.js.map +1 -0
  94. package/dist/test-case-463.525f34ba.js +170 -0
  95. package/dist/test-case-463.525f34ba.js.map +1 -0
  96. package/dist/toggle-display-grouped.4f4ae058.js +184 -0
  97. package/dist/toggle-display-grouped.4f4ae058.js.map +1 -0
  98. package/dist/top-items.f724bf61.js +153 -0
  99. package/dist/top-items.f724bf61.js.map +1 -0
  100. package/dist/upward-scroll.d49e0815.js +157 -0
  101. package/dist/upward-scroll.d49e0815.js.map +1 -0
  102. package/dist/window-grid.b22094fd.js +234 -0
  103. package/dist/window-grid.b22094fd.js.map +1 -0
  104. package/dist/window-scroller.a979c6d6.js +163 -0
  105. package/dist/window-scroller.a979c6d6.js.map +1 -0
  106. package/package.json +6 -6
@@ -0,0 +1,203 @@
1
+ // modules are defined as an array
2
+ // [ module function, map of requires ]
3
+ //
4
+ // map of requires is short require name -> numeric require
5
+ //
6
+ // anything defined in a previous bundle is accessed via the
7
+ // orig method which is the require for previous bundles
8
+ parcelRequire = (function (modules, cache, entry, globalName) {
9
+ // Save the require from previous bundle to this closure if any
10
+ var previousRequire = typeof parcelRequire === 'function' && parcelRequire;
11
+ var nodeRequire = typeof require === 'function' && require;
12
+
13
+ function newRequire(name, jumped) {
14
+ if (!cache[name]) {
15
+ if (!modules[name]) {
16
+ // if we cannot find the module within our internal map or
17
+ // cache jump to the current global require ie. the last bundle
18
+ // that was added to the page.
19
+ var currentRequire = typeof parcelRequire === 'function' && parcelRequire;
20
+ if (!jumped && currentRequire) {
21
+ return currentRequire(name, true);
22
+ }
23
+
24
+ // If there are other bundles on this page the require from the
25
+ // previous one is saved to 'previousRequire'. Repeat this as
26
+ // many times as there are bundles until the module is found or
27
+ // we exhaust the require chain.
28
+ if (previousRequire) {
29
+ return previousRequire(name, true);
30
+ }
31
+
32
+ // Try the node require function if it exists.
33
+ if (nodeRequire && typeof name === 'string') {
34
+ return nodeRequire(name);
35
+ }
36
+
37
+ var err = new Error('Cannot find module \'' + name + '\'');
38
+ err.code = 'MODULE_NOT_FOUND';
39
+ throw err;
40
+ }
41
+
42
+ localRequire.resolve = resolve;
43
+ localRequire.cache = {};
44
+
45
+ var module = cache[name] = new newRequire.Module(name);
46
+
47
+ modules[name][0].call(module.exports, localRequire, module, module.exports, this);
48
+ }
49
+
50
+ return cache[name].exports;
51
+
52
+ function localRequire(x){
53
+ return newRequire(localRequire.resolve(x));
54
+ }
55
+
56
+ function resolve(x){
57
+ return modules[name][1][x] || x;
58
+ }
59
+ }
60
+
61
+ function Module(moduleName) {
62
+ this.id = moduleName;
63
+ this.bundle = newRequire;
64
+ this.exports = {};
65
+ }
66
+
67
+ newRequire.isParcelRequire = true;
68
+ newRequire.Module = Module;
69
+ newRequire.modules = modules;
70
+ newRequire.cache = cache;
71
+ newRequire.parent = previousRequire;
72
+ newRequire.register = function (id, exports) {
73
+ modules[id] = [function (require, module) {
74
+ module.exports = exports;
75
+ }, {}];
76
+ };
77
+
78
+ var error;
79
+ for (var i = 0; i < entry.length; i++) {
80
+ try {
81
+ newRequire(entry[i]);
82
+ } catch (e) {
83
+ // Save first error but execute all entries
84
+ if (!error) {
85
+ error = e;
86
+ }
87
+ }
88
+ }
89
+
90
+ if (entry.length) {
91
+ // Expose entry point to Node, AMD or browser globals
92
+ // Based on https://github.com/ForbesLindesay/umd/blob/master/template.js
93
+ var mainExports = newRequire(entry[entry.length - 1]);
94
+
95
+ // CommonJS
96
+ if (typeof exports === "object" && typeof module !== "undefined") {
97
+ module.exports = mainExports;
98
+
99
+ // RequireJS
100
+ } else if (typeof define === "function" && define.amd) {
101
+ define(function () {
102
+ return mainExports;
103
+ });
104
+
105
+ // <script>
106
+ } else if (globalName) {
107
+ this[globalName] = mainExports;
108
+ }
109
+ }
110
+
111
+ // Override the current require with this new one
112
+ parcelRequire = newRequire;
113
+
114
+ if (error) {
115
+ // throw error from earlier, _after updating parcelRequire_
116
+ throw error;
117
+ }
118
+
119
+ return newRequire;
120
+ })({"scroll-into-view.tsx":[function(require,module,exports) {
121
+ "use strict";
122
+
123
+ Object.defineProperty(exports, "__esModule", {
124
+ value: true
125
+ });
126
+ exports.default = App;
127
+
128
+ var React = _interopRequireWildcard(require("react"));
129
+
130
+ var _src = require("../src");
131
+
132
+ function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
133
+
134
+ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
135
+
136
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
137
+
138
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
139
+
140
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
141
+
142
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
143
+
144
+ function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
145
+
146
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
147
+
148
+ function App() {
149
+ var ref = React.useRef(null);
150
+
151
+ var _React$useState = React.useState(-1),
152
+ _React$useState2 = _slicedToArray(_React$useState, 2),
153
+ currentItemIndex = _React$useState2[0],
154
+ setCurrentItemIndex = _React$useState2[1];
155
+
156
+ var listRef = React.useRef();
157
+ var keyDownCallback = React.useCallback(function (e) {
158
+ var nextIndex = null;
159
+
160
+ if (e.code === 'ArrowUp') {
161
+ nextIndex = Math.max(0, currentItemIndex - 1);
162
+ } else if (e.code === 'ArrowDown') {
163
+ nextIndex = Math.min(99, currentItemIndex + 1);
164
+ }
165
+
166
+ if (nextIndex !== null) {
167
+ ref.current.scrollIntoView({
168
+ index: nextIndex,
169
+ behavior: 'auto',
170
+ done: function done() {
171
+ setCurrentItemIndex(nextIndex);
172
+ }
173
+ });
174
+ e.preventDefault();
175
+ }
176
+ }, [currentItemIndex, ref, setCurrentItemIndex]);
177
+ var scrollerRef = React.useCallback(function (element) {
178
+ if (element) {
179
+ element.addEventListener('keydown', keyDownCallback);
180
+ listRef.current = element;
181
+ } else {
182
+ listRef.current.removeEventListener('keydown', keyDownCallback);
183
+ }
184
+ }, [keyDownCallback]);
185
+ return React.createElement(_src.Virtuoso, {
186
+ ref: ref,
187
+ scrollerRef: scrollerRef,
188
+ totalCount: 100,
189
+ itemContent: function itemContent(index) {
190
+ return React.createElement("div", {
191
+ style: {
192
+ height: index % 2 ? 30 : 20,
193
+ background: 'white',
194
+ color: index === currentItemIndex ? 'red' : 'black'
195
+ }
196
+ }, "Item ", index);
197
+ },
198
+ style: {
199
+ height: 300
200
+ }
201
+ });
202
+ }
203
+ },{"react":"../node_modules/react/index.js","../src":"../src/index.tsx"}]},{},[], null)
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["scroll-into-view.tsx"],"names":[],"mappings":";;;;;;;AAAA;;AACA;;;;;;;;;;;;;;;;;;AAEc,SAAU,GAAV,GAAa;AACzB,MAAM,GAAG,GAAG,KAAK,CAAC,MAAN,CAA6B,IAA7B,CAAZ;;AADyB,wBAEuB,KAAK,CAAC,QAAN,CAAe,CAAC,CAAhB,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ACP,IAAA,GAAG,EAAE,GADE;AAEP,IAAA,WAAW,EAAE,WAFN;AAGP,IAAA,UAAU,EAAE,GAHL;AAIP,IAAA,WAAW,EAAE,qBAAC,KAAD;AAAA,aACX,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA;AAAK,QAAA,KAAK,EAAE;AAAE,UAAA,MAAM,EAAE,KAAK,GAAG,CAAR,GAAY,EAAZ,GAAiB,EAA3B;AAA+B,UAAA,UAAU,EAAE,OAA3C;AAAoD,UAAA,KAAK,EAAE,KAAK,KAAK,gBAAV,GAA6B,KAA7B,GAAqC;AAAhG;AAAZ,OAAA,SAAA,EACQ,KADR,CADW;AAAA,KAJN;AASP,IAAA,KAAK,EAAE;AAAE,MAAA,MAAM,EAAE;AAAV;AATA,GAAT,CADF;AAaD","file":"scroll-into-view.39b77fe9.js","sourceRoot":"../e2e","sourcesContent":["import * as React from 'react'\nimport { Virtuoso, VirtuosoHandle } from '../src'\n\nexport default function App() {\n const ref = React.useRef<VirtuosoHandle>(null)\n const [currentItemIndex, setCurrentItemIndex] = React.useState(-1)\n const listRef = React.useRef<HTMLElement>()\n\n const keyDownCallback = React.useCallback(\n (e: KeyboardEvent) => {\n let nextIndex: number | null = null\n\n if (e.code === 'ArrowUp') {\n nextIndex = Math.max(0, currentItemIndex - 1)\n } else if (e.code === 'ArrowDown') {\n nextIndex = Math.min(99, currentItemIndex + 1)\n }\n\n if (nextIndex !== null) {\n ref.current!.scrollIntoView({\n index: nextIndex,\n behavior: 'auto',\n done: () => {\n setCurrentItemIndex(nextIndex!)\n },\n })\n e.preventDefault()\n }\n },\n [currentItemIndex, ref, setCurrentItemIndex]\n )\n\n const scrollerRef = React.useCallback(\n (element: HTMLElement | Window | null) => {\n if (element) {\n element.addEventListener('keydown', keyDownCallback as any)\n listRef.current = element as HTMLElement\n } else {\n listRef.current!.removeEventListener('keydown', keyDownCallback)\n }\n },\n [keyDownCallback]\n )\n\n return (\n <Virtuoso\n ref={ref}\n scrollerRef={scrollerRef}\n totalCount={100}\n itemContent={(index) => (\n <div style={{ height: index % 2 ? 30 : 20, background: 'white', color: index === currentItemIndex ? 'red' : 'black' }}>\n Item {index}\n </div>\n )}\n style={{ height: 300 }}\n />\n )\n}\n"]}
@@ -0,0 +1,179 @@
1
+ // modules are defined as an array
2
+ // [ module function, map of requires ]
3
+ //
4
+ // map of requires is short require name -> numeric require
5
+ //
6
+ // anything defined in a previous bundle is accessed via the
7
+ // orig method which is the require for previous bundles
8
+ parcelRequire = (function (modules, cache, entry, globalName) {
9
+ // Save the require from previous bundle to this closure if any
10
+ var previousRequire = typeof parcelRequire === 'function' && parcelRequire;
11
+ var nodeRequire = typeof require === 'function' && require;
12
+
13
+ function newRequire(name, jumped) {
14
+ if (!cache[name]) {
15
+ if (!modules[name]) {
16
+ // if we cannot find the module within our internal map or
17
+ // cache jump to the current global require ie. the last bundle
18
+ // that was added to the page.
19
+ var currentRequire = typeof parcelRequire === 'function' && parcelRequire;
20
+ if (!jumped && currentRequire) {
21
+ return currentRequire(name, true);
22
+ }
23
+
24
+ // If there are other bundles on this page the require from the
25
+ // previous one is saved to 'previousRequire'. Repeat this as
26
+ // many times as there are bundles until the module is found or
27
+ // we exhaust the require chain.
28
+ if (previousRequire) {
29
+ return previousRequire(name, true);
30
+ }
31
+
32
+ // Try the node require function if it exists.
33
+ if (nodeRequire && typeof name === 'string') {
34
+ return nodeRequire(name);
35
+ }
36
+
37
+ var err = new Error('Cannot find module \'' + name + '\'');
38
+ err.code = 'MODULE_NOT_FOUND';
39
+ throw err;
40
+ }
41
+
42
+ localRequire.resolve = resolve;
43
+ localRequire.cache = {};
44
+
45
+ var module = cache[name] = new newRequire.Module(name);
46
+
47
+ modules[name][0].call(module.exports, localRequire, module, module.exports, this);
48
+ }
49
+
50
+ return cache[name].exports;
51
+
52
+ function localRequire(x){
53
+ return newRequire(localRequire.resolve(x));
54
+ }
55
+
56
+ function resolve(x){
57
+ return modules[name][1][x] || x;
58
+ }
59
+ }
60
+
61
+ function Module(moduleName) {
62
+ this.id = moduleName;
63
+ this.bundle = newRequire;
64
+ this.exports = {};
65
+ }
66
+
67
+ newRequire.isParcelRequire = true;
68
+ newRequire.Module = Module;
69
+ newRequire.modules = modules;
70
+ newRequire.cache = cache;
71
+ newRequire.parent = previousRequire;
72
+ newRequire.register = function (id, exports) {
73
+ modules[id] = [function (require, module) {
74
+ module.exports = exports;
75
+ }, {}];
76
+ };
77
+
78
+ var error;
79
+ for (var i = 0; i < entry.length; i++) {
80
+ try {
81
+ newRequire(entry[i]);
82
+ } catch (e) {
83
+ // Save first error but execute all entries
84
+ if (!error) {
85
+ error = e;
86
+ }
87
+ }
88
+ }
89
+
90
+ if (entry.length) {
91
+ // Expose entry point to Node, AMD or browser globals
92
+ // Based on https://github.com/ForbesLindesay/umd/blob/master/template.js
93
+ var mainExports = newRequire(entry[entry.length - 1]);
94
+
95
+ // CommonJS
96
+ if (typeof exports === "object" && typeof module !== "undefined") {
97
+ module.exports = mainExports;
98
+
99
+ // RequireJS
100
+ } else if (typeof define === "function" && define.amd) {
101
+ define(function () {
102
+ return mainExports;
103
+ });
104
+
105
+ // <script>
106
+ } else if (globalName) {
107
+ this[globalName] = mainExports;
108
+ }
109
+ }
110
+
111
+ // Override the current require with this new one
112
+ parcelRequire = newRequire;
113
+
114
+ if (error) {
115
+ // throw error from earlier, _after updating parcelRequire_
116
+ throw error;
117
+ }
118
+
119
+ return newRequire;
120
+ })({"scroll-seek-placeholder.tsx":[function(require,module,exports) {
121
+ "use strict";
122
+
123
+ Object.defineProperty(exports, "__esModule", {
124
+ value: true
125
+ });
126
+ exports.default = App;
127
+
128
+ var React = _interopRequireWildcard(require("react"));
129
+
130
+ var _src = require("../src/");
131
+
132
+ function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
133
+
134
+ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
135
+
136
+ function App() {
137
+ return React.createElement(_src.Virtuoso, {
138
+ computeItemKey: function computeItemKey(key) {
139
+ return "item-".concat(key);
140
+ },
141
+ totalCount: 1000,
142
+ itemContent: function itemContent(index) {
143
+ return React.createElement("div", {
144
+ style: {
145
+ height: 30
146
+ }
147
+ }, "Item ", index);
148
+ },
149
+ style: {
150
+ height: 300
151
+ },
152
+ scrollSeekConfiguration: {
153
+ enter: function enter(velocity) {
154
+ return Math.abs(velocity) > 200;
155
+ },
156
+ exit: function exit(velocity) {
157
+ return Math.abs(velocity) < 30;
158
+ },
159
+ change: function change(_, range) {
160
+ return console.log({
161
+ range: range
162
+ });
163
+ }
164
+ },
165
+ components: {
166
+ ScrollSeekPlaceholder: function ScrollSeekPlaceholder(_ref) {
167
+ var height = _ref.height,
168
+ index = _ref.index;
169
+ return React.createElement("div", {
170
+ style: {
171
+ height: height,
172
+ color: 'red'
173
+ }
174
+ }, "Placeholder ", index);
175
+ }
176
+ }
177
+ });
178
+ }
179
+ },{"react":"../node_modules/react/index.js","../src/":"../src/index.tsx"}]},{},[], null)
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["scroll-seek-placeholder.tsx"],"names":[],"mappings":";;;;;;;AAAA;;AACA;;;;;;AAEc,SAAU,GAAV,GAAa;AACzB,SACE,KAAA,CAAA,aAAA,CAAC,aAAD,EAAS;AACP,IAAA,cAAc,EAAE,wBAAC,GAAD;AAAA,4BAAiB,GAAjB;AAAA,KADT;AAEP,IAAA,UAAU,EAAE,IAFL;AAGP,IAAA,WAAW,EAAE,qBAAC,KAAD;AAAA,aAAW,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA;AAAK,QAAA,KAAK,EAAE;AAAE,UAAA,MAAM,EAAE;AAAV;AAAZ,OAAA,SAAA,EAAkC,KAAlC,CAAX;AAAA,KAHN;AAIP,IAAA,KAAK,EAAE;AAAE,MAAA,MAAM,EAAE;AAAV,KAJA;AAKP,IAAA,uBAAuB,EAAE;AACvB,MAAA,KAAK,EAAE,eAAC,QAAD;AAAA,eAAc,IAAI,CAAC,GAAL,CAAS,QAAT,IAAqB,GAAnC;AAAA,OADgB;AAEvB,MAAA,IAAI,EAAE,cAAC,QAAD;AAAA,eAAc,IAAI,CAAC,GAAL,CAAS,QAAT,IAAqB,EAAnC;AAAA,OAFiB;AAGvB,MAAA,MAAM,EAAE,gBAAC,CAAD,EAAI,KAAJ;AAAA,eAAc,OAAO,CAAC,GAAR,CAAY;AAAE,UAAA,KAAK,EAAL;AAAF,SAAZ,CAAd;AAAA;AAHe,KALlB;AAUP,IAAA,UAAU,EAAE;AACV,MAAA,qBAAqB,EAAE;AAAA,YAAG,MAAH,QAAG,MAAH;AAAA,YAAW,KAAX,QAAW,KAAX;AAAA,eAAuB,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA;AAAK,UAAA,KAAK,EAAE;AAAE,YAAA,MAAM,EAAN,MAAF;AAAU,YAAA,KAAK,EAAE;AAAjB;AAAZ,SAAA,gBAAA,EAAmD,KAAnD,CAAvB;AAAA;AADb;AAVL,GAAT,CADF;AAgBD","file":"scroll-seek-placeholder.69fb85c6.js","sourceRoot":"../e2e","sourcesContent":["import * as React from 'react'\nimport { Virtuoso } from '../src/'\n\nexport default function App() {\n return (\n <Virtuoso\n computeItemKey={(key) => `item-${key}`}\n totalCount={1000}\n itemContent={(index) => <div style={{ height: 30 }}>Item {index}</div>}\n style={{ height: 300 }}\n scrollSeekConfiguration={{\n enter: (velocity) => Math.abs(velocity) > 200,\n exit: (velocity) => Math.abs(velocity) < 30,\n change: (_, range) => console.log({ range }),\n }}\n components={{\n ScrollSeekPlaceholder: ({ height, index }) => <div style={{ height, color: 'red' }}>Placeholder {index}</div>,\n }}\n />\n )\n}\n"]}
@@ -0,0 +1,212 @@
1
+ // modules are defined as an array
2
+ // [ module function, map of requires ]
3
+ //
4
+ // map of requires is short require name -> numeric require
5
+ //
6
+ // anything defined in a previous bundle is accessed via the
7
+ // orig method which is the require for previous bundles
8
+ parcelRequire = (function (modules, cache, entry, globalName) {
9
+ // Save the require from previous bundle to this closure if any
10
+ var previousRequire = typeof parcelRequire === 'function' && parcelRequire;
11
+ var nodeRequire = typeof require === 'function' && require;
12
+
13
+ function newRequire(name, jumped) {
14
+ if (!cache[name]) {
15
+ if (!modules[name]) {
16
+ // if we cannot find the module within our internal map or
17
+ // cache jump to the current global require ie. the last bundle
18
+ // that was added to the page.
19
+ var currentRequire = typeof parcelRequire === 'function' && parcelRequire;
20
+ if (!jumped && currentRequire) {
21
+ return currentRequire(name, true);
22
+ }
23
+
24
+ // If there are other bundles on this page the require from the
25
+ // previous one is saved to 'previousRequire'. Repeat this as
26
+ // many times as there are bundles until the module is found or
27
+ // we exhaust the require chain.
28
+ if (previousRequire) {
29
+ return previousRequire(name, true);
30
+ }
31
+
32
+ // Try the node require function if it exists.
33
+ if (nodeRequire && typeof name === 'string') {
34
+ return nodeRequire(name);
35
+ }
36
+
37
+ var err = new Error('Cannot find module \'' + name + '\'');
38
+ err.code = 'MODULE_NOT_FOUND';
39
+ throw err;
40
+ }
41
+
42
+ localRequire.resolve = resolve;
43
+ localRequire.cache = {};
44
+
45
+ var module = cache[name] = new newRequire.Module(name);
46
+
47
+ modules[name][0].call(module.exports, localRequire, module, module.exports, this);
48
+ }
49
+
50
+ return cache[name].exports;
51
+
52
+ function localRequire(x){
53
+ return newRequire(localRequire.resolve(x));
54
+ }
55
+
56
+ function resolve(x){
57
+ return modules[name][1][x] || x;
58
+ }
59
+ }
60
+
61
+ function Module(moduleName) {
62
+ this.id = moduleName;
63
+ this.bundle = newRequire;
64
+ this.exports = {};
65
+ }
66
+
67
+ newRequire.isParcelRequire = true;
68
+ newRequire.Module = Module;
69
+ newRequire.modules = modules;
70
+ newRequire.cache = cache;
71
+ newRequire.parent = previousRequire;
72
+ newRequire.register = function (id, exports) {
73
+ modules[id] = [function (require, module) {
74
+ module.exports = exports;
75
+ }, {}];
76
+ };
77
+
78
+ var error;
79
+ for (var i = 0; i < entry.length; i++) {
80
+ try {
81
+ newRequire(entry[i]);
82
+ } catch (e) {
83
+ // Save first error but execute all entries
84
+ if (!error) {
85
+ error = e;
86
+ }
87
+ }
88
+ }
89
+
90
+ if (entry.length) {
91
+ // Expose entry point to Node, AMD or browser globals
92
+ // Based on https://github.com/ForbesLindesay/umd/blob/master/template.js
93
+ var mainExports = newRequire(entry[entry.length - 1]);
94
+
95
+ // CommonJS
96
+ if (typeof exports === "object" && typeof module !== "undefined") {
97
+ module.exports = mainExports;
98
+
99
+ // RequireJS
100
+ } else if (typeof define === "function" && define.amd) {
101
+ define(function () {
102
+ return mainExports;
103
+ });
104
+
105
+ // <script>
106
+ } else if (globalName) {
107
+ this[globalName] = mainExports;
108
+ }
109
+ }
110
+
111
+ // Override the current require with this new one
112
+ parcelRequire = newRequire;
113
+
114
+ if (error) {
115
+ // throw error from earlier, _after updating parcelRequire_
116
+ throw error;
117
+ }
118
+
119
+ return newRequire;
120
+ })({"scroll-to-index.tsx":[function(require,module,exports) {
121
+ "use strict";
122
+
123
+ Object.defineProperty(exports, "__esModule", {
124
+ value: true
125
+ });
126
+ exports.default = App;
127
+
128
+ var React = _interopRequireWildcard(require("react"));
129
+
130
+ var _src = require("../src");
131
+
132
+ function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
133
+
134
+ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
135
+
136
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
137
+
138
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
139
+
140
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
141
+
142
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
143
+
144
+ function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
145
+
146
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
147
+
148
+ function App() {
149
+ var ref = React.useRef(null);
150
+
151
+ var _React$useState = React.useState(true),
152
+ _React$useState2 = _slicedToArray(_React$useState, 2),
153
+ visible = _React$useState2[0],
154
+ setVisible = _React$useState2[1];
155
+
156
+ return React.createElement(React.Fragment, null, React.createElement("div", null, React.createElement("button", {
157
+ id: "start-30",
158
+ onClick: function onClick() {
159
+ return ref.current.scrollToIndex({
160
+ index: 30,
161
+ align: 'start'
162
+ });
163
+ }
164
+ }, "Start 30"), React.createElement("button", {
165
+ id: "offset-30",
166
+ onClick: function onClick() {
167
+ return ref.current.scrollToIndex({
168
+ index: 30,
169
+ offset: 5
170
+ });
171
+ }
172
+ }, "Offset 30 by 5px"), React.createElement("button", {
173
+ id: "center-50",
174
+ onClick: function onClick() {
175
+ return ref.current.scrollToIndex({
176
+ index: 50,
177
+ align: 'center'
178
+ });
179
+ }
180
+ }, "Center 50"), React.createElement("button", {
181
+ id: "end-99",
182
+ onClick: function onClick() {
183
+ return ref.current.scrollToIndex({
184
+ index: 99,
185
+ align: 'end'
186
+ });
187
+ }
188
+ }, "End 99"), React.createElement("button", {
189
+ onClick: function onClick() {
190
+ return setVisible(!visible);
191
+ }
192
+ }, "Toggle")), React.createElement(_src.Virtuoso, {
193
+ ref: ref,
194
+ startReached: function startReached() {
195
+ return console.log('start');
196
+ },
197
+ totalCount: 100,
198
+ itemContent: function itemContent(index) {
199
+ return React.createElement("div", {
200
+ style: {
201
+ height: index % 2 ? 30 : 20,
202
+ background: 'white'
203
+ }
204
+ }, "Item ", index);
205
+ },
206
+ style: {
207
+ height: 300,
208
+ display: visible ? 'block' : 'none'
209
+ }
210
+ }));
211
+ }
212
+ },{"react":"../node_modules/react/index.js","../src":"../src/index.tsx"}]},{},[], null)
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["scroll-to-index.tsx"],"names":[],"mappings":";;;;;;;AAAA;;AACA;;;;;;;;;;;;;;;;;;AAEc,SAAU,GAAV,GAAa;AACzB,MAAM,G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A,KAAK,EAAE;AAApB,OAA3B,CAAN;AAAA;AAA7B,GAAA,EAA0F,QAA1F,CAVF,EAaE,KAAA,CAAA,aAAA,CAAA,QAAA,EAAA;AAAQ,IAAA,OAAO,EAAE;AAAA,aAAM,UAAU,CAAC,CAAC,OAAF,CAAhB;AAAA;AAAjB,GAAA,EAA2C,QAA3C,CAbF,CADF,EAgBE,KAAA,CAAA,aAAA,CAAC,aAAD,EAAS;AACP,IAAA,GAAG,EAAE,GADE;AAEP,IAAA,YAAY,EAAE;AAAA,aAAM,OAAO,CAAC,GAAR,CAAY,OAAZ,CAAN;AAAA,KAFP;AAGP,IAAA,UAAU,EAAE,GAHL;AAIP,IAAA,WAAW,EAAE,qBAAC,KAAD;AAAA,aAAW,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA;AAAK,QAAA,KAAK,EAAE;AAAE,UAAA,MAAM,EAAE,KAAK,GAAG,CAAR,GAAY,EAAZ,GAAiB,EAA3B;AAA+B,UAAA,UAAU,EAAE;AAA3C;AAAZ,OAAA,SAAA,EAAwE,KAAxE,CAAX;AAAA,KAJN;AAKP,IAAA,KAAK,EAAE;AAAE,MAAA,MAAM,EAAE,GAAV;AAAe,MAAA,OAAO,EAAE,OAAO,GAAG,OAAH,GAAa;AAA5C;AALA,GAAT,CAhBF,CADF;AA0BD","file":"scroll-to-index.e72249cf.js","sourceRoot":"../e2e","sourcesContent":["import * as React from 'react'\nimport { Virtuoso, VirtuosoHandle } from '../src'\n\nexport default function App() {\n const ref = React.useRef<VirtuosoHandle>(null)\n const [visible, setVisible] = React.useState(true)\n return (\n <>\n <div>\n <button id=\"start-30\" onClick={() => ref.current!.scrollToIndex({ index: 30, align: 'start' })}>\n Start 30\n </button>\n <button id=\"offset-30\" onClick={() => ref.current!.scrollToIndex({ index: 30, offset: 5 })}>\n Offset 30 by 5px\n </button>\n <button id=\"center-50\" onClick={() => ref.current!.scrollToIndex({ index: 50, align: 'center' })}>\n Center 50\n </button>\n <button id=\"end-99\" onClick={() => ref.current!.scrollToIndex({ index: 99, align: 'end' })}>\n End 99\n </button>\n <button onClick={() => setVisible(!visible)}>Toggle</button>\n </div>\n <Virtuoso\n ref={ref}\n startReached={() => console.log('start')}\n totalCount={100}\n itemContent={(index) => <div style={{ height: index % 2 ? 30 : 20, background: 'white' }}>Item {index}</div>}\n style={{ height: 300, display: visible ? 'block' : 'none' }}\n />\n </>\n )\n}\n"]}