@react-aria/virtualizer 3.0.0-nightly-641446f65-240905

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 (40) hide show
  1. package/README.md +3 -0
  2. package/dist/ScrollView.main.js +214 -0
  3. package/dist/ScrollView.main.js.map +1 -0
  4. package/dist/ScrollView.mjs +204 -0
  5. package/dist/ScrollView.module.js +204 -0
  6. package/dist/ScrollView.module.js.map +1 -0
  7. package/dist/Virtualizer.main.js +88 -0
  8. package/dist/Virtualizer.main.js.map +1 -0
  9. package/dist/Virtualizer.mjs +79 -0
  10. package/dist/Virtualizer.module.js +79 -0
  11. package/dist/Virtualizer.module.js.map +1 -0
  12. package/dist/VirtualizerItem.main.js +82 -0
  13. package/dist/VirtualizerItem.main.js.map +1 -0
  14. package/dist/VirtualizerItem.mjs +72 -0
  15. package/dist/VirtualizerItem.module.js +72 -0
  16. package/dist/VirtualizerItem.module.js.map +1 -0
  17. package/dist/import.mjs +25 -0
  18. package/dist/main.js +38 -0
  19. package/dist/main.js.map +1 -0
  20. package/dist/module.js +25 -0
  21. package/dist/module.js.map +1 -0
  22. package/dist/types.d.ts +337 -0
  23. package/dist/types.d.ts.map +1 -0
  24. package/dist/useVirtualizerItem.main.js +53 -0
  25. package/dist/useVirtualizerItem.main.js.map +1 -0
  26. package/dist/useVirtualizerItem.mjs +48 -0
  27. package/dist/useVirtualizerItem.module.js +48 -0
  28. package/dist/useVirtualizerItem.module.js.map +1 -0
  29. package/dist/utils.main.js +80 -0
  30. package/dist/utils.main.js.map +1 -0
  31. package/dist/utils.mjs +73 -0
  32. package/dist/utils.module.js +73 -0
  33. package/dist/utils.module.js.map +1 -0
  34. package/package.json +40 -0
  35. package/src/ScrollView.tsx +246 -0
  36. package/src/Virtualizer.tsx +117 -0
  37. package/src/VirtualizerItem.tsx +87 -0
  38. package/src/index.ts +19 -0
  39. package/src/useVirtualizerItem.ts +54 -0
  40. package/src/utils.ts +107 -0
@@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W;IACf,IAAI,WAAW,CAAA,GAAA,kBAAU,EAAE;QACzB,WAAW,CAAA,GAAA,gBAAQ;IACrB,GAAG;QAAC;KAAW;IAEf,sEAAsE;IACtE,wDAAwD;IACxD,CAAA,GAAA,wBAAgB,EAAE;aAAC;QAAK,KAAK;kBAAc;IAAQ;IAEnD,IAAI,QAA6B;QAC/B,iGAAiG;QACjG,SAAS;QACT,GAAG,WAAW,KAAK;IACrB;IAEA,IAAI,oBAAoB,cAAc;QACpC,MAAM,SAAS,GAAG;QAClB,MAAM,SAAS,GAAG;IACpB,OAAO,IAAI,oBAAoB,cAAc,YAAY,KAAK,KAAK,MAAM,KAAK,EAAE;QAC9E,mFAAmF;QACnF,6FAA6F;QAC7F,iFAAiF;QACjF,MAAM,SAAS,GAAG;QAClB,MAAM,SAAS,GAAG;IACpB,OACE,MAAM,QAAQ,GAAG;IAGnB,aAAa;QACX,OAAO,OAAO,QAAQ,CAAC,YAAY,KAAK,IAAI,YAAY,KAAK,GAAG;QAChE,QAAQ,OAAO,QAAQ,CAAC,YAAY,MAAM,IAAI,YAAY,MAAM,GAAG;QACnE,eAAe,cAAc,SAAS;QACtC,UAAU;QACV,GAAG,UAAU;IACf;IAEA,OAAO;QACL,iBAAiB;YACf,GAAG,UAAU;mBACb;QACF;QACA,cAAc;YACZ,MAAM;YACN,OAAO;QACT;IACF;AACF","sources":["packages/@react-aria/virtualizer/src/ScrollView.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n// @ts-ignore\nimport {flushSync} from 'react-dom';\nimport {getScrollLeft} from './utils';\nimport React, {\n CSSProperties,\n ForwardedRef,\n HTMLAttributes,\n ReactNode,\n RefObject,\n useCallback,\n useEffect,\n useRef,\n useState\n} from 'react';\nimport {Rect, Size} from '@react-stately/virtualizer';\nimport {useEffectEvent, useEvent, useLayoutEffect, useObjectRef, useResizeObserver} from '@react-aria/utils';\nimport {useLocale} from '@react-aria/i18n';\n\ninterface ScrollViewProps extends HTMLAttributes<HTMLElement> {\n contentSize: Size,\n onVisibleRectChange: (rect: Rect) => void,\n children?: ReactNode,\n innerStyle?: CSSProperties,\n onScrollStart?: () => void,\n onScrollEnd?: () => void,\n scrollDirection?: 'horizontal' | 'vertical' | 'both'\n}\n\nfunction ScrollView(props: ScrollViewProps, ref: ForwardedRef<HTMLDivElement | null>) {\n ref = useObjectRef(ref);\n let {scrollViewProps, contentProps} = useScrollView(props, ref);\n\n return (\n <div role=\"presentation\" {...scrollViewProps} ref={ref}>\n <div role=\"presentation\" {...contentProps}>\n {props.children}\n </div>\n </div>\n );\n}\n\nconst ScrollViewForwardRef = React.forwardRef(ScrollView);\nexport {ScrollViewForwardRef as ScrollView};\n\nexport function useScrollView(props: ScrollViewProps, ref: RefObject<HTMLElement | null>) {\n let {\n contentSize,\n onVisibleRectChange,\n innerStyle,\n onScrollStart,\n onScrollEnd,\n scrollDirection = 'both',\n ...otherProps\n } = props;\n\n let state = useRef({\n scrollTop: 0,\n scrollLeft: 0,\n scrollEndTime: 0,\n scrollTimeout: null,\n width: 0,\n height: 0,\n isScrolling: false\n }).current;\n let {direction} = useLocale();\n\n let [isScrolling, setScrolling] = useState(false);\n let onScroll = useCallback((e) => {\n if (e.target !== e.currentTarget) {\n return;\n }\n\n if (props.onScroll) {\n props.onScroll(e);\n }\n\n flushSync(() => {\n let scrollTop = e.currentTarget.scrollTop;\n let scrollLeft = getScrollLeft(e.currentTarget, direction);\n\n // Prevent rubber band scrolling from shaking when scrolling out of bounds\n state.scrollTop = Math.max(0, Math.min(scrollTop, contentSize.height - state.height));\n state.scrollLeft = Math.max(0, Math.min(scrollLeft, contentSize.width - state.width));\n\n onVisibleRectChange(new Rect(state.scrollLeft, state.scrollTop, state.width, state.height));\n\n if (!state.isScrolling) {\n state.isScrolling = true;\n setScrolling(true);\n\n // Pause typekit MutationObserver during scrolling.\n window.dispatchEvent(new Event('tk.disconnect-observer'));\n if (onScrollStart) {\n onScrollStart();\n }\n }\n\n // So we don't constantly call clearTimeout and setTimeout,\n // keep track of the current timeout time and only reschedule\n // the timer when it is getting close.\n let now = Date.now();\n if (state.scrollEndTime <= now + 50) {\n state.scrollEndTime = now + 300;\n\n clearTimeout(state.scrollTimeout);\n state.scrollTimeout = setTimeout(() => {\n state.isScrolling = false;\n setScrolling(false);\n state.scrollTimeout = null;\n\n window.dispatchEvent(new Event('tk.connect-observer'));\n if (onScrollEnd) {\n onScrollEnd();\n }\n }, 300);\n }\n });\n }, [props, direction, state, contentSize, onVisibleRectChange, onScrollStart, onScrollEnd]);\n\n // Attach event directly to ref so RAC Virtualizer doesn't need to send props upward.\n useEvent(ref, 'scroll', onScroll);\n\n // eslint-disable-next-line arrow-body-style\n useEffect(() => {\n return () => {\n clearTimeout(state.scrollTimeout);\n if (state.isScrolling) {\n window.dispatchEvent(new Event('tk.connect-observer'));\n }\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n let updateSize = useEffectEvent((flush: typeof flushSync) => {\n let dom = ref.current;\n if (!dom) {\n return;\n }\n\n let isTestEnv = process.env.NODE_ENV === 'test' && !process.env.VIRT_ON;\n let isClientWidthMocked = Object.getOwnPropertyNames(window.HTMLElement.prototype).includes('clientWidth');\n let isClientHeightMocked = Object.getOwnPropertyNames(window.HTMLElement.prototype).includes('clientHeight');\n let clientWidth = dom.clientWidth;\n let clientHeight = dom.clientHeight;\n let w = isTestEnv && !isClientWidthMocked ? Infinity : clientWidth;\n let h = isTestEnv && !isClientHeightMocked ? Infinity : clientHeight;\n\n if (state.width !== w || state.height !== h) {\n state.width = w;\n state.height = h;\n flush(() => {\n onVisibleRectChange(new Rect(state.scrollLeft, state.scrollTop, w, h));\n });\n\n // If the clientWidth or clientHeight changed, scrollbars appeared or disappeared as\n // a result of the layout update. In this case, re-layout again to account for the\n // adjusted space. In very specific cases this might result in the scrollbars disappearing\n // again, resulting in extra padding. We stop after a maximum of two layout passes to avoid\n // an infinite loop. This matches how browsers behavior with native CSS grid layout.\n if (!isTestEnv && clientWidth !== dom.clientWidth || clientHeight !== dom.clientHeight) {\n state.width = dom.clientWidth;\n state.height = dom.clientHeight;\n flush(() => {\n onVisibleRectChange(new Rect(state.scrollLeft, state.scrollTop, state.width, state.height));\n });\n }\n }\n });\n\n let didUpdateSize = useRef(false);\n useLayoutEffect(() => {\n // React doesn't allow flushSync inside effects, so queue a microtask.\n // We also need to wait until all refs are set (e.g. when passing a ref down from a parent).\n queueMicrotask(() => {\n if (!didUpdateSize.current) {\n didUpdateSize.current = true;\n updateSize(flushSync);\n }\n });\n }, [updateSize]);\n useEffect(() => {\n if (!didUpdateSize.current) {\n // If useEffect ran before the above microtask, we are in a synchronous render (e.g. act).\n // Update the size here so that you don't need to mock timers in tests.\n didUpdateSize.current = true;\n updateSize(fn => fn());\n }\n }, [updateSize]);\n let onResize = useCallback(() => {\n updateSize(flushSync);\n }, [updateSize]);\n\n // Watch border-box instead of of content-box so that we don't go into\n // an infinite loop when scrollbars appear or disappear.\n useResizeObserver({ref, box: 'border-box', onResize});\n\n let style: React.CSSProperties = {\n // Reset padding so that relative positioning works correctly. Padding will be done in JS layout.\n padding: 0,\n ...otherProps.style\n };\n\n if (scrollDirection === 'horizontal') {\n style.overflowX = 'auto';\n style.overflowY = 'hidden';\n } else if (scrollDirection === 'vertical' || contentSize.width === state.width) {\n // Set overflow-x: hidden if content size is equal to the width of the scroll view.\n // This prevents horizontal scrollbars from flickering during resizing due to resize observer\n // firing slower than the frame rate, which may cause an infinite re-render loop.\n style.overflowY = 'auto';\n style.overflowX = 'hidden';\n } else {\n style.overflow = 'auto';\n }\n\n innerStyle = {\n width: Number.isFinite(contentSize.width) ? contentSize.width : undefined,\n height: Number.isFinite(contentSize.height) ? contentSize.height : undefined,\n pointerEvents: isScrolling ? 'none' : 'auto',\n position: 'relative',\n ...innerStyle\n };\n\n return {\n scrollViewProps: {\n ...otherProps,\n style\n },\n contentProps: {\n role: 'presentation',\n style: innerStyle\n }\n };\n}\n"],"names":[],"version":3,"file":"ScrollView.module.js.map"}
@@ -0,0 +1,88 @@
1
+ var $00ca8c0b29e3e07c$exports = require("./ScrollView.main.js");
2
+ var $d6a26279cc31826b$exports = require("./VirtualizerItem.main.js");
3
+ var $knrtk$reactstatelyvirtualizer = require("@react-stately/virtualizer");
4
+ var $knrtk$reactariautils = require("@react-aria/utils");
5
+ var $knrtk$react = require("react");
6
+
7
+
8
+ function $parcel$interopDefault(a) {
9
+ return a && a.__esModule ? a.default : a;
10
+ }
11
+
12
+ function $parcel$export(e, n, v, s) {
13
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
14
+ }
15
+
16
+ $parcel$export(module.exports, "Virtualizer", () => $e1fb6f3669e1c329$export$89be5a243e59c4b2);
17
+ /*
18
+ * Copyright 2020 Adobe. All rights reserved.
19
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
20
+ * you may not use this file except in compliance with the License. You may obtain a copy
21
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
22
+ *
23
+ * Unless required by applicable law or agreed to in writing, software distributed under
24
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
25
+ * OF ANY KIND, either express or implied. See the License for the specific language
26
+ * governing permissions and limitations under the License.
27
+ */
28
+
29
+
30
+
31
+
32
+ function $e1fb6f3669e1c329$var$Virtualizer(props, ref) {
33
+ let { children: renderView, renderWrapper: renderWrapper, layout: layout, collection: collection, scrollDirection: scrollDirection, isLoading: // eslint-disable-next-line @typescript-eslint/no-unused-vars
34
+ isLoading, onLoadMore: // eslint-disable-next-line @typescript-eslint/no-unused-vars
35
+ onLoadMore, persistedKeys: persistedKeys, layoutOptions: layoutOptions, ...otherProps } = props;
36
+ let fallbackRef = (0, $knrtk$react.useRef)(undefined);
37
+ ref = ref || fallbackRef;
38
+ let state = (0, $knrtk$reactstatelyvirtualizer.useVirtualizerState)({
39
+ layout: layout,
40
+ collection: collection,
41
+ renderView: renderView,
42
+ onVisibleRectChange (rect) {
43
+ ref.current.scrollLeft = rect.x;
44
+ ref.current.scrollTop = rect.y;
45
+ },
46
+ persistedKeys: persistedKeys,
47
+ layoutOptions: layoutOptions
48
+ });
49
+ (0, $knrtk$reactariautils.useLoadMore)({
50
+ isLoading: isLoading,
51
+ onLoadMore: onLoadMore,
52
+ scrollOffset: 1
53
+ }, ref);
54
+ let onVisibleRectChange = (0, $knrtk$react.useCallback)((rect)=>{
55
+ state.setVisibleRect(rect);
56
+ }, [
57
+ state
58
+ ]);
59
+ return /*#__PURE__*/ (0, ($parcel$interopDefault($knrtk$react))).createElement((0, $00ca8c0b29e3e07c$exports.ScrollView), {
60
+ ...(0, $knrtk$reactariautils.mergeProps)(otherProps, {
61
+ onVisibleRectChange: onVisibleRectChange
62
+ }),
63
+ ref: ref,
64
+ contentSize: state.contentSize,
65
+ onScrollStart: state.startScrolling,
66
+ onScrollEnd: state.endScrolling,
67
+ scrollDirection: scrollDirection
68
+ }, $e1fb6f3669e1c329$var$renderChildren(null, state.visibleViews, renderWrapper || $e1fb6f3669e1c329$var$defaultRenderWrapper));
69
+ }
70
+ // forwardRef doesn't support generic parameters, so cast the result to the correct type
71
+ // https://stackoverflow.com/questions/58469229/react-with-typescript-generics-while-using-react-forwardref
72
+ const $e1fb6f3669e1c329$export$89be5a243e59c4b2 = /*#__PURE__*/ (0, ($parcel$interopDefault($knrtk$react))).forwardRef($e1fb6f3669e1c329$var$Virtualizer);
73
+ function $e1fb6f3669e1c329$var$renderChildren(parent, views, renderWrapper) {
74
+ return views.map((view)=>{
75
+ return renderWrapper(parent, view, view.children ? Array.from(view.children) : [], (childViews)=>$e1fb6f3669e1c329$var$renderChildren(view, childViews, renderWrapper));
76
+ });
77
+ }
78
+ function $e1fb6f3669e1c329$var$defaultRenderWrapper(parent, reusableView) {
79
+ return /*#__PURE__*/ (0, ($parcel$interopDefault($knrtk$react))).createElement((0, $d6a26279cc31826b$exports.VirtualizerItem), {
80
+ key: reusableView.key,
81
+ layoutInfo: reusableView.layoutInfo,
82
+ virtualizer: reusableView.virtualizer,
83
+ parent: parent === null || parent === void 0 ? void 0 : parent.layoutInfo
84
+ }, reusableView.rendered);
85
+ }
86
+
87
+
88
+ //# sourceMappingURL=Virtualizer.main.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;AA4BD,SAAS,kCAAsD,KAAgC,EAAE,GAAqC;IACpI,IAAI,EACF,UAAU,UAAU,iBACpB,aAAa,UACb,MAAM,cACN,UAAU,mBACV,eAAe,aACf,6DAA6D;IAC7D,SAAS,cACT,6DAA6D;IAC7D,UAAU,iBACV,aAAa,iBACb,aAAa,EACb,GAAG,YACJ,GAAG;IAEJ,IAAI,cAAc,CAAA,GAAA,mBAAK,EAAkB;IACzC,MAAM,OAAO;IAEb,IAAI,QAAQ,CAAA,GAAA,kDAAkB,EAAE;gBAC9B;oBACA;oBACA;QACA,qBAAoB,IAAI;YACtB,IAAI,OAAO,CAAC,UAAU,GAAG,KAAK,CAAC;YAC/B,IAAI,OAAO,CAAC,SAAS,GAAG,KAAK,CAAC;QAChC;uBACA;uBACA;IACF;IAEA,CAAA,GAAA,iCAAU,EAAE;mBAAC;oBAAW;QAAY,cAAc;IAAC,GAAG;IACtD,IAAI,sBAAsB,CAAA,GAAA,wBAAU,EAAE,CAAC;QACrC,MAAM,cAAc,CAAC;IACvB,GAAG;QAAC;KAAM;IAEV,qBACE,0DAAC,CAAA,GAAA,oCAAS;QACP,GAAG,CAAA,GAAA,gCAAS,EAAE,YAAY;iCAAC;QAAmB,EAAE;QACjD,KAAK;QACL,aAAa,MAAM,WAAW;QAC9B,eAAe,MAAM,cAAc;QACnC,aAAa,MAAM,YAAY;QAC/B,iBAAiB;OAChB,qCAAe,MAAM,MAAM,YAAY,EAAE,iBAAiB;AAGjE;AAEA,wFAAwF;AACxF,2GAA2G;AAC3G,MAAM,0DAAe,CAAA,GAAA,sCAAI,EAAE,UAAU,CAAC;AAGtC,SAAS,qCAAoC,MAAiC,EAAE,KAA2B,EAAE,aAAkC;IAC7I,OAAO,MAAM,GAAG,CAAC,CAAA;QACf,OAAO,cACL,QACA,MACA,KAAK,QAAQ,GAAG,MAAM,IAAI,CAAC,KAAK,QAAQ,IAAI,EAAE,EAC9C,CAAA,aAAc,qCAAe,MAAM,YAAY;IAEnD;AACF;AAEA,SAAS,2CACP,MAAiC,EACjC,YAAgC;IAEhC,qBACE,0DAAC,CAAA,GAAA,yCAAc;QACb,KAAK,aAAa,GAAG;QACrB,YAAY,aAAa,UAAU;QACnC,aAAa,aAAa,WAAW;QACrC,MAAM,EAAE,mBAAA,6BAAA,OAAQ,UAAU;OACzB,aAAa,QAAQ;AAG5B","sources":["packages/@react-aria/virtualizer/src/Virtualizer.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {Collection, Key, RefObject} from '@react-types/shared';\nimport {Layout, Rect, ReusableView, useVirtualizerState} from '@react-stately/virtualizer';\nimport {mergeProps, useLoadMore} from '@react-aria/utils';\nimport React, {HTMLAttributes, ReactElement, ReactNode, useCallback, useRef} from 'react';\nimport {ScrollView} from './ScrollView';\nimport {VirtualizerItem} from './VirtualizerItem';\n\ntype RenderWrapper<T extends object, V> = (\n parent: ReusableView<T, V> | null,\n reusableView: ReusableView<T, V>,\n children: ReusableView<T, V>[],\n renderChildren: (views: ReusableView<T, V>[]) => ReactElement[]\n) => ReactElement;\n\ninterface VirtualizerProps<T extends object, V, O> extends Omit<HTMLAttributes<HTMLElement>, 'children'> {\n children: (type: string, content: T) => V,\n renderWrapper?: RenderWrapper<T, V>,\n layout: Layout<T, O>,\n collection: Collection<T>,\n persistedKeys?: Set<Key> | null,\n scrollDirection?: 'horizontal' | 'vertical' | 'both',\n isLoading?: boolean,\n onLoadMore?: () => void,\n layoutOptions?: O\n}\n\nfunction Virtualizer<T extends object, V extends ReactNode, O>(props: VirtualizerProps<T, V, O>, ref: RefObject<HTMLDivElement | null>) {\n let {\n children: renderView,\n renderWrapper,\n layout,\n collection,\n scrollDirection,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n isLoading,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n onLoadMore,\n persistedKeys,\n layoutOptions,\n ...otherProps\n } = props;\n\n let fallbackRef = useRef<HTMLDivElement>(undefined);\n ref = ref || fallbackRef;\n\n let state = useVirtualizerState({\n layout,\n collection,\n renderView,\n onVisibleRectChange(rect) {\n ref.current.scrollLeft = rect.x;\n ref.current.scrollTop = rect.y;\n },\n persistedKeys,\n layoutOptions\n });\n\n useLoadMore({isLoading, onLoadMore, scrollOffset: 1}, ref);\n let onVisibleRectChange = useCallback((rect: Rect) => {\n state.setVisibleRect(rect);\n }, [state]);\n\n return (\n <ScrollView\n {...mergeProps(otherProps, {onVisibleRectChange})}\n ref={ref}\n contentSize={state.contentSize}\n onScrollStart={state.startScrolling}\n onScrollEnd={state.endScrolling}\n scrollDirection={scrollDirection}>\n {renderChildren(null, state.visibleViews, renderWrapper || defaultRenderWrapper)}\n </ScrollView>\n );\n}\n\n// forwardRef doesn't support generic parameters, so cast the result to the correct type\n// https://stackoverflow.com/questions/58469229/react-with-typescript-generics-while-using-react-forwardref\nconst _Virtualizer = React.forwardRef(Virtualizer) as <T extends object, V, O>(props: VirtualizerProps<T, V, O> & {ref?: RefObject<HTMLDivElement | null>}) => ReactElement;\nexport {_Virtualizer as Virtualizer};\n\nfunction renderChildren<T extends object, V>(parent: ReusableView<T, V> | null, views: ReusableView<T, V>[], renderWrapper: RenderWrapper<T, V>) {\n return views.map(view => {\n return renderWrapper(\n parent,\n view,\n view.children ? Array.from(view.children) : [],\n childViews => renderChildren(view, childViews, renderWrapper)\n );\n });\n}\n\nfunction defaultRenderWrapper<T extends object, V extends ReactNode>(\n parent: ReusableView<T, V> | null,\n reusableView: ReusableView<T, V>\n) {\n return (\n <VirtualizerItem\n key={reusableView.key}\n layoutInfo={reusableView.layoutInfo}\n virtualizer={reusableView.virtualizer}\n parent={parent?.layoutInfo}>\n {reusableView.rendered}\n </VirtualizerItem>\n );\n}\n"],"names":[],"version":3,"file":"Virtualizer.main.js.map"}
@@ -0,0 +1,79 @@
1
+ import {ScrollView as $44a6ee657928b002$export$5665e3d6be6adea} from "./ScrollView.mjs";
2
+ import {VirtualizerItem as $ccf8a0a04e4175ae$export$6796df8ba7398521} from "./VirtualizerItem.mjs";
3
+ import {useVirtualizerState as $9WwqA$useVirtualizerState} from "@react-stately/virtualizer";
4
+ import {useLoadMore as $9WwqA$useLoadMore, mergeProps as $9WwqA$mergeProps} from "@react-aria/utils";
5
+ import $9WwqA$react, {useRef as $9WwqA$useRef, useCallback as $9WwqA$useCallback} from "react";
6
+
7
+ /*
8
+ * Copyright 2020 Adobe. All rights reserved.
9
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
10
+ * you may not use this file except in compliance with the License. You may obtain a copy
11
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software distributed under
14
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
15
+ * OF ANY KIND, either express or implied. See the License for the specific language
16
+ * governing permissions and limitations under the License.
17
+ */
18
+
19
+
20
+
21
+
22
+ function $6d0a5c394373ae64$var$Virtualizer(props, ref) {
23
+ let { children: renderView, renderWrapper: renderWrapper, layout: layout, collection: collection, scrollDirection: scrollDirection, isLoading: // eslint-disable-next-line @typescript-eslint/no-unused-vars
24
+ isLoading, onLoadMore: // eslint-disable-next-line @typescript-eslint/no-unused-vars
25
+ onLoadMore, persistedKeys: persistedKeys, layoutOptions: layoutOptions, ...otherProps } = props;
26
+ let fallbackRef = (0, $9WwqA$useRef)(undefined);
27
+ ref = ref || fallbackRef;
28
+ let state = (0, $9WwqA$useVirtualizerState)({
29
+ layout: layout,
30
+ collection: collection,
31
+ renderView: renderView,
32
+ onVisibleRectChange (rect) {
33
+ ref.current.scrollLeft = rect.x;
34
+ ref.current.scrollTop = rect.y;
35
+ },
36
+ persistedKeys: persistedKeys,
37
+ layoutOptions: layoutOptions
38
+ });
39
+ (0, $9WwqA$useLoadMore)({
40
+ isLoading: isLoading,
41
+ onLoadMore: onLoadMore,
42
+ scrollOffset: 1
43
+ }, ref);
44
+ let onVisibleRectChange = (0, $9WwqA$useCallback)((rect)=>{
45
+ state.setVisibleRect(rect);
46
+ }, [
47
+ state
48
+ ]);
49
+ return /*#__PURE__*/ (0, $9WwqA$react).createElement((0, $44a6ee657928b002$export$5665e3d6be6adea), {
50
+ ...(0, $9WwqA$mergeProps)(otherProps, {
51
+ onVisibleRectChange: onVisibleRectChange
52
+ }),
53
+ ref: ref,
54
+ contentSize: state.contentSize,
55
+ onScrollStart: state.startScrolling,
56
+ onScrollEnd: state.endScrolling,
57
+ scrollDirection: scrollDirection
58
+ }, $6d0a5c394373ae64$var$renderChildren(null, state.visibleViews, renderWrapper || $6d0a5c394373ae64$var$defaultRenderWrapper));
59
+ }
60
+ // forwardRef doesn't support generic parameters, so cast the result to the correct type
61
+ // https://stackoverflow.com/questions/58469229/react-with-typescript-generics-while-using-react-forwardref
62
+ const $6d0a5c394373ae64$export$89be5a243e59c4b2 = /*#__PURE__*/ (0, $9WwqA$react).forwardRef($6d0a5c394373ae64$var$Virtualizer);
63
+ function $6d0a5c394373ae64$var$renderChildren(parent, views, renderWrapper) {
64
+ return views.map((view)=>{
65
+ return renderWrapper(parent, view, view.children ? Array.from(view.children) : [], (childViews)=>$6d0a5c394373ae64$var$renderChildren(view, childViews, renderWrapper));
66
+ });
67
+ }
68
+ function $6d0a5c394373ae64$var$defaultRenderWrapper(parent, reusableView) {
69
+ return /*#__PURE__*/ (0, $9WwqA$react).createElement((0, $ccf8a0a04e4175ae$export$6796df8ba7398521), {
70
+ key: reusableView.key,
71
+ layoutInfo: reusableView.layoutInfo,
72
+ virtualizer: reusableView.virtualizer,
73
+ parent: parent === null || parent === void 0 ? void 0 : parent.layoutInfo
74
+ }, reusableView.rendered);
75
+ }
76
+
77
+
78
+ export {$6d0a5c394373ae64$export$89be5a243e59c4b2 as Virtualizer};
79
+ //# sourceMappingURL=Virtualizer.module.js.map
@@ -0,0 +1,79 @@
1
+ import {ScrollView as $44a6ee657928b002$export$5665e3d6be6adea} from "./ScrollView.module.js";
2
+ import {VirtualizerItem as $ccf8a0a04e4175ae$export$6796df8ba7398521} from "./VirtualizerItem.module.js";
3
+ import {useVirtualizerState as $9WwqA$useVirtualizerState} from "@react-stately/virtualizer";
4
+ import {useLoadMore as $9WwqA$useLoadMore, mergeProps as $9WwqA$mergeProps} from "@react-aria/utils";
5
+ import $9WwqA$react, {useRef as $9WwqA$useRef, useCallback as $9WwqA$useCallback} from "react";
6
+
7
+ /*
8
+ * Copyright 2020 Adobe. All rights reserved.
9
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
10
+ * you may not use this file except in compliance with the License. You may obtain a copy
11
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software distributed under
14
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
15
+ * OF ANY KIND, either express or implied. See the License for the specific language
16
+ * governing permissions and limitations under the License.
17
+ */
18
+
19
+
20
+
21
+
22
+ function $6d0a5c394373ae64$var$Virtualizer(props, ref) {
23
+ let { children: renderView, renderWrapper: renderWrapper, layout: layout, collection: collection, scrollDirection: scrollDirection, isLoading: // eslint-disable-next-line @typescript-eslint/no-unused-vars
24
+ isLoading, onLoadMore: // eslint-disable-next-line @typescript-eslint/no-unused-vars
25
+ onLoadMore, persistedKeys: persistedKeys, layoutOptions: layoutOptions, ...otherProps } = props;
26
+ let fallbackRef = (0, $9WwqA$useRef)(undefined);
27
+ ref = ref || fallbackRef;
28
+ let state = (0, $9WwqA$useVirtualizerState)({
29
+ layout: layout,
30
+ collection: collection,
31
+ renderView: renderView,
32
+ onVisibleRectChange (rect) {
33
+ ref.current.scrollLeft = rect.x;
34
+ ref.current.scrollTop = rect.y;
35
+ },
36
+ persistedKeys: persistedKeys,
37
+ layoutOptions: layoutOptions
38
+ });
39
+ (0, $9WwqA$useLoadMore)({
40
+ isLoading: isLoading,
41
+ onLoadMore: onLoadMore,
42
+ scrollOffset: 1
43
+ }, ref);
44
+ let onVisibleRectChange = (0, $9WwqA$useCallback)((rect)=>{
45
+ state.setVisibleRect(rect);
46
+ }, [
47
+ state
48
+ ]);
49
+ return /*#__PURE__*/ (0, $9WwqA$react).createElement((0, $44a6ee657928b002$export$5665e3d6be6adea), {
50
+ ...(0, $9WwqA$mergeProps)(otherProps, {
51
+ onVisibleRectChange: onVisibleRectChange
52
+ }),
53
+ ref: ref,
54
+ contentSize: state.contentSize,
55
+ onScrollStart: state.startScrolling,
56
+ onScrollEnd: state.endScrolling,
57
+ scrollDirection: scrollDirection
58
+ }, $6d0a5c394373ae64$var$renderChildren(null, state.visibleViews, renderWrapper || $6d0a5c394373ae64$var$defaultRenderWrapper));
59
+ }
60
+ // forwardRef doesn't support generic parameters, so cast the result to the correct type
61
+ // https://stackoverflow.com/questions/58469229/react-with-typescript-generics-while-using-react-forwardref
62
+ const $6d0a5c394373ae64$export$89be5a243e59c4b2 = /*#__PURE__*/ (0, $9WwqA$react).forwardRef($6d0a5c394373ae64$var$Virtualizer);
63
+ function $6d0a5c394373ae64$var$renderChildren(parent, views, renderWrapper) {
64
+ return views.map((view)=>{
65
+ return renderWrapper(parent, view, view.children ? Array.from(view.children) : [], (childViews)=>$6d0a5c394373ae64$var$renderChildren(view, childViews, renderWrapper));
66
+ });
67
+ }
68
+ function $6d0a5c394373ae64$var$defaultRenderWrapper(parent, reusableView) {
69
+ return /*#__PURE__*/ (0, $9WwqA$react).createElement((0, $ccf8a0a04e4175ae$export$6796df8ba7398521), {
70
+ key: reusableView.key,
71
+ layoutInfo: reusableView.layoutInfo,
72
+ virtualizer: reusableView.virtualizer,
73
+ parent: parent === null || parent === void 0 ? void 0 : parent.layoutInfo
74
+ }, reusableView.rendered);
75
+ }
76
+
77
+
78
+ export {$6d0a5c394373ae64$export$89be5a243e59c4b2 as Virtualizer};
79
+ //# sourceMappingURL=Virtualizer.module.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;AAAA;;;;;;;;;;CAUC;;;;;AA4BD,SAAS,kCAAsD,KAAgC,EAAE,GAAqC;IACpI,IAAI,EACF,UAAU,UAAU,iBACpB,aAAa,UACb,MAAM,cACN,UAAU,mBACV,eAAe,aACf,6DAA6D;IAC7D,SAAS,cACT,6DAA6D;IAC7D,UAAU,iBACV,aAAa,iBACb,aAAa,EACb,GAAG,YACJ,GAAG;IAEJ,IAAI,cAAc,CAAA,GAAA,aAAK,EAAkB;IACzC,MAAM,OAAO;IAEb,IAAI,QAAQ,CAAA,GAAA,0BAAkB,EAAE;gBAC9B;oBACA;oBACA;QACA,qBAAoB,IAAI;YACtB,IAAI,OAAO,CAAC,UAAU,GAAG,KAAK,CAAC;YAC/B,IAAI,OAAO,CAAC,SAAS,GAAG,KAAK,CAAC;QAChC;uBACA;uBACA;IACF;IAEA,CAAA,GAAA,kBAAU,EAAE;mBAAC;oBAAW;QAAY,cAAc;IAAC,GAAG;IACtD,IAAI,sBAAsB,CAAA,GAAA,kBAAU,EAAE,CAAC;QACrC,MAAM,cAAc,CAAC;IACvB,GAAG;QAAC;KAAM;IAEV,qBACE,gCAAC,CAAA,GAAA,wCAAS;QACP,GAAG,CAAA,GAAA,iBAAS,EAAE,YAAY;iCAAC;QAAmB,EAAE;QACjD,KAAK;QACL,aAAa,MAAM,WAAW;QAC9B,eAAe,MAAM,cAAc;QACnC,aAAa,MAAM,YAAY;QAC/B,iBAAiB;OAChB,qCAAe,MAAM,MAAM,YAAY,EAAE,iBAAiB;AAGjE;AAEA,wFAAwF;AACxF,2GAA2G;AAC3G,MAAM,0DAAe,CAAA,GAAA,YAAI,EAAE,UAAU,CAAC;AAGtC,SAAS,qCAAoC,MAAiC,EAAE,KAA2B,EAAE,aAAkC;IAC7I,OAAO,MAAM,GAAG,CAAC,CAAA;QACf,OAAO,cACL,QACA,MACA,KAAK,QAAQ,GAAG,MAAM,IAAI,CAAC,KAAK,QAAQ,IAAI,EAAE,EAC9C,CAAA,aAAc,qCAAe,MAAM,YAAY;IAEnD;AACF;AAEA,SAAS,2CACP,MAAiC,EACjC,YAAgC;IAEhC,qBACE,gCAAC,CAAA,GAAA,yCAAc;QACb,KAAK,aAAa,GAAG;QACrB,YAAY,aAAa,UAAU;QACnC,aAAa,aAAa,WAAW;QACrC,MAAM,EAAE,mBAAA,6BAAA,OAAQ,UAAU;OACzB,aAAa,QAAQ;AAG5B","sources":["packages/@react-aria/virtualizer/src/Virtualizer.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {Collection, Key, RefObject} from '@react-types/shared';\nimport {Layout, Rect, ReusableView, useVirtualizerState} from '@react-stately/virtualizer';\nimport {mergeProps, useLoadMore} from '@react-aria/utils';\nimport React, {HTMLAttributes, ReactElement, ReactNode, useCallback, useRef} from 'react';\nimport {ScrollView} from './ScrollView';\nimport {VirtualizerItem} from './VirtualizerItem';\n\ntype RenderWrapper<T extends object, V> = (\n parent: ReusableView<T, V> | null,\n reusableView: ReusableView<T, V>,\n children: ReusableView<T, V>[],\n renderChildren: (views: ReusableView<T, V>[]) => ReactElement[]\n) => ReactElement;\n\ninterface VirtualizerProps<T extends object, V, O> extends Omit<HTMLAttributes<HTMLElement>, 'children'> {\n children: (type: string, content: T) => V,\n renderWrapper?: RenderWrapper<T, V>,\n layout: Layout<T, O>,\n collection: Collection<T>,\n persistedKeys?: Set<Key> | null,\n scrollDirection?: 'horizontal' | 'vertical' | 'both',\n isLoading?: boolean,\n onLoadMore?: () => void,\n layoutOptions?: O\n}\n\nfunction Virtualizer<T extends object, V extends ReactNode, O>(props: VirtualizerProps<T, V, O>, ref: RefObject<HTMLDivElement | null>) {\n let {\n children: renderView,\n renderWrapper,\n layout,\n collection,\n scrollDirection,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n isLoading,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n onLoadMore,\n persistedKeys,\n layoutOptions,\n ...otherProps\n } = props;\n\n let fallbackRef = useRef<HTMLDivElement>(undefined);\n ref = ref || fallbackRef;\n\n let state = useVirtualizerState({\n layout,\n collection,\n renderView,\n onVisibleRectChange(rect) {\n ref.current.scrollLeft = rect.x;\n ref.current.scrollTop = rect.y;\n },\n persistedKeys,\n layoutOptions\n });\n\n useLoadMore({isLoading, onLoadMore, scrollOffset: 1}, ref);\n let onVisibleRectChange = useCallback((rect: Rect) => {\n state.setVisibleRect(rect);\n }, [state]);\n\n return (\n <ScrollView\n {...mergeProps(otherProps, {onVisibleRectChange})}\n ref={ref}\n contentSize={state.contentSize}\n onScrollStart={state.startScrolling}\n onScrollEnd={state.endScrolling}\n scrollDirection={scrollDirection}>\n {renderChildren(null, state.visibleViews, renderWrapper || defaultRenderWrapper)}\n </ScrollView>\n );\n}\n\n// forwardRef doesn't support generic parameters, so cast the result to the correct type\n// https://stackoverflow.com/questions/58469229/react-with-typescript-generics-while-using-react-forwardref\nconst _Virtualizer = React.forwardRef(Virtualizer) as <T extends object, V, O>(props: VirtualizerProps<T, V, O> & {ref?: RefObject<HTMLDivElement | null>}) => ReactElement;\nexport {_Virtualizer as Virtualizer};\n\nfunction renderChildren<T extends object, V>(parent: ReusableView<T, V> | null, views: ReusableView<T, V>[], renderWrapper: RenderWrapper<T, V>) {\n return views.map(view => {\n return renderWrapper(\n parent,\n view,\n view.children ? Array.from(view.children) : [],\n childViews => renderChildren(view, childViews, renderWrapper)\n );\n });\n}\n\nfunction defaultRenderWrapper<T extends object, V extends ReactNode>(\n parent: ReusableView<T, V> | null,\n reusableView: ReusableView<T, V>\n) {\n return (\n <VirtualizerItem\n key={reusableView.key}\n layoutInfo={reusableView.layoutInfo}\n virtualizer={reusableView.virtualizer}\n parent={parent?.layoutInfo}>\n {reusableView.rendered}\n </VirtualizerItem>\n );\n}\n"],"names":[],"version":3,"file":"Virtualizer.module.js.map"}
@@ -0,0 +1,82 @@
1
+ var $7d70e069fceb2deb$exports = require("./useVirtualizerItem.main.js");
2
+ var $eXWCF$react = require("react");
3
+ var $eXWCF$reactariai18n = require("@react-aria/i18n");
4
+
5
+
6
+ function $parcel$interopDefault(a) {
7
+ return a && a.__esModule ? a.default : a;
8
+ }
9
+
10
+ function $parcel$export(e, n, v, s) {
11
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
12
+ }
13
+
14
+ $parcel$export(module.exports, "VirtualizerItem", () => $d6a26279cc31826b$export$6796df8ba7398521);
15
+ $parcel$export(module.exports, "layoutInfoToStyle", () => $d6a26279cc31826b$export$1481e64fbe01b8b3);
16
+ /*
17
+ * Copyright 2020 Adobe. All rights reserved.
18
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
19
+ * you may not use this file except in compliance with the License. You may obtain a copy
20
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
21
+ *
22
+ * Unless required by applicable law or agreed to in writing, software distributed under
23
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
24
+ * OF ANY KIND, either express or implied. See the License for the specific language
25
+ * governing permissions and limitations under the License.
26
+ */
27
+
28
+
29
+ function $d6a26279cc31826b$export$6796df8ba7398521(props) {
30
+ let { className: className, layoutInfo: layoutInfo, virtualizer: virtualizer, parent: parent, children: children } = props;
31
+ let { direction: direction } = (0, $eXWCF$reactariai18n.useLocale)();
32
+ let ref = (0, $eXWCF$react.useRef)(undefined);
33
+ (0, $7d70e069fceb2deb$exports.useVirtualizerItem)({
34
+ layoutInfo: layoutInfo,
35
+ virtualizer: virtualizer,
36
+ ref: ref
37
+ });
38
+ return /*#__PURE__*/ (0, ($parcel$interopDefault($eXWCF$react))).createElement("div", {
39
+ role: "presentation",
40
+ ref: ref,
41
+ className: className,
42
+ style: $d6a26279cc31826b$export$1481e64fbe01b8b3(layoutInfo, direction, parent)
43
+ }, children);
44
+ }
45
+ let $d6a26279cc31826b$var$cache = new WeakMap();
46
+ function $d6a26279cc31826b$export$1481e64fbe01b8b3(layoutInfo, dir, parent) {
47
+ let xProperty = dir === 'rtl' ? 'right' : 'left';
48
+ let cached = $d6a26279cc31826b$var$cache.get(layoutInfo);
49
+ if (cached && cached[xProperty] != null) {
50
+ if (!parent) return cached;
51
+ // Invalidate if the parent position changed.
52
+ let top = layoutInfo.rect.y - parent.rect.y;
53
+ let x = layoutInfo.rect.x - parent.rect.x;
54
+ if (cached.top === top && cached[xProperty] === x) return cached;
55
+ }
56
+ let rectStyles = {
57
+ top: layoutInfo.rect.y - (parent ? parent.rect.y : 0),
58
+ [xProperty]: layoutInfo.rect.x - (parent ? parent.rect.x : 0),
59
+ width: layoutInfo.rect.width,
60
+ height: layoutInfo.rect.height
61
+ };
62
+ // Get rid of any non finite values since they aren't valid css values
63
+ Object.entries(rectStyles).forEach(([key, value])=>{
64
+ if (!Number.isFinite(value)) rectStyles[key] = undefined;
65
+ });
66
+ let style = {
67
+ position: layoutInfo.isSticky ? 'sticky' : 'absolute',
68
+ // Sticky elements are positioned in normal document flow. Display inline-block so that they don't push other sticky columns onto the following rows.
69
+ display: layoutInfo.isSticky ? 'inline-block' : undefined,
70
+ overflow: layoutInfo.allowOverflow ? 'visible' : 'hidden',
71
+ opacity: layoutInfo.opacity,
72
+ zIndex: layoutInfo.zIndex,
73
+ transform: layoutInfo.transform,
74
+ contain: 'size layout style',
75
+ ...rectStyles
76
+ };
77
+ $d6a26279cc31826b$var$cache.set(layoutInfo, style);
78
+ return style;
79
+ }
80
+
81
+
82
+ //# sourceMappingURL=VirtualizerItem.main.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;AAcM,SAAS,0CAAgB,KAA2B;IACzD,IAAI,aAAC,SAAS,cAAE,UAAU,eAAE,WAAW,UAAE,MAAM,YAAE,QAAQ,EAAC,GAAG;IAC7D,IAAI,aAAC,SAAS,EAAC,GAAG,CAAA,GAAA,8BAAQ;IAC1B,IAAI,MAAM,CAAA,GAAA,mBAAK,EAAE;IACjB,CAAA,GAAA,4CAAiB,EAAE;oBACjB;qBACA;aACA;IACF;IAEA,qBACE,0DAAC;QAAI,MAAK;QAAe,KAAK;QAAK,WAAW;QAAW,OAAO,0CAAkB,YAAY,WAAW;OACtG;AAGP;AAEA,IAAI,8BAAQ,IAAI;AACT,SAAS,0CAAkB,UAAsB,EAAE,GAAc,EAAE,MAA0B;IAClG,IAAI,YAAY,QAAQ,QAAQ,UAAU;IAC1C,IAAI,SAAS,4BAAM,GAAG,CAAC;IACvB,IAAI,UAAU,MAAM,CAAC,UAAU,IAAI,MAAM;QACvC,IAAI,CAAC,QACH,OAAO;QAGT,6CAA6C;QAC7C,IAAI,MAAM,WAAW,IAAI,CAAC,CAAC,GAAG,OAAO,IAAI,CAAC,CAAC;QAC3C,IAAI,IAAI,WAAW,IAAI,CAAC,CAAC,GAAG,OAAO,IAAI,CAAC,CAAC;QACzC,IAAI,OAAO,GAAG,KAAK,OAAO,MAAM,CAAC,UAAU,KAAK,GAC9C,OAAO;IAEX;IAEA,IAAI,aAAa;QACf,KAAK,WAAW,IAAI,CAAC,CAAC,GAAI,CAAA,SAAS,OAAO,IAAI,CAAC,CAAC,GAAG,CAAA;QACnD,CAAC,UAAU,EAAE,WAAW,IAAI,CAAC,CAAC,GAAI,CAAA,SAAS,OAAO,IAAI,CAAC,CAAC,GAAG,CAAA;QAC3D,OAAO,WAAW,IAAI,CAAC,KAAK;QAC5B,QAAQ,WAAW,IAAI,CAAC,MAAM;IAChC;IAEA,sEAAsE;IACtE,OAAO,OAAO,CAAC,YAAY,OAAO,CAAC,CAAC,CAAC,KAAK,MAAM;QAC9C,IAAI,CAAC,OAAO,QAAQ,CAAC,QACnB,UAAU,CAAC,IAAI,GAAG;IAEtB;IAEA,IAAI,QAAuB;QACzB,UAAU,WAAW,QAAQ,GAAG,WAAW;QAC3C,qJAAqJ;QACrJ,SAAS,WAAW,QAAQ,GAAG,iBAAiB;QAChD,UAAU,WAAW,aAAa,GAAG,YAAY;QACjD,SAAS,WAAW,OAAO;QAC3B,QAAQ,WAAW,MAAM;QACzB,WAAW,WAAW,SAAS;QAC/B,SAAS;QACT,GAAG,UAAU;IACf;IAEA,4BAAM,GAAG,CAAC,YAAY;IACtB,OAAO;AACT","sources":["packages/@react-aria/virtualizer/src/VirtualizerItem.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {Direction} from '@react-types/shared';\nimport {LayoutInfo} from '@react-stately/virtualizer';\nimport React, {CSSProperties, ReactNode, useRef} from 'react';\nimport {useLocale} from '@react-aria/i18n';\nimport {useVirtualizerItem, VirtualizerItemOptions} from './useVirtualizerItem';\n\ninterface VirtualizerItemProps extends Omit<VirtualizerItemOptions, 'ref'> {\n parent?: LayoutInfo | null,\n className?: string,\n children: ReactNode\n}\n\nexport function VirtualizerItem(props: VirtualizerItemProps) {\n let {className, layoutInfo, virtualizer, parent, children} = props;\n let {direction} = useLocale();\n let ref = useRef(undefined);\n useVirtualizerItem({\n layoutInfo,\n virtualizer,\n ref\n });\n\n return (\n <div role=\"presentation\" ref={ref} className={className} style={layoutInfoToStyle(layoutInfo, direction, parent)}>\n {children}\n </div>\n );\n}\n\nlet cache = new WeakMap();\nexport function layoutInfoToStyle(layoutInfo: LayoutInfo, dir: Direction, parent?: LayoutInfo | null): CSSProperties {\n let xProperty = dir === 'rtl' ? 'right' : 'left';\n let cached = cache.get(layoutInfo);\n if (cached && cached[xProperty] != null) {\n if (!parent) {\n return cached;\n }\n\n // Invalidate if the parent position changed.\n let top = layoutInfo.rect.y - parent.rect.y;\n let x = layoutInfo.rect.x - parent.rect.x;\n if (cached.top === top && cached[xProperty] === x) {\n return cached;\n }\n }\n\n let rectStyles = {\n top: layoutInfo.rect.y - (parent ? parent.rect.y : 0),\n [xProperty]: layoutInfo.rect.x - (parent ? parent.rect.x : 0),\n width: layoutInfo.rect.width,\n height: layoutInfo.rect.height\n };\n\n // Get rid of any non finite values since they aren't valid css values\n Object.entries(rectStyles).forEach(([key, value]) => {\n if (!Number.isFinite(value)) {\n rectStyles[key] = undefined;\n }\n });\n\n let style: CSSProperties = {\n position: layoutInfo.isSticky ? 'sticky' : 'absolute',\n // Sticky elements are positioned in normal document flow. Display inline-block so that they don't push other sticky columns onto the following rows.\n display: layoutInfo.isSticky ? 'inline-block' : undefined,\n overflow: layoutInfo.allowOverflow ? 'visible' : 'hidden',\n opacity: layoutInfo.opacity,\n zIndex: layoutInfo.zIndex,\n transform: layoutInfo.transform,\n contain: 'size layout style',\n ...rectStyles\n };\n\n cache.set(layoutInfo, style);\n return style;\n}\n"],"names":[],"version":3,"file":"VirtualizerItem.main.js.map"}
@@ -0,0 +1,72 @@
1
+ import {useVirtualizerItem as $47736c1e63ba1c6d$export$1da781778207e0a2} from "./useVirtualizerItem.mjs";
2
+ import $ivH3G$react, {useRef as $ivH3G$useRef} from "react";
3
+ import {useLocale as $ivH3G$useLocale} from "@react-aria/i18n";
4
+
5
+ /*
6
+ * Copyright 2020 Adobe. All rights reserved.
7
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
8
+ * you may not use this file except in compliance with the License. You may obtain a copy
9
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software distributed under
12
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
13
+ * OF ANY KIND, either express or implied. See the License for the specific language
14
+ * governing permissions and limitations under the License.
15
+ */
16
+
17
+
18
+ function $ccf8a0a04e4175ae$export$6796df8ba7398521(props) {
19
+ let { className: className, layoutInfo: layoutInfo, virtualizer: virtualizer, parent: parent, children: children } = props;
20
+ let { direction: direction } = (0, $ivH3G$useLocale)();
21
+ let ref = (0, $ivH3G$useRef)(undefined);
22
+ (0, $47736c1e63ba1c6d$export$1da781778207e0a2)({
23
+ layoutInfo: layoutInfo,
24
+ virtualizer: virtualizer,
25
+ ref: ref
26
+ });
27
+ return /*#__PURE__*/ (0, $ivH3G$react).createElement("div", {
28
+ role: "presentation",
29
+ ref: ref,
30
+ className: className,
31
+ style: $ccf8a0a04e4175ae$export$1481e64fbe01b8b3(layoutInfo, direction, parent)
32
+ }, children);
33
+ }
34
+ let $ccf8a0a04e4175ae$var$cache = new WeakMap();
35
+ function $ccf8a0a04e4175ae$export$1481e64fbe01b8b3(layoutInfo, dir, parent) {
36
+ let xProperty = dir === 'rtl' ? 'right' : 'left';
37
+ let cached = $ccf8a0a04e4175ae$var$cache.get(layoutInfo);
38
+ if (cached && cached[xProperty] != null) {
39
+ if (!parent) return cached;
40
+ // Invalidate if the parent position changed.
41
+ let top = layoutInfo.rect.y - parent.rect.y;
42
+ let x = layoutInfo.rect.x - parent.rect.x;
43
+ if (cached.top === top && cached[xProperty] === x) return cached;
44
+ }
45
+ let rectStyles = {
46
+ top: layoutInfo.rect.y - (parent ? parent.rect.y : 0),
47
+ [xProperty]: layoutInfo.rect.x - (parent ? parent.rect.x : 0),
48
+ width: layoutInfo.rect.width,
49
+ height: layoutInfo.rect.height
50
+ };
51
+ // Get rid of any non finite values since they aren't valid css values
52
+ Object.entries(rectStyles).forEach(([key, value])=>{
53
+ if (!Number.isFinite(value)) rectStyles[key] = undefined;
54
+ });
55
+ let style = {
56
+ position: layoutInfo.isSticky ? 'sticky' : 'absolute',
57
+ // Sticky elements are positioned in normal document flow. Display inline-block so that they don't push other sticky columns onto the following rows.
58
+ display: layoutInfo.isSticky ? 'inline-block' : undefined,
59
+ overflow: layoutInfo.allowOverflow ? 'visible' : 'hidden',
60
+ opacity: layoutInfo.opacity,
61
+ zIndex: layoutInfo.zIndex,
62
+ transform: layoutInfo.transform,
63
+ contain: 'size layout style',
64
+ ...rectStyles
65
+ };
66
+ $ccf8a0a04e4175ae$var$cache.set(layoutInfo, style);
67
+ return style;
68
+ }
69
+
70
+
71
+ export {$ccf8a0a04e4175ae$export$6796df8ba7398521 as VirtualizerItem, $ccf8a0a04e4175ae$export$1481e64fbe01b8b3 as layoutInfoToStyle};
72
+ //# sourceMappingURL=VirtualizerItem.module.js.map
@@ -0,0 +1,72 @@
1
+ import {useVirtualizerItem as $47736c1e63ba1c6d$export$1da781778207e0a2} from "./useVirtualizerItem.module.js";
2
+ import $ivH3G$react, {useRef as $ivH3G$useRef} from "react";
3
+ import {useLocale as $ivH3G$useLocale} from "@react-aria/i18n";
4
+
5
+ /*
6
+ * Copyright 2020 Adobe. All rights reserved.
7
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
8
+ * you may not use this file except in compliance with the License. You may obtain a copy
9
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software distributed under
12
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
13
+ * OF ANY KIND, either express or implied. See the License for the specific language
14
+ * governing permissions and limitations under the License.
15
+ */
16
+
17
+
18
+ function $ccf8a0a04e4175ae$export$6796df8ba7398521(props) {
19
+ let { className: className, layoutInfo: layoutInfo, virtualizer: virtualizer, parent: parent, children: children } = props;
20
+ let { direction: direction } = (0, $ivH3G$useLocale)();
21
+ let ref = (0, $ivH3G$useRef)(undefined);
22
+ (0, $47736c1e63ba1c6d$export$1da781778207e0a2)({
23
+ layoutInfo: layoutInfo,
24
+ virtualizer: virtualizer,
25
+ ref: ref
26
+ });
27
+ return /*#__PURE__*/ (0, $ivH3G$react).createElement("div", {
28
+ role: "presentation",
29
+ ref: ref,
30
+ className: className,
31
+ style: $ccf8a0a04e4175ae$export$1481e64fbe01b8b3(layoutInfo, direction, parent)
32
+ }, children);
33
+ }
34
+ let $ccf8a0a04e4175ae$var$cache = new WeakMap();
35
+ function $ccf8a0a04e4175ae$export$1481e64fbe01b8b3(layoutInfo, dir, parent) {
36
+ let xProperty = dir === 'rtl' ? 'right' : 'left';
37
+ let cached = $ccf8a0a04e4175ae$var$cache.get(layoutInfo);
38
+ if (cached && cached[xProperty] != null) {
39
+ if (!parent) return cached;
40
+ // Invalidate if the parent position changed.
41
+ let top = layoutInfo.rect.y - parent.rect.y;
42
+ let x = layoutInfo.rect.x - parent.rect.x;
43
+ if (cached.top === top && cached[xProperty] === x) return cached;
44
+ }
45
+ let rectStyles = {
46
+ top: layoutInfo.rect.y - (parent ? parent.rect.y : 0),
47
+ [xProperty]: layoutInfo.rect.x - (parent ? parent.rect.x : 0),
48
+ width: layoutInfo.rect.width,
49
+ height: layoutInfo.rect.height
50
+ };
51
+ // Get rid of any non finite values since they aren't valid css values
52
+ Object.entries(rectStyles).forEach(([key, value])=>{
53
+ if (!Number.isFinite(value)) rectStyles[key] = undefined;
54
+ });
55
+ let style = {
56
+ position: layoutInfo.isSticky ? 'sticky' : 'absolute',
57
+ // Sticky elements are positioned in normal document flow. Display inline-block so that they don't push other sticky columns onto the following rows.
58
+ display: layoutInfo.isSticky ? 'inline-block' : undefined,
59
+ overflow: layoutInfo.allowOverflow ? 'visible' : 'hidden',
60
+ opacity: layoutInfo.opacity,
61
+ zIndex: layoutInfo.zIndex,
62
+ transform: layoutInfo.transform,
63
+ contain: 'size layout style',
64
+ ...rectStyles
65
+ };
66
+ $ccf8a0a04e4175ae$var$cache.set(layoutInfo, style);
67
+ return style;
68
+ }
69
+
70
+
71
+ export {$ccf8a0a04e4175ae$export$6796df8ba7398521 as VirtualizerItem, $ccf8a0a04e4175ae$export$1481e64fbe01b8b3 as layoutInfoToStyle};
72
+ //# sourceMappingURL=VirtualizerItem.module.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;AAAA;;;;;;;;;;CAUC;;;AAcM,SAAS,0CAAgB,KAA2B;IACzD,IAAI,aAAC,SAAS,cAAE,UAAU,eAAE,WAAW,UAAE,MAAM,YAAE,QAAQ,EAAC,GAAG;IAC7D,IAAI,aAAC,SAAS,EAAC,GAAG,CAAA,GAAA,gBAAQ;IAC1B,IAAI,MAAM,CAAA,GAAA,aAAK,EAAE;IACjB,CAAA,GAAA,yCAAiB,EAAE;oBACjB;qBACA;aACA;IACF;IAEA,qBACE,gCAAC;QAAI,MAAK;QAAe,KAAK;QAAK,WAAW;QAAW,OAAO,0CAAkB,YAAY,WAAW;OACtG;AAGP;AAEA,IAAI,8BAAQ,IAAI;AACT,SAAS,0CAAkB,UAAsB,EAAE,GAAc,EAAE,MAA0B;IAClG,IAAI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ed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {Direction} from '@react-types/shared';\nimport {LayoutInfo} from '@react-stately/virtualizer';\nimport React, {CSSProperties, ReactNode, useRef} from 'react';\nimport {useLocale} from '@react-aria/i18n';\nimport {useVirtualizerItem, VirtualizerItemOptions} from './useVirtualizerItem';\n\ninterface VirtualizerItemProps extends Omit<VirtualizerItemOptions, 'ref'> {\n parent?: LayoutInfo | null,\n className?: string,\n children: ReactNode\n}\n\nexport function VirtualizerItem(props: VirtualizerItemProps) {\n let {className, layoutInfo, virtualizer, parent, children} = props;\n let {direction} = useLocale();\n let ref = useRef(undefined);\n useVirtualizerItem({\n layoutInfo,\n virtualizer,\n ref\n });\n\n return (\n <div role=\"presentation\" ref={ref} className={className} style={layoutInfoToStyle(layoutInfo, direction, parent)}>\n {children}\n </div>\n );\n}\n\nlet cache = new WeakMap();\nexport function layoutInfoToStyle(layoutInfo: LayoutInfo, dir: Direction, parent?: LayoutInfo | null): CSSProperties {\n let xProperty = dir === 'rtl' ? 'right' : 'left';\n let cached = cache.get(layoutInfo);\n if (cached && cached[xProperty] != null) {\n if (!parent) {\n return cached;\n }\n\n // Invalidate if the parent position changed.\n let top = layoutInfo.rect.y - parent.rect.y;\n let x = layoutInfo.rect.x - parent.rect.x;\n if (cached.top === top && cached[xProperty] === x) {\n return cached;\n }\n }\n\n let rectStyles = {\n top: layoutInfo.rect.y - (parent ? parent.rect.y : 0),\n [xProperty]: layoutInfo.rect.x - (parent ? parent.rect.x : 0),\n width: layoutInfo.rect.width,\n height: layoutInfo.rect.height\n };\n\n // Get rid of any non finite values since they aren't valid css values\n Object.entries(rectStyles).forEach(([key, value]) => {\n if (!Number.isFinite(value)) {\n rectStyles[key] = undefined;\n }\n });\n\n let style: CSSProperties = {\n position: layoutInfo.isSticky ? 'sticky' : 'absolute',\n // Sticky elements are positioned in normal document flow. Display inline-block so that they don't push other sticky columns onto the following rows.\n display: layoutInfo.isSticky ? 'inline-block' : undefined,\n overflow: layoutInfo.allowOverflow ? 'visible' : 'hidden',\n opacity: layoutInfo.opacity,\n zIndex: layoutInfo.zIndex,\n transform: layoutInfo.transform,\n contain: 'size layout style',\n ...rectStyles\n };\n\n cache.set(layoutInfo, style);\n return style;\n}\n"],"names":[],"version":3,"file":"VirtualizerItem.module.js.map"}
@@ -0,0 +1,25 @@
1
+ import {Virtualizer as $6d0a5c394373ae64$export$89be5a243e59c4b2} from "./Virtualizer.mjs";
2
+ import {useVirtualizerItem as $47736c1e63ba1c6d$export$1da781778207e0a2} from "./useVirtualizerItem.mjs";
3
+ import {layoutInfoToStyle as $ccf8a0a04e4175ae$export$1481e64fbe01b8b3, VirtualizerItem as $ccf8a0a04e4175ae$export$6796df8ba7398521} from "./VirtualizerItem.mjs";
4
+ import {ScrollView as $44a6ee657928b002$export$5665e3d6be6adea, useScrollView as $44a6ee657928b002$export$2ea0c4974da4731b} from "./ScrollView.mjs";
5
+ import {getRTLOffsetType as $ce415dc67314b753$export$faf7630257ad4304, getScrollLeft as $ce415dc67314b753$export$1389d168952b34b5, setScrollLeft as $ce415dc67314b753$export$ed5fd5ffe5ab0ac} from "./utils.mjs";
6
+
7
+ /*
8
+ * Copyright 2020 Adobe. All rights reserved.
9
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
10
+ * you may not use this file except in compliance with the License. You may obtain a copy
11
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software distributed under
14
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
15
+ * OF ANY KIND, either express or implied. See the License for the specific language
16
+ * governing permissions and limitations under the License.
17
+ */
18
+
19
+
20
+
21
+
22
+
23
+
24
+ export {$6d0a5c394373ae64$export$89be5a243e59c4b2 as Virtualizer, $47736c1e63ba1c6d$export$1da781778207e0a2 as useVirtualizerItem, $ccf8a0a04e4175ae$export$6796df8ba7398521 as VirtualizerItem, $ccf8a0a04e4175ae$export$1481e64fbe01b8b3 as layoutInfoToStyle, $44a6ee657928b002$export$5665e3d6be6adea as ScrollView, $44a6ee657928b002$export$2ea0c4974da4731b as useScrollView, $ce415dc67314b753$export$faf7630257ad4304 as getRTLOffsetType, $ce415dc67314b753$export$1389d168952b34b5 as getScrollLeft, $ce415dc67314b753$export$ed5fd5ffe5ab0ac as setScrollLeft};
25
+ //# sourceMappingURL=module.js.map
package/dist/main.js ADDED
@@ -0,0 +1,38 @@
1
+ var $e1fb6f3669e1c329$exports = require("./Virtualizer.main.js");
2
+ var $7d70e069fceb2deb$exports = require("./useVirtualizerItem.main.js");
3
+ var $d6a26279cc31826b$exports = require("./VirtualizerItem.main.js");
4
+ var $00ca8c0b29e3e07c$exports = require("./ScrollView.main.js");
5
+ var $efdd61e59e023a1d$exports = require("./utils.main.js");
6
+
7
+
8
+ function $parcel$export(e, n, v, s) {
9
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
10
+ }
11
+
12
+ $parcel$export(module.exports, "Virtualizer", () => $e1fb6f3669e1c329$exports.Virtualizer);
13
+ $parcel$export(module.exports, "useVirtualizerItem", () => $7d70e069fceb2deb$exports.useVirtualizerItem);
14
+ $parcel$export(module.exports, "VirtualizerItem", () => $d6a26279cc31826b$exports.VirtualizerItem);
15
+ $parcel$export(module.exports, "layoutInfoToStyle", () => $d6a26279cc31826b$exports.layoutInfoToStyle);
16
+ $parcel$export(module.exports, "ScrollView", () => $00ca8c0b29e3e07c$exports.ScrollView);
17
+ $parcel$export(module.exports, "useScrollView", () => $00ca8c0b29e3e07c$exports.useScrollView);
18
+ $parcel$export(module.exports, "getRTLOffsetType", () => $efdd61e59e023a1d$exports.getRTLOffsetType);
19
+ $parcel$export(module.exports, "getScrollLeft", () => $efdd61e59e023a1d$exports.getScrollLeft);
20
+ $parcel$export(module.exports, "setScrollLeft", () => $efdd61e59e023a1d$exports.setScrollLeft);
21
+ /*
22
+ * Copyright 2020 Adobe. All rights reserved.
23
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
24
+ * you may not use this file except in compliance with the License. You may obtain a copy
25
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
26
+ *
27
+ * Unless required by applicable law or agreed to in writing, software distributed under
28
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
29
+ * OF ANY KIND, either express or implied. See the License for the specific language
30
+ * governing permissions and limitations under the License.
31
+ */
32
+
33
+
34
+
35
+
36
+
37
+
38
+ //# sourceMappingURL=main.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC","sources":["packages/@react-aria/virtualizer/src/index.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nexport type {RTLOffsetType} from './utils';\nexport type {VirtualizerItemOptions} from './useVirtualizerItem';\nexport {Virtualizer} from './Virtualizer';\nexport {useVirtualizerItem} from './useVirtualizerItem';\nexport {VirtualizerItem, layoutInfoToStyle} from './VirtualizerItem';\nexport {ScrollView, useScrollView} from './ScrollView';\nexport {getRTLOffsetType, getScrollLeft, setScrollLeft} from './utils';\n"],"names":[],"version":3,"file":"main.js.map"}