@thi.ng/hiccup
Advanced tools
Comparing version 1.3.1 to 1.3.2
@@ -6,2 +6,10 @@ # Change Log | ||
<a name="1.3.2"></a> | ||
## [1.3.2](https://github.com/thi-ng/umbrella/compare/@thi.ng/hiccup@1.3.1...@thi.ng/hiccup@1.3.2) (2018-04-01) | ||
**Note:** Version bump only for package @thi.ng/hiccup | ||
<a name="1.3.1"></a> | ||
@@ -8,0 +16,0 @@ ## [1.3.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/hiccup@1.3.0...@thi.ng/hiccup@1.3.1) (2018-03-28) |
{ | ||
"name": "@thi.ng/hiccup", | ||
"version": "1.3.1", | ||
"version": "1.3.2", | ||
"description": "HTML/SVG/XML serialization of nested data structures, iterables & closures", | ||
@@ -19,15 +19,13 @@ "main": "./index.js", | ||
"devDependencies": { | ||
"@thi.ng/atom": "^1.2.1", | ||
"@types/mocha": "^2.2.48", | ||
"@types/node": "^9.4.6", | ||
"mocha": "^5.0.0", | ||
"nyc": "^11.4.1", | ||
"ts-loader": "^3.5.0", | ||
"typedoc": "^0.10.0", | ||
"typescript": "^2.7.2", | ||
"webpack": "^3.11.0" | ||
"@thi.ng/atom": "^1.2.2", | ||
"@types/mocha": "^5.0.0", | ||
"@types/node": "^9.6.1", | ||
"mocha": "^5.0.5", | ||
"nyc": "^11.6.0", | ||
"typedoc": "^0.11.1", | ||
"typescript": "^2.8.1" | ||
}, | ||
"dependencies": { | ||
"@thi.ng/api": "^2.1.1", | ||
"@thi.ng/checks": "^1.3.0" | ||
"@thi.ng/api": "^2.1.2", | ||
"@thi.ng/checks": "^1.3.1" | ||
}, | ||
@@ -34,0 +32,0 @@ "keywords": [ |
107
README.md
@@ -5,4 +5,7 @@ # @thi.ng/hiccup | ||
## Overview | ||
This project is part of the | ||
[@thi.ng/umbrella](https://github.com/thi-ng/umbrella/) monorepo. | ||
## About | ||
Lightweight HTML/SVG/XML serialization of plain, nested data structures, | ||
@@ -13,8 +16,9 @@ iterables & closures. Inspired by | ||
Forget all the custom toy DSLs for templating and instead use the full power of | ||
ES6 to directly define fully data-driven, purely functional and easily | ||
*composable* components for static serialization to HTML & friends. | ||
Forget all the custom toy DSLs for templating and instead use the full | ||
power of ES6 to directly define fully data-driven, purely functional and | ||
easily *composable* components for static serialization to HTML & | ||
friends. | ||
This library is suitable for static website generation, server side rendering | ||
etc. For interactive use cases, please see companion package | ||
This library is suitable for static website generation, server side | ||
rendering etc. For interactive use cases, please see companion package | ||
[@thi.ng/hdom](https://github.com/thi-ng/umbrella/tree/master/packages/hdom). | ||
@@ -37,18 +41,20 @@ | ||
Using only vanilla language features simplifies the development, composability, | ||
reusability and testing of components. Furthermore, no custom template parser | ||
is required and you're only restricted by the expressiveness of the language / | ||
environment, not by your template engine. | ||
Using only vanilla language features simplifies the development, | ||
composability, reusability and testing of components. Furthermore, no | ||
custom template parser is required and you're only restricted by the | ||
expressiveness of the language / environment, not by your template | ||
engine. | ||
Components can be defined as simple functions returning arrays or loaded via JSON/JSONP. | ||
Components can be defined as simple functions returning arrays or loaded | ||
via JSON/JSONP. | ||
### What is Hiccup? | ||
For many years, [Hiccup](https://github.com/weavejester/hiccup) has been the | ||
de-facto standard to encode HTML/XML datastructures in Clojure. This library | ||
brings & extends this convention into ES6. A valid Hiccup tree is any flat | ||
(though, usually nested) array of the following possible structures. Any | ||
functions embedded in the tree are expected to return values of the same | ||
structure. Please see [examples](#examples) & [API](#api) further | ||
explanations... | ||
For many years, [Hiccup](https://github.com/weavejester/hiccup) has been | ||
the de-facto standard to encode HTML/XML datastructures in Clojure. This | ||
library brings & extends this convention into ES6. A valid Hiccup tree | ||
is any flat (though, usually nested) array of the following possible | ||
structures. Any functions embedded in the tree are expected to return | ||
values of the same structure. Please see [examples](#examples) & | ||
[API](#api) further explanations... | ||
@@ -94,8 +100,9 @@ ```js | ||
Arbitrary attributes can be supplied via an optional 2nd array element. `style` | ||
attributes can be given as CSS string or as an object. Boolean attributes are | ||
serialized in HTML5 syntax (i.e. present or not, but no values). | ||
Arbitrary attributes can be supplied via an optional 2nd array element. | ||
`style` attributes can be given as CSS string or as an object. Boolean | ||
attributes are serialized in HTML5 syntax (i.e. present or not, but no | ||
values). | ||
If the 2nd array element is not a plain object, it's treated as normal child | ||
node (see previous example). | ||
If the 2nd array element is not a plain object, it's treated as normal | ||
child node (see previous example). | ||
@@ -120,8 +127,9 @@ ```js | ||
If an attribute specifies a function as value, the function is called with the | ||
entire attribute object as argument. This allows for the dynamic generation of | ||
attribute values, based on existing ones. The result MUST be a string. | ||
If an attribute specifies a function as value, the function is called | ||
with the entire attribute object as argument. This allows for the | ||
dynamic generation of attribute values, based on existing ones. The | ||
result MUST be a string. | ||
**BREAKING CHANGE since 1.0.0:** Function values for event attributes (any | ||
attrib name starting with "on") WILL BE OMITTED from output. | ||
**BREAKING CHANGE since 1.0.0:** Function values for event attributes | ||
(any attrib name starting with "on") WILL BE OMITTED from output. | ||
@@ -321,8 +329,8 @@ ```js | ||
Recursively normalizes and then serializes given tree as HTML/SVG/XML string. | ||
If `escape` is true, HTML entity replacement is applied to all element body & | ||
attribute values. | ||
Recursively normalizes and then serializes given tree as HTML/SVG/XML | ||
string. If `escape` is true, HTML entity replacement is applied to all | ||
element body & attribute values. | ||
Any embedded component functions are expanded with their results. | ||
A normalized element has one of these shapes: | ||
Any embedded component functions are expanded with their results. A | ||
normalized element has one of these shapes: | ||
@@ -346,4 +354,5 @@ ```js | ||
**Note:** It's an error to specify IDs and/or classes in Zencoding convention | ||
**and** in a supplied attribute object. However, either of these are valid: | ||
**Note:** It's an error to specify IDs and/or classes in Zencoding | ||
convention **and** in a supplied attribute object. However, either of | ||
these are valid: | ||
@@ -355,10 +364,10 @@ ```js | ||
The presence of the attributes object is optional. | ||
If the 2nd array index is **not** a plain object, it'll be treated | ||
as normal child of the current tree node. | ||
The presence of the attributes object is optional. If the 2nd array | ||
index is **not** a plain object, it'll be treated as normal child of the | ||
current tree node. | ||
Any `null` or `undefined` values (other than in head position) | ||
will be removed, unless a function is in head position. | ||
In this case all other elements of that array are passed as | ||
arguments when that function is called. | ||
Any `null` or `undefined` values (other than in head position) will be | ||
removed, unless a function is in head position. In this case all other | ||
elements of that array are passed as arguments when that function is | ||
called. | ||
@@ -379,12 +388,12 @@ ```js | ||
The function's return value MUST be a valid new tree (or `undefined`). | ||
Functions located in other positions are called without args | ||
and can return any (serializable) value (i.e. new trees, strings, | ||
numbers, iterables or any type with a suitable `.toString()` | ||
implementation). | ||
Functions located in other positions are called without args and can | ||
return any (serializable) value (i.e. new trees, strings, numbers, | ||
iterables or any type with a suitable `.toString()` implementation). | ||
### escape(str: string): string | ||
Helper function. Applies HTML entity replacement on given string. | ||
If `serialize()` is called with `true` as 2nd argument, entity encoding | ||
is done automatically ([list of entities considered](https://github.com/thi-ng/hiccup/blob/master/src/index.ts#L14)). | ||
Helper function. Applies HTML entity replacement on given string. If | ||
`serialize()` is called with `true` as 2nd argument, entity encoding is | ||
done automatically ([list of entities | ||
considered](https://github.com/thi-ng/umbrella/blob/master/packages/hiccup/src/index.ts#L14)). | ||
@@ -391,0 +400,0 @@ # Authors |
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
40059
7
396
Updated@thi.ng/api@^2.1.2
Updated@thi.ng/checks@^1.3.1