Socket
Socket
Sign inDemoInstall

realar

Package Overview
Dependencies
1
Maintainers
1
Versions
129
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.6.0-alpha.3 to 0.6.0-alpha.4

build/types.d.ts

255

build/index.d.ts

@@ -1,255 +0,4 @@

import React, { FC } from 'react';
import { FC } from 'react';
import { Contextual, Isolate, Local, Observe, PoolEntry, SelectorEntry, SignalEntry, Transaction, Untrack, UseJsx, UseLocal, UseScoped, UseValue, UseValues, ValueEntry } from './types';
export { value, selector, signal, on, sync, cycle, prop, cache, shared, initial, free, mock, unmock, isolate, un, local, contextual, pool, transaction, untrack, observe, useValue, useValues, useLocal, useScoped, shared as useShared, Scope, useJsx, };
declare type Equals<X, Y> = (<T>() => T extends X ? 1 : 2) extends (<T>() => T extends Y ? 1 : 2) ? ([X] extends [Y] ? ([Y] extends [X] ? true : false) : false) : false;
declare type Re<T> = {
get: () => T;
} | (() => T);
interface E_UpdaterPartial<I, O> {
updater: {
<U>(func?: (state: O, upValue: U, upPrev: U) => I): Equals<U, unknown> extends true ? Signal<void> : Signal<U>;
value<U>(func?: (state: O, upValue: U, upPrev: U) => I): Equals<U, unknown> extends true ? Value<void> : Value<U>;
};
}
interface Value<I, O = I> extends E_UpdaterPartial<I, O> {
(value: I): void;
set: (value: I) => void;
get: () => O;
val: Equals<I, O> extends true ? O : never;
sync(func: (value: O, prev: O) => void): Value<I, O>;
op<R>(func: () => R): R extends void ? Value<I, O> : R;
to: {
(func: (value: O, prev: O) => void): Value<I, O>;
once(func: (value: O, prev: O) => void): Value<I, O>;
};
filter: {
(func?: (value: O) => any): Value<I, O>;
untrack(func?: (value: O) => any): Value<I, O>;
not: {
(func?: (value: O) => any): Value<I, O>;
untrack(func?: (value: O) => any): Value<I, O>;
};
};
select: {
<R>(func?: (value: O) => R): Selector<R>;
untrack<R>(func?: (value: O) => R): Selector<R>;
multiple: {
(cfg: any[]): any;
untrack(cfg: any[]): any;
};
};
map: {
<R>(func: (value: O) => R): Value<I, R>;
untrack<R>(func: (value: O) => R): Value<I, R>;
};
flow: any;
join: any;
promise: Promise<O>;
update: {
(func?: (value: O) => I): void;
track(func?: (value: O) => I): void;
by: {
<T>(re: Re<T>, updater?: (state: O, reValue: T, rePrev: T) => I): any;
once: {
<T>(re: Re<T>, updater?: (state: O, reValue: T, rePrev: T) => I): any;
};
};
};
pre: {
<N>(func?: (value: N) => I): Value<N, O>;
untrack<N>(func?: (value: N) => I): Value<N, O>;
filter: {
(func?: (value: O) => any): Value<I, O>;
untrack(func?: (value: O) => any): Value<I, O>;
not: {
(func?: (value: O) => any): Value<I, O>;
untrack(func?: (value: O) => any): Value<I, O>;
};
};
};
}
interface Signal<I, O = I> extends E_UpdaterPartial<I, O> {
(value: I): void;
set: (value: I) => void;
get: () => O;
val: Equals<I, O> extends true ? O : never;
sync(func: (value: O, prev: O) => void): Signal<I, O>;
op<R>(func: () => R): R extends void ? Signal<I, O> : R;
to: {
(func: (value: O, prev: O) => void): Signal<I, O>;
once(func: (value: O, prev: O) => void): Signal<I, O>;
};
filter: {
(func?: (value: O) => any): Signal<I, O>;
track(func?: (value: O) => any): Signal<I, O>;
not: {
(func?: (value: O) => any): Signal<I, O>;
track(func?: (value: O) => any): Signal<I, O>;
};
};
select: {
<R>(func?: (value: O) => R): Selector<R>;
untrack<R>(func?: (value: O) => R): Selector<R>;
multiple: {
(cfg: any[]): any;
untrack(cfg: any[]): any;
};
};
map: {
<R>(func: (value: O) => R): Signal<I, R>;
track<R>(func: (value: O) => R): Signal<I, R>;
};
flow: any;
join: any;
promise: Promise<O>;
update: {
(func?: (value: O) => I): void;
track(func?: (value: O) => I): void;
by: {
<T>(re: Re<T>, updater?: (state: O, reValue: T, rePrev: T) => I): any;
once: {
<T>(re: Re<T>, updater?: (state: O, reValue: T, rePrev: T) => I): any;
};
};
};
pre: {
<N>(func?: (value: N) => I): Signal<N, O>;
track<N>(func?: (value: N) => I): Signal<N, O>;
filter: {
(func?: (value: O) => any): Signal<I, O>;
track(func?: (value: O) => any): Signal<I, O>;
not: {
(func?: (value: O) => any): Signal<I, O>;
track(func?: (value: O) => any): Signal<I, O>;
};
};
};
}
declare type Selector<O> = {
get: () => O;
val: O;
select: any;
};
declare type ValueEntry = {
<T>(initial?: T): Value<T>;
trigger: {
(initial?: any): any;
flag: {
(initial?: any): any;
invert: {
(initial?: any): any;
};
};
};
from: {
(get: () => any, set?: (v: any) => any): any;
};
combine: {
(cfg: any): any;
};
};
declare type SelectorEntry = {
(fn: () => any): any;
};
declare type SignalEntry = {
<T>(initial?: T): Signal<T>;
trigger: {
(initial?: any): any;
flag: {
(initial?: any): any;
invert: {
(initial?: any): any;
};
};
};
from: {
(get: () => any, set?: (v: any) => any): any;
};
combine: {
(cfg: any): any;
};
};
declare type Local = {
inject(fn: () => void): void;
};
declare type Contextual = {
stop: () => void;
};
declare type Isolate = {
(fn: any): () => void;
unsafe: () => () => () => void;
};
declare type Transaction = {
<T>(fn: () => T): T;
unsafe: () => () => void;
};
declare type Untrack = {
<T>(fn: () => T): T;
unsafe: () => () => void;
};
declare type Observe = {
<T extends FC>(FunctionComponent: T): React.MemoExoticComponent<T>;
nomemo: {
<T extends FC>(FunctionComponent: T): T;
};
};
declare type UseScoped = {
<M>(target: (new (init?: any) => M) | ((init?: any) => M)): M;
};
declare type UseLocal = {
<T extends unknown[], M>(target: (new (...args: T) => M) | ((...args: T) => M), deps?: T): M;
};
declare type UseValue = {
<T>(target: Re<T>, deps?: any[]): T;
};
declare type UseValues_CfgExemplar = {
[key: string]: Re<any>;
};
declare type UseValues_ExpandCfgTargets<T> = {
[P in keyof T]: T[P] extends Re<infer Re_T> ? Re_T : T[P];
};
declare type UseValues = {
<T extends UseValues_CfgExemplar>(targets: T, deps?: any[]): UseValues_ExpandCfgTargets<T>;
<A, B>(targets: [Re<A>, Re<B>], deps?: any[]): [A, B];
<A, B, C>(targets: [Re<A>, Re<B>, Re<C>], deps?: any[]): [A, B, C];
<A, B, C, D>(targets: [Re<A>, Re<B>, Re<C>, Re<D>], deps?: any[]): [A, B, C, D];
<A, B, C, D, E>(targets: [Re<A>, Re<B>, Re<C>, Re<D>, Re<E>], deps?: any[]): [A, B, C, D, E];
<A, B, C, D, E, F>(targets: [Re<A>, Re<B>, Re<C>, Re<D>, Re<E>, Re<F>], deps?: any[]): [A, B, C, D, E, F];
<A, B, C, D, E, F, G>(targets: [Re<A>, Re<B>, Re<C>, Re<D>, Re<E>, Re<F>, Re<G>], deps?: any[]): [A, B, C, D, E, F, G];
<A, B, C, D, E, F, G, H>(targets: [Re<A>, Re<B>, Re<C>, Re<D>, Re<E>, Re<F>, Re<G>, Re<H>], deps?: any[]): [A, B, C, D, E, F, G, H];
<A, B, C, D, E, F, G, H, I>(targets: [Re<A>, Re<B>, Re<C>, Re<D>, Re<E>, Re<F>, Re<G>, Re<H>, Re<I>], deps?: any[]): [A, B, C, D, E, F, G, H, I];
<A, B, C, D, E, F, G, H, I, J>(targets: [Re<A>, Re<B>, Re<C>, Re<D>, Re<E>, Re<F>, Re<G>, Re<H>, Re<I>, Re<J>], deps?: any[]): [A, B, C, D, E, F, G, H, I, J];
<A, B, C, D, E, F, G, H, I, J, K>(targets: [Re<A>, Re<B>, Re<C>, Re<D>, Re<E>, Re<F>, Re<G>, Re<H>, Re<I>, Re<J>, Re<K>], deps?: any[]): [A, B, C, D, E, F, G, H, I, J, K];
<A, B, C, D, E, F, G, H, I, J, K, L>(targets: [Re<A>, Re<B>, Re<C>, Re<D>, Re<E>, Re<F>, Re<G>, Re<H>, Re<I>, Re<J>, Re<K>, Re<L>], deps?: any[]): [A, B, C, D, E, F, G, H, I, J, K, L];
<A, B, C, D, E, F, G, H, I, J, K, L, M>(targets: [Re<A>, Re<B>, Re<C>, Re<D>, Re<E>, Re<F>, Re<G>, Re<H>, Re<I>, Re<J>, Re<K>, Re<L>, Re<M>], deps?: any[]): [A, B, C, D, E, F, G, H, I, J, K, L, M];
<A, B, C, D, E, F, G, H, I, J, K, L, M, N>(targets: [Re<A>, Re<B>, Re<C>, Re<D>, Re<E>, Re<F>, Re<G>, Re<H>, Re<I>, Re<J>, Re<K>, Re<L>, Re<M>, Re<N>], deps?: any[]): [A, B, C, D, E, F, G, H, I, J, K, L, M, N];
<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O>(targets: [Re<A>, Re<B>, Re<C>, Re<D>, Re<E>, Re<F>, Re<G>, Re<H>, Re<I>, Re<J>, Re<K>, Re<L>, Re<M>, Re<N>, Re<O>], deps?: any[]): [A, B, C, D, E, F, G, H, I, J, K, L, M, N, O];
<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P>(targets: [Re<A>, Re<B>, Re<C>, Re<D>, Re<E>, Re<F>, Re<G>, Re<H>, Re<I>, Re<J>, Re<K>, Re<L>, Re<M>, Re<N>, Re<O>, Re<P>], deps?: any[]): [A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P];
<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q>(targets: [Re<A>, Re<B>, Re<C>, Re<D>, Re<E>, Re<F>, Re<G>, Re<H>, Re<I>, Re<J>, Re<K>, Re<L>, Re<M>, Re<N>, Re<O>, Re<P>, Re<Q>], deps?: any[]): [A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q];
<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R>(targets: [Re<A>, Re<B>, Re<C>, Re<D>, Re<E>, Re<F>, Re<G>, Re<H>, Re<I>, Re<J>, Re<K>, Re<L>, Re<M>, Re<N>, Re<O>, Re<P>, Re<Q>, Re<R>], deps?: any[]): [A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R];
<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S>(targets: [Re<A>, Re<B>, Re<C>, Re<D>, Re<E>, Re<F>, Re<G>, Re<H>, Re<I>, Re<J>, Re<K>, Re<L>, Re<M>, Re<N>, Re<O>, Re<P>, Re<Q>, Re<R>, Re<S>], deps?: any[]): [A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S];
<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T>(targets: [Re<A>, Re<B>, Re<C>, Re<D>, Re<E>, Re<F>, Re<G>, Re<H>, Re<I>, Re<J>, Re<K>, Re<L>, Re<M>, Re<N>, Re<O>, Re<P>, Re<Q>, Re<R>, Re<S>, Re<T>], deps?: any[]): [A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T];
<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U>(targets: [Re<A>, Re<B>, Re<C>, Re<D>, Re<E>, Re<F>, Re<G>, Re<H>, Re<I>, Re<J>, Re<K>, Re<L>, Re<M>, Re<N>, Re<O>, Re<P>, Re<Q>, Re<R>, Re<S>, Re<T>, Re<U>], deps?: any[]): [A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U];
<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V>(targets: [Re<A>, Re<B>, Re<C>, Re<D>, Re<E>, Re<F>, Re<G>, Re<H>, Re<I>, Re<J>, Re<K>, Re<L>, Re<M>, Re<N>, Re<O>, Re<P>, Re<Q>, Re<R>, Re<S>, Re<T>, Re<U>, Re<V>], deps?: any[]): [A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V];
<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W>(targets: [Re<A>, Re<B>, Re<C>, Re<D>, Re<E>, Re<F>, Re<G>, Re<H>, Re<I>, Re<J>, Re<K>, Re<L>, Re<M>, Re<N>, Re<O>, Re<P>, Re<Q>, Re<R>, Re<S>, Re<T>, Re<U>, Re<V>, Re<W>], deps?: any[]): [A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W];
<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X>(targets: [Re<A>, Re<B>, Re<C>, Re<D>, Re<E>, Re<F>, Re<G>, Re<H>, Re<I>, Re<J>, Re<K>, Re<L>, Re<M>, Re<N>, Re<O>, Re<P>, Re<Q>, Re<R>, Re<S>, Re<T>, Re<U>, Re<V>, Re<W>, Re<X>], deps?: any[]): [A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X];
<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y>(targets: [Re<A>, Re<B>, Re<C>, Re<D>, Re<E>, Re<F>, Re<G>, Re<H>, Re<I>, Re<J>, Re<K>, Re<L>, Re<M>, Re<N>, Re<O>, Re<P>, Re<Q>, Re<R>, Re<S>, Re<T>, Re<U>, Re<V>, Re<W>, Re<X>, Re<Y>], deps?: any[]): [A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y];
<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z>(targets: [Re<A>, Re<B>, Re<C>, Re<D>, Re<E>, Re<F>, Re<G>, Re<H>, Re<I>, Re<J>, Re<K>, Re<L>, Re<M>, Re<N>, Re<O>, Re<P>, Re<Q>, Re<R>, Re<S>, Re<T>, Re<U>, Re<V>, Re<W>, Re<X>, Re<Y>, Re<Z>], deps?: any[]): [A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z];
<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, $>(targets: [Re<A>, Re<B>, Re<C>, Re<D>, Re<E>, Re<F>, Re<G>, Re<H>, Re<I>, Re<J>, Re<K>, Re<L>, Re<M>, Re<N>, Re<O>, Re<P>, Re<Q>, Re<R>, Re<S>, Re<T>, Re<U>, Re<V>, Re<W>, Re<X>, Re<Y>, Re<Z>, Re<$>], deps?: any[]): [A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, $];
<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, $, _>(targets: [Re<A>, Re<B>, Re<C>, Re<D>, Re<E>, Re<F>, Re<G>, Re<H>, Re<I>, Re<J>, Re<K>, Re<L>, Re<M>, Re<N>, Re<O>, Re<P>, Re<Q>, Re<R>, Re<S>, Re<T>, Re<U>, Re<V>, Re<W>, Re<X>, Re<Y>, Re<Z>, Re<$>, Re<_>], deps?: any[]): [A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, $, _];
<A>(targets: [Re<A>], deps?: any[]): [A];
};
declare type UseJsx = {
<T = {}>(func: FC<T>, deps?: any[]): React.MemoExoticComponent<FC<T>>;
};
declare type PoolEntry_BodyExemplar = {
(...args: any[]): Promise<any>;
};
declare type PoolEntry = {
<K extends PoolEntry_BodyExemplar>(body: K): Pool<K>;
};
declare type Pool<K> = K & {
count: any;
threads: any;
pending: any;
};
declare const selector: SelectorEntry;

@@ -256,0 +5,0 @@ declare const value: ValueEntry;

@@ -297,4 +297,9 @@ "use strict";

const trait_ent_select_multiple_untrack = (ctx, cfg) => obj_keys(cfg).reduce((ret, key) => ((ret[key] = trait_ent_select_untrack(ctx, cfg[key])), ret), obj_empty_from(cfg));
const trait_ent_map = (ctx, fn) => (fill_entity(ctx[key_handler], ctx[key_proto], 0, 0, fn ? () => fn(ctx[key_get]()) : ctx[key_get], ctx[key_set] && ctx[key_set].bind()));
const trait_ent_map = (ctx, fn) => (fill_entity(ctx[key_handler], ctx[key_proto], 0, 0, fn
? ctx[key_handler][key_is_signal]
? () => fn(ctx[key_get]())
: sel(() => fn(ctx[key_get]()))[0]
: ctx[key_get], ctx[key_set] && ctx[key_set].bind()));
const trait_ent_map_untrack = make_trait_ent_pure_fn_untrack(trait_ent_map);
const trait_ent_map_to = (ctx, val) => trait_ent_map(ctx, () => val);
const trait_ent_pre = (ctx, fn) => (fn

@@ -360,2 +365,6 @@ ? fill_entity(ctx[key_handler], ctx[key_proto], 0, 0, ctx[key_get], (v) => ctx[key_set](fn(v)))

obj_def_prop_trait_ns_with_ns(proto_entity_readable_select_ns, key_multiple, trait_ent_select_multiple, make_proto_for_trackable_ns(trait_ent_select_multiple, trait_ent_select_multiple_untrack));
// readable.map:ns (track|untrack)
// .to
const proto_entity_readable_map_ns = obj_create(make_proto_for_trackable_ns(trait_ent_map, trait_ent_map_untrack));
obj_def_prop_trait_ns(proto_entity_readable_map_ns, key_to, trait_ent_map_to);
// readable.as:ns

@@ -375,3 +384,4 @@ // .as.value

// .flow (track|untrack)
// .map (track|untrack)
// .map:readable.map:ns (track|untrack)
// .to
// .join (track|untrack)

@@ -388,3 +398,3 @@ // .as:readable.as:ns

obj_def_prop_trait_with_ns(proto_entity_readable, key_select, trait_ent_select, proto_entity_readable_select_ns);
obj_def_prop_trait_with_ns(proto_entity_readable, key_map, op_trait_if_not_signal(trait_ent_map, trait_ent_map_untrack), make_proto_for_trackable_ns(trait_ent_map, trait_ent_map_untrack), 1);
obj_def_prop_trait_with_ns(proto_entity_readable, key_map, op_trait_if_not_signal(trait_ent_map, trait_ent_map_untrack), proto_entity_readable_map_ns, 1);
obj_def_prop_trait_with_ns(proto_entity_readable, key_join, trait_ent_join, make_proto_for_trackable_ns(trait_ent_join, trait_ent_join_untrack));

@@ -391,0 +401,0 @@ obj_def_prop_with_ns(proto_entity_readable, key_as, proto_entity_readable_as_ns);

{
"name": "realar",
"version": "0.6.0-alpha.3",
"description": "The advanced state manager less than 5kB for React",
"version": "0.6.0-alpha.4",
"description": "Advanced state manager for React",
"repository": {

@@ -71,3 +71,6 @@ "url": "https://github.com/betula/realar"

"jsx",
"decorator"
"decorator",
"stream",
"event stream",
"stream programming"
],

@@ -89,3 +92,3 @@ "browserslist": [

},
"gitHead": "c229617c48645a799e5e69457e469f2a2e38c822"
"gitHead": "9110b23c712789f798f56d147535b84476f85774"
}

@@ -9,249 +9,97 @@ # Realar

- __Logic free React components__. Perfect instruments for moving all component logic outside. Your React component will be pure from any unnecessary code, only view, only JSX, no more.
- _Logic free React components_. Perfect instruments for moving all component logic outside. Your React component will be clean from any unnecessary code, only view, only JSX, no more.
- _Lightweight and Fast_. Less then 5kB. Aims at the smallest size of the resulting bundle. And only parts are updated in which is really necessary to make changes.
- _Value and Signal_ is the big elephants remind Store and Action from Redux. Allows you to perform familiar coding techniques, and also add many modern features.
- _Declarative and Imperative_ both supported.
- _Stream_ event and value programming.
- _Modular Architecture_. Possibilities for the implementation of three levels of logic availability. Shared stateful is available for any part of your app. Scoped logic decomposition for React component context visibility. And React component local logic.
- _Decorators for classes lovers_. Support OOP as one of the primary syntaxes. The implementation of transparent functional reactive programming (TFRP) with React (looks similar to Mobx). And the babel plugin for automatic wrap all arrow JSX functions for the best clean code.
</p>
- __Lightweight and Fast__. Less then 5kB. Aims at the smallest size of the resulting bundle. And only parts are updated in which is really necessary to make changes.
- __Value and Signal__ is the big elephants remind Store and Action from Redux. Allows you to perform familiar coding techniques, and also add many modern features.
### Usage
- __Modular Architecture__. Possibilities for the implementation of three levels of logic availability.
- Shared stateful logic pattern (known as "service") for decomposing applications logic to separate independent or one direction dependent modules with global accessibility.
- Declaration one scope and use as many reactive values as you want without the need to define a new React context for each changeable value with context level accessibility.
- And enjoy clean React components with local logic decomposition.
You can make stores and "actions"
- __Decorators for clasess lovers__. Support OOP as one of the primary syntax. The implementation of transparent functional reactive programming (TFRP) with React (looks similar to Mobx). And the babel plugin for automatic wrap all arrow functions defined in the global scope with JSX inside to observe wrapper.
```javascript
const store = value(0)
const add = store.updater((state, num) => state + num)
const inc = store.updater(state => state + 1)
```
### Usage
And bind to React easily
```javascript
import React from 'react';
import { value, signal, useValue, useLocal, useShared, shared } from 'realar';
const App = () => {
const state = useValue(store)
const counterLogic = () => {
const count = value(0)
const inc = count.updater(state => state + 1)
const add = count.updater((state, num) => state + num)
return { count, inc, add }
return <p>{state} <button onClick={inc}>+</button></p>
}
const formLogic = () => {
const { add } = shared(counterLogic)
const addendum = value('0').pre(ev => ev.target.value)
const sum = signal()
.map(() => +addendum.val)
.filter()
.to(add);
return { addendum, sum }
}
const Form = () => {
const { addendum, sum } = useLocal(formLogic)
const addendumState = useValue(addendum)
return (
<p>
<input value={addendumState} onChange={addendum} />
<button onClick={sum}>sum</button>
</p>
)
}
const Counter = () => {
const { count, inc } = useShared(counterLogic)
const countState = useValue(count)
return (
<p>
{countState}
<button onClick={inc}>inc</button>
</p>
)
}
const App = () => (
<>
<Counter />
<Form />
<Counter />
<Form />
</>
)
```
[Try on CodeSandbox](https://codesandbox.io/s/realar-basic-example-41vvd?file=/src/App.tsx)
You can make streams
### OOP Usage
Transparent functional reactive programming with classes, decorators and [babel jsx wrapper](https://github.com/betula/babel-plugin-realar)
```javascript
class Ticker {
@prop count = 0
tick = () => ++this.count;
}
const ticker = new Ticker();
setInterval(ticker.tick, 200);
const App = () => (
<p>{ticker.count}</p>
)
const addendum = value('0').pre(ev => ev.target.value)
const sum = signal()
.map(() => +addendum.val)
.filter()
.to(add);
```
[Try wrapped version on CodeSandbox](https://codesandbox.io/s/realar-ticker-classes-c9819?file=/src/App.tsx)
It looks likes very clear and natively, and you can start development knows only two functions.
And bind to React
`prop`. Reactive value marker. Each reactive value has an immutable state. If the immutable state will update, all React components that depend on It will refresh.
`shared`. One of the primary reasons for using state manager in your application is a shared state accessing, and using shared logic between scattered React components and any place of your code.
```javascript
import React from 'react';
import { prop, shared } from 'realar';
const App = () => {
const addendumState = useValue(addendum)
class Counter {
@prop value = 0;
inc = () => this.value += 1;
dec = () => this.value -= 1;
return <p>
<input value={addendumState} onChange={addendum} />
<button onClick={sum}>sum</button>
</p>
}
const sharedCounter = () => shared(Counter);
const Count = () => {
const { value } = sharedCounter();
return <p>{value}</p>;
};
const Buttons = () => {
const { inc, dec } = sharedCounter();
return (
<>
<button onClick={inc}>+</button>
<button onClick={dec}>-</button>
</>
);
};
const App = () => (
<>
<Count />
<Buttons />
<Count />
<Buttons />
</>
);
export default App;
```
For best possibilities use [babel jsx wrapper](https://github.com/betula/babel-plugin-realar), your code will be so beautiful to look like.
You can use classes with decorators
But otherwise necessary to wrap all React function components that use reactive values inside to `observe` wrapper. [Try wrapped version on CodeSandbox](https://codesandbox.io/s/realar-counter-k9kmw?file=/src/App.tsx).
#### React component access visibility level
The basic level of scopes for React developers is a component level scope (_for example `useState`, and other standard React hooks has that level_).
Every React component instance has its own local state, which is saved every render for the component as long as the component is mounted.
In the Realar ecosystem `useLocal` hook used to make components local stateful logic.
```javascript
class CounterLogic {
@prop value = 0;
inc = () => this.value += 1
}
class Counter {
@prop state = 0;
const Counter = () => {
const { value, inc } = useLocal(CounterLogic);
return (
<p>{value} <button onClick={inc}>+</button></p>
);
add = (num) => this.state += num;
inc = () => this.add(1);
}
export const App = () => (
<>
<Counter />
<Counter />
</>
);
```
[Play wrapped on CodeSandbox](https://codesandbox.io/s/realar-component-level-scope-classes-m0i10?file=/src/App.tsx)
This feature can be useful for removing logic from the body of a component to keep that free of unnecessary code, and therefore cleaner.
And bind to React
#### React context access visibility level
```javascript
const Counter = () => {
const { value, inc } = useScoped(CounterLogic);
const App = observe(() => {
const { state, inc } = useLocal(Counter)
return (
<p>{value} <button onClick={inc}>+</button></p>
);
}
export const App = () => (
<Scope>
<Scope>
<Counter />
<Counter />
</Scope>
<Counter />
</Scope>
);
return <p>{state} <button onClick={inc}>+</button></p>
})
```
[Play wrapped on CodeSandbox](https://codesandbox.io/s/realar-context-component-level-scope-classes-wivjv?file=/src/App.tsx)
And you can use it together
### Core
The abstraction of the core is an implementation of functional reactive programming on javascript and binding that with React.
It uses usual mathematic to describe dependencies and commutation between reactive values.
In contradistinction to _stream pattern_, operator functions not needed. The reactive “sum” operator used a simple “+” operator (for example).
```javascript
const a = value(0)
const b = value(0)
class Positive {
@cache get state() {
return store.val > 0 ? 'positive' : 'non'
}
const sum = () => a.val + b.val
on(sum, console.log)
```
That code has a graph of dependencies inside. “sum” - reactive expression depends from “A” and “B”, and will react if “A” or “B” changed. It is perfectly demonstrated with “on” function (that subscribes to reactive expression) and “console.log” (developer console output).
On each change of “A” or “B” a new value of that sum will appear in the developer console output.
And for tasty easy binding reactive expressions and values with React components.
```javascript
const App = () => {
const val = useValue(sum);
return (
<p>{val}</p>
);
constructor() {
sync(() => this.state, console.log)
}
}
```
That component will be updated every time when new sum value is coming.
The difference from exists an implementation of functional reactive programming (mobx) in Realar dependency collector provides the possibility to write in selectors and nested writable reactions.
Realar provides big possibility abstractions for reactive flow. We already know about reactive value container, reactive expressions, and subscribe mechanism. But also have synchronization between data, cycled reactions, cached selectors, transactions and etc.
### Documentation
- [Get started](./docs/get-started.md)
- [Core](./docs/core.md)
- [OOP usage](./docs/oop.md)
- API

@@ -269,2 +117,3 @@ - [value](./docs/api.md)

+ [Basic usage on codesandbox](https://codesandbox.io/s/realar-basic-example-41vvd?file=/src/App.tsx).
+ [Hello](https://github.com/realar-project/hello) - shared state demonstration.

@@ -274,3 +123,6 @@ + [Todos](https://github.com/realar-project/todos) - todomvc implementation.

### In Production
+ [Card of the Day](https://apps.apple.com/app/card-of-the-day/id1547423880) - React Native mobile app.
### Articles

@@ -277,0 +129,0 @@

import React, { Context, FC } from 'react';
import rb from 'reactive-box';
import { Contextual, Isolate, Local, Observe, PoolEntry, SelectorEntry, SignalEntry, Transaction, Untrack, UseJsx, UseLocal, UseScoped, UseValue, UseValues, ValueEntry } from './types';
/*
TODOs:
[] Add second example to documentation
```
// Second example
const Loader = () => {
const count = value(0);
return {
start: count.updater(v => v + 1),
stop: count.updater(v => v - 1),
pending: count.select(v => v > 0)
}
}
```
[] maybe make val as readonly property for fix "never" type for prepended values and signals
or I can make readonly val only for prepended values and signals (think about).
[] typings for builder
[] documentation update
Backlog:
[] .as.trigger
[] .as.value.trigger
[] .as.signal.trigger
[] signal.trigger.resolved
[] value.trigger.resolved
[] test case "should work signal.trigger with configured .pre"
[] signal.trigger.from
[] value.trigger.from
*/
//

@@ -101,333 +56,3 @@ // Exports

//
// Typings.
//
//
// Private
//
// @see https://github.com/Microsoft/TypeScript/issues/27024
type Equals<X, Y> = (<T>() => T extends X ? 1 : 2) extends (<T>() => T extends Y ? 1 : 2)
? ([X] extends [Y]
? ([Y] extends [X] ? true : false) : false)
: false;
type Re<T> = { get: () => T } | (() => T);
//
// Entity types
//
interface E_UpdaterPartial<I, O> {
updater: {
<U>(func?: (state: O, upValue: U, upPrev: U) => I): Equals<U, unknown> extends true ? Signal<void> : Signal<U>
value<U>(func?: (state: O, upValue: U, upPrev: U) => I): Equals<U, unknown> extends true ? Value<void> : Value<U>
}
}
interface Value<I,O = I> extends E_UpdaterPartial<I,O> {
(value: I): void;
set: (value: I) => void;
get: () => O;
val: Equals<I, O> extends true ? O : never;
// readable section
sync(func: (value: O, prev: O) => void): Value<I, O>
op<R>(func: () => R): R extends void ? Value<I, O> : R
to: {
(func: (value: O, prev: O) => void): Value<I, O>
once(func: (value: O, prev: O) => void): Value<I, O>
}
filter: {
(func?: (value: O) => any): Value<I, O> // tracked by default
untrack(func?: (value: O) => any): Value<I, O>
not: {
(func?: (value: O) => any): Value<I, O> // tracked by default
untrack(func?: (value: O) => any): Value<I, O>
}
}
select: {
<R>(func?: (value: O) => R): Selector<R> // tracked by default
untrack<R>(func?: (value: O) => R): Selector<R>
multiple: {
(cfg: any[]): any // TODO: .select.multiple typings
untrack(cfg: any[]): any
}
}
map: {
<R>(func: (value: O) => R): Value<I, R> // tracked by default
untrack<R>(func: (value: O) => R): Value<I, R>
}
flow: any // TODO: .flow typings
join: any // TODO: .join typings
promise: Promise<O>
// writtable section
update: {
(func?: (value: O) => I): void // untracked by default
track(func?: (value: O) => I): void
by: {
<T>(re: Re<T>, updater?: (state: O, reValue: T, rePrev: T) => I)
once: {
<T>(re: Re<T>, updater?: (state: O, reValue: T, rePrev: T) => I)
}
}
}
pre: {
<N>(func?: (value: N) => I): Value<N, O> // tracked by default
untrack<N>(func?: (value: N) => I): Value<N, O>
filter: {
(func?: (value: O) => any): Value<I, O> // tracked by default
untrack(func?: (value: O) => any): Value<I, O>
not: { // tracked by default
(func?: (value: O) => any): Value<I, O>
untrack(func?: (value: O) => any): Value<I, O>
}
}
}
}
interface Signal<I,O = I> extends E_UpdaterPartial<I,O> {
(value: I): void;
set: (value: I) => void;
get: () => O;
val: Equals<I, O> extends true ? O : never;
// readable section
sync(func: (value: O, prev: O) => void): Signal<I, O>
op<R>(func: () => R): R extends void ? Signal<I, O> : R
to: {
(func: (value: O, prev: O) => void): Signal<I, O>
once(func: (value: O, prev: O) => void): Signal<I, O>
}
filter: {
(func?: (value: O) => any): Signal<I, O> // untracked by default
track(func?: (value: O) => any): Signal<I, O>
not: {
(func?: (value: O) => any): Signal<I, O> // untracked by default
track(func?: (value: O) => any): Signal<I, O>
}
}
select: {
<R>(func?: (value: O) => R): Selector<R> // tracked by default
untrack<R>(func?: (value: O) => R): Selector<R>
multiple: {
(cfg: any[]): any // TODO: .select.multiple typings
untrack(cfg: any[]): any
}
}
map: {
<R>(func: (value: O) => R): Signal<I, R> // untracked by default
track<R>(func: (value: O) => R): Signal<I, R>
}
flow: any // TODO: .flow typings
join: any // TODO: .join typings
promise: Promise<O>
// writtable section
update: {
(func?: (value: O) => I): void // untracked by default
track(func?: (value: O) => I): void
by: {
<T>(re: Re<T>, updater?: (state: O, reValue: T, rePrev: T) => I)
once: {
<T>(re: Re<T>, updater?: (state: O, reValue: T, rePrev: T) => I)
}
}
}
pre: {
<N>(func?: (value: N) => I): Signal<N, O> // untracked by default
track<N>(func?: (value: N) => I): Signal<N, O>
filter: {
(func?: (value: O) => any): Signal<I, O> // untracked by default
track(func?: (value: O) => any): Signal<I, O>
not: { // untracked by default
(func?: (value: O) => any): Signal<I, O>
track(func?: (value: O) => any): Signal<I, O>
}
}
}
}
type Selector<O> = {
get: () => O;
val: O;
select: any;
}
//
// Entry types
//
type ValueEntry = {
<T>(initial?: T): Value<T>;
trigger: {
(initial?: any): any;
flag: {
(initial?: any): any;
invert: { (initial?: any): any }
}
};
from: { (get: () => any, set?: (v) => any): any },
combine: { (cfg: any): any }
}
type SelectorEntry = {
(fn: () => any): any;
}
type SignalEntry = {
<T>(initial?: T): Signal<T>;
trigger: {
(initial?: any): any;
flag: {
(initial?: any): any;
invert: { (initial?: any): any }
}
};
from: { (get: () => any, set?: (v) => any): any },
combine: { (cfg: any): any }
};
//
// Realar external api typings
//
type Local = {
inject(fn: () => void): void;
}
type Contextual = {
stop: () => void;
}
type Isolate = {
(fn): () => void;
unsafe: () => () => () => void;
}
type Transaction = {
<T>(fn: () => T): T;
unsafe: () => () => void;
}
type Untrack = {
<T>(fn: () => T): T;
unsafe: () => () => void;
}
//
// Realar external api typings for React
//
type Observe = {
<T extends FC>(FunctionComponent: T): React.MemoExoticComponent<T>;
nomemo: {
<T extends FC>(FunctionComponent: T): T;
}
}
type UseScoped = {
<M>(target: (new (init?: any) => M) | ((init?: any) => M)): M;
}
type UseLocal = {
<T extends unknown[], M>(
target: (new (...args: T) => M) | ((...args: T) => M),
deps?: T
): M;
}
type UseValue = {
<T>(target: Re<T>, deps?: any[]): T;
}
type UseValues_CfgExemplar = {
[key: string]: Re<any>
}
type UseValues_ExpandCfgTargets<T> = {
[P in keyof T]: T[P] extends Re<infer Re_T> ? Re_T : T[P]
}
type UseValues = {
<T extends UseValues_CfgExemplar>(targets: T, deps?: any[]): UseValues_ExpandCfgTargets<T>
<A,B>(targets: [Re<A>,Re<B>], deps?: any[]): [A,B];
<A,B,C>(targets: [Re<A>,Re<B>,Re<C>], deps?: any[]): [A,B,C];
<A,B,C,D>(targets: [Re<A>,Re<B>,Re<C>,Re<D>], deps?: any[]): [A,B,C,D];
<A,B,C,D,E>(targets: [Re<A>,Re<B>,Re<C>,Re<D>,Re<E>], deps?: any[]): [A,B,C,D,E];
<A,B,C,D,E,F>(targets: [Re<A>,Re<B>,Re<C>,Re<D>,Re<E>,Re<F>], deps?: any[]): [A,B,C,D,E,F];
<A,B,C,D,E,F,G>(targets: [Re<A>,Re<B>,Re<C>,Re<D>,Re<E>,Re<F>,Re<G>], deps?: any[]): [A,B,C,D,E,F,G];
<A,B,C,D,E,F,G,H>(targets: [Re<A>,Re<B>,Re<C>,Re<D>,Re<E>,Re<F>,Re<G>,Re<H>], deps?: any[]): [A,B,C,D,E,F,G,H];
<A,B,C,D,E,F,G,H,I>(targets: [Re<A>,Re<B>,Re<C>,Re<D>,Re<E>,Re<F>,Re<G>,Re<H>,Re<I>], deps?: any[]): [A,B,C,D,E,F,G,H,I];
<A,B,C,D,E,F,G,H,I,J>(targets: [Re<A>,Re<B>,Re<C>,Re<D>,Re<E>,Re<F>,Re<G>,Re<H>,Re<I>,Re<J>], deps?: any[]): [A,B,C,D,E,F,G,H,I,J];
<A,B,C,D,E,F,G,H,I,J,K>(targets: [Re<A>,Re<B>,Re<C>,Re<D>,Re<E>,Re<F>,Re<G>,Re<H>,Re<I>,Re<J>,Re<K>], deps?: any[]): [A,B,C,D,E,F,G,H,I,J,K];
<A,B,C,D,E,F,G,H,I,J,K,L>(targets: [Re<A>,Re<B>,Re<C>,Re<D>,Re<E>,Re<F>,Re<G>,Re<H>,Re<I>,Re<J>,Re<K>,Re<L>], deps?: any[]): [A,B,C,D,E,F,G,H,I,J,K,L];
<A,B,C,D,E,F,G,H,I,J,K,L,M>(targets: [Re<A>,Re<B>,Re<C>,Re<D>,Re<E>,Re<F>,Re<G>,Re<H>,Re<I>,Re<J>,Re<K>,Re<L>,Re<M>], deps?: any[]): [A,B,C,D,E,F,G,H,I,J,K,L,M];
<A,B,C,D,E,F,G,H,I,J,K,L,M,N>(targets: [Re<A>,Re<B>,Re<C>,Re<D>,Re<E>,Re<F>,Re<G>,Re<H>,Re<I>,Re<J>,Re<K>,Re<L>,Re<M>,Re<N>], deps?: any[]): [A,B,C,D,E,F,G,H,I,J,K,L,M,N];
<A,B,C,D,E,F,G,H,I,J,K,L,M,N,O>(targets: [Re<A>,Re<B>,Re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,Re<M>,Re<N>,Re<O>,Re<P>,Re<Q>,Re<R>,Re<S>,Re<T>,Re<U>,Re<V>,Re<W>,Re<X>,Re<Y>,Re<Z>,Re<$>,Re<_>], deps?: any[]): [A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,$,_];
<A>(targets: [Re<A>], deps?: any[]): [A];
}
type UseJsx = {
<T = {}>(func: FC<T>, deps?: any[]): React.MemoExoticComponent<FC<T>>;
}
//
// Realar additions external api typings
//
type PoolEntry_BodyExemplar = {
(...args: any[]): Promise<any>;
}
type PoolEntry = {
<K extends PoolEntry_BodyExemplar>(body: K): Pool<K>
}
type Pool<K> = K & {
count: any;
threads: any;
pending: any;
};
//
// React optional require

@@ -800,3 +425,7 @@ //

0, 0,
fn ? () => fn(ctx[key_get]()) : ctx[key_get],
fn
? ctx[key_handler][key_is_signal]
? () => fn(ctx[key_get]())
: sel(() => fn(ctx[key_get]()))[0]
: ctx[key_get],
ctx[key_set] && ctx[key_set].bind()

@@ -806,2 +435,3 @@ )

const trait_ent_map_untrack = make_trait_ent_pure_fn_untrack(trait_ent_map);
const trait_ent_map_to = (ctx, val) => trait_ent_map(ctx, () => val);
const trait_ent_pre = (ctx, fn) => (

@@ -915,2 +545,9 @@ fn

// readable.map:ns (track|untrack)
// .to
const proto_entity_readable_map_ns = obj_create(
make_proto_for_trackable_ns(trait_ent_map, trait_ent_map_untrack)
);
obj_def_prop_trait_ns(proto_entity_readable_map_ns, key_to, trait_ent_map_to);
// readable.as:ns

@@ -931,3 +568,4 @@ // .as.value

// .flow (track|untrack)
// .map (track|untrack)
// .map:readable.map:ns (track|untrack)
// .to
// .join (track|untrack)

@@ -970,3 +608,3 @@ // .as:readable.as:ns

op_trait_if_not_signal(trait_ent_map, trait_ent_map_untrack),
make_proto_for_trackable_ns(trait_ent_map, trait_ent_map_untrack),
proto_entity_readable_map_ns,
1

@@ -973,0 +611,0 @@ );

Sorry, the diff of this file is not supported yet

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