@aiquants/virtualscroll 3.9.2 → 3.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/CHANGELOG.md +149 -0
  2. package/README.md +135 -40
  3. package/dist/ScrollBar.d.cts +45 -38
  4. package/dist/ScrollBar.d.ts +45 -38
  5. package/dist/ScrollBar.d.ts.map +1 -1
  6. package/dist/ScrollPane.d.cts +12 -14
  7. package/dist/ScrollPane.d.ts +12 -14
  8. package/dist/ScrollPane.d.ts.map +1 -1
  9. package/dist/VirtualGrid.d.cts +6 -6
  10. package/dist/VirtualGrid.d.ts +6 -6
  11. package/dist/VirtualGrid.d.ts.map +1 -1
  12. package/dist/VirtualScroll.d.cts +184 -30
  13. package/dist/VirtualScroll.d.ts +184 -30
  14. package/dist/VirtualScroll.d.ts.map +1 -1
  15. package/dist/cli.js +26 -47
  16. package/dist/index.cjs +1 -1
  17. package/dist/index.js +2385 -2413
  18. package/dist/labels.d.cts +38 -7
  19. package/dist/labels.d.ts +38 -7
  20. package/dist/labels.d.ts.map +1 -1
  21. package/dist/logger.d.cts +1 -16
  22. package/dist/logger.d.ts +1 -16
  23. package/dist/logger.d.ts.map +1 -1
  24. package/dist/styles/virtualscroll.css +1 -1
  25. package/dist/styles/virtualscroll.standalone.css +1 -1
  26. package/dist/useFenwickMapTree.d.cts +21 -1
  27. package/dist/useFenwickMapTree.d.ts +21 -1
  28. package/dist/useFenwickMapTree.d.ts.map +1 -1
  29. package/dist/useLruCache.d.ts.map +1 -1
  30. package/dist/utils.d.cts +14 -0
  31. package/dist/utils.d.ts +14 -0
  32. package/dist/utils.d.ts.map +1 -1
  33. package/package.json +5 -2
  34. package/src/ScrollBar.tsx +115 -55
  35. package/src/ScrollPane.tsx +12 -14
  36. package/src/VirtualGrid.tsx +27 -25
  37. package/src/VirtualScroll.tsx +486 -234
  38. package/src/labels.ts +58 -7
  39. package/src/logger.ts +1 -25
  40. package/src/styles/virtualscroll.css +51 -3
  41. package/src/useFenwickMapTree.ts +60 -98
  42. package/src/useLruCache.ts +14 -8
  43. package/src/utils.ts +15 -0
package/dist/cli.js CHANGED
@@ -3,7 +3,7 @@ import { spawn as o } from "node:child_process";
3
3
  import { realpathSync as a, existsSync as l } from "node:fs";
4
4
  import n from "node:path";
5
5
  import { fileURLToPath as c, pathToFileURL as m } from "node:url";
6
- class i {
6
+ class r {
7
7
  level;
8
8
  prefix;
9
9
  impl;
@@ -13,10 +13,10 @@ class i {
13
13
  * @param {string} [prefix="[virtualscroll]"] - The prefix to add to all log messages.
14
14
  * @param {ILogger} [impl=console] - The implementation to use for logging.
15
15
  */
16
- constructor(e = 2, t = "[virtualscroll]", s = console) {
17
- this.level = e, this.prefix = t, this.impl = s;
16
+ constructor(e = 2, t = "[virtualscroll]", i = console) {
17
+ this.level = e, this.prefix = t, this.impl = i;
18
18
  }
19
- static instance = new i(2, "[virtualscroll]");
19
+ static instance = new r(2, "[virtualscroll]");
20
20
  /**
21
21
  * @method setLevel
22
22
  * @description Updates the current log level for the static instance.
@@ -24,7 +24,7 @@ class i {
24
24
  * @param {LogLevel} level - The new log level.
25
25
  */
26
26
  static setLevel(e) {
27
- i.instance.setLevel(e);
27
+ r.instance.setLevel(e);
28
28
  }
29
29
  /**
30
30
  * @method setLevel
@@ -42,7 +42,7 @@ class i {
42
42
  * @param {ILogger} impl - The new logger implementation.
43
43
  */
44
44
  static setImplementation(e) {
45
- i.instance.setImplementation(e);
45
+ r.instance.setImplementation(e);
46
46
  }
47
47
  /**
48
48
  * @method setImplementation
@@ -53,24 +53,6 @@ class i {
53
53
  setImplementation(e) {
54
54
  this.impl = e;
55
55
  }
56
- /**
57
- * @method setPrefix
58
- * @description Updates the log prefix for the static instance.
59
- * @description 静的インスタンスのログのプレフィックスを更新します。
60
- * @param {string} prefix - The new prefix.
61
- */
62
- static setPrefix(e) {
63
- i.instance.setPrefix(e);
64
- }
65
- /**
66
- * @method setPrefix
67
- * @description Updates the log prefix.
68
- * @description ログのプレフィックスを更新します。
69
- * @param {string} prefix - The new prefix.
70
- */
71
- setPrefix(e) {
72
- this.prefix = e;
73
- }
74
56
  /**
75
57
  * @method isEnabled
76
58
  * @description Returns whether the given level would be emitted at the current level (static instance).
@@ -79,7 +61,7 @@ class i {
79
61
  * @returns {boolean} True if a message at `level` would be emitted. / `level` のメッセージが出力されるなら true。
80
62
  */
81
63
  static isEnabled(e) {
82
- return i.instance.isEnabled(e);
64
+ return r.instance.isEnabled(e);
83
65
  }
84
66
  /**
85
67
  * @method isEnabled
@@ -124,34 +106,31 @@ class i {
124
106
  return typeof e == "string" ? [`${this.prefix} ${e}`] : [this.prefix, e];
125
107
  }
126
108
  static debug(e, ...t) {
127
- i.instance.debug(e, ...t);
109
+ r.instance.debug(e, ...t);
128
110
  }
129
111
  debug(e, ...t) {
130
- this.level <= 0 && this.impl.debug(...this.formatMessage(i.resolveLazy(e)), ...t.map(i.resolveLazy));
131
- }
132
- static info(e, ...t) {
133
- i.instance.info(e, ...t);
112
+ this.level <= 0 && this.impl.debug(...this.formatMessage(r.resolveLazy(e)), ...t.map(r.resolveLazy));
134
113
  }
135
114
  info(e, ...t) {
136
- this.level <= 1 && this.impl.info(...this.formatMessage(i.resolveLazy(e)), ...t.map(i.resolveLazy));
115
+ this.level <= 1 && this.impl.info(...this.formatMessage(r.resolveLazy(e)), ...t.map(r.resolveLazy));
137
116
  }
138
117
  static warn(e, ...t) {
139
- i.instance.warn(e, ...t);
118
+ r.instance.warn(e, ...t);
140
119
  }
141
120
  warn(e, ...t) {
142
- this.level <= 2 && this.impl.warn(...this.formatMessage(i.resolveLazy(e)), ...t.map(i.resolveLazy));
121
+ this.level <= 2 && this.impl.warn(...this.formatMessage(r.resolveLazy(e)), ...t.map(r.resolveLazy));
143
122
  }
144
123
  static error(e, ...t) {
145
- i.instance.error(e, ...t);
124
+ r.instance.error(e, ...t);
146
125
  }
147
126
  error(e, ...t) {
148
- this.level <= 3 && this.impl.error(...this.formatMessage(i.resolveLazy(e)), ...t.map(i.resolveLazy));
127
+ this.level <= 3 && this.impl.error(...this.formatMessage(r.resolveLazy(e)), ...t.map(r.resolveLazy));
149
128
  }
150
129
  }
151
- const p = c(import.meta.url), f = n.dirname(p), h = "Usage: npx @aiquants/virtualscroll demo";
152
- function d(r) {
153
- if (r[0] === "demo") {
154
- const e = n.join(f, "..", "demo");
130
+ const p = c(import.meta.url), h = n.dirname(p), f = "Usage: npx @aiquants/virtualscroll demo";
131
+ function d(s) {
132
+ if (s[0] === "demo") {
133
+ const e = n.join(h, "..", "demo");
155
134
  l(e) || (console.error(
156
135
  `The 'demo' command is only available in a source checkout of @aiquants/virtualscroll.
157
136
  The demo app is not bundled in the published npm package.
@@ -163,20 +142,20 @@ To run it, clone the repository and inside the 'demo/' directory run:
163
142
  stdio: "inherit",
164
143
  shell: process.platform === "win32"
165
144
  });
166
- t.on("close", (s) => {
167
- s !== 0 && (i.error(`Demo server process exited with code ${s}`), process.exitCode = s ?? 1);
168
- }), t.on("error", (s) => {
169
- i.error("Failed to start demo server:", s), process.exitCode = 1;
145
+ t.on("close", (i) => {
146
+ i !== 0 && (r.error(`Demo server process exited with code ${i}`), process.exitCode = i ?? 1);
147
+ }), t.on("error", (i) => {
148
+ r.error("Failed to start demo server:", i), process.exitCode = 1;
170
149
  });
171
150
  } else
172
- r.length > 0 && console.error(`Unknown command: ${r[0]}`), console.error(h), process.exit(1);
151
+ s.length > 0 && console.error(`Unknown command: ${s[0]}`), console.error(f), process.exit(1);
173
152
  }
174
153
  function u() {
175
- const r = process.argv[1];
176
- if (!r)
154
+ const s = process.argv[1];
155
+ if (!s)
177
156
  return !1;
178
157
  try {
179
- return m(a(r)).href === import.meta.url;
158
+ return m(a(s)).href === import.meta.url;
180
159
  } catch {
181
160
  return !1;
182
161
  }