summaryrefslogtreecommitdiffstats
path: root/src/svg.js
blob: 1d72d64660ae4d3ba929ab86aeccb9e63ddc992a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
// import {extend} from './tools.js'
// import * as Element from './Element.js'
// import Defs from './Defs.js'
//
// extend(Defs, [EventTarget, Element, Parent])

import {makeInstance} from './adopter.js'
import * as Classes from './classes.js'
import * as adopter from './adopter.js'
import * as tools from './tools.js'
import * as containers from './containers.js'
import * as elements from './elements.js'
import './attr.js'
import './arrange.js'
import './data.js'
import find from './selector.js'
import './css.js'
import './transform.js'
import './memory.js'
import './sugar.js'
import {getMethodsFor, getConstructor} from './methods.js'
import {registerMorphableType, makeMorphable} from './Morphable.js'
const extend = tools.extend

import './EventTarget.js'
import './Element.js'
import './Parent.js'

extend([
  Classes.Doc,
  Classes.Symbol,
  Classes.Image,
  Classes.Pattern,
  Classes.Marker
], getMethodsFor('viewbox'))

extend([
  Classes.Line,
  Classes.Polyline,
  Classes.Polygon,
  Classes.Path
], getMethodsFor('marker'))

extend(Classes.Text, getMethodsFor('Text'))
extend(Classes.Path, getMethodsFor('Path'))

extend(Classes.Defs, getMethodsFor('Defs'))

extend([
  Classes.Text,
  Classes.Tspan
], getMethodsFor('Tspan'))

extend([
  Classes.Rect,
  Classes.Ellipse,
  Classes.Circle,
  Classes.Gradient
], getMethodsFor('radius'))

extend(Classes.EventTarget, getMethodsFor('EventTarget'))
extend(Classes.Element, getMethodsFor('Element'))
extend(Classes.Element, getMethodsFor('Parent'))
extend(Classes.Element, getConstructor('Memory'))
extend(Classes.Container, getMethodsFor('Container'))

registerMorphableType([
  Classes.SVGNumber,
  Classes.Color,
  Classes.Box,
  Classes.Matrix,
  Classes.SVGArray,
  Classes.PointArray,
  Classes.PathArray
])

makeMorphable()

// The main wrapping element
export default function SVG (element) {
  return makeInstance(element)
}

Object.assign(SVG, Classes)
Object.assign(SVG, tools)
Object.assign(SVG, adopter)

import * as utils from './utils.js'
SVG.utils = utils

import * as regex from './regex.js'
SVG.regex = regex


// satisfy tests, fix later
import * as ns from './namespaces.js'
SVG.get = SVG
SVG.find = find
Object.assign(SVG, ns)
// import Base from './Base.js'
// SVG.Element = SVG.Parent = SVG.Shape = SVG.Container = Base
import {easing} from './Controller.js'
SVG.easing = easing
import * as events from './event.js'
Object.assign(SVG, events)
import {TransformBag, ObjectBag, NonMorphable} from './Morphable.js'
SVG.TransformBag = TransformBag
SVG.ObjectBag = ObjectBag
SVG.NonMorphable = NonMorphable
import parser from './parser.js'
SVG.parser = parser
import * as defaults from './defaults.js'
SVG.defaults = defaults