Skip to content

Commit

Permalink
Add docs to tree
Browse files Browse the repository at this point in the history
  • Loading branch information
jordwest committed Aug 3, 2017
1 parent b583fc0 commit 8f7f5e7
Show file tree
Hide file tree
Showing 24 changed files with 930 additions and 4 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@ lib/bs
dist/main.bundle.js
lib/ocaml
.DS_Store
docs/*.html
113 changes: 113 additions & 0 deletions docs/Snabbdom_base.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<link rel="stylesheet" href="style.css" type="text/css">
<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type">
<link rel="Start" href="index.html">
<link rel="next" href="Snabbdom_external.html">
<link rel="Up" href="index.html">
<link title="Index of types" rel=Appendix href="index_types.html">
<link title="Index of exceptions" rel=Appendix href="index_exceptions.html">
<link title="Index of values" rel=Appendix href="index_values.html">
<link title="Index of modules" rel=Appendix href="index_modules.html">
<link title="Snabbdom_base" rel="Chapter" href="Snabbdom_base.html">
<link title="Snabbdom_external" rel="Chapter" href="Snabbdom_external.html"><title>Snabbdom_base</title>
</head>
<body>
<div class="navbar">&nbsp;<a class="up" href="index.html" title="Index">Up</a>
&nbsp;<a class="post" href="Snabbdom_external.html" title="Snabbdom_external">Next</a>
</div>
<h1>Module <a href="type_Snabbdom_base.html">Snabbdom_base</a></h1>

<pre><span class="keyword">module</span> Snabbdom_base: <code class="code">sig</code> <a href="Snabbdom_base.html">..</a> <code class="code">end</code></pre><div class="info module top">
Main snabbdom functions<br>
</div>
<hr width="100%">

<pre><span id="EXCEPTIONNot_supported"><span class="keyword">exception</span> Not_supported</span></pre>
<div class="info ">
This snabbdom function is not supported<br>
</div>

<pre><span id="EXCEPTIONChildren_not_allowed_with_text"><span class="keyword">exception</span> Children_not_allowed_with_text</span></pre>
<div class="info ">
A node cannot have both text and child nodes<br>
</div>

<pre><span id="TYPEnode_params"><span class="keyword">type</span> <code class="type"></code>node_params</span> = <code class="type"><a href="Snabbdom_external.Data.html#TYPEt">Snabbdom_external.Data.t</a> * <a href="Snabbdom_external.VNode.html#TYPEt">Snabbdom_external.VNode.t</a> list * string option</code> </pre>
<div class="info ">
node_params are the parameters Snabbdom uses to generate a vnode.
We pass them around in a tuple here, with the following elements:
<p>

1. Snabbdom data. This is the actual data object passed to Snabbdom's
actual `h` function.
2.<br>
</div>


<pre><span id="TYPEnode_params_transformer"><span class="keyword">type</span> <code class="type"></code>node_params_transformer</span> = <code class="type"><a href="Snabbdom_base.html#TYPEnode_params">node_params</a> -> <a href="Snabbdom_base.html#TYPEnode_params">node_params</a></code> </pre>
<div class="info ">
A node_params_transformer is any function which modifies
the parameters Snabbdom uses to generate a vnode.<br>
</div>


<pre><span id="VALh"><span class="keyword">val</span> h</span> : <code class="type">string -><br> <a href="Snabbdom_base.html#TYPEnode_params_transformer">node_params_transformer</a> list -> <a href="Snabbdom_external.VNode.html#TYPEt">Snabbdom_external.VNode.t</a></code></pre><div class="info ">
The recommended function for creating Snabbdom vnodes. Note this function
doesn't work exactly like <a href="https://github.com/snabbdom/snabbdom#snabbdomh"> Snabbdom's `h` function</a>
<p>

Since we're working in a different language, bs-snabbdom provides a slightly different
h function for constructing the vnodes that better works with OCaml. Underneath, we
still use the `h` function to create the vnodes. <em>Note: If you really need it, the
lower level binding is also defined in <a href="Snabbdom_external.html#VALh"><code class="code">Snabbdom_external.h</code></a>.</em>
<p>

The first parameter is the same as Snabbdom's - an html selector describing the element
type and any classes/id to apply to the element.
<p>

The second parameter takes a list of <a href="Snabbdom_base.html#TYPEnode_params_transformer"><code class="code">Snabbdom_base.node_params_transformer</code></a> functions, which
specify how to set up the node. Some transformers are implemented in this
module below.
<p>

Usage example:
<pre class="codepre"><code class="code">h "div.section" [
style "border" "1px solid black";
text "Hello World!"
]</code></pre><br>
</div>

<pre><span id="VALset_data_path"><span class="keyword">val</span> set_data_path</span> : <code class="type">string array -> 'a -> <a href="Snabbdom_base.html#TYPEnode_params_transformer">node_params_transformer</a></code></pre>
<pre><span id="VALchildren"><span class="keyword">val</span> children</span> : <code class="type"><a href="Snabbdom_external.VNode.html#TYPEt">Snabbdom_external.VNode.t</a> list -> <a href="Snabbdom_base.html#TYPEnode_params_transformer">node_params_transformer</a></code></pre><div class="info ">
Add child vnodes<br>
</div>

<pre><span id="VALtext"><span class="keyword">val</span> text</span> : <code class="type">string -> <a href="Snabbdom_base.html#TYPEnode_params_transformer">node_params_transformer</a></code></pre><div class="info ">
Sets the text in the body of the node<br>
</div>

<pre><span id="VALkey"><span class="keyword">val</span> key</span> : <code class="type">string -> <a href="Snabbdom_base.html#TYPEnode_params_transformer">node_params_transformer</a></code></pre><div class="info ">
Sets the Snabbdom key for this node. Use this on
lists of items to help Snabbdom reconcile the old
and new nodes and reuse nodes that belong to the
same key when reordering the list.<br>
</div>

<pre><span id="VALnothing"><span class="keyword">val</span> nothing</span> : <code class="type"><a href="Snabbdom_base.html#TYPEnode_params_transformer">node_params_transformer</a></code></pre><div class="info ">
Don't transform the <a href="Snabbdom_base.html#TYPEnode_params"><code class="code">Snabbdom_base.node_params</code></a>. Can be useful for if statements:
<p>

<pre class="codepre"><code class="code">if is_active then style "is-active" else nothing</code></pre><br>
</div>

<pre><span id="VALmodule_attributes"><span class="keyword">val</span> module_attributes</span> : <code class="type"><a href="Snabbdom_external.html#TYPEsnabbdom_module">Snabbdom_external.snabbdom_module</a></code></pre>
<pre><span id="VALattr"><span class="keyword">val</span> attr</span> : <code class="type">string -> string -> <a href="Snabbdom_base.html#TYPEnode_params_transformer">node_params_transformer</a></code></pre>
<pre><span id="VALmodule_class"><span class="keyword">val</span> module_class</span> : <code class="type"><a href="Snabbdom_external.html#TYPEsnabbdom_module">Snabbdom_external.snabbdom_module</a></code></pre>
<pre><span id="VALclass_name"><span class="keyword">val</span> class_name</span> : <code class="type">string -> <a href="Snabbdom_base.html#TYPEnode_params_transformer">node_params_transformer</a></code></pre>
<pre><span id="VALmodule_style"><span class="keyword">val</span> module_style</span> : <code class="type"><a href="Snabbdom_external.html#TYPEsnabbdom_module">Snabbdom_external.snabbdom_module</a></code></pre>
<pre><span id="VALstyle"><span class="keyword">val</span> style</span> : <code class="type">string -> string -> <a href="Snabbdom_base.html#TYPEnode_params_transformer">node_params_transformer</a></code></pre>
<pre><span id="VALstyle_delayed"><span class="keyword">val</span> style_delayed</span> : <code class="type">string -> string -> <a href="Snabbdom_base.html#TYPEnode_params_transformer">node_params_transformer</a></code></pre>
<pre><span id="VALstyle_remove"><span class="keyword">val</span> style_remove</span> : <code class="type">string -> string -> <a href="Snabbdom_base.html#TYPEnode_params_transformer">node_params_transformer</a></code></pre></body></html>
66 changes: 66 additions & 0 deletions docs/Snabbdom_external.Data.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<link rel="stylesheet" href="style.css" type="text/css">
<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type">
<link rel="Start" href="index.html">
<link rel="next" href="Snabbdom_external.VNode.html">
<link rel="Up" href="Snabbdom_external.html">
<link title="Index of types" rel=Appendix href="index_types.html">
<link title="Index of exceptions" rel=Appendix href="index_exceptions.html">
<link title="Index of values" rel=Appendix href="index_values.html">
<link title="Index of modules" rel=Appendix href="index_modules.html">
<link title="Snabbdom_base" rel="Chapter" href="Snabbdom_base.html">
<link title="Snabbdom_external" rel="Chapter" href="Snabbdom_external.html"><title>Snabbdom_external.Data</title>
</head>
<body>
<div class="navbar">&nbsp;<a class="up" href="Snabbdom_external.html" title="Snabbdom_external">Up</a>
&nbsp;<a class="post" href="Snabbdom_external.VNode.html" title="Snabbdom_external.VNode">Next</a>
</div>
<h1>Module <a href="type_Snabbdom_external.Data.html">Snabbdom_external.Data</a></h1>

<pre><span class="keyword">module</span> Data: <code class="code">sig</code> <a href="Snabbdom_external.Data.html">..</a> <code class="code">end</code></pre><div class="info module top">
The Data module provides functions for interacting with the data object passed to snabbdom's h function.<br>
</div>
<hr width="100%">

<pre><span id="TYPEt"><span class="keyword">type</span> <code class="type"></code>t</span> </pre>
<div class="info ">
Represents a Snabbdom data object.
<p>

Essentially this is just a standard JavaScript object. For example:
<p>

<pre class="codepre"><code class="code">{
style: {
color: '#000',
'font-weight': 'bold'
},
on: {
click: function(e) { e.preventDefault() }
}
}</code></pre><br>
</div>


<pre><span id="VALempty"><span class="keyword">val</span> empty</span> : <code class="type">unit -> <a href="Snabbdom_external.Data.html#TYPEt">t</a></code></pre><div class="info ">
Return a new, empty Snabbdom data object. This is equivalent to JavaScript <code class="code">{}</code><br>
</div>

<pre><span id="VALset_in_path"><span class="keyword">val</span> set_in_path</span> : <code class="type"><a href="Snabbdom_external.Data.html#TYPEt">t</a> -> string array -> 'a -> <a href="Snabbdom_external.Data.html#TYPEt">t</a></code></pre><div class="info ">
Sets an object property somewhere in the data object.
<p>

Pass an array of strings representing the path to the property to be set, followed
by the property value. Intermediate objects will be created if they don't already exist.
<p>

For example, to add a property like the following (in JavaScript):
<pre class="codepre"><code class="code">{ style: { color: '#000' } }</code></pre>
<p>

Use:
<pre class="codepre"><code class="code">let data = set_in_path data [|"style"; "color"|] "#000"</code></pre><br>
</div>
</body></html>
32 changes: 32 additions & 0 deletions docs/Snabbdom_external.Dom.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<link rel="stylesheet" href="style.css" type="text/css">
<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type">
<link rel="Start" href="index.html">
<link rel="previous" href="Snabbdom_external.VNode.html">
<link rel="Up" href="Snabbdom_external.html">
<link title="Index of types" rel=Appendix href="index_types.html">
<link title="Index of exceptions" rel=Appendix href="index_exceptions.html">
<link title="Index of values" rel=Appendix href="index_values.html">
<link title="Index of modules" rel=Appendix href="index_modules.html">
<link title="Snabbdom_base" rel="Chapter" href="Snabbdom_base.html">
<link title="Snabbdom_external" rel="Chapter" href="Snabbdom_external.html"><title>Snabbdom_external.Dom</title>
</head>
<body>
<div class="navbar"><a class="pre" href="Snabbdom_external.VNode.html" title="Snabbdom_external.VNode">Previous</a>
&nbsp;<a class="up" href="Snabbdom_external.html" title="Snabbdom_external">Up</a>
&nbsp;</div>
<h1>Module <a href="type_Snabbdom_external.Dom.html">Snabbdom_external.Dom</a></h1>

<pre><span class="keyword">module</span> Dom: <code class="code">sig</code> <a href="Snabbdom_external.Dom.html">..</a> <code class="code">end</code></pre><hr width="100%">

<pre><span id="VALfocus"><span class="keyword">val</span> focus</span> : <code class="type">Dom.element -> unit</code></pre>
<pre><span id="VALdocument"><span class="keyword">val</span> document</span> : <code class="type">Dom.document</code></pre>
<pre><span id="VALget_element_by_id"><span class="keyword">val</span> get_element_by_id</span> : <code class="type">Dom.document -> string -> Dom.element option</code></pre>
<pre><span id="VALstop_propagation"><span class="keyword">val</span> stop_propagation</span> : <code class="type">'a Dom.event_like -> unit</code></pre>
<pre><span id="VALprevent_default"><span class="keyword">val</span> prevent_default</span> : <code class="type">'a Dom.event_like -> unit</code></pre>
<pre><span id="VALget_target"><span class="keyword">val</span> get_target</span> : <code class="type">'a Dom.event_like -> 'a Dom.eventTarget_like</code></pre>
<pre><span id="VALget_value"><span class="keyword">val</span> get_value</span> : <code class="type">'a Dom.eventTarget_like -> string</code></pre>
<pre><span id="VALis_checked"><span class="keyword">val</span> is_checked</span> : <code class="type">'a Dom.eventTarget_like -> bool</code></pre>
<pre><span id="VALset_timeout"><span class="keyword">val</span> set_timeout</span> : <code class="type">(unit -> unit) -> int -> int</code></pre></body></html>
46 changes: 46 additions & 0 deletions docs/Snabbdom_external.VNode.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<link rel="stylesheet" href="style.css" type="text/css">
<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type">
<link rel="Start" href="index.html">
<link rel="previous" href="Snabbdom_external.Data.html">
<link rel="next" href="Snabbdom_external.Dom.html">
<link rel="Up" href="Snabbdom_external.html">
<link title="Index of types" rel=Appendix href="index_types.html">
<link title="Index of exceptions" rel=Appendix href="index_exceptions.html">
<link title="Index of values" rel=Appendix href="index_values.html">
<link title="Index of modules" rel=Appendix href="index_modules.html">
<link title="Snabbdom_base" rel="Chapter" href="Snabbdom_base.html">
<link title="Snabbdom_external" rel="Chapter" href="Snabbdom_external.html"><title>Snabbdom_external.VNode</title>
</head>
<body>
<div class="navbar"><a class="pre" href="Snabbdom_external.Data.html" title="Snabbdom_external.Data">Previous</a>
&nbsp;<a class="up" href="Snabbdom_external.html" title="Snabbdom_external">Up</a>
&nbsp;<a class="post" href="Snabbdom_external.Dom.html" title="Snabbdom_external.Dom">Next</a>
</div>
<h1>Module <a href="type_Snabbdom_external.VNode.html">Snabbdom_external.VNode</a></h1>

<pre><span class="keyword">module</span> VNode: <code class="code">sig</code> <a href="Snabbdom_external.VNode.html">..</a> <code class="code">end</code></pre><div class="info module top">
The VNode module provides types and functions for interacting with native Snabbdom vdom nodes<br>
</div>
<hr width="100%">

<pre><span id="TYPEt"><span class="keyword">type</span> <code class="type"></code>t</span> </pre>
<div class="info ">
Represents a Snabbdom vnode<br>
</div>


<pre><span id="VALget_elm"><span class="keyword">val</span> get_elm</span> : <code class="type"><a href="Snabbdom_external.VNode.html#TYPEt">t</a> -> Dom.element</code></pre>
<pre><span id="VALof_dom_element"><span class="keyword">val</span> of_dom_element</span> : <code class="type">Dom.element -> <a href="Snabbdom_external.VNode.html#TYPEt">t</a></code></pre><div class="info ">
Compile-time conversion of DOM elements to a Snabbdom vnode.
<p>

This function doesn't actually do anything at runtime.
Since the Snabbdom patch function allows us to use
an existing DOM element as an 'old' vnode, this function
just explicitly tells the compiler that we know what we're
doing.<br>
</div>
</body></html>
Loading

0 comments on commit 8f7f5e7

Please sign in to comment.