@effectweb/tanstack-table 0.8.0 → 0.9.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/dist/index.js +54 -46
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,48 +1,56 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
1
|
+
import {
|
|
2
|
+
constructTable
|
|
3
|
+
} from "@tanstack/table-core";
|
|
4
|
+
import { storeReactivityBindings } from "@tanstack/table-core/store-reactivity-bindings";
|
|
5
|
+
import { projectionSource, shareValue } from "effectweb/advanced";
|
|
6
|
+
export * from "@tanstack/table-core";
|
|
7
|
+
function createTable(options, project) {
|
|
8
|
+
let disposed = false;
|
|
9
|
+
const cleanups = [];
|
|
10
|
+
const reactivity = {
|
|
11
|
+
...storeReactivityBindings(),
|
|
12
|
+
addSubscription(subscription) {
|
|
13
|
+
cleanups.push(() => subscription.unsubscribe());
|
|
14
|
+
},
|
|
15
|
+
schedule(run) {
|
|
16
|
+
queueMicrotask(() => {
|
|
17
|
+
if (!disposed) run();
|
|
18
|
+
});
|
|
19
|
+
},
|
|
20
|
+
unmount() {
|
|
21
|
+
for (const stop of cleanups.splice(0).reverse()) stop();
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
const table = constructTable({
|
|
25
|
+
...options,
|
|
26
|
+
features: { ...options.features, coreReactivityFeature: reactivity }
|
|
27
|
+
});
|
|
28
|
+
const source = projectionSource({
|
|
29
|
+
project: () => structuredClone(project(table)),
|
|
30
|
+
reconcile: (previous, next) => shareValue(previous, next)
|
|
31
|
+
});
|
|
32
|
+
const state = table.store.subscribe(source.changed);
|
|
33
|
+
const settings = table.optionsStore?.subscribe(source.changed);
|
|
34
|
+
const controller = {
|
|
35
|
+
table,
|
|
36
|
+
source,
|
|
37
|
+
dispose() {
|
|
38
|
+
if (disposed) return;
|
|
39
|
+
disposed = true;
|
|
40
|
+
state.unsubscribe();
|
|
41
|
+
settings?.unsubscribe();
|
|
42
|
+
reactivity.unmount();
|
|
43
|
+
source.dispose();
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
try {
|
|
34
47
|
source.start();
|
|
35
|
-
return
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
return;
|
|
41
|
-
disposed = true;
|
|
42
|
-
state.unsubscribe();
|
|
43
|
-
settings?.unsubscribe();
|
|
44
|
-
reactivity.unmount();
|
|
45
|
-
source.dispose();
|
|
46
|
-
},
|
|
47
|
-
};
|
|
48
|
+
return controller;
|
|
49
|
+
} catch (error) {
|
|
50
|
+
controller.dispose();
|
|
51
|
+
throw error;
|
|
52
|
+
}
|
|
48
53
|
}
|
|
54
|
+
export {
|
|
55
|
+
createTable
|
|
56
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@effectweb/tanstack-table",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"@tanstack/table-core": "9.2.4"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
|
-
"effect": "4.0.0
|
|
31
|
-
"effectweb": "
|
|
30
|
+
"effect": "^4.0.0",
|
|
31
|
+
"effectweb": "0.9.0"
|
|
32
32
|
}
|
|
33
33
|
}
|