Socket
Socket
Sign inDemoInstall

@mdxeditor/gurx

Package Overview
Dependencies
5
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0 to 1.0.1

12

dist/index.d.ts

@@ -25,4 +25,4 @@ import { JSX as JSX_2 } from 'react/jsx-runtime';

* @param value - the initial value of the node. Stateful nodes always have a value.
* @param init - an optional function that will be called when the node is registered in a realm. Can be used to create subscriptions and define relationships to other nodes. Any referred nodes will be registered in the realm automatically.
* @param distinct - if true, the node will only emit values that are different from the previous value. Optionally, a custom distinct function can be provided if the node values are non-primitive.
* @param init - an optional function that will be called when the node is registered in a realm. Can be used to create subscriptions and define relationships to other nodes. Any referred nodes will be registered in the realm automatically.
* @example

@@ -40,3 +40,3 @@ * ```ts

*/
export declare function Cell<T>(value: T, distinct?: Distinct<T>, init?: (r: Realm) => void): NodeRef<T>;
export declare function Cell<T>(value: T, init?: (r: Realm) => void, distinct?: Distinct<T>): NodeRef<T>;

@@ -169,3 +169,3 @@ /**

* @param value - the initial value of the cell
* @param distinct - false by default. Pass true to mark the cell as a distinct one, or a custom comparator in case of a non-primitive value.
* @param distinct - true by default. Pass false to mark the signal as a non-distinct one, meaning that publishing the same value multiple times will re-trigger a recomputation cycle.
* @param node - optional, a reference to a cell. If the cell has not been touched in the realm before, the realm will instantiate a reference to it. If it's registered already, the function will return the reference.

@@ -177,3 +177,3 @@ */

* @returns a reference to the signal.
* @param distinct - false by default. Pass true to mark the signal as a distinct one, or a custom comparator in case of a non-primitive value.
* @param distinct - true by default. Pass false to mark the signal as a non-distinct one, meaning that publishing the same value multiple times will re-trigger a recomputation cycle.
* @param node - optional, a reference to a signal. If the signal has not been touched in the realm before, the realm will instantiate a reference to it. If it's registered already, the function will return the reference.

@@ -471,4 +471,4 @@ */

* Once a realm instance publishes or subscribes to the node, an instance of that node it will be registered in the realm.
* @param distinct - if true, the node will only emit values that are different from the previous value. Optionally, a custom distinct function can be provided if the node values are non-primitive.
* @param init - an optional function that will be called when the node is registered in a realm. Can be used to create subscriptions and define relationships to other nodes. Any referred nodes will be registered in the realm automatically.
* @param distinct - true by default. The node emits values that are different from the previous value. Optionally, a custom distinct function can be provided if the node values are non-primitive.
* @example

@@ -484,3 +484,3 @@ * ```ts

*/
export declare function Signal<T>(distinct?: Distinct<T>, init?: NodeInit<T>): NodeRef<T>;
export declare function Signal<T>(init?: NodeInit<T>, distinct?: Distinct<T>): NodeRef<T>;

@@ -487,0 +487,0 @@ /**

@@ -71,6 +71,6 @@ var O = Object.defineProperty;

* @param value - the initial value of the cell
* @param distinct - false by default. Pass true to mark the cell as a distinct one, or a custom comparator in case of a non-primitive value.
* @param distinct - true by default. Pass false to mark the signal as a non-distinct one, meaning that publishing the same value multiple times will re-trigger a recomputation cycle.
* @param node - optional, a reference to a cell. If the cell has not been touched in the realm before, the realm will instantiate a reference to it. If it's registered already, the function will return the reference.
*/
cellInstance(t, e = !1, n = Symbol()) {
cellInstance(t, e = !0, n = Symbol()) {
return this.state.has(n) || (this.state.set(n, t), e !== !1 && this.distinctNodes.set(n, e === !0 ? C : e)), n;

@@ -81,6 +81,6 @@ }

* @returns a reference to the signal.
* @param distinct - false by default. Pass true to mark the signal as a distinct one, or a custom comparator in case of a non-primitive value.
* @param distinct - true by default. Pass false to mark the signal as a non-distinct one, meaning that publishing the same value multiple times will re-trigger a recomputation cycle.
* @param node - optional, a reference to a signal. If the signal has not been touched in the realm before, the realm will instantiate a reference to it. If it's registered already, the function will return the reference.
*/
signalInstance(t = !1, e = Symbol()) {
signalInstance(t = !0, e = Symbol()) {
return t !== !1 && this.distinctNodes.set(e, t === !0 ? C : t), e;

@@ -347,10 +347,10 @@ }

}
function K(s, t = !1, e = k) {
function K(s, t = k, e = !0) {
return d(Symbol(), (n) => {
y.set(n, { type: "cell", distinct: t, initial: s, init: e });
y.set(n, { type: "cell", distinct: e, initial: s, init: t });
});
}
function W(s = !1, t = k) {
function W(s = k, t = !1) {
return d(Symbol(), (e) => {
y.set(e, { type: "signal", distinct: s, init: t });
y.set(e, { type: "signal", distinct: t, init: s });
});

@@ -357,0 +357,0 @@ }

@@ -6,3 +6,3 @@ {

"type": "module",
"version": "1.0.0",
"version": "1.0.1",
"module": "dist/index.js",

@@ -9,0 +9,0 @@ "main": "dist/index.js",

@@ -11,3 +11,3 @@ # Push-based state management

- **Optimized** - any Gurx node can be marked as distinct, meaning that it will push through its subscribers only when a new value arrives. This allows you to avoid expensive computations and re-renders.
- **Optimized** - any Gurx node are marked as distinct by default, meaning that it will push through its subscribers only when a value different than the previous one is published. This allows you to avoid expensive computations and re-renders.

@@ -52,4 +52,2 @@ - **Multi publish/subscribe** - you can subscribe to multiple nodes at once, and you can publish to multiple nodes at once. A multi-push will execute a single traversal of the node graph, and will re-render the components only once, given that they are subscribed through a single point.

0,
// distinct flag
true,
// the r is the realm instance that starts the cell

@@ -61,2 +59,4 @@ (r) => {

}
// distinct flag, true by default
true
)

@@ -66,4 +66,2 @@

const mySignal$ = Signal<number>(
// distinct flag
true,
// the r is the realm instance that starts the cell

@@ -76,3 +74,5 @@ (r) => {

r.link(mySignal$, myCell$)
}
},
// distinct flag
true
)

@@ -79,0 +79,0 @@ ```

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc