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