@dso-toolkit/core 52.0.3 → 53.1.0
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/dist/cjs/dso-accordion-section.cjs.entry.js +39 -1404
- package/dist/cjs/dso-action-list-item.cjs.entry.js +27 -0
- package/dist/cjs/dso-action-list.cjs.entry.js +20 -0
- package/dist/cjs/dso-annotation-output.cjs.entry.js +1 -1
- package/dist/cjs/dso-card-container.cjs.entry.js +1 -1
- package/dist/cjs/dso-date-picker.cjs.entry.js +1 -1
- package/dist/cjs/dso-dropdown-menu.cjs.entry.js +18 -3
- package/dist/cjs/dso-expandable-heading.cjs.entry.js +6 -2
- package/dist/cjs/dso-expandable.cjs.entry.js +1433 -2
- package/dist/cjs/dso-header.cjs.entry.js +16 -1
- package/dist/cjs/dso-helpcenter-panel.cjs.entry.js +2 -2
- package/dist/cjs/dso-image-overlay.cjs.entry.js +2 -2
- package/dist/cjs/dso-info_2.cjs.entry.js +3 -2
- package/dist/cjs/dso-label.cjs.entry.js +1 -8
- package/dist/cjs/dso-list-button.cjs.entry.js +3 -3
- package/dist/cjs/dso-modal.cjs.entry.js +2 -2
- package/dist/cjs/dso-ozon-content.cjs.entry.js +2 -2
- package/dist/cjs/dso-table.cjs.entry.js +2 -2
- package/dist/cjs/dso-toolkit.cjs.js +1 -1
- package/dist/cjs/dso-tooltip.cjs.entry.js +14 -12
- package/dist/cjs/dso-viewer-grid.cjs.entry.js +2 -2
- package/dist/cjs/expandable.interfaces-19b608b9.js +7 -0
- package/dist/cjs/{focus-trap.esm-c501d382.js → focus-trap.esm-a5b7273f.js} +134 -51
- package/dist/cjs/{has-overflow-b1b4f3f3.js → has-overflow-dd552ec8.js} +3 -4
- package/dist/cjs/index.cjs.js +67 -0
- package/dist/cjs/{index.esm-03a9e0b4.js → index.esm-0e935715.js} +97 -17
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +3 -1
- package/dist/collection/components/accordion/accordion.js +1 -1
- package/dist/collection/components/accordion/components/accordion-section.css +60 -10
- package/dist/collection/components/accordion/components/accordion-section.js +41 -100
- package/dist/collection/components/action-list/action-list.css +25 -0
- package/dist/collection/components/action-list/action-list.js +42 -0
- package/dist/collection/components/action-list/components/action-list-item.css +81 -0
- package/dist/collection/components/action-list/components/action-list-item.js +120 -0
- package/dist/collection/components/annotation-output/annotation-output.js +1 -1
- package/dist/collection/components/card-container/card-container.css +15 -1
- package/dist/collection/components/date-picker/date-picker.css +1 -1
- package/dist/collection/components/date-picker/date-picker.js +1 -1
- package/dist/collection/components/dropdown-menu/dropdown-menu.js +36 -1
- package/dist/collection/components/expandable/expandable.css +12 -1
- package/dist/collection/components/expandable/expandable.interfaces.js +3 -0
- package/dist/collection/components/expandable/expandable.js +246 -2
- package/dist/collection/components/expandable-heading/expandable-heading.css +34 -0
- package/dist/collection/components/expandable-heading/expandable-heading.js +28 -2
- package/dist/collection/components/header/header.js +18 -2
- package/dist/collection/components/label/label.js +1 -8
- package/dist/collection/components/list-button/list-button.css +2 -2
- package/dist/collection/components/modal/modal-ref.js +18 -0
- package/dist/collection/components/modal/modal.controller.js +47 -0
- package/dist/collection/components/modal/modal.js +3 -7
- package/dist/collection/components/ozon-content/ozon-content.css +8 -0
- package/dist/collection/components/selectable/selectable.css +22 -9
- package/dist/collection/components/selectable/selectable.js +2 -1
- package/dist/collection/components/tooltip/tooltip.js +13 -11
- package/dist/collection/index.js +2 -0
- package/dist/components/dropdown-menu.js +17 -1
- package/dist/components/dso-accordion-section.js +52 -1407
- package/dist/components/dso-action-list-item.d.ts +11 -0
- package/dist/components/dso-action-list-item.js +53 -0
- package/dist/components/dso-action-list.d.ts +11 -0
- package/dist/components/dso-action-list.js +36 -0
- package/dist/components/dso-annotation-output.js +1 -1
- package/dist/components/dso-card-container.js +1 -1
- package/dist/components/dso-date-picker.js +2 -2
- package/dist/components/dso-expandable-heading.js +9 -4
- package/dist/components/dso-header.js +18 -2
- package/dist/components/dso-label.js +1 -8
- package/dist/components/dso-list-button.js +1 -1
- package/dist/components/dso-ozon-content.js +1 -1
- package/dist/components/expandable.js +1440 -4
- package/dist/components/focus-trap.esm.js +133 -50
- package/dist/components/has-overflow.js +3 -4
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.esm.js +97 -17
- package/dist/components/index.js +71 -1
- package/dist/components/selectable.js +3 -2
- package/dist/components/tooltip.js +13 -11
- package/dist/dso-toolkit/dso-toolkit.esm.js +1 -1
- package/dist/dso-toolkit/index.esm.js +1 -1
- package/dist/dso-toolkit/{p-e4f667b3.entry.js → p-0b6fa7d3.entry.js} +1 -1
- package/dist/dso-toolkit/p-36224d6f.entry.js +1 -0
- package/dist/dso-toolkit/{p-9b07b034.entry.js → p-398a8e0b.entry.js} +1 -1
- package/dist/dso-toolkit/p-3b91c3e9.entry.js +1 -0
- package/dist/dso-toolkit/p-452b1234.js +1 -0
- package/dist/dso-toolkit/p-5950644a.js +5 -0
- package/dist/dso-toolkit/p-5de8b79a.entry.js +1 -0
- package/dist/dso-toolkit/p-5e50b616.entry.js +1 -0
- package/dist/dso-toolkit/p-69f37ab3.entry.js +1 -0
- package/dist/dso-toolkit/p-6a99d7f8.entry.js +1 -0
- package/dist/dso-toolkit/p-8a77030b.entry.js +1 -0
- package/dist/dso-toolkit/p-91963e3d.js +5 -0
- package/dist/dso-toolkit/p-96f44d35.entry.js +1 -0
- package/dist/dso-toolkit/p-975c172a.entry.js +1 -0
- package/dist/dso-toolkit/{p-092dde2f.entry.js → p-a1616935.entry.js} +1 -1
- package/dist/dso-toolkit/{p-ba330644.entry.js → p-bb90ea4c.entry.js} +1 -1
- package/dist/dso-toolkit/p-bf750b97.js +1 -0
- package/dist/dso-toolkit/{p-aab458c4.entry.js → p-c86a5bcb.entry.js} +1 -1
- package/dist/dso-toolkit/{p-f2b76233.entry.js → p-cf9b79df.entry.js} +1 -1
- package/dist/dso-toolkit/{p-43f3d736.entry.js → p-d10ec2b3.entry.js} +1 -1
- package/dist/dso-toolkit/p-e8a6ccf5.entry.js +1 -0
- package/dist/dso-toolkit/p-eaae698e.entry.js +1 -0
- package/dist/dso-toolkit/p-fa2f1a1c.entry.js +1 -0
- package/dist/dso-toolkit/p-fe7ca25f.entry.js +1 -0
- package/dist/esm/dso-accordion-section.entry.js +39 -1404
- package/dist/esm/dso-action-list-item.entry.js +23 -0
- package/dist/esm/dso-action-list.entry.js +16 -0
- package/dist/esm/dso-annotation-output.entry.js +1 -1
- package/dist/esm/dso-card-container.entry.js +1 -1
- package/dist/esm/dso-date-picker.entry.js +1 -1
- package/dist/esm/dso-dropdown-menu.entry.js +18 -3
- package/dist/esm/dso-expandable-heading.entry.js +7 -3
- package/dist/esm/dso-expandable.entry.js +1434 -3
- package/dist/esm/dso-header.entry.js +16 -1
- package/dist/esm/dso-helpcenter-panel.entry.js +2 -2
- package/dist/esm/dso-image-overlay.entry.js +2 -2
- package/dist/esm/dso-info_2.entry.js +3 -2
- package/dist/esm/dso-label.entry.js +1 -8
- package/dist/esm/dso-list-button.entry.js +3 -3
- package/dist/esm/dso-modal.entry.js +2 -2
- package/dist/esm/dso-ozon-content.entry.js +2 -2
- package/dist/esm/dso-table.entry.js +2 -2
- package/dist/esm/dso-toolkit.js +1 -1
- package/dist/esm/dso-tooltip.entry.js +14 -12
- package/dist/esm/dso-viewer-grid.entry.js +2 -2
- package/dist/esm/expandable.interfaces-9b1afbe8.js +5 -0
- package/dist/esm/{focus-trap.esm-94794d92.js → focus-trap.esm-2a49a38f.js} +134 -51
- package/dist/esm/{has-overflow-c44a8a0a.js → has-overflow-fdc85d8f.js} +3 -4
- package/dist/esm/{index.esm-8fc07ad8.js → index.esm-3d6c8190.js} +97 -17
- package/dist/esm/index.js +69 -0
- package/dist/esm/loader.js +1 -1
- package/dist/types/components/accordion/accordion.interfaces.d.ts +1 -1
- package/dist/types/components/accordion/components/accordion-section.d.ts +4 -8
- package/dist/types/components/action-list/action-list.d.ts +5 -0
- package/dist/types/components/action-list/components/action-list-item.d.ts +15 -0
- package/dist/types/components/dropdown-menu/dropdown-menu.d.ts +5 -0
- package/dist/types/components/expandable/expandable.d.ts +25 -1
- package/dist/types/components/expandable/expandable.interfaces.d.ts +10 -0
- package/dist/types/components/expandable-heading/expandable-heading.d.ts +2 -1
- package/dist/types/components/expandable-heading/expandable-heading.interfaces.d.ts +1 -0
- package/dist/types/components/header/header.d.ts +3 -0
- package/dist/types/components/label/label.d.ts +0 -1
- package/dist/types/components/modal/modal-ref.d.ts +8 -0
- package/dist/types/components/modal/modal.controller.d.ts +6 -0
- package/dist/types/components/modal/modal.d.ts +1 -2
- package/dist/types/components/modal/modal.interfaces.d.ts +12 -0
- package/dist/types/components.d.ts +82 -4
- package/dist/types/index.d.ts +2 -0
- package/package.json +11 -11
- package/dist/dso-toolkit/p-0fcdc369.entry.js +0 -1
- package/dist/dso-toolkit/p-147ec7bd.entry.js +0 -1
- package/dist/dso-toolkit/p-22f9240a.entry.js +0 -1
- package/dist/dso-toolkit/p-3635427a.js +0 -5
- package/dist/dso-toolkit/p-3b83e9c6.entry.js +0 -1
- package/dist/dso-toolkit/p-452c7fbb.entry.js +0 -1
- package/dist/dso-toolkit/p-4ae40ddc.entry.js +0 -1
- package/dist/dso-toolkit/p-4c8426b7.entry.js +0 -1
- package/dist/dso-toolkit/p-57ceabab.js +0 -5
- package/dist/dso-toolkit/p-9984079e.entry.js +0 -1
- package/dist/dso-toolkit/p-cece17a5.entry.js +0 -1
- package/dist/dso-toolkit/p-d3ed00f6.js +0 -1
- package/dist/dso-toolkit/p-e3bd7689.entry.js +0 -1
- package/dist/dso-toolkit/p-f3f0d6c9.entry.js +0 -1
|
@@ -1,1313 +1,5 @@
|
|
|
1
1
|
import { h, r as registerInstance, f as forceUpdate, F as Fragment, H as Host, g as getElement } from './index-ac5a22a3.js';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
/*
|
|
5
|
-
* anime.js v3.2.1
|
|
6
|
-
* (c) 2020 Julian Garnier
|
|
7
|
-
* Released under the MIT license
|
|
8
|
-
* animejs.com
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
// Defaults
|
|
12
|
-
|
|
13
|
-
var defaultInstanceSettings = {
|
|
14
|
-
update: null,
|
|
15
|
-
begin: null,
|
|
16
|
-
loopBegin: null,
|
|
17
|
-
changeBegin: null,
|
|
18
|
-
change: null,
|
|
19
|
-
changeComplete: null,
|
|
20
|
-
loopComplete: null,
|
|
21
|
-
complete: null,
|
|
22
|
-
loop: 1,
|
|
23
|
-
direction: 'normal',
|
|
24
|
-
autoplay: true,
|
|
25
|
-
timelineOffset: 0
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
var defaultTweenSettings = {
|
|
29
|
-
duration: 1000,
|
|
30
|
-
delay: 0,
|
|
31
|
-
endDelay: 0,
|
|
32
|
-
easing: 'easeOutElastic(1, .5)',
|
|
33
|
-
round: 0
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
var validTransforms = ['translateX', 'translateY', 'translateZ', 'rotate', 'rotateX', 'rotateY', 'rotateZ', 'scale', 'scaleX', 'scaleY', 'scaleZ', 'skew', 'skewX', 'skewY', 'perspective', 'matrix', 'matrix3d'];
|
|
37
|
-
|
|
38
|
-
// Caching
|
|
39
|
-
|
|
40
|
-
var cache = {
|
|
41
|
-
CSS: {},
|
|
42
|
-
springs: {}
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
// Utils
|
|
46
|
-
|
|
47
|
-
function minMax(val, min, max) {
|
|
48
|
-
return Math.min(Math.max(val, min), max);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
function stringContains(str, text) {
|
|
52
|
-
return str.indexOf(text) > -1;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
function applyArguments(func, args) {
|
|
56
|
-
return func.apply(null, args);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
var is = {
|
|
60
|
-
arr: function (a) { return Array.isArray(a); },
|
|
61
|
-
obj: function (a) { return stringContains(Object.prototype.toString.call(a), 'Object'); },
|
|
62
|
-
pth: function (a) { return is.obj(a) && a.hasOwnProperty('totalLength'); },
|
|
63
|
-
svg: function (a) { return a instanceof SVGElement; },
|
|
64
|
-
inp: function (a) { return a instanceof HTMLInputElement; },
|
|
65
|
-
dom: function (a) { return a.nodeType || is.svg(a); },
|
|
66
|
-
str: function (a) { return typeof a === 'string'; },
|
|
67
|
-
fnc: function (a) { return typeof a === 'function'; },
|
|
68
|
-
und: function (a) { return typeof a === 'undefined'; },
|
|
69
|
-
nil: function (a) { return is.und(a) || a === null; },
|
|
70
|
-
hex: function (a) { return /(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(a); },
|
|
71
|
-
rgb: function (a) { return /^rgb/.test(a); },
|
|
72
|
-
hsl: function (a) { return /^hsl/.test(a); },
|
|
73
|
-
col: function (a) { return (is.hex(a) || is.rgb(a) || is.hsl(a)); },
|
|
74
|
-
key: function (a) { return !defaultInstanceSettings.hasOwnProperty(a) && !defaultTweenSettings.hasOwnProperty(a) && a !== 'targets' && a !== 'keyframes'; },
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
// Easings
|
|
78
|
-
|
|
79
|
-
function parseEasingParameters(string) {
|
|
80
|
-
var match = /\(([^)]+)\)/.exec(string);
|
|
81
|
-
return match ? match[1].split(',').map(function (p) { return parseFloat(p); }) : [];
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
// Spring solver inspired by Webkit Copyright © 2016 Apple Inc. All rights reserved. https://webkit.org/demos/spring/spring.js
|
|
85
|
-
|
|
86
|
-
function spring(string, duration) {
|
|
87
|
-
|
|
88
|
-
var params = parseEasingParameters(string);
|
|
89
|
-
var mass = minMax(is.und(params[0]) ? 1 : params[0], .1, 100);
|
|
90
|
-
var stiffness = minMax(is.und(params[1]) ? 100 : params[1], .1, 100);
|
|
91
|
-
var damping = minMax(is.und(params[2]) ? 10 : params[2], .1, 100);
|
|
92
|
-
var velocity = minMax(is.und(params[3]) ? 0 : params[3], .1, 100);
|
|
93
|
-
var w0 = Math.sqrt(stiffness / mass);
|
|
94
|
-
var zeta = damping / (2 * Math.sqrt(stiffness * mass));
|
|
95
|
-
var wd = zeta < 1 ? w0 * Math.sqrt(1 - zeta * zeta) : 0;
|
|
96
|
-
var a = 1;
|
|
97
|
-
var b = zeta < 1 ? (zeta * w0 + -velocity) / wd : -velocity + w0;
|
|
98
|
-
|
|
99
|
-
function solver(t) {
|
|
100
|
-
var progress = duration ? (duration * t) / 1000 : t;
|
|
101
|
-
if (zeta < 1) {
|
|
102
|
-
progress = Math.exp(-progress * zeta * w0) * (a * Math.cos(wd * progress) + b * Math.sin(wd * progress));
|
|
103
|
-
} else {
|
|
104
|
-
progress = (a + b * progress) * Math.exp(-progress * w0);
|
|
105
|
-
}
|
|
106
|
-
if (t === 0 || t === 1) { return t; }
|
|
107
|
-
return 1 - progress;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
function getDuration() {
|
|
111
|
-
var cached = cache.springs[string];
|
|
112
|
-
if (cached) { return cached; }
|
|
113
|
-
var frame = 1/6;
|
|
114
|
-
var elapsed = 0;
|
|
115
|
-
var rest = 0;
|
|
116
|
-
while(true) {
|
|
117
|
-
elapsed += frame;
|
|
118
|
-
if (solver(elapsed) === 1) {
|
|
119
|
-
rest++;
|
|
120
|
-
if (rest >= 16) { break; }
|
|
121
|
-
} else {
|
|
122
|
-
rest = 0;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
var duration = elapsed * frame * 1000;
|
|
126
|
-
cache.springs[string] = duration;
|
|
127
|
-
return duration;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
return duration ? solver : getDuration;
|
|
131
|
-
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
// Basic steps easing implementation https://developer.mozilla.org/fr/docs/Web/CSS/transition-timing-function
|
|
135
|
-
|
|
136
|
-
function steps(steps) {
|
|
137
|
-
if ( steps === void 0 ) steps = 10;
|
|
138
|
-
|
|
139
|
-
return function (t) { return Math.ceil((minMax(t, 0.000001, 1)) * steps) * (1 / steps); };
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
// BezierEasing https://github.com/gre/bezier-easing
|
|
143
|
-
|
|
144
|
-
var bezier = (function () {
|
|
145
|
-
|
|
146
|
-
var kSplineTableSize = 11;
|
|
147
|
-
var kSampleStepSize = 1.0 / (kSplineTableSize - 1.0);
|
|
148
|
-
|
|
149
|
-
function A(aA1, aA2) { return 1.0 - 3.0 * aA2 + 3.0 * aA1 }
|
|
150
|
-
function B(aA1, aA2) { return 3.0 * aA2 - 6.0 * aA1 }
|
|
151
|
-
function C(aA1) { return 3.0 * aA1 }
|
|
152
|
-
|
|
153
|
-
function calcBezier(aT, aA1, aA2) { return ((A(aA1, aA2) * aT + B(aA1, aA2)) * aT + C(aA1)) * aT }
|
|
154
|
-
function getSlope(aT, aA1, aA2) { return 3.0 * A(aA1, aA2) * aT * aT + 2.0 * B(aA1, aA2) * aT + C(aA1) }
|
|
155
|
-
|
|
156
|
-
function binarySubdivide(aX, aA, aB, mX1, mX2) {
|
|
157
|
-
var currentX, currentT, i = 0;
|
|
158
|
-
do {
|
|
159
|
-
currentT = aA + (aB - aA) / 2.0;
|
|
160
|
-
currentX = calcBezier(currentT, mX1, mX2) - aX;
|
|
161
|
-
if (currentX > 0.0) { aB = currentT; } else { aA = currentT; }
|
|
162
|
-
} while (Math.abs(currentX) > 0.0000001 && ++i < 10);
|
|
163
|
-
return currentT;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
function newtonRaphsonIterate(aX, aGuessT, mX1, mX2) {
|
|
167
|
-
for (var i = 0; i < 4; ++i) {
|
|
168
|
-
var currentSlope = getSlope(aGuessT, mX1, mX2);
|
|
169
|
-
if (currentSlope === 0.0) { return aGuessT; }
|
|
170
|
-
var currentX = calcBezier(aGuessT, mX1, mX2) - aX;
|
|
171
|
-
aGuessT -= currentX / currentSlope;
|
|
172
|
-
}
|
|
173
|
-
return aGuessT;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
function bezier(mX1, mY1, mX2, mY2) {
|
|
177
|
-
|
|
178
|
-
if (!(0 <= mX1 && mX1 <= 1 && 0 <= mX2 && mX2 <= 1)) { return; }
|
|
179
|
-
var sampleValues = new Float32Array(kSplineTableSize);
|
|
180
|
-
|
|
181
|
-
if (mX1 !== mY1 || mX2 !== mY2) {
|
|
182
|
-
for (var i = 0; i < kSplineTableSize; ++i) {
|
|
183
|
-
sampleValues[i] = calcBezier(i * kSampleStepSize, mX1, mX2);
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
function getTForX(aX) {
|
|
188
|
-
|
|
189
|
-
var intervalStart = 0;
|
|
190
|
-
var currentSample = 1;
|
|
191
|
-
var lastSample = kSplineTableSize - 1;
|
|
192
|
-
|
|
193
|
-
for (; currentSample !== lastSample && sampleValues[currentSample] <= aX; ++currentSample) {
|
|
194
|
-
intervalStart += kSampleStepSize;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
--currentSample;
|
|
198
|
-
|
|
199
|
-
var dist = (aX - sampleValues[currentSample]) / (sampleValues[currentSample + 1] - sampleValues[currentSample]);
|
|
200
|
-
var guessForT = intervalStart + dist * kSampleStepSize;
|
|
201
|
-
var initialSlope = getSlope(guessForT, mX1, mX2);
|
|
202
|
-
|
|
203
|
-
if (initialSlope >= 0.001) {
|
|
204
|
-
return newtonRaphsonIterate(aX, guessForT, mX1, mX2);
|
|
205
|
-
} else if (initialSlope === 0.0) {
|
|
206
|
-
return guessForT;
|
|
207
|
-
} else {
|
|
208
|
-
return binarySubdivide(aX, intervalStart, intervalStart + kSampleStepSize, mX1, mX2);
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
return function (x) {
|
|
214
|
-
if (mX1 === mY1 && mX2 === mY2) { return x; }
|
|
215
|
-
if (x === 0 || x === 1) { return x; }
|
|
216
|
-
return calcBezier(getTForX(x), mY1, mY2);
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
return bezier;
|
|
222
|
-
|
|
223
|
-
})();
|
|
224
|
-
|
|
225
|
-
var penner = (function () {
|
|
226
|
-
|
|
227
|
-
// Based on jQuery UI's implemenation of easing equations from Robert Penner (http://www.robertpenner.com/easing)
|
|
228
|
-
|
|
229
|
-
var eases = { linear: function () { return function (t) { return t; }; } };
|
|
230
|
-
|
|
231
|
-
var functionEasings = {
|
|
232
|
-
Sine: function () { return function (t) { return 1 - Math.cos(t * Math.PI / 2); }; },
|
|
233
|
-
Circ: function () { return function (t) { return 1 - Math.sqrt(1 - t * t); }; },
|
|
234
|
-
Back: function () { return function (t) { return t * t * (3 * t - 2); }; },
|
|
235
|
-
Bounce: function () { return function (t) {
|
|
236
|
-
var pow2, b = 4;
|
|
237
|
-
while (t < (( pow2 = Math.pow(2, --b)) - 1) / 11) {}
|
|
238
|
-
return 1 / Math.pow(4, 3 - b) - 7.5625 * Math.pow(( pow2 * 3 - 2 ) / 22 - t, 2)
|
|
239
|
-
}; },
|
|
240
|
-
Elastic: function (amplitude, period) {
|
|
241
|
-
if ( amplitude === void 0 ) amplitude = 1;
|
|
242
|
-
if ( period === void 0 ) period = .5;
|
|
243
|
-
|
|
244
|
-
var a = minMax(amplitude, 1, 10);
|
|
245
|
-
var p = minMax(period, .1, 2);
|
|
246
|
-
return function (t) {
|
|
247
|
-
return (t === 0 || t === 1) ? t :
|
|
248
|
-
-a * Math.pow(2, 10 * (t - 1)) * Math.sin((((t - 1) - (p / (Math.PI * 2) * Math.asin(1 / a))) * (Math.PI * 2)) / p);
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
};
|
|
252
|
-
|
|
253
|
-
var baseEasings = ['Quad', 'Cubic', 'Quart', 'Quint', 'Expo'];
|
|
254
|
-
|
|
255
|
-
baseEasings.forEach(function (name, i) {
|
|
256
|
-
functionEasings[name] = function () { return function (t) { return Math.pow(t, i + 2); }; };
|
|
257
|
-
});
|
|
258
|
-
|
|
259
|
-
Object.keys(functionEasings).forEach(function (name) {
|
|
260
|
-
var easeIn = functionEasings[name];
|
|
261
|
-
eases['easeIn' + name] = easeIn;
|
|
262
|
-
eases['easeOut' + name] = function (a, b) { return function (t) { return 1 - easeIn(a, b)(1 - t); }; };
|
|
263
|
-
eases['easeInOut' + name] = function (a, b) { return function (t) { return t < 0.5 ? easeIn(a, b)(t * 2) / 2 :
|
|
264
|
-
1 - easeIn(a, b)(t * -2 + 2) / 2; }; };
|
|
265
|
-
eases['easeOutIn' + name] = function (a, b) { return function (t) { return t < 0.5 ? (1 - easeIn(a, b)(1 - t * 2)) / 2 :
|
|
266
|
-
(easeIn(a, b)(t * 2 - 1) + 1) / 2; }; };
|
|
267
|
-
});
|
|
268
|
-
|
|
269
|
-
return eases;
|
|
270
|
-
|
|
271
|
-
})();
|
|
272
|
-
|
|
273
|
-
function parseEasings(easing, duration) {
|
|
274
|
-
if (is.fnc(easing)) { return easing; }
|
|
275
|
-
var name = easing.split('(')[0];
|
|
276
|
-
var ease = penner[name];
|
|
277
|
-
var args = parseEasingParameters(easing);
|
|
278
|
-
switch (name) {
|
|
279
|
-
case 'spring' : return spring(easing, duration);
|
|
280
|
-
case 'cubicBezier' : return applyArguments(bezier, args);
|
|
281
|
-
case 'steps' : return applyArguments(steps, args);
|
|
282
|
-
default : return applyArguments(ease, args);
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
// Strings
|
|
287
|
-
|
|
288
|
-
function selectString(str) {
|
|
289
|
-
try {
|
|
290
|
-
var nodes = document.querySelectorAll(str);
|
|
291
|
-
return nodes;
|
|
292
|
-
} catch(e) {
|
|
293
|
-
return;
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
// Arrays
|
|
298
|
-
|
|
299
|
-
function filterArray(arr, callback) {
|
|
300
|
-
var len = arr.length;
|
|
301
|
-
var thisArg = arguments.length >= 2 ? arguments[1] : void 0;
|
|
302
|
-
var result = [];
|
|
303
|
-
for (var i = 0; i < len; i++) {
|
|
304
|
-
if (i in arr) {
|
|
305
|
-
var val = arr[i];
|
|
306
|
-
if (callback.call(thisArg, val, i, arr)) {
|
|
307
|
-
result.push(val);
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
return result;
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
function flattenArray(arr) {
|
|
315
|
-
return arr.reduce(function (a, b) { return a.concat(is.arr(b) ? flattenArray(b) : b); }, []);
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
function toArray(o) {
|
|
319
|
-
if (is.arr(o)) { return o; }
|
|
320
|
-
if (is.str(o)) { o = selectString(o) || o; }
|
|
321
|
-
if (o instanceof NodeList || o instanceof HTMLCollection) { return [].slice.call(o); }
|
|
322
|
-
return [o];
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
function arrayContains(arr, val) {
|
|
326
|
-
return arr.some(function (a) { return a === val; });
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
// Objects
|
|
330
|
-
|
|
331
|
-
function cloneObject(o) {
|
|
332
|
-
var clone = {};
|
|
333
|
-
for (var p in o) { clone[p] = o[p]; }
|
|
334
|
-
return clone;
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
function replaceObjectProps(o1, o2) {
|
|
338
|
-
var o = cloneObject(o1);
|
|
339
|
-
for (var p in o1) { o[p] = o2.hasOwnProperty(p) ? o2[p] : o1[p]; }
|
|
340
|
-
return o;
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
function mergeObjects(o1, o2) {
|
|
344
|
-
var o = cloneObject(o1);
|
|
345
|
-
for (var p in o2) { o[p] = is.und(o1[p]) ? o2[p] : o1[p]; }
|
|
346
|
-
return o;
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
// Colors
|
|
350
|
-
|
|
351
|
-
function rgbToRgba(rgbValue) {
|
|
352
|
-
var rgb = /rgb\((\d+,\s*[\d]+,\s*[\d]+)\)/g.exec(rgbValue);
|
|
353
|
-
return rgb ? ("rgba(" + (rgb[1]) + ",1)") : rgbValue;
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
function hexToRgba(hexValue) {
|
|
357
|
-
var rgx = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
|
|
358
|
-
var hex = hexValue.replace(rgx, function (m, r, g, b) { return r + r + g + g + b + b; } );
|
|
359
|
-
var rgb = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
|
|
360
|
-
var r = parseInt(rgb[1], 16);
|
|
361
|
-
var g = parseInt(rgb[2], 16);
|
|
362
|
-
var b = parseInt(rgb[3], 16);
|
|
363
|
-
return ("rgba(" + r + "," + g + "," + b + ",1)");
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
function hslToRgba(hslValue) {
|
|
367
|
-
var hsl = /hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(hslValue) || /hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)/g.exec(hslValue);
|
|
368
|
-
var h = parseInt(hsl[1], 10) / 360;
|
|
369
|
-
var s = parseInt(hsl[2], 10) / 100;
|
|
370
|
-
var l = parseInt(hsl[3], 10) / 100;
|
|
371
|
-
var a = hsl[4] || 1;
|
|
372
|
-
function hue2rgb(p, q, t) {
|
|
373
|
-
if (t < 0) { t += 1; }
|
|
374
|
-
if (t > 1) { t -= 1; }
|
|
375
|
-
if (t < 1/6) { return p + (q - p) * 6 * t; }
|
|
376
|
-
if (t < 1/2) { return q; }
|
|
377
|
-
if (t < 2/3) { return p + (q - p) * (2/3 - t) * 6; }
|
|
378
|
-
return p;
|
|
379
|
-
}
|
|
380
|
-
var r, g, b;
|
|
381
|
-
if (s == 0) {
|
|
382
|
-
r = g = b = l;
|
|
383
|
-
} else {
|
|
384
|
-
var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
|
|
385
|
-
var p = 2 * l - q;
|
|
386
|
-
r = hue2rgb(p, q, h + 1/3);
|
|
387
|
-
g = hue2rgb(p, q, h);
|
|
388
|
-
b = hue2rgb(p, q, h - 1/3);
|
|
389
|
-
}
|
|
390
|
-
return ("rgba(" + (r * 255) + "," + (g * 255) + "," + (b * 255) + "," + a + ")");
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
function colorToRgb(val) {
|
|
394
|
-
if (is.rgb(val)) { return rgbToRgba(val); }
|
|
395
|
-
if (is.hex(val)) { return hexToRgba(val); }
|
|
396
|
-
if (is.hsl(val)) { return hslToRgba(val); }
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
// Units
|
|
400
|
-
|
|
401
|
-
function getUnit(val) {
|
|
402
|
-
var split = /[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?(%|px|pt|em|rem|in|cm|mm|ex|ch|pc|vw|vh|vmin|vmax|deg|rad|turn)?$/.exec(val);
|
|
403
|
-
if (split) { return split[1]; }
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
function getTransformUnit(propName) {
|
|
407
|
-
if (stringContains(propName, 'translate') || propName === 'perspective') { return 'px'; }
|
|
408
|
-
if (stringContains(propName, 'rotate') || stringContains(propName, 'skew')) { return 'deg'; }
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
// Values
|
|
412
|
-
|
|
413
|
-
function getFunctionValue(val, animatable) {
|
|
414
|
-
if (!is.fnc(val)) { return val; }
|
|
415
|
-
return val(animatable.target, animatable.id, animatable.total);
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
function getAttribute(el, prop) {
|
|
419
|
-
return el.getAttribute(prop);
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
function convertPxToUnit(el, value, unit) {
|
|
423
|
-
var valueUnit = getUnit(value);
|
|
424
|
-
if (arrayContains([unit, 'deg', 'rad', 'turn'], valueUnit)) { return value; }
|
|
425
|
-
var cached = cache.CSS[value + unit];
|
|
426
|
-
if (!is.und(cached)) { return cached; }
|
|
427
|
-
var baseline = 100;
|
|
428
|
-
var tempEl = document.createElement(el.tagName);
|
|
429
|
-
var parentEl = (el.parentNode && (el.parentNode !== document)) ? el.parentNode : document.body;
|
|
430
|
-
parentEl.appendChild(tempEl);
|
|
431
|
-
tempEl.style.position = 'absolute';
|
|
432
|
-
tempEl.style.width = baseline + unit;
|
|
433
|
-
var factor = baseline / tempEl.offsetWidth;
|
|
434
|
-
parentEl.removeChild(tempEl);
|
|
435
|
-
var convertedUnit = factor * parseFloat(value);
|
|
436
|
-
cache.CSS[value + unit] = convertedUnit;
|
|
437
|
-
return convertedUnit;
|
|
438
|
-
}
|
|
439
|
-
|
|
440
|
-
function getCSSValue(el, prop, unit) {
|
|
441
|
-
if (prop in el.style) {
|
|
442
|
-
var uppercasePropName = prop.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
|
|
443
|
-
var value = el.style[prop] || getComputedStyle(el).getPropertyValue(uppercasePropName) || '0';
|
|
444
|
-
return unit ? convertPxToUnit(el, value, unit) : value;
|
|
445
|
-
}
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
function getAnimationType(el, prop) {
|
|
449
|
-
if (is.dom(el) && !is.inp(el) && (!is.nil(getAttribute(el, prop)) || (is.svg(el) && el[prop]))) { return 'attribute'; }
|
|
450
|
-
if (is.dom(el) && arrayContains(validTransforms, prop)) { return 'transform'; }
|
|
451
|
-
if (is.dom(el) && (prop !== 'transform' && getCSSValue(el, prop))) { return 'css'; }
|
|
452
|
-
if (el[prop] != null) { return 'object'; }
|
|
453
|
-
}
|
|
454
|
-
|
|
455
|
-
function getElementTransforms(el) {
|
|
456
|
-
if (!is.dom(el)) { return; }
|
|
457
|
-
var str = el.style.transform || '';
|
|
458
|
-
var reg = /(\w+)\(([^)]*)\)/g;
|
|
459
|
-
var transforms = new Map();
|
|
460
|
-
var m; while (m = reg.exec(str)) { transforms.set(m[1], m[2]); }
|
|
461
|
-
return transforms;
|
|
462
|
-
}
|
|
463
|
-
|
|
464
|
-
function getTransformValue(el, propName, animatable, unit) {
|
|
465
|
-
var defaultVal = stringContains(propName, 'scale') ? 1 : 0 + getTransformUnit(propName);
|
|
466
|
-
var value = getElementTransforms(el).get(propName) || defaultVal;
|
|
467
|
-
if (animatable) {
|
|
468
|
-
animatable.transforms.list.set(propName, value);
|
|
469
|
-
animatable.transforms['last'] = propName;
|
|
470
|
-
}
|
|
471
|
-
return unit ? convertPxToUnit(el, value, unit) : value;
|
|
472
|
-
}
|
|
473
|
-
|
|
474
|
-
function getOriginalTargetValue(target, propName, unit, animatable) {
|
|
475
|
-
switch (getAnimationType(target, propName)) {
|
|
476
|
-
case 'transform': return getTransformValue(target, propName, animatable, unit);
|
|
477
|
-
case 'css': return getCSSValue(target, propName, unit);
|
|
478
|
-
case 'attribute': return getAttribute(target, propName);
|
|
479
|
-
default: return target[propName] || 0;
|
|
480
|
-
}
|
|
481
|
-
}
|
|
482
|
-
|
|
483
|
-
function getRelativeValue(to, from) {
|
|
484
|
-
var operator = /^(\*=|\+=|-=)/.exec(to);
|
|
485
|
-
if (!operator) { return to; }
|
|
486
|
-
var u = getUnit(to) || 0;
|
|
487
|
-
var x = parseFloat(from);
|
|
488
|
-
var y = parseFloat(to.replace(operator[0], ''));
|
|
489
|
-
switch (operator[0][0]) {
|
|
490
|
-
case '+': return x + y + u;
|
|
491
|
-
case '-': return x - y + u;
|
|
492
|
-
case '*': return x * y + u;
|
|
493
|
-
}
|
|
494
|
-
}
|
|
495
|
-
|
|
496
|
-
function validateValue(val, unit) {
|
|
497
|
-
if (is.col(val)) { return colorToRgb(val); }
|
|
498
|
-
if (/\s/g.test(val)) { return val; }
|
|
499
|
-
var originalUnit = getUnit(val);
|
|
500
|
-
var unitLess = originalUnit ? val.substr(0, val.length - originalUnit.length) : val;
|
|
501
|
-
if (unit) { return unitLess + unit; }
|
|
502
|
-
return unitLess;
|
|
503
|
-
}
|
|
504
|
-
|
|
505
|
-
// getTotalLength() equivalent for circle, rect, polyline, polygon and line shapes
|
|
506
|
-
// adapted from https://gist.github.com/SebLambla/3e0550c496c236709744
|
|
507
|
-
|
|
508
|
-
function getDistance(p1, p2) {
|
|
509
|
-
return Math.sqrt(Math.pow(p2.x - p1.x, 2) + Math.pow(p2.y - p1.y, 2));
|
|
510
|
-
}
|
|
511
|
-
|
|
512
|
-
function getCircleLength(el) {
|
|
513
|
-
return Math.PI * 2 * getAttribute(el, 'r');
|
|
514
|
-
}
|
|
515
|
-
|
|
516
|
-
function getRectLength(el) {
|
|
517
|
-
return (getAttribute(el, 'width') * 2) + (getAttribute(el, 'height') * 2);
|
|
518
|
-
}
|
|
519
|
-
|
|
520
|
-
function getLineLength(el) {
|
|
521
|
-
return getDistance(
|
|
522
|
-
{x: getAttribute(el, 'x1'), y: getAttribute(el, 'y1')},
|
|
523
|
-
{x: getAttribute(el, 'x2'), y: getAttribute(el, 'y2')}
|
|
524
|
-
);
|
|
525
|
-
}
|
|
526
|
-
|
|
527
|
-
function getPolylineLength(el) {
|
|
528
|
-
var points = el.points;
|
|
529
|
-
var totalLength = 0;
|
|
530
|
-
var previousPos;
|
|
531
|
-
for (var i = 0 ; i < points.numberOfItems; i++) {
|
|
532
|
-
var currentPos = points.getItem(i);
|
|
533
|
-
if (i > 0) { totalLength += getDistance(previousPos, currentPos); }
|
|
534
|
-
previousPos = currentPos;
|
|
535
|
-
}
|
|
536
|
-
return totalLength;
|
|
537
|
-
}
|
|
538
|
-
|
|
539
|
-
function getPolygonLength(el) {
|
|
540
|
-
var points = el.points;
|
|
541
|
-
return getPolylineLength(el) + getDistance(points.getItem(points.numberOfItems - 1), points.getItem(0));
|
|
542
|
-
}
|
|
543
|
-
|
|
544
|
-
// Path animation
|
|
545
|
-
|
|
546
|
-
function getTotalLength(el) {
|
|
547
|
-
if (el.getTotalLength) { return el.getTotalLength(); }
|
|
548
|
-
switch(el.tagName.toLowerCase()) {
|
|
549
|
-
case 'circle': return getCircleLength(el);
|
|
550
|
-
case 'rect': return getRectLength(el);
|
|
551
|
-
case 'line': return getLineLength(el);
|
|
552
|
-
case 'polyline': return getPolylineLength(el);
|
|
553
|
-
case 'polygon': return getPolygonLength(el);
|
|
554
|
-
}
|
|
555
|
-
}
|
|
556
|
-
|
|
557
|
-
function setDashoffset(el) {
|
|
558
|
-
var pathLength = getTotalLength(el);
|
|
559
|
-
el.setAttribute('stroke-dasharray', pathLength);
|
|
560
|
-
return pathLength;
|
|
561
|
-
}
|
|
562
|
-
|
|
563
|
-
// Motion path
|
|
564
|
-
|
|
565
|
-
function getParentSvgEl(el) {
|
|
566
|
-
var parentEl = el.parentNode;
|
|
567
|
-
while (is.svg(parentEl)) {
|
|
568
|
-
if (!is.svg(parentEl.parentNode)) { break; }
|
|
569
|
-
parentEl = parentEl.parentNode;
|
|
570
|
-
}
|
|
571
|
-
return parentEl;
|
|
572
|
-
}
|
|
573
|
-
|
|
574
|
-
function getParentSvg(pathEl, svgData) {
|
|
575
|
-
var svg = svgData || {};
|
|
576
|
-
var parentSvgEl = svg.el || getParentSvgEl(pathEl);
|
|
577
|
-
var rect = parentSvgEl.getBoundingClientRect();
|
|
578
|
-
var viewBoxAttr = getAttribute(parentSvgEl, 'viewBox');
|
|
579
|
-
var width = rect.width;
|
|
580
|
-
var height = rect.height;
|
|
581
|
-
var viewBox = svg.viewBox || (viewBoxAttr ? viewBoxAttr.split(' ') : [0, 0, width, height]);
|
|
582
|
-
return {
|
|
583
|
-
el: parentSvgEl,
|
|
584
|
-
viewBox: viewBox,
|
|
585
|
-
x: viewBox[0] / 1,
|
|
586
|
-
y: viewBox[1] / 1,
|
|
587
|
-
w: width,
|
|
588
|
-
h: height,
|
|
589
|
-
vW: viewBox[2],
|
|
590
|
-
vH: viewBox[3]
|
|
591
|
-
}
|
|
592
|
-
}
|
|
593
|
-
|
|
594
|
-
function getPath(path, percent) {
|
|
595
|
-
var pathEl = is.str(path) ? selectString(path)[0] : path;
|
|
596
|
-
var p = percent || 100;
|
|
597
|
-
return function(property) {
|
|
598
|
-
return {
|
|
599
|
-
property: property,
|
|
600
|
-
el: pathEl,
|
|
601
|
-
svg: getParentSvg(pathEl),
|
|
602
|
-
totalLength: getTotalLength(pathEl) * (p / 100)
|
|
603
|
-
}
|
|
604
|
-
}
|
|
605
|
-
}
|
|
606
|
-
|
|
607
|
-
function getPathProgress(path, progress, isPathTargetInsideSVG) {
|
|
608
|
-
function point(offset) {
|
|
609
|
-
if ( offset === void 0 ) offset = 0;
|
|
610
|
-
|
|
611
|
-
var l = progress + offset >= 1 ? progress + offset : 0;
|
|
612
|
-
return path.el.getPointAtLength(l);
|
|
613
|
-
}
|
|
614
|
-
var svg = getParentSvg(path.el, path.svg);
|
|
615
|
-
var p = point();
|
|
616
|
-
var p0 = point(-1);
|
|
617
|
-
var p1 = point(+1);
|
|
618
|
-
var scaleX = isPathTargetInsideSVG ? 1 : svg.w / svg.vW;
|
|
619
|
-
var scaleY = isPathTargetInsideSVG ? 1 : svg.h / svg.vH;
|
|
620
|
-
switch (path.property) {
|
|
621
|
-
case 'x': return (p.x - svg.x) * scaleX;
|
|
622
|
-
case 'y': return (p.y - svg.y) * scaleY;
|
|
623
|
-
case 'angle': return Math.atan2(p1.y - p0.y, p1.x - p0.x) * 180 / Math.PI;
|
|
624
|
-
}
|
|
625
|
-
}
|
|
626
|
-
|
|
627
|
-
// Decompose value
|
|
628
|
-
|
|
629
|
-
function decomposeValue(val, unit) {
|
|
630
|
-
// const rgx = /-?\d*\.?\d+/g; // handles basic numbers
|
|
631
|
-
// const rgx = /[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/g; // handles exponents notation
|
|
632
|
-
var rgx = /[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/g; // handles exponents notation
|
|
633
|
-
var value = validateValue((is.pth(val) ? val.totalLength : val), unit) + '';
|
|
634
|
-
return {
|
|
635
|
-
original: value,
|
|
636
|
-
numbers: value.match(rgx) ? value.match(rgx).map(Number) : [0],
|
|
637
|
-
strings: (is.str(val) || unit) ? value.split(rgx) : []
|
|
638
|
-
}
|
|
639
|
-
}
|
|
640
|
-
|
|
641
|
-
// Animatables
|
|
642
|
-
|
|
643
|
-
function parseTargets(targets) {
|
|
644
|
-
var targetsArray = targets ? (flattenArray(is.arr(targets) ? targets.map(toArray) : toArray(targets))) : [];
|
|
645
|
-
return filterArray(targetsArray, function (item, pos, self) { return self.indexOf(item) === pos; });
|
|
646
|
-
}
|
|
647
|
-
|
|
648
|
-
function getAnimatables(targets) {
|
|
649
|
-
var parsed = parseTargets(targets);
|
|
650
|
-
return parsed.map(function (t, i) {
|
|
651
|
-
return {target: t, id: i, total: parsed.length, transforms: { list: getElementTransforms(t) } };
|
|
652
|
-
});
|
|
653
|
-
}
|
|
654
|
-
|
|
655
|
-
// Properties
|
|
656
|
-
|
|
657
|
-
function normalizePropertyTweens(prop, tweenSettings) {
|
|
658
|
-
var settings = cloneObject(tweenSettings);
|
|
659
|
-
// Override duration if easing is a spring
|
|
660
|
-
if (/^spring/.test(settings.easing)) { settings.duration = spring(settings.easing); }
|
|
661
|
-
if (is.arr(prop)) {
|
|
662
|
-
var l = prop.length;
|
|
663
|
-
var isFromTo = (l === 2 && !is.obj(prop[0]));
|
|
664
|
-
if (!isFromTo) {
|
|
665
|
-
// Duration divided by the number of tweens
|
|
666
|
-
if (!is.fnc(tweenSettings.duration)) { settings.duration = tweenSettings.duration / l; }
|
|
667
|
-
} else {
|
|
668
|
-
// Transform [from, to] values shorthand to a valid tween value
|
|
669
|
-
prop = {value: prop};
|
|
670
|
-
}
|
|
671
|
-
}
|
|
672
|
-
var propArray = is.arr(prop) ? prop : [prop];
|
|
673
|
-
return propArray.map(function (v, i) {
|
|
674
|
-
var obj = (is.obj(v) && !is.pth(v)) ? v : {value: v};
|
|
675
|
-
// Default delay value should only be applied to the first tween
|
|
676
|
-
if (is.und(obj.delay)) { obj.delay = !i ? tweenSettings.delay : 0; }
|
|
677
|
-
// Default endDelay value should only be applied to the last tween
|
|
678
|
-
if (is.und(obj.endDelay)) { obj.endDelay = i === propArray.length - 1 ? tweenSettings.endDelay : 0; }
|
|
679
|
-
return obj;
|
|
680
|
-
}).map(function (k) { return mergeObjects(k, settings); });
|
|
681
|
-
}
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
function flattenKeyframes(keyframes) {
|
|
685
|
-
var propertyNames = filterArray(flattenArray(keyframes.map(function (key) { return Object.keys(key); })), function (p) { return is.key(p); })
|
|
686
|
-
.reduce(function (a,b) { if (a.indexOf(b) < 0) { a.push(b); } return a; }, []);
|
|
687
|
-
var properties = {};
|
|
688
|
-
var loop = function ( i ) {
|
|
689
|
-
var propName = propertyNames[i];
|
|
690
|
-
properties[propName] = keyframes.map(function (key) {
|
|
691
|
-
var newKey = {};
|
|
692
|
-
for (var p in key) {
|
|
693
|
-
if (is.key(p)) {
|
|
694
|
-
if (p == propName) { newKey.value = key[p]; }
|
|
695
|
-
} else {
|
|
696
|
-
newKey[p] = key[p];
|
|
697
|
-
}
|
|
698
|
-
}
|
|
699
|
-
return newKey;
|
|
700
|
-
});
|
|
701
|
-
};
|
|
702
|
-
|
|
703
|
-
for (var i = 0; i < propertyNames.length; i++) loop( i );
|
|
704
|
-
return properties;
|
|
705
|
-
}
|
|
706
|
-
|
|
707
|
-
function getProperties(tweenSettings, params) {
|
|
708
|
-
var properties = [];
|
|
709
|
-
var keyframes = params.keyframes;
|
|
710
|
-
if (keyframes) { params = mergeObjects(flattenKeyframes(keyframes), params); }
|
|
711
|
-
for (var p in params) {
|
|
712
|
-
if (is.key(p)) {
|
|
713
|
-
properties.push({
|
|
714
|
-
name: p,
|
|
715
|
-
tweens: normalizePropertyTweens(params[p], tweenSettings)
|
|
716
|
-
});
|
|
717
|
-
}
|
|
718
|
-
}
|
|
719
|
-
return properties;
|
|
720
|
-
}
|
|
721
|
-
|
|
722
|
-
// Tweens
|
|
723
|
-
|
|
724
|
-
function normalizeTweenValues(tween, animatable) {
|
|
725
|
-
var t = {};
|
|
726
|
-
for (var p in tween) {
|
|
727
|
-
var value = getFunctionValue(tween[p], animatable);
|
|
728
|
-
if (is.arr(value)) {
|
|
729
|
-
value = value.map(function (v) { return getFunctionValue(v, animatable); });
|
|
730
|
-
if (value.length === 1) { value = value[0]; }
|
|
731
|
-
}
|
|
732
|
-
t[p] = value;
|
|
733
|
-
}
|
|
734
|
-
t.duration = parseFloat(t.duration);
|
|
735
|
-
t.delay = parseFloat(t.delay);
|
|
736
|
-
return t;
|
|
737
|
-
}
|
|
738
|
-
|
|
739
|
-
function normalizeTweens(prop, animatable) {
|
|
740
|
-
var previousTween;
|
|
741
|
-
return prop.tweens.map(function (t) {
|
|
742
|
-
var tween = normalizeTweenValues(t, animatable);
|
|
743
|
-
var tweenValue = tween.value;
|
|
744
|
-
var to = is.arr(tweenValue) ? tweenValue[1] : tweenValue;
|
|
745
|
-
var toUnit = getUnit(to);
|
|
746
|
-
var originalValue = getOriginalTargetValue(animatable.target, prop.name, toUnit, animatable);
|
|
747
|
-
var previousValue = previousTween ? previousTween.to.original : originalValue;
|
|
748
|
-
var from = is.arr(tweenValue) ? tweenValue[0] : previousValue;
|
|
749
|
-
var fromUnit = getUnit(from) || getUnit(originalValue);
|
|
750
|
-
var unit = toUnit || fromUnit;
|
|
751
|
-
if (is.und(to)) { to = previousValue; }
|
|
752
|
-
tween.from = decomposeValue(from, unit);
|
|
753
|
-
tween.to = decomposeValue(getRelativeValue(to, from), unit);
|
|
754
|
-
tween.start = previousTween ? previousTween.end : 0;
|
|
755
|
-
tween.end = tween.start + tween.delay + tween.duration + tween.endDelay;
|
|
756
|
-
tween.easing = parseEasings(tween.easing, tween.duration);
|
|
757
|
-
tween.isPath = is.pth(tweenValue);
|
|
758
|
-
tween.isPathTargetInsideSVG = tween.isPath && is.svg(animatable.target);
|
|
759
|
-
tween.isColor = is.col(tween.from.original);
|
|
760
|
-
if (tween.isColor) { tween.round = 1; }
|
|
761
|
-
previousTween = tween;
|
|
762
|
-
return tween;
|
|
763
|
-
});
|
|
764
|
-
}
|
|
765
|
-
|
|
766
|
-
// Tween progress
|
|
767
|
-
|
|
768
|
-
var setProgressValue = {
|
|
769
|
-
css: function (t, p, v) { return t.style[p] = v; },
|
|
770
|
-
attribute: function (t, p, v) { return t.setAttribute(p, v); },
|
|
771
|
-
object: function (t, p, v) { return t[p] = v; },
|
|
772
|
-
transform: function (t, p, v, transforms, manual) {
|
|
773
|
-
transforms.list.set(p, v);
|
|
774
|
-
if (p === transforms.last || manual) {
|
|
775
|
-
var str = '';
|
|
776
|
-
transforms.list.forEach(function (value, prop) { str += prop + "(" + value + ") "; });
|
|
777
|
-
t.style.transform = str;
|
|
778
|
-
}
|
|
779
|
-
}
|
|
780
|
-
};
|
|
781
|
-
|
|
782
|
-
// Set Value helper
|
|
783
|
-
|
|
784
|
-
function setTargetsValue(targets, properties) {
|
|
785
|
-
var animatables = getAnimatables(targets);
|
|
786
|
-
animatables.forEach(function (animatable) {
|
|
787
|
-
for (var property in properties) {
|
|
788
|
-
var value = getFunctionValue(properties[property], animatable);
|
|
789
|
-
var target = animatable.target;
|
|
790
|
-
var valueUnit = getUnit(value);
|
|
791
|
-
var originalValue = getOriginalTargetValue(target, property, valueUnit, animatable);
|
|
792
|
-
var unit = valueUnit || getUnit(originalValue);
|
|
793
|
-
var to = getRelativeValue(validateValue(value, unit), originalValue);
|
|
794
|
-
var animType = getAnimationType(target, property);
|
|
795
|
-
setProgressValue[animType](target, property, to, animatable.transforms, true);
|
|
796
|
-
}
|
|
797
|
-
});
|
|
798
|
-
}
|
|
799
|
-
|
|
800
|
-
// Animations
|
|
801
|
-
|
|
802
|
-
function createAnimation(animatable, prop) {
|
|
803
|
-
var animType = getAnimationType(animatable.target, prop.name);
|
|
804
|
-
if (animType) {
|
|
805
|
-
var tweens = normalizeTweens(prop, animatable);
|
|
806
|
-
var lastTween = tweens[tweens.length - 1];
|
|
807
|
-
return {
|
|
808
|
-
type: animType,
|
|
809
|
-
property: prop.name,
|
|
810
|
-
animatable: animatable,
|
|
811
|
-
tweens: tweens,
|
|
812
|
-
duration: lastTween.end,
|
|
813
|
-
delay: tweens[0].delay,
|
|
814
|
-
endDelay: lastTween.endDelay
|
|
815
|
-
}
|
|
816
|
-
}
|
|
817
|
-
}
|
|
818
|
-
|
|
819
|
-
function getAnimations(animatables, properties) {
|
|
820
|
-
return filterArray(flattenArray(animatables.map(function (animatable) {
|
|
821
|
-
return properties.map(function (prop) {
|
|
822
|
-
return createAnimation(animatable, prop);
|
|
823
|
-
});
|
|
824
|
-
})), function (a) { return !is.und(a); });
|
|
825
|
-
}
|
|
826
|
-
|
|
827
|
-
// Create Instance
|
|
828
|
-
|
|
829
|
-
function getInstanceTimings(animations, tweenSettings) {
|
|
830
|
-
var animLength = animations.length;
|
|
831
|
-
var getTlOffset = function (anim) { return anim.timelineOffset ? anim.timelineOffset : 0; };
|
|
832
|
-
var timings = {};
|
|
833
|
-
timings.duration = animLength ? Math.max.apply(Math, animations.map(function (anim) { return getTlOffset(anim) + anim.duration; })) : tweenSettings.duration;
|
|
834
|
-
timings.delay = animLength ? Math.min.apply(Math, animations.map(function (anim) { return getTlOffset(anim) + anim.delay; })) : tweenSettings.delay;
|
|
835
|
-
timings.endDelay = animLength ? timings.duration - Math.max.apply(Math, animations.map(function (anim) { return getTlOffset(anim) + anim.duration - anim.endDelay; })) : tweenSettings.endDelay;
|
|
836
|
-
return timings;
|
|
837
|
-
}
|
|
838
|
-
|
|
839
|
-
var instanceID = 0;
|
|
840
|
-
|
|
841
|
-
function createNewInstance(params) {
|
|
842
|
-
var instanceSettings = replaceObjectProps(defaultInstanceSettings, params);
|
|
843
|
-
var tweenSettings = replaceObjectProps(defaultTweenSettings, params);
|
|
844
|
-
var properties = getProperties(tweenSettings, params);
|
|
845
|
-
var animatables = getAnimatables(params.targets);
|
|
846
|
-
var animations = getAnimations(animatables, properties);
|
|
847
|
-
var timings = getInstanceTimings(animations, tweenSettings);
|
|
848
|
-
var id = instanceID;
|
|
849
|
-
instanceID++;
|
|
850
|
-
return mergeObjects(instanceSettings, {
|
|
851
|
-
id: id,
|
|
852
|
-
children: [],
|
|
853
|
-
animatables: animatables,
|
|
854
|
-
animations: animations,
|
|
855
|
-
duration: timings.duration,
|
|
856
|
-
delay: timings.delay,
|
|
857
|
-
endDelay: timings.endDelay
|
|
858
|
-
});
|
|
859
|
-
}
|
|
860
|
-
|
|
861
|
-
// Core
|
|
862
|
-
|
|
863
|
-
var activeInstances = [];
|
|
864
|
-
|
|
865
|
-
var engine = (function () {
|
|
866
|
-
var raf;
|
|
867
|
-
|
|
868
|
-
function play() {
|
|
869
|
-
if (!raf && (!isDocumentHidden() || !anime.suspendWhenDocumentHidden) && activeInstances.length > 0) {
|
|
870
|
-
raf = requestAnimationFrame(step);
|
|
871
|
-
}
|
|
872
|
-
}
|
|
873
|
-
function step(t) {
|
|
874
|
-
// memo on algorithm issue:
|
|
875
|
-
// dangerous iteration over mutable `activeInstances`
|
|
876
|
-
// (that collection may be updated from within callbacks of `tick`-ed animation instances)
|
|
877
|
-
var activeInstancesLength = activeInstances.length;
|
|
878
|
-
var i = 0;
|
|
879
|
-
while (i < activeInstancesLength) {
|
|
880
|
-
var activeInstance = activeInstances[i];
|
|
881
|
-
if (!activeInstance.paused) {
|
|
882
|
-
activeInstance.tick(t);
|
|
883
|
-
i++;
|
|
884
|
-
} else {
|
|
885
|
-
activeInstances.splice(i, 1);
|
|
886
|
-
activeInstancesLength--;
|
|
887
|
-
}
|
|
888
|
-
}
|
|
889
|
-
raf = i > 0 ? requestAnimationFrame(step) : undefined;
|
|
890
|
-
}
|
|
891
|
-
|
|
892
|
-
function handleVisibilityChange() {
|
|
893
|
-
if (!anime.suspendWhenDocumentHidden) { return; }
|
|
894
|
-
|
|
895
|
-
if (isDocumentHidden()) {
|
|
896
|
-
// suspend ticks
|
|
897
|
-
raf = cancelAnimationFrame(raf);
|
|
898
|
-
} else { // is back to active tab
|
|
899
|
-
// first adjust animations to consider the time that ticks were suspended
|
|
900
|
-
activeInstances.forEach(
|
|
901
|
-
function (instance) { return instance ._onDocumentVisibility(); }
|
|
902
|
-
);
|
|
903
|
-
engine();
|
|
904
|
-
}
|
|
905
|
-
}
|
|
906
|
-
if (typeof document !== 'undefined') {
|
|
907
|
-
document.addEventListener('visibilitychange', handleVisibilityChange);
|
|
908
|
-
}
|
|
909
|
-
|
|
910
|
-
return play;
|
|
911
|
-
})();
|
|
912
|
-
|
|
913
|
-
function isDocumentHidden() {
|
|
914
|
-
return !!document && document.hidden;
|
|
915
|
-
}
|
|
916
|
-
|
|
917
|
-
// Public Instance
|
|
918
|
-
|
|
919
|
-
function anime(params) {
|
|
920
|
-
if ( params === void 0 ) params = {};
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
var startTime = 0, lastTime = 0, now = 0;
|
|
924
|
-
var children, childrenLength = 0;
|
|
925
|
-
var resolve = null;
|
|
926
|
-
|
|
927
|
-
function makePromise(instance) {
|
|
928
|
-
var promise = window.Promise && new Promise(function (_resolve) { return resolve = _resolve; });
|
|
929
|
-
instance.finished = promise;
|
|
930
|
-
return promise;
|
|
931
|
-
}
|
|
932
|
-
|
|
933
|
-
var instance = createNewInstance(params);
|
|
934
|
-
makePromise(instance);
|
|
935
|
-
|
|
936
|
-
function toggleInstanceDirection() {
|
|
937
|
-
var direction = instance.direction;
|
|
938
|
-
if (direction !== 'alternate') {
|
|
939
|
-
instance.direction = direction !== 'normal' ? 'normal' : 'reverse';
|
|
940
|
-
}
|
|
941
|
-
instance.reversed = !instance.reversed;
|
|
942
|
-
children.forEach(function (child) { return child.reversed = instance.reversed; });
|
|
943
|
-
}
|
|
944
|
-
|
|
945
|
-
function adjustTime(time) {
|
|
946
|
-
return instance.reversed ? instance.duration - time : time;
|
|
947
|
-
}
|
|
948
|
-
|
|
949
|
-
function resetTime() {
|
|
950
|
-
startTime = 0;
|
|
951
|
-
lastTime = adjustTime(instance.currentTime) * (1 / anime.speed);
|
|
952
|
-
}
|
|
953
|
-
|
|
954
|
-
function seekChild(time, child) {
|
|
955
|
-
if (child) { child.seek(time - child.timelineOffset); }
|
|
956
|
-
}
|
|
957
|
-
|
|
958
|
-
function syncInstanceChildren(time) {
|
|
959
|
-
if (!instance.reversePlayback) {
|
|
960
|
-
for (var i = 0; i < childrenLength; i++) { seekChild(time, children[i]); }
|
|
961
|
-
} else {
|
|
962
|
-
for (var i$1 = childrenLength; i$1--;) { seekChild(time, children[i$1]); }
|
|
963
|
-
}
|
|
964
|
-
}
|
|
965
|
-
|
|
966
|
-
function setAnimationsProgress(insTime) {
|
|
967
|
-
var i = 0;
|
|
968
|
-
var animations = instance.animations;
|
|
969
|
-
var animationsLength = animations.length;
|
|
970
|
-
while (i < animationsLength) {
|
|
971
|
-
var anim = animations[i];
|
|
972
|
-
var animatable = anim.animatable;
|
|
973
|
-
var tweens = anim.tweens;
|
|
974
|
-
var tweenLength = tweens.length - 1;
|
|
975
|
-
var tween = tweens[tweenLength];
|
|
976
|
-
// Only check for keyframes if there is more than one tween
|
|
977
|
-
if (tweenLength) { tween = filterArray(tweens, function (t) { return (insTime < t.end); })[0] || tween; }
|
|
978
|
-
var elapsed = minMax(insTime - tween.start - tween.delay, 0, tween.duration) / tween.duration;
|
|
979
|
-
var eased = isNaN(elapsed) ? 1 : tween.easing(elapsed);
|
|
980
|
-
var strings = tween.to.strings;
|
|
981
|
-
var round = tween.round;
|
|
982
|
-
var numbers = [];
|
|
983
|
-
var toNumbersLength = tween.to.numbers.length;
|
|
984
|
-
var progress = (void 0);
|
|
985
|
-
for (var n = 0; n < toNumbersLength; n++) {
|
|
986
|
-
var value = (void 0);
|
|
987
|
-
var toNumber = tween.to.numbers[n];
|
|
988
|
-
var fromNumber = tween.from.numbers[n] || 0;
|
|
989
|
-
if (!tween.isPath) {
|
|
990
|
-
value = fromNumber + (eased * (toNumber - fromNumber));
|
|
991
|
-
} else {
|
|
992
|
-
value = getPathProgress(tween.value, eased * toNumber, tween.isPathTargetInsideSVG);
|
|
993
|
-
}
|
|
994
|
-
if (round) {
|
|
995
|
-
if (!(tween.isColor && n > 2)) {
|
|
996
|
-
value = Math.round(value * round) / round;
|
|
997
|
-
}
|
|
998
|
-
}
|
|
999
|
-
numbers.push(value);
|
|
1000
|
-
}
|
|
1001
|
-
// Manual Array.reduce for better performances
|
|
1002
|
-
var stringsLength = strings.length;
|
|
1003
|
-
if (!stringsLength) {
|
|
1004
|
-
progress = numbers[0];
|
|
1005
|
-
} else {
|
|
1006
|
-
progress = strings[0];
|
|
1007
|
-
for (var s = 0; s < stringsLength; s++) {
|
|
1008
|
-
var b = strings[s + 1];
|
|
1009
|
-
var n$1 = numbers[s];
|
|
1010
|
-
if (!isNaN(n$1)) {
|
|
1011
|
-
if (!b) {
|
|
1012
|
-
progress += n$1 + ' ';
|
|
1013
|
-
} else {
|
|
1014
|
-
progress += n$1 + b;
|
|
1015
|
-
}
|
|
1016
|
-
}
|
|
1017
|
-
}
|
|
1018
|
-
}
|
|
1019
|
-
setProgressValue[anim.type](animatable.target, anim.property, progress, animatable.transforms);
|
|
1020
|
-
anim.currentValue = progress;
|
|
1021
|
-
i++;
|
|
1022
|
-
}
|
|
1023
|
-
}
|
|
1024
|
-
|
|
1025
|
-
function setCallback(cb) {
|
|
1026
|
-
if (instance[cb] && !instance.passThrough) { instance[cb](instance); }
|
|
1027
|
-
}
|
|
1028
|
-
|
|
1029
|
-
function countIteration() {
|
|
1030
|
-
if (instance.remaining && instance.remaining !== true) {
|
|
1031
|
-
instance.remaining--;
|
|
1032
|
-
}
|
|
1033
|
-
}
|
|
1034
|
-
|
|
1035
|
-
function setInstanceProgress(engineTime) {
|
|
1036
|
-
var insDuration = instance.duration;
|
|
1037
|
-
var insDelay = instance.delay;
|
|
1038
|
-
var insEndDelay = insDuration - instance.endDelay;
|
|
1039
|
-
var insTime = adjustTime(engineTime);
|
|
1040
|
-
instance.progress = minMax((insTime / insDuration) * 100, 0, 100);
|
|
1041
|
-
instance.reversePlayback = insTime < instance.currentTime;
|
|
1042
|
-
if (children) { syncInstanceChildren(insTime); }
|
|
1043
|
-
if (!instance.began && instance.currentTime > 0) {
|
|
1044
|
-
instance.began = true;
|
|
1045
|
-
setCallback('begin');
|
|
1046
|
-
}
|
|
1047
|
-
if (!instance.loopBegan && instance.currentTime > 0) {
|
|
1048
|
-
instance.loopBegan = true;
|
|
1049
|
-
setCallback('loopBegin');
|
|
1050
|
-
}
|
|
1051
|
-
if (insTime <= insDelay && instance.currentTime !== 0) {
|
|
1052
|
-
setAnimationsProgress(0);
|
|
1053
|
-
}
|
|
1054
|
-
if ((insTime >= insEndDelay && instance.currentTime !== insDuration) || !insDuration) {
|
|
1055
|
-
setAnimationsProgress(insDuration);
|
|
1056
|
-
}
|
|
1057
|
-
if (insTime > insDelay && insTime < insEndDelay) {
|
|
1058
|
-
if (!instance.changeBegan) {
|
|
1059
|
-
instance.changeBegan = true;
|
|
1060
|
-
instance.changeCompleted = false;
|
|
1061
|
-
setCallback('changeBegin');
|
|
1062
|
-
}
|
|
1063
|
-
setCallback('change');
|
|
1064
|
-
setAnimationsProgress(insTime);
|
|
1065
|
-
} else {
|
|
1066
|
-
if (instance.changeBegan) {
|
|
1067
|
-
instance.changeCompleted = true;
|
|
1068
|
-
instance.changeBegan = false;
|
|
1069
|
-
setCallback('changeComplete');
|
|
1070
|
-
}
|
|
1071
|
-
}
|
|
1072
|
-
instance.currentTime = minMax(insTime, 0, insDuration);
|
|
1073
|
-
if (instance.began) { setCallback('update'); }
|
|
1074
|
-
if (engineTime >= insDuration) {
|
|
1075
|
-
lastTime = 0;
|
|
1076
|
-
countIteration();
|
|
1077
|
-
if (!instance.remaining) {
|
|
1078
|
-
instance.paused = true;
|
|
1079
|
-
if (!instance.completed) {
|
|
1080
|
-
instance.completed = true;
|
|
1081
|
-
setCallback('loopComplete');
|
|
1082
|
-
setCallback('complete');
|
|
1083
|
-
if (!instance.passThrough && 'Promise' in window) {
|
|
1084
|
-
resolve();
|
|
1085
|
-
makePromise(instance);
|
|
1086
|
-
}
|
|
1087
|
-
}
|
|
1088
|
-
} else {
|
|
1089
|
-
startTime = now;
|
|
1090
|
-
setCallback('loopComplete');
|
|
1091
|
-
instance.loopBegan = false;
|
|
1092
|
-
if (instance.direction === 'alternate') {
|
|
1093
|
-
toggleInstanceDirection();
|
|
1094
|
-
}
|
|
1095
|
-
}
|
|
1096
|
-
}
|
|
1097
|
-
}
|
|
1098
|
-
|
|
1099
|
-
instance.reset = function() {
|
|
1100
|
-
var direction = instance.direction;
|
|
1101
|
-
instance.passThrough = false;
|
|
1102
|
-
instance.currentTime = 0;
|
|
1103
|
-
instance.progress = 0;
|
|
1104
|
-
instance.paused = true;
|
|
1105
|
-
instance.began = false;
|
|
1106
|
-
instance.loopBegan = false;
|
|
1107
|
-
instance.changeBegan = false;
|
|
1108
|
-
instance.completed = false;
|
|
1109
|
-
instance.changeCompleted = false;
|
|
1110
|
-
instance.reversePlayback = false;
|
|
1111
|
-
instance.reversed = direction === 'reverse';
|
|
1112
|
-
instance.remaining = instance.loop;
|
|
1113
|
-
children = instance.children;
|
|
1114
|
-
childrenLength = children.length;
|
|
1115
|
-
for (var i = childrenLength; i--;) { instance.children[i].reset(); }
|
|
1116
|
-
if (instance.reversed && instance.loop !== true || (direction === 'alternate' && instance.loop === 1)) { instance.remaining++; }
|
|
1117
|
-
setAnimationsProgress(instance.reversed ? instance.duration : 0);
|
|
1118
|
-
};
|
|
1119
|
-
|
|
1120
|
-
// internal method (for engine) to adjust animation timings before restoring engine ticks (rAF)
|
|
1121
|
-
instance._onDocumentVisibility = resetTime;
|
|
1122
|
-
|
|
1123
|
-
// Set Value helper
|
|
1124
|
-
|
|
1125
|
-
instance.set = function(targets, properties) {
|
|
1126
|
-
setTargetsValue(targets, properties);
|
|
1127
|
-
return instance;
|
|
1128
|
-
};
|
|
1129
|
-
|
|
1130
|
-
instance.tick = function(t) {
|
|
1131
|
-
now = t;
|
|
1132
|
-
if (!startTime) { startTime = now; }
|
|
1133
|
-
setInstanceProgress((now + (lastTime - startTime)) * anime.speed);
|
|
1134
|
-
};
|
|
1135
|
-
|
|
1136
|
-
instance.seek = function(time) {
|
|
1137
|
-
setInstanceProgress(adjustTime(time));
|
|
1138
|
-
};
|
|
1139
|
-
|
|
1140
|
-
instance.pause = function() {
|
|
1141
|
-
instance.paused = true;
|
|
1142
|
-
resetTime();
|
|
1143
|
-
};
|
|
1144
|
-
|
|
1145
|
-
instance.play = function() {
|
|
1146
|
-
if (!instance.paused) { return; }
|
|
1147
|
-
if (instance.completed) { instance.reset(); }
|
|
1148
|
-
instance.paused = false;
|
|
1149
|
-
activeInstances.push(instance);
|
|
1150
|
-
resetTime();
|
|
1151
|
-
engine();
|
|
1152
|
-
};
|
|
1153
|
-
|
|
1154
|
-
instance.reverse = function() {
|
|
1155
|
-
toggleInstanceDirection();
|
|
1156
|
-
instance.completed = instance.reversed ? false : true;
|
|
1157
|
-
resetTime();
|
|
1158
|
-
};
|
|
1159
|
-
|
|
1160
|
-
instance.restart = function() {
|
|
1161
|
-
instance.reset();
|
|
1162
|
-
instance.play();
|
|
1163
|
-
};
|
|
1164
|
-
|
|
1165
|
-
instance.remove = function(targets) {
|
|
1166
|
-
var targetsArray = parseTargets(targets);
|
|
1167
|
-
removeTargetsFromInstance(targetsArray, instance);
|
|
1168
|
-
};
|
|
1169
|
-
|
|
1170
|
-
instance.reset();
|
|
1171
|
-
|
|
1172
|
-
if (instance.autoplay) { instance.play(); }
|
|
1173
|
-
|
|
1174
|
-
return instance;
|
|
1175
|
-
|
|
1176
|
-
}
|
|
1177
|
-
|
|
1178
|
-
// Remove targets from animation
|
|
1179
|
-
|
|
1180
|
-
function removeTargetsFromAnimations(targetsArray, animations) {
|
|
1181
|
-
for (var a = animations.length; a--;) {
|
|
1182
|
-
if (arrayContains(targetsArray, animations[a].animatable.target)) {
|
|
1183
|
-
animations.splice(a, 1);
|
|
1184
|
-
}
|
|
1185
|
-
}
|
|
1186
|
-
}
|
|
1187
|
-
|
|
1188
|
-
function removeTargetsFromInstance(targetsArray, instance) {
|
|
1189
|
-
var animations = instance.animations;
|
|
1190
|
-
var children = instance.children;
|
|
1191
|
-
removeTargetsFromAnimations(targetsArray, animations);
|
|
1192
|
-
for (var c = children.length; c--;) {
|
|
1193
|
-
var child = children[c];
|
|
1194
|
-
var childAnimations = child.animations;
|
|
1195
|
-
removeTargetsFromAnimations(targetsArray, childAnimations);
|
|
1196
|
-
if (!childAnimations.length && !child.children.length) { children.splice(c, 1); }
|
|
1197
|
-
}
|
|
1198
|
-
if (!animations.length && !children.length) { instance.pause(); }
|
|
1199
|
-
}
|
|
1200
|
-
|
|
1201
|
-
function removeTargetsFromActiveInstances(targets) {
|
|
1202
|
-
var targetsArray = parseTargets(targets);
|
|
1203
|
-
for (var i = activeInstances.length; i--;) {
|
|
1204
|
-
var instance = activeInstances[i];
|
|
1205
|
-
removeTargetsFromInstance(targetsArray, instance);
|
|
1206
|
-
}
|
|
1207
|
-
}
|
|
1208
|
-
|
|
1209
|
-
// Stagger helpers
|
|
1210
|
-
|
|
1211
|
-
function stagger(val, params) {
|
|
1212
|
-
if ( params === void 0 ) params = {};
|
|
1213
|
-
|
|
1214
|
-
var direction = params.direction || 'normal';
|
|
1215
|
-
var easing = params.easing ? parseEasings(params.easing) : null;
|
|
1216
|
-
var grid = params.grid;
|
|
1217
|
-
var axis = params.axis;
|
|
1218
|
-
var fromIndex = params.from || 0;
|
|
1219
|
-
var fromFirst = fromIndex === 'first';
|
|
1220
|
-
var fromCenter = fromIndex === 'center';
|
|
1221
|
-
var fromLast = fromIndex === 'last';
|
|
1222
|
-
var isRange = is.arr(val);
|
|
1223
|
-
var val1 = isRange ? parseFloat(val[0]) : parseFloat(val);
|
|
1224
|
-
var val2 = isRange ? parseFloat(val[1]) : 0;
|
|
1225
|
-
var unit = getUnit(isRange ? val[1] : val) || 0;
|
|
1226
|
-
var start = params.start || 0 + (isRange ? val1 : 0);
|
|
1227
|
-
var values = [];
|
|
1228
|
-
var maxValue = 0;
|
|
1229
|
-
return function (el, i, t) {
|
|
1230
|
-
if (fromFirst) { fromIndex = 0; }
|
|
1231
|
-
if (fromCenter) { fromIndex = (t - 1) / 2; }
|
|
1232
|
-
if (fromLast) { fromIndex = t - 1; }
|
|
1233
|
-
if (!values.length) {
|
|
1234
|
-
for (var index = 0; index < t; index++) {
|
|
1235
|
-
if (!grid) {
|
|
1236
|
-
values.push(Math.abs(fromIndex - index));
|
|
1237
|
-
} else {
|
|
1238
|
-
var fromX = !fromCenter ? fromIndex%grid[0] : (grid[0]-1)/2;
|
|
1239
|
-
var fromY = !fromCenter ? Math.floor(fromIndex/grid[0]) : (grid[1]-1)/2;
|
|
1240
|
-
var toX = index%grid[0];
|
|
1241
|
-
var toY = Math.floor(index/grid[0]);
|
|
1242
|
-
var distanceX = fromX - toX;
|
|
1243
|
-
var distanceY = fromY - toY;
|
|
1244
|
-
var value = Math.sqrt(distanceX * distanceX + distanceY * distanceY);
|
|
1245
|
-
if (axis === 'x') { value = -distanceX; }
|
|
1246
|
-
if (axis === 'y') { value = -distanceY; }
|
|
1247
|
-
values.push(value);
|
|
1248
|
-
}
|
|
1249
|
-
maxValue = Math.max.apply(Math, values);
|
|
1250
|
-
}
|
|
1251
|
-
if (easing) { values = values.map(function (val) { return easing(val / maxValue) * maxValue; }); }
|
|
1252
|
-
if (direction === 'reverse') { values = values.map(function (val) { return axis ? (val < 0) ? val * -1 : -val : Math.abs(maxValue - val); }); }
|
|
1253
|
-
}
|
|
1254
|
-
var spacing = isRange ? (val2 - val1) / maxValue : val1;
|
|
1255
|
-
return start + (spacing * (Math.round(values[i] * 100) / 100)) + unit;
|
|
1256
|
-
}
|
|
1257
|
-
}
|
|
1258
|
-
|
|
1259
|
-
// Timeline
|
|
1260
|
-
|
|
1261
|
-
function timeline(params) {
|
|
1262
|
-
if ( params === void 0 ) params = {};
|
|
1263
|
-
|
|
1264
|
-
var tl = anime(params);
|
|
1265
|
-
tl.duration = 0;
|
|
1266
|
-
tl.add = function(instanceParams, timelineOffset) {
|
|
1267
|
-
var tlIndex = activeInstances.indexOf(tl);
|
|
1268
|
-
var children = tl.children;
|
|
1269
|
-
if (tlIndex > -1) { activeInstances.splice(tlIndex, 1); }
|
|
1270
|
-
function passThrough(ins) { ins.passThrough = true; }
|
|
1271
|
-
for (var i = 0; i < children.length; i++) { passThrough(children[i]); }
|
|
1272
|
-
var insParams = mergeObjects(instanceParams, replaceObjectProps(defaultTweenSettings, params));
|
|
1273
|
-
insParams.targets = insParams.targets || params.targets;
|
|
1274
|
-
var tlDuration = tl.duration;
|
|
1275
|
-
insParams.autoplay = false;
|
|
1276
|
-
insParams.direction = tl.direction;
|
|
1277
|
-
insParams.timelineOffset = is.und(timelineOffset) ? tlDuration : getRelativeValue(timelineOffset, tlDuration);
|
|
1278
|
-
passThrough(tl);
|
|
1279
|
-
tl.seek(insParams.timelineOffset);
|
|
1280
|
-
var ins = anime(insParams);
|
|
1281
|
-
passThrough(ins);
|
|
1282
|
-
children.push(ins);
|
|
1283
|
-
var timings = getInstanceTimings(children, params);
|
|
1284
|
-
tl.delay = timings.delay;
|
|
1285
|
-
tl.endDelay = timings.endDelay;
|
|
1286
|
-
tl.duration = timings.duration;
|
|
1287
|
-
tl.seek(0);
|
|
1288
|
-
tl.reset();
|
|
1289
|
-
if (tl.autoplay) { tl.play(); }
|
|
1290
|
-
return tl;
|
|
1291
|
-
};
|
|
1292
|
-
return tl;
|
|
1293
|
-
}
|
|
1294
|
-
|
|
1295
|
-
anime.version = '3.2.1';
|
|
1296
|
-
anime.speed = 1;
|
|
1297
|
-
// TODO:#review: naming, documentation
|
|
1298
|
-
anime.suspendWhenDocumentHidden = true;
|
|
1299
|
-
anime.running = activeInstances;
|
|
1300
|
-
anime.remove = removeTargetsFromActiveInstances;
|
|
1301
|
-
anime.get = getOriginalTargetValue;
|
|
1302
|
-
anime.set = setTargetsValue;
|
|
1303
|
-
anime.convertPx = convertPxToUnit;
|
|
1304
|
-
anime.path = getPath;
|
|
1305
|
-
anime.setDashoffset = setDashoffset;
|
|
1306
|
-
anime.stagger = stagger;
|
|
1307
|
-
anime.timeline = timeline;
|
|
1308
|
-
anime.easing = parseEasings;
|
|
1309
|
-
anime.penner = penner;
|
|
1310
|
-
anime.random = function (min, max) { return Math.floor(Math.random() * (max - min + 1)) + min; };
|
|
2
|
+
import { i as isExpandable } from './expandable.interfaces-9b1afbe8.js';
|
|
1311
3
|
|
|
1312
4
|
const stateMap = {
|
|
1313
5
|
success: "succes:",
|
|
@@ -1368,7 +60,7 @@ const HandleIcon = ({ state, icon, attachmentCount }) => {
|
|
|
1368
60
|
}
|
|
1369
61
|
};
|
|
1370
62
|
|
|
1371
|
-
const accordionSectionCss = "*,*::after,*::before{box-sizing:border-box}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);border:0}:host{display:block}:host .dso-section-handle{font-size:1em;font-weight:600;line-height:1.375em;margin:0;position:relative}:host .dso-section-handle>a:active{text-decoration:none}:host .dso-section-handle a{text-decoration:none}:host .dso-section-handle a:hover,:host .dso-section-handle a:focus{text-decoration:none}:host .dso-section-handle a:active{text-decoration:underline}:host .dso-section-handle .dso-status{font-weight:400;text-decoration:underline}:host .dso-section-handle>button,:host .dso-section-handle>a{align-items:
|
|
63
|
+
const accordionSectionCss = "*,*::after,*::before{box-sizing:border-box}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);border:0}:host{display:block}:host .dso-section-handle{font-size:1em;font-weight:600;line-height:1.375em;margin:0;position:relative}:host .dso-section-handle>a:active{text-decoration:none}:host .dso-section-handle a{text-decoration:none}:host .dso-section-handle a:hover,:host .dso-section-handle a:focus{text-decoration:none}:host .dso-section-handle a:active{text-decoration:underline}:host .dso-section-handle .dso-status{font-weight:400;text-decoration:underline}:host .dso-section-handle>button,:host .dso-section-handle>a{align-items:flex-start;background-color:transparent;border:0;cursor:pointer;display:flex;font-family:Asap, sans-serif;font-size:1em;font-weight:600;line-height:1.375em;margin:0;padding:12px 16px 12px;text-align:start;width:100%;word-break:break-word}:host .dso-section-handle>button dso-icon,:host .dso-section-handle>a dso-icon{flex-shrink:0}:host .dso-section-handle>button dso-icon.dso-section-handle-chevron,:host .dso-section-handle>a dso-icon.dso-section-handle-chevron{transition:transform 260ms cubic-bezier(0.4, 0, 0.2, 1);transform:rotate(0)}:host .dso-section-handle>button>.dso-section-handle-addons:first-child,:host .dso-section-handle>button>dso-icon:first-child,:host .dso-section-handle>a>.dso-section-handle-addons:first-child,:host .dso-section-handle>a>dso-icon:first-child{margin-right:8px}:host .dso-section-handle>button>dso-icon:last-child,:host .dso-section-handle>a>dso-icon:last-child{margin-left:auto}:host .dso-section-handle>button>.dso-section-handle-addons:last-child,:host .dso-section-handle>a>.dso-section-handle-addons:last-child{margin-left:auto}:host .dso-section-handle>button>.dso-section-handle-addons:last-child dso-attachments-counter,:host .dso-section-handle>button>.dso-section-handle-addons:last-child dso-icon,:host .dso-section-handle>a>.dso-section-handle-addons:last-child dso-attachments-counter,:host .dso-section-handle>a>.dso-section-handle-addons:last-child dso-icon{margin-left:16px}:host([open]) .dso-section-handle>button .dso-section-handle-chevron:first-child,:host([open]) .dso-section-handle>a .dso-section-handle-chevron:first-child{transform:rotate(90deg)}:host([open]) .dso-section-handle>button .dso-section-handle-chevron:last-child,:host([open]) .dso-section-handle>a .dso-section-handle-chevron:last-child{transform:rotate(-180deg)}.dso-section-body{background-color:#fff;border-top:0;margin-top:-4px}.dso-section-body .dso-section-body-content{padding:20px 16px 16px}:host(.dso-accordion-default) .dso-section-handle{background-color:#fff;border:1px solid #8b4a6a;border-radius:4px}:host(.dso-accordion-default) .dso-section-handle a,:host(.dso-accordion-default) .dso-section-handle button{color:#8b4a6a}:host(.dso-accordion-default) .dso-section-handle a:hover,:host(.dso-accordion-default) .dso-section-handle a:active,:host(.dso-accordion-default) .dso-section-handle a.active,:host(.dso-accordion-default) .dso-section-handle button:hover,:host(.dso-accordion-default) .dso-section-handle button:active,:host(.dso-accordion-default) .dso-section-handle button.active{color:#8b4a6a}:host(.dso-accordion-default) .dso-section-body{border:1px solid #8b4a6a;border-radius:0 0 4px 4px}:host(.dso-accordion-default[open])>.dso-section-handle{background-color:#8b4a6a;border-radius:0;border-top-left-radius:4px;border-top-right-radius:4px}:host(.dso-accordion-default[open])>.dso-section-handle a,:host(.dso-accordion-default[open])>.dso-section-handle button{color:#fff}:host(.dso-accordion-default[open])>.dso-section-handle a dso-attachments-counter,:host(.dso-accordion-default[open])>.dso-section-handle button dso-attachments-counter{--dso-attachments-counter-color:#fff;--dso-icon:var(--di-paperclip-wit)}:host(.dso-accordion-default.dso-nested-accordion[open]) .dso-section-body{background-color:#e5e5e5}:host(.dso-accordion-compact) .dso-section-handle{border-bottom:1px solid transparent;border-top:1px solid #ccc}:host(.dso-accordion-compact) .dso-section-handle a,:host(.dso-accordion-compact) .dso-section-handle button{color:#39870c;padding-bottom:11px;padding-left:0;padding-top:11px}:host(.dso-accordion-compact) .dso-section-handle a:hover,:host(.dso-accordion-compact) .dso-section-handle a:active,:host(.dso-accordion-compact) .dso-section-handle a.active,:host(.dso-accordion-compact) .dso-section-handle button:hover,:host(.dso-accordion-compact) .dso-section-handle button:active,:host(.dso-accordion-compact) .dso-section-handle button.active{color:#39870c}:host(.dso-accordion-compact) .dso-section-body .dso-section-body-content{padding-left:32px;padding-top:0;padding-right:0}:host(.dso-accordion-compact.dso-accordion-reverse-align) .dso-section-handle a,:host(.dso-accordion-compact.dso-accordion-reverse-align) .dso-section-handle button{padding-left:16px}:host(.dso-accordion-compact.dso-accordion-reverse-align) .dso-section-body .dso-section-body-content{padding-left:16px;padding-right:0}:host(.dso-accordion-compact[open]:not(.dso-nested-accordion))>.dso-section-handle{background-color:transparent}:host(.dso-accordion-compact[open]:not(.dso-nested-accordion))>.dso-section-handle a,:host(.dso-accordion-compact[open]:not(.dso-nested-accordion))>.dso-section-handle button{color:#39870c}:host(.dso-accordion-compact[open]:not(.dso-nested-accordion))>.dso-section-handle a:hover,:host(.dso-accordion-compact[open]:not(.dso-nested-accordion))>.dso-section-handle a:active,:host(.dso-accordion-compact[open]:not(.dso-nested-accordion))>.dso-section-handle a.active,:host(.dso-accordion-compact[open]:not(.dso-nested-accordion))>.dso-section-handle button:hover,:host(.dso-accordion-compact[open]:not(.dso-nested-accordion))>.dso-section-handle button:active,:host(.dso-accordion-compact[open]:not(.dso-nested-accordion))>.dso-section-handle button.active{color:#39870c}:host(.dso-accordion-compact[open]:not(.dso-nested-accordion))>.dso-section-handle a dso-attachments-counter,:host(.dso-accordion-compact[open]:not(.dso-nested-accordion))>.dso-section-handle button dso-attachments-counter{--dso-attachments-counter-color:#666;--dso-icon:var(--di-paperclip-grijs)}:host(.dso-accordion-compact[open]:not(.dso-nested-accordion))>.dso-section-body{border-top:0}:host(.dso-accordion-compact.dso-nested-accordion[open])>.dso-section-body{padding-bottom:0}:host(.dso-accordion-compact.dso-nested-accordion[open])>.dso-section-body dso-accordion-section:last-child{border-bottom:0}:host(.dso-accordion-conclusion) .dso-section-handle{background-color:#f2f2f2;border:1px solid #f2f2f2}:host(.dso-accordion-conclusion) .dso-section-handle a,:host(.dso-accordion-conclusion) .dso-section-handle button{color:#000}:host(.dso-accordion-conclusion) .dso-section-handle a:hover,:host(.dso-accordion-conclusion) .dso-section-handle a:active,:host(.dso-accordion-conclusion) .dso-section-handle a.active,:host(.dso-accordion-conclusion) .dso-section-handle button:hover,:host(.dso-accordion-conclusion) .dso-section-handle button:active,:host(.dso-accordion-conclusion) .dso-section-handle button.active{background-color:#e5e5e5}:host(.dso-accordion-conclusion) .dso-section-handle a dso-attachments-counter,:host(.dso-accordion-conclusion) .dso-section-handle button dso-attachments-counter{--dso-attachments-counter-color:#000;--dso-icon:var(--di-paperclip-zwart)}:host(.dso-accordion-conclusion) .dso-section-body{border:2px solid #f2f2f2}:host(.dso-accordion-conclusion[open]:not(.dso-nested-accordion))>.dso-section-handle{background-color:#f2f2f2}:host(.dso-accordion-conclusion.dso-nested-accordion[open]){background-color:#fff}:host(.dso-accordion-neutral) .dso-section-handle{background-color:transparent;border:none;border-radius:4px;margin-block-end:2px}:host(.dso-accordion-neutral) .dso-section-handle a,:host(.dso-accordion-neutral) .dso-section-handle button{color:#000;padding:5px 16px 5px 0}:host(.dso-accordion-neutral) .dso-section-handle a:hover,:host(.dso-accordion-neutral) .dso-section-handle a:active,:host(.dso-accordion-neutral) .dso-section-handle a.active,:host(.dso-accordion-neutral) .dso-section-handle button:hover,:host(.dso-accordion-neutral) .dso-section-handle button:active,:host(.dso-accordion-neutral) .dso-section-handle button.active{color:#000}:host(.dso-accordion-neutral) .dso-section-handle a .info-icon,:host(.dso-accordion-neutral) .dso-section-handle button .info-icon{color:#39870c;margin-inline-start:8px}:host(.dso-accordion-neutral) .dso-section-body{background-color:transparent;border:1px solid #275937;box-shadow:1px 3px 4px rgba(0, 0, 0, 0.5);margin-block:0}:host(.dso-accordion-neutral) .dso-section-body.dso-animate-ready{transition:margin-block 260ms cubic-bezier(0.4, 0, 0.2, 1)}:host(.dso-accordion-neutral) .dso-section-body .dso-section-body-content{padding:16px 32px 24px 32px}:host(.dso-accordion-neutral[open])>.dso-section-handle{background-color:transparant;border-radius:0;border-top-left-radius:4px;border-top-right-radius:4px}:host(.dso-accordion-neutral[open])>.dso-section-handle a,:host(.dso-accordion-neutral[open])>.dso-section-handle button{color:#000}:host(.dso-accordion-neutral[open])>.dso-section-handle a dso-attachments-counter,:host(.dso-accordion-neutral[open])>.dso-section-handle button dso-attachments-counter{--dso-attachments-counter-color:#fff;--dso-icon:var(--di-paperclip-wit)}:host(.dso-accordion-neutral[open]) .dso-section-body{margin-block-end:16px;margin-block-start:2px}:host(.dso-accordion-neutral.dso-nested-accordion[open]) .dso-section-body{background-color:#e5e5e5}";
|
|
1372
64
|
|
|
1373
65
|
const AccordionSection = class {
|
|
1374
66
|
constructor(hostRef) {
|
|
@@ -1382,9 +74,7 @@ const AccordionSection = class {
|
|
|
1382
74
|
this.status = undefined;
|
|
1383
75
|
this.open = false;
|
|
1384
76
|
this.hasNestedSection = false;
|
|
1385
|
-
|
|
1386
|
-
toggleOpen() {
|
|
1387
|
-
this.activateAnimation();
|
|
77
|
+
this.hover = false;
|
|
1388
78
|
}
|
|
1389
79
|
componentWillLoad() {
|
|
1390
80
|
const accordion = this.host.parentElement;
|
|
@@ -1396,18 +86,6 @@ const AccordionSection = class {
|
|
|
1396
86
|
forceUpdate(this.host);
|
|
1397
87
|
});
|
|
1398
88
|
}
|
|
1399
|
-
this.prepareAnimationResizeObserver();
|
|
1400
|
-
}
|
|
1401
|
-
componentDidLoad() {
|
|
1402
|
-
var _a, _b;
|
|
1403
|
-
const bodyContentElement = (_a = this.host.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector(".dso-section-body-content");
|
|
1404
|
-
if (bodyContentElement) {
|
|
1405
|
-
(_b = this.resizeObserver) === null || _b === void 0 ? void 0 : _b.observe(bodyContentElement);
|
|
1406
|
-
}
|
|
1407
|
-
}
|
|
1408
|
-
disconnectedCallback() {
|
|
1409
|
-
var _a;
|
|
1410
|
-
(_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
1411
89
|
}
|
|
1412
90
|
/** Toggle this section.
|
|
1413
91
|
* @param scrollIntoView boolean - defaults to true
|
|
@@ -1424,6 +102,10 @@ const AccordionSection = class {
|
|
|
1424
102
|
async scrollSectionIntoView() {
|
|
1425
103
|
await this.scrollIntoViewWhenNeeded(false);
|
|
1426
104
|
}
|
|
105
|
+
get isNeutral() {
|
|
106
|
+
var _a;
|
|
107
|
+
return ((_a = this.accordionState) === null || _a === void 0 ? void 0 : _a.variant) === "neutral";
|
|
108
|
+
}
|
|
1427
109
|
async scrollIntoViewWhenNeeded(sectionToggled) {
|
|
1428
110
|
var _a, _b, _c;
|
|
1429
111
|
AccordionSection.scrollCandidate = undefined;
|
|
@@ -1432,12 +114,13 @@ const AccordionSection = class {
|
|
|
1432
114
|
if (!bodyClientRect || !headingClientRect || !this.accordionState) {
|
|
1433
115
|
return;
|
|
1434
116
|
}
|
|
1435
|
-
const waitForAnimationBeforeScrolling = (state) => {
|
|
1436
|
-
var _a;
|
|
1437
|
-
|
|
117
|
+
const waitForAnimationBeforeScrolling = async (state) => {
|
|
118
|
+
var _a, _b;
|
|
119
|
+
this.bodyHeight = await ((_a = this.expandable) === null || _a === void 0 ? void 0 : _a.getBodyHeight());
|
|
120
|
+
const sectionBottomOffsetTop = this.host.offsetTop + headingClientRect.height + (this.open ? (_b = this.bodyHeight) !== null && _b !== void 0 ? _b : 0 : 0);
|
|
1438
121
|
return (sectionToggled && (sectionBottomOffsetTop > document.documentElement.scrollHeight || state.allowMultipleOpen));
|
|
1439
122
|
};
|
|
1440
|
-
if (waitForAnimationBeforeScrolling(this.accordionState)) {
|
|
123
|
+
if (await waitForAnimationBeforeScrolling(this.accordionState)) {
|
|
1441
124
|
AccordionSection.scrollCandidate = this.host;
|
|
1442
125
|
return;
|
|
1443
126
|
}
|
|
@@ -1460,6 +143,32 @@ const AccordionSection = class {
|
|
|
1460
143
|
});
|
|
1461
144
|
}
|
|
1462
145
|
}
|
|
146
|
+
setAnimationBehaviour(event, section) {
|
|
147
|
+
const expandableElement = event.target;
|
|
148
|
+
if (!(expandableElement instanceof HTMLElement)) {
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
if (isExpandable(expandableElement)) {
|
|
152
|
+
this.expandable = expandableElement;
|
|
153
|
+
this.expandable.getAnimeInstance().then((animeInstance) => {
|
|
154
|
+
if (animeInstance) {
|
|
155
|
+
animeInstance.changeComplete = async () => {
|
|
156
|
+
if (!section) {
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
const accordion = section.parentElement;
|
|
160
|
+
if (isAccordion(accordion)) {
|
|
161
|
+
accordion === null || accordion === void 0 ? void 0 : accordion.animationEnd(section);
|
|
162
|
+
}
|
|
163
|
+
if (AccordionSection.scrollCandidate === this.host) {
|
|
164
|
+
AccordionSection.scrollCandidate = undefined;
|
|
165
|
+
await this.scrollSectionIntoView();
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
}
|
|
1463
172
|
async toggle(e) {
|
|
1464
173
|
var _a;
|
|
1465
174
|
e === null || e === void 0 ? void 0 : e.preventDefault();
|
|
@@ -1478,83 +187,9 @@ const AccordionSection = class {
|
|
|
1478
187
|
["dso-accordion-" + variant]: true,
|
|
1479
188
|
"dso-nested-accordion": this.hasNestedSection,
|
|
1480
189
|
"dso-accordion-reverse-align": reverseAlign !== null && reverseAlign !== void 0 ? reverseAlign : false,
|
|
1481
|
-
}, hidden: !variant }, h(Handle, { heading: this.heading, ref: (element) => (this.sectionHeading = element) }, h(HandleElement, { handleUrl: this.handleUrl, onClick: async (event) => await this.toggle(event), open: this.open }, reverseAlign ? (h(Fragment, null, hasAddons && (h("div", { class: "dso-section-handle-addons" }, h(HandleIcon, { icon: this.icon }))), h("span", null, this.handleTitle), h("dso-icon", { class: "dso-section-handle-chevron", icon: "chevron-down" }))) : (h(Fragment, null, h("dso-icon", { class: "dso-section-handle-chevron", icon: "chevron-right" }), this.state && h("span", { class: "sr-only" }, stateMap[this.state]), h("span", null, this.handleTitle), hasAddons && (h("div", { class: "dso-section-handle-addons" }, this.status && h("span", { class: "dso-status" }, this.status), h(HandleIcon, { state: this.state, icon: this.icon, attachmentCount: this.attachmentCount }))))))), h("
|
|
1482
|
-
}
|
|
1483
|
-
prepareAnimationResizeObserver() {
|
|
1484
|
-
this.resizeObserver = new ResizeObserver(debounce_1(([entry]) => {
|
|
1485
|
-
// entry.contentRect does not include padding, so we use getBoundingClientRect.
|
|
1486
|
-
const height = entry.target.getBoundingClientRect().height;
|
|
1487
|
-
if (this.bodyHeight !== height) {
|
|
1488
|
-
this.bodyHeight = height;
|
|
1489
|
-
this.instantiateAnimation();
|
|
1490
|
-
}
|
|
1491
|
-
}, 150));
|
|
1492
|
-
}
|
|
1493
|
-
instantiateAnimation() {
|
|
1494
|
-
this.animeInstance = anime({
|
|
1495
|
-
targets: this.sectionBody,
|
|
1496
|
-
height: 4,
|
|
1497
|
-
easing: "cubicBezier(0.4, 0, 0.2, 1)",
|
|
1498
|
-
duration: 260,
|
|
1499
|
-
autoplay: false,
|
|
1500
|
-
direction: "normal",
|
|
1501
|
-
changeComplete: async () => {
|
|
1502
|
-
var _a;
|
|
1503
|
-
(_a = this.accordion) === null || _a === void 0 ? void 0 : _a.animationEnd(this.host);
|
|
1504
|
-
if (AccordionSection.scrollCandidate === this.host) {
|
|
1505
|
-
AccordionSection.scrollCandidate = undefined;
|
|
1506
|
-
await this.scrollSectionIntoView();
|
|
1507
|
-
}
|
|
1508
|
-
},
|
|
1509
|
-
begin: () => {
|
|
1510
|
-
if (this.sectionBody) {
|
|
1511
|
-
if (this.open) {
|
|
1512
|
-
this.sectionBody.style.visibility = "";
|
|
1513
|
-
this.sectionBody.style.position = "";
|
|
1514
|
-
this.sectionBody.style.bottom = "";
|
|
1515
|
-
}
|
|
1516
|
-
}
|
|
1517
|
-
},
|
|
1518
|
-
complete: () => {
|
|
1519
|
-
if (this.sectionBody) {
|
|
1520
|
-
this.sectionBody.style.height = "";
|
|
1521
|
-
if (!this.open) {
|
|
1522
|
-
this.sectionBody.style.visibility = "hidden";
|
|
1523
|
-
this.sectionBody.style.position = "absolute";
|
|
1524
|
-
this.sectionBody.style.bottom = "100%";
|
|
1525
|
-
}
|
|
1526
|
-
}
|
|
1527
|
-
},
|
|
1528
|
-
});
|
|
1529
|
-
if (!this.open) {
|
|
1530
|
-
this.animeInstance.reverse();
|
|
1531
|
-
this.animeInstance.play();
|
|
1532
|
-
}
|
|
1533
|
-
if (this.sectionBody) {
|
|
1534
|
-
this.sectionBody.style.height = "";
|
|
1535
|
-
}
|
|
1536
|
-
}
|
|
1537
|
-
activateAnimation() {
|
|
1538
|
-
if (this.animeInstance) {
|
|
1539
|
-
if (this.animeInstance.progress > 0 && this.animeInstance.progress < 100) {
|
|
1540
|
-
this.animeInstance.reverse();
|
|
1541
|
-
}
|
|
1542
|
-
else {
|
|
1543
|
-
if (this.open) {
|
|
1544
|
-
this.animeInstance.direction = "reverse";
|
|
1545
|
-
this.animeInstance.play();
|
|
1546
|
-
}
|
|
1547
|
-
else {
|
|
1548
|
-
this.animeInstance.direction = "normal";
|
|
1549
|
-
this.animeInstance.play();
|
|
1550
|
-
}
|
|
1551
|
-
}
|
|
1552
|
-
}
|
|
190
|
+
}, hidden: !variant, onMouseenter: () => (this.hover = true), onMouseleave: () => (this.hover = false) }, h(Handle, { heading: this.heading, ref: (element) => (this.sectionHeading = element) }, h(HandleElement, { handleUrl: this.handleUrl, onClick: async (event) => await this.toggle(event), open: this.open }, reverseAlign ? (h(Fragment, null, hasAddons && (h("div", { class: "dso-section-handle-addons" }, h(HandleIcon, { icon: this.icon }))), h("span", null, this.handleTitle), h("dso-icon", { class: "dso-section-handle-chevron", icon: "chevron-down" }))) : (h(Fragment, null, h("dso-icon", { class: "dso-section-handle-chevron", icon: "chevron-right" }), this.state && h("span", { class: "sr-only" }, stateMap[this.state]), h("span", null, this.handleTitle, this.isNeutral && (h("dso-icon", { class: "info-icon", icon: this.open || this.hover ? "info-active" : "info" }))), hasAddons && (h("div", { class: "dso-section-handle-addons" }, this.status && h("span", { class: "dso-status" }, this.status), h(HandleIcon, { state: this.state, icon: this.icon, attachmentCount: this.attachmentCount }))))))), h("dso-expandable", { class: "dso-section-body", open: this.open, enableAnimation: true, minimumHeight: this.isNeutral ? 0 : 4, onAnimationInstantiated: (e) => this.setAnimationBehaviour(e, this.host) }, h("div", { slot: "expandable-content", class: "dso-section-body-content", ref: (element) => (this.sectionBody = element) }, h("slot", null)))));
|
|
1553
191
|
}
|
|
1554
192
|
get host() { return getElement(this); }
|
|
1555
|
-
static get watchers() { return {
|
|
1556
|
-
"open": ["toggleOpen"]
|
|
1557
|
-
}; }
|
|
1558
193
|
};
|
|
1559
194
|
function isAccordion(element) {
|
|
1560
195
|
return element instanceof HTMLElement && "getState" in element;
|