Skip to content

Commit eeeee26

Browse files
committed
@atomic-reactor/reactium-sdk-core@^1.1.2
1 parent 466d157 commit eeeee26

File tree

6 files changed

+547
-207
lines changed

6 files changed

+547
-207
lines changed

docs/api_data.js

+157
Original file line numberDiff line numberDiff line change
@@ -1417,6 +1417,44 @@ define({ "api": [
14171417
"filename": "node_modules/@atomic-reactor/reactium-sdk-core/lib/named-exports/is-container.js",
14181418
"groupTitle": "ReactHook"
14191419
},
1420+
{
1421+
"type": "ReactHook",
1422+
"url": "useReduxState(select,shouldUpdate,domain)",
1423+
"title": "useReduxState()",
1424+
"description": "<p>Similar to React useState(), returns selected redux state, and action dispatching function, as the first and second elements of an array.</p> <p>Takes an optional shouldUpdate callback (see useSelect), which does a shallow comparison of previous and current selected state by default. The update callback returned expects to be called with an object, and will cause a dispatch: { type: 'DOMAIN_UPDATE', domain, // the passed domain update, // object passed to update }</p> <p>Note: the boilerplate redux reducer created with <code>arcli component</code> will target action dispatched from this hoook.</p>",
1425+
"parameter": {
1426+
"fields": {
1427+
"Parameter": [
1428+
{
1429+
"group": "Parameter",
1430+
"type": "Function",
1431+
"optional": true,
1432+
"field": "select",
1433+
"description": "<p>Optional select callback (see useSelect), which selects for the domain by default.</p>"
1434+
},
1435+
{
1436+
"group": "Parameter",
1437+
"type": "Function",
1438+
"optional": true,
1439+
"field": "shouldUpdate",
1440+
"description": "<p>Optional shouldUpdate callback (see useSelect), which does a shallow comparison of previous and current selected state by default.</p>"
1441+
},
1442+
{
1443+
"group": "Parameter",
1444+
"type": "String",
1445+
"optional": false,
1446+
"field": "domain",
1447+
"description": "<p>The targeted redux domain.</p>"
1448+
}
1449+
]
1450+
}
1451+
},
1452+
"name": "useReduxState",
1453+
"group": "ReactHook",
1454+
"version": "0.0.0",
1455+
"filename": "node_modules/@atomic-reactor/use-select/lib/named-exports/redux.js",
1456+
"groupTitle": "ReactHook"
1457+
},
14201458
{
14211459
"type": "ReactHook",
14221460
"url": "useRefs()",
@@ -1502,6 +1540,64 @@ define({ "api": [
15021540
"filename": ".core/sdk/named-exports/roles.js",
15031541
"groupTitle": "ReactHook"
15041542
},
1543+
{
1544+
"type": "ReactHook",
1545+
"url": "useSelect(params)",
1546+
"title": "useSelect()",
1547+
"description": "<p>React hook for subscribing to only the updates from Redux store that you care about, and no more. This is superior to <code>react-redux</code> connect, in that your component will not update on every dispatch, only those state changes you have specifically targeted.</p>",
1548+
"parameter": {
1549+
"fields": {
1550+
"Parameter": [
1551+
{
1552+
"group": "Parameter",
1553+
"type": "Mixed",
1554+
"optional": false,
1555+
"field": "params",
1556+
"description": "<ol> <li>Callback function taking current state object from Redux store, and returning what you care about, or</li> <li>an Object with <code>select</code>, <code>shouldUpdate</code> and <code>returnMode</code> props.</li> </ol>"
1557+
},
1558+
{
1559+
"group": "Parameter",
1560+
"type": "Function",
1561+
"optional": false,
1562+
"field": "params.select",
1563+
"description": "<p>Callback function taking current state object from Redux store, and returning what you care about.</p>"
1564+
},
1565+
{
1566+
"group": "Parameter",
1567+
"type": "Function",
1568+
"optional": true,
1569+
"field": "params.shouldUpdate",
1570+
"description": "<p>Callback function object with 2 properties <code>newState</code> and <code>prevState</code>, containing the current results of the select function, and the previous results of the select function, respectively. Returns true if your component should update, otherwise false. By default, <code>useSelect</code> will do a shallow comparison.</p>"
1571+
},
1572+
{
1573+
"group": "Parameter",
1574+
"type": "String",
1575+
"optional": true,
1576+
"field": "params.returnMode",
1577+
"defaultValue": "state",
1578+
"description": "<p><code>state</code> to get the current state, <code>ref</code> to get the whole React reference object (for more realtime updates), and <code>get</code> for a getter function that takes object-path</p>"
1579+
}
1580+
]
1581+
}
1582+
},
1583+
"name": "useSelect",
1584+
"group": "ReactHook",
1585+
"examples": [
1586+
{
1587+
"title": "Simple.js",
1588+
"content": "import React from 'react';\nimport { useSelect } from '@atomic-reactor/use-select';\n\n// given a Redux state of { \"Simple\": {\"foo\": { \"bar\": \"baz\" }}}\nexport default () => {\n // Simple select callback: will update the component only when state.Simple.foo.bar changes no more.\n const baz = useSelect(state => state.Simple.foo.bar);\n return (\n <div>\n {baz}\n </div>\n );\n};",
1589+
"type": "json"
1590+
},
1591+
{
1592+
"title": "Advanced.js",
1593+
"content": "import React from 'react';\nimport { useSelect } from '@atomic-reactor/use-select';\n\n// given a Redux state of {\n// \"Advanced\": {\n// \"foo\": { \"bar\": \"baz\" },\n// \"hello\": \"world\",\n// }\n//}\nexport default () => {\n // Advanced select callback: will update the component only conditions of shouldUpdate are true.\n // All other Redux state changes are ignored.\n const Advanced = useSelect({\n select: state => state.Advanced,\n\n shouldUpdate: ({newState, prevState}) => {\n // newState and prevState are current and previous outcome of select callback above\n return newState.foo.bar !== prevState.foo.bar || newState.hello !== prevState.hello;\n },\n });\n\n return (\n <div>\n {Advanced.foo.bar}\n {Advanced.hello}\n </div>\n );\n};",
1594+
"type": "json"
1595+
}
1596+
],
1597+
"version": "0.0.0",
1598+
"filename": "node_modules/@atomic-reactor/use-select/lib/named-exports/redux.js",
1599+
"groupTitle": "ReactHook"
1600+
},
15051601
{
15061602
"type": "ReactHook",
15071603
"url": "useSettingGroup(group)",
@@ -1563,6 +1659,24 @@ define({ "api": [
15631659
"filename": "node_modules/@atomic-reactor/reactium-sdk-core/lib/named-exports/useStatus.js",
15641660
"groupTitle": "ReactHook"
15651661
},
1662+
{
1663+
"type": "ReactHook",
1664+
"url": "useStore()",
1665+
"title": "useStore()",
1666+
"description": "<p>Just gimme the store damnit! This React hook provides the Redux store when used on a component declared within the Store Provider.</p>",
1667+
"name": "useStore",
1668+
"group": "ReactHook",
1669+
"examples": [
1670+
{
1671+
"title": "MyComponent.js",
1672+
"content": "import React, { useEffect } from 'react';\nimport { useStore } from '@atomic-reactor/use-select';\n\nexport default () => {\n const { dispatch, getState, subscribe } = useStore();\n let count = getState();\n\n useEffect(() => {\n const unsubscribe = subscribe(() => {\n count = getState();\n });\n\n return unsubscribe;\n });\n\n return (\n <div>\n <button onClick={() => dispatch({ type: 'BUTTON_CLICK' })}>\n Click {count}\n </button>\n </div>\n );\n};",
1673+
"type": "json"
1674+
}
1675+
],
1676+
"version": "0.0.0",
1677+
"filename": "node_modules/@atomic-reactor/use-select/lib/named-exports/redux.js",
1678+
"groupTitle": "ReactHook"
1679+
},
15661680
{
15671681
"type": "ReactHook",
15681682
"url": "useSyncState(initialState)",
@@ -3274,6 +3388,49 @@ define({ "api": [
32743388
"filename": "node_modules/@atomic-reactor/reactium-sdk-core/lib/named-exports/fullscreen.js",
32753389
"groupTitle": "Reactium.Utilities"
32763390
},
3391+
{
3392+
"type": "Function",
3393+
"url": "ec(Component)",
3394+
"title": "ec()",
3395+
"description": "<p>ec, short for &quot;easy connect&quot; is a stripped down version of the redux <code>connect</code> function, which will provide your component with any Redux state properties under the name matching your component class (if applicable), as well as a <code>getState</code> function property.</p>",
3396+
"name": "ec",
3397+
"parameter": {
3398+
"fields": {
3399+
"Parameter": [
3400+
{
3401+
"group": "Parameter",
3402+
"type": "Component",
3403+
"optional": false,
3404+
"field": "Component",
3405+
"description": "<p>the React component to be decorated with Redux state.</p>"
3406+
},
3407+
{
3408+
"group": "Parameter",
3409+
"type": "domain",
3410+
"optional": true,
3411+
"field": "domain",
3412+
"description": "<p>domain or object path to get from state. if not provided, will used Component.name property.</p>"
3413+
}
3414+
]
3415+
}
3416+
},
3417+
"group": "Reactium.Utilities",
3418+
"examples": [
3419+
{
3420+
"title": "MyComponent/index.js",
3421+
"content": "import MyComponent from './MyComponent';\nimport { ec } from '@atomic-reactor/use-select';\n\nexport ec(MyComponent);",
3422+
"type": "json"
3423+
},
3424+
{
3425+
"title": "MyComponent/MyComponent.js",
3426+
"content": "import React, { Component } from 'react';\n\nclass MyComponent extends Component {\n render() {\n // getState prop provided by ec\n const state = this.props.getState();\n // foo property provided by ec\n const foo = this.props.foo;\n\n // Given that Redux store has an property MyComponent with property `foo`\n return (\n <div>\n {state.MyComponent.foo}\n {foo}\n </div>\n );\n }\n}\n\nMyComponent.defaultProps = {\n getState: () => {},\n foo: null,\n};\n\nexport default MyComponent;",
3427+
"type": "json"
3428+
}
3429+
],
3430+
"version": "0.0.0",
3431+
"filename": "node_modules/@atomic-reactor/use-select/lib/named-exports/redux.js",
3432+
"groupTitle": "Reactium.Utilities"
3433+
},
32773434
{
32783435
"type": "Function",
32793436
"url": "Reactium.Utils.abbreviatedNumber(number)",

docs/api_data.json

+157
Original file line numberDiff line numberDiff line change
@@ -1417,6 +1417,44 @@
14171417
"filename": "node_modules/@atomic-reactor/reactium-sdk-core/lib/named-exports/is-container.js",
14181418
"groupTitle": "ReactHook"
14191419
},
1420+
{
1421+
"type": "ReactHook",
1422+
"url": "useReduxState(select,shouldUpdate,domain)",
1423+
"title": "useReduxState()",
1424+
"description": "<p>Similar to React useState(), returns selected redux state, and action dispatching function, as the first and second elements of an array.</p> <p>Takes an optional shouldUpdate callback (see useSelect), which does a shallow comparison of previous and current selected state by default. The update callback returned expects to be called with an object, and will cause a dispatch: { type: 'DOMAIN_UPDATE', domain, // the passed domain update, // object passed to update }</p> <p>Note: the boilerplate redux reducer created with <code>arcli component</code> will target action dispatched from this hoook.</p>",
1425+
"parameter": {
1426+
"fields": {
1427+
"Parameter": [
1428+
{
1429+
"group": "Parameter",
1430+
"type": "Function",
1431+
"optional": true,
1432+
"field": "select",
1433+
"description": "<p>Optional select callback (see useSelect), which selects for the domain by default.</p>"
1434+
},
1435+
{
1436+
"group": "Parameter",
1437+
"type": "Function",
1438+
"optional": true,
1439+
"field": "shouldUpdate",
1440+
"description": "<p>Optional shouldUpdate callback (see useSelect), which does a shallow comparison of previous and current selected state by default.</p>"
1441+
},
1442+
{
1443+
"group": "Parameter",
1444+
"type": "String",
1445+
"optional": false,
1446+
"field": "domain",
1447+
"description": "<p>The targeted redux domain.</p>"
1448+
}
1449+
]
1450+
}
1451+
},
1452+
"name": "useReduxState",
1453+
"group": "ReactHook",
1454+
"version": "0.0.0",
1455+
"filename": "node_modules/@atomic-reactor/use-select/lib/named-exports/redux.js",
1456+
"groupTitle": "ReactHook"
1457+
},
14201458
{
14211459
"type": "ReactHook",
14221460
"url": "useRefs()",
@@ -1502,6 +1540,64 @@
15021540
"filename": ".core/sdk/named-exports/roles.js",
15031541
"groupTitle": "ReactHook"
15041542
},
1543+
{
1544+
"type": "ReactHook",
1545+
"url": "useSelect(params)",
1546+
"title": "useSelect()",
1547+
"description": "<p>React hook for subscribing to only the updates from Redux store that you care about, and no more. This is superior to <code>react-redux</code> connect, in that your component will not update on every dispatch, only those state changes you have specifically targeted.</p>",
1548+
"parameter": {
1549+
"fields": {
1550+
"Parameter": [
1551+
{
1552+
"group": "Parameter",
1553+
"type": "Mixed",
1554+
"optional": false,
1555+
"field": "params",
1556+
"description": "<ol> <li>Callback function taking current state object from Redux store, and returning what you care about, or</li> <li>an Object with <code>select</code>, <code>shouldUpdate</code> and <code>returnMode</code> props.</li> </ol>"
1557+
},
1558+
{
1559+
"group": "Parameter",
1560+
"type": "Function",
1561+
"optional": false,
1562+
"field": "params.select",
1563+
"description": "<p>Callback function taking current state object from Redux store, and returning what you care about.</p>"
1564+
},
1565+
{
1566+
"group": "Parameter",
1567+
"type": "Function",
1568+
"optional": true,
1569+
"field": "params.shouldUpdate",
1570+
"description": "<p>Callback function object with 2 properties <code>newState</code> and <code>prevState</code>, containing the current results of the select function, and the previous results of the select function, respectively. Returns true if your component should update, otherwise false. By default, <code>useSelect</code> will do a shallow comparison.</p>"
1571+
},
1572+
{
1573+
"group": "Parameter",
1574+
"type": "String",
1575+
"optional": true,
1576+
"field": "params.returnMode",
1577+
"defaultValue": "state",
1578+
"description": "<p><code>state</code> to get the current state, <code>ref</code> to get the whole React reference object (for more realtime updates), and <code>get</code> for a getter function that takes object-path</p>"
1579+
}
1580+
]
1581+
}
1582+
},
1583+
"name": "useSelect",
1584+
"group": "ReactHook",
1585+
"examples": [
1586+
{
1587+
"title": "Simple.js",
1588+
"content": "import React from 'react';\nimport { useSelect } from '@atomic-reactor/use-select';\n\n// given a Redux state of { \"Simple\": {\"foo\": { \"bar\": \"baz\" }}}\nexport default () => {\n // Simple select callback: will update the component only when state.Simple.foo.bar changes no more.\n const baz = useSelect(state => state.Simple.foo.bar);\n return (\n <div>\n {baz}\n </div>\n );\n};",
1589+
"type": "json"
1590+
},
1591+
{
1592+
"title": "Advanced.js",
1593+
"content": "import React from 'react';\nimport { useSelect } from '@atomic-reactor/use-select';\n\n// given a Redux state of {\n// \"Advanced\": {\n// \"foo\": { \"bar\": \"baz\" },\n// \"hello\": \"world\",\n// }\n//}\nexport default () => {\n // Advanced select callback: will update the component only conditions of shouldUpdate are true.\n // All other Redux state changes are ignored.\n const Advanced = useSelect({\n select: state => state.Advanced,\n\n shouldUpdate: ({newState, prevState}) => {\n // newState and prevState are current and previous outcome of select callback above\n return newState.foo.bar !== prevState.foo.bar || newState.hello !== prevState.hello;\n },\n });\n\n return (\n <div>\n {Advanced.foo.bar}\n {Advanced.hello}\n </div>\n );\n};",
1594+
"type": "json"
1595+
}
1596+
],
1597+
"version": "0.0.0",
1598+
"filename": "node_modules/@atomic-reactor/use-select/lib/named-exports/redux.js",
1599+
"groupTitle": "ReactHook"
1600+
},
15051601
{
15061602
"type": "ReactHook",
15071603
"url": "useSettingGroup(group)",
@@ -1563,6 +1659,24 @@
15631659
"filename": "node_modules/@atomic-reactor/reactium-sdk-core/lib/named-exports/useStatus.js",
15641660
"groupTitle": "ReactHook"
15651661
},
1662+
{
1663+
"type": "ReactHook",
1664+
"url": "useStore()",
1665+
"title": "useStore()",
1666+
"description": "<p>Just gimme the store damnit! This React hook provides the Redux store when used on a component declared within the Store Provider.</p>",
1667+
"name": "useStore",
1668+
"group": "ReactHook",
1669+
"examples": [
1670+
{
1671+
"title": "MyComponent.js",
1672+
"content": "import React, { useEffect } from 'react';\nimport { useStore } from '@atomic-reactor/use-select';\n\nexport default () => {\n const { dispatch, getState, subscribe } = useStore();\n let count = getState();\n\n useEffect(() => {\n const unsubscribe = subscribe(() => {\n count = getState();\n });\n\n return unsubscribe;\n });\n\n return (\n <div>\n <button onClick={() => dispatch({ type: 'BUTTON_CLICK' })}>\n Click {count}\n </button>\n </div>\n );\n};",
1673+
"type": "json"
1674+
}
1675+
],
1676+
"version": "0.0.0",
1677+
"filename": "node_modules/@atomic-reactor/use-select/lib/named-exports/redux.js",
1678+
"groupTitle": "ReactHook"
1679+
},
15661680
{
15671681
"type": "ReactHook",
15681682
"url": "useSyncState(initialState)",
@@ -3274,6 +3388,49 @@
32743388
"filename": "node_modules/@atomic-reactor/reactium-sdk-core/lib/named-exports/fullscreen.js",
32753389
"groupTitle": "Reactium.Utilities"
32763390
},
3391+
{
3392+
"type": "Function",
3393+
"url": "ec(Component)",
3394+
"title": "ec()",
3395+
"description": "<p>ec, short for &quot;easy connect&quot; is a stripped down version of the redux <code>connect</code> function, which will provide your component with any Redux state properties under the name matching your component class (if applicable), as well as a <code>getState</code> function property.</p>",
3396+
"name": "ec",
3397+
"parameter": {
3398+
"fields": {
3399+
"Parameter": [
3400+
{
3401+
"group": "Parameter",
3402+
"type": "Component",
3403+
"optional": false,
3404+
"field": "Component",
3405+
"description": "<p>the React component to be decorated with Redux state.</p>"
3406+
},
3407+
{
3408+
"group": "Parameter",
3409+
"type": "domain",
3410+
"optional": true,
3411+
"field": "domain",
3412+
"description": "<p>domain or object path to get from state. if not provided, will used Component.name property.</p>"
3413+
}
3414+
]
3415+
}
3416+
},
3417+
"group": "Reactium.Utilities",
3418+
"examples": [
3419+
{
3420+
"title": "MyComponent/index.js",
3421+
"content": "import MyComponent from './MyComponent';\nimport { ec } from '@atomic-reactor/use-select';\n\nexport ec(MyComponent);",
3422+
"type": "json"
3423+
},
3424+
{
3425+
"title": "MyComponent/MyComponent.js",
3426+
"content": "import React, { Component } from 'react';\n\nclass MyComponent extends Component {\n render() {\n // getState prop provided by ec\n const state = this.props.getState();\n // foo property provided by ec\n const foo = this.props.foo;\n\n // Given that Redux store has an property MyComponent with property `foo`\n return (\n <div>\n {state.MyComponent.foo}\n {foo}\n </div>\n );\n }\n}\n\nMyComponent.defaultProps = {\n getState: () => {},\n foo: null,\n};\n\nexport default MyComponent;",
3427+
"type": "json"
3428+
}
3429+
],
3430+
"version": "0.0.0",
3431+
"filename": "node_modules/@atomic-reactor/use-select/lib/named-exports/redux.js",
3432+
"groupTitle": "Reactium.Utilities"
3433+
},
32773434
{
32783435
"type": "Function",
32793436
"url": "Reactium.Utils.abbreviatedNumber(number)",

docs/api_project.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ define({
88
"apidoc": "0.3.0",
99
"generator": {
1010
"name": "apidoc",
11-
"time": "2021-08-17T19:20:16.141Z",
11+
"time": "2021-08-17T21:13:18.829Z",
1212
"url": "https://apidocjs.com",
1313
"version": "0.25.0"
1414
}

0 commit comments

Comments
 (0)