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

typed-dom

Package Overview
Dependencies
Maintainers
1
Versions
350
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

typed-dom - npm Package Compare versions

Comparing version 0.0.9 to 0.0.10

global.d.ts

513

dist/typed-dom.js

@@ -1,255 +0,272 @@

/*! typed-dom v0.0.9 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | MIT License */
define = typeof define === 'function' && define.amd
? define
: (function () {
'use strict';
var name = 'typed-dom',
workspace = {};
return function define(m, rs, f) {
return !f
? void define(name, m, rs)
: void f.apply(this, rs.map(function (r) {
switch (r) {
case 'require': {
return typeof require === 'function' ? require : void 0;
/*! typed-dom v0.0.10 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | MIT License */
require = function e(t, n, r) {
function s(o, u) {
if (!n[o]) {
if (!t[o]) {
var a = typeof require == 'function' && require;
if (!u && a)
return a(o, !0);
if (i)
return i(o, !0);
var f = new Error('Cannot find module \'' + o + '\'');
throw f.code = 'MODULE_NOT_FOUND', f;
}
case 'exports': {
return m.indexOf('/') === -1
? workspace[m] = typeof exports === 'undefined' ? self[m] = self[m] || {} : exports
: workspace[m] = workspace.hasOwnProperty(m) ? workspace[m] : {};
}
default: {
return r.slice(-2) === '.d' && {}
|| workspace.hasOwnProperty(r) && workspace[r]
|| typeof require === 'function' && require(r)
|| self[r];
}
}
}));
};
})();
define('src/dom/builder', [
'require',
'exports'
], function (require, exports) {
'use strict';
function build(factory, attrs, contents) {
if (contents === void 0) {
contents = [];
var l = n[o] = { exports: {} };
t[o][0].call(l.exports, function (e) {
var n = t[o][1][e];
return s(n ? n : e);
}, l, l.exports, e, t, n, r);
}
var raw = factory();
void Object.keys(attrs).forEach(function (name) {
return raw.setAttribute(name, attrs[name] || '');
});
void Object.keys(contents).forEach(function (k) {
return void raw.appendChild(contents[k].raw);
});
contents = contents instanceof Array ? Object.freeze(contents) : observe(contents);
return Object.freeze({
raw: raw,
get contents() {
return contents;
},
set contents(cs) {
if (contents instanceof Array) {
cs = Object.freeze(cs);
raw.innerHTML = '';
void cs.forEach(function (c) {
return void raw.appendChild(c.raw);
});
} else {
void Object.keys(cs).forEach(function (k) {
return void raw.replaceChild(cs[k].raw, contents[k].raw);
});
cs = observe(cs);
return n[o].exports;
}
var i = typeof require == 'function' && require;
for (var o = 0; o < r.length; o++)
s(r[o]);
return s;
}({
1: [
function (_dereq_, module, exports) {
},
{}
],
2: [
function (_dereq_, module, exports) {
arguments[4][1][0].apply(exports, arguments);
},
{ 'dup': 1 }
],
3: [
function (_dereq_, module, exports) {
'use strict';
function build(factory, attrs, contents) {
if (contents === void 0) {
contents = [];
}
contents = cs;
}
});
function observe(contents) {
var cache = {};
return Object.keys(contents).reduce(function (contents, k) {
cache[k] = contents[k];
Object.defineProperty(contents, k, {
get: function () {
return cache[k];
var raw = factory();
void Object.keys(attrs).forEach(function (name) {
return raw.setAttribute(name, attrs[name] || '');
});
void Object.keys(contents).forEach(function (k) {
return void raw.appendChild(contents[k].raw);
});
contents = contents instanceof Array ? Object.freeze(contents) : observe(contents);
return Object.freeze({
raw: raw,
get contents() {
return contents;
},
set: function (newElt) {
var oldElt = cache[k];
cache[k] = newElt;
raw.replaceChild(newElt.raw, oldElt.raw);
set contents(cs) {
if (contents instanceof Array) {
cs = Object.freeze(cs);
raw.innerHTML = '';
void cs.forEach(function (c) {
return void raw.appendChild(c.raw);
});
} else {
void Object.keys(cs).forEach(function (k) {
return void raw.replaceChild(cs[k].raw, contents[k].raw);
});
cs = observe(cs);
}
contents = cs;
}
});
return contents;
}, contents);
}
}
exports.build = build;
});
define('src/dom/html', [
'require',
'exports',
'src/dom/builder'
], function (require, exports, builder_1) {
'use strict';
exports.TypedHTML = [
'a',
'abbr',
'acronym',
'address',
'applet',
'area',
'article',
'aside',
'audio',
'b',
'base',
'basefont',
'bdo',
'big',
'blockquote',
'body',
'br',
'button',
'canvas',
'caption',
'center',
'cite',
'code',
'col',
'colgroup',
'datalist',
'dd',
'del',
'dfn',
'dir',
'div',
'dl',
'dt',
'em',
'embed',
'fieldset',
'figcaption',
'figure',
'font',
'footer',
'form',
'frame',
'frameset',
'h1',
'h2',
'h3',
'h4',
'h5',
'h6',
'head',
'header',
'hgroup',
'hr',
'html',
'i',
'iframe',
'img',
'input',
'ins',
'isindex',
'kbd',
'keygen',
'label',
'legend',
'li',
'link',
'listing',
'map',
'mark',
'marquee',
'menu',
'meta',
'nav',
'nextid',
'nobr',
'noframes',
'noscript',
'object',
'ol',
'optgroup',
'option',
'p',
'param',
'picture',
'plaintext',
'pre',
'progress',
'q',
'rt',
'ruby',
's',
'samp',
'script',
'section',
'select',
'small',
'source',
'span',
'strike',
'strong',
'style',
'sub',
'sup',
'table',
'tbody',
'td',
'template',
'textarea',
'tfoot',
'th',
'thead',
'title',
'tr',
'track',
'tt',
'u',
'ul',
'var',
'video',
'wbr',
'xmp',
'custom'
].reduce(function (obj, tag) {
obj[tag] = function (attrs, contents, factory) {
if (!contents || typeof contents === 'function') {
factory = contents;
contents = attrs;
attrs = {};
function observe(contents) {
var cache = {};
return Object.keys(contents).reduce(function (contents, k) {
cache[k] = contents[k];
Object.defineProperty(contents, k, {
get: function () {
return cache[k];
},
set: function (newElt) {
var oldElt = cache[k];
cache[k] = newElt;
raw.replaceChild(newElt.raw, oldElt.raw);
}
});
return contents;
}, contents);
}
}
return builder_1.build(factory || function () {
return document.createElement(tag);
}, attrs, contents);
};
return obj;
}, {});
});
define('src/export', [
'require',
'exports',
'src/dom/html'
], function (require, exports, html_1) {
'use strict';
exports.default = html_1.TypedHTML;
});
define('typed-dom', [
'require',
'exports',
'src/export',
'src/export',
'./src/import'
], function (require, exports, export_1, export_2) {
'use strict';
function __export(m) {
for (var p in m)
if (!exports.hasOwnProperty(p))
exports[p] = m[p];
}
__export(export_1);
exports.default = export_2.default;
});
exports.build = build;
},
{}
],
4: [
function (_dereq_, module, exports) {
'use strict';
var builder_1 = _dereq_('./builder');
exports.TypedHTML = [
'a',
'abbr',
'acronym',
'address',
'applet',
'area',
'article',
'aside',
'audio',
'b',
'base',
'basefont',
'bdo',
'big',
'blockquote',
'body',
'br',
'button',
'canvas',
'caption',
'center',
'cite',
'code',
'col',
'colgroup',
'datalist',
'dd',
'del',
'dfn',
'dir',
'div',
'dl',
'dt',
'em',
'embed',
'fieldset',
'figcaption',
'figure',
'font',
'footer',
'form',
'frame',
'frameset',
'h1',
'h2',
'h3',
'h4',
'h5',
'h6',
'head',
'header',
'hgroup',
'hr',
'html',
'i',
'iframe',
'img',
'input',
'ins',
'isindex',
'kbd',
'keygen',
'label',
'legend',
'li',
'link',
'listing',
'map',
'mark',
'marquee',
'menu',
'meta',
'nav',
'nextid',
'nobr',
'noframes',
'noscript',
'object',
'ol',
'optgroup',
'option',
'p',
'param',
'picture',
'plaintext',
'pre',
'progress',
'q',
'rt',
'ruby',
's',
'samp',
'script',
'section',
'select',
'small',
'source',
'span',
'strike',
'strong',
'style',
'sub',
'sup',
'table',
'tbody',
'td',
'template',
'textarea',
'tfoot',
'th',
'thead',
'title',
'tr',
'track',
'tt',
'u',
'ul',
'var',
'video',
'wbr',
'xmp',
'custom'
].reduce(function (obj, tag) {
obj[tag] = function (attrs, contents, factory) {
if (!contents || typeof contents === 'function') {
factory = contents;
contents = attrs;
attrs = {};
}
return builder_1.build(factory || function () {
return document.createElement(tag);
}, attrs, contents);
};
return obj;
}, {});
},
{ './builder': 3 }
],
5: [
function (_dereq_, module, exports) {
'use strict';
var html_1 = _dereq_('./dom/html');
exports.default = html_1.TypedHTML;
},
{ './dom/html': 4 }
],
6: [
function (_dereq_, module, exports) {
arguments[4][1][0].apply(exports, arguments);
},
{ 'dup': 1 }
],
'typed-dom': [
function (_dereq_, module, exports) {
'use strict';
function __export(m) {
for (var p in m)
if (!exports.hasOwnProperty(p))
exports[p] = m[p];
}
__export(_dereq_('./src/export'));
var export_1 = _dereq_('./src/export');
exports.default = export_1.default;
},
{ './src/export': 5 }
]
}, {}, [
1,
2,
6,
'typed-dom'
]);

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

/*! typed-dom v0.0.9 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | MIT License */
define="function"==typeof define&&define.amd?define:function(){"use strict";var e="typed-dom",t={};return function r(n,i,o){return o?void o.apply(this,i.map(function(e){switch(e){case"require":return"function"==typeof require?require:void 0;case"exports":return n.indexOf("/")===-1?t[n]="undefined"==typeof exports?self[n]=self[n]||{}:exports:t[n]=t.hasOwnProperty(n)?t[n]:{};default:return".d"===e.slice(-2)&&{}||t.hasOwnProperty(e)&&t[e]||"function"==typeof require&&require(e)||self[e]}})):void r(e,n,i)}}(),define("src/dom/builder",["require","exports"],function(e,t){"use strict";function r(e,t,r){function n(e){var t={};return Object.keys(e).reduce(function(e,r){return t[r]=e[r],Object.defineProperty(e,r,{get:function(){return t[r]},set:function(e){var n=t[r];t[r]=e,i.replaceChild(e.raw,n.raw)}}),e},e)}void 0===r&&(r=[]);var i=e();return void Object.keys(t).forEach(function(e){return i.setAttribute(e,t[e]||"")}),void Object.keys(r).forEach(function(e){return void i.appendChild(r[e].raw)}),r=r instanceof Array?Object.freeze(r):n(r),Object.freeze({raw:i,get contents(){return r},set contents(e){r instanceof Array?(e=Object.freeze(e),i.innerHTML="",void e.forEach(function(e){return void i.appendChild(e.raw)})):(void Object.keys(e).forEach(function(t){return void i.replaceChild(e[t].raw,r[t].raw)}),e=n(e)),r=e}})}t.build=r}),define("src/dom/html",["require","exports","src/dom/builder"],function(e,t,r){"use strict";t.TypedHTML=["a","abbr","acronym","address","applet","area","article","aside","audio","b","base","basefont","bdo","big","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","datalist","dd","del","dfn","dir","div","dl","dt","em","embed","fieldset","figcaption","figure","font","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","isindex","kbd","keygen","label","legend","li","link","listing","map","mark","marquee","menu","meta","nav","nextid","nobr","noframes","noscript","object","ol","optgroup","option","p","param","picture","plaintext","pre","progress","q","rt","ruby","s","samp","script","section","select","small","source","span","strike","strong","style","sub","sup","table","tbody","td","template","textarea","tfoot","th","thead","title","tr","track","tt","u","ul","var","video","wbr","xmp","custom"].reduce(function(e,t){return e[t]=function(e,n,i){return n&&"function"!=typeof n||(i=n,n=e,e={}),r.build(i||function(){return document.createElement(t)},e,n)},e},{})}),define("src/export",["require","exports","src/dom/html"],function(e,t,r){"use strict";t.default=r.TypedHTML}),define("typed-dom",["require","exports","src/export","src/export","./src/import"],function(e,t,r,n){"use strict";function i(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}i(r),t.default=n.default});
/*! typed-dom v0.0.10 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | MIT License */
require=function e(t,r,n){function o(u,a){if(!r[u]){if(!t[u]){var c="function"==typeof require&&require;if(!a&&c)return c(u,!0);if(i)return i(u,!0);var d=new Error("Cannot find module '"+u+"'");throw d.code="MODULE_NOT_FOUND",d}var f=r[u]={exports:{}};t[u][0].call(f.exports,function(e){var r=t[u][1][e];return o(r?r:e)},f,f.exports,e,t,r,n)}return r[u].exports}for(var i="function"==typeof require&&require,u=0;u<n.length;u++)o(n[u]);return o}({1:[function(e,t,r){},{}],2:[function(e,t,r){arguments[4][1][0].apply(r,arguments)},{dup:1}],3:[function(e,t,r){"use strict";function n(e,t,r){function n(e){var t={};return Object.keys(e).reduce(function(e,r){return t[r]=e[r],Object.defineProperty(e,r,{get:function(){return t[r]},set:function(e){var n=t[r];t[r]=e,o.replaceChild(e.raw,n.raw)}}),e},e)}void 0===r&&(r=[]);var o=e();return void Object.keys(t).forEach(function(e){return o.setAttribute(e,t[e]||"")}),void Object.keys(r).forEach(function(e){return void o.appendChild(r[e].raw)}),r=r instanceof Array?Object.freeze(r):n(r),Object.freeze({raw:o,get contents(){return r},set contents(e){r instanceof Array?(e=Object.freeze(e),o.innerHTML="",void e.forEach(function(e){return void o.appendChild(e.raw)})):(void Object.keys(e).forEach(function(t){return void o.replaceChild(e[t].raw,r[t].raw)}),e=n(e)),r=e}})}r.build=n},{}],4:[function(e,t,r){"use strict";var n=e("./builder");r.TypedHTML=["a","abbr","acronym","address","applet","area","article","aside","audio","b","base","basefont","bdo","big","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","datalist","dd","del","dfn","dir","div","dl","dt","em","embed","fieldset","figcaption","figure","font","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","isindex","kbd","keygen","label","legend","li","link","listing","map","mark","marquee","menu","meta","nav","nextid","nobr","noframes","noscript","object","ol","optgroup","option","p","param","picture","plaintext","pre","progress","q","rt","ruby","s","samp","script","section","select","small","source","span","strike","strong","style","sub","sup","table","tbody","td","template","textarea","tfoot","th","thead","title","tr","track","tt","u","ul","var","video","wbr","xmp","custom"].reduce(function(e,t){return e[t]=function(e,r,o){return r&&"function"!=typeof r||(o=r,r=e,e={}),n.build(o||function(){return document.createElement(t)},e,r)},e},{})},{"./builder":3}],5:[function(e,t,r){"use strict";var n=e("./dom/html");r.default=n.TypedHTML},{"./dom/html":4}],6:[function(e,t,r){arguments[4][1][0].apply(r,arguments)},{dup:1}],"typed-dom":[function(e,t,r){"use strict";function n(e){for(var t in e)r.hasOwnProperty(t)||(r[t]=e[t])}n(e("./src/export"));var o=e("./src/export");r.default=o.default},{"./src/export":5}]},{},[1,2,6,"typed-dom"]);
const gulp = require('gulp');
const glob = require('glob');
const shell = cmd => require('child_process').execSync(cmd, { stdio: [0, 1, 2] });
const del = require('del');
const extend = require('extend');
const source = require('vinyl-source-stream');
const buffer = require('vinyl-buffer');
const $ = require('gulp-load-plugins')();
const seq = require('run-sequence');
const $ = require('gulp-load-plugins')();
const browserify = require('browserify');
const tsify = require('tsify');
const Server = require('karma').Server;

@@ -11,7 +16,13 @@

const config = {
browsers: ['Chrome', 'Firefox'].concat((os => {
switch (os) {
case 'Windows_NT':
return ['Edge'];
case 'Darwin':
return [];
default:
return [];
}
})(require('os').type())),
ts: {
options: extend(require('./tsconfig.json').compilerOptions, {
typescript: require('typescript'),
outFile: `${pkg.name}.js`
}),
dist: {

@@ -36,33 +47,2 @@ src: [

].join('\n'),
exporter:
`define = typeof define === 'function' && define.amd
? define
: (function () {
'use strict';
var name = '${pkg.name}',
workspace = {};
return function define(m, rs, f) {
return !f
? void define(name, m, rs)
: void f.apply(this, rs.map(function (r) {
switch (r) {
case 'require': {
return typeof require === 'function' ? require : void 0;
}
case 'exports': {
return m.indexOf('/') === -1
? workspace[m] = typeof exports === 'undefined' ? self[m] = self[m] || {} : exports
: workspace[m] = workspace.hasOwnProperty(m) ? workspace[m] : {};
}
default: {
return r.slice(-2) === '.d' && {}
|| workspace.hasOwnProperty(r) && workspace[r]
|| typeof require === 'function' && require(r)
|| self[r];
}
}
}));
};
})();
`,
clean: {

@@ -73,2 +53,22 @@ dist: 'dist'

function compile(paths) {
let done = true;
return browserify({
basedir: '.',
debug: false,
entries: Object.values(paths).map(p => glob.sync(p)),
bundleExternal: false,
cache: {},
packageCache: {}
})
.require(`./${pkg.name}.ts`, { expose: pkg.name })
.plugin(tsify, require('./tsconfig.json').compilerOptions)
.bundle()
.on("error", err => done = console.log(err + ''))
.pipe(source(`${pkg.name}.js`))
.pipe(buffer())
.pipe($.derequire())
.once("finish", () => done || process.exit(1));
}
gulp.task('ts:watch', function () {

@@ -79,5 +79,3 @@ gulp.watch(config.ts.test.src, ['ts:test']);

gulp.task('ts:test', function () {
return gulp.src(config.ts.test.src)
.pipe($.typescript(config.ts.options))
.pipe($.header(config.exporter))
return compile(config.ts.test.src)
.pipe(gulp.dest(config.ts.test.dest));

@@ -87,9 +85,4 @@ });

gulp.task('ts:dist', function () {
return gulp.src(config.ts.dist.src)
.pipe($.typescript(config.ts.options))
.once("error", function () {
this.once("finish", () => process.exit(1));
})
return compile(config.ts.dist.src)
.pipe($.unassert())
.pipe($.header(config.exporter))
.pipe($.header(config.banner))

@@ -105,3 +98,3 @@ .pipe(gulp.dest(config.ts.dist.dest))

configFile: __dirname + '/karma.conf.js',
browsers: ['Chrome', 'Firefox'],
browsers: config.browsers,
preprocessors: {

@@ -116,3 +109,3 @@ 'dist/*.js': ['espower']

configFile: __dirname + '/karma.conf.js',
browsers: ['Chrome', 'Firefox'],
browsers: config.browsers,
reporters: ['dots', 'coverage'],

@@ -126,6 +119,6 @@ preprocessors: {

gulp.task('karma:server', function (done) {
gulp.task('karma:ci', function (done) {
new Server({
configFile: __dirname + '/karma.conf.js',
browsers: ['Chrome', 'Firefox'],
browsers: config.browsers,
reporters: ['dots', 'coverage', 'coveralls'],

@@ -148,3 +141,3 @@ preprocessors: {

gulp.task('update', function () {
shell('npm-check-updates -u');
shell('ncu -ua');
shell('npm i');

@@ -180,6 +173,6 @@ });

gulp.task('server', ['clean'], function (done) {
gulp.task('ci', ['clean'], function (done) {
seq(
'ts:test',
'karma:server',
'karma:ci',
'dist',

@@ -186,0 +179,0 @@ function () {

{
"name": "typed-dom",
"version": "0.0.9",
"version": "0.0.10",
"description": "Static typed html dom builder.",

@@ -15,3 +15,4 @@ "private": false,

"html",
"typings"
"typed",
"typing"
],

@@ -35,5 +36,7 @@ "main": "./dist/typed-dom.js",

"@types/power-assert": "1.4.29",
"browserify": "^13.1.1",
"del": "^2.2.2",
"extend": "^3.0.0",
"gulp": "^3.9.1",
"gulp-derequire": "^2.1.0",
"gulp-header": "^1.8.8",

@@ -43,3 +46,2 @@ "gulp-load-plugins": "^1.3.0",

"gulp-rename": "^1.2.2",
"gulp-typescript": "^3.0.1",
"gulp-uglify": "^2.0.0",

@@ -51,2 +53,3 @@ "gulp-unassert": "^1.0.0",

"karma-coveralls": "^1.1.2",
"karma-edge-launcher": "^0.1.1",
"karma-espower-preprocessor": "1.1.0",

@@ -60,6 +63,10 @@ "karma-firefox-launcher": "^1.0.0",

"run-sequence": "^1.2.2",
"typescript": "2.1.0-dev.20160930"
"tsify": "^2.0.3",
"typescript": "2.1.0-dev.20160930",
"vinyl-buffer": "^1.0.0",
"vinyl-source-stream": "^1.1.0"
},
"scripts": {
"test": "gulp server"
"test": "npm i && gulp test",
"ci": "gulp ci"
},

@@ -66,0 +73,0 @@ "author": "falsandtru",

@@ -109,3 +109,2 @@ import TypedHTML from 'typed-dom';

assert.throws(() => collection.contents[0] = TypedHTML.li());
assert.throws(() => collection.contents[1] = TypedHTML.li());
assert.throws(() => collection.contents.push(TypedHTML.li()));

@@ -112,0 +111,0 @@ assert.throws(() => collection.contents.pop());

@@ -8,3 +8,3 @@ {

],
"module": "amd",
"module": "commonjs",
"moduleResolution": "node",

@@ -11,0 +11,0 @@ "allowSyntheticDefaultImports": true,

@@ -1,3 +0,2 @@

import './src/import';
export * from './src/export';
export * from './src/export';
export {default} from './src/export';
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