forgo-state
Advanced tools
Comparing version 1.0.17 to 1.0.18
@@ -1,7 +0,4 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.bindToStateProps = exports.bindToStates = exports.defineState = void 0; | ||
const forgo_1 = require("forgo"); | ||
import { rerender, getForgoState, } from "forgo"; | ||
const stateMap = new Map(); | ||
function defineState(state) { | ||
export function defineState(state) { | ||
const handlers = { | ||
@@ -42,3 +39,3 @@ set(target, prop, value) { | ||
const componentStatesAndArgs = argsToUpdatePlusPendingArgs.map((x) => { | ||
const state = forgo_1.getForgoState(x.element.node); | ||
const state = getForgoState(x.element.node); | ||
if (!state) { | ||
@@ -56,3 +53,3 @@ throw new Error("Missing state on node."); | ||
let node = args.element.node; | ||
let state = forgo_1.getForgoState(node); | ||
let state = getForgoState(node); | ||
let parentStates = state.components.slice(0, args.element.componentIndex); | ||
@@ -65,3 +62,3 @@ while (node && state) { | ||
if (node) { | ||
state = forgo_1.getForgoState(node); | ||
state = getForgoState(node); | ||
if (state) { | ||
@@ -87,3 +84,2 @@ parentStates = state.components.filter((x) => x !== componentState); | ||
} | ||
exports.defineState = defineState; | ||
let argsToRenderInTheNextCycle = []; | ||
@@ -94,3 +90,3 @@ function doRender() { | ||
if (args.element.node) { | ||
forgo_1.rerender(args.element); | ||
rerender(args.element); | ||
} | ||
@@ -101,7 +97,6 @@ } | ||
} | ||
function bindToStates(states, component) { | ||
export function bindToStates(states, component) { | ||
return bindToStateProps(states.map((state) => [state, undefined]), component); | ||
} | ||
exports.bindToStates = bindToStates; | ||
function bindToStateProps(stateBindings, component) { | ||
export function bindToStateProps(stateBindings, component) { | ||
const wrappedComponent = Object.assign(Object.assign({}, component), { mount(props, args) { | ||
@@ -150,3 +145,2 @@ for (const [state, propGetter] of stateBindings) { | ||
} | ||
exports.bindToStateProps = bindToStateProps; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "forgo-state", | ||
"version": "1.0.17", | ||
"version": "1.0.18", | ||
"main": "./dist", | ||
@@ -5,0 +5,0 @@ "types": "./dist/index.d.ts", |
@@ -6,3 +6,3 @@ { | ||
"target": "ES2015", | ||
"module": "CommonJS", | ||
"module": "ESNext", | ||
"moduleResolution": "Node", | ||
@@ -9,0 +9,0 @@ "declaration": true, |
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
22680
364