@kitajs/html
Advanced tools
Comparing version 2.0.0 to 2.0.1
@@ -13,3 +13,3 @@ /// <reference path="./jsx.d.ts" /> | ||
*/ | ||
declare namespace html { | ||
declare namespace Html { | ||
/** | ||
@@ -184,2 +184,2 @@ * A const used to represent a html fragment. | ||
export = html | ||
export = Html |
{ | ||
"name": "@kitajs/html", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "Fast and type safe HTML templates using TypeScript.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -18,3 +18,3 @@ <br /> | ||
<pre> | ||
<h1>🏛️<br />KitaJS HTML</h1> | ||
<h1>🏛️<br />KitaJS Html</h1> | ||
</pre> | ||
@@ -25,3 +25,3 @@ <br /> | ||
<h3 align="center"> | ||
<code>KitaJS HTML</code> is a 0 dependencies, fast and concise HTML generator for JavaScript with JSX syntax. | ||
<code>@kitajs/html</code> is a no dependencies, fast and concise package to generate HTML through JavaScript with JSX syntax. | ||
<br /> | ||
@@ -74,4 +74,4 @@ <br /> | ||
"jsx": "react", | ||
"jsxFactory": "html.createElement", | ||
"jsxFragmentFactory": "html.Fragment" | ||
"jsxFactory": "Html.createElement", | ||
"jsxFragmentFactory": "Html.Fragment" | ||
} | ||
@@ -82,4 +82,6 @@ } | ||
```jsx | ||
// Always remember to import html from '@kitajs/html' | ||
import html from '@kitajs/html' | ||
// Unique import to the top of your main.ts file. | ||
import '@kitajs/html/register' | ||
// Or import it directly everywhere you need it. | ||
import Html from '@kitajs/html' | ||
@@ -110,3 +112,3 @@ // Using as a simple html builder | ||
// Also as a component library | ||
function Layout({ name, children }: html.PropsWithChildren<{ name: string }>) { | ||
function Layout({ name, children }: Html.PropsWithChildren<{ name: string }>) { | ||
return ( | ||
@@ -148,3 +150,3 @@ <html> | ||
This package aims to be a HTML builder, **_not an HTML sanitizer_**. This means that no HTML content is escaped by default. However we provide a custom attribute called **_`safe`_** that will sanitize everything inside of it. You can also use the exported `html.escapeHtml` function to escape other contents arbitrarily. | ||
This package aims to be a HTML builder, **_not an HTML sanitizer_**. This means that no HTML content is escaped by default. However we provide a custom attribute called **_`safe`_** that will sanitize everything inside of it. You can also use the exported `Html.escapeHtml` function to escape other contents arbitrarily. | ||
@@ -163,4 +165,4 @@ ```jsx | ||
```jsx | ||
// Manual escaping with html.escapeHtml | ||
<div>{'<a></a>' + html.escapeHtml('<a></a>')}</div> // <div><a></a><a></a></div> | ||
// Manual escaping with Html.escapeHtml | ||
<div>{'<a></a>' + Html.escapeHtml('<a></a>')}</div> // <div><a></a><a></a></div> | ||
``` | ||
@@ -237,3 +239,3 @@ | ||
```tsx | ||
export const Layout = html.compile<html.PropsWithChildren>((p) => ( | ||
export const Layout = Html.compile<Html.PropsWithChildren>((p) => ( | ||
<> | ||
@@ -276,3 +278,3 @@ {'<!doctype html>'} | ||
```tsx | ||
import html from '@kitajs/html' | ||
import Html from '@kitajs/html' | ||
@@ -283,3 +285,3 @@ function Component(props: PropsWithChildren<{ name: string }>) { | ||
compiled = html.compile<typeof Component>(Component) | ||
compiled = Html.compile<typeof Component>(Component) | ||
@@ -289,3 +291,3 @@ compiled({ name: 'World' }) | ||
compiled = html.compile((p) => <div>Hello {p.name}</div>) | ||
compiled = Html.compile((p) => <div>Hello {p.name}</div>) | ||
@@ -299,3 +301,3 @@ compiled({ name: 'World' }) | ||
```tsx | ||
compiled = html.compile((t) => { | ||
compiled = Html.compile((t) => { | ||
// THIS WILL NOT print 123, but a string used by .compile instead | ||
@@ -502,6 +504,6 @@ console.log(t.asd) | ||
```js | ||
html.createElement( | ||
Html.createElement( | ||
'ol', | ||
{ start: 2 }, | ||
[1, 2].map((i) => html.createElement('li', null, i)) | ||
[1, 2].map((i) => Html.createElement('li', null, i)) | ||
) | ||
@@ -524,3 +526,3 @@ ``` | ||
```jsx | ||
import html from '@kitajs/html' | ||
import Html from '@kitajs/html' | ||
import prettify from 'html-prettify' | ||
@@ -527,0 +529,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
62871
546