Skip to content

Commit

Permalink
Merge pull request #149 from blueflag/release/absolute-anaconda
Browse files Browse the repository at this point in the history
Release/absolute anaconda
  • Loading branch information
dxinteractive committed Feb 4, 2019
2 parents 38c079b + 42cd8d8 commit a72f09b
Show file tree
Hide file tree
Showing 289 changed files with 8,087 additions and 3,010 deletions.
1 change: 1 addition & 0 deletions .flowconfig
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
@@ -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
@@ -0,0 +1,3 @@
declare module "immutable" {
declare module.exports: any
}
10 changes: 9 additions & 1 deletion jest.config.js
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
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
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
@@ -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
@@ -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
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
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
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.

@@ -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>
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
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
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.

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
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
@@ -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
@@ -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
@@ -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
@@ -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 />

0 comments on commit a72f09b

Please sign in to comment.