Add yet-another-react-lightbox package and update .gitignore to exclude node_modules
This commit is contained in:
145
frontend/node_modules/@svgdotjs/svg.js/src/utils/adopter.js
generated
vendored
145
frontend/node_modules/@svgdotjs/svg.js/src/utils/adopter.js
generated
vendored
@@ -1,145 +0,0 @@
|
||||
import { addMethodNames } from './methods.js'
|
||||
import { capitalize } from './utils.js'
|
||||
import { svg } from '../modules/core/namespaces.js'
|
||||
import { globals } from '../utils/window.js'
|
||||
import Base from '../types/Base.js'
|
||||
|
||||
const elements = {}
|
||||
export const root = '___SYMBOL___ROOT___'
|
||||
|
||||
// Method for element creation
|
||||
export function create(name, ns = svg) {
|
||||
// create element
|
||||
return globals.document.createElementNS(ns, name)
|
||||
}
|
||||
|
||||
export function makeInstance(element, isHTML = false) {
|
||||
if (element instanceof Base) return element
|
||||
|
||||
if (typeof element === 'object') {
|
||||
return adopter(element)
|
||||
}
|
||||
|
||||
if (element == null) {
|
||||
return new elements[root]()
|
||||
}
|
||||
|
||||
if (typeof element === 'string' && element.charAt(0) !== '<') {
|
||||
return adopter(globals.document.querySelector(element))
|
||||
}
|
||||
|
||||
// Make sure, that HTML elements are created with the correct namespace
|
||||
const wrapper = isHTML ? globals.document.createElement('div') : create('svg')
|
||||
wrapper.innerHTML = element
|
||||
|
||||
// We can use firstChild here because we know,
|
||||
// that the first char is < and thus an element
|
||||
element = adopter(wrapper.firstChild)
|
||||
|
||||
// make sure, that element doesn't have its wrapper attached
|
||||
wrapper.removeChild(wrapper.firstChild)
|
||||
return element
|
||||
}
|
||||
|
||||
export function nodeOrNew(name, node) {
|
||||
return node &&
|
||||
(node instanceof globals.window.Node ||
|
||||
(node.ownerDocument &&
|
||||
node instanceof node.ownerDocument.defaultView.Node))
|
||||
? node
|
||||
: create(name)
|
||||
}
|
||||
|
||||
// Adopt existing svg elements
|
||||
export function adopt(node) {
|
||||
// check for presence of node
|
||||
if (!node) return null
|
||||
|
||||
// make sure a node isn't already adopted
|
||||
if (node.instance instanceof Base) return node.instance
|
||||
|
||||
if (node.nodeName === '#document-fragment') {
|
||||
return new elements.Fragment(node)
|
||||
}
|
||||
|
||||
// initialize variables
|
||||
let className = capitalize(node.nodeName || 'Dom')
|
||||
|
||||
// Make sure that gradients are adopted correctly
|
||||
if (className === 'LinearGradient' || className === 'RadialGradient') {
|
||||
className = 'Gradient'
|
||||
|
||||
// Fallback to Dom if element is not known
|
||||
} else if (!elements[className]) {
|
||||
className = 'Dom'
|
||||
}
|
||||
|
||||
return new elements[className](node)
|
||||
}
|
||||
|
||||
let adopter = adopt
|
||||
|
||||
export function mockAdopt(mock = adopt) {
|
||||
adopter = mock
|
||||
}
|
||||
|
||||
export function register(element, name = element.name, asRoot = false) {
|
||||
elements[name] = element
|
||||
if (asRoot) elements[root] = element
|
||||
|
||||
addMethodNames(Object.getOwnPropertyNames(element.prototype))
|
||||
|
||||
return element
|
||||
}
|
||||
|
||||
export function getClass(name) {
|
||||
return elements[name]
|
||||
}
|
||||
|
||||
// Element id sequence
|
||||
let did = 1000
|
||||
|
||||
// Get next named element id
|
||||
export function eid(name) {
|
||||
return 'Svgjs' + capitalize(name) + did++
|
||||
}
|
||||
|
||||
// Deep new id assignment
|
||||
export function assignNewId(node) {
|
||||
// do the same for SVG child nodes as well
|
||||
for (let i = node.children.length - 1; i >= 0; i--) {
|
||||
assignNewId(node.children[i])
|
||||
}
|
||||
|
||||
if (node.id) {
|
||||
node.id = eid(node.nodeName)
|
||||
return node
|
||||
}
|
||||
|
||||
return node
|
||||
}
|
||||
|
||||
// Method for extending objects
|
||||
export function extend(modules, methods) {
|
||||
let key, i
|
||||
|
||||
modules = Array.isArray(modules) ? modules : [modules]
|
||||
|
||||
for (i = modules.length - 1; i >= 0; i--) {
|
||||
for (key in methods) {
|
||||
modules[i].prototype[key] = methods[key]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function wrapWithAttrCheck(fn) {
|
||||
return function (...args) {
|
||||
const o = args[args.length - 1]
|
||||
|
||||
if (o && o.constructor === Object && !(o instanceof Array)) {
|
||||
return fn.apply(this, args.slice(0, -1)).attr(o)
|
||||
} else {
|
||||
return fn.apply(this, args)
|
||||
}
|
||||
}
|
||||
}
|
||||
33
frontend/node_modules/@svgdotjs/svg.js/src/utils/methods.js
generated
vendored
33
frontend/node_modules/@svgdotjs/svg.js/src/utils/methods.js
generated
vendored
@@ -1,33 +0,0 @@
|
||||
const methods = {}
|
||||
const names = []
|
||||
|
||||
export function registerMethods(name, m) {
|
||||
if (Array.isArray(name)) {
|
||||
for (const _name of name) {
|
||||
registerMethods(_name, m)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
if (typeof name === 'object') {
|
||||
for (const _name in name) {
|
||||
registerMethods(_name, name[_name])
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
addMethodNames(Object.getOwnPropertyNames(m))
|
||||
methods[name] = Object.assign(methods[name] || {}, m)
|
||||
}
|
||||
|
||||
export function getMethodsFor(name) {
|
||||
return methods[name] || {}
|
||||
}
|
||||
|
||||
export function getMethodNames() {
|
||||
return [...new Set(names)]
|
||||
}
|
||||
|
||||
export function addMethodNames(_names) {
|
||||
names.push(..._names)
|
||||
}
|
||||
250
frontend/node_modules/@svgdotjs/svg.js/src/utils/pathParser.js
generated
vendored
250
frontend/node_modules/@svgdotjs/svg.js/src/utils/pathParser.js
generated
vendored
@@ -1,250 +0,0 @@
|
||||
import { isPathLetter } from '../modules/core/regex.js'
|
||||
import Point from '../types/Point.js'
|
||||
|
||||
const segmentParameters = {
|
||||
M: 2,
|
||||
L: 2,
|
||||
H: 1,
|
||||
V: 1,
|
||||
C: 6,
|
||||
S: 4,
|
||||
Q: 4,
|
||||
T: 2,
|
||||
A: 7,
|
||||
Z: 0
|
||||
}
|
||||
|
||||
const pathHandlers = {
|
||||
M: function (c, p, p0) {
|
||||
p.x = p0.x = c[0]
|
||||
p.y = p0.y = c[1]
|
||||
|
||||
return ['M', p.x, p.y]
|
||||
},
|
||||
L: function (c, p) {
|
||||
p.x = c[0]
|
||||
p.y = c[1]
|
||||
return ['L', c[0], c[1]]
|
||||
},
|
||||
H: function (c, p) {
|
||||
p.x = c[0]
|
||||
return ['H', c[0]]
|
||||
},
|
||||
V: function (c, p) {
|
||||
p.y = c[0]
|
||||
return ['V', c[0]]
|
||||
},
|
||||
C: function (c, p) {
|
||||
p.x = c[4]
|
||||
p.y = c[5]
|
||||
return ['C', c[0], c[1], c[2], c[3], c[4], c[5]]
|
||||
},
|
||||
S: function (c, p) {
|
||||
p.x = c[2]
|
||||
p.y = c[3]
|
||||
return ['S', c[0], c[1], c[2], c[3]]
|
||||
},
|
||||
Q: function (c, p) {
|
||||
p.x = c[2]
|
||||
p.y = c[3]
|
||||
return ['Q', c[0], c[1], c[2], c[3]]
|
||||
},
|
||||
T: function (c, p) {
|
||||
p.x = c[0]
|
||||
p.y = c[1]
|
||||
return ['T', c[0], c[1]]
|
||||
},
|
||||
Z: function (c, p, p0) {
|
||||
p.x = p0.x
|
||||
p.y = p0.y
|
||||
return ['Z']
|
||||
},
|
||||
A: function (c, p) {
|
||||
p.x = c[5]
|
||||
p.y = c[6]
|
||||
return ['A', c[0], c[1], c[2], c[3], c[4], c[5], c[6]]
|
||||
}
|
||||
}
|
||||
|
||||
const mlhvqtcsaz = 'mlhvqtcsaz'.split('')
|
||||
|
||||
for (let i = 0, il = mlhvqtcsaz.length; i < il; ++i) {
|
||||
pathHandlers[mlhvqtcsaz[i]] = (function (i) {
|
||||
return function (c, p, p0) {
|
||||
if (i === 'H') c[0] = c[0] + p.x
|
||||
else if (i === 'V') c[0] = c[0] + p.y
|
||||
else if (i === 'A') {
|
||||
c[5] = c[5] + p.x
|
||||
c[6] = c[6] + p.y
|
||||
} else {
|
||||
for (let j = 0, jl = c.length; j < jl; ++j) {
|
||||
c[j] = c[j] + (j % 2 ? p.y : p.x)
|
||||
}
|
||||
}
|
||||
|
||||
return pathHandlers[i](c, p, p0)
|
||||
}
|
||||
})(mlhvqtcsaz[i].toUpperCase())
|
||||
}
|
||||
|
||||
function makeAbsolut(parser) {
|
||||
const command = parser.segment[0]
|
||||
return pathHandlers[command](parser.segment.slice(1), parser.p, parser.p0)
|
||||
}
|
||||
|
||||
function segmentComplete(parser) {
|
||||
return (
|
||||
parser.segment.length &&
|
||||
parser.segment.length - 1 ===
|
||||
segmentParameters[parser.segment[0].toUpperCase()]
|
||||
)
|
||||
}
|
||||
|
||||
function startNewSegment(parser, token) {
|
||||
parser.inNumber && finalizeNumber(parser, false)
|
||||
const pathLetter = isPathLetter.test(token)
|
||||
|
||||
if (pathLetter) {
|
||||
parser.segment = [token]
|
||||
} else {
|
||||
const lastCommand = parser.lastCommand
|
||||
const small = lastCommand.toLowerCase()
|
||||
const isSmall = lastCommand === small
|
||||
parser.segment = [small === 'm' ? (isSmall ? 'l' : 'L') : lastCommand]
|
||||
}
|
||||
|
||||
parser.inSegment = true
|
||||
parser.lastCommand = parser.segment[0]
|
||||
|
||||
return pathLetter
|
||||
}
|
||||
|
||||
function finalizeNumber(parser, inNumber) {
|
||||
if (!parser.inNumber) throw new Error('Parser Error')
|
||||
parser.number && parser.segment.push(parseFloat(parser.number))
|
||||
parser.inNumber = inNumber
|
||||
parser.number = ''
|
||||
parser.pointSeen = false
|
||||
parser.hasExponent = false
|
||||
|
||||
if (segmentComplete(parser)) {
|
||||
finalizeSegment(parser)
|
||||
}
|
||||
}
|
||||
|
||||
function finalizeSegment(parser) {
|
||||
parser.inSegment = false
|
||||
if (parser.absolute) {
|
||||
parser.segment = makeAbsolut(parser)
|
||||
}
|
||||
parser.segments.push(parser.segment)
|
||||
}
|
||||
|
||||
function isArcFlag(parser) {
|
||||
if (!parser.segment.length) return false
|
||||
const isArc = parser.segment[0].toUpperCase() === 'A'
|
||||
const length = parser.segment.length
|
||||
|
||||
return isArc && (length === 4 || length === 5)
|
||||
}
|
||||
|
||||
function isExponential(parser) {
|
||||
return parser.lastToken.toUpperCase() === 'E'
|
||||
}
|
||||
|
||||
const pathDelimiters = new Set([' ', ',', '\t', '\n', '\r', '\f'])
|
||||
export function pathParser(d, toAbsolute = true) {
|
||||
let index = 0
|
||||
let token = ''
|
||||
const parser = {
|
||||
segment: [],
|
||||
inNumber: false,
|
||||
number: '',
|
||||
lastToken: '',
|
||||
inSegment: false,
|
||||
segments: [],
|
||||
pointSeen: false,
|
||||
hasExponent: false,
|
||||
absolute: toAbsolute,
|
||||
p0: new Point(),
|
||||
p: new Point()
|
||||
}
|
||||
|
||||
while (((parser.lastToken = token), (token = d.charAt(index++)))) {
|
||||
if (!parser.inSegment) {
|
||||
if (startNewSegment(parser, token)) {
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
if (token === '.') {
|
||||
if (parser.pointSeen || parser.hasExponent) {
|
||||
finalizeNumber(parser, false)
|
||||
--index
|
||||
continue
|
||||
}
|
||||
parser.inNumber = true
|
||||
parser.pointSeen = true
|
||||
parser.number += token
|
||||
continue
|
||||
}
|
||||
|
||||
if (!isNaN(parseInt(token))) {
|
||||
if (parser.number === '0' || isArcFlag(parser)) {
|
||||
parser.inNumber = true
|
||||
parser.number = token
|
||||
finalizeNumber(parser, true)
|
||||
continue
|
||||
}
|
||||
|
||||
parser.inNumber = true
|
||||
parser.number += token
|
||||
continue
|
||||
}
|
||||
|
||||
if (pathDelimiters.has(token)) {
|
||||
if (parser.inNumber) {
|
||||
finalizeNumber(parser, false)
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
||||
if (token === '-' || token === '+') {
|
||||
if (parser.inNumber && !isExponential(parser)) {
|
||||
finalizeNumber(parser, false)
|
||||
--index
|
||||
continue
|
||||
}
|
||||
parser.number += token
|
||||
parser.inNumber = true
|
||||
continue
|
||||
}
|
||||
|
||||
if (token.toUpperCase() === 'E') {
|
||||
parser.number += token
|
||||
parser.hasExponent = true
|
||||
continue
|
||||
}
|
||||
|
||||
if (isPathLetter.test(token)) {
|
||||
if (parser.inNumber) {
|
||||
finalizeNumber(parser, false)
|
||||
} else if (!segmentComplete(parser)) {
|
||||
throw new Error('parser Error')
|
||||
} else {
|
||||
finalizeSegment(parser)
|
||||
}
|
||||
--index
|
||||
}
|
||||
}
|
||||
|
||||
if (parser.inNumber) {
|
||||
finalizeNumber(parser, false)
|
||||
}
|
||||
|
||||
if (parser.inSegment && segmentComplete(parser)) {
|
||||
finalizeSegment(parser)
|
||||
}
|
||||
|
||||
return parser.segments
|
||||
}
|
||||
136
frontend/node_modules/@svgdotjs/svg.js/src/utils/utils.js
generated
vendored
136
frontend/node_modules/@svgdotjs/svg.js/src/utils/utils.js
generated
vendored
@@ -1,136 +0,0 @@
|
||||
// Map function
|
||||
export function map(array, block) {
|
||||
let i
|
||||
const il = array.length
|
||||
const result = []
|
||||
|
||||
for (i = 0; i < il; i++) {
|
||||
result.push(block(array[i]))
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
// Filter function
|
||||
export function filter(array, block) {
|
||||
let i
|
||||
const il = array.length
|
||||
const result = []
|
||||
|
||||
for (i = 0; i < il; i++) {
|
||||
if (block(array[i])) {
|
||||
result.push(array[i])
|
||||
}
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
// Degrees to radians
|
||||
export function radians(d) {
|
||||
return ((d % 360) * Math.PI) / 180
|
||||
}
|
||||
|
||||
// Radians to degrees
|
||||
export function degrees(r) {
|
||||
return ((r * 180) / Math.PI) % 360
|
||||
}
|
||||
|
||||
// Convert camel cased string to dash separated
|
||||
export function unCamelCase(s) {
|
||||
return s.replace(/([A-Z])/g, function (m, g) {
|
||||
return '-' + g.toLowerCase()
|
||||
})
|
||||
}
|
||||
|
||||
// Capitalize first letter of a string
|
||||
export function capitalize(s) {
|
||||
return s.charAt(0).toUpperCase() + s.slice(1)
|
||||
}
|
||||
|
||||
// Calculate proportional width and height values when necessary
|
||||
export function proportionalSize(element, width, height, box) {
|
||||
if (width == null || height == null) {
|
||||
box = box || element.bbox()
|
||||
|
||||
if (width == null) {
|
||||
width = (box.width / box.height) * height
|
||||
} else if (height == null) {
|
||||
height = (box.height / box.width) * width
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
width: width,
|
||||
height: height
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This function adds support for string origins.
|
||||
* It searches for an origin in o.origin o.ox and o.originX.
|
||||
* This way, origin: {x: 'center', y: 50} can be passed as well as ox: 'center', oy: 50
|
||||
**/
|
||||
export function getOrigin(o, element) {
|
||||
const origin = o.origin
|
||||
// First check if origin is in ox or originX
|
||||
let ox = o.ox != null ? o.ox : o.originX != null ? o.originX : 'center'
|
||||
let oy = o.oy != null ? o.oy : o.originY != null ? o.originY : 'center'
|
||||
|
||||
// Then check if origin was used and overwrite in that case
|
||||
if (origin != null) {
|
||||
;[ox, oy] = Array.isArray(origin)
|
||||
? origin
|
||||
: typeof origin === 'object'
|
||||
? [origin.x, origin.y]
|
||||
: [origin, origin]
|
||||
}
|
||||
|
||||
// Make sure to only call bbox when actually needed
|
||||
const condX = typeof ox === 'string'
|
||||
const condY = typeof oy === 'string'
|
||||
if (condX || condY) {
|
||||
const { height, width, x, y } = element.bbox()
|
||||
|
||||
// And only overwrite if string was passed for this specific axis
|
||||
if (condX) {
|
||||
ox = ox.includes('left')
|
||||
? x
|
||||
: ox.includes('right')
|
||||
? x + width
|
||||
: x + width / 2
|
||||
}
|
||||
|
||||
if (condY) {
|
||||
oy = oy.includes('top')
|
||||
? y
|
||||
: oy.includes('bottom')
|
||||
? y + height
|
||||
: y + height / 2
|
||||
}
|
||||
}
|
||||
|
||||
// Return the origin as it is if it wasn't a string
|
||||
return [ox, oy]
|
||||
}
|
||||
|
||||
const descriptiveElements = new Set(['desc', 'metadata', 'title'])
|
||||
export const isDescriptive = (element) =>
|
||||
descriptiveElements.has(element.nodeName)
|
||||
|
||||
export const writeDataToDom = (element, data, defaults = {}) => {
|
||||
const cloned = { ...data }
|
||||
|
||||
for (const key in cloned) {
|
||||
if (cloned[key].valueOf() === defaults[key]) {
|
||||
delete cloned[key]
|
||||
}
|
||||
}
|
||||
|
||||
if (Object.keys(cloned).length) {
|
||||
element.node.setAttribute('data-svgjs', JSON.stringify(cloned)) // see #428
|
||||
} else {
|
||||
element.node.removeAttribute('data-svgjs')
|
||||
element.node.removeAttribute('svgjs:data')
|
||||
}
|
||||
}
|
||||
32
frontend/node_modules/@svgdotjs/svg.js/src/utils/window.js
generated
vendored
32
frontend/node_modules/@svgdotjs/svg.js/src/utils/window.js
generated
vendored
@@ -1,32 +0,0 @@
|
||||
export const globals = {
|
||||
window: typeof window === 'undefined' ? null : window,
|
||||
document: typeof document === 'undefined' ? null : document
|
||||
}
|
||||
|
||||
export function registerWindow(win = null, doc = null) {
|
||||
globals.window = win
|
||||
globals.document = doc
|
||||
}
|
||||
|
||||
const save = {}
|
||||
|
||||
export function saveWindow() {
|
||||
save.window = globals.window
|
||||
save.document = globals.document
|
||||
}
|
||||
|
||||
export function restoreWindow() {
|
||||
globals.window = save.window
|
||||
globals.document = save.document
|
||||
}
|
||||
|
||||
export function withWindow(win, fn) {
|
||||
saveWindow()
|
||||
registerWindow(win, win.document)
|
||||
fn(win, win.document)
|
||||
restoreWindow()
|
||||
}
|
||||
|
||||
export function getWindow() {
|
||||
return globals.window
|
||||
}
|
||||
Reference in New Issue
Block a user