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

@lumino/virtualdom

Package Overview
Dependencies
Maintainers
6
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lumino/virtualdom - npm Package Compare versions

Comparing version 1.14.2 to 2.0.0-alpha.0

160

dist/index.es6.js
import { ArrayExt } from '@lumino/algorithm';
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
/* global Reflect, Promise */
var extendStatics = function(d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
function __extends(d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
}
// Copyright (c) Jupyter Development Team.
/**

@@ -41,3 +11,3 @@ * A virtual node which represents plain text content.

*/
var VirtualText = /** @class */ (function () {
class VirtualText {
/**

@@ -48,3 +18,3 @@ * Construct a new virtual text node.

*/
function VirtualText(content) {
constructor(content) {
/**

@@ -59,4 +29,3 @@ * The type of the node.

}
return VirtualText;
}());
}
/**

@@ -69,3 +38,3 @@ * A virtual node which represents an HTML element.

*/
var VirtualElement = /** @class */ (function () {
class VirtualElement {
/**

@@ -82,3 +51,3 @@ * Construct a new virtual element node.

*/
function VirtualElement(tag, attrs, children, renderer) {
constructor(tag, attrs, children, renderer) {
/**

@@ -96,4 +65,3 @@ * The type of the node.

}
return VirtualElement;
}());
}
/**

@@ -112,4 +80,3 @@ * DEPRECATED - use VirtualElement with a defined renderer param instead.

*/
var VirtualElementPass = /** @class */ (function (_super) {
__extends(VirtualElementPass, _super);
class VirtualElementPass extends VirtualElement {
/**

@@ -132,14 +99,13 @@ * DEPRECATED - use VirtualElement with a defined renderer param instead

*/
function VirtualElementPass(tag, attrs, renderer) {
return _super.call(this, tag, attrs, [], renderer || undefined) || this;
constructor(tag, attrs, renderer) {
super(tag, attrs, [], renderer || undefined);
}
return VirtualElementPass;
}(VirtualElement));
}
function h(tag) {
var attrs = {};
var renderer;
var children = [];
for (var i = 1, n = arguments.length; i < n; ++i) {
let attrs = {};
let renderer;
let children = [];
for (let i = 1, n = arguments.length; i < n; ++i) {
// eslint-disable-next-line prefer-rest-params
var arg = arguments[i];
let arg = arguments[i];
if (typeof arg === 'string') {

@@ -168,4 +134,3 @@ children.push(new VirtualText(arg));

function extend(array, values) {
for (var _i = 0, values_1 = values; _i < values_1.length; _i++) {
var child = values_1[_i];
for (let child of values) {
if (typeof child === 'string') {

@@ -286,7 +251,7 @@ array.push(new VirtualText(child));

function hpass(tag) {
var attrs = {};
var renderer = null;
let attrs = {};
let renderer = null;
if (arguments.length === 2) {
// eslint-disable-next-line prefer-rest-params
var arg = arguments[1];
const arg = arguments[1];
if ('render' in arg) {

@@ -336,4 +301,4 @@ renderer = arg;

function render(content, host) {
var oldContent = Private.hostMap.get(host) || [];
var newContent = Private.asContentArray(content);
let oldContent = Private.hostMap.get(host) || [];
let newContent = Private.asContentArray(content);
Private.hostMap.set(host, newContent);

@@ -368,5 +333,5 @@ Private.updateContent(host, oldContent, newContent);

// eslint-disable-next-line prefer-rest-params
var host = arguments[1] || null;
let host = arguments[1] || null;
// eslint-disable-next-line prefer-rest-params
var before = arguments[2] || null;
const before = arguments[2] || null;
if (host) {

@@ -392,3 +357,3 @@ host.insertBefore(createDOMNode(node), before);

// Recursively populate the element with child content.
for (var i = 0, n = node.children.length; i < n; ++i) {
for (let i = 0, n = node.children.length; i < n; ++i) {
createDOMNode(node.children[i], host);

@@ -412,5 +377,5 @@ }

// Collect the old keyed elems into a mapping.
var oldKeyed = collectKeys(host, oldContent);
let oldKeyed = collectKeys(host, oldContent);
// Create a copy of the old content which can be modified in-place.
var oldCopy = oldContent.slice();
let oldCopy = oldContent.slice();
// Update the host with the new content. The diff always proceeds

@@ -421,5 +386,5 @@ // forward and never modifies a previously visited index. The old

// the end of the host node and removed at the end of the loop.
var currElem = host.firstChild;
var newCount = newContent.length;
for (var i = 0; i < newCount; ++i) {
let currElem = host.firstChild;
let newCount = newContent.length;
for (let i = 0; i < newCount; ++i) {
// If the old content is exhausted, create a new node.

@@ -431,4 +396,4 @@ if (i >= oldCopy.length) {

// Lookup the old and new virtual nodes.
var oldVNode = oldCopy[i];
var newVNode = newContent[i];
let oldVNode = oldCopy[i];
let newVNode = newContent[i];
// If both elements are identical, there is nothing to do.

@@ -464,5 +429,5 @@ if (oldVNode === newVNode) {

// pushed forward in the old copy array.
var newKey = newVNode.attrs.key;
let newKey = newVNode.attrs.key;
if (newKey && newKey in oldKeyed) {
var pair = oldKeyed[newKey];
let pair = oldKeyed[newKey];
if (pair.vNode !== oldVNode) {

@@ -483,3 +448,3 @@ ArrayExt.move(oldCopy, oldCopy.indexOf(pair.vNode, i + 1), i);

// may be matched at a later point in the diff.
var oldKey = oldVNode.attrs.key;
let oldKey = oldVNode.attrs.key;
if (oldKey && oldKey !== newKey) {

@@ -526,7 +491,5 @@ ArrayExt.insert(oldCopy, i, newVNode);

// Dispose of the old nodes pushed to the end of the host.
for (var i = oldContent.length - 1; i >= newCount; --i) {
var oldNode = oldContent[i];
var child = (_sentinel
? host.lastChild
: host.childNodes[i]);
for (let i = oldContent.length - 1; i >= newCount; --i) {
const oldNode = oldContent[i];
const child = (_sentinel ? host.lastChild : host.childNodes[i]);
// recursively clean up host children

@@ -551,3 +514,3 @@ if (oldNode.type === 'text') ;

*/
var specialAttrs = {
const specialAttrs = {
key: true,

@@ -564,11 +527,11 @@ className: true,

// Add the inline event listeners and node attributes.
for (var name_1 in attrs) {
if (name_1 in specialAttrs) {
for (let name in attrs) {
if (name in specialAttrs) {
continue;
}
if (name_1.substr(0, 2) === 'on') {
element[name_1] = attrs[name_1];
if (name.substr(0, 2) === 'on') {
element[name] = attrs[name];
}
else {
element.setAttribute(name_1, attrs[name_1]);
element.setAttribute(name, attrs[name]);
}

@@ -602,3 +565,3 @@ }

// Setup the strongly typed loop variable.
var name;
let name;
// Remove attributes and listeners which no longer exist.

@@ -659,4 +622,4 @@ for (name in oldAttrs) {

function addDataset(element, dataset) {
for (var name_2 in dataset) {
element.setAttribute("data-" + name_2, dataset[name_2]);
for (let name in dataset) {
element.setAttribute(`data-${name}`, dataset[name]);
}

@@ -668,10 +631,10 @@ }

function updateDataset(element, oldDataset, newDataset) {
for (var name_3 in oldDataset) {
if (!(name_3 in newDataset)) {
element.removeAttribute("data-" + name_3);
for (let name in oldDataset) {
if (!(name in newDataset)) {
element.removeAttribute(`data-${name}`);
}
}
for (var name_4 in newDataset) {
if (oldDataset[name_4] !== newDataset[name_4]) {
element.setAttribute("data-" + name_4, newDataset[name_4]);
for (let name in newDataset) {
if (oldDataset[name] !== newDataset[name]) {
element.setAttribute(`data-${name}`, newDataset[name]);
}

@@ -684,4 +647,4 @@ }

function addStyle(element, style) {
var elemStyle = element.style;
var name;
let elemStyle = element.style;
let name;
for (name in style) {

@@ -695,4 +658,4 @@ elemStyle[name] = style[name];

function updateStyle(element, oldStyle, newStyle) {
var elemStyle = element.style;
var name;
let elemStyle = element.style;
let name;
for (name in oldStyle) {

@@ -713,8 +676,7 @@ if (!(name in newStyle)) {

function collectKeys(host, content) {
var node = host.firstChild;
var keyMap = Object.create(null);
for (var _i = 0, content_1 = content; _i < content_1.length; _i++) {
var vNode = content_1[_i];
let node = host.firstChild;
let keyMap = Object.create(null);
for (let vNode of content) {
if (vNode.type === 'element' && vNode.attrs.key) {
keyMap[vNode.attrs.key] = { vNode: vNode, element: node };
keyMap[vNode.attrs.key] = { vNode, element: node };
}

@@ -721,0 +683,0 @@ node = node.nextSibling;

@@ -5,35 +5,5 @@ (function (global, factory) {

(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.lumino_virtualdom = {}, global.lumino_algorithm));
}(this, (function (exports, algorithm) { 'use strict';
})(this, (function (exports, algorithm) { 'use strict';
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
/* global Reflect, Promise */
var extendStatics = function(d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
function __extends(d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
}
// Copyright (c) Jupyter Development Team.
/**

@@ -46,3 +16,3 @@ * A virtual node which represents plain text content.

*/
var VirtualText = /** @class */ (function () {
class VirtualText {
/**

@@ -53,3 +23,3 @@ * Construct a new virtual text node.

*/
function VirtualText(content) {
constructor(content) {
/**

@@ -64,4 +34,3 @@ * The type of the node.

}
return VirtualText;
}());
}
/**

@@ -74,3 +43,3 @@ * A virtual node which represents an HTML element.

*/
var VirtualElement = /** @class */ (function () {
class VirtualElement {
/**

@@ -87,3 +56,3 @@ * Construct a new virtual element node.

*/
function VirtualElement(tag, attrs, children, renderer) {
constructor(tag, attrs, children, renderer) {
/**

@@ -101,4 +70,3 @@ * The type of the node.

}
return VirtualElement;
}());
}
/**

@@ -117,4 +85,3 @@ * DEPRECATED - use VirtualElement with a defined renderer param instead.

*/
var VirtualElementPass = /** @class */ (function (_super) {
__extends(VirtualElementPass, _super);
class VirtualElementPass extends VirtualElement {
/**

@@ -137,14 +104,13 @@ * DEPRECATED - use VirtualElement with a defined renderer param instead

*/
function VirtualElementPass(tag, attrs, renderer) {
return _super.call(this, tag, attrs, [], renderer || undefined) || this;
constructor(tag, attrs, renderer) {
super(tag, attrs, [], renderer || undefined);
}
return VirtualElementPass;
}(VirtualElement));
}
function h(tag) {
var attrs = {};
var renderer;
var children = [];
for (var i = 1, n = arguments.length; i < n; ++i) {
let attrs = {};
let renderer;
let children = [];
for (let i = 1, n = arguments.length; i < n; ++i) {
// eslint-disable-next-line prefer-rest-params
var arg = arguments[i];
let arg = arguments[i];
if (typeof arg === 'string') {

@@ -173,4 +139,3 @@ children.push(new VirtualText(arg));

function extend(array, values) {
for (var _i = 0, values_1 = values; _i < values_1.length; _i++) {
var child = values_1[_i];
for (let child of values) {
if (typeof child === 'string') {

@@ -291,7 +256,7 @@ array.push(new VirtualText(child));

function hpass(tag) {
var attrs = {};
var renderer = null;
let attrs = {};
let renderer = null;
if (arguments.length === 2) {
// eslint-disable-next-line prefer-rest-params
var arg = arguments[1];
const arg = arguments[1];
if ('render' in arg) {

@@ -341,4 +306,4 @@ renderer = arg;

function render(content, host) {
var oldContent = Private.hostMap.get(host) || [];
var newContent = Private.asContentArray(content);
let oldContent = Private.hostMap.get(host) || [];
let newContent = Private.asContentArray(content);
Private.hostMap.set(host, newContent);

@@ -373,5 +338,5 @@ Private.updateContent(host, oldContent, newContent);

// eslint-disable-next-line prefer-rest-params
var host = arguments[1] || null;
let host = arguments[1] || null;
// eslint-disable-next-line prefer-rest-params
var before = arguments[2] || null;
const before = arguments[2] || null;
if (host) {

@@ -397,3 +362,3 @@ host.insertBefore(createDOMNode(node), before);

// Recursively populate the element with child content.
for (var i = 0, n = node.children.length; i < n; ++i) {
for (let i = 0, n = node.children.length; i < n; ++i) {
createDOMNode(node.children[i], host);

@@ -417,5 +382,5 @@ }

// Collect the old keyed elems into a mapping.
var oldKeyed = collectKeys(host, oldContent);
let oldKeyed = collectKeys(host, oldContent);
// Create a copy of the old content which can be modified in-place.
var oldCopy = oldContent.slice();
let oldCopy = oldContent.slice();
// Update the host with the new content. The diff always proceeds

@@ -426,5 +391,5 @@ // forward and never modifies a previously visited index. The old

// the end of the host node and removed at the end of the loop.
var currElem = host.firstChild;
var newCount = newContent.length;
for (var i = 0; i < newCount; ++i) {
let currElem = host.firstChild;
let newCount = newContent.length;
for (let i = 0; i < newCount; ++i) {
// If the old content is exhausted, create a new node.

@@ -436,4 +401,4 @@ if (i >= oldCopy.length) {

// Lookup the old and new virtual nodes.
var oldVNode = oldCopy[i];
var newVNode = newContent[i];
let oldVNode = oldCopy[i];
let newVNode = newContent[i];
// If both elements are identical, there is nothing to do.

@@ -469,5 +434,5 @@ if (oldVNode === newVNode) {

// pushed forward in the old copy array.
var newKey = newVNode.attrs.key;
let newKey = newVNode.attrs.key;
if (newKey && newKey in oldKeyed) {
var pair = oldKeyed[newKey];
let pair = oldKeyed[newKey];
if (pair.vNode !== oldVNode) {

@@ -488,3 +453,3 @@ algorithm.ArrayExt.move(oldCopy, oldCopy.indexOf(pair.vNode, i + 1), i);

// may be matched at a later point in the diff.
var oldKey = oldVNode.attrs.key;
let oldKey = oldVNode.attrs.key;
if (oldKey && oldKey !== newKey) {

@@ -531,7 +496,5 @@ algorithm.ArrayExt.insert(oldCopy, i, newVNode);

// Dispose of the old nodes pushed to the end of the host.
for (var i = oldContent.length - 1; i >= newCount; --i) {
var oldNode = oldContent[i];
var child = (_sentinel
? host.lastChild
: host.childNodes[i]);
for (let i = oldContent.length - 1; i >= newCount; --i) {
const oldNode = oldContent[i];
const child = (_sentinel ? host.lastChild : host.childNodes[i]);
// recursively clean up host children

@@ -556,3 +519,3 @@ if (oldNode.type === 'text') ;

*/
var specialAttrs = {
const specialAttrs = {
key: true,

@@ -569,11 +532,11 @@ className: true,

// Add the inline event listeners and node attributes.
for (var name_1 in attrs) {
if (name_1 in specialAttrs) {
for (let name in attrs) {
if (name in specialAttrs) {
continue;
}
if (name_1.substr(0, 2) === 'on') {
element[name_1] = attrs[name_1];
if (name.substr(0, 2) === 'on') {
element[name] = attrs[name];
}
else {
element.setAttribute(name_1, attrs[name_1]);
element.setAttribute(name, attrs[name]);
}

@@ -607,3 +570,3 @@ }

// Setup the strongly typed loop variable.
var name;
let name;
// Remove attributes and listeners which no longer exist.

@@ -664,4 +627,4 @@ for (name in oldAttrs) {

function addDataset(element, dataset) {
for (var name_2 in dataset) {
element.setAttribute("data-" + name_2, dataset[name_2]);
for (let name in dataset) {
element.setAttribute(`data-${name}`, dataset[name]);
}

@@ -673,10 +636,10 @@ }

function updateDataset(element, oldDataset, newDataset) {
for (var name_3 in oldDataset) {
if (!(name_3 in newDataset)) {
element.removeAttribute("data-" + name_3);
for (let name in oldDataset) {
if (!(name in newDataset)) {
element.removeAttribute(`data-${name}`);
}
}
for (var name_4 in newDataset) {
if (oldDataset[name_4] !== newDataset[name_4]) {
element.setAttribute("data-" + name_4, newDataset[name_4]);
for (let name in newDataset) {
if (oldDataset[name] !== newDataset[name]) {
element.setAttribute(`data-${name}`, newDataset[name]);
}

@@ -689,4 +652,4 @@ }

function addStyle(element, style) {
var elemStyle = element.style;
var name;
let elemStyle = element.style;
let name;
for (name in style) {

@@ -700,4 +663,4 @@ elemStyle[name] = style[name];

function updateStyle(element, oldStyle, newStyle) {
var elemStyle = element.style;
var name;
let elemStyle = element.style;
let name;
for (name in oldStyle) {

@@ -718,8 +681,7 @@ if (!(name in newStyle)) {

function collectKeys(host, content) {
var node = host.firstChild;
var keyMap = Object.create(null);
for (var _i = 0, content_1 = content; _i < content_1.length; _i++) {
var vNode = content_1[_i];
let node = host.firstChild;
let keyMap = Object.create(null);
for (let vNode of content) {
if (vNode.type === 'element' && vNode.attrs.key) {
keyMap[vNode.attrs.key] = { vNode: vNode, element: node };
keyMap[vNode.attrs.key] = { vNode, element: node };
}

@@ -740,3 +702,3 @@ node = node.nextSibling;

})));
}));
//# sourceMappingURL=index.js.map

@@ -1,16 +0,2 @@

!function(i,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@lumino/algorithm")):"function"==typeof define&&define.amd?define(["exports","@lumino/algorithm"],t):t((i="undefined"!=typeof globalThis?globalThis:i||self).lumino_virtualdom={},i.lumino_algorithm)}(this,(function(i,t){"use strict";
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */var e=function(i,t){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,t){i.__proto__=t}||function(i,t){for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&(i[e]=t[e])},e(i,t)};var n,d,o=function(i){this.type="text",this.content=i},r=function(i,t,e,n){this.type="element",this.tag=i,this.attrs=t,this.children=e,this.renderer=n},a=function(i){function t(t,e,n){return i.call(this,t,e,[],n||void 0)||this}return function(i,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=i}e(i,t),i.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}(t,i),t}(r);function s(i){for(var t,e={},n=[],d=1,a=arguments.length;d<a;++d){var s=arguments[d];"string"==typeof s?n.push(new o(s)):s instanceof o||s instanceof r?n.push(s):s instanceof Array?l(n,s):1!==d&&2!==d||!s||"object"!=typeof s||("render"in s?t=s:e=s)}return new r(i,e,n,t);function l(i,t){for(var e=0,n=t;e<n.length;e++){var d=n[e];"string"==typeof d?i.push(new o(d)):(d instanceof o||d instanceof r)&&i.push(d)}}}!function(i){i.a=i.bind(void 0,"a"),i.abbr=i.bind(void 0,"abbr"),i.address=i.bind(void 0,"address"),i.area=i.bind(void 0,"area"),i.article=i.bind(void 0,"article"),i.aside=i.bind(void 0,"aside"),i.audio=i.bind(void 0,"audio"),i.b=i.bind(void 0,"b"),i.bdi=i.bind(void 0,"bdi"),i.bdo=i.bind(void 0,"bdo"),i.blockquote=i.bind(void 0,"blockquote"),i.br=i.bind(void 0,"br"),i.button=i.bind(void 0,"button"),i.canvas=i.bind(void 0,"canvas"),i.caption=i.bind(void 0,"caption"),i.cite=i.bind(void 0,"cite"),i.code=i.bind(void 0,"code"),i.col=i.bind(void 0,"col"),i.colgroup=i.bind(void 0,"colgroup"),i.data=i.bind(void 0,"data"),i.datalist=i.bind(void 0,"datalist"),i.dd=i.bind(void 0,"dd"),i.del=i.bind(void 0,"del"),i.dfn=i.bind(void 0,"dfn"),i.div=i.bind(void 0,"div"),i.dl=i.bind(void 0,"dl"),i.dt=i.bind(void 0,"dt"),i.em=i.bind(void 0,"em"),i.embed=i.bind(void 0,"embed"),i.fieldset=i.bind(void 0,"fieldset"),i.figcaption=i.bind(void 0,"figcaption"),i.figure=i.bind(void 0,"figure"),i.footer=i.bind(void 0,"footer"),i.form=i.bind(void 0,"form"),i.h1=i.bind(void 0,"h1"),i.h2=i.bind(void 0,"h2"),i.h3=i.bind(void 0,"h3"),i.h4=i.bind(void 0,"h4"),i.h5=i.bind(void 0,"h5"),i.h6=i.bind(void 0,"h6"),i.header=i.bind(void 0,"header"),i.hr=i.bind(void 0,"hr"),i.i=i.bind(void 0,"i"),i.iframe=i.bind(void 0,"iframe"),i.img=i.bind(void 0,"img"),i.input=i.bind(void 0,"input"),i.ins=i.bind(void 0,"ins"),i.kbd=i.bind(void 0,"kbd"),i.label=i.bind(void 0,"label"),i.legend=i.bind(void 0,"legend"),i.li=i.bind(void 0,"li"),i.main=i.bind(void 0,"main"),i.map=i.bind(void 0,"map"),i.mark=i.bind(void 0,"mark"),i.meter=i.bind(void 0,"meter"),i.nav=i.bind(void 0,"nav"),i.noscript=i.bind(void 0,"noscript"),i.object=i.bind(void 0,"object"),i.ol=i.bind(void 0,"ol"),i.optgroup=i.bind(void 0,"optgroup"),i.option=i.bind(void 0,"option"),i.output=i.bind(void 0,"output"),i.p=i.bind(void 0,"p"),i.param=i.bind(void 0,"param"),i.pre=i.bind(void 0,"pre"),i.progress=i.bind(void 0,"progress"),i.q=i.bind(void 0,"q"),i.rp=i.bind(void 0,"rp"),i.rt=i.bind(void 0,"rt"),i.ruby=i.bind(void 0,"ruby"),i.s=i.bind(void 0,"s"),i.samp=i.bind(void 0,"samp"),i.section=i.bind(void 0,"section"),i.select=i.bind(void 0,"select"),i.small=i.bind(void 0,"small"),i.source=i.bind(void 0,"source"),i.span=i.bind(void 0,"span"),i.strong=i.bind(void 0,"strong"),i.sub=i.bind(void 0,"sub"),i.summary=i.bind(void 0,"summary"),i.sup=i.bind(void 0,"sup"),i.table=i.bind(void 0,"table"),i.tbody=i.bind(void 0,"tbody"),i.td=i.bind(void 0,"td"),i.textarea=i.bind(void 0,"textarea"),i.tfoot=i.bind(void 0,"tfoot"),i.th=i.bind(void 0,"th"),i.thead=i.bind(void 0,"thead"),i.time=i.bind(void 0,"time"),i.title=i.bind(void 0,"title"),i.tr=i.bind(void 0,"tr"),i.track=i.bind(void 0,"track"),i.u=i.bind(void 0,"u"),i.ul=i.bind(void 0,"ul"),i.var_=i.bind(void 0,"var"),i.video=i.bind(void 0,"video"),i.wbr=i.bind(void 0,"wbr")}(s||(s={})),i.VirtualDOM=void 0,(n=i.VirtualDOM||(i.VirtualDOM={})).realize=function(i){return d.createDOMNode(i)},n.render=function(i,t){var e=d.hostMap.get(t)||[],n=d.asContentArray(i);d.hostMap.set(t,n),d.updateContent(t,e,n)},function(i){function e(i){var t=arguments[1]||null,n=arguments[2]||null;if(t)t.insertBefore(e(i),n);else{if("text"===i.type)return document.createTextNode(i.content);if(o(t=document.createElement(i.tag),i.attrs),i.renderer)return i.renderer.render(t,{attrs:i.attrs,children:i.children}),t;for(var d=0,r=i.children.length;d<r;++d)e(i.children[d],t)}return t}function n(i,t,e,d){for(var o=t.length-1;o>=e;--o){var r=t[o],a=d?i.lastChild:i.childNodes[o];"text"===r.type||(r.renderer&&r.renderer.unrender?r.renderer.unrender(a,{attrs:r.attrs,children:r.children}):n(a,r.children,0,!1)),d&&i.removeChild(a)}}i.hostMap=new WeakMap,i.asContentArray=function(i){return i?i instanceof Array?i:[i]:[]},i.createDOMNode=e,i.updateContent=function i(d,o,a){if(o!==a){for(var s=function(i,t){for(var e=i.firstChild,n=Object.create(null),d=0,o=t;d<o.length;d++){var r=o[d];"element"===r.type&&r.attrs.key&&(n[r.attrs.key]={vNode:r,element:e}),e=e.nextSibling}return n}(d,o),l=o.slice(),b=d.firstChild,v=a.length,u=0;u<v;++u)if(u>=l.length)e(a[u],d);else{var c=l[u],f=a[u];if(c!==f)if("text"!==c.type||"text"!==f.type)if("text"!==c.type&&"text"!==f.type)if(!c.renderer==!f.renderer){var h=f.attrs.key;if(h&&h in s){var p=s[h];p.vNode!==c&&(t.ArrayExt.move(l,l.indexOf(p.vNode,u+1),u),d.insertBefore(p.element,b),c=p.vNode,b=p.element)}if(c!==f){var m=c.attrs.key;m&&m!==h?(t.ArrayExt.insert(l,u,f),e(f,d,b)):c.tag===f.tag?(r(b,c.attrs,f.attrs),f.renderer?f.renderer.render(b,{attrs:f.attrs,children:f.children}):i(b,c.children,f.children),b=b.nextSibling):(t.ArrayExt.insert(l,u,f),e(f,d,b))}else b=b.nextSibling}else t.ArrayExt.insert(l,u,f),e(f,d,b);else t.ArrayExt.insert(l,u,f),e(f,d,b);else b.textContent=f.content,b=b.nextSibling;else b=b.nextSibling}n(d,l,v,!0)}};var d={key:!0,className:!0,htmlFor:!0,dataset:!0,style:!0};function o(i,t){for(var e in t)e in d||("on"===e.substr(0,2)?i[e]=t[e]:i.setAttribute(e,t[e]));void 0!==t.className&&i.setAttribute("class",t.className),void 0!==t.htmlFor&&i.setAttribute("for",t.htmlFor),t.dataset&&function(i,t){for(var e in t)i.setAttribute("data-"+e,t[e])}(i,t.dataset),t.style&&function(i,t){var e,n=i.style;for(e in t)n[e]=t[e]}(i,t.style)}function r(i,t,e){if(t!==e){var n;for(n in t)n in d||n in e||("on"===n.substr(0,2)?i[n]=null:i.removeAttribute(n));for(n in e)n in d||t[n]===e[n]||("on"===n.substr(0,2)?i[n]=e[n]:i.setAttribute(n,e[n]));t.className!==e.className&&(void 0!==e.className?i.setAttribute("class",e.className):i.removeAttribute("class")),t.htmlFor!==e.htmlFor&&(void 0!==e.htmlFor?i.setAttribute("for",e.htmlFor):i.removeAttribute("for")),t.dataset!==e.dataset&&function(i,t,e){for(var n in t)n in e||i.removeAttribute("data-"+n);for(var d in e)t[d]!==e[d]&&i.setAttribute("data-"+d,e[d])}(i,t.dataset||{},e.dataset||{}),t.style!==e.style&&function(i,t,e){var n,d=i.style;for(n in t)n in e||(d[n]="");for(n in e)t[n]!==e[n]&&(d[n]=e[n])}(i,t.style||{},e.style||{})}}}(d||(d={})),i.VirtualElement=r,i.VirtualElementPass=a,i.VirtualText=o,i.h=s,i.hpass=function(i){var t={},e=null;if(2===arguments.length){var n=arguments[1];"render"in n?e=n:t=n}else if(3===arguments.length)t=arguments[1],e=arguments[2];else if(arguments.length>3)throw new Error("hpass() should be called with 1, 2, or 3 arguments");return new a(i,t,e)},Object.defineProperty(i,"__esModule",{value:!0})}));
!function(i,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@lumino/algorithm")):"function"==typeof define&&define.amd?define(["exports","@lumino/algorithm"],t):t((i="undefined"!=typeof globalThis?globalThis:i||self).lumino_virtualdom={},i.lumino_algorithm)}(this,(function(i,t){"use strict";class e{constructor(i){this.type="text",this.content=i}}class n{constructor(i,t,e,n){this.type="element",this.tag=i,this.attrs=t,this.children=e,this.renderer=n}}class d extends n{constructor(i,t,e){super(i,t,[],e||void 0)}}function o(i){let t,d={},o=[];for(let i=1,a=arguments.length;i<a;++i){let a=arguments[i];"string"==typeof a?o.push(new e(a)):a instanceof e||a instanceof n?o.push(a):a instanceof Array?r(o,a):1!==i&&2!==i||!a||"object"!=typeof a||("render"in a?t=a:d=a)}return new n(i,d,o,t);function r(i,t){for(let d of t)"string"==typeof d?i.push(new e(d)):(d instanceof e||d instanceof n)&&i.push(d)}}var r,a;!function(i){i.a=i.bind(void 0,"a"),i.abbr=i.bind(void 0,"abbr"),i.address=i.bind(void 0,"address"),i.area=i.bind(void 0,"area"),i.article=i.bind(void 0,"article"),i.aside=i.bind(void 0,"aside"),i.audio=i.bind(void 0,"audio"),i.b=i.bind(void 0,"b"),i.bdi=i.bind(void 0,"bdi"),i.bdo=i.bind(void 0,"bdo"),i.blockquote=i.bind(void 0,"blockquote"),i.br=i.bind(void 0,"br"),i.button=i.bind(void 0,"button"),i.canvas=i.bind(void 0,"canvas"),i.caption=i.bind(void 0,"caption"),i.cite=i.bind(void 0,"cite"),i.code=i.bind(void 0,"code"),i.col=i.bind(void 0,"col"),i.colgroup=i.bind(void 0,"colgroup"),i.data=i.bind(void 0,"data"),i.datalist=i.bind(void 0,"datalist"),i.dd=i.bind(void 0,"dd"),i.del=i.bind(void 0,"del"),i.dfn=i.bind(void 0,"dfn"),i.div=i.bind(void 0,"div"),i.dl=i.bind(void 0,"dl"),i.dt=i.bind(void 0,"dt"),i.em=i.bind(void 0,"em"),i.embed=i.bind(void 0,"embed"),i.fieldset=i.bind(void 0,"fieldset"),i.figcaption=i.bind(void 0,"figcaption"),i.figure=i.bind(void 0,"figure"),i.footer=i.bind(void 0,"footer"),i.form=i.bind(void 0,"form"),i.h1=i.bind(void 0,"h1"),i.h2=i.bind(void 0,"h2"),i.h3=i.bind(void 0,"h3"),i.h4=i.bind(void 0,"h4"),i.h5=i.bind(void 0,"h5"),i.h6=i.bind(void 0,"h6"),i.header=i.bind(void 0,"header"),i.hr=i.bind(void 0,"hr"),i.i=i.bind(void 0,"i"),i.iframe=i.bind(void 0,"iframe"),i.img=i.bind(void 0,"img"),i.input=i.bind(void 0,"input"),i.ins=i.bind(void 0,"ins"),i.kbd=i.bind(void 0,"kbd"),i.label=i.bind(void 0,"label"),i.legend=i.bind(void 0,"legend"),i.li=i.bind(void 0,"li"),i.main=i.bind(void 0,"main"),i.map=i.bind(void 0,"map"),i.mark=i.bind(void 0,"mark"),i.meter=i.bind(void 0,"meter"),i.nav=i.bind(void 0,"nav"),i.noscript=i.bind(void 0,"noscript"),i.object=i.bind(void 0,"object"),i.ol=i.bind(void 0,"ol"),i.optgroup=i.bind(void 0,"optgroup"),i.option=i.bind(void 0,"option"),i.output=i.bind(void 0,"output"),i.p=i.bind(void 0,"p"),i.param=i.bind(void 0,"param"),i.pre=i.bind(void 0,"pre"),i.progress=i.bind(void 0,"progress"),i.q=i.bind(void 0,"q"),i.rp=i.bind(void 0,"rp"),i.rt=i.bind(void 0,"rt"),i.ruby=i.bind(void 0,"ruby"),i.s=i.bind(void 0,"s"),i.samp=i.bind(void 0,"samp"),i.section=i.bind(void 0,"section"),i.select=i.bind(void 0,"select"),i.small=i.bind(void 0,"small"),i.source=i.bind(void 0,"source"),i.span=i.bind(void 0,"span"),i.strong=i.bind(void 0,"strong"),i.sub=i.bind(void 0,"sub"),i.summary=i.bind(void 0,"summary"),i.sup=i.bind(void 0,"sup"),i.table=i.bind(void 0,"table"),i.tbody=i.bind(void 0,"tbody"),i.td=i.bind(void 0,"td"),i.textarea=i.bind(void 0,"textarea"),i.tfoot=i.bind(void 0,"tfoot"),i.th=i.bind(void 0,"th"),i.thead=i.bind(void 0,"thead"),i.time=i.bind(void 0,"time"),i.title=i.bind(void 0,"title"),i.tr=i.bind(void 0,"tr"),i.track=i.bind(void 0,"track"),i.u=i.bind(void 0,"u"),i.ul=i.bind(void 0,"ul"),i.var_=i.bind(void 0,"var"),i.video=i.bind(void 0,"video"),i.wbr=i.bind(void 0,"wbr")}(o||(o={})),i.VirtualDOM=void 0,(r=i.VirtualDOM||(i.VirtualDOM={})).realize=function(i){return a.createDOMNode(i)},r.render=function(i,t){let e=a.hostMap.get(t)||[],n=a.asContentArray(i);a.hostMap.set(t,n),a.updateContent(t,e,n)},function(i){function e(i){let t=arguments[1]||null;const n=arguments[2]||null;if(t)t.insertBefore(e(i),n);else{if("text"===i.type)return document.createTextNode(i.content);if(t=document.createElement(i.tag),o(t,i.attrs),i.renderer)return i.renderer.render(t,{attrs:i.attrs,children:i.children}),t;for(let n=0,d=i.children.length;n<d;++n)e(i.children[n],t)}return t}function n(i,t,e,d){for(let o=t.length-1;o>=e;--o){const e=t[o],r=d?i.lastChild:i.childNodes[o];"text"===e.type||(e.renderer&&e.renderer.unrender?e.renderer.unrender(r,{attrs:e.attrs,children:e.children}):n(r,e.children,0,!1)),d&&i.removeChild(r)}}i.hostMap=new WeakMap,i.asContentArray=function(i){return i?i instanceof Array?i:[i]:[]},i.createDOMNode=e,i.updateContent=function i(d,o,a){if(o===a)return;let s=function(i,t){let e=i.firstChild,n=Object.create(null);for(let i of t)"element"===i.type&&i.attrs.key&&(n[i.attrs.key]={vNode:i,element:e}),e=e.nextSibling;return n}(d,o),l=o.slice(),b=d.firstChild,v=a.length;for(let n=0;n<v;++n){if(n>=l.length){e(a[n],d);continue}let o=l[n],v=a[n];if(o===v){b=b.nextSibling;continue}if("text"===o.type&&"text"===v.type){b.textContent=v.content,b=b.nextSibling;continue}if("text"===o.type||"text"===v.type){t.ArrayExt.insert(l,n,v),e(v,d,b);continue}if(!o.renderer!=!v.renderer){t.ArrayExt.insert(l,n,v),e(v,d,b);continue}let u=v.attrs.key;if(u&&u in s){let i=s[u];i.vNode!==o&&(t.ArrayExt.move(l,l.indexOf(i.vNode,n+1),n),d.insertBefore(i.element,b),o=i.vNode,b=i.element)}if(o===v){b=b.nextSibling;continue}let c=o.attrs.key;c&&c!==u?(t.ArrayExt.insert(l,n,v),e(v,d,b)):o.tag===v.tag?(r(b,o.attrs,v.attrs),v.renderer?v.renderer.render(b,{attrs:v.attrs,children:v.children}):i(b,o.children,v.children),b=b.nextSibling):(t.ArrayExt.insert(l,n,v),e(v,d,b))}n(d,l,v,!0)};const d={key:!0,className:!0,htmlFor:!0,dataset:!0,style:!0};function o(i,t){for(let e in t)e in d||("on"===e.substr(0,2)?i[e]=t[e]:i.setAttribute(e,t[e]));void 0!==t.className&&i.setAttribute("class",t.className),void 0!==t.htmlFor&&i.setAttribute("for",t.htmlFor),t.dataset&&function(i,t){for(let e in t)i.setAttribute(`data-${e}`,t[e])}(i,t.dataset),t.style&&function(i,t){let e,n=i.style;for(e in t)n[e]=t[e]}(i,t.style)}function r(i,t,e){if(t===e)return;let n;for(n in t)n in d||n in e||("on"===n.substr(0,2)?i[n]=null:i.removeAttribute(n));for(n in e)n in d||t[n]===e[n]||("on"===n.substr(0,2)?i[n]=e[n]:i.setAttribute(n,e[n]));t.className!==e.className&&(void 0!==e.className?i.setAttribute("class",e.className):i.removeAttribute("class")),t.htmlFor!==e.htmlFor&&(void 0!==e.htmlFor?i.setAttribute("for",e.htmlFor):i.removeAttribute("for")),t.dataset!==e.dataset&&function(i,t,e){for(let n in t)n in e||i.removeAttribute(`data-${n}`);for(let n in e)t[n]!==e[n]&&i.setAttribute(`data-${n}`,e[n])}(i,t.dataset||{},e.dataset||{}),t.style!==e.style&&function(i,t,e){let n,d=i.style;for(n in t)n in e||(d[n]="");for(n in e)t[n]!==e[n]&&(d[n]=e[n])}(i,t.style||{},e.style||{})}}(a||(a={})),i.VirtualElement=n,i.VirtualElementPass=d,i.VirtualText=e,i.h=o,i.hpass=function(i){let t={},e=null;if(2===arguments.length){const i=arguments[1];"render"in i?e=i:t=i}else if(3===arguments.length)t=arguments[1],e=arguments[2];else if(arguments.length>3)throw new Error("hpass() should be called with 1, 2, or 3 arguments");return new d(i,t,e)},Object.defineProperty(i,"__esModule",{value:!0})}));
//# sourceMappingURL=index.min.js.map
{
"name": "@lumino/virtualdom",
"version": "1.14.2",
"version": "2.0.0-alpha.0",
"description": "Lumino Virtual DOM",

@@ -14,9 +14,3 @@ "homepage": "https://github.com/jupyterlab/lumino",

"license": "BSD-3-Clause",
"author": "S. Chris Colbert <sccolbert@gmail.com>",
"contributors": [
"A. T. Darian <git@darian.email>",
"Dave Willmer <dave.willmer@gmail.com>",
"S. Chris Colbert <sccolbert@gmail.com>",
"Steven Silvester <steven.silvester@gmail.com>"
],
"author": "Project Jupyter",
"main": "dist/index.js",

@@ -39,3 +33,2 @@ "jsdelivr": "dist/index.min.js",

"clean:test": "rimraf tests/build",
"docs": "typedoc --options tdoptions.json src",
"minimize": "terser dist/index.js -c -m --source-map \"content='dist/index.js.map',url='index.min.js.map'\" -o dist/index.min.js",

@@ -57,7 +50,12 @@ "test": "npm run test:firefox-headless",

},
"typedoc": {
"entryPoint": "./src/index.ts",
"displayName": "virtualdom"
},
"dependencies": {
"@lumino/algorithm": "^1.9.2"
"@lumino/algorithm": "^2.0.0-alpha.0"
},
"devDependencies": {
"@microsoft/api-extractor": "^7.6.0",
"@rollup/plugin-node-resolve": "^13.3.0",
"@types/chai": "^3.4.35",

@@ -73,13 +71,13 @@ "@types/mocha": "^2.2.39",

"mocha": "^9.0.3",
"postcss": "^8.4.14",
"rimraf": "^3.0.2",
"rollup": "^2.56.0",
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-postcss": "^4.0.0",
"rollup": "^2.77.2",
"rollup-plugin-postcss": "^4.0.2",
"rollup-plugin-sourcemaps": "^0.6.3",
"terser": "^5.7.1",
"tslib": "^2.3.0",
"typedoc": "~0.15.0",
"typescript": "~3.6.0",
"webpack": "^4.41.3",
"webpack-cli": "^3.3.10"
"tslib": "^2.4.0",
"typedoc": "~0.23.9",
"typescript": "~4.7.3",
"webpack": "^5.74.0",
"webpack-cli": "^4.10.0"
},

@@ -86,0 +84,0 @@ "publishConfig": {

@@ -1457,5 +1457,5 @@ // Copyright (c) Jupyter Development Team.

const oldNode = oldContent[i];
const child = (_sentinel
? host.lastChild
: host.childNodes[i]) as HTMLElement;
const child = (
_sentinel ? host.lastChild : host.childNodes[i]
) as HTMLElement;

@@ -1462,0 +1462,0 @@ // recursively clean up host children

@@ -579,2 +579,1 @@ /**

}
//# sourceMappingURL=index.d.ts.map

Sorry, the diff of this file is not supported yet

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