Skip to content
This repository has been archived by the owner on Sep 14, 2023. It is now read-only.

Commit

Permalink
feat: re-export getValidator and setValidator from @libre/atom
Browse files Browse the repository at this point in the history
  • Loading branch information
derrickbeining committed Feb 22, 2019
1 parent 494d33e commit 2964b20
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 19 deletions.
2 changes: 1 addition & 1 deletion docs/assets/js/search.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions docs/globals.html
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,12 @@ <h3>initialize</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in react-atom-internal.ts:55</li>
<li>Defined in react-atom-internal.ts:64</li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p><strong>NOTE: This is an escape hatch for users of <code>react</code> prior to hooks</strong></p>
<p><strong>NOTE: This is a back door for users of <code>react</code> prior to hooks</strong></p>
</div>
<p>Initializes <code>react-atom</code> with the provided <a href="interfaces/hookdependencies.html">HookDependencies</a> and
returns the full public API of <code>react-atom</code>.</p>
Expand Down Expand Up @@ -145,7 +145,7 @@ <h3>use<wbr>Atom</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in react-atom-internal.ts:136</li>
<li>Defined in react-atom-internal.ts:147</li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down Expand Up @@ -191,7 +191,7 @@ <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">DeepImmut
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in react-atom-internal.ts:171</li>
<li>Defined in react-atom-internal.ts:182</li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down
36 changes: 32 additions & 4 deletions docs/interfaces/publicexports.html
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,10 @@ <h3>Properties</h3>
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="publicexports.html#atom" class="tsd-kind-icon">Atom</a></li>
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="publicexports.html#addchangehandler" class="tsd-kind-icon">add<wbr>Change<wbr>Handler</a></li>
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="publicexports.html#deref" class="tsd-kind-icon">deref</a></li>
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="publicexports.html#getvalidator" class="tsd-kind-icon">get<wbr>Validator</a></li>
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="publicexports.html#removechangehandler" class="tsd-kind-icon">remove<wbr>Change<wbr>Handler</a></li>
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="publicexports.html#set" class="tsd-kind-icon">set</a></li>
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="publicexports.html#setvalidator" class="tsd-kind-icon">set<wbr>Validator</a></li>
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="publicexports.html#swap" class="tsd-kind-icon">swap</a></li>
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="publicexports.html#useatom" class="tsd-kind-icon">use<wbr>Atom</a></li>
</ul>
Expand Down Expand Up @@ -121,13 +123,23 @@ <h3>deref</h3>
</ul>
</aside>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
<a name="getvalidator" class="tsd-anchor"></a>
<h3>get<wbr>Validator</h3>
<div class="tsd-signature tsd-kind-icon">get<wbr>Validator<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">getValidator</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in internal-types.ts:57</li>
</ul>
</aside>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
<a name="removechangehandler" class="tsd-anchor"></a>
<h3>remove<wbr>Change<wbr>Handler</h3>
<div class="tsd-signature tsd-kind-icon">remove<wbr>Change<wbr>Handler<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">removeChangeHandler</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in internal-types.ts:57</li>
<li>Defined in internal-types.ts:58</li>
</ul>
</aside>
</section>
Expand All @@ -137,7 +149,17 @@ <h3>set</h3>
<div class="tsd-signature tsd-kind-icon">set<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">set</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in internal-types.ts:58</li>
<li>Defined in internal-types.ts:59</li>
</ul>
</aside>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
<a name="setvalidator" class="tsd-anchor"></a>
<h3>set<wbr>Validator</h3>
<div class="tsd-signature tsd-kind-icon">set<wbr>Validator<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">setValidator</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in internal-types.ts:60</li>
</ul>
</aside>
</section>
Expand All @@ -147,7 +169,7 @@ <h3>swap</h3>
<div class="tsd-signature tsd-kind-icon">swap<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">swap</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in internal-types.ts:59</li>
<li>Defined in internal-types.ts:61</li>
</ul>
</aside>
</section>
Expand All @@ -157,7 +179,7 @@ <h3>use<wbr>Atom</h3>
<div class="tsd-signature tsd-kind-icon">use<wbr>Atom<span class="tsd-signature-symbol">:</span> <a href="../globals.html#useatom" class="tsd-signature-type">useAtom</a></div>
<aside class="tsd-sources">
<ul>
<li>Defined in internal-types.ts:60</li>
<li>Defined in internal-types.ts:62</li>
</ul>
</aside>
</section>
Expand Down Expand Up @@ -190,12 +212,18 @@ <h3>use<wbr>Atom</h3>
<li class=" tsd-kind-property tsd-parent-kind-interface">
<a href="publicexports.html#deref" class="tsd-kind-icon">deref</a>
</li>
<li class=" tsd-kind-property tsd-parent-kind-interface">
<a href="publicexports.html#getvalidator" class="tsd-kind-icon">get<wbr>Validator</a>
</li>
<li class=" tsd-kind-property tsd-parent-kind-interface">
<a href="publicexports.html#removechangehandler" class="tsd-kind-icon">remove<wbr>Change<wbr>Handler</a>
</li>
<li class=" tsd-kind-property tsd-parent-kind-interface">
<a href="publicexports.html#set" class="tsd-kind-icon">set</a>
</li>
<li class=" tsd-kind-property tsd-parent-kind-interface">
<a href="publicexports.html#setvalidator" class="tsd-kind-icon">set<wbr>Validator</a>
</li>
<li class=" tsd-kind-property tsd-parent-kind-interface">
<a href="publicexports.html#swap" class="tsd-kind-icon">swap</a>
</li>
Expand Down
4 changes: 3 additions & 1 deletion src/internal-types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { addChangeHandler, Atom, deref, removeChangeHandler, set, swap } from "@libre/atom";
import { addChangeHandler, Atom, deref, getValidator, removeChangeHandler, set, setValidator, swap } from "@libre/atom";
import { useLayoutEffect, useMemo, useState } from "react";

import { useAtom } from "./react-atom-internal";
Expand Down Expand Up @@ -54,8 +54,10 @@ export interface PublicExports {
Atom: typeof Atom;
addChangeHandler: typeof addChangeHandler;
deref: typeof deref;
getValidator: typeof getValidator;
removeChangeHandler: typeof removeChangeHandler;
set: typeof set;
setValidator: typeof setValidator;
swap: typeof swap;
useAtom: typeof useAtom;
}
29 changes: 20 additions & 9 deletions src/react-atom-internal.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
import { addChangeHandler, Atom, DeepImmutable, deref, removeChangeHandler, set, swap } from "@libre/atom";
/**
* `react-atom` is a _lightweight_ abstraction around React's proposed Hooks API
* that provides the ability to ___share and update state across function
* components___. It offers a very simple and straightforward approach to managing
* state, whether local component state, or shared application state.
*/
import {
addChangeHandler,
Atom,
DeepImmutable,
deref,
getValidator,
removeChangeHandler,
set,
setValidator,
swap
} from "@libre/atom";
import { SetStateAction, useLayoutEffect, useMemo, useState } from "react";

import * as ErrorMsgs from "./error-messages";
Expand All @@ -17,14 +33,7 @@ let hookIdTicker = 0;
// ------------------------------------------------------------------------------------------ //

/**
* `react-atom` is a _lightweight_ abstraction around React's proposed Hooks API
* that provides the ability to ___share and update state across function
* components___. It offers a very simple and straightforward approach to managing
* state, whether local component state, or shared application state.
*/

/**
* **NOTE: This is an escape hatch for users of `react` prior to hooks**
* **NOTE: This is a back door for users of `react` prior to hooks**
*
* Initializes `react-atom` with the provided [[HookDependencies]] and
* returns the full public API of `react-atom`.
Expand Down Expand Up @@ -97,8 +106,10 @@ export function initialize(hooks: HookDependencies): PublicExports {
Atom,
addChangeHandler,
deref,
getValidator,
removeChangeHandler,
set,
setValidator,
swap,
useAtom
};
Expand Down

0 comments on commit 2964b20

Please sign in to comment.