virtua 0.44.1 → 0.44.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.
@@ -1,15 +1,4 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.WindowVirtualizer = exports.Virtualizer = exports.VList = void 0;
7
- /**
8
- * @module svelte
9
- */
10
- var VList_svelte_1 = require("./VList.svelte");
11
- Object.defineProperty(exports, "VList", { enumerable: true, get: function () { return __importDefault(VList_svelte_1).default; } });
12
- var Virtualizer_svelte_1 = require("./Virtualizer.svelte");
13
- Object.defineProperty(exports, "Virtualizer", { enumerable: true, get: function () { return __importDefault(Virtualizer_svelte_1).default; } });
14
- var WindowVirtualizer_svelte_1 = require("./WindowVirtualizer.svelte");
15
- Object.defineProperty(exports, "WindowVirtualizer", { enumerable: true, get: function () { return __importDefault(WindowVirtualizer_svelte_1).default; } });
1
+ export { default as VList } from './VList.svelte';
2
+ export { default as Virtualizer } from './Virtualizer.svelte';
3
+ export { default as WindowVirtualizer } from './WindowVirtualizer.svelte';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
@@ -1,8 +1,11 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.defaultGetKey = exports.styleToString = void 0;
4
- exports.iterRange = iterRange;
5
- const index_js_1 = require("../core/index.js");
1
+ /** @internal */
2
+ /**
3
+ * @internal
4
+ */
5
+ const sort = (arr) => {
6
+ return [...arr].sort((a, b) => a - b);
7
+ };
8
+
6
9
  const styleToString = (obj) => {
7
10
  return Object.keys(obj).reduce((acc, k) => {
8
11
  const value = obj[k];
@@ -12,16 +15,14 @@ const styleToString = (obj) => {
12
15
  return acc + `${k}:${value};`;
13
16
  }, "");
14
17
  };
15
- exports.styleToString = styleToString;
16
18
  const defaultGetKey = (_data, i) => "_" + i;
17
- exports.defaultGetKey = defaultGetKey;
18
19
  function* iterRange([start, end], keepMounted) {
19
20
  if (keepMounted) {
20
21
  const mounted = new Set(keepMounted);
21
22
  for (let i = start; i <= end; i++) {
22
23
  mounted.add(i);
23
24
  }
24
- for (const index of (0, index_js_1.sort)([...mounted])) {
25
+ for (const index of sort([...mounted])) {
25
26
  yield index;
26
27
  }
27
28
  }
@@ -31,3 +32,6 @@ function* iterRange([start, end], keepMounted) {
31
32
  }
32
33
  }
33
34
  }
35
+
36
+ export { defaultGetKey, iterRange, styleToString };
37
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sources":["../../../src/core/utils.ts","../../../src/svelte/utils.ts"],"sourcesContent":["/** @internal */\nexport const NULL = null;\n\n/** @internal */\nexport const { min, max, abs, floor } = Math;\n\n/**\n * @internal\n */\nexport const clamp = (\n value: number,\n minValue: number,\n maxValue: number\n): number => min(maxValue, max(minValue, value));\n\n/**\n * @internal\n */\nexport const sort = <T extends number>(arr: readonly T[]): T[] => {\n return [...arr].sort((a, b) => a - b);\n};\n\n/**\n * @internal\n */\nexport const microtask: (fn: () => void) => void =\n typeof queueMicrotask === \"function\"\n ? queueMicrotask\n : (fn) => {\n Promise.resolve().then(fn);\n };\n\n/**\n * @internal\n */\nexport const createPromise = <T = void>(): [Promise<T>, (arg: T) => void] => {\n let resolve: ((arg: T) => void) | undefined;\n const promise = new Promise<T>((res) => {\n resolve = res;\n });\n return [promise, resolve!];\n};\n\n/**\n * @internal\n */\nexport const once = <T>(fn: () => T): (() => T) => {\n let cache: T;\n\n return () => {\n if (fn) {\n cache = fn();\n fn = undefined!;\n }\n return cache;\n };\n};\n","import { sort, type ItemsRange } from \"../core/index.js\";\n\nexport const styleToString = (\n obj: Record<string, string | undefined>\n): string => {\n return Object.keys(obj).reduce((acc, k) => {\n const value = obj[k];\n if (value == null) {\n return acc;\n }\n return acc + `${k}:${value};`;\n }, \"\");\n};\n\nexport const defaultGetKey = (_data: unknown, i: number) => \"_\" + i;\n\nexport function* iterRange(\n [start, end]: ItemsRange,\n keepMounted?: readonly number[]\n) {\n if (keepMounted) {\n const mounted = new Set(keepMounted);\n for (let i = start; i <= end; i++) {\n mounted.add(i);\n }\n for (const index of sort([...mounted])) {\n yield index;\n }\n } else {\n for (let i = start; i <= end; i++) {\n yield i;\n }\n }\n}\n"],"names":[],"mappings":"AAAA;AAeA;;AAEG;AACI,MAAM,IAAI,GAAG,CAAmB,GAAiB,KAAS;AAC/D,IAAA,OAAO,CAAC,GAAG,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;AACvC,CAAC;;AClBM,MAAM,aAAa,GAAG,CAC3B,GAAuC,KAC7B;AACV,IAAA,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,KAAI;AACxC,QAAA,MAAM,KAAK,GAAG,GAAG,CAAC,CAAC,CAAC;AACpB,QAAA,IAAI,KAAK,IAAI,IAAI,EAAE;AACjB,YAAA,OAAO,GAAG;QACZ;AACA,QAAA,OAAO,GAAG,GAAG,CAAA,EAAG,CAAC,CAAA,CAAA,EAAI,KAAK,GAAG;IAC/B,CAAC,EAAE,EAAE,CAAC;AACR;AAEO,MAAM,aAAa,GAAG,CAAC,KAAc,EAAE,CAAS,KAAK,GAAG,GAAG;AAE5D,UAAW,SAAS,CACxB,CAAC,KAAK,EAAE,GAAG,CAAa,EACxB,WAA+B,EAAA;IAE/B,IAAI,WAAW,EAAE;AACf,QAAA,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,WAAW,CAAC;AACpC,QAAA,KAAK,IAAI,CAAC,GAAG,KAAK,EAAE,CAAC,IAAI,GAAG,EAAE,CAAC,EAAE,EAAE;AACjC,YAAA,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;QAChB;QACA,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,EAAE;AACtC,YAAA,MAAM,KAAK;QACb;IACF;SAAO;AACL,QAAA,KAAK,IAAI,CAAC,GAAG,KAAK,EAAE,CAAC,IAAI,GAAG,EAAE,CAAC,EAAE,EAAE;AACjC,YAAA,MAAM,CAAC;QACT;IACF;AACF;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "virtua",
3
- "version": "0.44.1",
3
+ "version": "0.44.2",
4
4
  "description": "A zero-config, fast and small (~3kB) virtual list (and grid) component for React, Vue, Solid and Svelte.",
5
5
  "main": "lib/index.cjs",
6
6
  "module": "lib/index.js",
@@ -122,6 +122,7 @@
122
122
  "rimraf": "^6.0.1",
123
123
  "rollup": "^4.50.1",
124
124
  "rollup-plugin-banner2": "^1.3.1",
125
+ "rollup-plugin-copy": "^3.5.0",
125
126
  "size-limit": "^11.2.0",
126
127
  "solid-js": "^1.9.9",
127
128
  "storybook": "^9.1.7",
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });