svg-path-commander 2.0.0 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.cjs +224 -0
- package/.lgtm.yml +9 -0
- package/.prettierrc.json +15 -0
- package/README.md +3 -2
- package/cypress/e2e/svg-path-commander.spec.ts +825 -0
- package/cypress/fixtures/shapeObjects.js +11 -0
- package/cypress/fixtures/shapes.js +104 -0
- package/cypress/fixtures/simpleShapes.js +75 -0
- package/cypress/plugins/esbuild-istanbul.ts +50 -0
- package/cypress/plugins/tsCompile.ts +34 -0
- package/cypress/support/commands.ts +37 -0
- package/cypress/support/e2e.ts +21 -0
- package/cypress/test.html +36 -0
- package/cypress.config.ts +29 -0
- package/dist/svg-path-commander.cjs +1 -1
- package/dist/svg-path-commander.cjs.map +1 -1
- package/dist/svg-path-commander.js +1 -1
- package/dist/svg-path-commander.js.map +1 -1
- package/dist/svg-path-commander.mjs +325 -276
- package/dist/svg-path-commander.mjs.map +1 -1
- package/dts.config.ts +15 -0
- package/package.json +8 -18
- package/tsconfig.json +28 -0
- package/vite.config.ts +38 -0
package/.eslintrc.cjs
ADDED
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
"env": {
|
|
3
|
+
"browser": true,
|
|
4
|
+
"es6": true
|
|
5
|
+
},
|
|
6
|
+
"extends": [
|
|
7
|
+
"plugin:@typescript-eslint/recommended",
|
|
8
|
+
"plugin:@typescript-eslint/recommended-requiring-type-checking",
|
|
9
|
+
],
|
|
10
|
+
"parser": "@typescript-eslint/parser",
|
|
11
|
+
"parserOptions": {
|
|
12
|
+
"project": "tsconfig.json",
|
|
13
|
+
"sourceType": "module"
|
|
14
|
+
},
|
|
15
|
+
"plugins": [
|
|
16
|
+
"eslint-plugin-jsdoc",
|
|
17
|
+
"eslint-plugin-prefer-arrow",
|
|
18
|
+
// "eslint-plugin-react",
|
|
19
|
+
"@typescript-eslint",
|
|
20
|
+
"prettier"
|
|
21
|
+
],
|
|
22
|
+
"root": true,
|
|
23
|
+
"rules": {
|
|
24
|
+
"prettier/prettier": "error",
|
|
25
|
+
"@typescript-eslint/adjacent-overload-signatures": "error",
|
|
26
|
+
"@typescript-eslint/array-type": [
|
|
27
|
+
"error",
|
|
28
|
+
{
|
|
29
|
+
"default": "array"
|
|
30
|
+
}
|
|
31
|
+
],
|
|
32
|
+
"@typescript-eslint/ban-types": [
|
|
33
|
+
"error",
|
|
34
|
+
{
|
|
35
|
+
"types": {
|
|
36
|
+
"Object": {
|
|
37
|
+
"message": "Avoid using the `Object` type. Did you mean `object`?"
|
|
38
|
+
},
|
|
39
|
+
"Function": {
|
|
40
|
+
"message": "Avoid using the `Function` type. Prefer a specific function type, like `() => void`."
|
|
41
|
+
},
|
|
42
|
+
"Boolean": {
|
|
43
|
+
"message": "Avoid using the `Boolean` type. Did you mean `boolean`?"
|
|
44
|
+
},
|
|
45
|
+
"Number": {
|
|
46
|
+
"message": "Avoid using the `Number` type. Did you mean `number`?"
|
|
47
|
+
},
|
|
48
|
+
"String": {
|
|
49
|
+
"message": "Avoid using the `String` type. Did you mean `string`?"
|
|
50
|
+
},
|
|
51
|
+
"Symbol": {
|
|
52
|
+
"message": "Avoid using the `Symbol` type. Did you mean `symbol`?"
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
],
|
|
57
|
+
"@typescript-eslint/consistent-type-assertions": "error",
|
|
58
|
+
"@typescript-eslint/dot-notation": "error",
|
|
59
|
+
"@typescript-eslint/explicit-function-return-type": "off",
|
|
60
|
+
"@typescript-eslint/explicit-module-boundary-types": "off",
|
|
61
|
+
"@typescript-eslint/indent": "off",
|
|
62
|
+
"@typescript-eslint/member-delimiter-style": [
|
|
63
|
+
"off",
|
|
64
|
+
{
|
|
65
|
+
"multiline": {
|
|
66
|
+
"delimiter": "none",
|
|
67
|
+
"requireLast": true
|
|
68
|
+
},
|
|
69
|
+
"singleline": {
|
|
70
|
+
"delimiter": "semi",
|
|
71
|
+
"requireLast": false
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
],
|
|
75
|
+
// "@typescript-eslint/naming-convention": "error",
|
|
76
|
+
"@typescript-eslint/no-empty-function": "error",
|
|
77
|
+
"@typescript-eslint/no-empty-interface": "error",
|
|
78
|
+
"@typescript-eslint/no-explicit-any": "off",
|
|
79
|
+
"@typescript-eslint/no-misused-new": "error",
|
|
80
|
+
"@typescript-eslint/no-namespace": "error",
|
|
81
|
+
"@typescript-eslint/no-parameter-properties": "off",
|
|
82
|
+
"@typescript-eslint/no-shadow": [
|
|
83
|
+
"error",
|
|
84
|
+
{
|
|
85
|
+
"hoist": "all"
|
|
86
|
+
}
|
|
87
|
+
],
|
|
88
|
+
"@typescript-eslint/no-unused-expressions": "error",
|
|
89
|
+
"@typescript-eslint/no-use-before-define": "off",
|
|
90
|
+
"@typescript-eslint/no-var-requires": "error",
|
|
91
|
+
"@typescript-eslint/prefer-for-of": "error",
|
|
92
|
+
"@typescript-eslint/prefer-function-type": "error",
|
|
93
|
+
"@typescript-eslint/prefer-namespace-keyword": "error",
|
|
94
|
+
"@typescript-eslint/quotes": "off",
|
|
95
|
+
"@typescript-eslint/semi": [
|
|
96
|
+
"off",
|
|
97
|
+
null
|
|
98
|
+
],
|
|
99
|
+
"@typescript-eslint/triple-slash-reference": [
|
|
100
|
+
"error",
|
|
101
|
+
{
|
|
102
|
+
"path": "always",
|
|
103
|
+
"types": "prefer-import",
|
|
104
|
+
"lib": "always"
|
|
105
|
+
}
|
|
106
|
+
],
|
|
107
|
+
"@typescript-eslint/type-annotation-spacing": "off",
|
|
108
|
+
"@typescript-eslint/typedef": "off",
|
|
109
|
+
"@typescript-eslint/unified-signatures": "error",
|
|
110
|
+
"arrow-parens": [
|
|
111
|
+
"off",
|
|
112
|
+
"always"
|
|
113
|
+
],
|
|
114
|
+
"brace-style": [
|
|
115
|
+
"off",
|
|
116
|
+
"off"
|
|
117
|
+
],
|
|
118
|
+
"comma-dangle": "off",
|
|
119
|
+
"complexity": "off",
|
|
120
|
+
"constructor-super": "error",
|
|
121
|
+
"dot-notation": "off",
|
|
122
|
+
"eol-last": "off",
|
|
123
|
+
"eqeqeq": [
|
|
124
|
+
"error",
|
|
125
|
+
"smart"
|
|
126
|
+
],
|
|
127
|
+
"guard-for-in": "error",
|
|
128
|
+
"id-denylist": [
|
|
129
|
+
"error",
|
|
130
|
+
"any",
|
|
131
|
+
"Number",
|
|
132
|
+
"number",
|
|
133
|
+
"String",
|
|
134
|
+
"string",
|
|
135
|
+
"Boolean",
|
|
136
|
+
"boolean",
|
|
137
|
+
"Undefined",
|
|
138
|
+
"undefined"
|
|
139
|
+
],
|
|
140
|
+
"id-match": "error",
|
|
141
|
+
"indent": "off",
|
|
142
|
+
"jsdoc/check-alignment": "error",
|
|
143
|
+
"jsdoc/check-indentation": "error",
|
|
144
|
+
"jsdoc/newline-after-description": "error",
|
|
145
|
+
"linebreak-style": "off",
|
|
146
|
+
"max-classes-per-file": [
|
|
147
|
+
"error",
|
|
148
|
+
1
|
|
149
|
+
],
|
|
150
|
+
"max-len": "off",
|
|
151
|
+
"new-parens": "off",
|
|
152
|
+
"newline-per-chained-call": "off",
|
|
153
|
+
"no-bitwise": "error",
|
|
154
|
+
"no-caller": "error",
|
|
155
|
+
"no-cond-assign": "error",
|
|
156
|
+
"no-console": "error",
|
|
157
|
+
"no-debugger": "error",
|
|
158
|
+
"no-empty": "error",
|
|
159
|
+
"no-empty-function": "off",
|
|
160
|
+
"no-eval": "error",
|
|
161
|
+
"no-extra-semi": "off",
|
|
162
|
+
"no-fallthrough": "off",
|
|
163
|
+
"no-invalid-this": "off",
|
|
164
|
+
"no-irregular-whitespace": "off",
|
|
165
|
+
"no-multiple-empty-lines": "off",
|
|
166
|
+
"no-new-wrappers": "error",
|
|
167
|
+
"no-shadow": "off",
|
|
168
|
+
"no-throw-literal": "error",
|
|
169
|
+
"no-trailing-spaces": "off",
|
|
170
|
+
"no-undef-init": "error",
|
|
171
|
+
"no-underscore-dangle": "off",
|
|
172
|
+
"no-unsafe-finally": "error",
|
|
173
|
+
"no-unused-expressions": "off",
|
|
174
|
+
"no-unused-labels": "error",
|
|
175
|
+
"no-use-before-define": "off",
|
|
176
|
+
"no-var": "error",
|
|
177
|
+
"object-shorthand": "error",
|
|
178
|
+
"one-var": [
|
|
179
|
+
"error",
|
|
180
|
+
"never"
|
|
181
|
+
],
|
|
182
|
+
"padded-blocks": [
|
|
183
|
+
"off",
|
|
184
|
+
{
|
|
185
|
+
"blocks": "never"
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
"allowSingleLineBlocks": true
|
|
189
|
+
}
|
|
190
|
+
],
|
|
191
|
+
"prefer-arrow/prefer-arrow-functions": "error",
|
|
192
|
+
"prefer-const": "error",
|
|
193
|
+
"quote-props": "off",
|
|
194
|
+
"quotes": "off",
|
|
195
|
+
"radix": "error",
|
|
196
|
+
// "react/jsx-curly-spacing": "off",
|
|
197
|
+
// "react/jsx-equals-spacing": "off",
|
|
198
|
+
// "react/jsx-tag-spacing": [
|
|
199
|
+
// "off",
|
|
200
|
+
// {
|
|
201
|
+
// "afterOpening": "allow",
|
|
202
|
+
// "closingSlash": "allow"
|
|
203
|
+
// }
|
|
204
|
+
// ],
|
|
205
|
+
// "react/jsx-wrap-multilines": "off",
|
|
206
|
+
"semi": "off",
|
|
207
|
+
"space-before-function-paren": "off",
|
|
208
|
+
"space-in-parens": [
|
|
209
|
+
"off",
|
|
210
|
+
"never"
|
|
211
|
+
],
|
|
212
|
+
"spaced-comment": [
|
|
213
|
+
"error",
|
|
214
|
+
"always",
|
|
215
|
+
{
|
|
216
|
+
"markers": [
|
|
217
|
+
"/"
|
|
218
|
+
]
|
|
219
|
+
}
|
|
220
|
+
],
|
|
221
|
+
"use-isnan": "error",
|
|
222
|
+
"valid-typeof": "off"
|
|
223
|
+
}
|
|
224
|
+
};
|
package/.lgtm.yml
ADDED
package/.prettierrc.json
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"arrowParens": "avoid",
|
|
3
|
+
"bracketSpacing": true,
|
|
4
|
+
"endOfLine": "lf",
|
|
5
|
+
"bracketSameLine": false,
|
|
6
|
+
"jsxSingleQuote": false,
|
|
7
|
+
"printWidth": 120,
|
|
8
|
+
"proseWrap": "preserve",
|
|
9
|
+
"quoteProps": "as-needed",
|
|
10
|
+
"semi": true,
|
|
11
|
+
"singleQuote": true,
|
|
12
|
+
"tabWidth": 2,
|
|
13
|
+
"trailingComma": "all",
|
|
14
|
+
"useTabs": false
|
|
15
|
+
}
|
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
[](https://www.typescriptlang.org/)
|
|
8
8
|
[](https://www.cypress.io/)
|
|
9
9
|
[](https://github.com/eslint)
|
|
10
|
-
[](https://vitejs.dev/)
|
|
11
11
|
[](https://prettier.io/)
|
|
12
12
|
|
|
13
13
|

|
|
@@ -17,6 +17,7 @@ A modern set of Typescript tools for manipulating the `d` (description) attribut
|
|
|
17
17
|
|
|
18
18
|
While you may find familiar tools inside, this library brings ***new additions***:
|
|
19
19
|
* the build in `getBBox`, `getPointAtLength` and `getTotalLength` are more reliable and much more accurate than the native methods, not to mention their world class performance ratings;
|
|
20
|
+
* thanks to the community contributions we've implemented useful tools like `getPropertiesAtLength`, `getSegmentOfPoint` or `isPointInStroke`;
|
|
20
21
|
* a tool that can *reverse path draw direction* without altering path commands, even with specific shorthand path commands;
|
|
21
22
|
* a unique tool that can *reverse path draw direction* for path strings with only 'C' path commands;
|
|
22
23
|
* a new and unique tool to *apply transform functions to path commands* via the modern *DOMMatrix* API.
|
|
@@ -46,7 +47,7 @@ npm install svg-path-commander
|
|
|
46
47
|
|
|
47
48
|
# CDN
|
|
48
49
|
```html
|
|
49
|
-
<script src="https://cdn.jsdelivr.net/npm/svg-path-commander/dist/svg-path-commander.
|
|
50
|
+
<script src="https://cdn.jsdelivr.net/npm/svg-path-commander/dist/svg-path-commander.js">
|
|
50
51
|
```
|
|
51
52
|
|
|
52
53
|
# Quick Guide
|