New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@gera2ld/jsx-dom

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@gera2ld/jsx-dom - npm Package Compare versions

Comparing version 2.0.1 to 2.1.0

10

dist/index.js

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

/*! @gera2ld/jsx-dom v2.0.1 | ISC License */
/*! @gera2ld/jsx-dom v2.1.0 | ISC License */
(function (exports) {

@@ -237,6 +237,14 @@ 'use strict';

}
/**
* Render and mount without returning VirtualDOM, useful when you don't need SVG support.
*/
function hm() {
return mountDom(h.apply(void 0, arguments));
}
exports.Fragment = Fragment;
exports.createElement = h;
exports.h = h;
exports.hm = hm;
exports.jsx = jsx;

@@ -243,0 +251,0 @@ exports.jsxs = jsxs;

2

package.json
{
"name": "@gera2ld/jsx-dom",
"version": "2.0.1",
"version": "2.1.0",
"description": "Use JSX for HTML elements.",

@@ -5,0 +5,0 @@ "author": "Gerald <i@gerald.top>",

@@ -9,2 +9,10 @@ # @gera2ld/jsx-dom

## Why virtual DOM?
v1.x does not have virtual DOM, as a result all elements are mounted immediately and we can hardly decide if an element is or is not part of an SVG.
v2.x introduces virtual DOM so that we can decide namespace of each node based on its parent.
However if you do not need SVG support and expect simple usage as before, just set pragma/jsxFactory to `JSX.hm` instead of `JSX.h`.
## Usage

@@ -23,3 +31,2 @@

const vdom = <div>hello</div>;
// Mount as DOM element

@@ -79,3 +86,3 @@ const dom = mountDom(vdom);

```
```json
// .babelrc

@@ -107,1 +114,9 @@ {

```
If you don't need SVG support and want to omit `mountDom`, just replace `JSX.h` with `JSX.hm`:
```js
// pragma/jsxFactory set to "JSX.hm"
document.body.append(<div>hello</div>);
```
export { h, h as createElement, jsx, jsxs, Fragment } from './h';
export { mountDom } from './mount';
export { mountDom, hm } from './mount';
export * from './types';

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

import { h } from './h';
import { VChildren, VProps, MountEnv, MountResult, DomNode, VChild } from './types';

@@ -10,1 +11,5 @@ export declare function insertDom(parent: HTMLElement | SVGElement | DocumentFragment, ref: MountResult): void;

export declare function mountDom(vnode: VChildren[]): DomNode[];
/**
* Render and mount without returning VirtualDOM, useful when you don't need SVG support.
*/
export declare function hm(...args: Parameters<typeof h>): Node;
import { VType, VTYPE_ELEMENT, VTYPE_FUNCTION, MOUNT_SINGLE, MOUNT_ARRAY } from './consts';
export interface VProps {
[key: string]: any;
children: VChildren;
children?: VChildren;
}

@@ -6,0 +6,0 @@ export declare type VFunction = (props: VProps) => VNode;

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