@karmo-co/drift-kit-public 24.4.0 → 25.0.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/components.js +16 -1
- package/drift-icons-coolicon.js +1340 -461
- package/drift-kit.min.css +2 -2
- package/package.json +1 -1
package/components.js
CHANGED
|
@@ -338,12 +338,15 @@
|
|
|
338
338
|
if (dk.motion.cascade)
|
|
339
339
|
return;
|
|
340
340
|
var A = 'data-dk-cascade';
|
|
341
|
+
var last = 0;
|
|
341
342
|
function prop(root, name) { return getComputedStyle(root).getPropertyValue(name); }
|
|
342
343
|
function cap(root) { return parseFloat(prop(root, '--dk-motion-cascade-max-beats')) || 8; }
|
|
343
344
|
function reduced() { return !!(dk.motion.reduced && dk.motion.reduced()); }
|
|
344
345
|
function set(el, i, max) {
|
|
345
346
|
el.setAttribute(A + '-unit', '');
|
|
346
347
|
el.style.setProperty('--dk-cascade-i', String(Math.min(i, max)));
|
|
348
|
+
if (Math.min(i, max) > last)
|
|
349
|
+
last = Math.min(i, max);
|
|
347
350
|
}
|
|
348
351
|
function walk(container, beat, max) {
|
|
349
352
|
var kids = Array.prototype.slice.call(container.children);
|
|
@@ -386,9 +389,11 @@
|
|
|
386
389
|
if (!root || root.__dkCascaded)
|
|
387
390
|
return;
|
|
388
391
|
root.__dkCascaded = true;
|
|
392
|
+
last = 0;
|
|
389
393
|
root.__dkCascadeNext = reduced() ? 0 : walk(root, 0, cap(root));
|
|
390
394
|
if (reduced())
|
|
391
395
|
walk(root, 0, 0);
|
|
396
|
+
root.style.setProperty('--dk-cascade-last', String(last));
|
|
392
397
|
root.__dkCascadeStart = (window.performance && performance.now()) || 0;
|
|
393
398
|
root.setAttribute('data-in', '');
|
|
394
399
|
}
|
|
@@ -477,8 +482,13 @@
|
|
|
477
482
|
if (pat === 'none' || !page)
|
|
478
483
|
return { done: Promise.resolve(), start: null };
|
|
479
484
|
var kind = pat === 'slide' ? 'slide-' + (opts.direction === 'back' ? 'back' : 'forward') : 'fade';
|
|
485
|
+
var parts = opts.leave === 'parts';
|
|
486
|
+
if (parts)
|
|
487
|
+
kind = 'parts';
|
|
480
488
|
var ghost = document.createElement('div');
|
|
481
489
|
ghost.setAttribute(A + '-ghost', kind);
|
|
490
|
+
if (parts)
|
|
491
|
+
ghost.setAttribute(A + '-leave', 'parts');
|
|
482
492
|
ghost.setAttribute('aria-hidden', 'true');
|
|
483
493
|
ghost.setAttribute('inert', '');
|
|
484
494
|
var inner = document.createElement('div');
|
|
@@ -519,11 +529,16 @@
|
|
|
519
529
|
if (observer)
|
|
520
530
|
observer.disconnect();
|
|
521
531
|
entered = pageOf(region);
|
|
522
|
-
if (entered)
|
|
532
|
+
if (entered && !parts)
|
|
523
533
|
entered.setAttribute(A + '-enter', kind);
|
|
534
|
+
var root = parts && entered && (entered.hasAttribute('data-dk-cascade') ? entered : entered.querySelector('[data-dk-cascade]'));
|
|
535
|
+
if (root)
|
|
536
|
+
root.setAttribute('data-dk-cascade-after', 'leave');
|
|
524
537
|
var t = pat === 'slide'
|
|
525
538
|
? msOf(region, '--dk-motion-page-slide-duration')
|
|
526
539
|
: Math.max(msOf(region, '--dk-motion-page-fade-duration'), msOf(region, '--dk-motion-page-fade-exit-duration'));
|
|
540
|
+
if (parts)
|
|
541
|
+
t = msOf(region, '--dk-motion-exit-large-duration');
|
|
527
542
|
clearTimeout(timer);
|
|
528
543
|
timer = setTimeout(end, t + 32);
|
|
529
544
|
}
|