uikit 3.16.11-dev.bde560a72 → 3.16.11-dev.cc1aeb568

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 (75) hide show
  1. package/CHANGELOG.md +1 -0
  2. package/dist/css/uikit-core-rtl.css +1 -1
  3. package/dist/css/uikit-core-rtl.min.css +1 -1
  4. package/dist/css/uikit-core.css +1 -1
  5. package/dist/css/uikit-core.min.css +1 -1
  6. package/dist/css/uikit-rtl.css +1 -1
  7. package/dist/css/uikit-rtl.min.css +1 -1
  8. package/dist/css/uikit.css +1 -1
  9. package/dist/css/uikit.min.css +1 -1
  10. package/dist/js/components/countdown.js +1 -1
  11. package/dist/js/components/countdown.min.js +1 -1
  12. package/dist/js/components/filter.js +24 -28
  13. package/dist/js/components/filter.min.js +1 -1
  14. package/dist/js/components/lightbox-panel.js +85 -562
  15. package/dist/js/components/lightbox-panel.min.js +1 -1
  16. package/dist/js/components/lightbox.js +96 -574
  17. package/dist/js/components/lightbox.min.js +1 -1
  18. package/dist/js/components/notification.js +1 -1
  19. package/dist/js/components/notification.min.js +1 -1
  20. package/dist/js/components/parallax.js +1 -1
  21. package/dist/js/components/parallax.min.js +1 -1
  22. package/dist/js/components/slider-parallax.js +1 -1
  23. package/dist/js/components/slider-parallax.min.js +1 -1
  24. package/dist/js/components/slider.js +79 -72
  25. package/dist/js/components/slider.min.js +1 -1
  26. package/dist/js/components/slideshow-parallax.js +1 -1
  27. package/dist/js/components/slideshow-parallax.min.js +1 -1
  28. package/dist/js/components/slideshow.js +79 -72
  29. package/dist/js/components/slideshow.min.js +1 -1
  30. package/dist/js/components/sortable.js +14 -18
  31. package/dist/js/components/sortable.min.js +1 -1
  32. package/dist/js/components/tooltip.js +1 -1
  33. package/dist/js/components/tooltip.min.js +1 -1
  34. package/dist/js/components/upload.js +1 -1
  35. package/dist/js/components/upload.min.js +1 -1
  36. package/dist/js/uikit-core.js +309 -336
  37. package/dist/js/uikit-core.min.js +1 -1
  38. package/dist/js/uikit-icons.js +1 -1
  39. package/dist/js/uikit-icons.min.js +1 -1
  40. package/dist/js/uikit.js +435 -464
  41. package/dist/js/uikit.min.js +1 -1
  42. package/package.json +1 -1
  43. package/src/js/api/computed.js +48 -1
  44. package/src/js/api/hooks.js +12 -8
  45. package/src/js/api/observer.js +23 -41
  46. package/src/js/api/options.js +1 -0
  47. package/src/js/api/update.js +21 -37
  48. package/src/js/api/watch.js +21 -24
  49. package/src/js/components/filter.js +23 -29
  50. package/src/js/components/lightbox.js +12 -14
  51. package/src/js/components/sortable.js +13 -19
  52. package/src/js/core/accordion.js +32 -45
  53. package/src/js/core/drop.js +1 -1
  54. package/src/js/core/dropnav.js +46 -60
  55. package/src/js/core/height-match.js +2 -8
  56. package/src/js/core/img.js +6 -5
  57. package/src/js/core/navbar.js +19 -32
  58. package/src/js/core/scrollspy-nav.js +10 -12
  59. package/src/js/core/scrollspy.js +16 -17
  60. package/src/js/core/switcher.js +29 -40
  61. package/src/js/core/toggle.js +3 -7
  62. package/src/js/{util → mixin/internal}/scroll.js +1 -5
  63. package/src/js/mixin/modal.js +1 -1
  64. package/src/js/mixin/slider-nav.js +80 -76
  65. package/src/js/mixin/slider.js +10 -8
  66. package/src/js/util/fastdom.js +2 -2
  67. package/tests/drop.html +0 -1
  68. package/tests/dropnav.html +1 -1
  69. package/tests/icon.html +0 -2
  70. package/tests/modal.html +0 -1
  71. package/tests/nav.html +0 -1
  72. package/tests/navbar.html +0 -1
  73. package/tests/progress.html +0 -1
  74. package/tests/scroll.html +0 -1
  75. package/tests/sticky-navbar.html +6 -6
@@ -1,4 +1,4 @@
1
- /*! UIkit 3.16.11-dev.bde560a72 | https://www.getuikit.com | (c) 2014 - 2023 YOOtheme | MIT License */
1
+ /*! UIkit 3.16.11-dev.cc1aeb568 | https://www.getuikit.com | (c) 2014 - 2023 YOOtheme | MIT License */
2
2
 
3
3
  (function (global, factory) {
4
4
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('uikit-util')) :
@@ -266,500 +266,16 @@
266
266
  );
267
267
  }
268
268
 
269
- const hyphenateRe = /\B([A-Z])/g;
270
- const hyphenate = memoize((str) => str.replace(hyphenateRe, "-$1").toLowerCase());
271
- const ucfirst = memoize((str) => str.charAt(0).toUpperCase() + str.slice(1));
272
- function startsWith(str, search) {
273
- var _a;
274
- return (_a = str == null ? void 0 : str.startsWith) == null ? void 0 : _a.call(str, search);
275
- }
276
- function includes(obj, search) {
277
- var _a;
278
- return (_a = obj == null ? void 0 : obj.includes) == null ? void 0 : _a.call(obj, search);
279
- }
280
- function findIndex(array, predicate) {
281
- var _a;
282
- return (_a = array == null ? void 0 : array.findIndex) == null ? void 0 : _a.call(array, predicate);
283
- }
284
- const { isArray, from: toArray } = Array;
285
- function isFunction(obj) {
286
- return typeof obj === "function";
287
- }
288
- function isObject(obj) {
289
- return obj !== null && typeof obj === "object";
290
- }
291
- function isWindow(obj) {
292
- return isObject(obj) && obj === obj.window;
293
- }
294
- function isDocument(obj) {
295
- return nodeType(obj) === 9;
296
- }
297
- function isNode(obj) {
298
- return nodeType(obj) >= 1;
299
- }
300
- function isElement(obj) {
301
- return nodeType(obj) === 1;
302
- }
303
- function nodeType(obj) {
304
- return !isWindow(obj) && isObject(obj) && obj.nodeType;
305
- }
306
- function isString(value) {
307
- return typeof value === "string";
308
- }
309
- function isNumber(value) {
310
- return typeof value === "number";
311
- }
312
- function isNumeric(value) {
313
- return isNumber(value) || isString(value) && !isNaN(value - parseFloat(value));
314
- }
315
- function isUndefined(value) {
316
- return value === void 0;
317
- }
318
- function toFloat(value) {
319
- return parseFloat(value) || 0;
320
- }
321
- function toNode(element) {
322
- return toNodes(element)[0];
323
- }
324
- function toNodes(element) {
325
- return isNode(element) ? [element] : Array.from(element || []).filter(isNode);
326
- }
327
- function toWindow(element) {
328
- if (isWindow(element)) {
329
- return element;
330
- }
331
- element = toNode(element);
332
- const document = isDocument(element) ? element : element == null ? void 0 : element.ownerDocument;
333
- return (document == null ? void 0 : document.defaultView) || window;
334
- }
335
- function each(obj, cb) {
336
- for (const key in obj) {
337
- if (false === cb(obj[key], key)) {
338
- return false;
339
- }
340
- }
341
- return true;
342
- }
343
- function sumBy(array, iteratee) {
344
- return array.reduce(
345
- (sum, item) => sum + toFloat(isFunction(iteratee) ? iteratee(item) : item[iteratee]),
346
- 0
347
- );
348
- }
349
- function memoize(fn) {
350
- const cache = /* @__PURE__ */ Object.create(null);
351
- return (key) => cache[key] || (cache[key] = fn(key));
352
- }
353
-
354
- function attr(element, name, value) {
355
- var _a;
356
- if (isObject(name)) {
357
- for (const key in name) {
358
- attr(element, key, name[key]);
359
- }
360
- return;
361
- }
362
- if (isUndefined(value)) {
363
- return (_a = toNode(element)) == null ? void 0 : _a.getAttribute(name);
364
- } else {
365
- for (const el of toNodes(element)) {
366
- if (isFunction(value)) {
367
- value = value.call(el, attr(el, name));
368
- }
369
- if (value === null) {
370
- removeAttr(el, name);
371
- } else {
372
- el.setAttribute(name, value);
373
- }
374
- }
375
- }
376
- }
377
- function removeAttr(element, name) {
378
- toNodes(element).forEach((element2) => element2.removeAttribute(name));
379
- }
380
-
381
- function parent(element) {
382
- var _a;
383
- return (_a = toNode(element)) == null ? void 0 : _a.parentElement;
384
- }
385
- function filter(element, selector) {
386
- return toNodes(element).filter((element2) => matches(element2, selector));
387
- }
388
- function matches(element, selector) {
389
- return toNodes(element).some((element2) => element2.matches(selector));
390
- }
391
- function closest(element, selector) {
392
- return isElement(element) ? element.closest(startsWith(selector, ">") ? selector.slice(1) : selector) : toNodes(element).map((element2) => closest(element2, selector)).filter(Boolean);
393
- }
394
- function within(element, selector) {
395
- return isString(selector) ? !!closest(element, selector) : toNode(selector).contains(toNode(element));
396
- }
397
- function parents(element, selector) {
398
- const elements = [];
399
- while (element = parent(element)) {
400
- if (!selector || matches(element, selector)) {
401
- elements.push(element);
402
- }
403
- }
404
- return elements;
405
- }
406
- function children(element, selector) {
407
- element = toNode(element);
408
- const children2 = element ? toNodes(element.children) : [];
409
- return selector ? filter(children2, selector) : children2;
410
- }
411
- function index(element, ref) {
412
- return ref ? toNodes(element).indexOf(toNode(ref)) : children(parent(element)).indexOf(element);
413
- }
414
-
415
- function findAll(selector, context) {
416
- return toNodes(_query(selector, toNode(context), "querySelectorAll"));
417
- }
418
- const contextSelectorRe = /(^|[^\\],)\s*[!>+~-]/;
419
- const isContextSelector = memoize((selector) => selector.match(contextSelectorRe));
420
- const contextSanitizeRe = /([!>+~-])(?=\s+[!>+~-]|\s*$)/g;
421
- const sanatize = memoize((selector) => selector.replace(contextSanitizeRe, "$1 *"));
422
- function _query(selector, context = document, queryFn) {
423
- if (!selector || !isString(selector)) {
424
- return selector;
425
- }
426
- selector = sanatize(selector);
427
- if (isContextSelector(selector)) {
428
- const split = splitSelector(selector);
429
- selector = "";
430
- for (let sel of split) {
431
- let ctx = context;
432
- if (sel[0] === "!") {
433
- const selectors = sel.substr(1).trim().split(" ");
434
- ctx = closest(parent(context), selectors[0]);
435
- sel = selectors.slice(1).join(" ").trim();
436
- if (!sel.length && split.length === 1) {
437
- return ctx;
438
- }
439
- }
440
- if (sel[0] === "-") {
441
- const selectors = sel.substr(1).trim().split(" ");
442
- const prev = (ctx || context).previousElementSibling;
443
- ctx = matches(prev, sel.substr(1)) ? prev : null;
444
- sel = selectors.slice(1).join(" ");
445
- }
446
- if (ctx) {
447
- selector += `${selector ? "," : ""}${domPath(ctx)} ${sel}`;
448
- }
449
- }
450
- context = document;
451
- }
452
- try {
453
- return context[queryFn](selector);
454
- } catch (e) {
455
- return null;
456
- }
457
- }
458
- const selectorRe = /.*?[^\\](?:,|$)/g;
459
- const splitSelector = memoize(
460
- (selector) => selector.match(selectorRe).map((selector2) => selector2.replace(/,$/, "").trim())
461
- );
462
- function domPath(element) {
463
- const names = [];
464
- while (element.parentNode) {
465
- const id = attr(element, "id");
466
- if (id) {
467
- names.unshift(`#${escape(id)}`);
468
- break;
469
- } else {
470
- let { tagName } = element;
471
- if (tagName !== "HTML") {
472
- tagName += `:nth-child(${index(element) + 1})`;
473
- }
474
- names.unshift(tagName);
475
- element = element.parentNode;
476
- }
477
- }
478
- return names.join(" > ");
479
- }
480
- function escape(css) {
481
- return isString(css) ? CSS.escape(css) : "";
482
- }
483
-
484
- function on(...args) {
485
- let [targets, types, selector, listener, useCapture = false] = getArgs(args);
486
- if (listener.length > 1) {
487
- listener = detail(listener);
488
- }
489
- if (useCapture == null ? void 0 : useCapture.self) {
490
- listener = selfFilter(listener);
491
- }
492
- if (selector) {
493
- listener = delegate(selector, listener);
494
- }
495
- for (const type of types) {
496
- for (const target of targets) {
497
- target.addEventListener(type, listener, useCapture);
498
- }
499
- }
500
- return () => off(targets, types, listener, useCapture);
501
- }
502
- function off(...args) {
503
- let [targets, types, , listener, useCapture = false] = getArgs(args);
504
- for (const type of types) {
505
- for (const target of targets) {
506
- target.removeEventListener(type, listener, useCapture);
507
- }
508
- }
509
- }
510
- function getArgs(args) {
511
- args[0] = toEventTargets(args[0]);
512
- if (isString(args[1])) {
513
- args[1] = args[1].split(" ");
514
- }
515
- if (isFunction(args[2])) {
516
- args.splice(2, 0, false);
517
- }
518
- return args;
519
- }
520
- function delegate(selector, listener) {
521
- return (e) => {
522
- const current = selector[0] === ">" ? findAll(selector, e.currentTarget).reverse().filter((element) => within(e.target, element))[0] : closest(e.target, selector);
523
- if (current) {
524
- e.current = current;
525
- listener.call(this, e);
526
- delete e.current;
527
- }
528
- };
529
- }
530
- function detail(listener) {
531
- return (e) => isArray(e.detail) ? listener(e, ...e.detail) : listener(e);
532
- }
533
- function selfFilter(listener) {
534
- return function(e) {
535
- if (e.target === e.currentTarget || e.target === e.current) {
536
- return listener.call(null, e);
537
- }
538
- };
539
- }
540
- function isEventTarget(target) {
541
- return target && "addEventListener" in target;
542
- }
543
- function toEventTarget(target) {
544
- return isEventTarget(target) ? target : toNode(target);
545
- }
546
- function toEventTargets(target) {
547
- return isArray(target) ? target.map(toEventTarget).filter(Boolean) : isString(target) ? findAll(target) : isEventTarget(target) ? [target] : toNodes(target);
548
- }
549
-
550
- const cssNumber = {
551
- "animation-iteration-count": true,
552
- "column-count": true,
553
- "fill-opacity": true,
554
- "flex-grow": true,
555
- "flex-shrink": true,
556
- "font-weight": true,
557
- "line-height": true,
558
- opacity: true,
559
- order: true,
560
- orphans: true,
561
- "stroke-dasharray": true,
562
- "stroke-dashoffset": true,
563
- widows: true,
564
- "z-index": true,
565
- zoom: true
566
- };
567
- function css(element, property, value, priority) {
568
- const elements = toNodes(element);
569
- for (const element2 of elements) {
570
- if (isString(property)) {
571
- property = propName(property);
572
- if (isUndefined(value)) {
573
- return getComputedStyle(element2).getPropertyValue(property);
574
- } else {
575
- element2.style.setProperty(
576
- property,
577
- isNumeric(value) && !cssNumber[property] ? `${value}px` : value || isNumber(value) ? value : "",
578
- priority
579
- );
580
- }
581
- } else if (isArray(property)) {
582
- const props = {};
583
- for (const prop of property) {
584
- props[prop] = css(element2, prop);
585
- }
586
- return props;
587
- } else if (isObject(property)) {
588
- priority = value;
589
- each(property, (value2, property2) => css(element2, property2, value2, priority));
590
- }
591
- }
592
- return elements[0];
593
- }
594
- const propName = memoize((name) => vendorPropName(name));
595
- function vendorPropName(name) {
596
- if (startsWith(name, "--")) {
597
- return name;
598
- }
599
- name = hyphenate(name);
600
- const { style } = document.documentElement;
601
- if (name in style) {
602
- return name;
603
- }
604
- for (const prefix of ["webkit", "moz"]) {
605
- const prefixedName = `-${prefix}-${name}`;
606
- if (prefixedName in style) {
607
- return prefixedName;
608
- }
609
- }
610
- }
611
-
612
- const dirs = {
613
- width: ["left", "right"],
614
- height: ["top", "bottom"]
615
- };
616
- function dimensions(element) {
617
- const rect = isElement(element) ? toNode(element).getBoundingClientRect() : { height: height(element), width: width(element), top: 0, left: 0 };
618
- return {
619
- height: rect.height,
620
- width: rect.width,
621
- top: rect.top,
622
- left: rect.left,
623
- bottom: rect.top + rect.height,
624
- right: rect.left + rect.width
625
- };
626
- }
627
- function offset(element, coordinates) {
628
- const currentOffset = dimensions(element);
629
- if (element) {
630
- const { scrollY, scrollX } = toWindow(element);
631
- const offsetBy = { height: scrollY, width: scrollX };
632
- for (const dir in dirs) {
633
- for (const prop of dirs[dir]) {
634
- currentOffset[prop] += offsetBy[dir];
635
- }
636
- }
637
- }
638
- if (!coordinates) {
639
- return currentOffset;
640
- }
641
- const pos = css(element, "position");
642
- each(
643
- css(element, ["left", "top"]),
644
- (value, prop) => css(
645
- element,
646
- prop,
647
- coordinates[prop] - currentOffset[prop] + toFloat(pos === "absolute" && value === "auto" ? position(element)[prop] : value)
648
- )
649
- );
650
- }
651
- function position(element) {
652
- let { top, left } = offset(element);
653
- const {
654
- ownerDocument: { body, documentElement },
655
- offsetParent
656
- } = toNode(element);
657
- let parent = offsetParent || documentElement;
658
- while (parent && (parent === body || parent === documentElement) && css(parent, "position") === "static") {
659
- parent = parent.parentNode;
660
- }
661
- if (isElement(parent)) {
662
- const parentOffset = offset(parent);
663
- top -= parentOffset.top + toFloat(css(parent, "borderTopWidth"));
664
- left -= parentOffset.left + toFloat(css(parent, "borderLeftWidth"));
665
- }
666
- return {
667
- top: top - toFloat(css(element, "marginTop")),
668
- left: left - toFloat(css(element, "marginLeft"))
669
- };
670
- }
671
- const height = dimension("height");
672
- const width = dimension("width");
673
- function dimension(prop) {
674
- const propName = ucfirst(prop);
675
- return (element, value) => {
676
- if (isUndefined(value)) {
677
- if (isWindow(element)) {
678
- return element[`inner${propName}`];
679
- }
680
- if (isDocument(element)) {
681
- const doc = element.documentElement;
682
- return Math.max(doc[`offset${propName}`], doc[`scroll${propName}`]);
683
- }
684
- element = toNode(element);
685
- value = css(element, prop);
686
- value = value === "auto" ? element[`offset${propName}`] : toFloat(value) || 0;
687
- return value - boxModelAdjust(element, prop);
688
- } else {
689
- return css(
690
- element,
691
- prop,
692
- !value && value !== 0 ? "" : +value + boxModelAdjust(element, prop) + "px"
693
- );
694
- }
695
- };
696
- }
697
- function boxModelAdjust(element, prop, sizing = "border-box") {
698
- return css(element, "boxSizing") === sizing ? sumBy(
699
- dirs[prop].map(ucfirst),
700
- (prop2) => toFloat(css(element, `padding${prop2}`)) + toFloat(css(element, `border${prop2}Width`))
701
- ) : 0;
702
- }
703
-
704
- function scrollParents(element, scrollable = false, props = []) {
705
- const scrollEl = scrollingElement(element);
706
- let ancestors = parents(element).reverse();
707
- ancestors = ancestors.slice(ancestors.indexOf(scrollEl) + 1);
708
- const fixedIndex = findIndex(ancestors, (el) => css(el, "position") === "fixed");
709
- if (~fixedIndex) {
710
- ancestors = ancestors.slice(fixedIndex);
711
- }
712
- return [scrollEl].concat(
713
- ancestors.filter(
714
- (parent) => css(parent, "overflow").split(" ").some((prop) => includes(["auto", "scroll", ...props], prop)) && (!scrollable || parent.scrollHeight > offsetViewport(parent).height)
715
- )
716
- ).reverse();
717
- }
718
- function offsetViewport(scrollElement) {
719
- const window = toWindow(scrollElement);
720
- const {
721
- visualViewport,
722
- document: { documentElement }
723
- } = window;
724
- let viewportElement = scrollElement === scrollingElement(scrollElement) ? window : scrollElement;
725
- if (isWindow(viewportElement) && visualViewport) {
726
- let { height, width, scale, pageTop: top, pageLeft: left } = visualViewport;
727
- height = Math.round(height * scale);
728
- width = Math.round(width * scale);
729
- return { height, width, top, left, bottom: top + height, right: left + width };
730
- }
731
- let rect = offset(viewportElement);
732
- if (css(viewportElement, "display") === "inline") {
733
- return rect;
734
- }
735
- for (let [prop, dir, start, end] of [
736
- ["width", "x", "left", "right"],
737
- ["height", "y", "top", "bottom"]
738
- ]) {
739
- if (isWindow(viewportElement)) {
740
- viewportElement = documentElement;
741
- } else {
742
- rect[start] += toFloat(css(viewportElement, `border-${start}-width`));
743
- }
744
- rect[prop] = rect[dir] = viewportElement[`client${ucfirst(prop)}`];
745
- rect[end] = rect[prop] + rect[start];
746
- }
747
- return rect;
748
- }
749
- function scrollingElement(element) {
750
- return toWindow(element).document.scrollingElement;
751
- }
752
-
753
269
  let prevented;
754
270
  function preventBackgroundScroll(el) {
755
- const off = on(
271
+ const off = util.on(
756
272
  el,
757
273
  "touchmove",
758
274
  (e) => {
759
- if (e.targetTouches.length !== 1 || matches(e.target, 'input[type="range"')) {
275
+ if (e.targetTouches.length !== 1 || util.matches(e.target, 'input[type="range"')) {
760
276
  return;
761
277
  }
762
- let [{ scrollHeight, clientHeight }] = scrollParents(e.target);
278
+ let [{ scrollHeight, clientHeight }] = util.scrollParents(e.target);
763
279
  if (clientHeight >= scrollHeight && e.cancelable) {
764
280
  e.preventDefault();
765
281
  }
@@ -771,15 +287,15 @@
771
287
  }
772
288
  prevented = true;
773
289
  const { scrollingElement } = document;
774
- css(scrollingElement, {
290
+ util.css(scrollingElement, {
775
291
  overflowY: CSS.supports("overflow", "clip") ? "clip" : "hidden",
776
292
  touchAction: "none",
777
- paddingRight: width(window) - scrollingElement.clientWidth || ""
293
+ paddingRight: util.width(window) - scrollingElement.clientWidth || ""
778
294
  });
779
295
  return () => {
780
296
  prevented = false;
781
297
  off();
782
- css(scrollingElement, { overflowY: "", touchAction: "", paddingRight: "" });
298
+ util.css(scrollingElement, { overflowY: "", touchAction: "", paddingRight: "" });
783
299
  };
784
300
  }
785
301
 
@@ -1117,28 +633,81 @@
1117
633
  role: "region"
1118
634
  },
1119
635
  computed: {
1120
- nav: {
1121
- get({ selNav }, $el) {
1122
- return util.$(selNav, $el);
1123
- },
1124
- watch(nav, prev) {
1125
- util.attr(nav, "role", "tablist");
1126
- if (prev) {
1127
- this.$emit();
1128
- }
1129
- },
1130
- immediate: true
636
+ nav({ selNav }, $el) {
637
+ return util.$(selNav, $el);
638
+ },
639
+ navChildren() {
640
+ return util.children(this.nav);
1131
641
  },
1132
642
  selNavItem({ attrItem }) {
1133
643
  return `[${attrItem}],[data-${attrItem}]`;
1134
644
  },
1135
- navItems: {
1136
- get(_, $el) {
1137
- return util.$$(this.selNavItem, $el);
1138
- },
1139
- watch() {
645
+ navItems(_, $el) {
646
+ return util.$$(this.selNavItem, $el);
647
+ }
648
+ },
649
+ watch: {
650
+ nav(nav, prev) {
651
+ util.attr(nav, "role", "tablist");
652
+ if (prev) {
1140
653
  this.$emit();
1141
654
  }
655
+ },
656
+ list(list) {
657
+ util.attr(list, "role", "presentation");
658
+ },
659
+ navChildren(children2) {
660
+ util.attr(children2, "role", "presentation");
661
+ },
662
+ navItems(items) {
663
+ for (const el of items) {
664
+ const cmd = util.data(el, this.attrItem);
665
+ const button = util.$("a,button", el) || el;
666
+ let ariaLabel;
667
+ let ariaControls = null;
668
+ if (util.isNumeric(cmd)) {
669
+ const item = util.toNumber(cmd);
670
+ const slide = this.slides[item];
671
+ if (slide) {
672
+ if (!slide.id) {
673
+ slide.id = generateId(this, slide, `-item-${cmd}`);
674
+ }
675
+ ariaControls = slide.id;
676
+ }
677
+ ariaLabel = this.t("slideX", util.toFloat(cmd) + 1);
678
+ util.attr(button, "role", "tab");
679
+ } else {
680
+ if (this.list) {
681
+ if (!this.list.id) {
682
+ this.list.id = generateId(this, this.list, "-items");
683
+ }
684
+ ariaControls = this.list.id;
685
+ }
686
+ ariaLabel = this.t(cmd);
687
+ }
688
+ util.attr(button, {
689
+ "aria-controls": ariaControls,
690
+ "aria-label": util.attr(button, "aria-label") || ariaLabel
691
+ });
692
+ }
693
+ },
694
+ slides(slides) {
695
+ slides.forEach(
696
+ (slide, i) => util.attr(slide, {
697
+ role: this.nav ? "tabpanel" : "group",
698
+ "aria-label": this.t("slideLabel", i + 1, this.length),
699
+ "aria-roledescription": this.nav ? null : "slide"
700
+ })
701
+ );
702
+ },
703
+ length(length) {
704
+ const navLength = this.navChildren.length;
705
+ if (this.nav && length !== navLength) {
706
+ util.empty(this.nav);
707
+ for (let i = 0; i < length; i++) {
708
+ util.append(this.nav, `<li ${this.attrItem}="${i}"><a href></a></li>`);
709
+ }
710
+ }
1142
711
  }
1143
712
  },
1144
713
  connected() {
@@ -1148,54 +717,6 @@
1148
717
  });
1149
718
  },
1150
719
  update: [
1151
- {
1152
- write() {
1153
- this.slides.forEach(
1154
- (slide, i) => util.attr(slide, {
1155
- role: this.nav ? "tabpanel" : "group",
1156
- "aria-label": this.t("slideLabel", i + 1, this.length),
1157
- "aria-roledescription": this.nav ? null : "slide"
1158
- })
1159
- );
1160
- if (this.nav && this.length !== this.nav.children.length) {
1161
- util.html(
1162
- this.nav,
1163
- this.slides.map((_, i) => `<li ${this.attrItem}="${i}"><a href></a></li>`).join("")
1164
- );
1165
- }
1166
- util.attr(util.children(this.nav).concat(this.list), "role", "presentation");
1167
- for (const el of this.navItems) {
1168
- const cmd = util.data(el, this.attrItem);
1169
- const button = util.$("a,button", el) || el;
1170
- let ariaLabel;
1171
- let ariaControls = null;
1172
- if (util.isNumeric(cmd)) {
1173
- const item = util.toNumber(cmd);
1174
- const slide = this.slides[item];
1175
- if (slide) {
1176
- if (!slide.id) {
1177
- slide.id = generateId(this, slide, `-item-${cmd}`);
1178
- }
1179
- ariaControls = slide.id;
1180
- }
1181
- ariaLabel = this.t("slideX", util.toFloat(cmd) + 1);
1182
- util.attr(button, "role", "tab");
1183
- } else {
1184
- if (this.list) {
1185
- if (!this.list.id) {
1186
- this.list.id = generateId(this, this.list, "-items");
1187
- }
1188
- ariaControls = this.list.id;
1189
- }
1190
- ariaLabel = this.t(cmd);
1191
- }
1192
- util.attr(button, {
1193
- "aria-controls": ariaControls,
1194
- "aria-label": util.attr(button, "aria-label") || ariaLabel
1195
- });
1196
- }
1197
- }
1198
- },
1199
720
  {
1200
721
  write() {
1201
722
  this.navItems.concat(this.nav).forEach((el) => el && (el.hidden = !this.maxIndex));
@@ -1533,18 +1054,20 @@
1533
1054
  maxIndex() {
1534
1055
  return this.length - 1;
1535
1056
  },
1536
- slides: {
1537
- get() {
1538
- return util.children(this.list);
1539
- },
1540
- watch() {
1541
- this.$emit();
1542
- }
1057
+ slides() {
1058
+ return util.children(this.list);
1543
1059
  },
1544
1060
  length() {
1545
1061
  return this.slides.length;
1546
1062
  }
1547
1063
  },
1064
+ watch: {
1065
+ slides(slides, prev) {
1066
+ if (prev) {
1067
+ this.$emit();
1068
+ }
1069
+ }
1070
+ },
1548
1071
  observe: resize(),
1549
1072
  methods: {
1550
1073
  show(index, force = false) {
@@ -1928,19 +1451,18 @@
1928
1451
  props: { toggle: String },
1929
1452
  data: { toggle: "a" },
1930
1453
  computed: {
1931
- toggles: {
1932
- get({ toggle }, $el) {
1933
- return util.$$(toggle, $el);
1934
- },
1935
- watch(toggles) {
1936
- this.hide();
1937
- for (const toggle of toggles) {
1938
- if (util.isTag(toggle, "a")) {
1939
- util.attr(toggle, "role", "button");
1940
- }
1454
+ toggles({ toggle }, $el) {
1455
+ return util.$$(toggle, $el);
1456
+ }
1457
+ },
1458
+ watch: {
1459
+ toggles(toggles) {
1460
+ this.hide();
1461
+ for (const toggle of toggles) {
1462
+ if (util.isTag(toggle, "a")) {
1463
+ util.attr(toggle, "role", "button");
1941
1464
  }
1942
- },
1943
- immediate: true
1465
+ }
1944
1466
  }
1945
1467
  },
1946
1468
  disconnected() {