svgdotjs / svg.js

The lightweight library for manipulating and animating SVG
https://svgjs.dev
Other
10.95k stars 1.07k forks source link

Docs Updates #1287

Open RieMars opened 1 year ago

RieMars commented 1 year ago

Could the docs be reviewed in the following areas?

Suggestion 1 - Import Note https://svgjs.dev/docs/3.0/getting-started/ Current:

'Note: All properties that were former available on the global SVG object need to be imported now, see example below:'

Revised:

'Note: Since X.X.X, All properties that were formerly available on the global SVG object need to be imported now, see example below:'

Where X.X.X is the version, as I don't know what version it started with if I'm using a legacy codebase that I'm updating. As many people will only hit this as a problem when they're getting bundler errors.

Suggestion 2 - Import Example https://svgjs.dev/docs/3.0/getting-started/

import { SVG, extend as SVGextend, Element as SVGElement } from '@svgdotjs/svg.js'

Could use an actual example, rather than generic pseudo-code. Not being familiar with the whole code base, I thought that Element was going to bring in all the elements. And is there any need to alias? If so maybe explain why? Also if you have some sample code using SVG.ClipPath() is there any way to import the element so that sample code works?

Suggestion 3 - ClipPath Defs https://svgjs.dev/docs/3.0/shape-elements/ Whilst there is a discussion of how the constructor methods (eg. draw.clipPath() )and raw constructor ( clip = new ClipPath() ) difference here, there's no explanation in the docs of how ClipPath needs to be added to Defs. Adding something about it would be helpful, whether that's at the top of that doc page or within the ClipPath section, not sure the best place, but it's undocumented at the moment.

Bug? When using the left nav to navigate between directly to an API (eg. SVG.Symbol and SVG.Circle) or when using the search, it doesn't go to the right heading (inline anchor) on a given page the first time. It seems to need to be clicked twice.

Benefits

Fuzzyma commented 1 year ago

Thanks for your suggestions. The docs are open source as well and can be found at https://github.com/svgdotjs/svgdotjs.github.io.

A PR is really welcome and will be merged asap :)

RieMars commented 1 year ago

Ok sure, just I quickly checked it out and is the version of the docs in that repository the same as live? https://svgjs.dev/docs/3.0/getting-started/ doesn't have the same text as: https://github.com/svgdotjs/svgdotjs.github.io/blob/source-3.1/content/3-getting-started/default.txt Couldn't see the line:

import { SVG, extend as SVGextend, Element as SVGElement } from '@svgdotjs/svg.js'

I didn't want to start making suggestions in code if I'm not working on the latest.

Fuzzyma commented 1 year ago

There is a version selector at the top of the docs page. The docs currently show 3.0 by default (which is also a bug). You can check against the 3.1 version by selection it in the dropdown: https://svgjs.dev/docs/3.1/