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

snabbdom

Package Overview
Dependencies
Maintainers
5
Versions
61
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

snabbdom - npm Package Compare versions

Comparing version 1.0.1 to 2.0.0

1

build/package/hooks.js

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

export {};
//# sourceMappingURL=hooks.js.map

6

build/package/modules/eventlisteners.d.ts
import { Module } from './module';
declare type SpecificListener<N extends keyof HTMLElementEventMap> = (ev: HTMLElementEventMap[N]) => void;
export declare type On = {
[N in keyof HTMLElementEventMap]?: (ev: HTMLElementEventMap[N]) => void;
[N in keyof HTMLElementEventMap]?: SpecificListener<N> | Array<SpecificListener<N>>;
} & {
[event: string]: EventListener;
[event: string]: EventListener | EventListener[];
};
export declare const eventListenersModule: Module;
export {};
function invokeHandler(handler, vnode, event) {
if (typeof handler === 'function') {
// call function handler
// @ts-expect-error
handler.call(vnode, event, vnode);
}
else if (typeof handler === 'object') {
// call handler with arguments
if (typeof handler[0] === 'function') {
// special case for single argument for performance
if (handler.length === 2) {
handler[0].call(vnode, handler[1], event, vnode);
}
else {
var args = handler.slice(1);
args.push(event);
args.push(vnode);
handler[0].apply(vnode, args);
}
// call multiple handlers
for (var i = 0; i < handler.length; i++) {
invokeHandler(handler[i], vnode, event);
}
else {
// call multiple handlers
for (var i = 0; i < handler.length; i++) {
invokeHandler(handler[i], vnode, event);
}
}
}

@@ -27,0 +13,0 @@ }

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

export {};
//# sourceMappingURL=module.js.map

@@ -5,2 +5,24 @@ # Changelog

## [2.0.0](https://github.com/snabbdom/snabbdom/compare/v1.0.1...v2.0.0) (2020-09-10)
### ⚠ BREAKING CHANGES
* **eventlisteners:** loaded/carrying event listeners are no longer supported.
### Features
* **eventlisteners:** add missing mult. listeners type ([5a89efe](https://github.com/snabbdom/snabbdom/commit/5a89efe01580d50f15649c19a444745867c5c0d4)), closes [#794](https://github.com/snabbdom/snabbdom/issues/794)
* **eventlisteners:** remove loaded listeners feature ([6e0ff8e](https://github.com/snabbdom/snabbdom/commit/6e0ff8e8141c70891e55e41a3107d6d4de0bc754)), closes [#802](https://github.com/snabbdom/snabbdom/issues/802) [#802](https://github.com/snabbdom/snabbdom/issues/802)
### Bug Fixes
* **deps:** add regenertor-runtime to devDeps ([2a2964c](https://github.com/snabbdom/snabbdom/commit/2a2964c3eb47cd2f5a7ae88f49b2afe9ea299d7e)), closes [#813](https://github.com/snabbdom/snabbdom/issues/813)
* **docs:** gitter badge url ([7e19849](https://github.com/snabbdom/snabbdom/commit/7e198493c11f6d4afa8b03d727083d661e85ec0e))
* **examples:** example import paths ([8111f62](https://github.com/snabbdom/snabbdom/commit/8111f6234a70840673412da6cd37a726a7c839f8)), closes [#761](https://github.com/snabbdom/snabbdom/issues/761)
* **examples:** totalHeight 0 on remove last element reorder animation ([afa77c0](https://github.com/snabbdom/snabbdom/commit/afa77c04d4ab959a5f2bb5853e5dd821c744843f))
* **package:** remove directories field ([c7a2a93](https://github.com/snabbdom/snabbdom/commit/c7a2a93f5a2ed63bd76130e5e3d3769a9f1c1c58))
* **package:** update urls paldepind -> snabbdom ([f94185a](https://github.com/snabbdom/snabbdom/commit/f94185a5bbb31018af48b77449e74f58339fe404)), closes [#775](https://github.com/snabbdom/snabbdom/issues/775)
### [1.0.1](https://github.com/paldepind/snabbdom/compare/v1.0.0...v1.0.1) (2020-06-18)

@@ -88,1 +110,179 @@

* only esm and correct import paths ([dad44f0](https://github.com/paldepind/snabbdom/commit/dad44f0d632d344ca13ee8430d941c26a53d5c2a)), closes [#516](https://github.com/paldepind/snabbdom/issues/516) [#437](https://github.com/paldepind/snabbdom/issues/437) [#263](https://github.com/paldepind/snabbdom/issues/263)
## [v0.7.2] - 2018-09-02
## Bugfixes
- Improvements to TypeScript types #364. Thanks to @gfmio.
- In some cases and browsers the style module would cause elements to not be removed correctly #367. Thanks to @jvanbruegge for fixing this tricky bug.
## [v0.7.0] - 2017-07-27
## Breaking change
The way Snabbdom handles boolean attributes in the attributes module has been changed. Snabbdom no longer maintains a list of known boolean attributes. Not relying on such a list means that custom boolean attributes are supported, that performance is slightly better, and that the list doesn't have to be kept up to date.
Whether or not to set a boolean attribute is now determined by looking at the value specified for the attribute. If the value is a boolean (i.e. strictly equal to `true` or `false`) it will be handled as a boolean attribute. If you're currently setting boolean attributes with booleans then this change does not affect you.
```js
h("div", {
attrs: {
foo: true // will be set a boolean attribute since `true` is a boolean
bar: "baz" // will set a normal attribute
}
});
```
The example above will result in the HTML: `<div foo bar="baz" />`. Even if `bar` is actually a boolean attribute. So for instance `h("input", { attrs: { required: 12 } })` will no longer set a boolean attribute correctly.
Previously `h("input", { attrs: { required: 0 } })` would result in the HTML `<input>` since `required` was a know boolean attribute and `0` is falsey. Per the new behavior the HTML will be `<input required="0">`. To accomidate for the change always give boolean values for boolean attributes.
## Bugfixes
- `toVNode` now handles `DocumentFragment` which makes it possible to patch into a fragment. #320. Thanks to @staltz.
- Custom boolean attributes are handled correctly. #314. Thanks to @caridy.
- Type improvement. `VNode` key property can be `undefined` #290. Thanks to @yarom82.
- Data attributes are checked for existence before deleting. Old behavior caused error in Safari. #313. Thanks to @FeliciousX.
## Performance improvements
- New handling of boolean attributes. #314. Thanks to @caridy.
## [v0.6.9] - 2017-05-19
## Bug fixes
- Fix style delayed and remove to be optional in TypeScript, https://github.com/snabbdom/snabbdom/issues/295
## [v0.6.8] - 2017-05-16
## Bug fixes
- Fix error when class is set by vdom selector in SVG, https://github.com/snabbdom/snabbdom/issues/217. Thanks to @caesarsol
- Fix hyperscript to support undefined or null children in TypeScript, https://github.com/snabbdom/snabbdom/issues/226. Thanks to @ornicar
- Fix thunk function so it is not called redundantly, https://github.com/snabbdom/snabbdom/pull/273. Thanks to @caesarsol
- Improve TypeScript types of VNode props, https://github.com/snabbdom/snabbdom/issues/264 and https://github.com/snabbdom/snabbdom/issues/264. Thanks to @mightyiam
- Fix toVNode() for comment nodes, lacking some fields, https://github.com/snabbdom/snabbdom/pull/266. Thanks to @staltz
## Performance improvements
- Improvement for attribute patching, https://github.com/snabbdom/snabbdom/issues/257. Thanks to @diervo
## [v0.6.6] - 2017-03-07
## Bug fixes
- The attributes module sets boolean attributes correctly according to the specificaiton. https://github.com/snabbdom/snabbdom/issues/254. Thanks to @PerWiklander for reporting the bug.
## [v0.6.5] - 2017-02-25
This is a patch version with a few bug fixes.
## Bug fixes
- Fix `toVNode()` to handle text nodes correctly, https://github.com/snabbdom/snabbdom/issues/252. Thanks to @Steelfish
- Fix dataset module to support old browsers, such as IE10. Thanks @staltz
- Fix "create element" workflow to align with "update element" workflow, https://github.com/snabbdom/snabbdom/pull/234. Thanks @caridy
## [v0.6.4] - 2017-02-09
This version adds some features such as support for comment nodes and better server-side/client-side rendering collaboration, besides some bug fixes.
## New features
### Add ability to create comment nodes. https://github.com/snabbdom/snabbdom/issues/142 Thanks to @pedrosland
Example:
``` js
h('!', 'Will show as a comment')
```
will be rendered on the DOM as
``` html
<!-- Will show as a comment -->
```
### Introduce `toVNode()` to reconstruct root element as vnode. https://github.com/snabbdom/snabbdom/issues/167 Thanks to @staltz
Useful for client-side rendering over existing HTML that was rendered server-side with snabbdom.
Example:
``` js
import {toVNode} from 'snabbdom/tovnode'
// ...
patch(toVNode(element), vnode)
```
Will deep-convert the `element` to a VNode, this way allowing existing HTML to not be ignored by the patch process.
## Bug fixes
- Fix compatibility issue of String.prototype.startsWith in the Style Module. https://github.com/snabbdom/snabbdom/pull/228 Thanks to @zhulongzheng
- Support for `null`/`undefined` children without crashing. https://github.com/snabbdom/snabbdom/issues/226 Thanks to @nunocastromartins
## [v0.6.3] - 2017-01-16
## Bugfixes
- Fix the export of the `Module` interface for TypeScript projects depending on snabbdom.
## [v0.6.2] - 2017-01-16
## Bugfixes
- Fix the export of the `Hooks` interface for TypeScript projects depending on snabbdom.
## [v0.6.1] - 2017-01-05
The biggest change in this release is that the Snabbdom source code has been ported to TypeScript. The work has been primarily done by @staltz. This brings much improved support for using Snabbdom in TypeScript projects.
**Note**: This release contains breaking changes. See below.
## New features
- Complete TypeScript support. Thanks to @staltz.
- Support for CSS variables. #195. Thanks to @jlesquembre.
- Allow `h(sel, data, node)` and `h(sel, node)` shortcut notations in the `h` function. #196. That is, instead of `h('div', [child])` one can now do `h('div', child)`. Thanks to @AlexGalays.
## Bugfixes
- Fix custom element creation when tag name begins with 'svg'. #213. Thanks to @tdumitrescu.
- Fix bug related to updating one child with same key but different selector. #188. Thanks to @zhulongzheng.
- Strings can be used as children inside SVG elements. #208. Thanks to @jbucaran and @jbucaran.
- Use `parentNode` fixing bug in IE 11. #210. Thanks to @aronallen.
## Breaking changes
The TypeScript rewrite uses the `import` and `export` features introduced in ECMAScript 2015. Unfortunately the ES imports have no analogy to the CommonJS pattern of setting `module.exports`. This means that the Snabbdom modules that previously used this feature now have to be imported in a slightly different way.
``` js
var h = require("snabbdom/h"); // The old way
var h = require("snabbdom/h").h; // The new way
var h = require("snabbdom/h").default; // Alternative new way
var {h} = require("snabbdom/h"); // Using destructuring
```
## [v0.6.0] - 2017-01-05
Deprecated. Use [version 0.6.1](https://github.com/snabbdom/snabbdom/releases/tag/v0.6.1) instead.
## v0.5.0 - 2016-05-16
## Breaking change
This release contains a new thunk implementation that solves many issues with the old thunk implementation. The thunk API has changed slightly. Please see the [thunks](https://github.com/paldepind/snabbdom#thunks) section in the readme.
[Unreleased]: https://github.com/snabbdom/snabbdom/compare/v0.7.2...HEAD
[v0.7.2]: https://github.com/snabbdom/snabbdom/compare/v0.7.0...v0.7.2
[v0.7.0]: https://github.com/snabbdom/snabbdom/compare/v0.6.9...v0.7.0
[v0.6.9]: https://github.com/snabbdom/snabbdom/compare/v0.6.8...v0.6.9
[v0.6.8]: https://github.com/snabbdom/snabbdom/compare/v0.6.6...v0.6.8
[v0.6.6]: https://github.com/snabbdom/snabbdom/compare/v0.6.5...v0.6.6
[v0.6.5]: https://github.com/snabbdom/snabbdom/compare/v0.6.4...v0.6.5
[v0.6.4]: https://github.com/snabbdom/snabbdom/compare/v0.6.3...v0.6.4
[v0.6.3]: https://github.com/snabbdom/snabbdom/compare/v0.6.2...v0.6.3
[v0.6.2]: https://github.com/snabbdom/snabbdom/compare/v0.6.1...v0.6.2
[v0.6.1]: https://github.com/snabbdom/snabbdom/compare/v0.6.0...v0.6.1
[v0.6.0]: https://github.com/snabbdom/snabbdom/compare/v0.5.0...v0.6.0
{
"name": "snabbdom",
"version": "1.0.1",
"version": "2.0.0",
"description": "A virtual DOM library with focus on simplicity, modularity, powerful features and performance.",

@@ -26,17 +26,14 @@ "type": "module",

},
"directories": {
"example": "examples",
"test": "test"
},
"devDependencies": {
"@babel/core": "7.10.2",
"@babel/preset-env": "7.10.2",
"@commitlint/cli": "8.3.5",
"@commitlint/travis-cli": "9.0.1",
"@types/chai": "4.2.11",
"@types/faker": "4.1.12",
"@babel/core": "7.11.6",
"@babel/preset-env": "7.11.5",
"@commitlint/cli": "9.1.2",
"@commitlint/config-conventional": "9.1.2",
"@commitlint/travis-cli": "9.1.2",
"@types/chai": "4.2.12",
"@types/faker": "5.1.0",
"@types/lodash.shuffle": "4.2.6",
"@types/mathjs": "6.0.5",
"@types/mocha": "7.0.2",
"@typescript-eslint/eslint-plugin": "3.3.0",
"@types/mocha": "8.0.3",
"@typescript-eslint/eslint-plugin": "4.1.0",
"babel-loader": "8.1.0",

@@ -49,13 +46,14 @@ "benchmark": "2.1.4",

"editorconfig-checker": "3.1.0",
"eslint": "7.2.0",
"eslint-config-standard-with-typescript": "18.0.2",
"eslint-plugin-import": "2.21.2",
"eslint-plugin-markdown": "2.0.0-alpha.0",
"eslint": "7.8.1",
"eslint-config-standard-with-typescript": "19.0.1",
"eslint-plugin-import": "2.22.0",
"eslint-plugin-markdown": "2.0.0-rc.0",
"eslint-plugin-node": "11.1.0",
"eslint-plugin-promise": "4.2.1",
"eslint-plugin-standard": "4.0.1",
"faker": "4.1.0",
"husky": "4.2.5",
"faker": "5.1.0",
"globby": "11.0.1",
"husky": "4.3.0",
"is-path-inside": "3.0.2",
"karma": "5.1.0",
"karma": "5.2.2",
"karma-browserstack-launcher": "1.6.0",

@@ -66,21 +64,24 @@ "karma-chrome-launcher": "3.1.0",

"karma-mocha-reporter": "2.2.5",
"karma-webpack": "4.0.2",
"latest-snabbdom-release": "npm:snabbdom@0.7.4",
"latest-snabbdom-release": "npm:snabbdom@1.0.1",
"lodash.shuffle": "4.2.0",
"mathjs": "7.0.1",
"mocha": "8.0.1",
"mathjs": "7.2.0",
"meow": "7.1.1",
"mocha": "8.1.3",
"nodegit": "0.27.0",
"npm-run-all": "4.1.5",
"p-map-series": "2.1.0",
"p-reduce": "2.1.0",
"remark-cli": "8.0.0",
"regenerator-runtime": "0.13.7",
"remark-cli": "8.0.1",
"remark-toc": "7.0.0",
"standard-version": "8.0.0",
"ts-transform-import-path-rewrite": "0.2.1",
"standard-version": "9.0.0",
"tsconfigs": "5.0.0",
"tty-table": "4.1.3",
"ttypescript": "1.5.10",
"typescript": "3.9.5",
"webpack": "4.43.0"
"ttypescript": "1.5.12",
"typescript": "4.0.2",
"webpack": "4.44.1",
"webpack-cli": "3.3.12"
},
"scripts": {
"mark-pr-head-as-trusted": "node --unhandled-rejections=strict mark-pr-head-as-trusted.cjs",
"docs": "remark . --output",

@@ -91,7 +92,8 @@ "check-clean": "git diff --exit-code",

"lint": "run-s lint:editorconfig lint:js",
"unit": "cross-env FILES_PATTERN=\"build/test/unit/**/*.js\" karma start karma.conf.cjs",
"benchmark": "cross-env FILES_PATTERN=\"build/test/benchmark/**/*.js\" karma start karma.conf.cjs --concurrency=1",
"unit": "cross-env FILES_PATTERN=\"test-bundles/unit/**/*.js\" karma start karma.conf.cjs",
"benchmark": "cross-env FILES_PATTERN=\"test-bundles/benchmark/**/*.js\" karma start karma.conf.cjs --concurrency=1",
"make-release-commit": "standard-version",
"test": "run-s lint compile unit",
"test": "run-s lint compile bundle-tests unit",
"compile": "ttsc --build src/test/tsconfig.json",
"bundle-tests": "webpack --config tests.webpack.config.cjs",
"prepublishOnly": "npm run compile"

@@ -101,3 +103,3 @@ },

"type": "git",
"url": "git+https://github.com/paldepind/snabbdom.git"
"url": "git+https://github.com/snabbdom/snabbdom.git"
},

@@ -114,3 +116,3 @@ "keywords": [

"bugs": {
"url": "https://github.com/paldepind/snabbdom/issues"
"url": "https://github.com/snabbdom/snabbdom/issues"
},

@@ -132,3 +134,3 @@ "remarkConfig": {

},
"homepage": "https://github.com/paldepind/snabbdom#readme",
"homepage": "https://github.com/snabbdom/snabbdom#readme",
"husky": {

@@ -135,0 +137,0 @@ "hooks": {

@@ -12,7 +12,11 @@ <img alt="Snabbdom" src="logo.png" width="356px">

[![npm downloads](https://img.shields.io/npm/dm/snabbdom.svg)](https://www.npmjs.com/package/snabbdom)
[![Join the chat at https://gitter.im/paldepind/snabbdom](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/paldepind/snabbdom?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Join the chat at https://gitter.im/snabbdom/snabbdom](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/snabbdom/snabbdom?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Donate to our collective](https://opencollective.com/snabbdom/donate/button@2x.png?color=blue)](https://opencollective.com/snabbdom#section-contribute)
Thanks to [Browserstack](https://www.browserstack.com/) for providing access to
their great cross-browser testing tools.
* * *
## Introduction

@@ -129,3 +133,3 @@

* [Set properties on `destroy`](#set-properties-on-destroy)
* [Eventlisteners module](#eventlisteners-module)
* [The eventlisteners module](#the-eventlisteners-module)
* [SVG](#svg)

@@ -461,2 +465,4 @@ * [Classes in SVG Elements](#classes-in-svg-elements)

The `all` value of `transition-property` is not supported.
#### Set properties on `remove`

@@ -481,2 +487,4 @@

The `all` value of `transition-property` is not supported.
#### Set properties on `destroy`

@@ -494,4 +502,6 @@

### Eventlisteners module
The `all` value of `transition-property` is not supported.
### The eventlisteners module
The event listeners module gives powerful capabilities for attaching

@@ -498,0 +508,0 @@ event listeners.

@@ -21,6 +21,6 @@ import { vnode, VNode, VNodeData } from './vnode'

export function h(sel: string): VNode
export function h(sel: string, data: VNodeData | null): VNode
export function h(sel: string, children: VNodeChildren): VNode
export function h(sel: string, data: VNodeData | null, children: VNodeChildren): VNode
export function h (sel: string): VNode
export function h (sel: string, data: VNodeData | null): VNode
export function h (sel: string, children: VNodeChildren): VNode
export function h (sel: string, data: VNodeData | null, children: VNodeChildren): VNode
export function h (sel: any, b?: any, c?: any): VNode {

@@ -27,0 +27,0 @@ var data: VNodeData = {}

@@ -8,2 +8,3 @@ import { VNode as _VNode, VNodeData as _VNodeData } from './vnode'

/* eslint-disable @typescript-eslint/no-unused-vars */
declare global {

@@ -22,1 +23,2 @@ /**

}
/* eslint-enable @typescript-eslint/no-unused-vars */
import { VNode, VNodeData } from '../vnode'
import { Module } from './module'
type SpecificListener<N extends keyof HTMLElementEventMap> = (ev: HTMLElementEventMap[N]) => void
export type On = {
[N in keyof HTMLElementEventMap]?: (ev: HTMLElementEventMap[N]) => void
[N in keyof HTMLElementEventMap]?: SpecificListener<N> | Array<SpecificListener<N>>
} & {
[event: string]: EventListener
[event: string]: EventListener | EventListener[]
}
function invokeHandler (handler: any, vnode?: VNode, event?: Event): void {
type SomeListener<N extends keyof HTMLElementEventMap> = SpecificListener<N> | EventListener
function invokeHandler<N extends keyof HTMLElementEventMap> (handler: SomeListener<N> | Array<SomeListener<N>>, vnode?: VNode, event?: Event): void {
if (typeof handler === 'function') {
// call function handler
// @ts-expect-error
handler.call(vnode, event, vnode)
} else if (typeof handler === 'object') {
// call handler with arguments
if (typeof handler[0] === 'function') {
// special case for single argument for performance
if (handler.length === 2) {
handler[0].call(vnode, handler[1], event, vnode)
} else {
var args = handler.slice(1)
args.push(event)
args.push(vnode)
handler[0].apply(vnode, args)
}
} else {
// call multiple handlers
for (var i = 0; i < handler.length; i++) {
invokeHandler(handler[i], vnode, event)
}
// call multiple handlers
for (var i = 0; i < handler.length; i++) {
invokeHandler(handler[i], vnode, event)
}

@@ -32,0 +24,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