@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.
- package/CHANGELOG.md +149 -0
- package/README.md +135 -40
- package/dist/ScrollBar.d.cts +45 -38
- package/dist/ScrollBar.d.ts +45 -38
- package/dist/ScrollBar.d.ts.map +1 -1
- package/dist/ScrollPane.d.cts +12 -14
- package/dist/ScrollPane.d.ts +12 -14
- package/dist/ScrollPane.d.ts.map +1 -1
- package/dist/VirtualGrid.d.cts +6 -6
- package/dist/VirtualGrid.d.ts +6 -6
- package/dist/VirtualGrid.d.ts.map +1 -1
- package/dist/VirtualScroll.d.cts +184 -30
- package/dist/VirtualScroll.d.ts +184 -30
- package/dist/VirtualScroll.d.ts.map +1 -1
- package/dist/cli.js +26 -47
- package/dist/index.cjs +1 -1
- package/dist/index.js +2385 -2413
- package/dist/labels.d.cts +38 -7
- package/dist/labels.d.ts +38 -7
- package/dist/labels.d.ts.map +1 -1
- package/dist/logger.d.cts +1 -16
- package/dist/logger.d.ts +1 -16
- package/dist/logger.d.ts.map +1 -1
- package/dist/styles/virtualscroll.css +1 -1
- package/dist/styles/virtualscroll.standalone.css +1 -1
- package/dist/useFenwickMapTree.d.cts +21 -1
- package/dist/useFenwickMapTree.d.ts +21 -1
- package/dist/useFenwickMapTree.d.ts.map +1 -1
- package/dist/useLruCache.d.ts.map +1 -1
- package/dist/utils.d.cts +14 -0
- package/dist/utils.d.ts +14 -0
- package/dist/utils.d.ts.map +1 -1
- package/package.json +5 -2
- package/src/ScrollBar.tsx +115 -55
- package/src/ScrollPane.tsx +12 -14
- package/src/VirtualGrid.tsx +27 -25
- package/src/VirtualScroll.tsx +486 -234
- package/src/labels.ts +58 -7
- package/src/logger.ts +1 -25
- package/src/styles/virtualscroll.css +51 -3
- package/src/useFenwickMapTree.ts +60 -98
- package/src/useLruCache.ts +14 -8
- 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
|
|
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]",
|
|
17
|
-
this.level = e, this.prefix = t, this.impl =
|
|
16
|
+
constructor(e = 2, t = "[virtualscroll]", i = console) {
|
|
17
|
+
this.level = e, this.prefix = t, this.impl = i;
|
|
18
18
|
}
|
|
19
|
-
static instance = new
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
109
|
+
r.instance.debug(e, ...t);
|
|
128
110
|
}
|
|
129
111
|
debug(e, ...t) {
|
|
130
|
-
this.level <= 0 && this.impl.debug(...this.formatMessage(
|
|
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(
|
|
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
|
-
|
|
118
|
+
r.instance.warn(e, ...t);
|
|
140
119
|
}
|
|
141
120
|
warn(e, ...t) {
|
|
142
|
-
this.level <= 2 && this.impl.warn(...this.formatMessage(
|
|
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
|
-
|
|
124
|
+
r.instance.error(e, ...t);
|
|
146
125
|
}
|
|
147
126
|
error(e, ...t) {
|
|
148
|
-
this.level <= 3 && this.impl.error(...this.formatMessage(
|
|
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),
|
|
152
|
-
function d(
|
|
153
|
-
if (
|
|
154
|
-
const e = n.join(
|
|
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", (
|
|
167
|
-
|
|
168
|
-
}), t.on("error", (
|
|
169
|
-
|
|
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
|
-
|
|
151
|
+
s.length > 0 && console.error(`Unknown command: ${s[0]}`), console.error(f), process.exit(1);
|
|
173
152
|
}
|
|
174
153
|
function u() {
|
|
175
|
-
const
|
|
176
|
-
if (!
|
|
154
|
+
const s = process.argv[1];
|
|
155
|
+
if (!s)
|
|
177
156
|
return !1;
|
|
178
157
|
try {
|
|
179
|
-
return m(a(
|
|
158
|
+
return m(a(s)).href === import.meta.url;
|
|
180
159
|
} catch {
|
|
181
160
|
return !1;
|
|
182
161
|
}
|