fabric
Version:
Object model for HTML5 canvas, and SVG-to-canvas parser. Backed by jsdom and node-canvas.
1 lines • 2.18 kB
Source Map (JSON)
{"version":3,"file":"regex.mjs","sources":["../../../../src/util/path/regex.ts"],"sourcesContent":["import { reNum } from '../../parser/constants';\n\nconst commaWsp = `\\\\s*,?\\\\s*`;\n\n/**\n * p for param\n * using \"bad naming\" here because it makes the regex much easier to read\n * p is a number that is preceded by an arbitary number of spaces, maybe 0,\n * a comma or not, and then possibly more spaces or not.\n */\nconst p = `${commaWsp}(${reNum})`;\n\n// const reMoveToCommand = `(M) ?(?:${p}${p} ?)+`;\n\n// const reLineCommand = `(L) ?(?:${p}${p} ?)+`;\n\n// const reHorizontalLineCommand = `(H) ?(?:${p} ?)+`;\n\n// const reVerticalLineCommand = `(V) ?(?:${p} ?)+`;\n\n// const reClosePathCommand = String.raw`(Z)\\s*`;\n\n// const reCubicCurveCommand = `(C) ?(?:${p}${p}${p}${p}${p}${p} ?)+`;\n\n// const reCubicCurveShortcutCommand = `(S) ?(?:${p}${p}${p}${p} ?)+`;\n\n// const reQuadraticCurveCommand = `(Q) ?(?:${p}${p}${p}${p} ?)+`;\n\n// const reQuadraticCurveShortcutCommand = `(T) ?(?:${p}${p} ?)+`;\n\nexport const reArcCommandPoints = `${p}${p}${p}${commaWsp}([01])${commaWsp}([01])${p}${p}`;\n// const reArcCommand = `(A) ?(?:${reArcCommandPoints} ?)+`;\n\n// export const rePathCommandGroups =\n// `(?:(?:${reMoveToCommand})` +\n// `|(?:${reLineCommand})` +\n// `|(?:${reHorizontalLineCommand})` +\n// `|(?:${reVerticalLineCommand})` +\n// `|(?:${reClosePathCommand})` +\n// `|(?:${reCubicCurveCommand})` +\n// `|(?:${reCubicCurveShortcutCommand})` +\n// `|(?:${reQuadraticCurveCommand})` +\n// `|(?:${reQuadraticCurveShortcutCommand})` +\n// `|(?:${reArcCommand}))`;\n\nexport const rePathCommand = '[mzlhvcsqta][^mzlhvcsqta]*';\n"],"names":["commaWsp","p","reNum","reArcCommandPoints","rePathCommand"],"mappings":";;AAEA,MAAMA,QAAQ,GAAG,CAAA,UAAA,CAAY;;AAE7B;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,CAAC,GAAG,CAAA,EAAGD,QAAQ,CAAA,CAAA,EAAIE,KAAK,CAAA,CAAA,CAAG;;AAEjC;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;MAEaC,kBAAkB,GAAG,CAAA,EAAGF,CAAC,GAAGA,CAAC,CAAA,EAAGA,CAAC,CAAA,EAAGD,QAAQ,CAAA,MAAA,EAASA,QAAQ,SAASC,CAAC,CAAA,EAAGA,CAAC,CAAA;AACxF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO,MAAMG,aAAa,GAAG;;;;"}