@antv/util 3.3.0 → 3.3.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.
Files changed (186) hide show
  1. package/dist/color/arr2rgb.d.ts +12 -0
  2. package/dist/color/gradient.d.ts +6 -0
  3. package/dist/color/index.d.ts +4 -0
  4. package/dist/color/rgb2arr.d.ts +6 -0
  5. package/dist/color/tocssgradient.d.ts +1 -0
  6. package/dist/color/torgb.d.ts +6 -0
  7. package/dist/helper/index.d.ts +2 -0
  8. package/dist/helper/mod.d.ts +1 -0
  9. package/dist/helper/to-radian.d.ts +1 -0
  10. package/dist/index.d.ts +5 -0
  11. package/dist/lodash/augment.d.ts +2 -0
  12. package/dist/lodash/cache.d.ts +14 -0
  13. package/dist/lodash/clamp.d.ts +2 -0
  14. package/dist/lodash/clear-animation-frame.d.ts +1 -0
  15. package/dist/lodash/clone.d.ts +2 -0
  16. package/dist/lodash/contains.d.ts +2 -0
  17. package/dist/lodash/debounce.d.ts +2 -0
  18. package/dist/lodash/deep-mix.d.ts +2 -0
  19. package/dist/lodash/difference.d.ts +11 -0
  20. package/dist/lodash/each.d.ts +2 -0
  21. package/dist/lodash/ends-with.d.ts +3 -0
  22. package/dist/lodash/every.d.ts +7 -0
  23. package/dist/lodash/extend.d.ts +2 -0
  24. package/dist/lodash/filter.d.ts +2 -0
  25. package/dist/lodash/find-index.d.ts +2 -0
  26. package/dist/lodash/find.d.ts +3 -0
  27. package/dist/lodash/first-value.d.ts +2 -0
  28. package/dist/lodash/fixed-base.d.ts +2 -0
  29. package/dist/lodash/flatten-deep.d.ts +12 -0
  30. package/dist/lodash/flatten.d.ts +11 -0
  31. package/dist/lodash/for-in.d.ts +2 -0
  32. package/dist/lodash/get-range.d.ts +6 -0
  33. package/dist/lodash/get-type.d.ts +2 -0
  34. package/dist/lodash/get-wrap-behavior.d.ts +9 -0
  35. package/dist/lodash/get.d.ts +8 -0
  36. package/dist/lodash/group-by.d.ts +6 -0
  37. package/dist/lodash/group-to-map.d.ts +8 -0
  38. package/dist/lodash/group.d.ts +2 -0
  39. package/dist/lodash/has-key.d.ts +2 -0
  40. package/dist/lodash/has-value.d.ts +2 -0
  41. package/dist/lodash/has.d.ts +2 -0
  42. package/dist/lodash/head.d.ts +1 -0
  43. package/dist/lodash/identity.d.ts +2 -0
  44. package/dist/lodash/index-of.d.ts +2 -0
  45. package/dist/lodash/index.d.ts +108 -0
  46. package/dist/lodash/is-arguments.d.ts +2 -0
  47. package/dist/lodash/is-array-like.d.ts +2 -0
  48. package/dist/lodash/is-array.d.ts +2 -0
  49. package/dist/lodash/is-boolean.d.ts +2 -0
  50. package/dist/lodash/is-date.d.ts +2 -0
  51. package/dist/lodash/is-decimal.d.ts +2 -0
  52. package/dist/lodash/is-element.d.ts +6 -0
  53. package/dist/lodash/is-empty.d.ts +2 -0
  54. package/dist/lodash/is-equal-with.d.ts +24 -0
  55. package/dist/lodash/is-equal.d.ts +2 -0
  56. package/dist/lodash/is-error.d.ts +2 -0
  57. package/dist/lodash/is-even.d.ts +2 -0
  58. package/dist/lodash/is-finite.d.ts +1 -0
  59. package/dist/lodash/is-function.d.ts +5 -0
  60. package/dist/lodash/is-integer.d.ts +2 -0
  61. package/dist/lodash/is-match.d.ts +2 -0
  62. package/dist/lodash/is-negative.d.ts +2 -0
  63. package/dist/lodash/is-nil.d.ts +2 -0
  64. package/dist/lodash/is-null.d.ts +2 -0
  65. package/dist/lodash/is-number-equal.d.ts +1 -0
  66. package/dist/lodash/is-number.d.ts +2 -0
  67. package/dist/lodash/is-object-like.d.ts +2 -0
  68. package/dist/lodash/is-object.d.ts +2 -0
  69. package/dist/lodash/is-odd.d.ts +2 -0
  70. package/dist/lodash/is-plain-object.d.ts +2 -0
  71. package/dist/lodash/is-positive.d.ts +2 -0
  72. package/dist/lodash/is-prototype.d.ts +2 -0
  73. package/dist/lodash/is-reg-exp.d.ts +2 -0
  74. package/dist/lodash/is-segment-equal.d.ts +2 -0
  75. package/dist/lodash/is-string.d.ts +2 -0
  76. package/dist/lodash/is-type.d.ts +2 -0
  77. package/dist/lodash/is-undefined.d.ts +2 -0
  78. package/dist/lodash/keys.d.ts +2 -0
  79. package/dist/lodash/last.d.ts +1 -0
  80. package/dist/lodash/lower-case.d.ts +2 -0
  81. package/dist/lodash/lower-first.d.ts +2 -0
  82. package/dist/lodash/map-values.d.ts +6 -0
  83. package/dist/lodash/map.d.ts +2 -0
  84. package/dist/lodash/max-by.d.ts +16 -0
  85. package/dist/lodash/max.d.ts +19 -0
  86. package/dist/lodash/memoize.d.ts +11 -0
  87. package/dist/lodash/merge.d.ts +7 -0
  88. package/dist/lodash/min-by.d.ts +16 -0
  89. package/dist/lodash/min.d.ts +19 -0
  90. package/dist/lodash/mix.d.ts +1 -0
  91. package/dist/lodash/mod.d.ts +2 -0
  92. package/dist/lodash/noop.d.ts +2 -0
  93. package/dist/lodash/number2color.d.ts +2 -0
  94. package/dist/lodash/omit.d.ts +3 -0
  95. package/dist/lodash/parse-radius.d.ts +9 -0
  96. package/dist/lodash/pick.d.ts +16 -0
  97. package/dist/lodash/pull-at.d.ts +2 -0
  98. package/dist/lodash/pull.d.ts +2 -0
  99. package/dist/lodash/reduce.d.ts +3 -0
  100. package/dist/lodash/remove.d.ts +2 -0
  101. package/dist/lodash/request-animation-frame.d.ts +1 -0
  102. package/dist/lodash/set.d.ts +8 -0
  103. package/dist/lodash/size.d.ts +1 -0
  104. package/dist/lodash/some.d.ts +7 -0
  105. package/dist/lodash/sort-by.d.ts +7 -0
  106. package/dist/lodash/starts-with.d.ts +3 -0
  107. package/dist/lodash/substitute.d.ts +5 -0
  108. package/dist/lodash/throttle.d.ts +6 -0
  109. package/dist/lodash/to-array.d.ts +2 -0
  110. package/dist/lodash/to-degree.d.ts +2 -0
  111. package/dist/lodash/to-integer.d.ts +1 -0
  112. package/dist/lodash/to-radian.d.ts +2 -0
  113. package/dist/lodash/to-string.d.ts +2 -0
  114. package/dist/lodash/types/index.d.ts +3 -0
  115. package/dist/lodash/union.d.ts +2 -0
  116. package/dist/lodash/uniq.d.ts +1 -0
  117. package/dist/lodash/unique-id.d.ts +2 -0
  118. package/dist/lodash/upper-case.d.ts +2 -0
  119. package/dist/lodash/upper-first.d.ts +2 -0
  120. package/dist/lodash/values-of-key.d.ts +2 -0
  121. package/dist/lodash/values.d.ts +2 -0
  122. package/dist/lodash/wrap-behavior.d.ts +9 -0
  123. package/dist/math/index.d.ts +2 -0
  124. package/dist/math/is-point-in-polygon.d.ts +1 -0
  125. package/dist/math/is-polygons-intersect.d.ts +4 -0
  126. package/dist/matrix/index.d.ts +27 -0
  127. package/dist/path/convert/path-2-absolute.d.ts +2 -0
  128. package/dist/path/convert/path-2-curve.d.ts +2 -0
  129. package/dist/path/convert/path-2-string.d.ts +6 -0
  130. package/dist/path/index.d.ts +18 -0
  131. package/dist/path/parser/finalize-segment.d.ts +5 -0
  132. package/dist/path/parser/is-arc-command.d.ts +4 -0
  133. package/dist/path/parser/is-digit-start.d.ts +6 -0
  134. package/dist/path/parser/is-path-command.d.ts +4 -0
  135. package/dist/path/parser/is-space.d.ts +4 -0
  136. package/dist/path/parser/params-count.d.ts +13 -0
  137. package/dist/path/parser/params-parser.d.ts +10 -0
  138. package/dist/path/parser/parse-path-string.d.ts +6 -0
  139. package/dist/path/parser/path-parser.d.ts +16 -0
  140. package/dist/path/parser/scan-flag.d.ts +6 -0
  141. package/dist/path/parser/scan-param.d.ts +6 -0
  142. package/dist/path/parser/scan-segment.d.ts +6 -0
  143. package/dist/path/parser/skip-spaces.d.ts +7 -0
  144. package/dist/path/process/arc-2-cubic.d.ts +7 -0
  145. package/dist/path/process/clone-path.d.ts +2 -0
  146. package/dist/path/process/fix-arc.d.ts +2 -0
  147. package/dist/path/process/line-2-cubic.d.ts +1 -0
  148. package/dist/path/process/normalize-path.d.ts +8 -0
  149. package/dist/path/process/normalize-segment.d.ts +6 -0
  150. package/dist/path/process/quad-2-cubic.d.ts +1 -0
  151. package/dist/path/process/reverse-curve.d.ts +2 -0
  152. package/dist/path/process/round-path.d.ts +6 -0
  153. package/dist/path/process/segment-2-cubic.d.ts +2 -0
  154. package/dist/path/types.d.ts +127 -0
  155. package/dist/path/util/distance-square-root.d.ts +1 -0
  156. package/dist/path/util/equalize-segments.d.ts +2 -0
  157. package/dist/path/util/get-draw-direction.d.ts +2 -0
  158. package/dist/path/util/get-path-area.d.ts +8 -0
  159. package/dist/path/util/get-path-bbox-total-length.d.ts +5 -0
  160. package/dist/path/util/get-path-bbox.d.ts +5 -0
  161. package/dist/path/util/get-point-at-length.d.ts +5 -0
  162. package/dist/path/util/get-properties-at-length.d.ts +6 -0
  163. package/dist/path/util/get-properties-at-point.d.ts +7 -0
  164. package/dist/path/util/get-rotated-curve.d.ts +2 -0
  165. package/dist/path/util/get-total-length.d.ts +8 -0
  166. package/dist/path/util/is-absolute-array.d.ts +6 -0
  167. package/dist/path/util/is-curve-array.d.ts +9 -0
  168. package/dist/path/util/is-normalized-array.d.ts +7 -0
  169. package/dist/path/util/is-path-array.d.ts +5 -0
  170. package/dist/path/util/is-point-in-stroke.d.ts +5 -0
  171. package/dist/path/util/mid-point.d.ts +1 -0
  172. package/dist/path/util/path-length-factory.d.ts +7 -0
  173. package/dist/path/util/rotate-vector.d.ts +4 -0
  174. package/dist/path/util/segment-arc-factory.d.ts +8 -0
  175. package/dist/path/util/segment-cubic-factory.d.ts +6 -0
  176. package/dist/path/util/segment-line-factory.d.ts +6 -0
  177. package/dist/path/util/segment-quad-factory.d.ts +6 -0
  178. package/dist/util.min.js +1 -1
  179. package/esm/path/index.d.ts +1 -0
  180. package/esm/path/index.js +1 -0
  181. package/esm/path/index.js.map +1 -1
  182. package/lib/path/index.d.ts +1 -0
  183. package/lib/path/index.js +3 -1
  184. package/lib/path/index.js.map +1 -1
  185. package/package.json +2 -5
  186. package/src/path/index.ts +1 -0
@@ -0,0 +1,11 @@
1
+ declare const _default: (f: Function, resolver?: (...args: any[]) => string) => {
2
+ (...args: any[]): any;
3
+ cache: Map<any, any>;
4
+ };
5
+ /**
6
+ * _.memoize(calColor);
7
+ * _.memoize(calColor, (...args) => args[0]);
8
+ * @param f
9
+ * @param resolver
10
+ */
11
+ export default _default;
@@ -0,0 +1,7 @@
1
+ declare const _default: <T>(dataArray: T[]) => T[];
2
+ /**
3
+ * 将数组展开
4
+ * todo 和 flatten 是一个意思吧?@绝云
5
+ * @param dataArray
6
+ */
7
+ export default _default;
@@ -0,0 +1,16 @@
1
+ declare const _default: <T>(arr: T[], fn: string | ((v: T) => number)) => T;
2
+ /**
3
+ * @param {Array} arr The array to iterate over.
4
+ * @param {Function} [fn] The iteratee invoked per element.
5
+ * @return {*} Returns the minimum value.
6
+ * @example
7
+ *
8
+ * var objects = [{ 'n': 1 }, { 'n': 2 }];
9
+ *
10
+ * minBy(objects, function(o) { return o.n; });
11
+ * // => { 'n': 1 }
12
+ *
13
+ * minBy(objects, 'n');
14
+ * // => { 'n': 1 }
15
+ */
16
+ export default _default;
@@ -0,0 +1,19 @@
1
+ declare const _default: (arr: number[]) => number | undefined;
2
+ /**
3
+ * @param {Array} arr The array to iterate over.
4
+ * @return {*} Returns the minimum value.
5
+ * @example
6
+ *
7
+ * min([1, 2]);
8
+ * // => 1
9
+ *
10
+ * min([]);
11
+ * // => undefined
12
+ *
13
+ * const data = new Array(1250010).fill(1).map((d,idx) => idx);
14
+ *
15
+ * min(data);
16
+ * // => 1250010
17
+ * // Math.min(...data) will encounter "Maximum call stack size exceeded" error
18
+ */
19
+ export default _default;
@@ -0,0 +1 @@
1
+ export default function mix<Base, A, B, C>(dist: Base & A & B & C, src1?: A, src2?: B, src3?: C): Base & A & B & C;
@@ -0,0 +1,2 @@
1
+ declare const mod: (n: number, m: number) => number;
2
+ export default mod;
@@ -0,0 +1,2 @@
1
+ declare const _default: () => void;
2
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare function numberToColor(num: number): string;
2
+ export default numberToColor;
@@ -0,0 +1,3 @@
1
+ import { ObjectType } from './types';
2
+ declare const _default: <T>(obj: ObjectType<T>, keys: string[]) => ObjectType<T>;
3
+ export default _default;
@@ -0,0 +1,9 @@
1
+ export interface RadiusType {
2
+ r1: number;
3
+ r2: number;
4
+ r3: number;
5
+ r4: number;
6
+ }
7
+ declare function parseRadius(radius: number): RadiusType;
8
+ declare function parseRadius(radius: number[]): RadiusType;
9
+ export default parseRadius;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Creates an object composed of the picked `object` properties.
3
+ *
4
+ * @param {Object} object The source object.
5
+ * @param {...(string[])} [paths] The property paths to pick.
6
+ * @returns {Object} Returns the new object.
7
+ * @example
8
+ *
9
+ * var object = { 'a': 1, 'b': '2', 'c': 3 };
10
+ * pick(object, ['a', 'c']); // => { 'a': 1, 'c': 3 }
11
+ */
12
+ export interface ObjectType<T> {
13
+ [key: string]: T;
14
+ }
15
+ declare const _default: <T>(object: ObjectType<T>, keys: string[]) => ObjectType<T>;
16
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare const pullAt: <T>(arr: T[], indexes: number[]) => T[];
2
+ export default pullAt;
@@ -0,0 +1,2 @@
1
+ declare const pull: <T>(arr: T[], ...values: any[]) => T[];
2
+ export default pull;
@@ -0,0 +1,3 @@
1
+ import { ObjectType } from './types';
2
+ declare const reduce: <T, G>(arr: ObjectType<T> | G[], fn: (result: T, data: G, idx: string | number) => T, init: T) => T;
3
+ export default reduce;
@@ -0,0 +1,2 @@
1
+ declare const remove: <T>(arr: T[], predicate: (value: T, idx: number, arr?: T[]) => boolean) => T[];
2
+ export default remove;
@@ -0,0 +1 @@
1
+ export default function requestAnimationFrame(fn: FrameRequestCallback): any;
@@ -0,0 +1,8 @@
1
+ declare const _default: (obj: any, path: string | any[], value: any) => any;
2
+ /**
3
+ * https://github.com/developit/dlv/blob/master/index.js
4
+ * @param obj
5
+ * @param path
6
+ * @param value
7
+ */
8
+ export default _default;
@@ -0,0 +1 @@
1
+ export default function size(o: unknown): number;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * 只要有一个满足条件就返回 true
3
+ * @param arr
4
+ * @param func
5
+ */
6
+ declare const some: <T>(arr: T[], func: (v: T, idx?: number) => any) => boolean;
7
+ export default some;
@@ -0,0 +1,7 @@
1
+ export interface ObjectType<T> {
2
+ [key: string]: T;
3
+ }
4
+ declare function sortBy<T>(arr: ObjectType<T>[], key: Function): ObjectType<T>[];
5
+ declare function sortBy<T>(arr: ObjectType<T>[], key: string): ObjectType<T>[];
6
+ declare function sortBy<T>(arr: ObjectType<T>[], key: string[]): ObjectType<T>[];
7
+ export default sortBy;
@@ -0,0 +1,3 @@
1
+ declare function startsWith(arr: string, e: string): boolean;
2
+ declare function startsWith<T>(arr: T[], e: T): boolean;
3
+ export default startsWith;
@@ -0,0 +1,5 @@
1
+ export interface ObjectType<T> {
2
+ [key: string]: T;
3
+ }
4
+ declare function substitute<T>(str: string, o: ObjectType<T>): string;
5
+ export default substitute;
@@ -0,0 +1,6 @@
1
+ export interface OptionsType {
2
+ leading?: boolean;
3
+ trailing?: boolean;
4
+ }
5
+ declare const _default: (func: Function, wait: number, options: OptionsType) => Function;
6
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare const _default: (value: any) => any[];
2
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare const toDegree: (radian: number) => number;
2
+ export default toDegree;
@@ -0,0 +1 @@
1
+ export default parseInt;
@@ -0,0 +1,2 @@
1
+ declare const toRadian: (degree: number) => number;
2
+ export default toRadian;
@@ -0,0 +1,2 @@
1
+ declare const _default: (value: any) => string;
2
+ export default _default;
@@ -0,0 +1,3 @@
1
+ export interface ObjectType<T> {
2
+ [key: string]: T;
3
+ }
@@ -0,0 +1,2 @@
1
+ declare const union: (...sources: any[]) => any[];
2
+ export default union;
@@ -0,0 +1 @@
1
+ export default function uniq(arr: any[], cache?: Map<any, any>): any[];
@@ -0,0 +1,2 @@
1
+ declare const _default: (prefix?: string) => string;
2
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare const upperCase: (str: string) => string;
2
+ export default upperCase;
@@ -0,0 +1,2 @@
1
+ declare const upperFirst: (value: string) => string;
2
+ export default upperFirst;
@@ -0,0 +1,2 @@
1
+ declare const _default: (data: any[], name: string) => any[];
2
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare const values: (obj: any) => unknown[];
2
+ export default values;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * 封装事件,便于使用上下文this,和便于解除事件时使用
3
+ * @protected
4
+ * @param {Object} obj 对象
5
+ * @param {String} action 事件名称
6
+ * @return {Function} 返回事件处理函数
7
+ */
8
+ declare function wrapBehavior(obj: object, action: string): Function;
9
+ export default wrapBehavior;
@@ -0,0 +1,2 @@
1
+ export { isPointInPolygon } from './is-point-in-polygon';
2
+ export { isPolygonsIntersect } from './is-polygons-intersect';
@@ -0,0 +1 @@
1
+ export declare function isPointInPolygon(points: number[][], x: number, y: number): boolean;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * @see https://stackoverflow.com/questions/753140/how-do-i-determine-if-two-convex-polygons-intersect
3
+ */
4
+ export declare function isPolygonsIntersect(points1: number[][], points2: number[][]): boolean;
@@ -0,0 +1,27 @@
1
+ /**
2
+ * 根据 actions 来做 transform
3
+ * @param m
4
+ * @param actions
5
+ */
6
+ export declare function transform(m: number[], actions: any[][]): any[];
7
+ /**
8
+ * 向量 v1 到 向量 v2 夹角的方向
9
+ * @param {Array} v1 向量
10
+ * @param {Array} v2 向量
11
+ * @return {Boolean} >= 0 顺时针 < 0 逆时针
12
+ */
13
+ export declare function direction(v1: number[], v2: number[]): number;
14
+ /**
15
+ * 二维向量 v1 到 v2 的夹角
16
+ * @param v1
17
+ * @param v2
18
+ * @param direct
19
+ */
20
+ export declare function angleTo(v1: [number, number], v2: [number, number], direct?: boolean): number;
21
+ /**
22
+ * 计算二维向量的垂直向量
23
+ * @param out
24
+ * @param v
25
+ * @param flag
26
+ */
27
+ export declare function vertical(out: number[], v: number[], flag: boolean): number[];
@@ -0,0 +1,2 @@
1
+ import type { PathArray, AbsoluteArray } from '../types';
2
+ export declare function path2Absolute(pathInput: string | PathArray): AbsoluteArray;
@@ -0,0 +1,2 @@
1
+ import type { CurveArray, PathArray } from '../types';
2
+ export declare function path2Curve(pathInput: string | PathArray, needZCommandIndexes?: boolean): CurveArray | [CurveArray, number[]];
@@ -0,0 +1,6 @@
1
+ import type { PathArray } from '../types';
2
+ /**
3
+ * Returns a valid `d` attribute string value created
4
+ * by rounding values and concatenating the `pathArray` segments.
5
+ */
6
+ export declare function path2String(path: PathArray, round?: number | 'off'): string;
@@ -0,0 +1,18 @@
1
+ export { path2String } from './convert/path-2-string';
2
+ export { path2Curve } from './convert/path-2-curve';
3
+ export { path2Absolute } from './convert/path-2-absolute';
4
+ export { clonePath } from './process/clone-path';
5
+ export { normalizePath } from './process/normalize-path';
6
+ export { reverseCurve } from './process/reverse-curve';
7
+ export { arcToCubic } from './process/arc-2-cubic';
8
+ export { getPathBBox } from './util/get-path-bbox';
9
+ export { getTotalLength } from './util/get-total-length';
10
+ export { getPathBBoxTotalLength } from './util/get-path-bbox-total-length';
11
+ export { getRotatedCurve } from './util/get-rotated-curve';
12
+ export { getPathArea } from './util/get-path-area';
13
+ export { getDrawDirection } from './util/get-draw-direction';
14
+ export { getPointAtLength } from './util/get-point-at-length';
15
+ export { isPointInStroke } from './util/is-point-in-stroke';
16
+ export { distanceSquareRoot } from './util/distance-square-root';
17
+ export { equalizeSegments } from './util/equalize-segments';
18
+ export * from './types';
@@ -0,0 +1,5 @@
1
+ import type { PathParser } from './path-parser';
2
+ /**
3
+ * Breaks the parsing of a pathString once a segment is finalized.
4
+ */
5
+ export declare function finalizeSegment(path: PathParser): void;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Checks if the character is an A (arc-to) path command.
3
+ */
4
+ export declare function isArcCommand(code: number): boolean;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Checks if the character is or belongs to a number.
3
+ * [0-9]|+|-|.
4
+ */
5
+ export declare function isDigitStart(code: number): boolean;
6
+ export declare function isDigit(code: number): boolean;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Checks if the character is a path command.
3
+ */
4
+ export declare function isPathCommand(code: number): boolean;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Checks if the character is a space.
3
+ */
4
+ export declare function isSpace(ch: number): boolean;
@@ -0,0 +1,13 @@
1
+ export declare const paramsCount: {
2
+ a: number;
3
+ c: number;
4
+ h: number;
5
+ l: number;
6
+ m: number;
7
+ r: number;
8
+ q: number;
9
+ s: number;
10
+ t: number;
11
+ v: number;
12
+ z: number;
13
+ };
@@ -0,0 +1,10 @@
1
+ export declare const paramsParser: {
2
+ x1: number;
3
+ y1: number;
4
+ x2: number;
5
+ y2: number;
6
+ x: number;
7
+ y: number;
8
+ qx: any;
9
+ qy: any;
10
+ };
@@ -0,0 +1,6 @@
1
+ import type { PathArray } from '../types';
2
+ /**
3
+ * Parses a path string value and returns an array
4
+ * of segments we like to call `pathArray`.
5
+ */
6
+ export declare function parsePathString(pathInput: PathArray | string): PathArray | string;
@@ -0,0 +1,16 @@
1
+ import type { PathArray } from '../types';
2
+ /**
3
+ * The `PathParser` is used by the `parsePathString` static method
4
+ * to generate a `pathArray`.
5
+ */
6
+ export declare class PathParser {
7
+ pathValue: string;
8
+ segments: PathArray;
9
+ max: number;
10
+ index: number;
11
+ param: number;
12
+ segmentStart: number;
13
+ data: any;
14
+ err: string;
15
+ constructor(pathString: string);
16
+ }
@@ -0,0 +1,6 @@
1
+ import type { PathParser } from './path-parser';
2
+ /**
3
+ * Validates an A (arc-to) specific path command value.
4
+ * Usually a `large-arc-flag` or `sweep-flag`.
5
+ */
6
+ export declare function scanFlag(path: PathParser): void;
@@ -0,0 +1,6 @@
1
+ import type { PathParser } from './path-parser';
2
+ /**
3
+ * Validates every character of the path string,
4
+ * every path command, negative numbers or floating point numbers.
5
+ */
6
+ export declare function scanParam(path: PathParser): void;
@@ -0,0 +1,6 @@
1
+ import type { PathParser } from './path-parser';
2
+ /**
3
+ * Scans every character in the path string to determine
4
+ * where a segment starts and where it ends.
5
+ */
6
+ export declare function scanSegment(path: PathParser): void;
@@ -0,0 +1,7 @@
1
+ import type { PathParser } from './path-parser';
2
+ /**
3
+ * Points the parser to the next character in the
4
+ * path string every time it encounters any kind of
5
+ * space character.
6
+ */
7
+ export declare function skipSpaces(path: PathParser): void;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Converts A (arc-to) segments to C (cubic-bezier-to).
3
+ *
4
+ * For more information of where this math came from visit:
5
+ * http://www.w3.org/TR/SVG11/implnote.html#ArcImplementationNotes
6
+ */
7
+ export declare function arcToCubic(X1: number, Y1: number, RX: number, RY: number, angle: number, LAF: number, SF: number, X2: number, Y2: number, recursive: number[]): any[];
@@ -0,0 +1,2 @@
1
+ import type { PathArray, PathSegment } from '../types';
2
+ export declare function clonePath(path: PathArray | PathSegment): PathArray;
@@ -0,0 +1,2 @@
1
+ import type { PathArray } from '../types';
2
+ export declare function fixArc(pathArray: PathArray, allPathCommands: string[], i: number): void;
@@ -0,0 +1 @@
1
+ export declare function lineToCubic(x1: number, y1: number, x2: number, y2: number): number[];
@@ -0,0 +1,8 @@
1
+ import type { PathArray, NormalArray } from '../types';
2
+ /**
3
+ * @example
4
+ * const path = 'M0 0 H50';
5
+ * const normalizedPath = SVGPathCommander.normalizePath(path);
6
+ * // result => [['M', 0, 0], ['L', 50, 0]]
7
+ */
8
+ export declare function normalizePath(pathInput: string | PathArray): NormalArray;
@@ -0,0 +1,6 @@
1
+ import type { PathSegment, NormalSegment } from '../types';
2
+ /**
3
+ * Normalizes a single segment of a `PathArray` object.
4
+ * eg. H/V -> L, T -> Q
5
+ */
6
+ export declare function normalizeSegment(segment: PathSegment, params: any): NormalSegment;
@@ -0,0 +1 @@
1
+ export declare function quadToCubic(x1: number, y1: number, qx: number, qy: number, x2: number, y2: number): number[];
@@ -0,0 +1,2 @@
1
+ import type { CurveArray } from '../types';
2
+ export declare function reverseCurve(pathArray: CurveArray): CurveArray;
@@ -0,0 +1,6 @@
1
+ import type { PathArray } from '../types';
2
+ /**
3
+ * Rounds the values of a `PathArray` instance to
4
+ * a specified amount of decimals and returns it.
5
+ */
6
+ export declare function roundPath(path: PathArray, round: number | 'off'): PathArray;
@@ -0,0 +1,2 @@
1
+ import type { PathSegment, ParserParams, CSegment, MSegment } from '../types';
2
+ export declare function segmentToCubic(segment: PathSegment, params: ParserParams): CSegment | MSegment;
@@ -0,0 +1,127 @@
1
+ export declare type Point = {
2
+ x: number;
3
+ y: number;
4
+ };
5
+ export declare type MCommand = 'M';
6
+ export declare type mCommand = 'm';
7
+ export declare type LCommand = 'L';
8
+ export declare type lCommand = 'l';
9
+ export declare type VCommand = 'V';
10
+ export declare type vCommand = 'v';
11
+ export declare type HCommand = 'H';
12
+ export declare type hCommand = 'h';
13
+ export declare type ZCommand = 'Z';
14
+ export declare type zCommand = 'z';
15
+ export declare type CCommand = 'C';
16
+ export declare type cCommand = 'c';
17
+ export declare type SCommand = 'S';
18
+ export declare type sCommand = 's';
19
+ export declare type QCommand = 'Q';
20
+ export declare type qCommand = 'q';
21
+ export declare type TCommand = 'T';
22
+ export declare type tCommand = 't';
23
+ export declare type ACommand = 'A';
24
+ export declare type aCommand = 'a';
25
+ export declare type AbsoluteCommand = MCommand | LCommand | VCommand | HCommand | ZCommand | CCommand | SCommand | QCommand | TCommand | ACommand;
26
+ export declare type RelativeCommand = mCommand | lCommand | vCommand | hCommand | zCommand | cCommand | sCommand | qCommand | tCommand | aCommand;
27
+ export declare type PathCommand = AbsoluteCommand | RelativeCommand;
28
+ export declare type MSegment = [MCommand, number, number];
29
+ export declare type mSegment = [mCommand, number, number];
30
+ export declare type MoveSegment = MSegment | mSegment;
31
+ export declare type LSegment = [LCommand, number, number];
32
+ export declare type lSegment = [lCommand, number, number];
33
+ export declare type LineSegment = LSegment | lSegment;
34
+ export declare type VSegment = [VCommand, number];
35
+ export declare type vSegment = [vCommand, number];
36
+ export declare type VertLineSegment = vSegment | VSegment;
37
+ export declare type HSegment = [HCommand, number];
38
+ export declare type hSegment = [hCommand, number];
39
+ export declare type HorLineSegment = HSegment | hSegment;
40
+ export declare type ZSegment = [ZCommand];
41
+ export declare type zSegment = [zCommand];
42
+ export declare type CloseSegment = ZSegment | zSegment;
43
+ export declare type CSegment = [CCommand, number, number, number, number, number, number];
44
+ export declare type cSegment = [cCommand, number, number, number, number, number, number];
45
+ export declare type CubicSegment = CSegment | cSegment;
46
+ export declare type SSegment = [SCommand, number, number, number, number];
47
+ export declare type sSegment = [sCommand, number, number, number, number];
48
+ export declare type ShortCubicSegment = SSegment | sSegment;
49
+ export declare type QSegment = [QCommand, number, number, number, number];
50
+ export declare type qSegment = [qCommand, number, number, number, number];
51
+ export declare type QuadSegment = QSegment | qSegment;
52
+ export declare type TSegment = [TCommand, number, number];
53
+ export declare type tSegment = [tCommand, number, number];
54
+ export declare type ShortQuadSegment = TSegment | tSegment;
55
+ export declare type ASegment = [ACommand, number, number, number, number, number, number, number];
56
+ export declare type aSegment = [aCommand, number, number, number, number, number, number, number];
57
+ export declare type ArcSegment = ASegment | aSegment;
58
+ export declare type PathSegment = MoveSegment | LineSegment | VertLineSegment | HorLineSegment | CloseSegment | CubicSegment | ShortCubicSegment | QuadSegment | ShortQuadSegment | ArcSegment;
59
+ export interface SegmentProperties {
60
+ /** the segment */
61
+ segment: PathSegment;
62
+ /** the segment index */
63
+ index: number;
64
+ /** the segment length */
65
+ length: number;
66
+ /** the length including the segment length */
67
+ lengthAtSegment: number;
68
+ [key: string]: any;
69
+ }
70
+ export declare type ShortSegment = VertLineSegment | HorLineSegment | ShortCubicSegment | ShortQuadSegment | CloseSegment;
71
+ export declare type AbsoluteSegment = MSegment | LSegment | VSegment | HSegment | CSegment | SSegment | QSegment | TSegment | ASegment | ZSegment;
72
+ export declare type RelativeSegment = mSegment | lSegment | vSegment | hSegment | cSegment | sSegment | qSegment | tSegment | aSegment | zSegment;
73
+ export declare type NormalSegment = MSegment | LSegment | CSegment | QSegment | ASegment | ZSegment;
74
+ export declare type PathArray = [MSegment | mSegment, ...PathSegment[]];
75
+ export declare type AbsoluteArray = [MSegment, ...AbsoluteSegment[]];
76
+ export declare type RelativeArray = [MSegment, ...RelativeSegment[]];
77
+ export declare type NormalArray = [MSegment, ...NormalSegment[]];
78
+ export declare type CurveArray = [MSegment, ...CSegment[]];
79
+ export declare type PolygonArray = [MSegment, ...LSegment[], ZSegment];
80
+ export declare type PolylineArray = [MSegment, ...LSegment[]];
81
+ export interface ParserParams {
82
+ x1: number;
83
+ y1: number;
84
+ x2: number;
85
+ y2: number;
86
+ x: number;
87
+ y: number;
88
+ qx: number | null;
89
+ qy: number | null;
90
+ }
91
+ export interface PathBBox {
92
+ width: number;
93
+ height: number;
94
+ x: number;
95
+ y: number;
96
+ x2: number;
97
+ y2: number;
98
+ cx: number;
99
+ cy: number;
100
+ cz: number;
101
+ }
102
+ export interface PathBBoxTotalLength extends PathBBox {
103
+ length: number;
104
+ }
105
+ export interface PathLengthFactoryOptions {
106
+ bbox: boolean;
107
+ length: boolean;
108
+ sampleSize: number;
109
+ }
110
+ export interface SegmentLimits {
111
+ min: Point;
112
+ max: Point;
113
+ }
114
+ export interface PointProperties {
115
+ closest: {
116
+ x: number;
117
+ y: number;
118
+ };
119
+ distance: number;
120
+ segment?: SegmentProperties;
121
+ }
122
+ export interface LengthFactory {
123
+ length: number;
124
+ point: Point;
125
+ min: Point;
126
+ max: Point;
127
+ }
@@ -0,0 +1 @@
1
+ export declare function distanceSquareRoot(a: [number, number], b: [number, number]): number;