From f180c4e559019c85c6543e0819e890cec295d588 Mon Sep 17 00:00:00 2001 From: Klemek Date: Tue, 16 Jul 2019 10:35:33 +0200 Subject: [PATCH] updated documentation --- README.md | 40 ++++++++++++++++++++++++++++++++++++++++ preview/links.svg | 10 +++++----- src/placing.js | 4 ++-- 3 files changed, 47 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index e1c67c1..b7b6fb6 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,8 @@ * [More info](#more-info) * [Icon names](#icon-names) * [Link types](#link-types) + * [Thrown errors](#thrown-errors) + * [Change icons](#change-icons) * [Examples](#examples) ## Install @@ -268,6 +270,44 @@ Here are the available styles : * __`underlined`__ * ~~`striked`~~ +### Thrown errors + +Errors can be thrown in these 2 cases : + +* Nodes could not be placed based on the constraints: + * `Failed to place nodes` +* A node or a link have an invalid property + * `Node 'name' is invalid at key ...` + +### Change icons + +If you want to change the icons you can edit/build your own `resources.json` as following: + +```javascript +{ + "name": "squares", + "height": 60, //height of all icons + "index": [ // which categories are there and in which order it should be searched + "solid", + "hollow" + ], + "icons": { + "solid": { + "square":{ + "path":"M10 10v-40h40v40z", + "width":60 + } + }, + "hollow": { + "square":{ + "path":"M10 10v-40h40v40h-40m10 10v-20h20v20h-20z", + "width":60 + } + } + } +} +``` + ## Examples *[back to top](#top)* diff --git a/preview/links.svg b/preview/links.svg index c23a6b4..0dff352 100644 --- a/preview/links.svg +++ b/preview/links.svg @@ -1,5 +1,5 @@ + fill="black"> @@ -26,25 +26,25 @@ - + dashed - + dashed-line - + dashed-double - + dashed-split-double diff --git a/src/placing.js b/src/placing.js index 64b7bcc..c2b761d 100644 --- a/src/placing.js +++ b/src/placing.js @@ -323,13 +323,13 @@ module.exports = (options) => { Object.keys(nodes).forEach(key => { const res = utils.isValid(nodes[key], NODE_DEF); if (res) - throw `node '${key}' is invalid at key ${res}`; + throw `Node '${key}' is invalid at key ${res}`; }); links.forEach((link, i) => { const res = utils.isValid(link, LINK_DEF); if (res) - throw `link ${i} (${link.from}->${link.to}) is invalid at key ${res}`; + throw `Link ${i} (${link.from}->${link.to}) is invalid at key ${res}`; }); Object.values(nodes).forEach(node => {