diff options
Diffstat (limited to 'src/modules/core')
-rw-r--r-- | src/modules/core/attr.js | 2 | ||||
-rw-r--r-- | src/modules/core/defaults.js | 4 | ||||
-rw-r--r-- | src/modules/core/event.js | 2 | ||||
-rw-r--r-- | src/modules/core/namespaces.js | 8 | ||||
-rw-r--r-- | src/modules/core/parser.js | 6 | ||||
-rw-r--r-- | src/modules/core/pointed.js | 6 | ||||
-rw-r--r-- | src/modules/core/poly.js | 2 | ||||
-rw-r--r-- | src/modules/core/regex.js | 38 |
8 files changed, 34 insertions, 34 deletions
diff --git a/src/modules/core/attr.js b/src/modules/core/attr.js index 548a6fb..52c10a0 100644 --- a/src/modules/core/attr.js +++ b/src/modules/core/attr.js @@ -17,7 +17,7 @@ export default function attr (attr, val, ns) { attr = {} val = this.node.attributes - for (let node of val) { + for (const node of val) { attr[node.nodeName] = isNumber.test(node.nodeValue) ? parseFloat(node.nodeValue) : node.nodeValue diff --git a/src/modules/core/defaults.js b/src/modules/core/defaults.js index 499d1b4..e8e65b6 100644 --- a/src/modules/core/defaults.js +++ b/src/modules/core/defaults.js @@ -2,14 +2,14 @@ export function noop () {} // Default animation values -export let timeline = { +export const timeline = { duration: 400, ease: '>', delay: 0 } // Default attribute values -export let attrs = { +export const attrs = { // fill and stroke 'fill-opacity': 1, diff --git a/src/modules/core/event.js b/src/modules/core/event.js index d9b4f46..2cf9b1e 100644 --- a/src/modules/core/event.js +++ b/src/modules/core/event.js @@ -3,7 +3,7 @@ import { makeInstance } from '../../utils/adopter.js' import { globals } from '../../utils/window.js' let listenerId = 0 -let windowEvents = {} +const windowEvents = {} function getEvents (instance) { let n = instance.getEventHolder() diff --git a/src/modules/core/namespaces.js b/src/modules/core/namespaces.js index 3791298..086e0e9 100644 --- a/src/modules/core/namespaces.js +++ b/src/modules/core/namespaces.js @@ -1,5 +1,5 @@ // Default namespaces -export let ns = 'http://www.w3.org/2000/svg' -export let xmlns = 'http://www.w3.org/2000/xmlns/' -export let xlink = 'http://www.w3.org/1999/xlink' -export let svgjs = 'http://svgjs.com/svgjs' +export const ns = 'http://www.w3.org/2000/svg' +export const xmlns = 'http://www.w3.org/2000/xmlns/' +export const xlink = 'http://www.w3.org/1999/xlink' +export const svgjs = 'http://svgjs.com/svgjs' diff --git a/src/modules/core/parser.js b/src/modules/core/parser.js index 7028044..4f92657 100644 --- a/src/modules/core/parser.js +++ b/src/modules/core/parser.js @@ -4,7 +4,7 @@ import { makeInstance } from '../../utils/adopter.js' export default function parser () { // Reuse cached element if possible if (!parser.nodes) { - let svg = makeInstance().size(2, 0) + const svg = makeInstance().size(2, 0) svg.node.style.cssText = [ 'opacity: 0', 'position: absolute', @@ -16,13 +16,13 @@ export default function parser () { svg.attr('focusable', 'false') svg.attr('aria-hidden', 'true') - let path = svg.path().node + const path = svg.path().node parser.nodes = { svg, path } } if (!parser.nodes.svg.node.parentNode) { - let b = globals.document.body || globals.document.documentElement + const b = globals.document.body || globals.document.documentElement parser.nodes.svg.addTo(b) } diff --git a/src/modules/core/pointed.js b/src/modules/core/pointed.js index 95e6819..540e5f8 100644 --- a/src/modules/core/pointed.js +++ b/src/modules/core/pointed.js @@ -1,6 +1,6 @@ import PointArray from '../../types/PointArray.js' -export let MorphArray = PointArray +export const MorphArray = PointArray // Move by left top corner over x-axis export function x (x) { @@ -14,12 +14,12 @@ export function y (y) { // Set width of element export function width (width) { - let b = this.bbox() + const b = this.bbox() return width == null ? b.width : this.size(width, b.height) } // Set height of element export function height (height) { - let b = this.bbox() + const b = this.bbox() return height == null ? b.height : this.size(b.width, height) } diff --git a/src/modules/core/poly.js b/src/modules/core/poly.js index f23b70b..340bdd1 100644 --- a/src/modules/core/poly.js +++ b/src/modules/core/poly.js @@ -26,6 +26,6 @@ export function move (x, y) { // Set element size to given width and height export function size (width, height) { - let p = proportionalSize(this, width, height) + const p = proportionalSize(this, width, height) return this.attr('points', this.array().size(p.width, p.height)) } diff --git a/src/modules/core/regex.js b/src/modules/core/regex.js index 1056554..2b7b89e 100644 --- a/src/modules/core/regex.js +++ b/src/modules/core/regex.js @@ -1,58 +1,58 @@ // Parse unit value -export let numberAndUnit = /^([+-]?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?)([a-z%]*)$/i +export const numberAndUnit = /^([+-]?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?)([a-z%]*)$/i // Parse hex value -export let hex = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i +export const hex = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i // Parse rgb value -export let rgb = /rgb\((\d+),(\d+),(\d+)\)/ +export const rgb = /rgb\((\d+),(\d+),(\d+)\)/ // Parse reference id -export let reference = /(#[a-z0-9\-_]+)/i +export const reference = /(#[a-z0-9\-_]+)/i // splits a transformation chain -export let transforms = /\)\s*,?\s*/ +export const transforms = /\)\s*,?\s*/ // Whitespace -export let whitespace = /\s/g +export const whitespace = /\s/g // Test hex value -export let isHex = /^#[a-f0-9]{3,6}$/i +export const isHex = /^#[a-f0-9]{3,6}$/i // Test rgb value -export let isRgb = /^rgb\(/ +export const isRgb = /^rgb\(/ // Test css declaration -export let isCss = /[^:]+:[^;]+;?/ +export const isCss = /[^:]+:[^;]+;?/ // Test for blank string -export let isBlank = /^(\s+)?$/ +export const isBlank = /^(\s+)?$/ // Test for numeric string -export let isNumber = /^[+-]?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i +export const isNumber = /^[+-]?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i // Test for percent value -export let isPercent = /^-?[\d.]+%$/ +export const isPercent = /^-?[\d.]+%$/ // Test for image url -export let isImage = /\.(jpg|jpeg|png|gif|svg)(\?[^=]+.*)?/i +export const isImage = /\.(jpg|jpeg|png|gif|svg)(\?[^=]+.*)?/i // split at whitespace and comma -export let delimiter = /[\s,]+/ +export const delimiter = /[\s,]+/ // The following regex are used to parse the d attribute of a path // Matches all hyphens which are not after an exponent -export let hyphen = /([^e])-/gi +export const hyphen = /([^e])-/gi // Replaces and tests for all path letters -export let pathLetters = /[MLHVCSQTAZ]/gi +export const pathLetters = /[MLHVCSQTAZ]/gi // yes we need this one, too -export let isPathLetter = /[MLHVCSQTAZ]/i +export const isPathLetter = /[MLHVCSQTAZ]/i // matches 0.154.23.45 -export let numbersWithDots = /((\d?\.\d+(?:e[+-]?\d+)?)((?:\.\d+(?:e[+-]?\d+)?)+))+/gi +export const numbersWithDots = /((\d?\.\d+(?:e[+-]?\d+)?)((?:\.\d+(?:e[+-]?\d+)?)+))+/gi // matches . -export let dots = /\./g +export const dots = /\./g |