Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release/absolute anaconda #149

Merged
merged 141 commits into from
Feb 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
141 commits
Select commit Hold shift + click to select a range
de2bed7
feat: Add modify to public api
dxinteractive Oct 2, 2018
b9caecd
feat: stub modify function
dxinteractive Oct 2, 2018
be0c81a
refactor: organise private variables
dxinteractive Oct 2, 2018
5470617
refactor: remove unused isFirst and isLast member vars
dxinteractive Oct 2, 2018
d73ff46
fix: unget should not have index as a key
dxinteractive Oct 2, 2018
17a7e9d
BREAKING CHANGE: Remove ActionCreators from public API
dxinteractive Oct 2, 2018
b2c5e3a
feat: Add keyPathModifiers to Action
dxinteractive Oct 2, 2018
13a6dab
merge: from release/superior-snake
dxinteractive Nov 26, 2018
4203e00
amend: remove parcel.modify()
dxinteractive Nov 26, 2018
aaa354e
refactor: make parcelData functions more consistently named
dxinteractive Nov 28, 2018
95f3258
refactor: remove unused parcelData.set argument
dxinteractive Nov 28, 2018
f3b99ae
refactor: Add internal ParcelDataEvaluator flow type
dxinteractive Nov 28, 2018
7d40f30
feat: Add Action.keyPathModifiers to enable functions in actions
dxinteractive Nov 28, 2018
27ec644
refactor: remove needless todo comment
dxinteractive Nov 28, 2018
3cae540
feat: Adjust tests to cope with keyPathModifiers
dxinteractive Nov 28, 2018
a28e85d
refactor: replace Reducer with ChangeRequestReducer
dxinteractive Nov 28, 2018
16a68f5
refactor: delete unused file
dxinteractive Nov 28, 2018
025b9ec
BREAK: rename Parcel.modifyValue to modifyValueDown
dxinteractive Nov 28, 2018
ccc769a
BREAK: rename Parcel.modifyChangeValue to modifyValueUp
dxinteractive Nov 28, 2018
5af77d3
BREAK: rename Parcel.modifyChangeBatch to modifyChange
dxinteractive Nov 28, 2018
abb17b0
refactor: delete unused file
dxinteractive Nov 28, 2018
b0548e8
Merge branch 'master' of github.com:blueflag/dataparcels into feature…
dxinteractive Nov 28, 2018
d445e91
Merge pull request #148 from blueflag/master
dxinteractive Nov 28, 2018
bda4b57
Merge pull request #136 from blueflag/feature/function-modifiers
dxinteractive Nov 28, 2018
ac86132
feat: draft modifyUp and modifyDown
dxinteractive Dec 2, 2018
96fe36e
feat: add parceldata getIn
dxinteractive Dec 4, 2018
4fb356b
feat: add staticparcel to runtime type checker
dxinteractive Dec 4, 2018
63e4327
fix: make Parcel.toObject() make object out of array value
dxinteractive Dec 4, 2018
cb25af9
BREAK: remove Parcel.updateMeta
dxinteractive Dec 5, 2018
a3dced4
BREAK: remove type ParcelMetaUpdater
dxinteractive Dec 5, 2018
ad74093
amend: fix lint
dxinteractive Dec 5, 2018
e1a66a1
BREAK: remove Parcel.matchPipe
dxinteractive Dec 5, 2018
cad57fb
refactor: remove typedPathString and typeCode logic
dxinteractive Dec 5, 2018
3aaef4c
refactor: remove ping and shouldBeSynchronous
dxinteractive Dec 5, 2018
b900d06
docs: turn parcelboundary render into pure example without debugRende…
dxinteractive Dec 5, 2018
9255e46
BREAK: remove debugRender
dxinteractive Dec 5, 2018
afbf571
Merge pull request #155 from blueflag/feature/static-parcel
dxinteractive Dec 6, 2018
284c13d
docs: remove unused gh-pages
dxinteractive Jan 11, 2019
ce88393
add: setData action
dxinteractive Jan 11, 2019
2f9061d
BREAK: redo parcel.modify methods and update methods
dxinteractive Jan 11, 2019
7233ea9
build: fix view-coverage command
dxinteractive Jan 12, 2019
516c98a
add: Parcel.children()
dxinteractive Jan 12, 2019
f1cf293
BREAK: add value updater validation to updaters
dxinteractive Jan 12, 2019
14175a4
refactor: sort methods
dxinteractive Jan 12, 2019
2fbc191
refactor: redo updateIn to reduce code
dxinteractive Jan 12, 2019
094c1e7
amend: fix flow problem
dxinteractive Jan 12, 2019
996ce7a
add: add new type exports
dxinteractive Jan 13, 2019
6b51e49
BREAK: add standardised value updater
dxinteractive Jan 13, 2019
fa1c71c
add: add static parcel
dxinteractive Jan 13, 2019
91b7162
amend: amend usage of old modify method
dxinteractive Jan 13, 2019
26b04c2
docs: add docs
dxinteractive Jan 13, 2019
9c85074
test: add sanity test
dxinteractive Jan 14, 2019
487506a
amend: fix lint
dxinteractive Jan 14, 2019
1660859
build: commit new lock file
dxinteractive Jan 14, 2019
072106d
amend: rename updater methods
dxinteractive Jan 14, 2019
fcc9430
docs: fix link
dxinteractive Jan 14, 2019
602df3a
amend: deep updater renamed to shape updaters
dxinteractive Jan 14, 2019
9fe7dc4
Merge pull request #165 from blueflag/feature/static-parcel
dxinteractive Jan 14, 2019
55e2456
build: add size limit
dxinteractive Jan 14, 2019
827537f
amend: use external size limit config file
dxinteractive Jan 14, 2019
f5d1eda
add: ability for push and unshift to accept multiple args
dxinteractive Jan 14, 2019
91f34c3
test: improve Parcel.initialMeta tests
dxinteractive Jan 14, 2019
653a9fc
fix: prevent value from being removed if initialMeta is set
dxinteractive Jan 14, 2019
4bd114d
refactor: initialMeta must be passed an object
dxinteractive Jan 14, 2019
1a9cf66
amend: rename StaticParcel to ParcelShape
dxinteractive Jan 14, 2019
91e6b33
amend: rename ParcelShapeShapeUpdater
dxinteractive Jan 14, 2019
ca6fe36
amend: revert parcel shape shape
dxinteractive Jan 14, 2019
9226944
amend: better flow types
dxinteractive Jan 14, 2019
e722e6b
docs: typo
dxinteractive Jan 14, 2019
a4c30da
Merge pull request #167 from blueflag/feature/size-limit
dxinteractive Jan 14, 2019
9eb3116
Merge pull request #168 from blueflag/feature/push-unshift-multiple
dxinteractive Jan 14, 2019
eddf89f
test: improve initialMeta tests
dxinteractive Jan 14, 2019
7e35b9c
Merge pull request #169 from blueflag/feature/fix-initial-meta
dxinteractive Jan 14, 2019
f060531
merge: fro relase branch
dxinteractive Jan 15, 2019
4b00e57
Merge pull request #170 from blueflag/feature/parcel-shape
dxinteractive Jan 15, 2019
7a760a5
v0.18.0-0
dxinteractive Jan 15, 2019
b0fd93b
v0.18.0-1
dxinteractive Jan 15, 2019
53f99d7
v0.18.0-2
dxinteractive Jan 15, 2019
62beb40
add: Parcel.move()
dxinteractive Jan 15, 2019
9fe45ef
add: ParcelShape.move()
dxinteractive Jan 15, 2019
a0e0933
docs: add move() to docs
dxinteractive Jan 15, 2019
222ad0a
docs: add react-sortable-hoc example
dxinteractive Jan 15, 2019
8840af8
docs: update editing arrays text
dxinteractive Jan 15, 2019
fc5842e
Merge pull request #171 from blueflag/feature/move
dxinteractive Jan 15, 2019
d0be342
add: ShapeUpdaterUndefinedError error and ParcelShape._updateFromData…
dxinteractive Jan 22, 2019
94f9239
add: ability for modifyShapeUp to halt change propagation if undefine…
dxinteractive Jan 22, 2019
9ff4a30
test: improve parcel shape updater tests, and test modifyShapeUp unde…
dxinteractive Jan 22, 2019
54248a2
build: misc project setup improvements
dxinteractive Jan 28, 2019
43da4b6
BREAK: move from named exports to slash exports
dxinteractive Jan 28, 2019
14234a3
BREAK: split out parcel shape updaters and finalise modify method api
dxinteractive Jan 28, 2019
deffe3c
BREAK: make reducer able to cancel action during execution
dxinteractive Jan 28, 2019
fd52cd5
refactor: add setMetaDefault
dxinteractive Jan 28, 2019
27fb9f2
refactor: remove unneeded error
dxinteractive Jan 28, 2019
ef992cd
BREAK: remove batch and all batch related methods
dxinteractive Jan 28, 2019
54b1cb3
BREAK: remove hasDispatched and dispatch registry
dxinteractive Jan 28, 2019
381d921
BREAK: remove setChangeRequestMeta
dxinteractive Jan 28, 2019
83c8b48
refactor: import from new slash imports
dxinteractive Jan 28, 2019
3fdf3d5
test: improve tests
dxinteractive Jan 28, 2019
44a2e1d
BREAK: remove hasDispatched, batch, batchAndReturn, modifyChange, set…
dxinteractive Jan 28, 2019
72c5e26
refactor: fix flow
dxinteractive Jan 28, 2019
32cceac
BREAK: remove Parcel.hasDispatched()
dxinteractive Jan 28, 2019
387b3f3
wip
dxinteractive Jan 28, 2019
5d1ea38
Merge branch 'master' into release/absolute-anaconda
dxinteractive Jan 29, 2019
ab982db
docs: make docs use new slash exports
dxinteractive Jan 29, 2019
ddeb993
Merge pull request #175 from blueflag/feature/no-batch
dxinteractive Jan 29, 2019
f98eea1
Merge branch 'release/absolute-anaconda' of github.com:blueflag/datap…
dxinteractive Jan 29, 2019
924b064
wip
dxinteractive Jan 29, 2019
9ee8ea5
wip
dxinteractive Jan 30, 2019
2bd3dd6
add: react-dataparcels-draggable
dxinteractive Jan 30, 2019
cd499e5
amend: rename draggable to drag
dxinteractive Jan 30, 2019
e54df3f
amend: rename drag folder
dxinteractive Jan 30, 2019
088d77f
add: throw error if non indexed type provided to drag
dxinteractive Jan 30, 2019
a1e8ceb
add: ability to se sortable props via config
dxinteractive Jan 30, 2019
d59be3b
build: enforce coverage
dxinteractive Jan 30, 2019
bc3ebfa
amend: put jest config in the right place
dxinteractive Jan 30, 2019
47ede29
docs: add note about usage
dxinteractive Jan 30, 2019
1bb7535
docs: remove Typography class from example
dxinteractive Jan 30, 2019
2737789
Merge pull request #179 from blueflag/feature/draggable
dxinteractive Jan 30, 2019
de7909a
Merge branch 'release/absolute-anaconda' of github.com:blueflag/datap…
dxinteractive Jan 31, 2019
50c1b8b
add: remove value updater error in favour of warning
dxinteractive Jan 31, 2019
1e4d034
docs: update updater docs
dxinteractive Jan 31, 2019
ddb44c0
docs: add features section
dxinteractive Jan 31, 2019
da30d57
Merge pull request #177 from blueflag/feature/more-more-docs
dxinteractive Jan 31, 2019
8b8634f
Merge branch 'release/absolute-anaconda' of github.com:blueflag/datap…
dxinteractive Jan 31, 2019
11942a5
docs: fix link
dxinteractive Jan 31, 2019
deb1630
docs: more docs
dxinteractive Feb 1, 2019
fd1bafa
docs: docs docs
dxinteractive Feb 2, 2019
5f00e51
wip
dxinteractive Feb 2, 2019
bedf0eb
amend: react-dataparcels exports
dxinteractive Feb 2, 2019
e54c080
amend: use a cancel() function to cancel changes instead of undefined
dxinteractive Feb 2, 2019
e8f54f2
fix: allow ParcelBoundary state to be ahead of the state of higher pa…
dxinteractive Feb 2, 2019
b32e7fd
docs
dxinteractive Feb 2, 2019
3877a47
Merge branch 'feature/modify-examples' of github.com:blueflag/datapar…
dxinteractive Feb 2, 2019
cee444c
refactor: upgrade unmutable
dxinteractive Feb 3, 2019
22387e9
amend: bug where reducerparentactions wouldnt run pre and post on las…
dxinteractive Feb 3, 2019
949b9ae
docs: rename example
dxinteractive Feb 3, 2019
30184c9
add: parcelboundary keepstate and necessary underlying data
dxinteractive Feb 3, 2019
390e5f8
docs: more docs
dxinteractive Feb 3, 2019
e604a4d
amend: change() is now callewd CancelActionMarker
dxinteractive Feb 4, 2019
cf0e80d
docs: remove cancel import from sandbox
dxinteractive Feb 4, 2019
42cd8d8
Merge pull request #180 from blueflag/feature/modify-examples
dxinteractive Feb 4, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ module.system.node.resolve_dirname=src
<PROJECT_ROOT>/.*/gatsby-node.js
<PROJECT_ROOT>/packages/dataparcels-docs/.*
<PROJECT_ROOT>/node_modules/react-flip-move/src/.*
<PROJECT_ROOT>/node_modules/immutable/.*
14 changes: 14 additions & 0 deletions .size-limit
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[
{
limit: "25 KB",
path: "packages/dataparcels/lib/index.js"
},
{
limit: "25 KB",
path: "packages/dataparcels/ParcelShape.js"
},
{
limit: "25 KB",
path: "packages/react-dataparcels/lib/index.js"
}
]
3 changes: 3 additions & 0 deletions flow-typed/brokenModules.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
declare module "immutable" {
declare module.exports: any
}
10 changes: 9 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,13 @@ module.exports = {
"!packages/dataparcels-docs/**"
],
testMatch: ["**/__test__/**/*-test.js?(x)"],
testURL: 'http://localhost'
testURL: 'http://localhost',
coverageThreshold: {
global: {
branches: 90,
functions: 90,
lines: 90,
statements: 90
}
}
};
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"lerna": "2.9.0",
"npmClient": "yarn",
"useWorkspaces": true,
"version": "0.17.2"
"version": "0.18.0-2"
}
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
"flow": "blueflag-test flow",
"flow-coverage": "blueflag-test flow-coverage -M",
"lint": "blueflag-test lint --monorepo",
"test": "yarn jest --maxWorkers=4",
"test-all": "yarn lint && yarn flow && yarn test --maxWorkers=4 && yarn flow-coverage",
"test": "yarn build && yarn jest --maxWorkers=1",
"test-all": "yarn build && yarn test --maxWorkers=1 && yarn flow && yarn lint && yarn flow-coverage && yarn size-limit",
"deploy-docs": "yarn lerna --scope dataparcels-docs run deploy",
"view-coverage": "yarn run coverage; open ./coverage/lcov-report/index.html",
"view-coverage": "open ./coverage/lcov-report/index.html",
"watch": "lerna run watch --parallel --"
},
"workspaces": {
Expand Down
63 changes: 0 additions & 63 deletions packages/dataparcels-docs/gatsby-node.js
Original file line number Diff line number Diff line change
@@ -1,68 +1,5 @@
const {createFilePath} = require('gatsby-source-filesystem');
const path = require('path');
const fs = require('fs');

exports.createPages = ({graphql, boundActionCreators}) => {
const {createPage} = boundActionCreators;

// function createExamples() {
// return graphql(`
// {
// allFile(filter: {sourceInstanceName: {eq: "example-pages"}}, sort: {fields: relativePath, order: ASC}) {
// edges {
// next {
// name
// relativePath
// }
// node {
// name
// relativePath
// }
// previous {
// name
// relativePath
// }
// }
// }
// }
// `)
// .then(result => {
// if (result.errors) {
// return Promise.reject(result.errors);
// }

// let getPath = (node) => `/examples/${node.name.split("-")[1]}`;
// result.data.allFile.edges.forEach(({next, node, previous}, index) => {
// let component = path.resolve(`src/examples/${node.relativePath}`);

// createPage({
// path: getPath(node),
// component,
// context: {
// next: next ? getPath(next) : null,
// previous: previous ? getPath(previous) : null,
// file: node.relativePath
// }
// });
// });
// });
// }

return Promise.resolve()
//.then(createExamples)
;
};

const circleYml = `
general:
branches:
ignore:
- gh-pages
`;

exports.onPostBuild = () => {
fs.writeFileSync(`${__dirname}/public/circle.yml`, circleYml);
}

exports.modifyWebpackConfig = ({ config, stage }) => {

Expand Down
5 changes: 2 additions & 3 deletions packages/dataparcels-docs/package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
{
"name": "dataparcels-docs",
"version": "0.17.1",
"version": "0.18.0-2",
"description": "Dataparcels Documentation",
"author": "Damien Clarke",
"license": "MIT",
"main": "n/a",
"scripts": {
"build-all": "yarn build-docs",
"build-docs": "gatsby build",
"deploy": "gatsby build --prefix-paths && gh-pages -d public",
"watch": "gatsby develop",
"test": "echo \"Error: no test specified\" && exit 1"
},
Expand All @@ -24,7 +23,6 @@
"gatsby-remark-prismjs": "^1.2.21",
"gatsby-source-filesystem": "^1.5.26",
"gatsby-transformer-remark": "^1.7.34",
"gh-pages": "^1.1.0",
"immutable": "^3.8.2",
"mdx-loader": "1.0.0-beta.3",
"mdxc": "^1.1.1",
Expand All @@ -33,6 +31,7 @@
"react-flip-move": "^3.0.2",
"react-helmet": "^5.2.0",
"react-lifecycles-compat": "^3.0.4",
"react-sortable-hoc": "^1.4.0",
"stampy": "^0.41.0",
"unmutable": "^0.29.2"
}
Expand Down
1 change: 1 addition & 0 deletions packages/dataparcels-docs/src/component/APINavigation.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export default () => <NavigationList>
<NavigationListItem>- <Link to="/api/ParcelHoc">ParcelHoc</Link></NavigationListItem>
<NavigationListItem>- <Link to="/api/ParcelBoundary">ParcelBoundary</Link></NavigationListItem>
<NavigationListItem>- <Link to="/api/ParcelBoundaryHoc">ParcelBoundaryHoc</Link></NavigationListItem>
<NavigationListItem>- <Link to="/api/ParcelShape">ParcelShape</Link></NavigationListItem>
<NavigationListItem>- <Link to="/api/ChangeRequest">ChangeRequest</Link></NavigationListItem>
<NavigationListItem>- <Link to="/api/Action">Action</Link></NavigationListItem>
</NavigationList>;
10 changes: 5 additions & 5 deletions packages/dataparcels-docs/src/content/API.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,33 +31,33 @@ export default () => <Box>
name="Parcel"
description={<Box>
<Text element="p" modifier="marginMilli">Parcel is a data container.</Text>
<Text element="p">It's job is to hold your data, split it into smaller parts, and merge changes back together.</Text>
<Text element="p">Its job is to hold your data, split it into smaller parts, and merge changes back together.</Text>
</Box>}
image={IconParcel}
/>
<Item
name="ParcelHoc"
description={<Box>
<Text element="p" modifier="marginMilli">ParcelHoc is a React higher order component.</Text>
<Text element="p">It's job is to provide a parcel as a prop, and to handle how the parcel binds to React props and lifecycle events.</Text>
<Text element="p">Its job is to provide a parcel as a prop, and to handle how the parcel binds to React props and lifecycle events.</Text>
</Box>}
image={IconParcelHoc}
/>
<Item
name="ParcelBoundary"
description={<Box>
<Text element="p" modifier="marginMilli">ParcelBoundary is a React component.</Text>
<Text element="p">It's job is to optimise rendering performance, and to optionally control the flow of parcel changes.</Text>
<Text element="p">Its job is to optimise rendering performance, and to optionally control the flow of parcel changes.</Text>
</Box>}
image={IconParcelBoundary}
/>
<Item
name="ParcelBoundaryHoc"
description={<Box>
<Text element="p" modifier="marginMilli">ParcelBoundaryHoc is a React higher order component.</Text>
<Text element="p">It's job is to control the flow of parcel changes. It is the higher order component version of a ParcelBoundary.</Text>
<Text element="p">Its job is to control the flow of parcel changes. It is the higher order component version of a ParcelBoundary.</Text>
</Box>}
image={IconParcelBoundaryHoc}
/>
<Text element="p" modifier="margin">See also: <Link className="Link" to="/api/ChangeRequest">ChangeRequest</Link>, <Link className="Link" to="/api/Action">Action</Link>.</Text>
<Text element="p" modifier="margin">See also: <Link className="Link" to="/api/ParcelShape">ParcelShape</Link>, <Link className="Link" to="/api/ChangeRequest">ChangeRequest</Link>, <Link className="Link" to="/api/Action">Action</Link>.</Text>
</Box>;
3 changes: 2 additions & 1 deletion packages/dataparcels-docs/src/content/APIExamples.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import Link from 'gatsby-link';
### Parcel

* <Link to="/examples/editing-objects">Editing objects</Link>
* <Link to="/examples/editing-arrays">Editing arrays</Link>
* <Link to="/examples/editing-arrays">Editing arrays (including drag & drop)</Link>
* <Link to="/parcel-meta">Parcel meta</Link>
* <Link to="/examples/managing-your-own-parcel-state">Managing your own parcel state</Link>

### ParcelHoc
Expand Down
6 changes: 0 additions & 6 deletions packages/dataparcels-docs/src/content/Examples.md

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Link from 'gatsby-link';

* <Link to="/examples/parcelboundary-example">ParcelBoundary example</Link>
* <Link to="/examples/parcelboundary-pure">ParcelBoundary pure rendering example</Link>
* <Link to="/examples/parcelboundary-debounce">Using debounce</Link>
* <Link to="/examples/parcelboundary-forceupdate">Using forceUpdate</Link>
* <Link to="/examples/parcelboundary-hold">Using hold</Link>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions packages/dataparcels-docs/src/docs/api/action/Action.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import Link from 'component/Link';
# Action

```js
import {Action} from 'dataparcels';
import {Action} from 'react-dataparcels';
import Action from 'dataparcels/Action';
import Action from 'react-dataparcels/Action';
```

```flow
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ isValueAction(): boolean

Returns true if the action affects the original parcel's value.

Actions such as `setMeta` and `ping` do not affect the original parcel's value and are not value actions.
Actions such as `setMeta` do not affect the original parcel's value and are not value actions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import Link from 'component/Link';
# ChangeRequest

```js
import {ChangeRequest} from 'dataparcels';
import {ChangeRequest} from 'react-dataparcels';
import ChangeRequest from 'dataparcels/ChangeRequest';
import ChangeRequest from 'react-dataparcels/ChangeRequest';
```

```flow
Expand All @@ -17,4 +17,4 @@ When a change occurs, ChangeRequests are used by Parcels to describe what to cha

ChangeRequests contain an array of <Link to="/api/Action">Actions</Link> to perform.

ChangeRequests can most often be accessed in `handleChange` and `modifyChange` functions. Most of the time these operate invisibly, and it's extremely rare that you'll create these yourself.
ChangeRequests can most often be accessed in `handleChange` and `modifyUp` functions. Most of the time these operate invisibly, and it's extremely rare that you'll create these yourself.
8 changes: 2 additions & 6 deletions packages/dataparcels-docs/src/docs/api/parcel/Parcel.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import IconParcel from 'content/parcel.gif';

<ApiPageIcon>{IconParcel}</ApiPageIcon>

Parcel is a data container. It's job is to hold your data, split it into smaller parts, and merge changes back together.
Parcel is a data container. Its job is to hold your data, split it into smaller parts, and merge changes back together.

If you're using React, you probably won't be instanciating parcels directly. Please see the <Link to="/getting-started">getting started</Link> page to see how to best use Parcels in a React app.

Expand All @@ -20,9 +20,7 @@ import Parcel from 'react-dataparcels';
```flow
new Parcel({
value?: any,
handleChange?: Function,
// debugging options
debugRender?: boolean
handleChange?: Function
});
```

Expand All @@ -32,8 +30,6 @@ new Parcel({
The `handleChange` function will be called whenever the Parcel's value has been triggered to change. It is passed `newParcel`, a replacement Parcel containing the changes; and `changeRequest`, a <Link to="/api/ChangeRequest">ChangeRequest</Link> that contains details about the change itself.

In `handleChange` you would typically implement logic to replace your current parcel with `newParcel`, but if you're using React you should read <Link to="/getting-started">getting started</Link> to save you the trouble of implementing this yourself.
* <Param name="debugRender" optional type="boolean" default="false" />
For debugging purposes. When set to `true` this causes all downstream <Link to="/api/ParcelBoundary">ParcelBoundary</Link>s to display when they are being rendered and re-rendered.

```js
// creates a Parcel that contains a value of 123
Expand Down
4 changes: 2 additions & 2 deletions packages/dataparcels-docs/src/docs/api/parcel/ParcelAfter.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Examples from 'content/Examples.md';
import Link from 'gatsby-link';

### Examples

<Examples />
Many examples can be found on the <Link to="/data-editing">data editing</Link> page.
3 changes: 0 additions & 3 deletions packages/dataparcels-docs/src/docs/api/parcel/batch.md

This file was deleted.

This file was deleted.

29 changes: 29 additions & 0 deletions packages/dataparcels-docs/src/docs/api/parcel/children.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
```flow
children(mapper?: ParcelMapper): ParentType<Parcel> // only on ParentParcels

type ParcelMapper = (
item: Parcel,
property: string|number,
parent: Parcel
) => any;
```

Returns all of the Parcel's children as new ChildParcels, contained within the original Parcel's data structure.

An optional `mapper` function can be passed, which will be called on each child.

```js
let value = {
abc: 123,
def: 456
};

let parcel = new Parcel({value});
parcel.children();

// returns {
// abc: Parcel, // contains a value of 123
// def: Parcel // contains a value of 456
// }

```
23 changes: 22 additions & 1 deletion packages/dataparcels-docs/src/docs/api/parcel/delete.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,25 @@
import IndexedKeys from 'docs/notes/IndexedKeys.md';

```flow
delete(): void
delete(): void // only on ChildParcels
delete(key: string|number): void // only on ParentParcels, will delete a child
```

Calling `delete()` with no arguments will trigger a change that will delete the current Parcel off of its parent. This variation of the `delete()` method only exists on ChildParcels.

On ParentParcels this method can be called with a `key`, which deletes the child value at that key.

```js
let value = {
abc: 123,
def: 456
};
let parcel = new Parcel({value});
parcel.get('abc').delete();
// this triggers a change that sets the parcel's value to {def: 456}

parcel.delete('abc');
// this also triggers a change that sets the parcel's value to {def: 456}
```

<IndexedKeys />
17 changes: 17 additions & 0 deletions packages/dataparcels-docs/src/docs/api/parcel/deleteIn.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
import IndexedKeys from 'docs/notes/IndexedKeys.md';

```flow
deleteIn(keyPath: Array<string|number>): void // only on ParentParcels
```

Calling `setIn()` will trigger a change that will delete the value at the provided `keyPath`.

```js
let value = {
a: {
b: 123
}
};
let parcel = new Parcel({value});
parcel.deleteIn(['a','b']);
// this triggers a change that sets the parcel's value to {a: {}}
```

<IndexedKeys />
Loading