@virtuoso.dev/gurx
Advanced tools
+8
-0
| # Change Log - @virtuoso.dev/gurx | ||
| ## 1.2.1 | ||
| ### Patch Changes | ||
| - [#1361](https://github.com/petyosi/react-virtuoso/pull/1361) [`7b38166`](https://github.com/petyosi/react-virtuoso/commit/7b3816607c2b8fa3eb8818bea6e291c93a91112d) Thanks [@petyosi](https://github.com/petyosi)! - Replace ESLint and Prettier with oxlint and oxfmt for faster linting and formatting. Modernize TypeScript configuration with `verbatimModuleSyntax` and ES2022 build targets. | ||
| Source code changes are non-behavioral: stricter equality checks (`===`/`!==` instead of truthiness), `??` instead of `||` for defaults, early returns instead of else blocks, self-closing JSX tags, and removal of unnecessary JSX fragments. `LogLevel` in react-virtuoso is changed from a TypeScript enum to a const object — the named exports (`LogLevel.DEBUG`, etc.) work identically, but enum reverse-mapping (`LogLevel[0]`) is no longer supported. | ||
| ## 1.2.0 | ||
@@ -4,0 +12,0 @@ |
+21
-19
@@ -108,3 +108,3 @@ import { JSX } from 'react/jsx-runtime'; | ||
| */ | ||
| export declare function filter<I, O = I>(predicate: (value: I) => boolean): Operator<I, O>; | ||
| export declare function filter<I, R = I>(predicate: (value: I) => boolean): Operator<I, R>; | ||
@@ -127,3 +127,3 @@ export declare const getValue: Realm['getValue']; | ||
| */ | ||
| export declare function map<I, O>(mapFunction: (value: I) => O): Operator<I, O>; | ||
| export declare function map<I, R>(mapFunction: (value: I) => R): Operator<I, R>; | ||
@@ -134,3 +134,3 @@ /** | ||
| */ | ||
| export declare function mapTo<I, O>(value: O): Operator<I, O>; | ||
| export declare function mapTo<I, R>(value: R): Operator<I, R>; | ||
@@ -155,3 +155,3 @@ /** | ||
| */ | ||
| export declare type O<In, Out> = Operator<In, Out>; | ||
| export declare type O<In, Result> = Operator<In, Result>; | ||
@@ -169,3 +169,3 @@ /** | ||
| */ | ||
| export declare function onNext<I, O>(bufNode: NodeRef<O>): Operator<I, [I, O]>; | ||
| export declare function onNext<I, R>(bufNode: NodeRef<R>): Operator<I, [I, R]>; | ||
@@ -178,15 +178,15 @@ /** | ||
| */ | ||
| export declare type Operator<I, O> = (source: Out<I>, realm: Realm) => NodeRef<O>; | ||
| export declare type Operator<I, R> = (source: Out<I>, realm: Realm) => NodeRef<R>; | ||
| export declare type Out<T = unknown> = NodeRef<T> | PipeRef<unknown, T>; | ||
| export declare function Pipe<I, O>(value: O, init: (r: Realm, input$: Out<I>, output$: Out<O>) => void, distinct?: Distinct<I>): PipeRef<I, O>; | ||
| export declare function Pipe<I, Result>(value: Result, init: (r: Realm, input$: Out<I>, output$: Out<Result>) => void, distinct?: Distinct<I>): PipeRef<I, Result>; | ||
| export declare const pipe: Realm['pipe']; | ||
| export declare type PipeInit<I, O> = (r: Realm, inputRef$: NodeRef<I>, outputRef$: NodeRef<O>) => void; | ||
| export declare type PipeInit<I, R> = (r: Realm, inputRef$: NodeRef<I>, outputRef$: NodeRef<R>) => void; | ||
| export declare type PipeRef<I = unknown, O = unknown> = symbol & { | ||
| export declare type PipeRef<I = unknown, R = unknown> = symbol & { | ||
| inputType: I; | ||
| outputType: O; | ||
| outputType: R; | ||
| }; | ||
@@ -788,9 +788,9 @@ | ||
| transformer<In>(...o: []): (s: Inp<In>) => Inp<In>; | ||
| transformer<In, Out>(...o: [O<In, Out>]): (s: Inp<Out>) => Inp<In>; | ||
| transformer<In, Out, O1>(...o: [O<In, O1>, O<O1, Out>]): (s: Inp<Out>) => Inp<In>; | ||
| transformer<In, Out, O1, O2>(...o: [O<In, O1>, O<O1, O2>, O<O2, Out>]): (s: Inp<Out>) => Inp<In>; | ||
| transformer<In, Out, O1, O2, O3>(...o: [O<In, O1>, O<O1, O2>, O<O2, O3>, O<O3, Out>]): (s: Inp<Out>) => Inp<In>; | ||
| transformer<In, Out, O1, O2, O3, O4>(...o: [O<In, O1>, O<O1, O2>, O<O2, O3>, O<O3, O4>, O<O4, Out>]): (s: Inp<Out>) => Inp<In>; | ||
| transformer<In, Out, O1, O2, O3, O4, O5>(...o: [O<In, O1>, O<O1, O2>, O<O2, O3>, O<O3, O4>, O<O4, O5>, O<O5, Out>]): (s: Inp<Out>) => Inp<In>; | ||
| transformer<In, Out>(...operators: O<unknown, unknown>[]): (s: Inp<Out>) => Inp<In>; | ||
| transformer<In, Result>(...o: [O<In, Result>]): (s: Inp<Result>) => Inp<In>; | ||
| transformer<In, Result, O1>(...o: [O<In, O1>, O<O1, Result>]): (s: Inp<Result>) => Inp<In>; | ||
| transformer<In, Result, O1, O2>(...o: [O<In, O1>, O<O1, O2>, O<O2, Result>]): (s: Inp<Result>) => Inp<In>; | ||
| transformer<In, Result, O1, O2, O3>(...o: [O<In, O1>, O<O1, O2>, O<O2, O3>, O<O3, Result>]): (s: Inp<Result>) => Inp<In>; | ||
| transformer<In, Result, O1, O2, O3, O4>(...o: [O<In, O1>, O<O1, O2>, O<O2, O3>, O<O3, O4>, O<O4, Result>]): (s: Inp<Result>) => Inp<In>; | ||
| transformer<In, Result, O1, O2, O3, O4, O5>(...o: [O<In, O1>, O<O1, O2>, O<O2, O3>, O<O3, O4>, O<O4, O5>, O<O5, Result>]): (s: Inp<Result>) => Inp<In>; | ||
| transformer<In, Result>(...operators: O<unknown, unknown>[]): (s: Inp<Result>) => Inp<In>; | ||
| private calculateExecutionMap; | ||
@@ -830,3 +830,3 @@ private combineOperators; | ||
| */ | ||
| export declare function scan<I, O>(accumulator: (current: O, value: I) => O, seed: O): Operator<I, O>; | ||
| export declare function scan<I, R>(accumulator: (current: R, value: I) => R, seed: R): Operator<I, R>; | ||
@@ -879,4 +879,6 @@ /** | ||
| */ | ||
| export declare function useCell<O, I = O>(cell: NodeRef<O> | PipeRef<I, O>): [O, (value: I) => void]; | ||
| export declare function useCell<T>(cell: NodeRef<T>): [T, (value: T) => void]; | ||
| export declare function useCell<I, O>(cell: PipeRef<I, O>): [O, (value: I) => void]; | ||
| /** | ||
@@ -883,0 +885,0 @@ * Gets the current value of the cell. The component is re-rendered when the cell value changes. |
+199
-200
@@ -1,7 +0,5 @@ | ||
| var T = Object.defineProperty; | ||
| var L = (s, t, e) => t in s ? T(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e; | ||
| var g = (s, t, e) => L(s, typeof t != "symbol" ? t + "" : t, e); | ||
| import * as p from "react"; | ||
| import { jsx as A } from "react/jsx-runtime"; | ||
| class x { | ||
| import * as f from "react"; | ||
| import { jsx as N } from "react/jsx-runtime"; | ||
| class M { | ||
| map; | ||
| constructor(t = /* @__PURE__ */ new Map()) { | ||
@@ -11,3 +9,3 @@ this.map = t; | ||
| clone() { | ||
| return new x(new Map(this.map)); | ||
| return new M(new Map(this.map)); | ||
| } | ||
@@ -23,6 +21,4 @@ decrement(t, e) { | ||
| } | ||
| class C { | ||
| constructor() { | ||
| g(this, "map", /* @__PURE__ */ new Map()); | ||
| } | ||
| class w { | ||
| map = /* @__PURE__ */ new Map(); | ||
| delete(t) { | ||
@@ -43,14 +39,31 @@ return this.map.delete(t); | ||
| } | ||
| function m(s, t) { | ||
| function h(s, t) { | ||
| return t(s), s; | ||
| } | ||
| function E() { | ||
| function x() { | ||
| } | ||
| const V = "cell", j = "signal", W = "pipe"; | ||
| function R(s, t) { | ||
| const k = "cell", v = "signal", T = "pipe"; | ||
| function E(s, t) { | ||
| return s === t; | ||
| } | ||
| const w = /* @__PURE__ */ new Map(); | ||
| let M; | ||
| class K { | ||
| const y = /* @__PURE__ */ new Map(); | ||
| let S; | ||
| function L(s, t) { | ||
| const e = S; | ||
| S = s; | ||
| try { | ||
| return t(); | ||
| } finally { | ||
| S = e; | ||
| } | ||
| } | ||
| class j { | ||
| definitionRegistry = /* @__PURE__ */ new Set(); | ||
| distinctNodes = /* @__PURE__ */ new Map(); | ||
| executionMaps = /* @__PURE__ */ new Map(); | ||
| graph = new w(); | ||
| pipeMap = /* @__PURE__ */ new Map(); | ||
| singletonSubscriptions = /* @__PURE__ */ new Map(); | ||
| state = /* @__PURE__ */ new Map(); | ||
| subscriptions = new w(); | ||
| /** | ||
@@ -62,10 +75,2 @@ * Creates a new realm. | ||
| constructor(t = {}) { | ||
| g(this, "definitionRegistry", /* @__PURE__ */ new Set()); | ||
| g(this, "distinctNodes", /* @__PURE__ */ new Map()); | ||
| g(this, "executionMaps", /* @__PURE__ */ new Map()); | ||
| g(this, "graph", new C()); | ||
| g(this, "pipeMap", /* @__PURE__ */ new Map()); | ||
| g(this, "singletonSubscriptions", /* @__PURE__ */ new Map()); | ||
| g(this, "state", /* @__PURE__ */ new Map()); | ||
| g(this, "subscriptions", new C()); | ||
| for (const e of Object.getOwnPropertySymbols(t)) | ||
@@ -82,3 +87,3 @@ this.state.set(e, t[e]); | ||
| cellInstance(t, e = !0, n = Symbol()) { | ||
| return this.state.has(n) || this.state.set(n, t), e !== !1 && !this.distinctNodes.has(n) && this.distinctNodes.set(n, e === !0 ? R : e), n; | ||
| return this.state.has(n) || this.state.set(n, t), e !== !1 && !this.distinctNodes.has(n) && this.distinctNodes.set(n, e === !0 ? E : e), n; | ||
| } | ||
@@ -105,4 +110,4 @@ /** | ||
| this.connect({ | ||
| map: (i) => (r, o) => { | ||
| i(n(o, r)); | ||
| map: (i) => (r, u) => { | ||
| i(n(u, r)); | ||
| }, | ||
@@ -116,3 +121,3 @@ pulls: [t], | ||
| combine(...t) { | ||
| return m(this.signalInstance(), (e) => { | ||
| return h(this.signalInstance(), (e) => { | ||
| this.connect({ | ||
@@ -129,3 +134,3 @@ map: (n) => (...i) => { | ||
| combineCells(...t) { | ||
| return m( | ||
| return h( | ||
| this.cellInstance( | ||
@@ -162,4 +167,4 @@ t.map((e) => this.getValue(e)), | ||
| }; | ||
| for (const o of [...i, ...e]) | ||
| this.register(o), this.graph.getOrCreate(o).add(r); | ||
| for (const u of [...i, ...e]) | ||
| this.register(u), this.graph.getOrCreate(u).add(r); | ||
| this.executionMaps.clear(); | ||
@@ -190,6 +195,3 @@ } | ||
| inContext(t) { | ||
| const e = M; | ||
| M = this; | ||
| const n = t(); | ||
| return M = e, n; | ||
| return L(this, t); | ||
| } | ||
@@ -228,11 +230,10 @@ /** | ||
| pubIn(t) { | ||
| var y; | ||
| const e = Reflect.ownKeys(t).map((a) => this.pipeMap.get(a) ?? a), n = Reflect.ownKeys(t).reduce((a, u) => { | ||
| const h = u, S = t[h], f = this.pipeMap.get(h) ?? h; | ||
| return a[f] = S, a; | ||
| }, {}), i = this.getExecutionMap(e), r = i.refCount.clone(), o = i.participatingNodes.slice(), c = new Map(this.state), l = (a) => { | ||
| this.graph.use(a, (u) => { | ||
| for (const { sink: h, sources: S } of u) | ||
| S.has(a) && r.decrement(h, () => { | ||
| o.splice(o.indexOf(h), 1), l(h); | ||
| const e = Object.getOwnPropertySymbols(t).map((l) => this.pipeMap.get(l) ?? l), n = Object.getOwnPropertySymbols(t).reduce((l, o) => { | ||
| const a = t[o], b = this.pipeMap.get(o) ?? o; | ||
| return l[b] = a, l; | ||
| }, {}), i = this.getExecutionMap(e), r = i.refCount.clone(), u = i.participatingNodes.slice(), c = new Map(this.state), p = (l) => { | ||
| this.graph.use(l, (o) => { | ||
| for (const { sink: a, sources: b } of o) | ||
| b.has(l) && r.decrement(a, () => { | ||
| u.splice(u.indexOf(a), 1), p(a); | ||
| }); | ||
@@ -242,30 +243,29 @@ }); | ||
| for (; ; ) { | ||
| const a = o.shift(); | ||
| if (a === void 0) | ||
| const l = u.shift(); | ||
| if (l === void 0) | ||
| break; | ||
| const u = a; | ||
| let h = !1; | ||
| const S = (f) => { | ||
| const b = this.distinctNodes.get(u); | ||
| if (b != null && b(c.get(u), f)) { | ||
| h = !1; | ||
| const o = l; | ||
| let a = !1; | ||
| const b = (m) => { | ||
| if (this.distinctNodes.get(o)?.(c.get(o), m) === !0) { | ||
| a = !1; | ||
| return; | ||
| } | ||
| h = !0, c.set(u, f), this.state.has(u) && this.state.set(u, f); | ||
| a = !0, c.set(o, m), this.state.has(o) && this.state.set(o, m); | ||
| }; | ||
| if (Object.hasOwn(n, u) ? S(n[u]) : i.projections.use(u, (f) => { | ||
| for (const b of f) { | ||
| const k = [...Array.from(b.sources), ...Array.from(b.pulls)].map((v) => c.get(v)); | ||
| b.map(S)(...k); | ||
| if (Object.hasOwn(n, o) ? b(n[o]) : i.projections.use(o, (m) => { | ||
| for (const d of m) { | ||
| const I = [...Array.from(d.sources), ...Array.from(d.pulls)].map((P) => c.get(P)); | ||
| d.map(b)(...I); | ||
| } | ||
| }), h) { | ||
| const f = c.get(u); | ||
| }), a) { | ||
| const m = c.get(o); | ||
| this.inContext(() => { | ||
| this.subscriptions.use(u, (b) => { | ||
| for (const k of b) | ||
| k(f); | ||
| this.subscriptions.use(o, (d) => { | ||
| for (const I of d) | ||
| I(m); | ||
| }); | ||
| }), (y = this.singletonSubscriptions.get(u)) == null || y(f); | ||
| }), this.singletonSubscriptions.get(o)?.(m); | ||
| } else | ||
| l(u); | ||
| p(o); | ||
| } | ||
@@ -279,16 +279,16 @@ } | ||
| register(t) { | ||
| const e = w.get(t); | ||
| const e = y.get(t); | ||
| if (e === void 0) | ||
| return t; | ||
| if (!this.definitionRegistry.has(t)) { | ||
| if (this.definitionRegistry.add(t), e.type === V) | ||
| return m(this.cellInstance(e.initial, e.distinct, t), (o) => { | ||
| if (this.definitionRegistry.add(t), e.type === k) | ||
| return h(this.cellInstance(e.initial, e.distinct, t), (u) => { | ||
| this.inContext(() => { | ||
| e.init(this, o); | ||
| e.init(this, u); | ||
| }); | ||
| }); | ||
| if (e.type === j) | ||
| return m(this.signalInstance(e.distinct, t), (o) => { | ||
| if (e.type === v) | ||
| return h(this.signalInstance(e.distinct, t), (u) => { | ||
| this.inContext(() => { | ||
| e.init(this, o); | ||
| e.init(this, u); | ||
| }); | ||
@@ -316,3 +316,3 @@ }); | ||
| signalInstance(t = !0, e = Symbol()) { | ||
| return t !== !1 && this.distinctNodes.set(e, t === !0 ? R : t), e; | ||
| return t !== !1 && this.distinctNodes.set(e, t === !0 ? E : t), e; | ||
| } | ||
@@ -360,3 +360,2 @@ /** | ||
| } | ||
| // eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
| subMultiple(t, e) { | ||
@@ -373,14 +372,14 @@ const n = this.signalInstance(); | ||
| transformer(...t) { | ||
| return (e) => m(this.signalInstance(), (n) => (this.link(this.pipe(n, ...t), e), n)); | ||
| return (e) => h(this.signalInstance(), (n) => (this.link(this.pipe(n, ...t), e), n)); | ||
| } | ||
| calculateExecutionMap(t) { | ||
| const e = [], n = /* @__PURE__ */ new Set(), i = new C(), r = new x(), o = new C(), c = (l, y = 0) => { | ||
| r.increment(l), !n.has(l) && (this.register(l), i.use(l, (a) => { | ||
| y = Math.max(...Array.from(a).map((u) => e.indexOf(u))) + 1; | ||
| }), this.graph.use(l, (a) => { | ||
| for (const u of a) | ||
| u.sources.has(l) ? (o.getOrCreate(u.sink).add(u), c(u.sink, y)) : i.getOrCreate(u.sink).add(l); | ||
| }), n.add(l), e.splice(y, 0, l)); | ||
| const e = [], n = /* @__PURE__ */ new Set(), i = new w(), r = new M(), u = new w(), c = (p, l = 0) => { | ||
| r.increment(p), !n.has(p) && (this.register(p), i.use(p, (o) => { | ||
| l = Math.max(...Array.from(o).map((a) => e.indexOf(a))) + 1; | ||
| }), this.graph.use(p, (o) => { | ||
| for (const a of o) | ||
| a.sources.has(p) ? (u.getOrCreate(a.sink).add(a), c(a.sink, l)) : i.getOrCreate(a.sink).add(p); | ||
| }), n.add(p), e.splice(l, 0, p)); | ||
| }; | ||
| return t.forEach(c), { participatingNodes: e, pendingPulls: i, projections: o, refCount: r }; | ||
| return t.forEach(c), { participatingNodes: e, pendingPulls: i, projections: u, refCount: r }; | ||
| } | ||
@@ -403,3 +402,3 @@ combineOperators(...t) { | ||
| for (const [i, r] of this.executionMaps.entries()) | ||
| if (Array.isArray(i) && i.length === t.length && i.every((o) => t.includes(o))) | ||
| if (Array.isArray(i) && i.length === t.length && i.every((u) => t.includes(u))) | ||
| return r; | ||
@@ -410,15 +409,15 @@ const n = this.calculateExecutionMap(t); | ||
| } | ||
| function G(s, t = E, e = !0) { | ||
| return m(Symbol(), (n) => { | ||
| w.set(n, { distinct: e, init: t, initial: s, type: V }); | ||
| function D(s, t = x, e = !0) { | ||
| return h(Symbol(), (n) => { | ||
| y.set(n, { distinct: e, init: t, initial: s, type: k }); | ||
| }); | ||
| } | ||
| function Y(s, t, e = !0) { | ||
| return m(Symbol(), (n) => { | ||
| w.set(n, { distinct: e, init: t, initial: s, type: W }); | ||
| function A(s, t, e = !0) { | ||
| return h(Symbol(), (n) => { | ||
| y.set(n, { distinct: e, init: t, initial: s, type: T }); | ||
| }); | ||
| } | ||
| function z(s, t, e = !0) { | ||
| return m(Symbol(), (n) => { | ||
| w.set(n, { | ||
| function U(s, t, e = !0) { | ||
| return h(Symbol(), (n) => { | ||
| y.set(n, { | ||
| distinct: e, | ||
@@ -429,34 +428,34 @@ init: (i, r) => { | ||
| initial: s, | ||
| type: V | ||
| type: k | ||
| }); | ||
| }); | ||
| } | ||
| function B(s = E, t = !1) { | ||
| return m(Symbol(), (e) => { | ||
| w.set(e, { distinct: t, init: s, type: "signal" }); | ||
| function q(s = x, t = !1) { | ||
| return h(Symbol(), (e) => { | ||
| y.set(e, { distinct: t, init: s, type: "signal" }); | ||
| }); | ||
| } | ||
| function H(s = E) { | ||
| return m(Symbol(), (t) => { | ||
| w.set(t, { distinct: !1, init: s, type: "signal" }); | ||
| function F(s = x) { | ||
| return h(Symbol(), (t) => { | ||
| y.set(t, { distinct: !1, init: s, type: "signal" }); | ||
| }); | ||
| } | ||
| function d() { | ||
| if (!M) | ||
| function g() { | ||
| if (!S) | ||
| throw new Error("This function must be called within a realm instance"); | ||
| return M; | ||
| return S; | ||
| } | ||
| const J = (s, t) => { | ||
| d().link(s, t); | ||
| }, X = (...s) => { | ||
| d().pub(...s); | ||
| }, Z = (...s) => d().sub(...s), $ = (...s) => { | ||
| d().pubIn(...s); | ||
| }, tt = (...s) => d().pipe(...s), et = (...s) => { | ||
| d().changeWith(...s); | ||
| }, nt = (...s) => d().combine(...s), st = (s) => d().getValue(s), N = { data: null, error: null, isLoading: !0, type: "loading" }; | ||
| function it(s, t) { | ||
| return Y(N, (e, n, i) => { | ||
| function r(o) { | ||
| e.pub(i, N), s(o).then((c) => { | ||
| const G = (s, t) => { | ||
| g().link(s, t); | ||
| }, z = (...s) => { | ||
| g().pub(...s); | ||
| }, B = (...s) => g().sub(...s), H = (...s) => { | ||
| g().pubIn(...s); | ||
| }, J = (...s) => g().pipe(...s), X = (...s) => { | ||
| g().changeWith(...s); | ||
| }, Z = (...s) => g().combine(...s), $ = (s) => g().getValue(s), R = { data: null, error: null, isLoading: !0, type: "loading" }; | ||
| function tt(s, t) { | ||
| return A(R, (e, n, i) => { | ||
| function r(u) { | ||
| e.pub(i, R), s(u).then((c) => { | ||
| e.pub(i, { data: c, error: null, isLoading: !1, type: "success" }); | ||
@@ -470,4 +469,4 @@ }).catch((c) => { | ||
| } | ||
| const O = p.createContext(null); | ||
| function rt({ | ||
| const V = f.createContext(null); | ||
| function et({ | ||
| children: s, | ||
@@ -477,10 +476,10 @@ initWith: t, | ||
| }) { | ||
| const n = p.useMemo(() => new K(t), []); | ||
| return p.useEffect(() => { | ||
| const n = f.useMemo(() => new j(t), []); | ||
| return f.useEffect(() => { | ||
| n.pubIn(e); | ||
| }, [e, n]), /* @__PURE__ */ A(O.Provider, { value: n, children: s }); | ||
| }, [e, n]), /* @__PURE__ */ N(V.Provider, { value: n, children: s }); | ||
| } | ||
| const _ = typeof document < "u" ? p.useLayoutEffect : p.useEffect; | ||
| function I() { | ||
| const s = p.useContext(O); | ||
| const W = typeof document < "u" ? f.useLayoutEffect : f.useEffect; | ||
| function C() { | ||
| const s = f.useContext(V); | ||
| if (s === null) | ||
@@ -490,7 +489,7 @@ throw new Error("useRealm must be used within a RealmContextProvider"); | ||
| } | ||
| function Q(s) { | ||
| const t = I(); | ||
| function Y(s) { | ||
| const t = C(); | ||
| t.register(s); | ||
| const e = p.useCallback((n) => t.sub(s, n), [t, s]); | ||
| return p.useSyncExternalStore( | ||
| const e = f.useCallback((n) => t.sub(s, n), [t, s]); | ||
| return f.useSyncExternalStore( | ||
| e, | ||
@@ -501,7 +500,7 @@ () => t.getValue(s), | ||
| } | ||
| function D(s) { | ||
| const t = I(); | ||
| function _(s) { | ||
| const t = C(); | ||
| t.register(s); | ||
| const [e, n] = p.useState(() => t.getValue(s)); | ||
| return _(() => { | ||
| const [e, n] = f.useState(() => t.getValue(s)); | ||
| return W(() => { | ||
| const i = t.sub(s, () => { | ||
@@ -515,10 +514,10 @@ n(() => t.getValue(s)); | ||
| } | ||
| const P = "useSyncExternalStore" in p ? Q : D; | ||
| function ot(...s) { | ||
| const t = I(), e = p.useMemo(() => t.combineCells(...s), [t, ...s]); | ||
| return P(e); | ||
| const O = "useSyncExternalStore" in f ? Y : _; | ||
| function nt(...s) { | ||
| const t = C(), e = f.useMemo(() => t.combineCells(...s), [t, ...s]); | ||
| return O(e); | ||
| } | ||
| function U(s) { | ||
| const t = I(); | ||
| return t.register(s), p.useCallback( | ||
| function K(s) { | ||
| const t = C(); | ||
| return t.register(s), f.useCallback( | ||
| (e) => { | ||
@@ -530,6 +529,6 @@ t.pub(s, e); | ||
| } | ||
| function ut(s) { | ||
| return [P(s), U(s)]; | ||
| function st(s) { | ||
| return [O(s), K(s)]; | ||
| } | ||
| function ct(s) { | ||
| function it(s) { | ||
| return ((t, e) => { | ||
@@ -546,3 +545,3 @@ const n = e.signalInstance(); | ||
| } | ||
| function at(...s) { | ||
| function rt(...s) { | ||
| return ((t, e) => { | ||
@@ -560,3 +559,3 @@ const n = e.signalInstance(); | ||
| } | ||
| function lt(s) { | ||
| function ut(s) { | ||
| return (t, e) => { | ||
@@ -573,3 +572,3 @@ const n = e.signalInstance(); | ||
| } | ||
| function pt(s) { | ||
| function ot(s) { | ||
| return (t, e) => { | ||
@@ -586,3 +585,3 @@ const n = e.signalInstance(); | ||
| } | ||
| function ht() { | ||
| function ct() { | ||
| return (s, t) => { | ||
@@ -600,8 +599,8 @@ const e = t.signalInstance(); | ||
| } | ||
| function ft(s, t) { | ||
| function at(s, t) { | ||
| return (e, n) => { | ||
| const i = n.signalInstance(); | ||
| return n.connect({ | ||
| map: (r) => (o) => { | ||
| r(t = s(t, o)); | ||
| map: (r) => (u) => { | ||
| r(t = s(t, u)); | ||
| }, | ||
@@ -613,8 +612,8 @@ sink: i, | ||
| } | ||
| function gt(s) { | ||
| function lt(s) { | ||
| return (t, e) => { | ||
| const n = e.signalInstance(); | ||
| let i, r = null; | ||
| return e.sub(t, (o) => { | ||
| i = o, r === null && (r = setTimeout(() => { | ||
| return e.sub(t, (u) => { | ||
| i = u, r === null && (r = setTimeout(() => { | ||
| r = null, e.pub(n, i); | ||
@@ -625,8 +624,8 @@ }, s)); | ||
| } | ||
| function mt(s) { | ||
| function pt(s) { | ||
| return (t, e) => { | ||
| const n = e.signalInstance(); | ||
| let i, r = null; | ||
| return e.sub(t, (o) => { | ||
| i = o, r !== null && clearTimeout(r), r = setTimeout(() => { | ||
| return e.sub(t, (u) => { | ||
| i = u, r !== null && clearTimeout(r), r = setTimeout(() => { | ||
| e.pub(n, i); | ||
@@ -637,3 +636,3 @@ }, s); | ||
| } | ||
| function bt() { | ||
| function ft() { | ||
| return (s, t) => { | ||
@@ -648,3 +647,3 @@ const e = t.signalInstance(); | ||
| } | ||
| function dt(s) { | ||
| function ht(s) { | ||
| return (t, e) => { | ||
@@ -654,21 +653,21 @@ const n = e.signalInstance(), i = Symbol(); | ||
| return e.connect({ | ||
| map: (o) => (c) => { | ||
| r !== i && (o([r, c]), r = i); | ||
| map: (u) => (c) => { | ||
| r !== i && (u([r, c]), r = i); | ||
| }, | ||
| sink: n, | ||
| sources: [s] | ||
| }), e.sub(t, (o) => { | ||
| r = o; | ||
| }), e.sub(t, (u) => { | ||
| r = u; | ||
| }), n; | ||
| }; | ||
| } | ||
| function yt(s, t, e) { | ||
| function mt(s, t, e) { | ||
| return (n, i) => { | ||
| const r = i.signalInstance(); | ||
| return i.sub(n, (o) => { | ||
| o !== null && typeof o == "object" && "then" in o ? (i.pub(r, s()), o.then((c) => { | ||
| return i.sub(n, (u) => { | ||
| u !== null && typeof u == "object" && "then" in u ? (i.pub(r, s()), u.then((c) => { | ||
| i.pub(r, t(c)); | ||
| }).catch((c) => { | ||
| i.pub(r, e(c)); | ||
| })) : i.pub(r, t(o)); | ||
| })) : i.pub(r, t(u)); | ||
| }), r; | ||
@@ -678,36 +677,36 @@ }; | ||
| export { | ||
| H as Action, | ||
| it as AsyncQuery, | ||
| G as Cell, | ||
| z as DerivedCell, | ||
| Y as Pipe, | ||
| K as Realm, | ||
| O as RealmContext, | ||
| rt as RealmProvider, | ||
| B as Signal, | ||
| et as changeWith, | ||
| nt as combine, | ||
| mt as debounceTime, | ||
| R as defaultComparator, | ||
| bt as delayWithMicrotask, | ||
| pt as filter, | ||
| st as getValue, | ||
| yt as handlePromise, | ||
| J as link, | ||
| ct as map, | ||
| lt as mapTo, | ||
| dt as onNext, | ||
| ht as once, | ||
| tt as pipe, | ||
| X as pub, | ||
| $ as pubIn, | ||
| ft as scan, | ||
| Z as sub, | ||
| gt as throttleTime, | ||
| ut as useCell, | ||
| P as useCellValue, | ||
| ot as useCellValues, | ||
| U as usePublisher, | ||
| I as useRealm, | ||
| at as withLatestFrom | ||
| F as Action, | ||
| tt as AsyncQuery, | ||
| D as Cell, | ||
| U as DerivedCell, | ||
| A as Pipe, | ||
| j as Realm, | ||
| V as RealmContext, | ||
| et as RealmProvider, | ||
| q as Signal, | ||
| X as changeWith, | ||
| Z as combine, | ||
| pt as debounceTime, | ||
| E as defaultComparator, | ||
| ft as delayWithMicrotask, | ||
| ot as filter, | ||
| $ as getValue, | ||
| mt as handlePromise, | ||
| G as link, | ||
| it as map, | ||
| ut as mapTo, | ||
| ht as onNext, | ||
| ct as once, | ||
| J as pipe, | ||
| z as pub, | ||
| H as pubIn, | ||
| at as scan, | ||
| B as sub, | ||
| lt as throttleTime, | ||
| st as useCell, | ||
| O as useCellValue, | ||
| nt as useCellValues, | ||
| K as usePublisher, | ||
| C as useRealm, | ||
| rt as withLatestFrom | ||
| }; |
+37
-30
| { | ||
| "name": "@virtuoso.dev/gurx", | ||
| "version": "1.2.1", | ||
| "private": false, | ||
| "license": "MIT", | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "git+https://github.com/petyosi/react-virtuoso.git", | ||
| "directory": "packages/gurx" | ||
| }, | ||
| "files": [ | ||
| "dist", | ||
| "CHANGELOG.md" | ||
| ], | ||
| "type": "module", | ||
| "sideEffects": false, | ||
| "type": "module", | ||
| "version": "1.2.0", | ||
| "main": "dist/index.js", | ||
| "module": "dist/index.js", | ||
| "main": "dist/index.js", | ||
| "types": "dist/index.d.ts", | ||
| "exports": { | ||
| ".": { | ||
| "types": "./dist/index.d.ts", | ||
| "default": "./dist/index.js" | ||
| } | ||
| }, | ||
| "publishConfig": { | ||
@@ -14,15 +30,5 @@ "access": "public", | ||
| }, | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "git+https://github.com/petyosi/react-virtuoso.git", | ||
| "directory": "packages/gurx" | ||
| }, | ||
| "license": "MIT", | ||
| "peerDependencies": { | ||
| "react": ">= 16 || >= 17 || >= 18 || >= 19", | ||
| "react-dom": ">= 16 || >= 17 || >= 18 || >= 19" | ||
| }, | ||
| "devDependencies": { | ||
| "@microsoft/api-extractor": "^7.55.1", | ||
| "@types/node": "^22.10.1", | ||
| "@types/node": "^22.19.1", | ||
| "@types/react": "^19.2.7", | ||
@@ -33,25 +39,26 @@ "@types/react-dom": "^19.2.3", | ||
| "@vitest/browser-playwright": "^4.0.16", | ||
| "eslint": "^9.24.0", | ||
| "playwright": "^1.49.0", | ||
| "prettier": "^3.5.3", | ||
| "react": "^19.2.0", | ||
| "react-dom": "^19.2.0", | ||
| "typescript": "~5.9.3", | ||
| "playwright": "^1.58.2", | ||
| "react": "^19.2.3", | ||
| "react-dom": "^19.2.3", | ||
| "typescript": "^5.9.3", | ||
| "vite": "^6.4.1", | ||
| "vite-plugin-dts": "^4.5.4", | ||
| "vitest": "^4.0.16", | ||
| "vitest-browser-react": "^2.0.2", | ||
| "@virtuoso.dev/tooling": "0.1.0" | ||
| "vitest-browser-react": "^2.0.2" | ||
| }, | ||
| "files": [ | ||
| "dist", | ||
| "CHANGELOG.md" | ||
| ], | ||
| "peerDependencies": { | ||
| "react": ">= 16 || >= 17 || >= 18 || >= 19", | ||
| "react-dom": ">= 16 || >= 17 || >= 18 || >= 19" | ||
| }, | ||
| "scripts": { | ||
| "build": "tsc && vite build", | ||
| "test": "vitest", | ||
| "ci-lint": "eslint", | ||
| "lint": "eslint", | ||
| "typecheck": "tsgo --noEmit" | ||
| "test": "vitest run --browser.headless", | ||
| "test:browser": "vitest run --project=browser", | ||
| "test:node": "vitest run --project=node", | ||
| "test:watch": "vitest", | ||
| "lint": "oxlint --type-aware --type-check", | ||
| "typecheck": "tsgo --noEmit", | ||
| "format": "oxfmt", | ||
| "format:check": "oxfmt --check" | ||
| } | ||
| } |
74298
1.18%15
-16.67%