thednp / svg-path-commander

Typescript tools for advanced processing of SVG path data.
https://thednp.github.io/svg-path-commander/
MIT License
228 stars 19 forks source link

path commands (ex. MCommand, LCommand ..) are not exported #5

Closed jglee96 closed 2 years ago

jglee96 commented 2 years ago

Hello, I'm using this library with typescript. I trying to edit segments with path commands. I can edit width path command string (ex. 'M', 'L', 'C' ..). I think that using path commands is looks better. However path commands are not exoprted to index.d.ts, only absoluteCommand and relativeCommand are exported. Is it intended exporting?

thednp commented 2 years ago

I don't understand, can you elaborate and provide some test?

UPDATE: Yes, some path commands types aren't exported, they're there to build the others.

What is your suggestion please?

jglee96 commented 2 years ago

Sorry to not enough explanation and my language skill. I want to change my code like this:

const type = pathCommand[0];
switch (type) {
  case 'M' {
  ////
  }
  case 'L' {
  ////
  }
}

->

const type = pathCommand[0];
switch (type) {
  case MCommand {
  ////
  }
  case LCommand {
  ////
  }
}
thednp commented 2 years ago

I see, so you need to have all path commands (as well as all segment types) exported to global namespace?

jglee96 commented 2 years ago

Yes, That's What I mean.

thednp commented 2 years ago

Will have it done with the next update.

thednp commented 2 years ago

How is the TypeScript definition with SVGPathCommander? How would you rate it so far? (I'm new to TS myself)

jglee96 commented 2 years ago

Recently I've been lookig for SVG Path processing tool. I think SVGPathCommander is the best with TS. Others are hard to use with TS because of insufficient type declaration.

thednp commented 2 years ago

Oh thanks!

If you don't mind can you share what you're doing? I might have a better solution or I may get more insight on what TypeScript definitions might need.

jglee96 commented 2 years ago

I try to search each verb of SVG Path and edit points. Then we can be provided the services that make new shape from original shape. I'm sorry, but I can't tell you any more details because it's a team job.