Skip to content

Commit e5a9faa

Browse files
committed
Update compositor.json
1 parent 6757ff1 commit e5a9faa

File tree

1 file changed

+90
-0
lines changed

1 file changed

+90
-0
lines changed

compositor.json

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
{
2+
"name": "renatorib/react-powerplug",
3+
"version": "0.1.4",
4+
"libraries": {
5+
"xv": "^1.1.25"
6+
},
7+
"title": "PowerPlug",
8+
"branch": "master",
9+
"style": {
10+
"name": "Material",
11+
"componentSet": {
12+
"nav": "nav/DarkAbsoluteNav",
13+
"header": "header/GradientHeader",
14+
"article": "article/BasicArticle",
15+
"footer": "footer/BasicFooter"
16+
},
17+
"fontFamily": "Roboto, sans-serif",
18+
"heading": {
19+
"fontWeight": 500,
20+
"letterSpacing": "-0.01em"
21+
},
22+
"colors": {
23+
"text": "#212121",
24+
"background": "#fff",
25+
"primary": "#2196f3",
26+
"secondary": "#1565c0",
27+
"highlight": "#ff4081",
28+
"border": "#e0e0e0",
29+
"muted": "#f5f5f5"
30+
},
31+
"layout": {
32+
"centered": true,
33+
"bannerHeight": "80vh",
34+
"maxWidth": 896
35+
}
36+
},
37+
"content": [
38+
{
39+
"component": "nav",
40+
"links": [
41+
{
42+
"href": "https://github.com/renatorib/react-powerplug",
43+
"text": "GitHub"
44+
},
45+
{
46+
"href": "https://npmjs.com/package/react-powerplug",
47+
"text": "npm"
48+
}
49+
]
50+
},
51+
{
52+
"component": "header",
53+
"heading": "react-powerplug",
54+
"subhead": ":electric_plug: Give life to your Dumb Components.",
55+
"children": [
56+
{
57+
"component": "ui/TweetButton",
58+
"text": "react-powerplug: :electric_plug: Give life to your Dumb Components.",
59+
"url": ""
60+
},
61+
{
62+
"component": "ui/GithubButton",
63+
"user": "renatorib",
64+
"repo": "react-powerplug"
65+
}
66+
],
67+
"text": "v0.0.2"
68+
},
69+
{
70+
"component": "article",
71+
"metadata": {
72+
"source": "github.readme"
73+
},
74+
"html": "<p><img src=\"./logo.png\"></p>\n<p><a href=\"https://www.npmjs.com/package/react-powerplug\"><img src=\"https://img.shields.io/npm/v/react-powerplug.svg?style=flat-square\"></a>\n<a href=\"https://www.npmjs.com/package/react-powerplug\"><img src=\"https://img.shields.io/npm/dt/react-powerplug.svg?style=flat-square\"></a>\n<a href=\"https://github.com/renatorib/react-powerplug/issues\"><img src=\"https://img.shields.io/github/issues/renatorib/react-powerplug.svg?style=flat-square\"></a>\n<a href=\"https://github.com/renatorib/react-powerplug/stargazers\"><img src=\"https://img.shields.io/github/stars/renatorib/react-powerplug.svg?style=flat-square\"></a>\n<a href=\"https://twitter.com/intent/tweet?url=https://github.com/renatorib/react-powerplug\"><img src=\"https://img.shields.io/twitter/url/https/github.com/renatorib/react-powerplug.svg?style=social&amp;style=flat-square\"></a></p>\n<p>:electric_plug: Give life to your Dumb Components. </p>\n<p><strong>React PowerPlug is a <em>Just add water&#x2122;</em></strong> set of <strong>function as children components</strong> that add different types of state logics in your dumb components. It creates a state and pass down the logic to the children, so you can handle your data/callbacks in dumb components.</p>\n<p>It&apos;s has been created to (but not limited to) use with <strong>storybook, react styleguidist, documentations, etc</strong>. because it&apos;s the most common use case. Otherwise you can use in your normal components too, for example a Dropdown that needs to know if opened or not, and others cases. </p>\n<p><a href=\"https://codesandbox.io/s/jp890p2x7w\">Play with live Toggle example on CodeSandbox</a></p>\n<pre><span class=\"hljs-keyword\">import</span> { Toggle } <span class=\"hljs-keyword\">from</span> <span class=\"hljs-string\">&apos;react-powerplug&apos;</span>\n<span class=\"hljs-keyword\">import</span> Checkbox <span class=\"hljs-keyword\">from</span> <span class=\"hljs-string\">&apos;./MyDumbCheckbox&apos;</span>\n\n&lt;Toggle initial={<span class=\"hljs-literal\">true</span>}&gt;\n {({ on, toggle }) =&gt; (\n <span class=\"xml\"><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">Checkbox</span> <span class=\"hljs-attr\">checked</span>=<span class=\"hljs-string\">{on}</span> <span class=\"hljs-attr\">onChange</span>=<span class=\"hljs-string\">{toggle}</span> /&gt;</span>\n )}\n<span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">Toggle</span>&gt;</span></span></pre><h1>Components</h1>\n<p><strong><em>Note:</em></strong> <em>This is a kind of a cheat sheet for fast search.</em><br><em>If you want a more detailed <strong>API Reference</strong> and examples for each component see the <a href=\"docs/README.md\">Docs</a></em></p>\n<h2><a href=\"docs/components/State.md\">State</a></h2>\n<p><strong>Props:</strong> <code>{ initial }</code><br><strong>Args:</strong> <code>{ state, setState }</code></p>\n<pre>&lt;State initial={{ <span class=\"hljs-attr\">isLoading</span>: <span class=\"hljs-literal\">false</span>, <span class=\"hljs-attr\">data</span>: <span class=\"hljs-literal\">null</span> }}&gt;\n {({ state, setState }) =&gt; (\n <span class=\"xml\"><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">DataReceiver</span>\n <span class=\"hljs-attr\">data</span>=<span class=\"hljs-string\">{state.data}</span>\n <span class=\"hljs-attr\">onStart</span>=<span class=\"hljs-string\">{()</span> =&gt;</span> setState({ isLoading: true })}\n onFinish={data =&gt; setState({ data, isLoading: false })}\n /&gt;\n )}\n<span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">State</span>&gt;</span></span></pre><h2><a href=\"docs/components/Toggle.md\">Toggle</a></h2>\n<p><strong>Props:</strong> <code>{ initial }</code><br><strong>Args:</strong> <code>{ on, off, toggle, setOn }</code></p>\n<pre>&lt;Toggle initial={<span class=\"hljs-literal\">true</span>}&gt;\n {({ on, toggle }) =&gt; (\n <span class=\"xml\"><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">Checkbox</span> <span class=\"hljs-attr\">checked</span>=<span class=\"hljs-string\">{on}</span> <span class=\"hljs-attr\">onChange</span>=<span class=\"hljs-string\">{toggle}</span> /&gt;</span>\n )}\n<span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">Toggle</span>&gt;</span></span></pre><h2><a href=\"docs/components/Counter.md\">Counter</a></h2>\n<p><strong>Props:</strong> <code>{ initial }</code><br><strong>Args:</strong> <code>{ count, inc, dec }</code></p>\n<pre>&lt;Counter initial={<span class=\"hljs-number\">0</span>}&gt;\n {({ count, inc, dec }) =&gt; (\n <span class=\"xml\"><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">CartItem</span>\n <span class=\"hljs-attr\">productName</span>=<span class=\"hljs-string\">&quot;Lorem ipsum&quot;</span>\n <span class=\"hljs-attr\">unitPrice</span>=<span class=\"hljs-string\">{19.90}</span>\n <span class=\"hljs-attr\">count</span>=<span class=\"hljs-string\">{count}</span>\n <span class=\"hljs-attr\">onAdd</span>=<span class=\"hljs-string\">{inc}</span>\n <span class=\"hljs-attr\">onRemove</span>=<span class=\"hljs-string\">{dec}</span>\n /&gt;</span>\n )}\n<span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">Counter</span>&gt;</span></span></pre><h2><a href=\"docs/components/Set.md\">Set</a></h2>\n<p><strong>Props:</strong> <code>{ initial }</code><br><strong>Args:</strong> <code>{ set, get, values }</code></p>\n<pre>&lt;<span class=\"hljs-built_in\">Set</span> initial={{ <span class=\"hljs-attr\">sounds</span>: <span class=\"hljs-literal\">true</span>, <span class=\"hljs-attr\">graphics</span>: <span class=\"hljs-string\">&apos;medium&apos;</span> }}&gt;\n {({ set, get }) =&gt; (\n <span class=\"xml\"><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">Settings</span>&gt;</span>\n <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">ToggleCheck</span> <span class=\"hljs-attr\">checked</span>=<span class=\"hljs-string\">{get(</span>&apos;<span class=\"hljs-attr\">sounds</span>&apos;)} <span class=\"hljs-attr\">onChange</span>=<span class=\"hljs-string\">{c</span> =&gt;</span> set(&apos;sounds&apos;, c)}&gt;\n Game Sounds\n <span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">ToggleCheck</span>&gt;</span>\n <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">Select</span>\n <span class=\"hljs-attr\">label</span>=<span class=\"hljs-string\">&quot;Graphics&quot;</span>\n <span class=\"hljs-attr\">options</span>=<span class=\"hljs-string\">{[</span>&apos;<span class=\"hljs-attr\">low</span>&apos;, &apos;<span class=\"hljs-attr\">medium</span>&apos;, &apos;<span class=\"hljs-attr\">high</span>&apos;]}\n <span class=\"hljs-attr\">selected</span>=<span class=\"hljs-string\">{get(</span>&apos;<span class=\"hljs-attr\">graphics</span>&apos;)}\n <span class=\"hljs-attr\">onSelect</span>=<span class=\"hljs-string\">{value</span> =&gt;</span> set(&apos;graphics&apos;, value)}\n /&gt;\n <span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">Settings</span>&gt;</span>\n )}\n<span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">Set</span>&gt;</span></span></pre><h2><a href=\"docs/components/List.md\">List</a></h2>\n<p><strong>Props:</strong> <code>{ initial }</code><br><strong>Args:</strong> <code>{ list, push, pull, sort, setList }</code></p>\n<pre>&lt;List initial={[<span class=\"hljs-string\">&apos;react&apos;</span>, <span class=\"hljs-string\">&apos;babel&apos;</span>]}&gt;\n {({ list, pull, push }) =&gt; (\n <span class=\"xml\"><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">div</span>&gt;</span>\n <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">FormInput</span> <span class=\"hljs-attr\">onSubmit</span>=<span class=\"hljs-string\">{push}</span> /&gt;</span>\n {list.map(tag =&gt; (\n <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">Tag</span> <span class=\"hljs-attr\">onRemove</span>=<span class=\"hljs-string\">{()</span> =&gt;</span> pull(value =&gt; value === tag)}&gt;\n {tag}\n <span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">Tag</span>&gt;</span>\n )}\n <span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">div</span>&gt;</span>\n )}\n<span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">List</span>&gt;</span></span></pre><h2><a href=\"docs/components/Bind.md\">Bind</a></h2>\n<p><strong>Props:</strong> <code>{ initial, getter }</code><br><strong>Args:</strong> <code>{ value, setValue, bind }</code> </p>\n<pre>&lt;Bind initial=<span class=\"hljs-string\">&quot;hello world&quot;</span>&gt;\n {({ bind, value }) =&gt; (\n <span class=\"xml\"><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">div</span>&gt;</span>\n <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">ControlledInput</span> {<span class=\"hljs-attr\">...bind</span>} /&gt;</span>\n <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">div</span>&gt;</span>You typed {value}<span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">div</span>&gt;</span>\n <span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">div</span>&gt;</span>\n )}\n<span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">Bind</span>&gt;</span></span></pre><h2><a href=\"docs/components/Compose.md\">Compose</a></h2>\n<p><strong>Props:</strong> <code>{ states }</code><br><strong>Args:</strong> <em>depends on passed states</em></p>\n<p>For an example, see below.</p>\n<h1>Composing Components</h1>\n<p>If you want to merge two of more components functionalities, you can compose they.<br>For complete guide <a href=\"docs/components/Compose.md\">see Compose docs</a></p>\n<pre><span class=\"hljs-keyword\">import</span> { compose } <span class=\"hljs-keyword\">from</span> <span class=\"hljs-string\">&apos;react-powerplug&apos;</span>\n\n<span class=\"hljs-keyword\">const</span> ToggleCounter = compose(&lt;Toggle initial={true} /&gt;, &lt;Counter initial={2} /&gt;)\n\n&lt;ToggleCounter&gt;\n {({ count, inc, dec, on, toggle }) =&gt; (\n &lt;ProductCard\n {...productInfo}\n isFavorited={on}\n onFavorite={toggle}\n count={count}\n onAdd={inc}\n onRemove={dec}\n /&gt;\n )}\n&lt;/ToggleCounter&gt;</pre><p>Also, you can use a built-in Compose component and pass components on <code>states</code> prop</p>\n<pre><span class=\"hljs-keyword\">import</span> { Compose } <span class=\"hljs-keyword\">from</span> <span class=\"hljs-string\">&apos;react-powerplug&apos;</span>\n\n&lt;Compose states={[&lt;Toggle initial={true} /&gt;, &lt;Counter initial={2} /&gt;]}&gt;\n {({ on, toggle, count, inc, dec }) =&gt; (\n &lt;ProductCard {...} /&gt;\n )}\n&lt;/Compose&gt;</pre><p>It is the same to do this:</p>\n<pre>&lt;Counter initial={<span class=\"hljs-number\">2</span>}&gt;\n {({ count, inc, dec }) =&gt; (\n <span class=\"xml\"><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">Toggle</span> <span class=\"hljs-attr\">initial</span>=<span class=\"hljs-string\">{true}</span>&gt;</span>\n {({ on, toggle }) =&gt; (\n <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">ProductCard</span>\n {<span class=\"hljs-attr\">...productInfo</span>}\n <span class=\"hljs-attr\">isFavorited</span>=<span class=\"hljs-string\">{on}</span>\n <span class=\"hljs-attr\">onFavorite</span>=<span class=\"hljs-string\">{toggle}</span>\n <span class=\"hljs-attr\">count</span>=<span class=\"hljs-string\">{count}</span>\n <span class=\"hljs-attr\">onAdd</span>=<span class=\"hljs-string\">{inc}</span>\n <span class=\"hljs-attr\">onRemove</span>=<span class=\"hljs-string\">{dec}</span>\n /&gt;</span>\n )}\n <span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">Toggle</span>&gt;</span>\n )}\n<span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">Counter</span>&gt;</span></span></pre><p>Because of this, when you use <code>toggle</code> function, only <code>&lt;Toggle&gt;</code> will be rerendered, but if you use <code>inc</code> or <code>dec</code> functions, both <code>&lt;Counter&gt;</code> and <code>&lt;Toggle&gt;</code> will be rerendered. Even using <code>compose()</code> utility.</p>\n<h1>Install</h1>\n<h3>Node Module</h3>\n<pre>yarn <span class=\"hljs-keyword\">add</span><span class=\"bash\"> react-powerplug</span></pre><pre>npm <span class=\"hljs-selector-tag\">i</span> react-powerplug</pre><h3>UMD library</h3>\n<pre><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">script</span> <span class=\"hljs-attr\">src</span>=<span class=\"hljs-string\">&quot;https://unpkg.com/react-powerplug/dist/react-powerplug.min.js&quot;</span>&gt;</span><span class=\"undefined\"></span><span class=\"hljs-tag\">&lt;/<span class=\"hljs-name\">script</span>&gt;</span></pre><p>exposed as <code>ReactPowerPlug</code></p>\n<h1>Contribute</h1>\n<p>You can help improving this project sending PRs and helping with issues.<br>Also you ping me at <a href=\"http://twitter.com/renatorib_\">Twitter</a></p>\n"
75+
},
76+
{
77+
"component": "footer",
78+
"links": [
79+
{
80+
"href": "https://github.com/renatorib/react-powerplug",
81+
"text": "GitHub"
82+
},
83+
{
84+
"href": "https://github.com/renatorib",
85+
"text": "renatorib"
86+
}
87+
]
88+
}
89+
]
90+
}

0 commit comments

Comments
 (0)