Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

karet

Package Overview
Dependencies
Maintainers
1
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

karet - npm Package Compare versions

Comparing version 3.2.2 to 3.3.0

74

dist/karet.cjs.js

@@ -11,5 +11,2 @@ 'use strict';

var VALUE = 'value';
var ERROR = 'error';
var STYLE = 'style';

@@ -131,5 +128,5 @@ var DANGEROUSLY = 'dangerouslySetInnerHTML';

if (type === VALUE) {
if (type === 'value') {
self.forceUpdate();
} else if (type === ERROR) {
} else if (type === 'error') {
throw e.value;

@@ -143,26 +140,24 @@ }

function doUnsubscribe(self, _ref2) {
var args = _ref2.args;
function doUnsubscribe(_ref2, _ref3) {
var h = _ref2.h;
var args = _ref3.args;
var handler = self.h;
if (handler) {
forEachInChildren(2, args, handler, offAny);
forEachInProps(args[1], handler, offAny);
}
forEachInChildren(2, args, h, offAny);
forEachInProps(args[1], h, offAny);
}
function decObs(obs2num, property) {
obs2num.set(property, (obs2num.get(property) || 0) - 1);
function decObs(p2n, property) {
p2n.set(property, (p2n.get(property) || 0) - 1);
}
function incObs(obs2num, property) {
obs2num.set(property, (obs2num.get(property) || 0) + 1);
function incObs(p2n, property) {
p2n.set(property, (p2n.get(property) || 0) + 1);
}
function updateObs(delta, property, obs2num) {
if (delta < 0) do {
property.offAny(obs2num.h);
} while (++delta);else if (0 < delta) do {
property.onAny(obs2num.h);
} while (--delta);
function updateObs(delta, property, p2n) {
for (; delta < 0; ++delta) {
property.offAny(p2n.h);
}for (; 0 < delta; --delta) {
property.onAny(p2n.h);
}
}

@@ -180,17 +175,17 @@

},
componentDidUpdate: function componentDidUpdate(_ref3) {
var before = _ref3.args;
componentDidUpdate: function componentDidUpdate(_ref4) {
var before = _ref4.args;
var after = this.props.args;
var obs2num = new Map();
obs2num.h = this.h;
var p2n = new Map();
p2n.h = this.h;
forEachInProps(before[1], obs2num, decObs);
forEachInChildren(2, before, obs2num, decObs);
forEachInProps(before[1], p2n, decObs);
forEachInChildren(2, before, p2n, decObs);
forEachInProps(after[1], obs2num, incObs);
forEachInChildren(2, after, obs2num, incObs);
forEachInProps(after[1], p2n, incObs);
forEachInChildren(2, after, p2n, incObs);
obs2num.forEach(updateObs);
p2n.forEach(updateObs);
},

@@ -256,16 +251,8 @@ componentWillUnmount: function componentWillUnmount() {

var props = args[1];
if (hasPropertiesInProps(props) || hasPropertiesInChildren(2, args)) {
var fromClassProps = { args: args };
if (props) {
var key = props.key;
if (null != key) fromClassProps.key = key;
}
return React.createElement(FromClass, fromClassProps);
} else {
return React.createElement.apply(null, args);
}
return hasPropertiesInProps(props) || hasPropertiesInChildren(2, args) ? React.createElement(FromClass, { args: args, key: props.key }) : React.createElement.apply(null, args);
}
function createElement(type, props, _child) {
var lift = props && props[LIFT];
props = props || I.object0;
var lift = props[LIFT];
if (lift || I.isString(type) || React.Fragment === type) {

@@ -292,4 +279,7 @@ var n = arguments.length;

exports.Children = React.Children;
exports.Fragment = React.Fragment;
exports.createContext = React.createContext;
exports.forwardRef = React.forwardRef;
exports.createElement = createElement;
exports.fromClass = fromClass;
import { isArray, inherit, object0, isString, dissocPartialU, assocPartialU } from 'infestines';
import { Component, Fragment, createElement, forwardRef } from 'react';
export { Fragment } from 'react';
export { Children, Fragment, createContext, forwardRef } from 'react';
import { Property } from 'kefir';

@@ -8,5 +8,2 @@

var VALUE = 'value';
var ERROR = 'error';
var STYLE = 'style';

@@ -128,5 +125,5 @@ var DANGEROUSLY = 'dangerouslySetInnerHTML';

if (type === VALUE) {
if (type === 'value') {
self.forceUpdate();
} else if (type === ERROR) {
} else if (type === 'error') {
throw e.value;

@@ -140,26 +137,24 @@ }

function doUnsubscribe(self, _ref2) {
var args = _ref2.args;
function doUnsubscribe(_ref2, _ref3) {
var h = _ref2.h;
var args = _ref3.args;
var handler = self.h;
if (handler) {
forEachInChildren(2, args, handler, offAny);
forEachInProps(args[1], handler, offAny);
}
forEachInChildren(2, args, h, offAny);
forEachInProps(args[1], h, offAny);
}
function decObs(obs2num, property) {
obs2num.set(property, (obs2num.get(property) || 0) - 1);
function decObs(p2n, property) {
p2n.set(property, (p2n.get(property) || 0) - 1);
}
function incObs(obs2num, property) {
obs2num.set(property, (obs2num.get(property) || 0) + 1);
function incObs(p2n, property) {
p2n.set(property, (p2n.get(property) || 0) + 1);
}
function updateObs(delta, property, obs2num) {
if (delta < 0) do {
property.offAny(obs2num.h);
} while (++delta);else if (0 < delta) do {
property.onAny(obs2num.h);
} while (--delta);
function updateObs(delta, property, p2n) {
for (; delta < 0; ++delta) {
property.offAny(p2n.h);
}for (; 0 < delta; --delta) {
property.onAny(p2n.h);
}
}

@@ -177,17 +172,17 @@

},
componentDidUpdate: function componentDidUpdate(_ref3) {
var before = _ref3.args;
componentDidUpdate: function componentDidUpdate(_ref4) {
var before = _ref4.args;
var after = this.props.args;
var obs2num = new Map();
obs2num.h = this.h;
var p2n = new Map();
p2n.h = this.h;
forEachInProps(before[1], obs2num, decObs);
forEachInChildren(2, before, obs2num, decObs);
forEachInProps(before[1], p2n, decObs);
forEachInChildren(2, before, p2n, decObs);
forEachInProps(after[1], obs2num, incObs);
forEachInChildren(2, after, obs2num, incObs);
forEachInProps(after[1], p2n, incObs);
forEachInChildren(2, after, p2n, incObs);
obs2num.forEach(updateObs);
p2n.forEach(updateObs);
},

@@ -253,16 +248,8 @@ componentWillUnmount: function componentWillUnmount() {

var props = args[1];
if (hasPropertiesInProps(props) || hasPropertiesInChildren(2, args)) {
var fromClassProps = { args: args };
if (props) {
var key = props.key;
if (null != key) fromClassProps.key = key;
}
return createElement(FromClass, fromClassProps);
} else {
return createElement.apply(null, args);
}
return hasPropertiesInProps(props) || hasPropertiesInChildren(2, args) ? createElement(FromClass, { args: args, key: props.key }) : createElement.apply(null, args);
}
function createElement$1(type, props, _child) {
var lift = props && props[LIFT];
props = props || object0;
var lift = props[LIFT];
if (lift || isString(type) || Fragment === type) {

@@ -269,0 +256,0 @@ var n = arguments.length;

@@ -9,5 +9,2 @@ (function (global, factory) {

var VALUE = 'value';
var ERROR = 'error';
var STYLE = 'style';

@@ -129,5 +126,5 @@ var DANGEROUSLY = 'dangerouslySetInnerHTML';

if (type === VALUE) {
if (type === 'value') {
self.forceUpdate();
} else if (type === ERROR) {
} else if (type === 'error') {
throw e.value;

@@ -141,26 +138,24 @@ }

function doUnsubscribe(self, _ref2) {
var args = _ref2.args;
function doUnsubscribe(_ref2, _ref3) {
var h = _ref2.h;
var args = _ref3.args;
var handler = self.h;
if (handler) {
forEachInChildren(2, args, handler, offAny);
forEachInProps(args[1], handler, offAny);
}
forEachInChildren(2, args, h, offAny);
forEachInProps(args[1], h, offAny);
}
function decObs(obs2num, property) {
obs2num.set(property, (obs2num.get(property) || 0) - 1);
function decObs(p2n, property) {
p2n.set(property, (p2n.get(property) || 0) - 1);
}
function incObs(obs2num, property) {
obs2num.set(property, (obs2num.get(property) || 0) + 1);
function incObs(p2n, property) {
p2n.set(property, (p2n.get(property) || 0) + 1);
}
function updateObs(delta, property, obs2num) {
if (delta < 0) do {
property.offAny(obs2num.h);
} while (++delta);else if (0 < delta) do {
property.onAny(obs2num.h);
} while (--delta);
function updateObs(delta, property, p2n) {
for (; delta < 0; ++delta) {
property.offAny(p2n.h);
}for (; 0 < delta; --delta) {
property.onAny(p2n.h);
}
}

@@ -178,17 +173,17 @@

},
componentDidUpdate: function componentDidUpdate(_ref3) {
var before = _ref3.args;
componentDidUpdate: function componentDidUpdate(_ref4) {
var before = _ref4.args;
var after = this.props.args;
var obs2num = new Map();
obs2num.h = this.h;
var p2n = new Map();
p2n.h = this.h;
forEachInProps(before[1], obs2num, decObs);
forEachInChildren(2, before, obs2num, decObs);
forEachInProps(before[1], p2n, decObs);
forEachInChildren(2, before, p2n, decObs);
forEachInProps(after[1], obs2num, incObs);
forEachInChildren(2, after, obs2num, incObs);
forEachInProps(after[1], p2n, incObs);
forEachInChildren(2, after, p2n, incObs);
obs2num.forEach(updateObs);
p2n.forEach(updateObs);
},

@@ -254,16 +249,8 @@ componentWillUnmount: function componentWillUnmount() {

var props = args[1];
if (hasPropertiesInProps(props) || hasPropertiesInChildren(2, args)) {
var fromClassProps = { args: args };
if (props) {
var key = props.key;
if (null != key) fromClassProps.key = key;
}
return React.createElement(FromClass, fromClassProps);
} else {
return React.createElement.apply(null, args);
}
return hasPropertiesInProps(props) || hasPropertiesInChildren(2, args) ? React.createElement(FromClass, { args: args, key: props.key }) : React.createElement.apply(null, args);
}
function createElement(type, props, _child) {
var lift = props && props[LIFT];
props = props || I.object0;
var lift = props[LIFT];
if (lift || I.isString(type) || React.Fragment === type) {

@@ -290,3 +277,6 @@ var n = arguments.length;

exports.Children = React.Children;
exports.Fragment = React.Fragment;
exports.createContext = React.createContext;
exports.forwardRef = React.forwardRef;
exports.createElement = createElement;

@@ -293,0 +283,0 @@ exports.fromClass = fromClass;

@@ -1,1 +0,1 @@

!function(r,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("infestines"),require("react"),require("kefir")):"function"==typeof define&&define.amd?define(["exports","infestines","react","kefir"],n):n(r.karet={},r.I,r.React,r.Kefir)}(this,function(r,n,e,t){"use strict";function i(r){var n=r._currentEvent;if(n)return n.value}function f(r){for(var e=r,t=0,a=r.length;t<a;++t){var o=r[t],u=U(o)?i(o):n.isArray(o)?f(o):o;o!==u&&(e===r&&(e=r.slice(0)),e[t]=u)}return e}function a(r){var n=null;for(var e in r){var t=r[e];if(U(t)){if(!n)for(var f in n={},r){if(f===e)break;n[f]=r[f]}n[e]=i(t)}else n&&(n[e]=t)}return n||r}function o(r,e,t,i){for(var f=e.length;r<f;++r){var a=e[r];U(a)?i(t,a):n.isArray(a)&&o(0,a,t,i)}}function u(r,e,t){for(var i in r){var f=r[i];if(U(f))t(e,f);else if(E===i)n.isArray(f)&&o(0,f,e,t);else if(k===i||w===i)for(var a in f){var u=f[a];U(u)&&t(e,u)}}}function l(r,n){n.offAny(r)}function s(r,n){n.onAny(r)}function c(r,n){var e=n.args,t=r.h;t||(t=r.h=function(n){var e=n.type;if(e===m)r.forceUpdate();else if(e===A)throw n.value}),u(e[1],t,s),o(2,e,t,s)}function v(r,n){var e=n.args,t=r.h;t&&(o(2,e,t,l),u(e[1],t,l))}function p(r,n){r.set(n,(r.get(n)||0)-1)}function h(r,n){r.set(n,(r.get(n)||0)+1)}function y(r,n,e){if(r<0)do{n.offAny(e.h)}while(++r);else if(0<r)do{n.onAny(e.h)}while(--r)}function d(r,e){for(var t=e.length;r<t;++r){var i=e[r];if(U(i)||n.isArray(i)&&d(0,i))return!0}return!1}function g(r){var t=r[1];if(function(r){for(var e in r){var t=r[e];if(U(t))return!0;if(E===e){if(n.isArray(t)&&d(0,t))return!0}else if(k===e||w===e)for(var i in t)if(U(t[i]))return!0}return!1}(t)||d(2,r)){var i={args:r};if(t){var f=t.key;null!=f&&(i.key=f)}return e.createElement(F,i)}return e.createElement.apply(null,r)}var m="value",A="error",k="style",w="dangerouslySetInnerHTML",E="children",U=function(r){return r instanceof t.Property},b="undefined"==typeof window?{h:null,forceUpdate:function(){}}:null,F=n.inherit(function(r){e.Component.call(this,r),(this.h=b)&&(this.state=n.object0)},e.Component,{componentDidMount:function(){c(this,this.props)},componentDidUpdate:function(r){var n=r.args,e=this.props.args,t=new Map;t.h=this.h,u(n[1],t,p),o(2,n,t,p),u(e[1],t,h),o(2,e,t,h),t.forEach(y)},componentWillUnmount:function(){v(this,this.props)},render:function(){if(this.h){var r=this.props.args,t=r.length,o=Array(t),u=o[0]=r[0];o[1]=function(r){var e=null;for(var t in r){var o=r[t],u=U(o)?i(o):E===t?n.isArray(o)?f(o):o:k===t||w===t?a(o):o;if(o!==u){if(!e)for(var l in e={},r){if(l===t)break;e[l]=r[l]}e[t]=u}else e&&(e[t]=u)}return e||r}(r[1]);for(var l=2;l<t;++l){var s=r[l];o[l]=U(s)?i(s):n.isArray(s)?f(s):s}return u===e.Fragment&&t<4&&null==o[2]?null:e.createElement.apply(null,o)}return null}},b&&{getDerivedStateFromProps:function(r){return c(b,r),v(b,r),null}});r.Fragment=e.Fragment,r.createElement=function(r,t,i){var f=t&&t["karet-lift"];if(f||n.isString(r)||e.Fragment===r){var a=arguments.length,o=Array(a);o[0]=r,o[1]=f?n.dissocPartialU("karet-lift",t):t;for(var u=2;u<a;++u)o[u]=arguments[u];return g(o)}return e.createElement.apply(null,arguments)},r.fromClass=function(r){return e.forwardRef(function(e,t){return g([r,null==t?e:n.assocPartialU("ref",t,e)])})},Object.defineProperty(r,"__esModule",{value:!0})});
!function(r,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("infestines"),require("react"),require("kefir")):"function"==typeof define&&define.amd?define(["exports","infestines","react","kefir"],n):n(r.karet={},r.I,r.React,r.Kefir)}(this,function(r,n,e,t){"use strict";function i(r){var n=r._currentEvent;if(n)return n.value}function f(r){for(var e=r,t=0,o=r.length;t<o;++t){var a=r[t],u=w(a)?i(a):n.isArray(a)?f(a):a;a!==u&&(e===r&&(e=r.slice(0)),e[t]=u)}return e}function o(r){var n=null;for(var e in r){var t=r[e];if(w(t)){if(!n)for(var f in n={},r){if(f===e)break;n[f]=r[f]}n[e]=i(t)}else n&&(n[e]=t)}return n||r}function a(r,e,t,i){for(var f=e.length;r<f;++r){var o=e[r];w(o)?i(t,o):n.isArray(o)&&a(0,o,t,i)}}function u(r,e,t){for(var i in r){var f=r[i];if(w(f))t(e,f);else if(k===i)n.isArray(f)&&a(0,f,e,t);else if(m===i||A===i)for(var o in f){var u=f[o];w(u)&&t(e,u)}}}function l(r,n){n.offAny(r)}function s(r,n){n.onAny(r)}function c(r,n){var e=n.args,t=r.h;t||(t=r.h=function(n){var e=n.type;if("value"===e)r.forceUpdate();else if("error"===e)throw n.value}),u(e[1],t,s),a(2,e,t,s)}function v(r,n){var e=r.h,t=n.args;a(2,t,e,l),u(t[1],e,l)}function p(r,n){r.set(n,(r.get(n)||0)-1)}function h(r,n){r.set(n,(r.get(n)||0)+1)}function d(r,n,e){for(;r<0;++r)n.offAny(e.h);for(;0<r;--r)n.onAny(e.h)}function y(r,e){for(var t=e.length;r<t;++r){var i=e[r];if(w(i)||n.isArray(i)&&y(0,i))return!0}return!1}function g(r){var t=r[1];return function(r){for(var e in r){var t=r[e];if(w(t))return!0;if(k===e){if(n.isArray(t)&&y(0,t))return!0}else if(m===e||A===e)for(var i in t)if(w(t[i]))return!0}return!1}(t)||y(2,r)?e.createElement(E,{args:r,key:t.key}):e.createElement.apply(null,r)}var m="style",A="dangerouslySetInnerHTML",k="children",w=function(r){return r instanceof t.Property},C="undefined"==typeof window?{h:null,forceUpdate:function(){}}:null,E=n.inherit(function(r){e.Component.call(this,r),(this.h=C)&&(this.state=n.object0)},e.Component,{componentDidMount:function(){c(this,this.props)},componentDidUpdate:function(r){var n=r.args,e=this.props.args,t=new Map;t.h=this.h,u(n[1],t,p),a(2,n,t,p),u(e[1],t,h),a(2,e,t,h),t.forEach(d)},componentWillUnmount:function(){v(this,this.props)},render:function(){if(this.h){var r=this.props.args,t=r.length,a=Array(t),u=a[0]=r[0];a[1]=function(r){var e=null;for(var t in r){var a=r[t],u=w(a)?i(a):k===t?n.isArray(a)?f(a):a:m===t||A===t?o(a):a;if(a!==u){if(!e)for(var l in e={},r){if(l===t)break;e[l]=r[l]}e[t]=u}else e&&(e[t]=u)}return e||r}(r[1]);for(var l=2;l<t;++l){var s=r[l];a[l]=w(s)?i(s):n.isArray(s)?f(s):s}return u===e.Fragment&&t<4&&null==a[2]?null:e.createElement.apply(null,a)}return null}},C&&{getDerivedStateFromProps:function(r){return c(C,r),v(C,r),null}});r.Children=e.Children,r.Fragment=e.Fragment,r.createContext=e.createContext,r.forwardRef=e.forwardRef,r.createElement=function(r,t,i){var f=(t=t||n.object0)["karet-lift"];if(f||n.isString(r)||e.Fragment===r){var o=arguments.length,a=Array(o);a[0]=r,a[1]=f?n.dissocPartialU("karet-lift",t):t;for(var u=2;u<o;++u)a[u]=arguments[u];return g(a)}return e.createElement.apply(null,arguments)},r.fromClass=function(r){return e.forwardRef(function(e,t){return g([r,null==t?e:n.assocPartialU("ref",t,e)])})},Object.defineProperty(r,"__esModule",{value:!0})});
{
"name": "karet",
"version": "3.2.2",
"version": "3.3.0",
"description": "Karet is a library that allows you to embed Kefir properties into React VDOM",

@@ -46,3 +46,3 @@ "module": "dist/karet.es.js",

"eslint": "^4.19.1",
"eslint-plugin-babel": "^5.0.0",
"eslint-plugin-babel": "^5.1.0",
"eslint-plugin-react": "^7.7.0",

@@ -53,3 +53,2 @@ "kefir": "^3.8.3",

"partial.lenses": "^13.9.0",
"prop-types": "^15.6.1",
"react": "^16.3.2",

@@ -56,0 +55,0 @@ "react-addons-test-utils": "^15.6.2",

@@ -17,3 +17,3 @@ # <a id="karet"></a> [≡](#contents) Karet &middot; [![Gitter](https://img.shields.io/gitter/room/calmm-js/chat.js.svg)](https://gitter.im/calmm-js/chat) [![GitHub stars](https://img.shields.io/github/stars/calmm-js/karet.svg?style=social)](https://github.com/calmm-js/karet) [![npm](https://img.shields.io/npm/dm/karet.svg)](https://www.npmjs.com/package/karet)

are pushed through observables. An update to a deeply nested VDOM element
can be an O(1) operation.
can be an `O(1)` operation.

@@ -34,3 +34,3 @@ Using Karet couldn't be simpler. Usually you just `import * as React from

* [Reference](#reference)
* [`Fragment`](#Fragment)
* [React exports passed through](#react-exports-passed-through)
* [`karet-lift` attribute](#karet-lift)

@@ -64,2 +64,6 @@ * [`fromClass(Component)`](#fromClass "fromClass: Component props -> Component (Property props)")

Note that the result, like the date and time display above, is *just* a React
component. If you export it, you can use it just like any other React component
and even in modules that do not import `karet`.
[Here is a live example in CodeSandbox](https://codesandbox.io/s/2o1mmnwxvp).

@@ -70,18 +74,39 @@

**NOTE:** Karet does not pass through all named React exports. Only
`createElement` and [`Fragment`](#Fragment) are exported, which is all that is
needed for basic use of VDOM or the Babel JSX transform.
## <a id="reference"></a> [≡](#contents) Reference
**NOTE:** The result, like the date and time dispplay above, is *just* a React
component. If you export it, you can use it just like any other React component
and even in modules that do not import `karet`.
### <a id="react-exports-passed-through"></a> [≡](#contents) [React exports passed through](#react-exports-passed-through)
## <a id="reference"></a> [≡](#contents) Reference
Karet passes through the following exports from React:
### <a id="Fragment"></a> [≡](#contents) [`Fragment`](#Fragment)
* [`Children`](https://reactjs.org/docs/react-api.html#reactchildren) as is.
Note that with observable properties in children these functions may not do
exactly what you want and you might want to
[lift](https://github.com/calmm-js/karet.util#lifting) them.
* [`Fragment`](https://reactjs.org/docs/fragments.html) as is. It should work
without problems.
* [`createContext`](https://reactjs.org/docs/context.html#reactcreatecontext) as
is. Note that with Karet it is preferable to put observable properties into
the context and let changes propagate through them rather than update the
context.
* [`createElement`](https://reactjs.org/docs/react-api.html#createelement) which
lifts Kefir properties in [fragments](https://reactjs.org/docs/fragments.html)
and built-in HTML elements.
* [`forwardRef`](https://reactjs.org/docs/react-api.html#reactforwardref) as is.
In addition to `createElement`, Karet exports [React's `Fragment`
component](https://reactjs.org/docs/fragments.html) and lifts fragments
implicitly.
Notably the following are not exported:
* [`Component`](https://reactjs.org/docs/react-api.html#reactcomponent) and
[`PureComponent`](https://reactjs.org/docs/react-api.html#reactpurecomponent),
because with Karet you really don't need them and the `render` method can
cause undesired component remounting when used with observable properties
embedded into VDOM.
* [`cloneElement`](https://reactjs.org/docs/react-api.html#cloneelement) does
not work out of the box with elements containing Kefir properties. It should
be possible [to support it](https://github.com/calmm-js/karet/issues/6),
however.
* [`createRef`](https://reactjs.org/docs/react-api.html#reactcreateref) is not
exported, because [Karet Util](https://github.com/calmm-js/karet.util)
provides an [alternative](https://github.com/calmm-js/karet.util/#U-refTo)
that works better with observable properties.
### <a id="karet-lift"></a> [≡](#contents) [`karet-lift` attribute](#karet-lift)

@@ -88,0 +113,0 @@

@@ -7,11 +7,13 @@ import babel from 'rollup-plugin-babel'

const globals = {
infestines: 'I',
kefir: 'Kefir',
react: 'React'
}
const build = ({NODE_ENV, format, suffix}) => ({
external: ['infestines', 'react', 'kefir'],
external: Object.keys(globals),
input: 'src/karet.js',
output: {
globals: {
infestines: 'I',
kefir: 'Kefir',
react: 'React'
},
globals,
exports: 'named',

@@ -29,4 +31,6 @@ name: 'karet',

'node_modules/react/index.js': [
'Children',
'Component',
'Fragment',
'createContext',
'createElement',

@@ -33,0 +37,0 @@ 'forwardRef'

@@ -7,5 +7,2 @@ import * as I from 'infestines'

const VALUE = 'value'
const ERROR = 'error'
const STYLE = 'style'

@@ -128,5 +125,5 @@ const DANGEROUSLY = 'dangerouslySetInnerHTML'

const {type} = e
if (type === VALUE) {
if (type === 'value') {
self.forceUpdate()
} else if (type === ERROR) {
} else if (type === 'error') {
throw e.value

@@ -140,27 +137,18 @@ }

function doUnsubscribe(self, {args}) {
const handler = self.h
if (handler) {
forEachInChildren(2, args, handler, offAny)
forEachInProps(args[1], handler, offAny)
}
function doUnsubscribe({h}, {args}) {
forEachInChildren(2, args, h, offAny)
forEachInProps(args[1], h, offAny)
}
function decObs(obs2num, property) {
obs2num.set(property, (obs2num.get(property) || 0) - 1)
function decObs(p2n, property) {
p2n.set(property, (p2n.get(property) || 0) - 1)
}
function incObs(obs2num, property) {
obs2num.set(property, (obs2num.get(property) || 0) + 1)
function incObs(p2n, property) {
p2n.set(property, (p2n.get(property) || 0) + 1)
}
function updateObs(delta, property, obs2num) {
if (delta < 0)
do {
property.offAny(obs2num.h)
} while (++delta)
else if (0 < delta)
do {
property.onAny(obs2num.h)
} while (--delta)
function updateObs(delta, property, p2n) {
for (; delta < 0; ++delta) property.offAny(p2n.h)
for (; 0 < delta; --delta) property.onAny(p2n.h)
}

@@ -184,12 +172,12 @@

const obs2num = new Map()
obs2num.h = this.h
const p2n = new Map()
p2n.h = this.h
forEachInProps(before[1], obs2num, decObs)
forEachInChildren(2, before, obs2num, decObs)
forEachInProps(before[1], p2n, decObs)
forEachInChildren(2, before, p2n, decObs)
forEachInProps(after[1], obs2num, incObs)
forEachInChildren(2, after, obs2num, incObs)
forEachInProps(after[1], p2n, incObs)
forEachInChildren(2, after, p2n, incObs)
obs2num.forEach(updateObs)
p2n.forEach(updateObs)
},

@@ -257,16 +245,10 @@ componentWillUnmount() {

const props = args[1]
if (hasPropertiesInProps(props) || hasPropertiesInChildren(2, args)) {
const fromClassProps = {args}
if (props) {
const key = props.key
if (null != key) fromClassProps.key = key
}
return React.createElement(FromClass, fromClassProps)
} else {
return React.createElement.apply(null, args)
}
return hasPropertiesInProps(props) || hasPropertiesInChildren(2, args)
? React.createElement(FromClass, {args, key: props.key})
: React.createElement.apply(null, args)
}
export function createElement(type, props, _child) {
const lift = props && props[LIFT]
props = props || I.object0
const lift = props[LIFT]
if (lift || I.isString(type) || React.Fragment === type) {

@@ -296,2 +278,2 @@ const n = arguments.length

export {Fragment} from 'react'
export {Children, Fragment, createContext, forwardRef} from 'react'

Sorry, the diff of this file is not supported yet

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