@effectweb/tanstack-table 0.8.0 → 0.8.1

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 (2) hide show
  1. package/dist/index.js +49 -47
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -1,48 +1,50 @@
1
- import { constructTable, } from '@tanstack/table-core';
2
- import { storeReactivityBindings } from '@tanstack/table-core/store-reactivity-bindings';
3
- import { projectionSource, shareValue } from 'effectweb/advanced';
4
- export * from '@tanstack/table-core';
5
- export function createTable(options, project) {
6
- let disposed = false;
7
- const cleanups = [];
8
- const reactivity = {
9
- ...storeReactivityBindings(),
10
- addSubscription(subscription) {
11
- cleanups.push(() => subscription.unsubscribe());
12
- },
13
- schedule(run) {
14
- queueMicrotask(() => {
15
- if (!disposed)
16
- run();
17
- });
18
- },
19
- unmount() {
20
- for (const stop of cleanups.splice(0).reverse())
21
- 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
- source.start();
35
- return {
36
- table,
37
- source,
38
- dispose() {
39
- if (disposed)
40
- return;
41
- disposed = true;
42
- state.unsubscribe();
43
- settings?.unsubscribe();
44
- reactivity.unmount();
45
- source.dispose();
46
- },
47
- };
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
+ source.start();
35
+ return {
36
+ table,
37
+ source,
38
+ dispose() {
39
+ if (disposed) return;
40
+ disposed = true;
41
+ state.unsubscribe();
42
+ settings?.unsubscribe();
43
+ reactivity.unmount();
44
+ source.dispose();
45
+ }
46
+ };
48
47
  }
48
+ export {
49
+ createTable
50
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@effectweb/tanstack-table",
3
- "version": "0.8.0",
3
+ "version": "0.8.1",
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-rc.112",
31
- "effectweb": "^0.8.0"
30
+ "effect": "4.0.0-rc.118",
31
+ "effectweb": "^0.8.1"
32
32
  }
33
33
  }