Comparing version 0.4.9 to 0.4.10
import { FC } from 'react'; | ||
import { expr, box, sel, transaction } from 'reactive-box'; | ||
export { prop, cache, action, on, cycle, effect, shared, initial, observe, useValue, useLocal, useShared, free, mock, box, sel, expr, transaction, boxProperty, selProperty, boxProperties, Ensurable, }; | ||
export { prop, cache, action, on, cycle, effect, shared, initial, observe, useValue, useLocal, useShared, free, mock, box, sel, expr, transaction, Ensurable, }; | ||
declare type Ensurable<T> = T | void; | ||
@@ -31,7 +31,3 @@ declare function action<T = undefined>(init?: T): { | ||
declare function free(): void; | ||
declare function boxProperty(o: any, p: string | number | symbol, init?: any): any; | ||
declare function selProperty(o: any, p: string | number | symbol, selector: () => any): any; | ||
declare function boxProperties<T extends {}>(props: T): T; | ||
declare function boxProperties<O extends Object, T extends {}>(o: O, props: T): O & T; | ||
declare function prop(_proto: any, key: any, descriptor?: any): any; | ||
declare function cache(_proto: any, key: any, descriptor: any): any; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.boxProperties = exports.selProperty = exports.boxProperty = exports.transaction = exports.expr = exports.sel = exports.box = exports.mock = exports.free = exports.useShared = exports.useLocal = exports.useValue = exports.observe = exports.initial = exports.shared = exports.effect = exports.cycle = exports.on = exports.action = exports.cache = exports.prop = void 0; | ||
exports.transaction = exports.expr = exports.sel = exports.box = exports.mock = exports.free = exports.useShared = exports.useLocal = exports.useValue = exports.observe = exports.initial = exports.shared = exports.effect = exports.cycle = exports.on = exports.action = exports.cache = exports.prop = void 0; | ||
const react_1 = require("react"); | ||
@@ -180,22 +180,3 @@ const reactive_box_1 = require("reactive-box"); | ||
Object.defineProperty(o, p, { get, set }); | ||
return o; | ||
} | ||
exports.boxProperty = boxProperty; | ||
function selProperty(o, p, selector) { | ||
const [get] = reactive_box_1.sel(selector); | ||
Object.defineProperty(o, p, { get }); | ||
return o; | ||
} | ||
exports.selProperty = selProperty; | ||
function boxProperties(o, props) { | ||
if (!props) { | ||
props = o; | ||
o = {}; | ||
} | ||
Object.keys(props).forEach(key => { | ||
boxProperty(o, key, props[key]); | ||
}); | ||
return o; | ||
} | ||
exports.boxProperties = boxProperties; | ||
function prop(_proto, key, descriptor) { | ||
@@ -218,3 +199,4 @@ const initializer = descriptor === null || descriptor === void 0 ? void 0 : descriptor.initializer; | ||
get() { | ||
selProperty(this, key, descriptor.get); | ||
const [get] = reactive_box_1.sel(descriptor.get); | ||
Object.defineProperty(this, key, { get }); | ||
return this[key]; | ||
@@ -221,0 +203,0 @@ }, |
{ | ||
"name": "realar", | ||
"version": "0.4.9", | ||
"version": "0.4.10", | ||
"description": "React state manager", | ||
@@ -91,3 +91,3 @@ "repository": { | ||
}, | ||
"gitHead": "3140a940386b5da7b970b7409f625d3ccad0608f" | ||
"gitHead": "6a28ef6b50504bc6d2596d5469ffa5e11310ed82" | ||
} |
@@ -69,3 +69,3 @@ # Realar | ||
_Documentation not ready yet for `action`, `cache`, `on`, `cycle`, `effect`, `shared`, `initial`, `mock`, `free`, `useLocal`, `observe`, `useValue`, `useShared`, `transaction`, `box`, `sel`, `boxProperty`, `selProperty`, `boxProperties` functions. It's coming soon._ | ||
_Documentation not ready yet for `action`, `cache`, `on`, `cycle`, `effect`, `shared`, `initial`, `mock`, `free`, `useLocal`, `observe`, `useValue`, `useShared`, `transaction`, `box`, `sel` functions. It's coming soon._ | ||
@@ -72,0 +72,0 @@ ### Demos |
@@ -29,5 +29,2 @@ import { useRef, useReducer, useEffect, useMemo, FC } from 'react'; | ||
transaction, | ||
boxProperty, | ||
selProperty, | ||
boxProperties, | ||
Ensurable, | ||
@@ -224,24 +221,4 @@ }; | ||
Object.defineProperty(o, p, { get, set }); | ||
return o; | ||
} | ||
function selProperty(o: any, p: string | number | symbol, selector: () => any): any { | ||
const [get] = sel(selector); | ||
Object.defineProperty(o, p, { get }); | ||
return o; | ||
} | ||
function boxProperties<T extends {}>(props: T): T; | ||
function boxProperties<O extends Object, T extends {}>(o: O, props: T): O & T; | ||
function boxProperties(o: any, props?: any) { | ||
if (!props) { | ||
props = o; | ||
o = {}; | ||
} | ||
Object.keys(props).forEach(key => { | ||
boxProperty(o, key, props[key]); | ||
}); | ||
return o; | ||
} | ||
function prop(_proto: any, key: any, descriptor?: any): any { | ||
@@ -264,3 +241,4 @@ const initializer = descriptor?.initializer; | ||
get() { | ||
selProperty(this, key, descriptor.get); | ||
const [get] = sel(descriptor.get); | ||
Object.defineProperty(this, key, { get }); | ||
return this[key]; | ||
@@ -267,0 +245,0 @@ }, |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
26510
450