feat: updates documentation

This commit is contained in:
Mark Mankarious
2023-10-08 14:19:08 +01:00
parent 4ad8b22482
commit 1de5c9d8b5
4 changed files with 39 additions and 37 deletions

View File

@@ -2,14 +2,14 @@
The `initialScene` object contains the following properties:
| Name | Type |
| --- | --- |
| `icons` | [`Icon[]`](#icon) |
| `nodes` | [`Node[]`](#node) |
| `connectors` | [`Connector[]`](#connector) |
| `rectangles` | [`Rectangle[]`](#rectangle) |
| `textBoxes` | [`TextBox[]`](#textbox) |
| `zoom` | `number` |
| Name | Type | Default |
| --- | --- | --- |
| `icons` | [`Icon[]`](#icon) | `[]` |
| `nodes` | [`Node[]`](#node) | `[]` |
| `connectors` | [`Connector[]`](#connector) | `[]` |
| `rectangles` | [`Rectangle[]`](#rectangle) | `[]` |
| `textBoxes` | [`TextBox[]`](#textbox) | `[]` |
| `zoom` | `number` | `1` |
## `Icon`
@@ -38,7 +38,7 @@ The `initialScene` object contains the following properties:
tile: {
x: number;
y: number;
};
}
}
```
@@ -50,7 +50,8 @@ The `initialScene` object contains the following properties:
color?: string;
width?: number;
style?: 'SOLID' | 'DOTTED' | 'DASHED';
anchors: ConnectorAnchor[]
label?: string;
anchors: ConnectorAnchor[];
}
```
@@ -61,22 +62,24 @@ The `initialScene` object contains the following properties:
```js
id?: string;
{
node: string
} |
{
tile: {
x: number;
y: number;
}
} |
{
anchor: string;
}
ref:
| {
tile: {
x: number;
y: number;
}
}
| {
node: string;
}
|
{
anchor: string;
}
```
**Notes on anchors**
- Connector anchors can reference either one of a `tile`, a `node` or another `connectorAnchor`. If the reference is to a `node` or another `anchor`, the anchor is dynamic and will be tied to the reference's position.
- Connector anchors can reference either a `tile`, a `node` or another `anchor`. If the reference is to a `node` or another `anchor`, the anchor is dynamic and will be tied to the referenced element's position.
- When using either a `node` or an `anchor` as a reference, you must specify the `id` of the of the item being referred to.
## `Rectangle`

View File

@@ -1,8 +1,8 @@
# Installation
**Isoflow** is published to npm as a React component you can directly embed in your projects.
Isoflow is published as a **React component** you can embed into your project.
Install using `npm`:
To install using `npm`:
```bash
npm install isoflow
@@ -16,15 +16,16 @@ yarn add isoflow
### Demo
Try it out on [CodeSandbox](https://codesandbox.io/p/sandbox/github/markmanx/isoflow).
The latest version of Isoflow is always synced here on [CodeSandbox](https://codesandbox.io/p/sandbox/github/markmanx/isoflow).
## Running Isoflow in development mode
To run Isoflow on a local development server with hot-reloading enabled:
### Running Isoflow in development mode
To run Isoflow on your local machine:
1. `npm i`
2. `npm run start`.
1. Clone the [Github repository](https://github.com/markmanx/isoflow).
2. `npm i`
3. `npm run start`.
## Developer documentation
### Developer documentation
For detailed API documentation, examples and more, see the online [developer documentation](https://v2.isoflow.io/docs). You can also build and run the docs locally:
- `npm run docs:build`

View File

@@ -1,6 +1,6 @@
# Isopacks
**Isopacks** are add-on modules for Isoflow that contain icons and other assets. You can easily extend Isopacks or build your own from scratch.
**Isopacks** are add-on modules for Isoflow that contain icons and other assets. You can easily build your own from scratch or create and load your own.
### Cloud & Network Isopacks
@@ -45,7 +45,7 @@ const icons = flattenCollections([
const App = () => {
return (
<Isoflow initialScene={{ icons }} width="100%" height="100%" />
<Isoflow initialScene={{ icons }} />
);
}

View File

@@ -14,9 +14,7 @@ import Isoflow from 'isoflow';
const App = () => {
return (
<div style={{ width: '100%', height: '100%' }}>
<Isoflow />
</div>
<Isoflow />
);
}
@@ -31,7 +29,7 @@ Isoflow takes _100%_ of `width` and `height` of the containing block so make sur
### Integration with NextJS
Isoflow cannot be server-side rendered and has to be imported slightly differently when using SSR frameworks like NextJS.
Isoflow cannot be server-side rendered and has to be imported using `next/dyanmic`:
```jsx showLineNumbers filename="IsoflowDynamic.jsx"
import dynamic from 'next/dynamic';