Socket
Socket
Sign inDemoInstall

forgo

Package Overview
Dependencies
Maintainers
1
Versions
140
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

forgo - npm Package Compare versions

Comparing version 0.0.19 to 0.0.20

3

dist/index.d.ts

@@ -40,2 +40,5 @@ export declare type ForgoRef<T> = {

key?: string | number;
props?: {
[key: string]: any;
};
components: NodeAttachedComponentState<any>[];

@@ -42,0 +45,0 @@ };

40

dist/index.js

@@ -385,3 +385,19 @@ "use strict";

function attachProps(forgoNode, node, pendingAttachStates) {
// We have to inject node into the args object.
// components are already holding a reference to the args object.
// They don't know yet that args.element.node is undefined.
for (const state of pendingAttachStates) {
state.args.element.node = node;
}
if (isForgoElement(forgoNode)) {
const currentState = getForgoState(node);
// Remove props which don't match
if (currentState && currentState.props) {
const currentEntries = Object.entries(currentState.props);
for (const [key, value] of currentEntries) {
if (key !== "children" && forgoNode.props[key] !== value) {
node[key] = undefined;
}
}
}
// We're gonna keep this simple.

@@ -395,15 +411,17 @@ // Attach everything as is.

}
// Now attach the internal forgo state.
const state = {
key: forgoNode.key,
props: forgoNode.props,
components: pendingAttachStates,
};
setForgoState(node, state);
}
// We have to inject node into the args object.
// components are already holding a reference to the args object.
// They don't know yet that args.element.node is undefined.
for (const state of pendingAttachStates) {
state.args.element.node = node;
else {
// Now attach the internal forgo state.
const state = {
components: pendingAttachStates,
};
setForgoState(node, state);
}
// Now attach the internal forgo state.
const state = {
key: isForgoElement(forgoNode) ? forgoNode.key : undefined,
components: pendingAttachStates,
};
setForgoState(node, state);
}

@@ -410,0 +428,0 @@ /*

{
"name": "forgo",
"version": "0.0.19",
"version": "0.0.20",
"main": "./dist",

@@ -5,0 +5,0 @@ "devDependencies": {

@@ -210,2 +210,9 @@ # forgo

## Routing
Forgo Router is a tiny router for Forgo, and is just around 1KB gzipped.
https://github.com/forgojs/forgo-router
## Try it out on CodeSandbox

@@ -217,2 +224,3 @@

There is also an example for using [Forgo with forgo-router](https://codesandbox.io/s/forgo-router-typescript-px4sg).

@@ -219,0 +227,0 @@ ## Recap with a complete example

@@ -111,2 +111,3 @@ /*

key?: string | number;
props?: { [key: string]: any };
components: NodeAttachedComponentState<any>[];

@@ -700,3 +701,22 @@ };

) {
// We have to inject node into the args object.
// components are already holding a reference to the args object.
// They don't know yet that args.element.node is undefined.
for (const state of pendingAttachStates) {
state.args.element.node = node;
}
if (isForgoElement(forgoNode)) {
const currentState = getForgoState(node);
// Remove props which don't match
if (currentState && currentState.props) {
const currentEntries = Object.entries(currentState.props);
for (const [key, value] of currentEntries) {
if (key !== "children" && forgoNode.props[key] !== value) {
(node as any)[key] = undefined;
}
}
}
// We're gonna keep this simple.

@@ -710,18 +730,19 @@ // Attach everything as is.

}
}
// We have to inject node into the args object.
// components are already holding a reference to the args object.
// They don't know yet that args.element.node is undefined.
for (const state of pendingAttachStates) {
state.args.element.node = node;
}
// Now attach the internal forgo state.
const state: NodeAttachedState = {
key: forgoNode.key,
props: forgoNode.props,
components: pendingAttachStates,
};
// Now attach the internal forgo state.
const state: NodeAttachedState = {
key: isForgoElement(forgoNode) ? forgoNode.key : undefined,
components: pendingAttachStates,
};
setForgoState(node, state);
} else {
// Now attach the internal forgo state.
const state: NodeAttachedState = {
components: pendingAttachStates,
};
setForgoState(node, state);
setForgoState(node, state);
}
}

@@ -728,0 +749,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc