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

pickle-ts

Package Overview
Dependencies
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pickle-ts - npm Package Compare versions

Comparing version 0.1.3 to 0.1.4

1

dist/dom.d.ts

@@ -6,2 +6,3 @@ export interface VElement {

key?: string | number;
lifecycleListenerCount?: number;
}

@@ -8,0 +9,0 @@ export declare type VNode = VElement | string | number;

42

dist/dom.js

@@ -75,22 +75,12 @@ "use strict";

}
// pickle mods (needs to work with qt browser)
function updateAttribute(element, name, value, oldValue, isSVG) {
if (name === "key") {
// pickle mod - use style strings rather than objects; works better with workflow of transitioning styles from ts to css
//} else if (name === "style") {
// for (var i in merge(oldValue, value)) {
// element[name][i] = value == null || value[i] == null ? "" : value[i]
// }
}
else {
if (typeof value === "function" // ||
) {
element[name] = value; // == null ? "" : value
}
else if (value != null && value !== false) {
element.setAttribute(name, value);
}
if (value == null || value === false) {
element.removeAttribute(name);
}
}
if (name === "key")
return;
if (typeof value === "function")
element[name] = value;
else if (value != null && value !== false)
element.setAttribute(name, value);
if (value == null || value === false)
element.removeAttribute(name);
}

@@ -153,4 +143,6 @@ function createNode(vnode, callbacks, isSVG) {

function done() {
parent.removeChild(removeChildren(element, velement));
removeChildren(element, velement);
parent.removeChild(element);
}
element["removing"] = true;
var cb = velement.attributes && velement.attributes.onremove;

@@ -164,2 +156,9 @@ if (cb) {

}
function activeNodes(nodes) {
var activeNodes = [];
for (var x = 0; x < nodes.length; x++)
if (nodes[x]["removing"] !== true)
activeNodes.push(nodes[x]);
return activeNodes;
}
function patchElement(parent, node, oldVNode, vnode, lifecycleCallbacks, isRecycling, isSVG) {

@@ -189,4 +188,5 @@ if (isSVG === void 0) { isSVG = false; }

var children = vnode.children;
var active = activeNodes(node.childNodes); // Array.from (node!.childNodes).filter(x => x["removing"] !== true) // pickle mod (allow asynchronous removes)
for (var i = 0; i < oldChildren.length; i++) {
oldElements[i] = node.childNodes[i];
oldElements[i] = active[i]; // pickle mod
var oldKey = getKey(oldChildren[i]);

@@ -193,0 +193,0 @@ if (oldKey != null) {

@@ -6,5 +6,5 @@ export { Component } from './component';

export { VElement, VNode, VAttributes, VLifecycle, isVElement, createVElement, merge } from './dom';
export { lifecycle } from './lifecycle';
export { lifecycleListener, LifecycleListener } from './lifecycle';
export { literal, KeyValue, isNullOrEmpty, key, Let } from './util';
export { selector, commandButton, commandLink, inputer, labeledInput, slider, radioGroup } from './widgets';
export { h, a, abbr, address, area, article, aside, audio, b, bdi, bdo, blockquote, br, button, canvas, caption, cite, code, col, colgroup, data, datalist, dd, del, details, dfn, dialog, div, dl, dt, em, embed, fieldset, figcaption, figure, footer, form, h1, h2, h3, h4, h5, h6, header, hr, i, img, input, ins, kbd, label, legend, li, main, map, mark, menu, menuitem, meter, nav, object, ol, optgroup, option, output, p, param, pre, progress, q, rp, rt, rtc, ruby, s, samp, section, select, small, source, span, strong, sub, summary, sup, svg, table, tbody, td, textarea, tfoot, th, thead, time, tr, track, u, ul, video, vvar, wbr } from './html';

@@ -16,3 +16,3 @@ "use strict";

var lifecycle_1 = require("./lifecycle");
exports.lifecycle = lifecycle_1.lifecycle;
exports.lifecycleListener = lifecycle_1.lifecycleListener;
var util_1 = require("./util");

@@ -19,0 +19,0 @@ exports.literal = util_1.literal;

@@ -1,2 +0,7 @@

import { VElement, VLifecycle } from "./dom";
export declare function lifecycle(el: VElement, life: VLifecycle): VElement;
import { VElement } from './dom';
export interface LifecycleListener {
update?(): void;
remove?(): Promise<void>;
destroy?(): void;
}
export declare function lifecycleListener(velement: VElement, createLifecycleListener: (el: Element) => LifecycleListener): VElement;
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [0, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
function lifecycle(el, life) {
var attributes = el.attributes;
var create = attributes.oncreate;
var update = attributes.onupdate;
var remove = attributes.onremove;
var destroy = attributes.ondestroy;
function lifecycleListener(velement, createLifecycleListener) {
var _this = this;
var attributes = velement.attributes;
var _a = velement.attributes, oncreate = _a.oncreate, onupdate = _a.onupdate, onremove = _a.onremove, ondestroy = _a.ondestroy;
velement.lifecycleListenerCount = (velement.lifecycleListenerCount || 0) + 1;
var lid = "lifecycleListener" + velement.lifecycleListenerCount;
attributes.oncreate = function (el, attrs) {
life.oncreate && life.oncreate(el, attrs);
create && create(el, attrs);
var life = el[lid] = createLifecycleListener(el);
oncreate && oncreate(el, attrs);
};
attributes.onupdate = function (el, attrs) {
life.onupdate && life.onupdate(el, attrs);
update && update(el, attrs);
var life = el[lid];
life.update && life.update();
onupdate && onupdate(el, attrs);
};
attributes.onremove = function (el, rem) {
life.onremove && life.onremove(el, rem);
remove && remove(el, function () { });
};
attributes.onremove = function (el, rem) { return __awaiter(_this, void 0, void 0, function () {
var life;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
life = el[lid];
if (!life.remove) return [3 /*break*/, 2];
return [4 /*yield*/, life.remove()];
case 1:
_a.sent();
_a.label = 2;
case 2:
if (onremove)
onremove(el, rem);
else
rem();
return [2 /*return*/];
}
});
}); };
attributes.ondestroy = function (el) {
life.ondestroy && life.ondestroy(el);
destroy && destroy(el);
var life = el[lid];
life.destroy && life.destroy();
ondestroy && ondestroy(el);
};
return el;
return velement;
}
exports.lifecycle = lifecycle;
exports.lifecycleListener = lifecycleListener;
{
"name": "pickle-ts",
"version": "0.1.3",
"version": "0.1.4",
"author": "pickle",
"license": "MIT",
"repository": {
"type" : "git"
, "url" : "https://github.com/pickle-ts/pickle"
"repository": {
"type": "git",
"url": "https://github.com/pickle-ts/pickle"
},

@@ -13,6 +13,6 @@ "main": "dist/index.js",

"dependencies": {
"typescript": "^2.5.0",
"class-transformer": "^0.1.8",
"reflect-metadata": "^0.1.10"
"reflect-metadata": "^0.1.12",
"typescript": "^2.5.0"
}
}
}
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