@pageboard/html 0.14.19 → 0.14.21

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.
Files changed (110) hide show
  1. package/elements/accordion.js +1 -1
  2. package/elements/fieldsets.js +1 -1
  3. package/elements/form.js +2 -2
  4. package/elements/grid.js +1 -1
  5. package/elements/image.js +1 -1
  6. package/elements/input-file.js +2 -2
  7. package/elements/input-property.js +12 -13
  8. package/elements/inputs.js +5 -5
  9. package/elements/layout.js +1 -1
  10. package/elements/link.js +2 -2
  11. package/elements/menu.js +2 -2
  12. package/elements/navigation.js +1 -1
  13. package/elements/page.js +1 -1
  14. package/elements/paragraph.js +2 -2
  15. package/elements/query-tags.js +1 -1
  16. package/elements/tab.js +1 -1
  17. package/elements/table.js +1 -1
  18. package/elements/template.js +1 -1
  19. package/package.json +3 -8
  20. package/ui/card.css +3 -3
  21. package/ui/components/accordion.css +241 -0
  22. package/ui/components/accordion.js +613 -0
  23. package/ui/components/ad.css +275 -0
  24. package/ui/components/api.js +1167 -0
  25. package/ui/components/breadcrumb.css +122 -0
  26. package/ui/components/button.css +3525 -0
  27. package/ui/components/card.css +939 -0
  28. package/ui/components/checkbox.css +604 -0
  29. package/ui/components/checkbox.js +831 -0
  30. package/ui/components/colorize.js +274 -0
  31. package/ui/components/comment.css +268 -0
  32. package/ui/components/container.css +149 -0
  33. package/ui/components/dimmer.css +224 -0
  34. package/ui/components/dimmer.js +733 -0
  35. package/ui/components/divider.css +253 -0
  36. package/ui/components/dropdown.css +1448 -0
  37. package/ui/components/dropdown.js +3955 -0
  38. package/ui/components/embed.css +160 -0
  39. package/ui/components/embed.js +706 -0
  40. package/ui/components/feed.css +281 -0
  41. package/ui/components/flag.css +1035 -0
  42. package/ui/components/form.css +1011 -0
  43. package/ui/components/form.js +1706 -0
  44. package/ui/components/grid.css +1941 -0
  45. package/ui/components/header.css +719 -0
  46. package/ui/components/icon.css +4777 -0
  47. package/ui/components/image.css +310 -0
  48. package/ui/components/input.css +469 -0
  49. package/ui/components/item.css +464 -0
  50. package/ui/components/label.css +1281 -0
  51. package/ui/components/list.css +943 -0
  52. package/ui/components/loader.css +339 -0
  53. package/ui/components/menu.css +1940 -0
  54. package/ui/components/message.css +468 -0
  55. package/ui/components/modal.css +617 -0
  56. package/ui/components/modal.js +1034 -0
  57. package/ui/components/nag.css +145 -0
  58. package/ui/components/nag.js +507 -0
  59. package/ui/components/placeholder.css +229 -0
  60. package/ui/components/popup.css +640 -0
  61. package/ui/components/popup.js +1532 -0
  62. package/ui/components/progress.css +502 -0
  63. package/ui/components/progress.js +931 -0
  64. package/ui/components/rail.css +152 -0
  65. package/ui/components/rating.css +257 -0
  66. package/ui/components/rating.js +508 -0
  67. package/ui/components/reset.css +476 -0
  68. package/ui/components/reveal.css +260 -0
  69. package/ui/components/search.css +431 -0
  70. package/ui/components/search.js +1505 -0
  71. package/ui/components/segment.css +824 -0
  72. package/ui/components/shape.css +143 -0
  73. package/ui/components/shape.js +921 -0
  74. package/ui/components/sidebar.css +537 -0
  75. package/ui/components/sidebar.js +1033 -0
  76. package/ui/components/site.css +184 -0
  77. package/ui/components/site.js +487 -0
  78. package/ui/components/state.js +708 -0
  79. package/ui/components/statistic.css +534 -0
  80. package/ui/components/step.css +566 -0
  81. package/ui/components/sticky.css +73 -0
  82. package/ui/components/sticky.js +959 -0
  83. package/ui/components/tab.css +89 -0
  84. package/ui/components/tab.js +952 -0
  85. package/ui/components/table.css +1108 -0
  86. package/ui/components/transition.css +1792 -0
  87. package/ui/components/transition.js +1095 -0
  88. package/ui/components/video.css +121 -0
  89. package/ui/components/video.js +532 -0
  90. package/ui/components/visibility.js +1311 -0
  91. package/ui/components/visit.js +517 -0
  92. package/ui/item.css +2 -2
  93. package/ui/layout.css +1 -1
  94. package/ui/themes/default/assets/fonts/brand-icons.eot +0 -0
  95. package/ui/themes/default/assets/fonts/brand-icons.svg +1008 -0
  96. package/ui/themes/default/assets/fonts/brand-icons.ttf +0 -0
  97. package/ui/themes/default/assets/fonts/brand-icons.woff +0 -0
  98. package/ui/themes/default/assets/fonts/brand-icons.woff2 +0 -0
  99. package/ui/themes/default/assets/fonts/icons.eot +0 -0
  100. package/ui/themes/default/assets/fonts/icons.otf +0 -0
  101. package/ui/themes/default/assets/fonts/icons.svg +1518 -0
  102. package/ui/themes/default/assets/fonts/icons.ttf +0 -0
  103. package/ui/themes/default/assets/fonts/icons.woff +0 -0
  104. package/ui/themes/default/assets/fonts/icons.woff2 +0 -0
  105. package/ui/themes/default/assets/fonts/outline-icons.eot +0 -0
  106. package/ui/themes/default/assets/fonts/outline-icons.svg +366 -0
  107. package/ui/themes/default/assets/fonts/outline-icons.ttf +0 -0
  108. package/ui/themes/default/assets/fonts/outline-icons.woff +0 -0
  109. package/ui/themes/default/assets/fonts/outline-icons.woff2 +0 -0
  110. package/ui/themes/default/assets/images/flags.png +0 -0
@@ -0,0 +1,921 @@
1
+ /*!
2
+ * # Semantic UI 2.4.1 - Shape
3
+ * http://github.com/semantic-org/semantic-ui/
4
+ *
5
+ *
6
+ * Released under the MIT license
7
+ * http://opensource.org/licenses/MIT
8
+ *
9
+ */
10
+
11
+ ;(function ($, window, document, undefined) {
12
+
13
+ 'use strict';
14
+
15
+ window = (typeof window != 'undefined' && window.Math == Math)
16
+ ? window
17
+ : (typeof self != 'undefined' && self.Math == Math)
18
+ ? self
19
+ : Function('return this')()
20
+ ;
21
+
22
+ $.fn.shape = function(parameters) {
23
+ var
24
+ $allModules = $(this),
25
+ $body = $('body'),
26
+
27
+ time = new Date().getTime(),
28
+ performance = [],
29
+
30
+ query = arguments[0],
31
+ methodInvoked = (typeof query == 'string'),
32
+ queryArguments = [].slice.call(arguments, 1),
33
+
34
+ requestAnimationFrame = window.requestAnimationFrame
35
+ || window.mozRequestAnimationFrame
36
+ || window.webkitRequestAnimationFrame
37
+ || window.msRequestAnimationFrame
38
+ || function(callback) { setTimeout(callback, 0); },
39
+
40
+ returnedValue
41
+ ;
42
+
43
+ $allModules
44
+ .each(function() {
45
+ var
46
+ moduleSelector = $allModules.selector || '',
47
+ settings = ( $.isPlainObject(parameters) )
48
+ ? $.extend(true, {}, $.fn.shape.settings, parameters)
49
+ : $.extend({}, $.fn.shape.settings),
50
+
51
+ // internal aliases
52
+ namespace = settings.namespace,
53
+ selector = settings.selector,
54
+ error = settings.error,
55
+ className = settings.className,
56
+
57
+ // define namespaces for modules
58
+ eventNamespace = '.' + namespace,
59
+ moduleNamespace = 'module-' + namespace,
60
+
61
+ // selector cache
62
+ $module = $(this),
63
+ $sides = $module.find(selector.sides),
64
+ $side = $module.find(selector.side),
65
+
66
+ // private variables
67
+ nextIndex = false,
68
+ $activeSide,
69
+ $nextSide,
70
+
71
+ // standard module
72
+ element = this,
73
+ instance = $module.data(moduleNamespace),
74
+ module
75
+ ;
76
+
77
+ module = {
78
+
79
+ initialize: function() {
80
+ module.verbose('Initializing module for', element);
81
+ module.set.defaultSide();
82
+ module.instantiate();
83
+ },
84
+
85
+ instantiate: function() {
86
+ module.verbose('Storing instance of module', module);
87
+ instance = module;
88
+ $module
89
+ .data(moduleNamespace, instance)
90
+ ;
91
+ },
92
+
93
+ destroy: function() {
94
+ module.verbose('Destroying previous module for', element);
95
+ $module
96
+ .removeData(moduleNamespace)
97
+ .off(eventNamespace)
98
+ ;
99
+ },
100
+
101
+ refresh: function() {
102
+ module.verbose('Refreshing selector cache for', element);
103
+ $module = $(element);
104
+ $sides = $(this).find(selector.shape);
105
+ $side = $(this).find(selector.side);
106
+ },
107
+
108
+ repaint: function() {
109
+ module.verbose('Forcing repaint event');
110
+ var
111
+ shape = $sides[0] || document.createElement('div'),
112
+ fakeAssignment = shape.offsetWidth
113
+ ;
114
+ },
115
+
116
+ animate: function(propertyObject, callback) {
117
+ module.verbose('Animating box with properties', propertyObject);
118
+ callback = callback || function(event) {
119
+ module.verbose('Executing animation callback');
120
+ if(event !== undefined) {
121
+ event.stopPropagation();
122
+ }
123
+ module.reset();
124
+ module.set.active();
125
+ };
126
+ settings.beforeChange.call($nextSide[0]);
127
+ if(module.get.transitionEvent()) {
128
+ module.verbose('Starting CSS animation');
129
+ $module
130
+ .addClass(className.animating)
131
+ ;
132
+ $sides
133
+ .css(propertyObject)
134
+ .one(module.get.transitionEvent(), callback)
135
+ ;
136
+ module.set.duration(settings.duration);
137
+ requestAnimationFrame(function() {
138
+ $module
139
+ .addClass(className.animating)
140
+ ;
141
+ $activeSide
142
+ .addClass(className.hidden)
143
+ ;
144
+ });
145
+ }
146
+ else {
147
+ callback();
148
+ }
149
+ },
150
+
151
+ queue: function(method) {
152
+ module.debug('Queueing animation of', method);
153
+ $sides
154
+ .one(module.get.transitionEvent(), function() {
155
+ module.debug('Executing queued animation');
156
+ setTimeout(function(){
157
+ $module.shape(method);
158
+ }, 0);
159
+ })
160
+ ;
161
+ },
162
+
163
+ reset: function() {
164
+ module.verbose('Animating states reset');
165
+ $module
166
+ .removeClass(className.animating)
167
+ .attr('style', '')
168
+ .removeAttr('style')
169
+ ;
170
+ // removeAttr style does not consistently work in safari
171
+ $sides
172
+ .attr('style', '')
173
+ .removeAttr('style')
174
+ ;
175
+ $side
176
+ .attr('style', '')
177
+ .removeAttr('style')
178
+ .removeClass(className.hidden)
179
+ ;
180
+ $nextSide
181
+ .removeClass(className.animating)
182
+ .attr('style', '')
183
+ .removeAttr('style')
184
+ ;
185
+ },
186
+
187
+ is: {
188
+ complete: function() {
189
+ return ($side.filter('.' + className.active)[0] == $nextSide[0]);
190
+ },
191
+ animating: function() {
192
+ return $module.hasClass(className.animating);
193
+ }
194
+ },
195
+
196
+ set: {
197
+
198
+ defaultSide: function() {
199
+ $activeSide = $module.find('.' + settings.className.active);
200
+ $nextSide = ( $activeSide.next(selector.side).length > 0 )
201
+ ? $activeSide.next(selector.side)
202
+ : $module.find(selector.side).first()
203
+ ;
204
+ nextIndex = false;
205
+ module.verbose('Active side set to', $activeSide);
206
+ module.verbose('Next side set to', $nextSide);
207
+ },
208
+
209
+ duration: function(duration) {
210
+ duration = duration || settings.duration;
211
+ duration = (typeof duration == 'number')
212
+ ? duration + 'ms'
213
+ : duration
214
+ ;
215
+ module.verbose('Setting animation duration', duration);
216
+ if(settings.duration || settings.duration === 0) {
217
+ $sides.add($side)
218
+ .css({
219
+ '-webkit-transition-duration': duration,
220
+ '-moz-transition-duration': duration,
221
+ '-ms-transition-duration': duration,
222
+ '-o-transition-duration': duration,
223
+ 'transition-duration': duration
224
+ })
225
+ ;
226
+ }
227
+ },
228
+
229
+ currentStageSize: function() {
230
+ var
231
+ $activeSide = $module.find('.' + settings.className.active),
232
+ width = $activeSide.outerWidth(true),
233
+ height = $activeSide.outerHeight(true)
234
+ ;
235
+ $module
236
+ .css({
237
+ width: width,
238
+ height: height
239
+ })
240
+ ;
241
+ },
242
+
243
+ stageSize: function() {
244
+ var
245
+ $clone = $module.clone().addClass(className.loading),
246
+ $activeSide = $clone.find('.' + settings.className.active),
247
+ $nextSide = (nextIndex)
248
+ ? $clone.find(selector.side).eq(nextIndex)
249
+ : ( $activeSide.next(selector.side).length > 0 )
250
+ ? $activeSide.next(selector.side)
251
+ : $clone.find(selector.side).first(),
252
+ newWidth = (settings.width == 'next')
253
+ ? $nextSide.outerWidth(true)
254
+ : (settings.width == 'initial')
255
+ ? $module.width()
256
+ : settings.width,
257
+ newHeight = (settings.height == 'next')
258
+ ? $nextSide.outerHeight(true)
259
+ : (settings.height == 'initial')
260
+ ? $module.height()
261
+ : settings.height
262
+ ;
263
+ $activeSide.removeClass(className.active);
264
+ $nextSide.addClass(className.active);
265
+ $clone.insertAfter($module);
266
+ $clone.remove();
267
+ if(settings.width != 'auto') {
268
+ $module.css('width', newWidth + settings.jitter);
269
+ module.verbose('Specifying width during animation', newWidth);
270
+ }
271
+ if(settings.height != 'auto') {
272
+ $module.css('height', newHeight + settings.jitter);
273
+ module.verbose('Specifying height during animation', newHeight);
274
+ }
275
+ },
276
+
277
+ nextSide: function(selector) {
278
+ nextIndex = selector;
279
+ $nextSide = $side.filter(selector);
280
+ nextIndex = $side.index($nextSide);
281
+ if($nextSide.length === 0) {
282
+ module.set.defaultSide();
283
+ module.error(error.side);
284
+ }
285
+ module.verbose('Next side manually set to', $nextSide);
286
+ },
287
+
288
+ active: function() {
289
+ module.verbose('Setting new side to active', $nextSide);
290
+ $side
291
+ .removeClass(className.active)
292
+ ;
293
+ $nextSide
294
+ .addClass(className.active)
295
+ ;
296
+ settings.onChange.call($nextSide[0]);
297
+ module.set.defaultSide();
298
+ }
299
+ },
300
+
301
+ flip: {
302
+
303
+ up: function() {
304
+ if(module.is.complete() && !module.is.animating() && !settings.allowRepeats) {
305
+ module.debug('Side already visible', $nextSide);
306
+ return;
307
+ }
308
+ if( !module.is.animating()) {
309
+ module.debug('Flipping up', $nextSide);
310
+ var
311
+ transform = module.get.transform.up()
312
+ ;
313
+ module.set.stageSize();
314
+ module.stage.above();
315
+ module.animate(transform);
316
+ }
317
+ else {
318
+ module.queue('flip up');
319
+ }
320
+ },
321
+
322
+ down: function() {
323
+ if(module.is.complete() && !module.is.animating() && !settings.allowRepeats) {
324
+ module.debug('Side already visible', $nextSide);
325
+ return;
326
+ }
327
+ if( !module.is.animating()) {
328
+ module.debug('Flipping down', $nextSide);
329
+ var
330
+ transform = module.get.transform.down()
331
+ ;
332
+ module.set.stageSize();
333
+ module.stage.below();
334
+ module.animate(transform);
335
+ }
336
+ else {
337
+ module.queue('flip down');
338
+ }
339
+ },
340
+
341
+ left: function() {
342
+ if(module.is.complete() && !module.is.animating() && !settings.allowRepeats) {
343
+ module.debug('Side already visible', $nextSide);
344
+ return;
345
+ }
346
+ if( !module.is.animating()) {
347
+ module.debug('Flipping left', $nextSide);
348
+ var
349
+ transform = module.get.transform.left()
350
+ ;
351
+ module.set.stageSize();
352
+ module.stage.left();
353
+ module.animate(transform);
354
+ }
355
+ else {
356
+ module.queue('flip left');
357
+ }
358
+ },
359
+
360
+ right: function() {
361
+ if(module.is.complete() && !module.is.animating() && !settings.allowRepeats) {
362
+ module.debug('Side already visible', $nextSide);
363
+ return;
364
+ }
365
+ if( !module.is.animating()) {
366
+ module.debug('Flipping right', $nextSide);
367
+ var
368
+ transform = module.get.transform.right()
369
+ ;
370
+ module.set.stageSize();
371
+ module.stage.right();
372
+ module.animate(transform);
373
+ }
374
+ else {
375
+ module.queue('flip right');
376
+ }
377
+ },
378
+
379
+ over: function() {
380
+ if(module.is.complete() && !module.is.animating() && !settings.allowRepeats) {
381
+ module.debug('Side already visible', $nextSide);
382
+ return;
383
+ }
384
+ if( !module.is.animating()) {
385
+ module.debug('Flipping over', $nextSide);
386
+ module.set.stageSize();
387
+ module.stage.behind();
388
+ module.animate(module.get.transform.over() );
389
+ }
390
+ else {
391
+ module.queue('flip over');
392
+ }
393
+ },
394
+
395
+ back: function() {
396
+ if(module.is.complete() && !module.is.animating() && !settings.allowRepeats) {
397
+ module.debug('Side already visible', $nextSide);
398
+ return;
399
+ }
400
+ if( !module.is.animating()) {
401
+ module.debug('Flipping back', $nextSide);
402
+ module.set.stageSize();
403
+ module.stage.behind();
404
+ module.animate(module.get.transform.back() );
405
+ }
406
+ else {
407
+ module.queue('flip back');
408
+ }
409
+ }
410
+
411
+ },
412
+
413
+ get: {
414
+
415
+ transform: {
416
+ up: function() {
417
+ var
418
+ translate = {
419
+ y: -(($activeSide.outerHeight(true) - $nextSide.outerHeight(true)) / 2),
420
+ z: -($activeSide.outerHeight(true) / 2)
421
+ }
422
+ ;
423
+ return {
424
+ transform: 'translateY(' + translate.y + 'px) translateZ('+ translate.z + 'px) rotateX(-90deg)'
425
+ };
426
+ },
427
+
428
+ down: function() {
429
+ var
430
+ translate = {
431
+ y: -(($activeSide.outerHeight(true) - $nextSide.outerHeight(true)) / 2),
432
+ z: -($activeSide.outerHeight(true) / 2)
433
+ }
434
+ ;
435
+ return {
436
+ transform: 'translateY(' + translate.y + 'px) translateZ('+ translate.z + 'px) rotateX(90deg)'
437
+ };
438
+ },
439
+
440
+ left: function() {
441
+ var
442
+ translate = {
443
+ x : -(($activeSide.outerWidth(true) - $nextSide.outerWidth(true)) / 2),
444
+ z : -($activeSide.outerWidth(true) / 2)
445
+ }
446
+ ;
447
+ return {
448
+ transform: 'translateX(' + translate.x + 'px) translateZ(' + translate.z + 'px) rotateY(90deg)'
449
+ };
450
+ },
451
+
452
+ right: function() {
453
+ var
454
+ translate = {
455
+ x : -(($activeSide.outerWidth(true) - $nextSide.outerWidth(true)) / 2),
456
+ z : -($activeSide.outerWidth(true) / 2)
457
+ }
458
+ ;
459
+ return {
460
+ transform: 'translateX(' + translate.x + 'px) translateZ(' + translate.z + 'px) rotateY(-90deg)'
461
+ };
462
+ },
463
+
464
+ over: function() {
465
+ var
466
+ translate = {
467
+ x : -(($activeSide.outerWidth(true) - $nextSide.outerWidth(true)) / 2)
468
+ }
469
+ ;
470
+ return {
471
+ transform: 'translateX(' + translate.x + 'px) rotateY(180deg)'
472
+ };
473
+ },
474
+
475
+ back: function() {
476
+ var
477
+ translate = {
478
+ x : -(($activeSide.outerWidth(true) - $nextSide.outerWidth(true)) / 2)
479
+ }
480
+ ;
481
+ return {
482
+ transform: 'translateX(' + translate.x + 'px) rotateY(-180deg)'
483
+ };
484
+ }
485
+ },
486
+
487
+ transitionEvent: function() {
488
+ var
489
+ element = document.createElement('element'),
490
+ transitions = {
491
+ 'transition' :'transitionend',
492
+ 'OTransition' :'oTransitionEnd',
493
+ 'MozTransition' :'transitionend',
494
+ 'WebkitTransition' :'webkitTransitionEnd'
495
+ },
496
+ transition
497
+ ;
498
+ for(transition in transitions){
499
+ if( element.style[transition] !== undefined ){
500
+ return transitions[transition];
501
+ }
502
+ }
503
+ },
504
+
505
+ nextSide: function() {
506
+ return ( $activeSide.next(selector.side).length > 0 )
507
+ ? $activeSide.next(selector.side)
508
+ : $module.find(selector.side).first()
509
+ ;
510
+ }
511
+
512
+ },
513
+
514
+ stage: {
515
+
516
+ above: function() {
517
+ var
518
+ box = {
519
+ origin : (($activeSide.outerHeight(true) - $nextSide.outerHeight(true)) / 2),
520
+ depth : {
521
+ active : ($nextSide.outerHeight(true) / 2),
522
+ next : ($activeSide.outerHeight(true) / 2)
523
+ }
524
+ }
525
+ ;
526
+ module.verbose('Setting the initial animation position as above', $nextSide, box);
527
+ $sides
528
+ .css({
529
+ 'transform' : 'translateZ(-' + box.depth.active + 'px)'
530
+ })
531
+ ;
532
+ $activeSide
533
+ .css({
534
+ 'transform' : 'rotateY(0deg) translateZ(' + box.depth.active + 'px)'
535
+ })
536
+ ;
537
+ $nextSide
538
+ .addClass(className.animating)
539
+ .css({
540
+ 'top' : box.origin + 'px',
541
+ 'transform' : 'rotateX(90deg) translateZ(' + box.depth.next + 'px)'
542
+ })
543
+ ;
544
+ },
545
+
546
+ below: function() {
547
+ var
548
+ box = {
549
+ origin : (($activeSide.outerHeight(true) - $nextSide.outerHeight(true)) / 2),
550
+ depth : {
551
+ active : ($nextSide.outerHeight(true) / 2),
552
+ next : ($activeSide.outerHeight(true) / 2)
553
+ }
554
+ }
555
+ ;
556
+ module.verbose('Setting the initial animation position as below', $nextSide, box);
557
+ $sides
558
+ .css({
559
+ 'transform' : 'translateZ(-' + box.depth.active + 'px)'
560
+ })
561
+ ;
562
+ $activeSide
563
+ .css({
564
+ 'transform' : 'rotateY(0deg) translateZ(' + box.depth.active + 'px)'
565
+ })
566
+ ;
567
+ $nextSide
568
+ .addClass(className.animating)
569
+ .css({
570
+ 'top' : box.origin + 'px',
571
+ 'transform' : 'rotateX(-90deg) translateZ(' + box.depth.next + 'px)'
572
+ })
573
+ ;
574
+ },
575
+
576
+ left: function() {
577
+ var
578
+ height = {
579
+ active : $activeSide.outerWidth(true),
580
+ next : $nextSide.outerWidth(true)
581
+ },
582
+ box = {
583
+ origin : ( ( height.active - height.next ) / 2),
584
+ depth : {
585
+ active : (height.next / 2),
586
+ next : (height.active / 2)
587
+ }
588
+ }
589
+ ;
590
+ module.verbose('Setting the initial animation position as left', $nextSide, box);
591
+ $sides
592
+ .css({
593
+ 'transform' : 'translateZ(-' + box.depth.active + 'px)'
594
+ })
595
+ ;
596
+ $activeSide
597
+ .css({
598
+ 'transform' : 'rotateY(0deg) translateZ(' + box.depth.active + 'px)'
599
+ })
600
+ ;
601
+ $nextSide
602
+ .addClass(className.animating)
603
+ .css({
604
+ 'left' : box.origin + 'px',
605
+ 'transform' : 'rotateY(-90deg) translateZ(' + box.depth.next + 'px)'
606
+ })
607
+ ;
608
+ },
609
+
610
+ right: function() {
611
+ var
612
+ height = {
613
+ active : $activeSide.outerWidth(true),
614
+ next : $nextSide.outerWidth(true)
615
+ },
616
+ box = {
617
+ origin : ( ( height.active - height.next ) / 2),
618
+ depth : {
619
+ active : (height.next / 2),
620
+ next : (height.active / 2)
621
+ }
622
+ }
623
+ ;
624
+ module.verbose('Setting the initial animation position as left', $nextSide, box);
625
+ $sides
626
+ .css({
627
+ 'transform' : 'translateZ(-' + box.depth.active + 'px)'
628
+ })
629
+ ;
630
+ $activeSide
631
+ .css({
632
+ 'transform' : 'rotateY(0deg) translateZ(' + box.depth.active + 'px)'
633
+ })
634
+ ;
635
+ $nextSide
636
+ .addClass(className.animating)
637
+ .css({
638
+ 'left' : box.origin + 'px',
639
+ 'transform' : 'rotateY(90deg) translateZ(' + box.depth.next + 'px)'
640
+ })
641
+ ;
642
+ },
643
+
644
+ behind: function() {
645
+ var
646
+ height = {
647
+ active : $activeSide.outerWidth(true),
648
+ next : $nextSide.outerWidth(true)
649
+ },
650
+ box = {
651
+ origin : ( ( height.active - height.next ) / 2),
652
+ depth : {
653
+ active : (height.next / 2),
654
+ next : (height.active / 2)
655
+ }
656
+ }
657
+ ;
658
+ module.verbose('Setting the initial animation position as behind', $nextSide, box);
659
+ $activeSide
660
+ .css({
661
+ 'transform' : 'rotateY(0deg)'
662
+ })
663
+ ;
664
+ $nextSide
665
+ .addClass(className.animating)
666
+ .css({
667
+ 'left' : box.origin + 'px',
668
+ 'transform' : 'rotateY(-180deg)'
669
+ })
670
+ ;
671
+ }
672
+ },
673
+ setting: function(name, value) {
674
+ module.debug('Changing setting', name, value);
675
+ if( $.isPlainObject(name) ) {
676
+ $.extend(true, settings, name);
677
+ }
678
+ else if(value !== undefined) {
679
+ if($.isPlainObject(settings[name])) {
680
+ $.extend(true, settings[name], value);
681
+ }
682
+ else {
683
+ settings[name] = value;
684
+ }
685
+ }
686
+ else {
687
+ return settings[name];
688
+ }
689
+ },
690
+ internal: function(name, value) {
691
+ if( $.isPlainObject(name) ) {
692
+ $.extend(true, module, name);
693
+ }
694
+ else if(value !== undefined) {
695
+ module[name] = value;
696
+ }
697
+ else {
698
+ return module[name];
699
+ }
700
+ },
701
+ debug: function() {
702
+ if(!settings.silent && settings.debug) {
703
+ if(settings.performance) {
704
+ module.performance.log(arguments);
705
+ }
706
+ else {
707
+ module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
708
+ module.debug.apply(console, arguments);
709
+ }
710
+ }
711
+ },
712
+ verbose: function() {
713
+ if(!settings.silent && settings.verbose && settings.debug) {
714
+ if(settings.performance) {
715
+ module.performance.log(arguments);
716
+ }
717
+ else {
718
+ module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
719
+ module.verbose.apply(console, arguments);
720
+ }
721
+ }
722
+ },
723
+ error: function() {
724
+ if(!settings.silent) {
725
+ module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
726
+ module.error.apply(console, arguments);
727
+ }
728
+ },
729
+ performance: {
730
+ log: function(message) {
731
+ var
732
+ currentTime,
733
+ executionTime,
734
+ previousTime
735
+ ;
736
+ if(settings.performance) {
737
+ currentTime = new Date().getTime();
738
+ previousTime = time || currentTime;
739
+ executionTime = currentTime - previousTime;
740
+ time = currentTime;
741
+ performance.push({
742
+ 'Name' : message[0],
743
+ 'Arguments' : [].slice.call(message, 1) || '',
744
+ 'Element' : element,
745
+ 'Execution Time' : executionTime
746
+ });
747
+ }
748
+ clearTimeout(module.performance.timer);
749
+ module.performance.timer = setTimeout(module.performance.display, 500);
750
+ },
751
+ display: function() {
752
+ var
753
+ title = settings.name + ':',
754
+ totalTime = 0
755
+ ;
756
+ time = false;
757
+ clearTimeout(module.performance.timer);
758
+ $.each(performance, function(index, data) {
759
+ totalTime += data['Execution Time'];
760
+ });
761
+ title += ' ' + totalTime + 'ms';
762
+ if(moduleSelector) {
763
+ title += ' \'' + moduleSelector + '\'';
764
+ }
765
+ if($allModules.length > 1) {
766
+ title += ' ' + '(' + $allModules.length + ')';
767
+ }
768
+ if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) {
769
+ console.groupCollapsed(title);
770
+ if(console.table) {
771
+ console.table(performance);
772
+ }
773
+ else {
774
+ $.each(performance, function(index, data) {
775
+ console.log(data['Name'] + ': ' + data['Execution Time']+'ms');
776
+ });
777
+ }
778
+ console.groupEnd();
779
+ }
780
+ performance = [];
781
+ }
782
+ },
783
+ invoke: function(query, passedArguments, context) {
784
+ var
785
+ object = instance,
786
+ maxDepth,
787
+ found,
788
+ response
789
+ ;
790
+ passedArguments = passedArguments || queryArguments;
791
+ context = element || context;
792
+ if(typeof query == 'string' && object !== undefined) {
793
+ query = query.split(/[\. ]/);
794
+ maxDepth = query.length - 1;
795
+ $.each(query, function(depth, value) {
796
+ var camelCaseValue = (depth != maxDepth)
797
+ ? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
798
+ : query
799
+ ;
800
+ if( $.isPlainObject( object[camelCaseValue] ) && (depth != maxDepth) ) {
801
+ object = object[camelCaseValue];
802
+ }
803
+ else if( object[camelCaseValue] !== undefined ) {
804
+ found = object[camelCaseValue];
805
+ return false;
806
+ }
807
+ else if( $.isPlainObject( object[value] ) && (depth != maxDepth) ) {
808
+ object = object[value];
809
+ }
810
+ else if( object[value] !== undefined ) {
811
+ found = object[value];
812
+ return false;
813
+ }
814
+ else {
815
+ return false;
816
+ }
817
+ });
818
+ }
819
+ if ( $.isFunction( found ) ) {
820
+ response = found.apply(context, passedArguments);
821
+ }
822
+ else if(found !== undefined) {
823
+ response = found;
824
+ }
825
+ if($.isArray(returnedValue)) {
826
+ returnedValue.push(response);
827
+ }
828
+ else if(returnedValue !== undefined) {
829
+ returnedValue = [returnedValue, response];
830
+ }
831
+ else if(response !== undefined) {
832
+ returnedValue = response;
833
+ }
834
+ return found;
835
+ }
836
+ };
837
+
838
+ if(methodInvoked) {
839
+ if(instance === undefined) {
840
+ module.initialize();
841
+ }
842
+ module.invoke(query);
843
+ }
844
+ else {
845
+ if(instance !== undefined) {
846
+ instance.invoke('destroy');
847
+ }
848
+ module.initialize();
849
+ }
850
+ })
851
+ ;
852
+
853
+ return (returnedValue !== undefined)
854
+ ? returnedValue
855
+ : this
856
+ ;
857
+ };
858
+
859
+ $.fn.shape.settings = {
860
+
861
+ // module info
862
+ name : 'Shape',
863
+
864
+ // hide all debug content
865
+ silent : false,
866
+
867
+ // debug content outputted to console
868
+ debug : false,
869
+
870
+ // verbose debug output
871
+ verbose : false,
872
+
873
+ // fudge factor in pixels when swapping from 2d to 3d (can be useful to correct rounding errors)
874
+ jitter : 0,
875
+
876
+ // performance data output
877
+ performance: true,
878
+
879
+ // event namespace
880
+ namespace : 'shape',
881
+
882
+ // width during animation, can be set to 'auto', initial', 'next' or pixel amount
883
+ width: 'initial',
884
+
885
+ // height during animation, can be set to 'auto', 'initial', 'next' or pixel amount
886
+ height: 'initial',
887
+
888
+ // callback occurs on side change
889
+ beforeChange : function() {},
890
+ onChange : function() {},
891
+
892
+ // allow animation to same side
893
+ allowRepeats: false,
894
+
895
+ // animation duration
896
+ duration : false,
897
+
898
+ // possible errors
899
+ error: {
900
+ side : 'You tried to switch to a side that does not exist.',
901
+ method : 'The method you called is not defined'
902
+ },
903
+
904
+ // classnames used
905
+ className : {
906
+ animating : 'animating',
907
+ hidden : 'hidden',
908
+ loading : 'loading',
909
+ active : 'active'
910
+ },
911
+
912
+ // selectors used
913
+ selector : {
914
+ sides : '.sides',
915
+ side : '.side'
916
+ }
917
+
918
+ };
919
+
920
+
921
+ })( jQuery, window, document );