@flowgram.ai/variable-core 0.3.1 → 0.3.3
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/esm/index.js +15 -5
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.mts +1 -3
- package/dist/index.d.ts +1 -3
- package/dist/index.js +13 -4
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/esm/index.js
CHANGED
|
@@ -1684,8 +1684,9 @@ var ScopeOutputData = class {
|
|
|
1684
1684
|
// src/scope/datas/scope-available-data.ts
|
|
1685
1685
|
import {
|
|
1686
1686
|
Subject as Subject3,
|
|
1687
|
+
animationFrameScheduler as animationFrameScheduler2,
|
|
1688
|
+
debounceTime as debounceTime2,
|
|
1687
1689
|
distinctUntilChanged as distinctUntilChanged3,
|
|
1688
|
-
distinctUntilKeyChanged,
|
|
1689
1690
|
map as map3,
|
|
1690
1691
|
merge as merge2,
|
|
1691
1692
|
share as share3,
|
|
@@ -1818,16 +1819,25 @@ var ScopeAvailableData = class {
|
|
|
1818
1819
|
* @returns
|
|
1819
1820
|
*/
|
|
1820
1821
|
trackByKeyPath(keyPath = [], cb, opts) {
|
|
1821
|
-
const { triggerOnInit = true } = opts || {};
|
|
1822
|
+
const { triggerOnInit = true, debounceAnimation, selector } = opts || {};
|
|
1822
1823
|
return subsToDisposable(
|
|
1823
1824
|
merge2(this.anyVariableChange$, this.variables$).pipe(
|
|
1824
1825
|
triggerOnInit ? startWith() : tap2(() => null),
|
|
1825
1826
|
map3(() => {
|
|
1826
1827
|
const v = this.getByKeyPath(keyPath);
|
|
1827
|
-
return
|
|
1828
|
+
return selector ? selector(v) : v;
|
|
1828
1829
|
}),
|
|
1829
|
-
|
|
1830
|
-
|
|
1830
|
+
distinctUntilChanged3(
|
|
1831
|
+
(a, b) => shallowEqual7(a, b),
|
|
1832
|
+
(value) => {
|
|
1833
|
+
if (value instanceof ASTNode) {
|
|
1834
|
+
return value.hash;
|
|
1835
|
+
}
|
|
1836
|
+
return value;
|
|
1837
|
+
}
|
|
1838
|
+
),
|
|
1839
|
+
// 每个 animationFrame 内所有更新合并成一个
|
|
1840
|
+
debounceAnimation ? debounceTime2(0, animationFrameScheduler2) : tap2(() => null)
|
|
1831
1841
|
).subscribe(cb)
|
|
1832
1842
|
);
|
|
1833
1843
|
}
|