material 0.7.2 → 0.7.4
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.
- package/LICENSE +9 -18
- package/index.js +25 -48
- package/package.json +2 -10
- package/src/checkbox.js +48 -52
- package/src/element/insert.js +4 -4
- package/src/list.js +1 -3
- package/src/module/build.js +1 -3
- package/src/module/dom.js +1 -0
- package/src/module/request.js +33 -0
- package/src/navigation.js +7 -1
- package/src/skin/material/button/action.sass +6 -6
- package/src/skin/material/button/button.sass +6 -6
- package/src/skin/material/button/file.sass +1 -1
- package/src/skin/material/button/floating.sass +5 -5
- package/src/skin/material/button/raised.sass +5 -5
- package/src/skin/material/button/stroked.sass +5 -5
- package/src/skin/material/component/navigation.sass +6 -2
- package/src/skin/material/control/checkbox.sass +21 -21
- package/src/skin/material/module/ripple.sass +1 -1
- package/src/snackbar.js +4 -2
- package/src/styles/M3/abstracts/variables.sass +44 -0
- package/src/styles/M3/components/button.sass +26 -0
- package/src/styles/M3/modules/ripple.sass +9 -0
- package/src/styles/M3/themes/classic.sass +2 -0
- package/src/tabs.js +2 -3
- package/dist/demo-bundle.js +0 -2281
- package/dist/demo-bundle.js.map +0 -7
- package/dist/demo.css +0 -93
- package/dist/demo.css.map +0 -7
- package/dist/demo.html +0 -24
- package/dist/demo.js +0 -159
- package/dist/icon/accessibility.svg +0 -5
- package/dist/icon/apps.svg +0 -5
- package/dist/icon/happy.svg +0 -6
- package/dist/icon/link.svg +0 -5
- package/dist/icon/more.svg +0 -5
- package/dist/icon/navi.svg +0 -5
- package/dist/icon/phone.svg +0 -6
- package/dist/icon/share.svg +0 -6
- package/dist/icon/side.svg +0 -5
- package/dist/icon/star.svg +0 -7
- package/dist/icon/star_border.svg +0 -6
- package/dist/material.css +0 -2429
- package/dist/material.css.map +0 -7
- package/dist/styles/demo.sass +0 -110
- package/dist/styles.css +0 -23
- package/esbuild.js +0 -22
- package/esbuild.watch.js +0 -25
- package/src/container.js +0 -66
- package/src/field/email.js +0 -24
- package/src/field/image.js +0 -59
package/dist/demo-bundle.js
DELETED
|
@@ -1,2281 +0,0 @@
|
|
|
1
|
-
(() => {
|
|
2
|
-
// ../../node_modules/material/src/module/css.js
|
|
3
|
-
function has (element, className) {
|
|
4
|
-
if (!element || !className) {
|
|
5
|
-
return false
|
|
6
|
-
}
|
|
7
|
-
return !!element.className.match(new RegExp('(\\s|^)' + className + '(\\s|$)'))
|
|
8
|
-
}
|
|
9
|
-
function add (element, className) {
|
|
10
|
-
if (!element || !className) {
|
|
11
|
-
return
|
|
12
|
-
}
|
|
13
|
-
const classNames = className.split(' ')
|
|
14
|
-
for (let i = 0; i < classNames.length; i++) {
|
|
15
|
-
const cn = classNames[i]
|
|
16
|
-
if (!has(element, cn)) {
|
|
17
|
-
element.classList.add(cn)
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
return element
|
|
21
|
-
}
|
|
22
|
-
function remove (element, className) {
|
|
23
|
-
if (!element || !className) {
|
|
24
|
-
return
|
|
25
|
-
}
|
|
26
|
-
element.classList.remove(className)
|
|
27
|
-
return element
|
|
28
|
-
}
|
|
29
|
-
function toggle (element, className) {
|
|
30
|
-
if (has(element, className)) {
|
|
31
|
-
remove(element, className)
|
|
32
|
-
} else {
|
|
33
|
-
add(element, className)
|
|
34
|
-
}
|
|
35
|
-
return element
|
|
36
|
-
}
|
|
37
|
-
const css_default = { has, add, remove, toggle }
|
|
38
|
-
|
|
39
|
-
// ../../node_modules/material/src/component/classify.js
|
|
40
|
-
function classify (element, options) {
|
|
41
|
-
css_default.add(element, options.prefix + '-' + options.class)
|
|
42
|
-
if (options.name) {
|
|
43
|
-
css_default.add(element, options.class + '-' + options.name)
|
|
44
|
-
}
|
|
45
|
-
if (options.type) {
|
|
46
|
-
css_default.add(element, 'type-' + options.type)
|
|
47
|
-
}
|
|
48
|
-
if (options.color) {
|
|
49
|
-
css_default.add(element, options.color + '-color')
|
|
50
|
-
}
|
|
51
|
-
if (options.css) {
|
|
52
|
-
css_default.add(element, options.css)
|
|
53
|
-
}
|
|
54
|
-
if (options.elevation) {
|
|
55
|
-
css_default.add(element, 'elevation-z' + options.elevation)
|
|
56
|
-
}
|
|
57
|
-
if (options.name) {
|
|
58
|
-
element.dataset.name = options.name
|
|
59
|
-
}
|
|
60
|
-
if (options.label) {
|
|
61
|
-
element.title = options.label
|
|
62
|
-
}
|
|
63
|
-
if (options.style) {
|
|
64
|
-
const styles = options.style.split(' ')
|
|
65
|
-
for (let i = 0; i < styles.length; i++) {
|
|
66
|
-
css_default.add(element, 'style-' + styles[i])
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
if (options.theme) {
|
|
70
|
-
element.classList.add(options.theme + '-theme')
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
const classify_default = classify
|
|
74
|
-
|
|
75
|
-
// ../../node_modules/material/src/component/create.js
|
|
76
|
-
function create (options) {
|
|
77
|
-
const element = document.createElement(options.tag || 'div')
|
|
78
|
-
classify_default(element, options)
|
|
79
|
-
return element
|
|
80
|
-
}
|
|
81
|
-
const create_default = create
|
|
82
|
-
|
|
83
|
-
// ../../node_modules/material/src/element/create.js
|
|
84
|
-
function create2 (tag, className) {
|
|
85
|
-
tag = tag || 'div'
|
|
86
|
-
const element = document.createElement(tag)
|
|
87
|
-
css_default.add(element, className)
|
|
88
|
-
return element
|
|
89
|
-
}
|
|
90
|
-
const create_default2 = create2
|
|
91
|
-
|
|
92
|
-
// ../../node_modules/material/src/module/dom.js
|
|
93
|
-
function append (container, element) {
|
|
94
|
-
container.appendChild(element)
|
|
95
|
-
return element
|
|
96
|
-
}
|
|
97
|
-
function prepend (container, element) {
|
|
98
|
-
return container.insertBefore(element, container.firstChild)
|
|
99
|
-
}
|
|
100
|
-
function after (container, element) {
|
|
101
|
-
return container.parentNode.insertBefore(element, container.nextSibling)
|
|
102
|
-
}
|
|
103
|
-
function before (container, element) {
|
|
104
|
-
return container.insertBefore(element, container)
|
|
105
|
-
}
|
|
106
|
-
function replace (container, element) {
|
|
107
|
-
return container.parentNode.replaceChild(element, container)
|
|
108
|
-
}
|
|
109
|
-
function remove2 (element) {
|
|
110
|
-
const parent = element.parentNode
|
|
111
|
-
return parent.removeChild(element)
|
|
112
|
-
}
|
|
113
|
-
function dispose (element) {
|
|
114
|
-
const el = element
|
|
115
|
-
return el.parentNode ? el.parentNode.removeChild(el) : el
|
|
116
|
-
}
|
|
117
|
-
function empty (element) {
|
|
118
|
-
while (element.firstChild) {
|
|
119
|
-
element.removeChild(element.firstChild)
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
function destroy (element) {
|
|
123
|
-
return element.parentNode.removeChild(element)
|
|
124
|
-
}
|
|
125
|
-
const dom_default = { append, prepend, after, before, replace, remove: remove2, destroy, empty, dispose }
|
|
126
|
-
|
|
127
|
-
// ../../node_modules/material/src/element/insert.js
|
|
128
|
-
function insert (element, container, context) {
|
|
129
|
-
if (!element || !container) { return }
|
|
130
|
-
element = element.root || element
|
|
131
|
-
container = container.root || container
|
|
132
|
-
context = context || 'bottom'
|
|
133
|
-
const contexts = ['top', 'bottom', 'after', 'before']
|
|
134
|
-
const methods = ['prepend', 'append', 'after', 'before']
|
|
135
|
-
const index = contexts.indexOf(context)
|
|
136
|
-
if (index === -1) {
|
|
137
|
-
return
|
|
138
|
-
}
|
|
139
|
-
const method = methods[index]
|
|
140
|
-
dom_default[method](container, element)
|
|
141
|
-
return element
|
|
142
|
-
}
|
|
143
|
-
const insert_default = insert
|
|
144
|
-
|
|
145
|
-
// ../../node_modules/material/src/component/control.js
|
|
146
|
-
const KEYCODE = {
|
|
147
|
-
ENTER: 13,
|
|
148
|
-
SPACE: 32
|
|
149
|
-
}
|
|
150
|
-
const control = {
|
|
151
|
-
toggle () {
|
|
152
|
-
if (this.disabled) { return }
|
|
153
|
-
this.focus()
|
|
154
|
-
if (this.checked) {
|
|
155
|
-
this.check(false)
|
|
156
|
-
} else {
|
|
157
|
-
this.check(true)
|
|
158
|
-
}
|
|
159
|
-
return this
|
|
160
|
-
},
|
|
161
|
-
check (checked) {
|
|
162
|
-
if (checked) {
|
|
163
|
-
css_default.add(this.root, 'is-checked')
|
|
164
|
-
this.element.input.checked = true
|
|
165
|
-
this.checked = true
|
|
166
|
-
this.emit('change', this.checked)
|
|
167
|
-
} else {
|
|
168
|
-
css_default.remove(this.root, 'is-checked')
|
|
169
|
-
this.element.input.checked = false
|
|
170
|
-
this.checked = false
|
|
171
|
-
this.emit('change', this.checked)
|
|
172
|
-
}
|
|
173
|
-
return this
|
|
174
|
-
},
|
|
175
|
-
label (label2, container) {
|
|
176
|
-
if (!label2) { return }
|
|
177
|
-
this.element = this.element || {}
|
|
178
|
-
if (!this.element.label) {
|
|
179
|
-
this.element.label = create_default2('label', this.options.class + '-label')
|
|
180
|
-
}
|
|
181
|
-
this.element.label.textContent = label2
|
|
182
|
-
container = container || this.root
|
|
183
|
-
insert_default(this.element.label, container)
|
|
184
|
-
},
|
|
185
|
-
icon (icon, container, position) {
|
|
186
|
-
if (!icon) { return }
|
|
187
|
-
container = container || this.root
|
|
188
|
-
position = position || 'top'
|
|
189
|
-
if (this.options.type === 'text-icon') {
|
|
190
|
-
position = 'bottom'
|
|
191
|
-
}
|
|
192
|
-
this.element = this.element || {}
|
|
193
|
-
this.element.icon = create_default2('i', this.options.class + '-icon')
|
|
194
|
-
insert_default(this.element.icon, container, position)
|
|
195
|
-
this.element.icon.innerHTML = icon
|
|
196
|
-
},
|
|
197
|
-
error (error) {
|
|
198
|
-
error = error || this.options.error
|
|
199
|
-
if (this.options.error === null) { return }
|
|
200
|
-
const text = this.options.error || this.options.text
|
|
201
|
-
if (!this.element.error) {
|
|
202
|
-
this.element.error = create_default2('error', this.options.class + '-error')
|
|
203
|
-
}
|
|
204
|
-
if (text) {
|
|
205
|
-
this.element.error.textContent = text
|
|
206
|
-
}
|
|
207
|
-
insert_default(this.element.error, this.root, 'bottom')
|
|
208
|
-
},
|
|
209
|
-
disable () {
|
|
210
|
-
this.disabled = true
|
|
211
|
-
this.element.input.setAttribute('disabled', 'disabled')
|
|
212
|
-
css_default.add(this.root, 'is-disabled')
|
|
213
|
-
return this
|
|
214
|
-
},
|
|
215
|
-
enable () {
|
|
216
|
-
this.disabled = false
|
|
217
|
-
this.element.input.removeAttribute('disabled')
|
|
218
|
-
css_default.remove(this.root, 'is-disabled')
|
|
219
|
-
return this
|
|
220
|
-
},
|
|
221
|
-
keydown (e2) {
|
|
222
|
-
if (e2.altKey) { return }
|
|
223
|
-
switch (e2.keyCode) {
|
|
224
|
-
case KEYCODE.ENTER:
|
|
225
|
-
case KEYCODE.SPACE:
|
|
226
|
-
e2.preventDefault()
|
|
227
|
-
this.toggle(e2)
|
|
228
|
-
break
|
|
229
|
-
default:
|
|
230
|
-
break
|
|
231
|
-
}
|
|
232
|
-
},
|
|
233
|
-
get (prop) {
|
|
234
|
-
switch (prop) {
|
|
235
|
-
case 'name':
|
|
236
|
-
this.getName()
|
|
237
|
-
break
|
|
238
|
-
default:
|
|
239
|
-
this.setValue(prop)
|
|
240
|
-
}
|
|
241
|
-
return this
|
|
242
|
-
},
|
|
243
|
-
getName () {
|
|
244
|
-
return this.root.dataset.name
|
|
245
|
-
},
|
|
246
|
-
focus () {
|
|
247
|
-
if (this.disabled === true) { return this }
|
|
248
|
-
css_default.add(this.root, 'is-focused')
|
|
249
|
-
if (this.element.input !== document.activeElement) {
|
|
250
|
-
this.element.input.focus()
|
|
251
|
-
}
|
|
252
|
-
return this
|
|
253
|
-
},
|
|
254
|
-
blur () {
|
|
255
|
-
css_default.remove(this.root, 'is-focused')
|
|
256
|
-
return this
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
const control_default = control
|
|
260
|
-
|
|
261
|
-
// ../../node_modules/material/src/module/utils.js
|
|
262
|
-
function _isArray (object) {
|
|
263
|
-
return Object.prototype.toString.call(object) === '[object Array]'
|
|
264
|
-
}
|
|
265
|
-
function _isLiteralObject (object) {
|
|
266
|
-
return object && typeof object === 'object' && Object.getPrototypeOf(object) === Object.getPrototypeOf({})
|
|
267
|
-
}
|
|
268
|
-
function _isIterable (object) {
|
|
269
|
-
const r = _isLiteralObject(object) || _isArray(object) || typeof object === 'object' && object !== null && object.length !== void 0
|
|
270
|
-
return r
|
|
271
|
-
}
|
|
272
|
-
function _each (object, callback) {
|
|
273
|
-
if (_isArray(object) || typeof object === 'object' && object.length !== void 0) {
|
|
274
|
-
for (let i = 0, l = object.length; i < l; i++) {
|
|
275
|
-
callback.apply(object[i], [object[i], i])
|
|
276
|
-
}
|
|
277
|
-
return
|
|
278
|
-
}
|
|
279
|
-
if (_isLiteralObject(object)) {
|
|
280
|
-
for (const key in object) {
|
|
281
|
-
callback.apply(object[key], [object[key], key])
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
// ../../node_modules/material/src/element/style.js
|
|
287
|
-
function get (element, style) {
|
|
288
|
-
if (_isArray(style)) {
|
|
289
|
-
const css = {}
|
|
290
|
-
for (const i in list) {
|
|
291
|
-
css[list[i]] = this.get(element, list[i])
|
|
292
|
-
}
|
|
293
|
-
return css
|
|
294
|
-
} else {
|
|
295
|
-
let computedStyle
|
|
296
|
-
if (typeof window.getComputedStyle === 'function') {
|
|
297
|
-
computedStyle = window.getComputedStyle(element)
|
|
298
|
-
} else if (typeof document.currentStyle !== void 0) {
|
|
299
|
-
computedStyle = element.currentStyle
|
|
300
|
-
} else {
|
|
301
|
-
computedStyle = element.style
|
|
302
|
-
}
|
|
303
|
-
if (style) {
|
|
304
|
-
return computedStyle[style]
|
|
305
|
-
} else {
|
|
306
|
-
return computedStyle
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
function set (element, style) {
|
|
311
|
-
if (_isIterable(element) && _isLiteralObject(style)) {
|
|
312
|
-
_each(element, function (e2) {
|
|
313
|
-
set(e2, style)
|
|
314
|
-
})
|
|
315
|
-
return element
|
|
316
|
-
}
|
|
317
|
-
if (_isLiteralObject(style)) {
|
|
318
|
-
for (const i in style) {
|
|
319
|
-
element.style[i] = style[i]
|
|
320
|
-
}
|
|
321
|
-
return style
|
|
322
|
-
}
|
|
323
|
-
return false
|
|
324
|
-
}
|
|
325
|
-
const style_default = { get, set }
|
|
326
|
-
|
|
327
|
-
// ../../node_modules/material/src/element/offset.js
|
|
328
|
-
function offset (element, prop) {
|
|
329
|
-
const rect = element.getBoundingClientRect()
|
|
330
|
-
const offset2 = {
|
|
331
|
-
top: Math.round(rect.top),
|
|
332
|
-
right: Math.round(rect.right),
|
|
333
|
-
bottom: Math.round(rect.bottom),
|
|
334
|
-
left: Math.round(rect.left),
|
|
335
|
-
width: rect.width ? Math.round(rect.width) : Math.round(element.offsetWidth),
|
|
336
|
-
height: rect.height ? Math.round(rect.height) : Math.round(element.offsetHeight)
|
|
337
|
-
}
|
|
338
|
-
if (offset2.width <= 0) {
|
|
339
|
-
offset2.width = parseFloat(style_default.get(element, 'width'))
|
|
340
|
-
}
|
|
341
|
-
if (offset2.height <= 0) {
|
|
342
|
-
offset2.height = parseFloat(style_default.get(element, 'height'))
|
|
343
|
-
}
|
|
344
|
-
if (prop) {
|
|
345
|
-
return offset2[prop]
|
|
346
|
-
} else {
|
|
347
|
-
return offset2
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
const offset_default = offset
|
|
351
|
-
|
|
352
|
-
// ../../node_modules/material/src/component/ripple.js
|
|
353
|
-
const defaults = {
|
|
354
|
-
transition: '.5s cubic-bezier(0.4, 0.0, 0.2, 1)',
|
|
355
|
-
opacity: ['1', '.3']
|
|
356
|
-
}
|
|
357
|
-
function init (instance2) {
|
|
358
|
-
instance2.on('built', (container) => {
|
|
359
|
-
set2(container)
|
|
360
|
-
})
|
|
361
|
-
}
|
|
362
|
-
function set2 (container) {
|
|
363
|
-
container.addEventListener('mousedown', (e2) => {
|
|
364
|
-
show(e2)
|
|
365
|
-
})
|
|
366
|
-
}
|
|
367
|
-
function show (e2) {
|
|
368
|
-
const container = e2.target
|
|
369
|
-
const offs = offset_default(container)
|
|
370
|
-
const ripple = create_default2('div', 'material-ripple')
|
|
371
|
-
const end = coordinate(offs)
|
|
372
|
-
const initial = {
|
|
373
|
-
left: (e2.offsetX || offs.width / 2) + 'px',
|
|
374
|
-
top: (e2.offsetY || offs.height / 2) + 'px'
|
|
375
|
-
}
|
|
376
|
-
ripple.style.left = initial.left
|
|
377
|
-
ripple.style.top = initial.top
|
|
378
|
-
ripple.style.transition = defaults.transition
|
|
379
|
-
insert_default(ripple, container, 'top')
|
|
380
|
-
setTimeout(() => {
|
|
381
|
-
ripple.style.left = end.left
|
|
382
|
-
ripple.style.top = end.top
|
|
383
|
-
ripple.style.width = end.size
|
|
384
|
-
ripple.style.height = end.size
|
|
385
|
-
}, 1)
|
|
386
|
-
document.body.onmouseup = () => {
|
|
387
|
-
destroy2(ripple)
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
function destroy2 (ripple) {
|
|
391
|
-
if (ripple.parentNode) {
|
|
392
|
-
ripple.style.opacity = '0'
|
|
393
|
-
}
|
|
394
|
-
document.body.onmouseup = null
|
|
395
|
-
setTimeout(() => {
|
|
396
|
-
if (ripple.parentNode) {
|
|
397
|
-
ripple.parentNode.removeChild(ripple)
|
|
398
|
-
}
|
|
399
|
-
}, 1e3)
|
|
400
|
-
}
|
|
401
|
-
function coordinate (o) {
|
|
402
|
-
const size = o.width
|
|
403
|
-
let top = -o.height / 2
|
|
404
|
-
if (o.width > o.height) {
|
|
405
|
-
top = -(o.width - o.height / 2)
|
|
406
|
-
}
|
|
407
|
-
return {
|
|
408
|
-
size: size * 2 + 'px',
|
|
409
|
-
top: top + 'px',
|
|
410
|
-
left: size / -2 + 'px'
|
|
411
|
-
}
|
|
412
|
-
}
|
|
413
|
-
const ripple_default = init
|
|
414
|
-
|
|
415
|
-
// ../../node_modules/material/src/module/emitter.js
|
|
416
|
-
const emitter_default = {
|
|
417
|
-
on (event, cb) {
|
|
418
|
-
this.event = this.event || {}
|
|
419
|
-
this.event[event] = this.event[event] || []
|
|
420
|
-
this.event[event].push(cb)
|
|
421
|
-
return this
|
|
422
|
-
},
|
|
423
|
-
off (event, cb) {
|
|
424
|
-
this.event = this.event || {}
|
|
425
|
-
if (event in this.event === false) { return }
|
|
426
|
-
this.event[event].splice(this.event[event].indexOf(cb), 1)
|
|
427
|
-
return this
|
|
428
|
-
},
|
|
429
|
-
emit (event) {
|
|
430
|
-
this.event = this.event || {}
|
|
431
|
-
if (event in this.event === false) { return }
|
|
432
|
-
for (let i = 0; i < this.event[event].length; i++) {
|
|
433
|
-
this.event[event][i].apply(this, Array.prototype.slice.call(arguments, 1))
|
|
434
|
-
}
|
|
435
|
-
return this
|
|
436
|
-
}
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
// ../../node_modules/material/src/module/extract.js
|
|
440
|
-
function f (instance2, func) {
|
|
441
|
-
if (!func) { return }
|
|
442
|
-
if (typeof func === 'function') {
|
|
443
|
-
return func
|
|
444
|
-
} else if (!func.match(/\./)) { return instance2[func] }
|
|
445
|
-
let iteration
|
|
446
|
-
const keys = func.split('.')
|
|
447
|
-
for (let i = 0, l = keys.length; i < l; i++) {
|
|
448
|
-
const key = keys[i]
|
|
449
|
-
iteration = iteration || instance2
|
|
450
|
-
iteration = iteration[key]
|
|
451
|
-
}
|
|
452
|
-
return iteration
|
|
453
|
-
}
|
|
454
|
-
function e (instance2, ev) {
|
|
455
|
-
if (!ev) { return instance2 } else if (!ev.match(/\./)) { return instance2[ev] }
|
|
456
|
-
let iteration
|
|
457
|
-
const obj = {}
|
|
458
|
-
let element
|
|
459
|
-
const keys = ev.split('.')
|
|
460
|
-
for (let i = 0, l = keys.length; i < l; i++) {
|
|
461
|
-
const key = keys[i]
|
|
462
|
-
iteration = iteration || instance2
|
|
463
|
-
iteration = iteration[key]
|
|
464
|
-
if (i === keys.length - 2) {
|
|
465
|
-
element = iteration
|
|
466
|
-
}
|
|
467
|
-
}
|
|
468
|
-
obj.element = element
|
|
469
|
-
obj.name = keys[keys.length - 1]
|
|
470
|
-
return obj
|
|
471
|
-
}
|
|
472
|
-
const extract_default = { e, f }
|
|
473
|
-
|
|
474
|
-
// ../../node_modules/material/src/module/attach.js
|
|
475
|
-
const attach_default = {
|
|
476
|
-
attach: function (events) {
|
|
477
|
-
events = events || this.options.events
|
|
478
|
-
if (!events) { return }
|
|
479
|
-
const instance2 = this
|
|
480
|
-
events.map((def) => {
|
|
481
|
-
const e2 = extract_default.e(instance2, def[0])
|
|
482
|
-
const f2 = extract_default.f(instance2, def[1])
|
|
483
|
-
e2.element.addEventListener(e2.name, f2.bind(this))
|
|
484
|
-
})
|
|
485
|
-
return this
|
|
486
|
-
}
|
|
487
|
-
}
|
|
488
|
-
|
|
489
|
-
// ../../node_modules/material/src/Button.js
|
|
490
|
-
const defaults2 = {
|
|
491
|
-
prefix: 'material',
|
|
492
|
-
class: 'button',
|
|
493
|
-
tag: 'button',
|
|
494
|
-
events: [
|
|
495
|
-
['root.click', 'handleClick']
|
|
496
|
-
]
|
|
497
|
-
}
|
|
498
|
-
const Button = class {
|
|
499
|
-
constructor (options) {
|
|
500
|
-
this.init(options)
|
|
501
|
-
this.build()
|
|
502
|
-
this.setup()
|
|
503
|
-
this.attach()
|
|
504
|
-
this.emit('ready')
|
|
505
|
-
return this
|
|
506
|
-
}
|
|
507
|
-
|
|
508
|
-
init (options) {
|
|
509
|
-
this.options = Object.assign({}, defaults2, options || {})
|
|
510
|
-
Object.assign(this, control_default, emitter_default, attach_default, ripple_default)
|
|
511
|
-
this.element = this.element || {}
|
|
512
|
-
ripple_default(this)
|
|
513
|
-
this.emit('init')
|
|
514
|
-
}
|
|
515
|
-
|
|
516
|
-
build () {
|
|
517
|
-
this.element = {}
|
|
518
|
-
this.root = create_default(this.options)
|
|
519
|
-
this.options.label = this.options.label || this.options.text
|
|
520
|
-
this.root.setAttribute('aria-label', this.options.label || this.options.name)
|
|
521
|
-
this.label(this.options.label)
|
|
522
|
-
this.icon(this.options.icon)
|
|
523
|
-
if (this.options.container) {
|
|
524
|
-
insert_default(this.root, this.options.container)
|
|
525
|
-
}
|
|
526
|
-
this.emit('built', this.root)
|
|
527
|
-
return this
|
|
528
|
-
}
|
|
529
|
-
|
|
530
|
-
insert (container, context) {
|
|
531
|
-
insert_default(this.root, container, context)
|
|
532
|
-
return this
|
|
533
|
-
}
|
|
534
|
-
|
|
535
|
-
setup () {
|
|
536
|
-
this.element.input = this.root
|
|
537
|
-
if (this.options.name) {
|
|
538
|
-
this.root.dataset.name = this.options.name
|
|
539
|
-
}
|
|
540
|
-
if (this.options.content) {
|
|
541
|
-
this.root.innerHTML = this.options.content
|
|
542
|
-
}
|
|
543
|
-
}
|
|
544
|
-
|
|
545
|
-
set (prop, value) {
|
|
546
|
-
switch (prop) {
|
|
547
|
-
case 'disabled':
|
|
548
|
-
this.disable(value)
|
|
549
|
-
break
|
|
550
|
-
case 'value':
|
|
551
|
-
this.setValue(value)
|
|
552
|
-
break
|
|
553
|
-
case 'label':
|
|
554
|
-
this.setLabel(value)
|
|
555
|
-
break
|
|
556
|
-
default:
|
|
557
|
-
this.setValue(prop)
|
|
558
|
-
}
|
|
559
|
-
return this
|
|
560
|
-
}
|
|
561
|
-
|
|
562
|
-
handleClick (e2) {
|
|
563
|
-
e2.preventDefault()
|
|
564
|
-
if (this.disabled === true) { return }
|
|
565
|
-
if (this.options.upload) { return }
|
|
566
|
-
this.emit('click', e2)
|
|
567
|
-
return this
|
|
568
|
-
}
|
|
569
|
-
}
|
|
570
|
-
const Button_default = Button
|
|
571
|
-
|
|
572
|
-
// ../../node_modules/material/src/component/insert.js
|
|
573
|
-
const insert_default2 = {
|
|
574
|
-
insert (container, context) {
|
|
575
|
-
const element = this.root
|
|
576
|
-
this.insertElement(element, container, context)
|
|
577
|
-
return this
|
|
578
|
-
},
|
|
579
|
-
insertElement (element, container, context) {
|
|
580
|
-
if (container && container.root) {
|
|
581
|
-
container = container.root
|
|
582
|
-
}
|
|
583
|
-
this.container = container
|
|
584
|
-
context = context || 'bottom'
|
|
585
|
-
const contexts = ['top', 'bottom', 'after', 'before']
|
|
586
|
-
const methods = ['prepend', 'append', 'after', 'before']
|
|
587
|
-
const index = contexts.indexOf(context)
|
|
588
|
-
if (index === -1) {
|
|
589
|
-
return
|
|
590
|
-
}
|
|
591
|
-
const method = methods[index]
|
|
592
|
-
dom_default[method](container, element)
|
|
593
|
-
return element
|
|
594
|
-
}
|
|
595
|
-
}
|
|
596
|
-
|
|
597
|
-
// ../../node_modules/material/src/module/object.js
|
|
598
|
-
function is (object) {
|
|
599
|
-
return object && typeof object === 'object' && Object.getPrototypeOf(object) === Object.getPrototypeOf({})
|
|
600
|
-
}
|
|
601
|
-
|
|
602
|
-
// ../../node_modules/material/src/layout.js
|
|
603
|
-
const Layout = class {
|
|
604
|
-
constructor (schema, container) {
|
|
605
|
-
this.component = this.create(schema, container)
|
|
606
|
-
return this
|
|
607
|
-
}
|
|
608
|
-
|
|
609
|
-
create (schema, container, structure, level) {
|
|
610
|
-
level = level || 0
|
|
611
|
-
level++
|
|
612
|
-
structure = structure || {}
|
|
613
|
-
let component = null
|
|
614
|
-
for (var i = 0; i < schema.length; i++) {
|
|
615
|
-
var name
|
|
616
|
-
let options = {}
|
|
617
|
-
if (schema[i] instanceof Object && typeof schema[i] === 'function') {
|
|
618
|
-
if (is(schema[i + 2])) {
|
|
619
|
-
options = schema[i + 2]
|
|
620
|
-
}
|
|
621
|
-
if (typeof schema[i + 1] === 'string') {
|
|
622
|
-
name = schema[i + 1]
|
|
623
|
-
options.name = name
|
|
624
|
-
}
|
|
625
|
-
component = new schema[i](options)
|
|
626
|
-
if (name) {
|
|
627
|
-
structure[name] = component
|
|
628
|
-
}
|
|
629
|
-
if (component) {
|
|
630
|
-
this.display(component.root, options)
|
|
631
|
-
this.style(component, options)
|
|
632
|
-
}
|
|
633
|
-
if (level === 1) {
|
|
634
|
-
const isClass = (fn) => /^\sclass/.test(schema[i].toString())
|
|
635
|
-
structure.root = component.root
|
|
636
|
-
}
|
|
637
|
-
if (component && container) {
|
|
638
|
-
if (component.insert) { component.insert(container) } else { insert_default(component, container) }
|
|
639
|
-
}
|
|
640
|
-
} else if (Array.isArray(schema[i])) {
|
|
641
|
-
if (component == null) {
|
|
642
|
-
component = container
|
|
643
|
-
}
|
|
644
|
-
this.create(schema[i], component, structure, level)
|
|
645
|
-
}
|
|
646
|
-
}
|
|
647
|
-
return structure
|
|
648
|
-
}
|
|
649
|
-
|
|
650
|
-
display (element, options) {
|
|
651
|
-
const display = options.display
|
|
652
|
-
const direction = options.direction || 'horizontal'
|
|
653
|
-
if (!element || !display) { return }
|
|
654
|
-
if (direction === 'horizontal') {
|
|
655
|
-
element.className += ' flex-row'
|
|
656
|
-
} else if (direction === 'vertical') {
|
|
657
|
-
element.className += ' flex-column'
|
|
658
|
-
}
|
|
659
|
-
}
|
|
660
|
-
|
|
661
|
-
style (component) {
|
|
662
|
-
const options = component.options || {}
|
|
663
|
-
if (options.flex) {
|
|
664
|
-
css_default.add(component.root, 'flex-' + options.flex)
|
|
665
|
-
} else {
|
|
666
|
-
const size = options.size
|
|
667
|
-
if (options.size && options.width) {
|
|
668
|
-
component.root.width = size + 'px'
|
|
669
|
-
} else if (options.size && options.height) {
|
|
670
|
-
component.root.height = size + 'px'
|
|
671
|
-
}
|
|
672
|
-
}
|
|
673
|
-
if (options.position) {
|
|
674
|
-
component.root.position = options.position
|
|
675
|
-
}
|
|
676
|
-
if (options.bottom) {
|
|
677
|
-
component.root.bottom = options.bottom
|
|
678
|
-
}
|
|
679
|
-
if (options.hide) {
|
|
680
|
-
component.root.display = 'none'
|
|
681
|
-
}
|
|
682
|
-
if (options.theme) {
|
|
683
|
-
css_default.add(component.root, 'theme-' + options.theme)
|
|
684
|
-
}
|
|
685
|
-
}
|
|
686
|
-
|
|
687
|
-
get (name) {
|
|
688
|
-
if (name) { return this.component[name] } else { return this.component }
|
|
689
|
-
}
|
|
690
|
-
}
|
|
691
|
-
const layout_default = Layout
|
|
692
|
-
|
|
693
|
-
// ../../node_modules/material/src/card.js
|
|
694
|
-
const defaults3 = {
|
|
695
|
-
prefix: 'material',
|
|
696
|
-
class: 'card',
|
|
697
|
-
tag: 'div'
|
|
698
|
-
}
|
|
699
|
-
const Card = class {
|
|
700
|
-
constructor (options) {
|
|
701
|
-
this.init(options)
|
|
702
|
-
this.build()
|
|
703
|
-
}
|
|
704
|
-
|
|
705
|
-
init (options) {
|
|
706
|
-
this.options = Object.assign({}, defaults3, options || {})
|
|
707
|
-
Object.assign(this, insert_default2)
|
|
708
|
-
}
|
|
709
|
-
|
|
710
|
-
build () {
|
|
711
|
-
this.root = create_default(this.options)
|
|
712
|
-
if (this.options.layout) {
|
|
713
|
-
this.layout = new layout_default(this.options.layout, this.root)
|
|
714
|
-
}
|
|
715
|
-
}
|
|
716
|
-
}
|
|
717
|
-
const card_default = Card
|
|
718
|
-
|
|
719
|
-
// ../../node_modules/material/src/component/events.js
|
|
720
|
-
const events_default = {
|
|
721
|
-
addEvent (event, fn) {
|
|
722
|
-
const element = this.root
|
|
723
|
-
function listenHandler (e2) {
|
|
724
|
-
const ret = fn.apply(this, arguments)
|
|
725
|
-
if (ret === false) {
|
|
726
|
-
e2.stopPropagation()
|
|
727
|
-
e2.preventDefault()
|
|
728
|
-
}
|
|
729
|
-
return ret
|
|
730
|
-
}
|
|
731
|
-
function attachHandler () {
|
|
732
|
-
const ret = fn.call(element, window.event)
|
|
733
|
-
if (ret === false) {
|
|
734
|
-
window.event.returnValue = false
|
|
735
|
-
window.event.cancelBubble = true
|
|
736
|
-
}
|
|
737
|
-
return ret
|
|
738
|
-
}
|
|
739
|
-
if (element.addEventListener) {
|
|
740
|
-
element.addEventListener(event, listenHandler, false)
|
|
741
|
-
} else {
|
|
742
|
-
element.attachEvent('on' + event, attachHandler)
|
|
743
|
-
}
|
|
744
|
-
return this
|
|
745
|
-
},
|
|
746
|
-
removeEvent (event, fn) {
|
|
747
|
-
const element = this.root
|
|
748
|
-
if (element.removeEventListener) {
|
|
749
|
-
element.removeEventListener(event, fn, false)
|
|
750
|
-
} else if (element.detachEvent) {
|
|
751
|
-
element.detachEvent('on' + event, element[fn.toString() + event])
|
|
752
|
-
element[fn.toString() + event] = null
|
|
753
|
-
} else {
|
|
754
|
-
element['on' + event] = function () {
|
|
755
|
-
}
|
|
756
|
-
}
|
|
757
|
-
return this
|
|
758
|
-
}
|
|
759
|
-
}
|
|
760
|
-
|
|
761
|
-
// ../../node_modules/material/src/component.js
|
|
762
|
-
const defaults4 = {
|
|
763
|
-
prefix: 'material',
|
|
764
|
-
class: 'component',
|
|
765
|
-
tag: 'span'
|
|
766
|
-
}
|
|
767
|
-
const Component = class {
|
|
768
|
-
constructor (options) {
|
|
769
|
-
this.init(options)
|
|
770
|
-
this.build()
|
|
771
|
-
return this
|
|
772
|
-
}
|
|
773
|
-
|
|
774
|
-
init (options) {
|
|
775
|
-
this.options = Object.assign({}, defaults4, options || {})
|
|
776
|
-
Object.assign(this, emitter_default, events_default, insert_default2)
|
|
777
|
-
return this
|
|
778
|
-
}
|
|
779
|
-
|
|
780
|
-
build () {
|
|
781
|
-
this.root = create_default(this.options)
|
|
782
|
-
if (this.options.container) {
|
|
783
|
-
this.insert(this.options.container)
|
|
784
|
-
}
|
|
785
|
-
return this
|
|
786
|
-
}
|
|
787
|
-
}
|
|
788
|
-
const component_default = Component
|
|
789
|
-
|
|
790
|
-
// ../../node_modules/material/src/container.js
|
|
791
|
-
const defaults5 = {
|
|
792
|
-
prefix: 'material',
|
|
793
|
-
class: 'container',
|
|
794
|
-
tag: 'div'
|
|
795
|
-
}
|
|
796
|
-
const Container = class {
|
|
797
|
-
constructor (options) {
|
|
798
|
-
this.init(options)
|
|
799
|
-
this.build()
|
|
800
|
-
return this
|
|
801
|
-
}
|
|
802
|
-
|
|
803
|
-
init (options) {
|
|
804
|
-
this.options = Object.assign({}, defaults5, options || {})
|
|
805
|
-
Object.assign(this, emitter_default)
|
|
806
|
-
return this
|
|
807
|
-
}
|
|
808
|
-
|
|
809
|
-
build () {
|
|
810
|
-
this.root = create_default(this.options)
|
|
811
|
-
if (this.options.container) {
|
|
812
|
-
insert_default(this.root, this.options.container)
|
|
813
|
-
}
|
|
814
|
-
return this
|
|
815
|
-
}
|
|
816
|
-
|
|
817
|
-
insert (container, context) {
|
|
818
|
-
insert_default(this.root, container, context)
|
|
819
|
-
return this
|
|
820
|
-
}
|
|
821
|
-
}
|
|
822
|
-
const container_default = Container
|
|
823
|
-
|
|
824
|
-
// ../../node_modules/material/src/component/label.js
|
|
825
|
-
function label (root, text, options) {
|
|
826
|
-
text = text || null
|
|
827
|
-
const prefix = options.class || options.prefix
|
|
828
|
-
const label2 = create_default2('label', prefix + '-label')
|
|
829
|
-
label2.textContent = text
|
|
830
|
-
label2.setAttribute('for', options.name)
|
|
831
|
-
insert_default(label2, root)
|
|
832
|
-
return label2
|
|
833
|
-
}
|
|
834
|
-
const label_default = label
|
|
835
|
-
|
|
836
|
-
// ../../node_modules/material/src/element/attribute.js
|
|
837
|
-
function init2 (element, attribute) {
|
|
838
|
-
for (const key in attribute) {
|
|
839
|
-
if (attribute.hasOwnProperty(key)) {
|
|
840
|
-
element.setAttribute(key, attribute[key])
|
|
841
|
-
}
|
|
842
|
-
}
|
|
843
|
-
return element
|
|
844
|
-
}
|
|
845
|
-
function set3 (element, name, value) {
|
|
846
|
-
return element.setAttribute(name, '' + value)
|
|
847
|
-
}
|
|
848
|
-
function get2 (element, name) {
|
|
849
|
-
return element.getAttribute(name) || null
|
|
850
|
-
}
|
|
851
|
-
function remove3 (element, name) {
|
|
852
|
-
return element.removeAttribute(name)
|
|
853
|
-
}
|
|
854
|
-
const attribute_default = { init: init2, set: set3, get: get2, remove: remove3 }
|
|
855
|
-
|
|
856
|
-
// ../../node_modules/material/src/element/build.js
|
|
857
|
-
function isObject (object) {
|
|
858
|
-
return object && typeof object === 'object' && Object.getPrototypeOf(object) === Object.getPrototypeOf({})
|
|
859
|
-
}
|
|
860
|
-
function process (string) {
|
|
861
|
-
const tags = string.match(/^[\w-]+/)
|
|
862
|
-
const ids = string.match(/#([\w-]+)/)
|
|
863
|
-
const classes = string.match(/\.[\w-]+/g)
|
|
864
|
-
const names = string.match(/\$([\w-]+)/)
|
|
865
|
-
const properties = {
|
|
866
|
-
tag: tags ? tags[0] : 'div'
|
|
867
|
-
}
|
|
868
|
-
if (ids) { properties.id = ids[1] }
|
|
869
|
-
if (names) { properties.name = names[1] }
|
|
870
|
-
if (classes) {
|
|
871
|
-
properties.class = classes.join(' ').replace(/\./g, '')
|
|
872
|
-
}
|
|
873
|
-
return properties
|
|
874
|
-
}
|
|
875
|
-
function build (schema, container, object, level) {
|
|
876
|
-
let element
|
|
877
|
-
object = object || {}
|
|
878
|
-
for (let i = 0; i < schema.length; i++) {
|
|
879
|
-
if (typeof schema[i] === 'string') {
|
|
880
|
-
const property = process(schema[i])
|
|
881
|
-
element = create_default2(property.tag, property.class)
|
|
882
|
-
insert_default(element, container)
|
|
883
|
-
if (property.name) {
|
|
884
|
-
object[property.name] = element
|
|
885
|
-
}
|
|
886
|
-
} else if (isObject(schema[i])) {
|
|
887
|
-
attribute_default.init(element, schema[i])
|
|
888
|
-
} else if (Array.isArray(schema[i])) {
|
|
889
|
-
build(schema[i], element, object, level)
|
|
890
|
-
}
|
|
891
|
-
}
|
|
892
|
-
return object
|
|
893
|
-
}
|
|
894
|
-
const build_default = build
|
|
895
|
-
|
|
896
|
-
// ../../node_modules/material/src/skin/material/icon/checkbox.svg
|
|
897
|
-
const checkbox_default = 'export default `\n<svg width="18px" height="18px" class="checkbox-icon" viewBox="0 0 18 18">\n <polygon class="checkbox-check" points="7 14.42 2 9.42 3.41 8.01 7 11.59 14.59 4 16 5.42"></polygon>\n</svg>`;'
|
|
898
|
-
|
|
899
|
-
// ../../node_modules/material/src/checkbox.js
|
|
900
|
-
const defaults6 = {
|
|
901
|
-
prefix: 'material',
|
|
902
|
-
class: 'checkbox',
|
|
903
|
-
type: 'control',
|
|
904
|
-
build: [
|
|
905
|
-
'$root.material-checkbox',
|
|
906
|
-
{},
|
|
907
|
-
['input$input', {}],
|
|
908
|
-
['span$control.checkbox-control']
|
|
909
|
-
],
|
|
910
|
-
events: [
|
|
911
|
-
['element.control.click', 'click', {}],
|
|
912
|
-
['element.label.click', 'toggle', {}],
|
|
913
|
-
['element.input.focus', 'focus'],
|
|
914
|
-
['element.input.blur', 'blur'],
|
|
915
|
-
['element.input.keydown', 'keydown', {}]
|
|
916
|
-
]
|
|
917
|
-
}
|
|
918
|
-
const Checkbox = class {
|
|
919
|
-
constructor (options) {
|
|
920
|
-
this.init(options)
|
|
921
|
-
this.build()
|
|
922
|
-
this.attach()
|
|
923
|
-
return this
|
|
924
|
-
}
|
|
925
|
-
|
|
926
|
-
init (options) {
|
|
927
|
-
this.options = Object.assign({}, defaults6, options || {})
|
|
928
|
-
Object.assign(this, events_default, control_default, emitter_default, attach_default)
|
|
929
|
-
return this
|
|
930
|
-
}
|
|
931
|
-
|
|
932
|
-
build () {
|
|
933
|
-
this.element = build_default(this.options.build)
|
|
934
|
-
this.root = this.element.root
|
|
935
|
-
this.element.control.innerHTML = checkbox_default
|
|
936
|
-
const text = this.options.text || this.options.label
|
|
937
|
-
this.element.label = label_default(this.root, text, this.options)
|
|
938
|
-
this.element.input.setAttribute('type', 'checkbox')
|
|
939
|
-
this.element.input.setAttribute('name', this.options.name)
|
|
940
|
-
this.element.input.setAttribute('aria-label', this.options.name)
|
|
941
|
-
if (this.options.value) {
|
|
942
|
-
this.element.input.setAttribute('value', this.options.value)
|
|
943
|
-
}
|
|
944
|
-
if (this.options.disabled) {
|
|
945
|
-
this.disabled = this.options.disabled
|
|
946
|
-
this.element.input.setAttribute('disabled', 'disabled')
|
|
947
|
-
css_default.add(this.root, 'is-disabled')
|
|
948
|
-
}
|
|
949
|
-
if (this.options.checked) {
|
|
950
|
-
this.check(true)
|
|
951
|
-
}
|
|
952
|
-
if (this.options.value) {
|
|
953
|
-
this.set('value', this.value)
|
|
954
|
-
}
|
|
955
|
-
if (this.options.container) {
|
|
956
|
-
insert_default(this.root, this.options.container)
|
|
957
|
-
}
|
|
958
|
-
return this
|
|
959
|
-
}
|
|
960
|
-
|
|
961
|
-
set (prop, value) {
|
|
962
|
-
switch (prop) {
|
|
963
|
-
case 'checked':
|
|
964
|
-
this.check(value)
|
|
965
|
-
break
|
|
966
|
-
case 'value':
|
|
967
|
-
this.setValue(value)
|
|
968
|
-
break
|
|
969
|
-
case 'label':
|
|
970
|
-
this.setLabel(value)
|
|
971
|
-
break
|
|
972
|
-
default:
|
|
973
|
-
this.check(prop)
|
|
974
|
-
}
|
|
975
|
-
return this
|
|
976
|
-
}
|
|
977
|
-
|
|
978
|
-
insert (container, context) {
|
|
979
|
-
insert_default(this.root, container, context)
|
|
980
|
-
return this
|
|
981
|
-
}
|
|
982
|
-
|
|
983
|
-
click (e2) {
|
|
984
|
-
this.toggle(e2)
|
|
985
|
-
this.element.input.focus()
|
|
986
|
-
return this
|
|
987
|
-
}
|
|
988
|
-
|
|
989
|
-
setValue (value) {
|
|
990
|
-
console.log('setValue', value)
|
|
991
|
-
this.value = value
|
|
992
|
-
this.element.input.setAttribute('value', value)
|
|
993
|
-
return this
|
|
994
|
-
}
|
|
995
|
-
}
|
|
996
|
-
const checkbox_default2 = Checkbox
|
|
997
|
-
|
|
998
|
-
// ../../node_modules/material/src/component/controller.js
|
|
999
|
-
let instance = null
|
|
1000
|
-
const Controller = class {
|
|
1001
|
-
constructor () {
|
|
1002
|
-
if (!instance) {
|
|
1003
|
-
instance = this
|
|
1004
|
-
}
|
|
1005
|
-
this.components = this.components || []
|
|
1006
|
-
this.component = this.component || {}
|
|
1007
|
-
this.init()
|
|
1008
|
-
return instance
|
|
1009
|
-
}
|
|
1010
|
-
|
|
1011
|
-
init () {
|
|
1012
|
-
this.subscribe('settings', (message) => {
|
|
1013
|
-
})
|
|
1014
|
-
}
|
|
1015
|
-
|
|
1016
|
-
register (component) {
|
|
1017
|
-
this.components.push(component)
|
|
1018
|
-
this.component[component.name] = this.component[component.name] || []
|
|
1019
|
-
this.component[component.name].push(component)
|
|
1020
|
-
return this
|
|
1021
|
-
}
|
|
1022
|
-
|
|
1023
|
-
subscribe (topic, callback) {
|
|
1024
|
-
this._topics = this._topics || {}
|
|
1025
|
-
if (!this._topics.hasOwnProperty(topic)) {
|
|
1026
|
-
this._topics[topic] = []
|
|
1027
|
-
}
|
|
1028
|
-
this._topics[topic].push(callback)
|
|
1029
|
-
return true
|
|
1030
|
-
}
|
|
1031
|
-
|
|
1032
|
-
unsunscribe (topic, callback) {
|
|
1033
|
-
this._topics = this._topics || {}
|
|
1034
|
-
if (!this._topics.hasOwnProperty(topic)) {
|
|
1035
|
-
return false
|
|
1036
|
-
}
|
|
1037
|
-
for (let i = 0, len = this._topics[topic].length; i < len; i++) {
|
|
1038
|
-
if (this._topics[topic][i] === callback) {
|
|
1039
|
-
this._topics[topic].splice(i, 1)
|
|
1040
|
-
return true
|
|
1041
|
-
}
|
|
1042
|
-
}
|
|
1043
|
-
return false
|
|
1044
|
-
}
|
|
1045
|
-
|
|
1046
|
-
publish () {
|
|
1047
|
-
this._topics = this._topics || {}
|
|
1048
|
-
const args = Array.prototype.slice.call(arguments)
|
|
1049
|
-
const topic = args.shift()
|
|
1050
|
-
if (!this._topics.hasOwnProperty(topic)) {
|
|
1051
|
-
return false
|
|
1052
|
-
}
|
|
1053
|
-
for (let i = 0, len = this._topics[topic].length; i < len; i++) {
|
|
1054
|
-
this._topics[topic][i].apply(void 0, args)
|
|
1055
|
-
}
|
|
1056
|
-
return true
|
|
1057
|
-
}
|
|
1058
|
-
}
|
|
1059
|
-
const controller = new Controller()
|
|
1060
|
-
const controller_default = controller
|
|
1061
|
-
|
|
1062
|
-
// ../../node_modules/material/src/divider.js
|
|
1063
|
-
const defaults7 = {
|
|
1064
|
-
prefix: 'material',
|
|
1065
|
-
class: 'divider',
|
|
1066
|
-
tag: 'span'
|
|
1067
|
-
}
|
|
1068
|
-
const Divider = class {
|
|
1069
|
-
constructor (options) {
|
|
1070
|
-
this.init(options)
|
|
1071
|
-
this.build()
|
|
1072
|
-
return this
|
|
1073
|
-
}
|
|
1074
|
-
|
|
1075
|
-
init (options) {
|
|
1076
|
-
this.options = Object.assign({}, defaults7, options || {})
|
|
1077
|
-
Object.assign(this, insert_default2)
|
|
1078
|
-
}
|
|
1079
|
-
|
|
1080
|
-
build () {
|
|
1081
|
-
this.root = create_default(this.options)
|
|
1082
|
-
if (this.options.text) {
|
|
1083
|
-
this.root.textContent = this.options.text
|
|
1084
|
-
}
|
|
1085
|
-
if (this.options.container) {
|
|
1086
|
-
this.insert(this.options.container)
|
|
1087
|
-
}
|
|
1088
|
-
}
|
|
1089
|
-
}
|
|
1090
|
-
const divider_default = Divider
|
|
1091
|
-
|
|
1092
|
-
// ../../node_modules/material/src/component/init.js
|
|
1093
|
-
function init3 (instance2) {
|
|
1094
|
-
modules(instance2)
|
|
1095
|
-
controller_default.register(instance2)
|
|
1096
|
-
return instance2
|
|
1097
|
-
}
|
|
1098
|
-
function modules (instance2) {
|
|
1099
|
-
const modules2 = instance2.options.modules
|
|
1100
|
-
for (let i = 0; i < modules2.length; i++) {
|
|
1101
|
-
if (typeof modules2[i] === 'function') {
|
|
1102
|
-
modules2[i](instance2)
|
|
1103
|
-
} else {
|
|
1104
|
-
Object.assign(instance2, modules2[i])
|
|
1105
|
-
}
|
|
1106
|
-
}
|
|
1107
|
-
}
|
|
1108
|
-
const init_default = init3
|
|
1109
|
-
|
|
1110
|
-
// ../../node_modules/material/src/drawer.js
|
|
1111
|
-
const defaults8 = {
|
|
1112
|
-
prefix: 'material',
|
|
1113
|
-
class: 'drawer',
|
|
1114
|
-
modifier: 'width',
|
|
1115
|
-
state: 'closed',
|
|
1116
|
-
position: 'left',
|
|
1117
|
-
tag: 'div',
|
|
1118
|
-
width: '340',
|
|
1119
|
-
modules: [emitter_default, events_default]
|
|
1120
|
-
}
|
|
1121
|
-
const Drawer = class {
|
|
1122
|
-
constructor (options) {
|
|
1123
|
-
this.options = Object.assign({}, defaults8, options || {})
|
|
1124
|
-
init_default(this)
|
|
1125
|
-
this.build()
|
|
1126
|
-
this.attach()
|
|
1127
|
-
this.emit('ready')
|
|
1128
|
-
return this
|
|
1129
|
-
}
|
|
1130
|
-
|
|
1131
|
-
build () {
|
|
1132
|
-
this.wrapper = create_default2('div')
|
|
1133
|
-
classify_default(this.wrapper, this.options)
|
|
1134
|
-
this.root = create_default2('aside')
|
|
1135
|
-
css_default.add(this.root, 'drawer-panel')
|
|
1136
|
-
insert_default(this.root, this.wrapper)
|
|
1137
|
-
if (this.options.position) {
|
|
1138
|
-
css_default.add(this.root, 'position-' + this.options.position)
|
|
1139
|
-
}
|
|
1140
|
-
if (this.options.fixed) {
|
|
1141
|
-
this.wrapper.classList.add('is-fixed')
|
|
1142
|
-
}
|
|
1143
|
-
if (this.options.size) {
|
|
1144
|
-
if (this.options.position === 'top' || this.options.position === 'bottom') {
|
|
1145
|
-
this.root.style = 'height: ' + this.options.size + 'px;'
|
|
1146
|
-
} else {
|
|
1147
|
-
this.root.style = 'width: ' + this.options.size + 'px;'
|
|
1148
|
-
}
|
|
1149
|
-
}
|
|
1150
|
-
if (this.options.container) {
|
|
1151
|
-
insert_default(this.wrapper, this.options.container)
|
|
1152
|
-
}
|
|
1153
|
-
this.emit('built', this.root)
|
|
1154
|
-
return this
|
|
1155
|
-
}
|
|
1156
|
-
|
|
1157
|
-
attach () {
|
|
1158
|
-
this.wrapper.addEventListener('click', (e2) => {
|
|
1159
|
-
console.log(' click close')
|
|
1160
|
-
this.close()
|
|
1161
|
-
})
|
|
1162
|
-
}
|
|
1163
|
-
|
|
1164
|
-
toggle () {
|
|
1165
|
-
if (this.wrapper.classList.contains('show')) {
|
|
1166
|
-
this.close()
|
|
1167
|
-
} else {
|
|
1168
|
-
this.open()
|
|
1169
|
-
}
|
|
1170
|
-
return this
|
|
1171
|
-
}
|
|
1172
|
-
|
|
1173
|
-
close () {
|
|
1174
|
-
css_default.remove(this.wrapper, 'show')
|
|
1175
|
-
return this
|
|
1176
|
-
}
|
|
1177
|
-
|
|
1178
|
-
open () {
|
|
1179
|
-
css_default.add(this.wrapper, 'show')
|
|
1180
|
-
return this
|
|
1181
|
-
}
|
|
1182
|
-
|
|
1183
|
-
insert (container, context) {
|
|
1184
|
-
insert_default(this.wrapper, container, context)
|
|
1185
|
-
return this
|
|
1186
|
-
}
|
|
1187
|
-
}
|
|
1188
|
-
const drawer_default = Drawer
|
|
1189
|
-
|
|
1190
|
-
// ../../node_modules/material/src/item.js
|
|
1191
|
-
const defaults9 = {
|
|
1192
|
-
prefix: 'material',
|
|
1193
|
-
class: 'item',
|
|
1194
|
-
type: 'default',
|
|
1195
|
-
tag: 'li',
|
|
1196
|
-
types: {
|
|
1197
|
-
default: 'span',
|
|
1198
|
-
display4: 'h1',
|
|
1199
|
-
display3: 'h1',
|
|
1200
|
-
display2: 'h1',
|
|
1201
|
-
display1: 'h1',
|
|
1202
|
-
headline: 'h1',
|
|
1203
|
-
title: 'h2',
|
|
1204
|
-
subheading2: 'h3',
|
|
1205
|
-
subheading1: 'h4',
|
|
1206
|
-
body: 'p',
|
|
1207
|
-
body2: 'aside',
|
|
1208
|
-
caption: 'span'
|
|
1209
|
-
}
|
|
1210
|
-
}
|
|
1211
|
-
const Item = class {
|
|
1212
|
-
constructor (options) {
|
|
1213
|
-
this.init(options)
|
|
1214
|
-
this.build()
|
|
1215
|
-
return this
|
|
1216
|
-
}
|
|
1217
|
-
|
|
1218
|
-
init (options) {
|
|
1219
|
-
this.options = Object.assign({}, defaults9, options || {})
|
|
1220
|
-
Object.assign(this, insert_default2)
|
|
1221
|
-
}
|
|
1222
|
-
|
|
1223
|
-
build () {
|
|
1224
|
-
this.options.tag = this.options.tag || this.options.types[this.options.type]
|
|
1225
|
-
this.options.tag = this.options.tag
|
|
1226
|
-
this.root = create_default(this.options)
|
|
1227
|
-
if (this.options.text) {
|
|
1228
|
-
this.set(this.options.text)
|
|
1229
|
-
}
|
|
1230
|
-
if (this.options.layout) {
|
|
1231
|
-
this.layout = new layout_default(this.options.layout, this.root)
|
|
1232
|
-
} else {
|
|
1233
|
-
if (this.options.container) {
|
|
1234
|
-
this.insert(this.options.container)
|
|
1235
|
-
}
|
|
1236
|
-
}
|
|
1237
|
-
}
|
|
1238
|
-
|
|
1239
|
-
set (value) {
|
|
1240
|
-
if (value) {
|
|
1241
|
-
if (this.root.innerText) {
|
|
1242
|
-
this.root.innerText = value
|
|
1243
|
-
} else {
|
|
1244
|
-
this.root.textContent = value
|
|
1245
|
-
}
|
|
1246
|
-
return this
|
|
1247
|
-
}
|
|
1248
|
-
return this
|
|
1249
|
-
}
|
|
1250
|
-
}
|
|
1251
|
-
const item_default = Item
|
|
1252
|
-
|
|
1253
|
-
// ../../node_modules/material/src/list.js
|
|
1254
|
-
const defaults10 = {
|
|
1255
|
-
prefix: 'material',
|
|
1256
|
-
class: 'list',
|
|
1257
|
-
tag: 'ul',
|
|
1258
|
-
functions: ['render', 'select'],
|
|
1259
|
-
target: '.material-item',
|
|
1260
|
-
events: [
|
|
1261
|
-
['root.click', 'handleSelect']
|
|
1262
|
-
]
|
|
1263
|
-
}
|
|
1264
|
-
const List = class {
|
|
1265
|
-
constructor (options) {
|
|
1266
|
-
this.options = Object.assign({}, defaults10, options || {})
|
|
1267
|
-
this.init(this.options)
|
|
1268
|
-
this.build(this.options)
|
|
1269
|
-
this.attach(this.options.events)
|
|
1270
|
-
return this
|
|
1271
|
-
}
|
|
1272
|
-
|
|
1273
|
-
init () {
|
|
1274
|
-
this.filters = []
|
|
1275
|
-
this.data = []
|
|
1276
|
-
this.items = []
|
|
1277
|
-
Object.assign(this, emitter_default, attach_default)
|
|
1278
|
-
this._initFunction(this.options.functions)
|
|
1279
|
-
return this
|
|
1280
|
-
}
|
|
1281
|
-
|
|
1282
|
-
_initFunction (functions) {
|
|
1283
|
-
for (let i = 0; i < functions.length; i++) {
|
|
1284
|
-
const name = functions[i]
|
|
1285
|
-
if (this.options[name]) {
|
|
1286
|
-
this[name] = this.options[name]
|
|
1287
|
-
}
|
|
1288
|
-
}
|
|
1289
|
-
}
|
|
1290
|
-
|
|
1291
|
-
build (options) {
|
|
1292
|
-
const tag = this.options.tag || 'ul'
|
|
1293
|
-
this.root = document.createElement(tag)
|
|
1294
|
-
css_default.add(this.root, 'material-' + this.options.class)
|
|
1295
|
-
if (options.name) {
|
|
1296
|
-
css_default.add(this.root, options.class + '-' + options.name)
|
|
1297
|
-
}
|
|
1298
|
-
if (options.type) {
|
|
1299
|
-
css_default.add(this.root, 'type-' + options.type)
|
|
1300
|
-
}
|
|
1301
|
-
if (options.layout) {
|
|
1302
|
-
css_default.add(this.root, 'layout-' + options.layout)
|
|
1303
|
-
}
|
|
1304
|
-
if (this.options.list) {
|
|
1305
|
-
this.set('list', this.options.list)
|
|
1306
|
-
}
|
|
1307
|
-
if (this.options.container) {
|
|
1308
|
-
insert_default(this.root, this.options.container)
|
|
1309
|
-
}
|
|
1310
|
-
return this
|
|
1311
|
-
}
|
|
1312
|
-
|
|
1313
|
-
handleSelect (e2) {
|
|
1314
|
-
if (e2.target && e2.target.matches(this.options.target)) {
|
|
1315
|
-
css_default.remove(this.item, 'is-selected')
|
|
1316
|
-
css_default.add(e2.target, 'is-selected')
|
|
1317
|
-
this.select(e2.target, e2, this.item)
|
|
1318
|
-
this.item = e2.target
|
|
1319
|
-
}
|
|
1320
|
-
}
|
|
1321
|
-
|
|
1322
|
-
select (item, e2, selected) {
|
|
1323
|
-
this.emit('select', item)
|
|
1324
|
-
}
|
|
1325
|
-
|
|
1326
|
-
render (info) {
|
|
1327
|
-
let item
|
|
1328
|
-
if (info.type === 'divider') {
|
|
1329
|
-
item = new divider_default()
|
|
1330
|
-
} else {
|
|
1331
|
-
item = new item_default({
|
|
1332
|
-
name: info.name,
|
|
1333
|
-
text: info.text || info.name
|
|
1334
|
-
})
|
|
1335
|
-
}
|
|
1336
|
-
return item
|
|
1337
|
-
}
|
|
1338
|
-
|
|
1339
|
-
set (prop, value, options) {
|
|
1340
|
-
switch (prop) {
|
|
1341
|
-
case 'list':
|
|
1342
|
-
this.setList(value, options)
|
|
1343
|
-
break
|
|
1344
|
-
default:
|
|
1345
|
-
this.setList(prop, options)
|
|
1346
|
-
}
|
|
1347
|
-
return this
|
|
1348
|
-
}
|
|
1349
|
-
|
|
1350
|
-
setList (list3) {
|
|
1351
|
-
for (let i = 0; i < list3.length; i++) {
|
|
1352
|
-
this.addItem(this.render(list3[i]), i)
|
|
1353
|
-
}
|
|
1354
|
-
return this
|
|
1355
|
-
}
|
|
1356
|
-
|
|
1357
|
-
addItem (item) {
|
|
1358
|
-
if (!item) {
|
|
1359
|
-
return
|
|
1360
|
-
}
|
|
1361
|
-
const where = 'bottom'
|
|
1362
|
-
insert_default(item.root, this.root, where)
|
|
1363
|
-
this.items.push(item)
|
|
1364
|
-
return item
|
|
1365
|
-
}
|
|
1366
|
-
|
|
1367
|
-
insert (container, context) {
|
|
1368
|
-
insert_default(this.root, container, context)
|
|
1369
|
-
}
|
|
1370
|
-
|
|
1371
|
-
empty () {
|
|
1372
|
-
this.root.innerHTML = ''
|
|
1373
|
-
this.items = []
|
|
1374
|
-
this.item = null
|
|
1375
|
-
}
|
|
1376
|
-
|
|
1377
|
-
reverse () {
|
|
1378
|
-
this.list.reverse()
|
|
1379
|
-
this.update(this.list)
|
|
1380
|
-
return this
|
|
1381
|
-
}
|
|
1382
|
-
}
|
|
1383
|
-
const list_default = List
|
|
1384
|
-
|
|
1385
|
-
// ../../node_modules/material/src/progress.js
|
|
1386
|
-
const defaults11 = {
|
|
1387
|
-
prefix: 'material',
|
|
1388
|
-
class: 'progress',
|
|
1389
|
-
tag: 'div',
|
|
1390
|
-
progress: '0%',
|
|
1391
|
-
circular: `<svg class="progress" width="65px" height="65px" viewBox="0 0 66 66" xmlns="http://www.w3.org/2000/svg">
|
|
1392
|
-
<circle class="path" fill="none" stroke-width="6" stroke-linecap="round" cx="33" cy="33" r="30"></circle>
|
|
1393
|
-
</svg>`
|
|
1394
|
-
}
|
|
1395
|
-
const Spinner = class {
|
|
1396
|
-
constructor (options) {
|
|
1397
|
-
this.init(options)
|
|
1398
|
-
this.build()
|
|
1399
|
-
return this
|
|
1400
|
-
}
|
|
1401
|
-
|
|
1402
|
-
init (options) {
|
|
1403
|
-
this.options = Object.assign({}, defaults11, options || {})
|
|
1404
|
-
Object.assign(this, insert_default)
|
|
1405
|
-
}
|
|
1406
|
-
|
|
1407
|
-
build (options) {
|
|
1408
|
-
this.root = create_default2(this.options.tag)
|
|
1409
|
-
classify_default(this.root, this.options)
|
|
1410
|
-
if (this.options.type === 'circular') {
|
|
1411
|
-
this.root.innerHTML = this.options.circular
|
|
1412
|
-
}
|
|
1413
|
-
if (this.options.type === 'indeterminate') {
|
|
1414
|
-
this.bar = create_default2('div', 'bar')
|
|
1415
|
-
insert_default(this.bar, this.root)
|
|
1416
|
-
} else {
|
|
1417
|
-
this.bar = create_default2('div', 'bar')
|
|
1418
|
-
insert_default(this.bar, this.root)
|
|
1419
|
-
this.set(this.options.progress)
|
|
1420
|
-
}
|
|
1421
|
-
if (this.options.container) {
|
|
1422
|
-
insert_default(this.root, this.options.container)
|
|
1423
|
-
}
|
|
1424
|
-
return this
|
|
1425
|
-
}
|
|
1426
|
-
|
|
1427
|
-
set (progress) {
|
|
1428
|
-
this.bar.setAttribute('style', 'width: ' + progress)
|
|
1429
|
-
}
|
|
1430
|
-
}
|
|
1431
|
-
const progress_default = Spinner
|
|
1432
|
-
|
|
1433
|
-
// ../../node_modules/material/src/skin/material/icon/pin.svg
|
|
1434
|
-
const pin_default = 'export default `\n<svg width="24px" class="slider-pin" height="32px" viewBox="0 0 24 32">\n <path d="M12.4799395,31.9994146 C12.4799395,31.9994146 24,18.0312233 24,11.6159251 C24,5.2006268 18.627417,0 12,0 C5.372583,0 0,5.2006268 0,11.6159251 C0,18.0312233 12.4799395,31.9994146 12.4799395,31.9994146 Z"></path>\n</svg>`;'
|
|
1435
|
-
|
|
1436
|
-
// ../../node_modules/material/src/slider.js
|
|
1437
|
-
const defaults12 = {
|
|
1438
|
-
prefix: 'material',
|
|
1439
|
-
class: 'slider',
|
|
1440
|
-
type: 'control',
|
|
1441
|
-
label: null,
|
|
1442
|
-
checked: false,
|
|
1443
|
-
error: false,
|
|
1444
|
-
value: false,
|
|
1445
|
-
range: [0, 100],
|
|
1446
|
-
step: 5,
|
|
1447
|
-
modules: [events_default, control_default, emitter_default, attach_default],
|
|
1448
|
-
mixins: [],
|
|
1449
|
-
build: [
|
|
1450
|
-
'$root.material-slider',
|
|
1451
|
-
{},
|
|
1452
|
-
['label$label.slider-label', {}],
|
|
1453
|
-
['input$input'],
|
|
1454
|
-
[
|
|
1455
|
-
'$control.slider-control',
|
|
1456
|
-
{},
|
|
1457
|
-
[
|
|
1458
|
-
'$track.slider-track',
|
|
1459
|
-
{},
|
|
1460
|
-
['canvas$canvas.slider-canvas', {}],
|
|
1461
|
-
['$trackvalue.slider-track-value', {}],
|
|
1462
|
-
['$knob.slider-knob', {}],
|
|
1463
|
-
[
|
|
1464
|
-
'$marker.slider-marker',
|
|
1465
|
-
{},
|
|
1466
|
-
['$value.slider-value', {}]
|
|
1467
|
-
]
|
|
1468
|
-
]
|
|
1469
|
-
]
|
|
1470
|
-
],
|
|
1471
|
-
events: [
|
|
1472
|
-
['element.input.focus', 'focus'],
|
|
1473
|
-
['element.input.blur', 'blur']
|
|
1474
|
-
]
|
|
1475
|
-
}
|
|
1476
|
-
const Slider = class {
|
|
1477
|
-
constructor (options) {
|
|
1478
|
-
this.options = Object.assign({}, defaults12, options || {})
|
|
1479
|
-
this.init(this.options)
|
|
1480
|
-
this.build(this.options)
|
|
1481
|
-
this.attach()
|
|
1482
|
-
return this
|
|
1483
|
-
}
|
|
1484
|
-
|
|
1485
|
-
init (options) {
|
|
1486
|
-
init_default(this)
|
|
1487
|
-
return this
|
|
1488
|
-
}
|
|
1489
|
-
|
|
1490
|
-
build () {
|
|
1491
|
-
this.element = build_default(this.options.build)
|
|
1492
|
-
this.root = this.element.root
|
|
1493
|
-
classify_default(this.root, this.options)
|
|
1494
|
-
if (this.options.container) {
|
|
1495
|
-
insert_default(this.root, this.options.container)
|
|
1496
|
-
}
|
|
1497
|
-
const value = this.element.marker.innerHTML
|
|
1498
|
-
this.element.marker.innerHTML = pin_default + value
|
|
1499
|
-
if (this.options.type) {
|
|
1500
|
-
css_default.add(this.root, 'type-' + this.options.type)
|
|
1501
|
-
}
|
|
1502
|
-
if (this.options.disabled) {
|
|
1503
|
-
this.disable(true)
|
|
1504
|
-
}
|
|
1505
|
-
const text = this.options.label || this.options.text
|
|
1506
|
-
this.element.label.textContent = text
|
|
1507
|
-
this.options.label = this.options.label || this.options.text
|
|
1508
|
-
this.initTrack()
|
|
1509
|
-
const delay = 50
|
|
1510
|
-
setTimeout(() => {
|
|
1511
|
-
this.initCanvas()
|
|
1512
|
-
}, delay)
|
|
1513
|
-
}
|
|
1514
|
-
|
|
1515
|
-
initCanvas () {
|
|
1516
|
-
window.addEventListener('resize', () => {
|
|
1517
|
-
console.log('resize')
|
|
1518
|
-
this.drawCanvas()
|
|
1519
|
-
}, false)
|
|
1520
|
-
this.drawCanvas()
|
|
1521
|
-
}
|
|
1522
|
-
|
|
1523
|
-
drawCanvas () {
|
|
1524
|
-
const width = offset_default(this.element.track, 'width')
|
|
1525
|
-
const height = offset_default(this.element.track, 'height')
|
|
1526
|
-
this.element.canvas.width = width
|
|
1527
|
-
this.element.canvas.height = height
|
|
1528
|
-
const context = this.element.canvas.getContext('2d')
|
|
1529
|
-
context.lineWidth = 2
|
|
1530
|
-
context.beginPath()
|
|
1531
|
-
context.moveTo(0, height / 2 + 1)
|
|
1532
|
-
context.lineTo(width, height / 2 + 1)
|
|
1533
|
-
context.strokeStyle = 'rgba(34, 31, 31, .26)'
|
|
1534
|
-
context.stroke()
|
|
1535
|
-
}
|
|
1536
|
-
|
|
1537
|
-
initTrack () {
|
|
1538
|
-
this.element.track.addEventListener('mousedown', (ev) => {
|
|
1539
|
-
if (this.disabled === true) { return }
|
|
1540
|
-
this.initTrackSize()
|
|
1541
|
-
const position = ev.layerX
|
|
1542
|
-
this.update(position)
|
|
1543
|
-
})
|
|
1544
|
-
this.element.knob.addEventListener('click', (ev) => {
|
|
1545
|
-
ev.stopPropagation()
|
|
1546
|
-
})
|
|
1547
|
-
this.initDragging()
|
|
1548
|
-
const delay = 100
|
|
1549
|
-
setTimeout(() => {
|
|
1550
|
-
this.setValue(this.options.value)
|
|
1551
|
-
}, delay)
|
|
1552
|
-
}
|
|
1553
|
-
|
|
1554
|
-
initTrackSize () {
|
|
1555
|
-
this._tracksize = offset_default(this.element.track, 'width')
|
|
1556
|
-
this._knobsize = offset_default(this.element.knob, 'width')
|
|
1557
|
-
this._markersize = 32
|
|
1558
|
-
this._trackleft = offset_default(this.element.track, 'left')
|
|
1559
|
-
return this
|
|
1560
|
-
}
|
|
1561
|
-
|
|
1562
|
-
initDragging () {
|
|
1563
|
-
this.element.knob.onmousedown = (e2) => {
|
|
1564
|
-
if (this.disabled === true) { return }
|
|
1565
|
-
e2.stopPropagation()
|
|
1566
|
-
e2 = e2 || window.event
|
|
1567
|
-
css_default.add(this.element.control, 'dragging')
|
|
1568
|
-
let start = 0
|
|
1569
|
-
let position = 0
|
|
1570
|
-
if (e2.pageX) { start = e2.pageX } else if (e2.clientX) { start = e2.clientX }
|
|
1571
|
-
start = this._trackleft
|
|
1572
|
-
document.body.onmousemove = (e3) => {
|
|
1573
|
-
if (this.disabled === true) { return }
|
|
1574
|
-
console.log('mousedown', this.disabled)
|
|
1575
|
-
e3 = e3 || window.event
|
|
1576
|
-
let end = 0
|
|
1577
|
-
if (e3.pageX) { end = e3.pageX } else if (e3.clientX) { end = e3.clientX }
|
|
1578
|
-
position = end - start
|
|
1579
|
-
this.update(position)
|
|
1580
|
-
}
|
|
1581
|
-
document.body.onmouseup = (e3) => {
|
|
1582
|
-
document.body.onmousemove = document.body.onmouseup = null
|
|
1583
|
-
e3 = e3 || window.event
|
|
1584
|
-
let end = 0
|
|
1585
|
-
if (e3.pageX) { end = e3.pageX } else if (e3.clientX) { end = e3.clientX }
|
|
1586
|
-
position = end - start
|
|
1587
|
-
this.update(position)
|
|
1588
|
-
css_default.remove(this.element.control, 'dragging')
|
|
1589
|
-
}
|
|
1590
|
-
}
|
|
1591
|
-
}
|
|
1592
|
-
|
|
1593
|
-
update (position) {
|
|
1594
|
-
const size = this._tracksize
|
|
1595
|
-
const range = this.options.range[1] - this.options.range[0]
|
|
1596
|
-
if (position > size) {
|
|
1597
|
-
position = size
|
|
1598
|
-
}
|
|
1599
|
-
if (position < 0) {
|
|
1600
|
-
position = 0
|
|
1601
|
-
}
|
|
1602
|
-
const ratio = size / position
|
|
1603
|
-
const value = Math.round(range / ratio) + this.options.range[0]
|
|
1604
|
-
if (position === 0) {
|
|
1605
|
-
css_default.remove(this.element.knob, 'notnull')
|
|
1606
|
-
}
|
|
1607
|
-
this.element.knob.style.left = position - this._knobsize / 2 + 'px'
|
|
1608
|
-
this.element.trackvalue.style.width = position + 'px'
|
|
1609
|
-
this.element.marker.style.left = position - this._markersize / 2 + 'px'
|
|
1610
|
-
this.element.value.textContent = value
|
|
1611
|
-
this.element.input.value = value
|
|
1612
|
-
if (value > this.options.range[0]) {
|
|
1613
|
-
css_default.add(this.element.knob, 'notnull')
|
|
1614
|
-
} else {
|
|
1615
|
-
css_default.remove(this.element.knob, 'notnull')
|
|
1616
|
-
}
|
|
1617
|
-
}
|
|
1618
|
-
|
|
1619
|
-
updateValue (value) {
|
|
1620
|
-
this.initTrackSize()
|
|
1621
|
-
let size = offset_default(this.element.track, 'width')
|
|
1622
|
-
size = parseInt(size)
|
|
1623
|
-
const range = this.options.range[1] - this.options.range[0]
|
|
1624
|
-
const ratio = value * 100 / range
|
|
1625
|
-
const position = Math.round(size * ratio / 100)
|
|
1626
|
-
this.update(position)
|
|
1627
|
-
return this
|
|
1628
|
-
}
|
|
1629
|
-
|
|
1630
|
-
insert (container, context) {
|
|
1631
|
-
insert_default(this.root, container, context)
|
|
1632
|
-
}
|
|
1633
|
-
|
|
1634
|
-
set (prop, value) {
|
|
1635
|
-
switch (prop) {
|
|
1636
|
-
case 'value':
|
|
1637
|
-
this.setValue(value)
|
|
1638
|
-
break
|
|
1639
|
-
case 'label':
|
|
1640
|
-
this.setLabel(value)
|
|
1641
|
-
break
|
|
1642
|
-
default:
|
|
1643
|
-
this.setValue(prop)
|
|
1644
|
-
}
|
|
1645
|
-
return this
|
|
1646
|
-
}
|
|
1647
|
-
|
|
1648
|
-
get (prop) {
|
|
1649
|
-
let value
|
|
1650
|
-
switch (prop) {
|
|
1651
|
-
case 'value':
|
|
1652
|
-
value = this.getValue()
|
|
1653
|
-
break
|
|
1654
|
-
case 'name':
|
|
1655
|
-
value = this.name
|
|
1656
|
-
break
|
|
1657
|
-
default:
|
|
1658
|
-
return this.getValue()
|
|
1659
|
-
}
|
|
1660
|
-
return value
|
|
1661
|
-
}
|
|
1662
|
-
|
|
1663
|
-
getValue () {
|
|
1664
|
-
return this.element.input.value
|
|
1665
|
-
}
|
|
1666
|
-
|
|
1667
|
-
setValue (value) {
|
|
1668
|
-
value = value || this.options.range[0]
|
|
1669
|
-
this.element.input.value = value
|
|
1670
|
-
this.updateValue(value)
|
|
1671
|
-
}
|
|
1672
|
-
|
|
1673
|
-
setLabel (text) {
|
|
1674
|
-
text = text || this.options.label || this.options.text
|
|
1675
|
-
if (text !== null && this.label) {
|
|
1676
|
-
this.label.textContent = text
|
|
1677
|
-
}
|
|
1678
|
-
}
|
|
1679
|
-
}
|
|
1680
|
-
const slider_default = Slider
|
|
1681
|
-
|
|
1682
|
-
// ../../node_modules/material/src/switch.js
|
|
1683
|
-
const defaults13 = {
|
|
1684
|
-
prefix: 'material',
|
|
1685
|
-
class: 'switch',
|
|
1686
|
-
type: 'control',
|
|
1687
|
-
label: null,
|
|
1688
|
-
checked: false,
|
|
1689
|
-
error: false,
|
|
1690
|
-
value: false,
|
|
1691
|
-
disabled: false,
|
|
1692
|
-
build: [
|
|
1693
|
-
'$root.material-switch',
|
|
1694
|
-
{},
|
|
1695
|
-
['input$input$switch-input', { type: 'checkbox' }],
|
|
1696
|
-
[
|
|
1697
|
-
'span$control.switch-control',
|
|
1698
|
-
{},
|
|
1699
|
-
[
|
|
1700
|
-
'span$track.switch-track',
|
|
1701
|
-
{},
|
|
1702
|
-
['span$knob.switch-knob', {}]
|
|
1703
|
-
]
|
|
1704
|
-
],
|
|
1705
|
-
['label$label.switch-label']
|
|
1706
|
-
],
|
|
1707
|
-
events: [
|
|
1708
|
-
['element.control.click', 'toggle'],
|
|
1709
|
-
['element.label.click', 'toggle'],
|
|
1710
|
-
['element.input.click', 'toggle'],
|
|
1711
|
-
['element.input.focus', 'focus'],
|
|
1712
|
-
['element.input.blur', 'blur']
|
|
1713
|
-
]
|
|
1714
|
-
}
|
|
1715
|
-
const Switch = class {
|
|
1716
|
-
constructor (options) {
|
|
1717
|
-
this.init(options)
|
|
1718
|
-
this.build()
|
|
1719
|
-
this.attach()
|
|
1720
|
-
return this
|
|
1721
|
-
}
|
|
1722
|
-
|
|
1723
|
-
init (options) {
|
|
1724
|
-
this.options = Object.assign({}, defaults13, options || {})
|
|
1725
|
-
Object.assign(this, emitter_default, control_default, attach_default, insert_default2)
|
|
1726
|
-
this.value = this.options.value
|
|
1727
|
-
return this
|
|
1728
|
-
}
|
|
1729
|
-
|
|
1730
|
-
build () {
|
|
1731
|
-
this.element = build_default(this.options.build)
|
|
1732
|
-
this.root = this.element.root
|
|
1733
|
-
classify_default(this.root, this.options)
|
|
1734
|
-
if (this.options.disabled) {
|
|
1735
|
-
this.disable()
|
|
1736
|
-
}
|
|
1737
|
-
if (this.value) {
|
|
1738
|
-
this.element.input.setAttribute('checked', 'checked')
|
|
1739
|
-
}
|
|
1740
|
-
this.element.input.setAttribute('aria-label', this.options.name)
|
|
1741
|
-
const text = this.options.label || this.options.text || ''
|
|
1742
|
-
this.element.label.textContent = text
|
|
1743
|
-
this.element.label.setAttribute('for', this.options.name)
|
|
1744
|
-
if (this.options.checked) {
|
|
1745
|
-
this.check(true)
|
|
1746
|
-
}
|
|
1747
|
-
if (this.options.container) {
|
|
1748
|
-
this.insert(this.options.container)
|
|
1749
|
-
}
|
|
1750
|
-
}
|
|
1751
|
-
|
|
1752
|
-
set (prop, value) {
|
|
1753
|
-
switch (prop) {
|
|
1754
|
-
case 'value':
|
|
1755
|
-
this.setValue(value)
|
|
1756
|
-
break
|
|
1757
|
-
case 'disabled':
|
|
1758
|
-
if (value === true) {
|
|
1759
|
-
this.disable()
|
|
1760
|
-
} else if (value === false) {
|
|
1761
|
-
this.enable()
|
|
1762
|
-
}
|
|
1763
|
-
break
|
|
1764
|
-
default:
|
|
1765
|
-
this.setValue(prop)
|
|
1766
|
-
}
|
|
1767
|
-
return this
|
|
1768
|
-
}
|
|
1769
|
-
|
|
1770
|
-
get () {
|
|
1771
|
-
return this.value
|
|
1772
|
-
}
|
|
1773
|
-
|
|
1774
|
-
getValue () {
|
|
1775
|
-
return this.value
|
|
1776
|
-
}
|
|
1777
|
-
|
|
1778
|
-
setValue (value) {
|
|
1779
|
-
if (value) {
|
|
1780
|
-
this.check()
|
|
1781
|
-
} else {
|
|
1782
|
-
this.unCheck()
|
|
1783
|
-
}
|
|
1784
|
-
}
|
|
1785
|
-
}
|
|
1786
|
-
const switch_default = Switch
|
|
1787
|
-
|
|
1788
|
-
// ../../node_modules/material/src/tabs.js
|
|
1789
|
-
const defaults14 = {
|
|
1790
|
-
prefix: 'material',
|
|
1791
|
-
class: 'tabs',
|
|
1792
|
-
tag: 'div',
|
|
1793
|
-
indicator: {
|
|
1794
|
-
prefix: 'material',
|
|
1795
|
-
class: 'indicator',
|
|
1796
|
-
tag: 'div'
|
|
1797
|
-
}
|
|
1798
|
-
}
|
|
1799
|
-
const Tabs = class {
|
|
1800
|
-
constructor (options) {
|
|
1801
|
-
this.init(options)
|
|
1802
|
-
this.build()
|
|
1803
|
-
return this
|
|
1804
|
-
}
|
|
1805
|
-
|
|
1806
|
-
init (options) {
|
|
1807
|
-
this.options = Object.assign({}, defaults14, options || {})
|
|
1808
|
-
Object.assign(this, insert_default2, emitter_default)
|
|
1809
|
-
}
|
|
1810
|
-
|
|
1811
|
-
build () {
|
|
1812
|
-
this.root = create_default(this.options)
|
|
1813
|
-
if (this.options.list) {
|
|
1814
|
-
this.list = new list_default({
|
|
1815
|
-
list: this.options.list,
|
|
1816
|
-
target: '.material-button',
|
|
1817
|
-
height: 600,
|
|
1818
|
-
label: 'Flat',
|
|
1819
|
-
render: (info) => {
|
|
1820
|
-
let item
|
|
1821
|
-
item = new Button_default({
|
|
1822
|
-
name: info.name,
|
|
1823
|
-
text: info.text || info.name
|
|
1824
|
-
})
|
|
1825
|
-
return item
|
|
1826
|
-
},
|
|
1827
|
-
select: (item) => {
|
|
1828
|
-
console.log('click')
|
|
1829
|
-
this.selected = item
|
|
1830
|
-
this.click(item)
|
|
1831
|
-
}
|
|
1832
|
-
}).insert(this.root)
|
|
1833
|
-
}
|
|
1834
|
-
this.indicator = create_default(this.options.indicator)
|
|
1835
|
-
this.insertElement(this.indicator, this.root)
|
|
1836
|
-
if (this.options.container) {
|
|
1837
|
-
this.insert(this.options.container)
|
|
1838
|
-
}
|
|
1839
|
-
return this
|
|
1840
|
-
}
|
|
1841
|
-
|
|
1842
|
-
click (item) {
|
|
1843
|
-
const or = offset_default(this.root)
|
|
1844
|
-
const o = offset_default(item)
|
|
1845
|
-
this.indicator.setAttribute('style', 'width: ' + o.width + 'px; left: ' + (o.left - or.left) + 'px;')
|
|
1846
|
-
this.emit('select', item.dataset.name)
|
|
1847
|
-
}
|
|
1848
|
-
}
|
|
1849
|
-
const tabs_default = Tabs
|
|
1850
|
-
|
|
1851
|
-
// ../../node_modules/material/src/text.js
|
|
1852
|
-
const defaults15 = {
|
|
1853
|
-
prefix: 'material',
|
|
1854
|
-
class: 'text',
|
|
1855
|
-
type: 'default',
|
|
1856
|
-
types: {
|
|
1857
|
-
default: 'span',
|
|
1858
|
-
display4: 'h1',
|
|
1859
|
-
display3: 'h1',
|
|
1860
|
-
display2: 'h1',
|
|
1861
|
-
display1: 'h1',
|
|
1862
|
-
headline: 'h1',
|
|
1863
|
-
title: 'h2',
|
|
1864
|
-
subheading2: 'h3',
|
|
1865
|
-
subheading1: 'h4',
|
|
1866
|
-
body: 'p',
|
|
1867
|
-
body2: 'aside',
|
|
1868
|
-
caption: 'span'
|
|
1869
|
-
}
|
|
1870
|
-
}
|
|
1871
|
-
const Text = class {
|
|
1872
|
-
constructor (options) {
|
|
1873
|
-
this.init(options)
|
|
1874
|
-
this.build()
|
|
1875
|
-
return this
|
|
1876
|
-
}
|
|
1877
|
-
|
|
1878
|
-
init (options) {
|
|
1879
|
-
this.options = Object.assign({}, defaults15, options || {})
|
|
1880
|
-
Object.assign(this, insert_default2)
|
|
1881
|
-
}
|
|
1882
|
-
|
|
1883
|
-
build () {
|
|
1884
|
-
this.options.tag = this.options.types[this.options.type]
|
|
1885
|
-
this.root = create_default(this.options)
|
|
1886
|
-
if (this.options.text) {
|
|
1887
|
-
this.set(this.options.text)
|
|
1888
|
-
}
|
|
1889
|
-
if (this.options.container) {
|
|
1890
|
-
this.insert(this.options.container)
|
|
1891
|
-
}
|
|
1892
|
-
return this
|
|
1893
|
-
}
|
|
1894
|
-
|
|
1895
|
-
set (value) {
|
|
1896
|
-
if (value) {
|
|
1897
|
-
if (this.root.innerText) {
|
|
1898
|
-
this.root.innerText = value
|
|
1899
|
-
} else {
|
|
1900
|
-
this.root.textContent = value
|
|
1901
|
-
}
|
|
1902
|
-
return this
|
|
1903
|
-
}
|
|
1904
|
-
return this
|
|
1905
|
-
}
|
|
1906
|
-
}
|
|
1907
|
-
const text_default = Text
|
|
1908
|
-
|
|
1909
|
-
// ../../node_modules/material/src/toolbar.js
|
|
1910
|
-
const defaults16 = {
|
|
1911
|
-
prefix: 'material',
|
|
1912
|
-
class: 'toolbar',
|
|
1913
|
-
tag: 'header'
|
|
1914
|
-
}
|
|
1915
|
-
const Toolbar = class {
|
|
1916
|
-
constructor (options) {
|
|
1917
|
-
this.init(options)
|
|
1918
|
-
this.build()
|
|
1919
|
-
this.attach()
|
|
1920
|
-
return this
|
|
1921
|
-
}
|
|
1922
|
-
|
|
1923
|
-
init (options) {
|
|
1924
|
-
this.options = Object.assign({}, defaults16, options || {})
|
|
1925
|
-
Object.assign(this, insert_default2)
|
|
1926
|
-
console.log('waterfALL', this.options.waterfall)
|
|
1927
|
-
this.waterfall = this.options.waterfall
|
|
1928
|
-
}
|
|
1929
|
-
|
|
1930
|
-
build () {
|
|
1931
|
-
this.root = create_default(this.options)
|
|
1932
|
-
console.log(this.options.height, this.options.fixed)
|
|
1933
|
-
if (this.options.height) {
|
|
1934
|
-
this.root.style.height = this.options.height + 'px'
|
|
1935
|
-
}
|
|
1936
|
-
if (this.options.fixed) {
|
|
1937
|
-
console.log('is-fixed')
|
|
1938
|
-
this.root.classList.add('is-fixed')
|
|
1939
|
-
}
|
|
1940
|
-
if (this.options.flexible) {
|
|
1941
|
-
this.root.classList.add('is-flexible')
|
|
1942
|
-
}
|
|
1943
|
-
return this
|
|
1944
|
-
}
|
|
1945
|
-
|
|
1946
|
-
attach () {
|
|
1947
|
-
this.root.addEventListener('DOMNodeInserted', (e2) => {
|
|
1948
|
-
const textNode = e2.target
|
|
1949
|
-
if (textNode !== this.root) { return }
|
|
1950
|
-
const size = this.size = offset_default(this.root, 'height')
|
|
1951
|
-
const view = this.view = this.root.parentNode
|
|
1952
|
-
console.log('view', view)
|
|
1953
|
-
let padding = window.getComputedStyle(view)['padding-top']
|
|
1954
|
-
padding = parseInt(padding, 10)
|
|
1955
|
-
this.padding = padding
|
|
1956
|
-
const ptop = this.ptop = size + padding
|
|
1957
|
-
if (document.body == view) {
|
|
1958
|
-
console.log('toolbar container body')
|
|
1959
|
-
this.root.classList.add('toolbar-body')
|
|
1960
|
-
}
|
|
1961
|
-
view.setAttribute('style', 'padding-top: ' + ptop + 'px')
|
|
1962
|
-
this.scroll(view)
|
|
1963
|
-
})
|
|
1964
|
-
}
|
|
1965
|
-
|
|
1966
|
-
set (prop, value) {
|
|
1967
|
-
switch (prop) {
|
|
1968
|
-
case 'minimize':
|
|
1969
|
-
this.root.setAttribute('style', 'height: 64px')
|
|
1970
|
-
break
|
|
1971
|
-
case 'value':
|
|
1972
|
-
this.setValue(value)
|
|
1973
|
-
break
|
|
1974
|
-
case 'label':
|
|
1975
|
-
this.setLabel(value)
|
|
1976
|
-
break
|
|
1977
|
-
default:
|
|
1978
|
-
this.check(prop)
|
|
1979
|
-
}
|
|
1980
|
-
return this
|
|
1981
|
-
}
|
|
1982
|
-
|
|
1983
|
-
scroll (view) {
|
|
1984
|
-
let isBody = false
|
|
1985
|
-
let element = view
|
|
1986
|
-
this.scrolling = view
|
|
1987
|
-
if (view === document.body) {
|
|
1988
|
-
isBody = true
|
|
1989
|
-
element = document
|
|
1990
|
-
this.scrolling = document.body
|
|
1991
|
-
}
|
|
1992
|
-
view.classList.add()
|
|
1993
|
-
element.addEventListener('scroll', (e2) => {
|
|
1994
|
-
let scrollTop
|
|
1995
|
-
if (isBody) {
|
|
1996
|
-
scrollTop = (document.documentElement || document.body.parentNode || document.body).scrollTop
|
|
1997
|
-
} else {
|
|
1998
|
-
scrollTop = view.scrollTop
|
|
1999
|
-
}
|
|
2000
|
-
if (scrollTop > 0) {
|
|
2001
|
-
this.root.classList.add('is-scrolled')
|
|
2002
|
-
} else {
|
|
2003
|
-
this.root.classList.remove('is-scrolled')
|
|
2004
|
-
}
|
|
2005
|
-
this.update(e2, scrollTop)
|
|
2006
|
-
})
|
|
2007
|
-
}
|
|
2008
|
-
|
|
2009
|
-
update (e2, scrollTop) {
|
|
2010
|
-
if (this.options.fixed) {
|
|
2011
|
-
this.fixed(e2, scrollTop)
|
|
2012
|
-
}
|
|
2013
|
-
if (this.options.flexible) {
|
|
2014
|
-
this.flexible(e2, scrollTop)
|
|
2015
|
-
}
|
|
2016
|
-
}
|
|
2017
|
-
|
|
2018
|
-
flexible (e2, scrollTop) {
|
|
2019
|
-
const size = offset_default(this.root, 'height')
|
|
2020
|
-
let height = '64'
|
|
2021
|
-
if (size < height) {
|
|
2022
|
-
this.root.style.height = height + 'px'
|
|
2023
|
-
} else {
|
|
2024
|
-
height = this.size - scrollTop
|
|
2025
|
-
if (height < 64) { height = 64 }
|
|
2026
|
-
this.root.style.height = height + 'px'
|
|
2027
|
-
}
|
|
2028
|
-
}
|
|
2029
|
-
|
|
2030
|
-
fixed (e2, scrollTop) {
|
|
2031
|
-
if (scrollTop > 0) {
|
|
2032
|
-
this.root.style.transform = 'translateY(' + scrollTop + 'px)'
|
|
2033
|
-
} else {
|
|
2034
|
-
this.root.style.transform = 'translateY(' + scrollTop + 'px)'
|
|
2035
|
-
}
|
|
2036
|
-
}
|
|
2037
|
-
|
|
2038
|
-
waterfall$ (e2) {
|
|
2039
|
-
}
|
|
2040
|
-
}
|
|
2041
|
-
const toolbar_default = Toolbar
|
|
2042
|
-
|
|
2043
|
-
// src/module/css.js
|
|
2044
|
-
const has2 = (element, className) => {
|
|
2045
|
-
if (!element || !className) { return false }
|
|
2046
|
-
return !!element.className.match(new RegExp(`(\\s|^)${className}(\\s|$)`))
|
|
2047
|
-
}
|
|
2048
|
-
const add2 = (element, className) => {
|
|
2049
|
-
if (!element || !className) { return }
|
|
2050
|
-
const sanitizedClassName = className.trim().replace(/\s+/g, ' ')
|
|
2051
|
-
const classNames = sanitizedClassName.split(' ')
|
|
2052
|
-
for (const cn of classNames) {
|
|
2053
|
-
if (!has2(element, cn)) {
|
|
2054
|
-
element.classList.add(cn)
|
|
2055
|
-
}
|
|
2056
|
-
}
|
|
2057
|
-
return element
|
|
2058
|
-
}
|
|
2059
|
-
const remove4 = (element, className) => {
|
|
2060
|
-
if (!element || !className) { return }
|
|
2061
|
-
element.classList.remove(className)
|
|
2062
|
-
return element
|
|
2063
|
-
}
|
|
2064
|
-
const toggle2 = (element, className) => {
|
|
2065
|
-
if (has2(element, className)) {
|
|
2066
|
-
remove4(element, className)
|
|
2067
|
-
} else {
|
|
2068
|
-
add2(element, className)
|
|
2069
|
-
}
|
|
2070
|
-
return element
|
|
2071
|
-
}
|
|
2072
|
-
const css_default2 = { has: has2, add: add2, remove: remove4, toggle: toggle2 }
|
|
2073
|
-
|
|
2074
|
-
// dist/icon/navi.svg
|
|
2075
|
-
const navi_default = 'export default `\n<svg height="24" viewBox="0 0 24 24" width="24">\n <path d="M0 0h24v24H0z" fill="none" />\n <path d="M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z" />\n</svg>`;'
|
|
2076
|
-
|
|
2077
|
-
// dist/icon/more.svg
|
|
2078
|
-
const more_default = 'export default `\n<svg height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg">\n <path d="M0 0h24v24H0z" fill="none" />\n <path d="M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z" />\n</svg>`'
|
|
2079
|
-
|
|
2080
|
-
// dist/icon/star.svg
|
|
2081
|
-
const star_default = 'export default `\n<svg fill="#000000" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg">\n <path d="M0 0h24v24H0z" fill="none"/>\n <path d="M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z"/>\n <path d="M0 0h24v24H0z" fill="none"/>\n</svg>\n `;'
|
|
2082
|
-
|
|
2083
|
-
// dist/icon/happy.svg
|
|
2084
|
-
const happy_default = 'export default `\n<svg fill="#000000" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg">\n <path d="M11.99 2C6.47 2 2 6.47 2 12s4.47 10 9.99 10S22 17.53 22 12 17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8zm1-10.06L14.06 11l1.06-1.06L16.18 11l1.06-1.06-2.12-2.12zm-4.12 0L9.94 11 11 9.94 8.88 7.82 6.76 9.94 7.82 11zM12 17.5c2.33 0 4.31-1.46 5.11-3.5H6.89c.8 2.04 2.78 3.5 5.11 3.5z"/>\n <path d="M0 0h24v24H0z" fill="none"/>\n</svg>\n `'
|
|
2085
|
-
|
|
2086
|
-
// dist/demo.js
|
|
2087
|
-
console.log('demo')
|
|
2088
|
-
console.log('log')
|
|
2089
|
-
const list2 = [{
|
|
2090
|
-
text: 'One',
|
|
2091
|
-
name: 'one'
|
|
2092
|
-
}, {
|
|
2093
|
-
text: 'Two',
|
|
2094
|
-
name: 'two'
|
|
2095
|
-
}, {
|
|
2096
|
-
text: 'Three',
|
|
2097
|
-
name: 'three'
|
|
2098
|
-
}, {
|
|
2099
|
-
text: 'Four',
|
|
2100
|
-
name: 'four'
|
|
2101
|
-
}]
|
|
2102
|
-
document.addEventListener('DOMContentLoaded', function () {
|
|
2103
|
-
const layout = new layout_default([
|
|
2104
|
-
component_default,
|
|
2105
|
-
'demo',
|
|
2106
|
-
{ display: 'flex', direction: 'vertical' },
|
|
2107
|
-
[
|
|
2108
|
-
component_default,
|
|
2109
|
-
'head',
|
|
2110
|
-
{ display: 'flex', direction: 'horizontal' },
|
|
2111
|
-
[
|
|
2112
|
-
toolbar_default,
|
|
2113
|
-
'toolbar',
|
|
2114
|
-
{ flex: 1, display: 'flex', direction: 'horizontal' },
|
|
2115
|
-
[Button_default, 'menu-navi', { icon: navi_default, type: 'action' }],
|
|
2116
|
-
[text_default, 'app-title', { text: 'Material' }]
|
|
2117
|
-
],
|
|
2118
|
-
[
|
|
2119
|
-
toolbar_default,
|
|
2120
|
-
'desk',
|
|
2121
|
-
{ display: 'flex', direction: 'horizontal' },
|
|
2122
|
-
[Button_default, 'menu-more', { icon: more_default, type: 'action' }]
|
|
2123
|
-
]
|
|
2124
|
-
],
|
|
2125
|
-
[
|
|
2126
|
-
drawer_default,
|
|
2127
|
-
'navi',
|
|
2128
|
-
{ css: 'drawer-temporary', type: 'temporary', size: '280px' },
|
|
2129
|
-
[
|
|
2130
|
-
component_default,
|
|
2131
|
-
'navi-head',
|
|
2132
|
-
{ theme: 'dark' },
|
|
2133
|
-
[text_default, 'app-title', { text: 'Components' }]
|
|
2134
|
-
],
|
|
2135
|
-
[list_default, 'navi-list', { theme: 'dark' }]
|
|
2136
|
-
],
|
|
2137
|
-
[tabs_default, 'tabs', { color: 'primary', list: list2, flex: 'none' }],
|
|
2138
|
-
[
|
|
2139
|
-
container_default,
|
|
2140
|
-
'body',
|
|
2141
|
-
{ flex: '1' },
|
|
2142
|
-
[
|
|
2143
|
-
container_default,
|
|
2144
|
-
'container-components',
|
|
2145
|
-
{},
|
|
2146
|
-
[text_default, 'text', { text: 'Components', type: 'title' }]
|
|
2147
|
-
],
|
|
2148
|
-
[
|
|
2149
|
-
card_default,
|
|
2150
|
-
'buttons',
|
|
2151
|
-
{},
|
|
2152
|
-
[
|
|
2153
|
-
toolbar_default,
|
|
2154
|
-
'toolbar-buttons',
|
|
2155
|
-
{},
|
|
2156
|
-
[text_default, 'buttons-title', { text: 'Buttons' }]
|
|
2157
|
-
],
|
|
2158
|
-
[
|
|
2159
|
-
container_default,
|
|
2160
|
-
'button-body',
|
|
2161
|
-
{},
|
|
2162
|
-
[Button_default, 'first', { text: 'Flat' }],
|
|
2163
|
-
[Button_default, 'second', { text: 'Raised', type: 'raised', color: 'primary' }],
|
|
2164
|
-
[Button_default, 'third', { icon: star_default, type: 'action' }],
|
|
2165
|
-
[Button_default, 'fourth', { icon: star_default, text: 'text' }]
|
|
2166
|
-
]
|
|
2167
|
-
],
|
|
2168
|
-
[
|
|
2169
|
-
card_default,
|
|
2170
|
-
'buttons',
|
|
2171
|
-
{},
|
|
2172
|
-
[
|
|
2173
|
-
toolbar_default,
|
|
2174
|
-
'toolbar-buttons',
|
|
2175
|
-
{},
|
|
2176
|
-
[text_default, 'buttons-title', { text: 'Floating Buttons' }]
|
|
2177
|
-
],
|
|
2178
|
-
[
|
|
2179
|
-
container_default,
|
|
2180
|
-
'button-body',
|
|
2181
|
-
{},
|
|
2182
|
-
[Button_default, 'fifth', { icon: star_default, type: 'floating', color: 'primary' }],
|
|
2183
|
-
[Button_default, 'six', { icon: happy_default, type: 'floating', style: 'mini', color: 'primary' }],
|
|
2184
|
-
[Button_default, 'fifth', { icon: star_default, type: 'floating', color: 'secondary' }],
|
|
2185
|
-
[Button_default, 'six', { icon: happy_default, type: 'floating', style: 'mini', color: 'secondary' }]
|
|
2186
|
-
]
|
|
2187
|
-
],
|
|
2188
|
-
[
|
|
2189
|
-
card_default,
|
|
2190
|
-
'checkboxes',
|
|
2191
|
-
{},
|
|
2192
|
-
[
|
|
2193
|
-
toolbar_default,
|
|
2194
|
-
'toolbar',
|
|
2195
|
-
{},
|
|
2196
|
-
[text_default, 'checkbox-title', { text: 'Checkboxes' }]
|
|
2197
|
-
],
|
|
2198
|
-
[
|
|
2199
|
-
container_default,
|
|
2200
|
-
'checkbox-body',
|
|
2201
|
-
{},
|
|
2202
|
-
[checkbox_default2, 'checkbox', { text: 'Checkbox' }],
|
|
2203
|
-
[checkbox_default2, 'checkbox-checked', { text: 'Checked', checked: true }],
|
|
2204
|
-
[checkbox_default2, 'checkbox-disabled', { text: 'Disabled', disabled: true }]
|
|
2205
|
-
]
|
|
2206
|
-
],
|
|
2207
|
-
[
|
|
2208
|
-
card_default,
|
|
2209
|
-
'switches',
|
|
2210
|
-
{},
|
|
2211
|
-
[
|
|
2212
|
-
toolbar_default,
|
|
2213
|
-
'switch-toolbar',
|
|
2214
|
-
{},
|
|
2215
|
-
[text_default, 'switch-title', { text: 'Switches' }]
|
|
2216
|
-
],
|
|
2217
|
-
[
|
|
2218
|
-
container_default,
|
|
2219
|
-
'switch-body',
|
|
2220
|
-
{},
|
|
2221
|
-
[switch_default, 'switch', { text: 'Switch' }],
|
|
2222
|
-
[switch_default, 'switch-checked', { text: 'Checked', checked: true }],
|
|
2223
|
-
[switch_default, 'switch-disabled', { text: 'Disabled', disabled: true }]
|
|
2224
|
-
]
|
|
2225
|
-
],
|
|
2226
|
-
[
|
|
2227
|
-
card_default,
|
|
2228
|
-
'progress indicators',
|
|
2229
|
-
{},
|
|
2230
|
-
[
|
|
2231
|
-
toolbar_default,
|
|
2232
|
-
'progress-toolbar',
|
|
2233
|
-
{},
|
|
2234
|
-
[text_default, 'progress-title', { text: 'Progress indicators' }]
|
|
2235
|
-
],
|
|
2236
|
-
[
|
|
2237
|
-
container_default,
|
|
2238
|
-
'progress-body',
|
|
2239
|
-
{},
|
|
2240
|
-
[progress_default, 'progress', { progress: '60%' }],
|
|
2241
|
-
[progress_default, 'progress-indeterminate', { type: 'indeterminate' }]
|
|
2242
|
-
]
|
|
2243
|
-
],
|
|
2244
|
-
[
|
|
2245
|
-
card_default,
|
|
2246
|
-
'sliders',
|
|
2247
|
-
{},
|
|
2248
|
-
[
|
|
2249
|
-
toolbar_default,
|
|
2250
|
-
'slider-toolbar',
|
|
2251
|
-
{},
|
|
2252
|
-
[text_default, 'slider-title', { text: 'Sliders' }]
|
|
2253
|
-
],
|
|
2254
|
-
[
|
|
2255
|
-
container_default,
|
|
2256
|
-
'slider-body',
|
|
2257
|
-
{},
|
|
2258
|
-
[slider_default, 'slider', { text: 'Slider' }],
|
|
2259
|
-
[slider_default, 'slider-checked', { text: 'Checked', checked: true }],
|
|
2260
|
-
[slider_default, 'slider-disabled', { text: 'Disabled', disabled: true }]
|
|
2261
|
-
]
|
|
2262
|
-
]
|
|
2263
|
-
]
|
|
2264
|
-
], document.body)
|
|
2265
|
-
const moreButton = layout.get('menu-more').on('click', (e2) => {
|
|
2266
|
-
layout.get('more-menu').show(e2)
|
|
2267
|
-
})
|
|
2268
|
-
layout.get('body').root.addEventListener('scroll', (e2) => {
|
|
2269
|
-
if (layout.get('body').root.scrollTop > 0) {
|
|
2270
|
-
css_default2.add(layout.get('tabs').root, 'head-shadow')
|
|
2271
|
-
} else {
|
|
2272
|
-
css_default2.remove(layout.get('tabs').root, 'head-shadow')
|
|
2273
|
-
}
|
|
2274
|
-
})
|
|
2275
|
-
const naviMenu = layout.get('menu-navi')
|
|
2276
|
-
naviMenu.on('click', (e2) => {
|
|
2277
|
-
layout.get('navi').open()
|
|
2278
|
-
})
|
|
2279
|
-
})
|
|
2280
|
-
})()
|
|
2281
|
-
// # sourceMappingURL=demo-bundle.js.map
|