@nanahoshi/mona-ui 0.24.8 → 0.24.9

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 (81) hide show
  1. package/fesm2022/nanahoshi-mona-ui-button-group.mjs +37 -9
  2. package/fesm2022/nanahoshi-mona-ui-button.mjs +8 -2
  3. package/fesm2022/nanahoshi-mona-ui-color-gradient.mjs +4 -3
  4. package/fesm2022/nanahoshi-mona-ui-contextmenu.mjs +101 -47
  5. package/fesm2022/nanahoshi-mona-ui-dialog.mjs +339 -101
  6. package/fesm2022/nanahoshi-mona-ui-dropdown-button.mjs +119 -69
  7. package/fesm2022/nanahoshi-mona-ui-editor.mjs +2 -2
  8. package/fesm2022/{nanahoshi-mona-ui-grid-grid-footer-row.component-DdyHnUIr.mjs → nanahoshi-mona-ui-grid-grid-footer-row.component-DhKLnW06.mjs} +2 -2
  9. package/fesm2022/{nanahoshi-mona-ui-grid-grid-list.component-B6gq7Hu3.mjs → nanahoshi-mona-ui-grid-grid-list.component-voGbKOiB.mjs} +4 -4
  10. package/fesm2022/{nanahoshi-mona-ui-grid-grid-row.component-DdUY3I7P.mjs → nanahoshi-mona-ui-grid-grid-row.component-HQ1Kv6R9.mjs} +2 -3
  11. package/fesm2022/{nanahoshi-mona-ui-grid-grid-virtual-list.component-DG8Bu4Dy.mjs → nanahoshi-mona-ui-grid-grid-virtual-list.component-PNLJFcuH.mjs} +4 -4
  12. package/fesm2022/{nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-CVqpbMcb.mjs → nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-BO19AVwC.mjs} +9 -9
  13. package/fesm2022/nanahoshi-mona-ui-grid.mjs +1 -1
  14. package/fesm2022/nanahoshi-mona-ui-i18n-icu.mjs +4 -0
  15. package/fesm2022/nanahoshi-mona-ui-internal.mjs +438 -22
  16. package/fesm2022/nanahoshi-mona-ui-locales-ar-sa.mjs +4 -0
  17. package/fesm2022/nanahoshi-mona-ui-locales-de-de.mjs +4 -0
  18. package/fesm2022/nanahoshi-mona-ui-locales-es-es.mjs +4 -0
  19. package/fesm2022/nanahoshi-mona-ui-locales-fr-fr.mjs +4 -0
  20. package/fesm2022/nanahoshi-mona-ui-locales-id-id.mjs +4 -0
  21. package/fesm2022/nanahoshi-mona-ui-locales-it-it.mjs +4 -0
  22. package/fesm2022/nanahoshi-mona-ui-locales-ja-jp.mjs +4 -0
  23. package/fesm2022/nanahoshi-mona-ui-locales-ko-kr.mjs +4 -0
  24. package/fesm2022/nanahoshi-mona-ui-locales-pt-br.mjs +4 -0
  25. package/fesm2022/nanahoshi-mona-ui-locales-ru-ru.mjs +4 -0
  26. package/fesm2022/nanahoshi-mona-ui-locales-tr-tr.mjs +4 -0
  27. package/fesm2022/nanahoshi-mona-ui-locales-zh-cn.mjs +4 -0
  28. package/fesm2022/nanahoshi-mona-ui-locales-zh-tw.mjs +4 -0
  29. package/fesm2022/nanahoshi-mona-ui-menubar.mjs +127 -133
  30. package/fesm2022/nanahoshi-mona-ui-notification.mjs +473 -240
  31. package/fesm2022/nanahoshi-mona-ui-popover.mjs +202 -90
  32. package/fesm2022/nanahoshi-mona-ui-popup-menu.mjs +609 -256
  33. package/fesm2022/nanahoshi-mona-ui-popup.mjs +2 -0
  34. package/fesm2022/nanahoshi-mona-ui-sheet.mjs +45 -10
  35. package/fesm2022/nanahoshi-mona-ui-split-button.mjs +102 -58
  36. package/fesm2022/nanahoshi-mona-ui-tooltip.mjs +286 -443
  37. package/fesm2022/nanahoshi-mona-ui-window.mjs +591 -310
  38. package/i18n/catalogs/en-US.messages.json +4 -0
  39. package/locales/ar-sa/ar-sa.messages.json +4 -0
  40. package/locales/de-de/de-de.messages.json +4 -0
  41. package/locales/es-es/es-es.messages.json +4 -0
  42. package/locales/fr-fr/fr-fr.messages.json +4 -0
  43. package/locales/id-id/id-id.messages.json +4 -0
  44. package/locales/it-it/it-it.messages.json +4 -0
  45. package/locales/ja-jp/ja-jp.messages.json +4 -0
  46. package/locales/ko-kr/ko-kr.messages.json +4 -0
  47. package/locales/pt-br/pt-br.messages.json +4 -0
  48. package/locales/ru-ru/ru-ru.messages.json +4 -0
  49. package/locales/tr-tr/tr-tr.messages.json +4 -0
  50. package/locales/zh-cn/zh-cn.messages.json +4 -0
  51. package/locales/zh-tw/zh-tw.messages.json +4 -0
  52. package/package.json +1 -1
  53. package/types/nanahoshi-mona-ui-button-group.d.ts +13 -3
  54. package/types/nanahoshi-mona-ui-button.d.ts +20 -3
  55. package/types/nanahoshi-mona-ui-contextmenu.d.ts +5 -6
  56. package/types/nanahoshi-mona-ui-dialog.d.ts +131 -20
  57. package/types/nanahoshi-mona-ui-dropdown-button.d.ts +75 -56
  58. package/types/nanahoshi-mona-ui-i18n.d.ts +19 -0
  59. package/types/nanahoshi-mona-ui-internal.d.ts +119 -15
  60. package/types/nanahoshi-mona-ui-locales-ar-sa.d.ts +4 -0
  61. package/types/nanahoshi-mona-ui-locales-de-de.d.ts +4 -0
  62. package/types/nanahoshi-mona-ui-locales-es-es.d.ts +4 -0
  63. package/types/nanahoshi-mona-ui-locales-fr-fr.d.ts +4 -0
  64. package/types/nanahoshi-mona-ui-locales-id-id.d.ts +4 -0
  65. package/types/nanahoshi-mona-ui-locales-it-it.d.ts +4 -0
  66. package/types/nanahoshi-mona-ui-locales-ja-jp.d.ts +4 -0
  67. package/types/nanahoshi-mona-ui-locales-ko-kr.d.ts +4 -0
  68. package/types/nanahoshi-mona-ui-locales-pt-br.d.ts +4 -0
  69. package/types/nanahoshi-mona-ui-locales-ru-ru.d.ts +4 -0
  70. package/types/nanahoshi-mona-ui-locales-tr-tr.d.ts +4 -0
  71. package/types/nanahoshi-mona-ui-locales-zh-cn.d.ts +4 -0
  72. package/types/nanahoshi-mona-ui-locales-zh-tw.d.ts +4 -0
  73. package/types/nanahoshi-mona-ui-menubar.d.ts +65 -62
  74. package/types/nanahoshi-mona-ui-notification.d.ts +76 -16
  75. package/types/nanahoshi-mona-ui-popover.d.ts +44 -17
  76. package/types/nanahoshi-mona-ui-popup-menu.d.ts +110 -32
  77. package/types/nanahoshi-mona-ui-popup.d.ts +2 -0
  78. package/types/nanahoshi-mona-ui-sheet.d.ts +16 -5
  79. package/types/nanahoshi-mona-ui-split-button.d.ts +29 -7
  80. package/types/nanahoshi-mona-ui-tooltip.d.ts +43 -20
  81. package/types/nanahoshi-mona-ui-window.d.ts +103 -14
@@ -1,5 +1,6 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { inject, ElementRef, Renderer2, input, effect, Directive, DOCUMENT, signal, afterEveryRender, untracked } from '@angular/core';
3
+ import { GlobalPositionStrategy, ConnectionPositionPair } from '@angular/cdk/overlay';
3
4
  import { forEach } from '@mirei/ts-collections';
4
5
  import { Observable, timer, take, debounceTime, map, merge, scan, filter } from 'rxjs';
5
6
  import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
@@ -220,6 +221,29 @@ const string2rgba = (rgbText) => {
220
221
  return { r: 0, g: 0, b: 0, a: 255 };
221
222
  };
222
223
 
224
+ const tokensOf = (element, attribute) => (element.getAttribute(attribute) ?? "").split(/\s+/).filter(token => token !== "");
225
+ /**
226
+ * Adds `id` to an id-list attribute such as `aria-describedby`, keeping the ids already there.
227
+ */
228
+ const addAriaReference = (element, attribute, id) => {
229
+ const tokens = tokensOf(element, attribute);
230
+ if (!tokens.includes(id)) {
231
+ element.setAttribute(attribute, [...tokens, id].join(" "));
232
+ }
233
+ };
234
+ /**
235
+ * Removes `id` from an id-list attribute, and the attribute itself once it holds no ids.
236
+ */
237
+ const removeAriaReference = (element, attribute, id) => {
238
+ const tokens = tokensOf(element, attribute).filter(token => token !== id);
239
+ if (tokens.length) {
240
+ element.setAttribute(attribute, tokens.join(" "));
241
+ }
242
+ else {
243
+ element.removeAttribute(attribute);
244
+ }
245
+ };
246
+
223
247
  /**
224
248
  * Generates a unique control ID for an element.
225
249
  * The ID consists of the `mona-` prefix followed by a random hexadecimal string.
@@ -276,6 +300,73 @@ function focusElement(host, element) {
276
300
  }
277
301
  }
278
302
 
303
+ /**
304
+ * How many open modal overlays made each element inert. An element is made inert by the first and released by the
305
+ * last, so closing one of two stacked modals leaves the page behind the other one inert.
306
+ */
307
+ const inertCounts = new WeakMap();
308
+ /** Elements left alone: they hold no content, or announce for everyone (live regions, CDK's live announcer). */
309
+ const isExempt = (element) => element instanceof HTMLScriptElement ||
310
+ element instanceof HTMLStyleElement ||
311
+ element instanceof HTMLTemplateElement ||
312
+ element.hasAttribute("aria-live") ||
313
+ element.classList.contains("cdk-overlay-backdrop");
314
+ /**
315
+ * Makes everything outside a modal overlay inert, so assistive technology, the pointer and Tab can't reach the page
316
+ * behind it. Walking up from `element` to `<body>`, every sibling is made inert, except that inside the CDK overlay
317
+ * container only the overlays opened before this one are: popups opened later (a dropdown inside the dialog) stay
318
+ * usable. Elements that were inert already are left as they are.
319
+ * @param element the overlay's host element (the CDK overlay wrapper)
320
+ * @returns the function that releases what this call made inert
321
+ */
322
+ const inertOutside = (element) => {
323
+ const body = element.ownerDocument.body;
324
+ const acquired = [];
325
+ let node = element;
326
+ while (node && node !== body && node.parentElement) {
327
+ const parent = node.parentElement;
328
+ const onlyEarlier = parent.classList.contains("cdk-overlay-container");
329
+ for (const sibling of Array.from(parent.children)) {
330
+ if (sibling === node) {
331
+ if (onlyEarlier) {
332
+ break;
333
+ }
334
+ continue;
335
+ }
336
+ if (isExempt(sibling)) {
337
+ continue;
338
+ }
339
+ const count = inertCounts.get(sibling) ?? 0;
340
+ if (count === 0 && sibling.hasAttribute("inert")) {
341
+ continue;
342
+ }
343
+ inertCounts.set(sibling, count + 1);
344
+ if (count === 0) {
345
+ sibling.setAttribute("inert", "");
346
+ }
347
+ acquired.push(sibling);
348
+ }
349
+ node = parent;
350
+ }
351
+ let released = false;
352
+ return () => {
353
+ if (released) {
354
+ return;
355
+ }
356
+ released = true;
357
+ for (const sibling of acquired) {
358
+ const count = (inertCounts.get(sibling) ?? 1) - 1;
359
+ if (count <= 0) {
360
+ inertCounts.delete(sibling);
361
+ sibling.removeAttribute("inert");
362
+ }
363
+ else {
364
+ inertCounts.set(sibling, count);
365
+ }
366
+ }
367
+ };
368
+ };
369
+
279
370
  /**
280
371
  * The text of the elements an `aria-labelledby` value points to, joined with spaces, for names built from a
281
372
  * component's name ("Filter {name}"). It's read after every render, so it follows the labelling elements' text.
@@ -302,6 +393,31 @@ function injectLabelledByText(ids) {
302
393
  return text.asReadonly();
303
394
  }
304
395
 
396
+ /**
397
+ * Places a global overlay through its position strategy, so later `updatePosition()` calls (a direction change, a
398
+ * resize) keep it where it is instead of resetting inline styles. Each axis is independent: a `top` alone keeps the
399
+ * overlay centered horizontally. Centering follows the overlay's size as it grows or shrinks.
400
+ */
401
+ const positionGlobalOverlay = (overlayRef, position) => {
402
+ const strategy = overlayRef.getConfig().positionStrategy;
403
+ if (!(strategy instanceof GlobalPositionStrategy)) {
404
+ return;
405
+ }
406
+ if (position.left != null) {
407
+ strategy.left(`${position.left}px`);
408
+ }
409
+ else {
410
+ strategy.centerHorizontally();
411
+ }
412
+ if (position.top != null) {
413
+ strategy.top(`${position.top}px`);
414
+ }
415
+ else {
416
+ strategy.centerVertically();
417
+ }
418
+ overlayRef.updatePosition();
419
+ };
420
+
305
421
  const rxFromResize = (target, options) => {
306
422
  return new Observable(observer => {
307
423
  const elements = target instanceof Element ? [target] : Array.from(target ?? []);
@@ -351,6 +467,326 @@ const themeOverlaySurfaceClasses = `
351
467
  ${themeOverlayBackdropClasses}
352
468
  `;
353
469
 
470
+ /**
471
+ * How long a popup opened by hovering waits after the pointer leaves its anchor, so the pointer can cross the gap
472
+ * onto the popup and stay there (WCAG 1.4.13, Content on Hover or Focus).
473
+ */
474
+ const HOVER_GRACE = 100;
475
+ /**
476
+ * When to show and hide a popup that follows the pointer and focus, shared by the tooltip and the hover popover.
477
+ *
478
+ * - A show waits for `showDelay`, and leaving the anchor first cancels it.
479
+ * - The popup stays while the pointer is on the anchor or on the popup, or focus is on the anchor. Leaving waits for
480
+ * `hideDelay` (at least {@link HOVER_GRACE} for the pointer), and coming back cancels the hide.
481
+ * - Moving to another anchor replaces the popup.
482
+ * - After a dismissal (Escape), the popup stays closed until the pointer and focus have left that anchor.
483
+ */
484
+ class HoverIntent {
485
+ #config;
486
+ #anchor = null;
487
+ #dismissed = null;
488
+ #focused = false;
489
+ #hideTimer = null;
490
+ #hovered = false;
491
+ #panelCleanup = null;
492
+ #panelHovered = false;
493
+ #pending = null;
494
+ #showTimer = null;
495
+ #tracked = null;
496
+ constructor(config) {
497
+ this.#config = config;
498
+ }
499
+ /**
500
+ * Reports that the popup for `anchor` started closing for a reason of its own (Escape, an outside click, being
501
+ * disabled). With `dismissed`, it stays closed until the pointer and focus have left the anchor.
502
+ */
503
+ closed(anchor, dismissed = false) {
504
+ if (this.#anchor !== anchor) {
505
+ return;
506
+ }
507
+ if (dismissed && (this.#hovered || this.#focused)) {
508
+ this.#dismissed = anchor;
509
+ }
510
+ this.#release();
511
+ }
512
+ /** Stops every timer and forgets every anchor, without closing anything. */
513
+ dispose() {
514
+ this.#clearShow();
515
+ this.#cancelHide();
516
+ this.#release();
517
+ this.#pending = null;
518
+ this.#tracked = null;
519
+ this.#dismissed = null;
520
+ }
521
+ /** The pointer moved onto `anchor`, or focus moved into it. */
522
+ enter(anchor, source) {
523
+ if (anchor !== this.#tracked) {
524
+ this.#tracked = anchor;
525
+ this.#hovered = false;
526
+ this.#focused = false;
527
+ }
528
+ this.#setActive(source, true);
529
+ if (this.#dismissed === anchor) {
530
+ return;
531
+ }
532
+ this.#dismissed = null;
533
+ this.#cancelHide();
534
+ if (this.#anchor === anchor || this.#pending === anchor) {
535
+ return;
536
+ }
537
+ this.#clearShow();
538
+ this.#pending = anchor;
539
+ const delay = this.#config.showDelay();
540
+ if (delay > 0) {
541
+ this.#showTimer = setTimeout(() => this.#show(anchor), delay);
542
+ }
543
+ else {
544
+ this.#show(anchor);
545
+ }
546
+ }
547
+ /** Hides the popup now, as leaving would, and cancels a pending show. */
548
+ hideNow() {
549
+ this.#clearShow();
550
+ this.#pending = null;
551
+ this.#cancelHide();
552
+ if (this.#anchor) {
553
+ this.#release();
554
+ this.#config.hide();
555
+ }
556
+ }
557
+ /** The pointer left `anchor`, or focus left it. */
558
+ leave(anchor, source) {
559
+ if (anchor !== this.#tracked) {
560
+ return;
561
+ }
562
+ this.#setActive(source, false);
563
+ if (this.#hovered || this.#focused) {
564
+ return;
565
+ }
566
+ if (this.#dismissed === anchor) {
567
+ this.#dismissed = null;
568
+ return;
569
+ }
570
+ if (this.#pending === anchor) {
571
+ this.#clearShow();
572
+ this.#pending = null;
573
+ }
574
+ if (this.#anchor === anchor && !this.#panelHovered) {
575
+ this.#scheduleHide(source);
576
+ }
577
+ }
578
+ /**
579
+ * Reports that the popup for `anchor` is open. While the pointer is on `panel`, the popup stays.
580
+ */
581
+ opened(anchor, panel) {
582
+ this.#release();
583
+ this.#anchor = anchor;
584
+ if (!panel) {
585
+ return;
586
+ }
587
+ const enter = (event) => {
588
+ if (event.pointerType === "touch") {
589
+ return;
590
+ }
591
+ this.#panelHovered = true;
592
+ this.#cancelHide();
593
+ };
594
+ const leave = (event) => {
595
+ if (event.pointerType === "touch") {
596
+ return;
597
+ }
598
+ this.#panelHovered = false;
599
+ if (this.#anchor === anchor && !this.#hovered && !this.#focused) {
600
+ this.#scheduleHide("pointer");
601
+ }
602
+ };
603
+ panel.addEventListener("pointerenter", enter);
604
+ panel.addEventListener("pointerleave", leave);
605
+ this.#panelCleanup = () => {
606
+ panel.removeEventListener("pointerenter", enter);
607
+ panel.removeEventListener("pointerleave", leave);
608
+ };
609
+ }
610
+ #cancelHide() {
611
+ if (this.#hideTimer != null) {
612
+ clearTimeout(this.#hideTimer);
613
+ this.#hideTimer = null;
614
+ }
615
+ }
616
+ #clearShow() {
617
+ if (this.#showTimer != null) {
618
+ clearTimeout(this.#showTimer);
619
+ this.#showTimer = null;
620
+ }
621
+ }
622
+ #release() {
623
+ this.#panelCleanup?.();
624
+ this.#panelCleanup = null;
625
+ this.#panelHovered = false;
626
+ this.#anchor = null;
627
+ this.#cancelHide();
628
+ }
629
+ #scheduleHide(source) {
630
+ this.#cancelHide();
631
+ const delay = Math.max(this.#config.hideDelay(), source === "pointer" ? HOVER_GRACE : 0);
632
+ const hide = () => {
633
+ this.#hideTimer = null;
634
+ if (this.#anchor) {
635
+ this.#release();
636
+ this.#config.hide();
637
+ }
638
+ };
639
+ if (delay > 0) {
640
+ this.#hideTimer = setTimeout(hide, delay);
641
+ }
642
+ else {
643
+ hide();
644
+ }
645
+ }
646
+ #setActive(source, active) {
647
+ if (source === "pointer") {
648
+ this.#hovered = active;
649
+ }
650
+ else {
651
+ this.#focused = active;
652
+ }
653
+ }
654
+ #show(anchor) {
655
+ this.#showTimer = null;
656
+ this.#pending = null;
657
+ if (this.#anchor && this.#anchor !== anchor) {
658
+ this.#release();
659
+ this.#config.hide();
660
+ }
661
+ this.#config.show(anchor);
662
+ }
663
+ /** The anchor whose popup is open, if any. */
664
+ get anchor() {
665
+ return this.#anchor;
666
+ }
667
+ }
668
+ /**
669
+ * Feeds a {@link HoverIntent} from pointer and focus events delegated on `root`, so anchors added, removed or
670
+ * re-rendered later need no listeners of their own. Touch pointers are ignored: a tap that focuses the anchor shows
671
+ * the popup through focus instead, and it isn't hidden again by the pointer leaving after the tap.
672
+ * @param resolve the anchor an event target belongs to, or `null`
673
+ * @returns the function that removes the listeners
674
+ */
675
+ const listenForHover = (root, resolve, intent) => {
676
+ const anchorOf = (target) => target instanceof Element ? resolve(target) : null;
677
+ const stillInside = (anchor, to) => to instanceof Node && anchor.contains(to);
678
+ const over = (event) => {
679
+ if (event.pointerType === "touch") {
680
+ return;
681
+ }
682
+ const anchor = anchorOf(event.target);
683
+ if (anchor) {
684
+ intent.enter(anchor, "pointer");
685
+ }
686
+ };
687
+ const out = (event) => {
688
+ if (event.pointerType === "touch") {
689
+ return;
690
+ }
691
+ const anchor = anchorOf(event.target);
692
+ if (anchor && !stillInside(anchor, event.relatedTarget)) {
693
+ intent.leave(anchor, "pointer");
694
+ }
695
+ };
696
+ const focusIn = (event) => {
697
+ const anchor = anchorOf(event.target);
698
+ if (anchor) {
699
+ intent.enter(anchor, "focus");
700
+ }
701
+ };
702
+ const focusOut = (event) => {
703
+ const anchor = anchorOf(event.target);
704
+ if (anchor && !stillInside(anchor, event.relatedTarget)) {
705
+ intent.leave(anchor, "focus");
706
+ }
707
+ };
708
+ root.addEventListener("pointerover", over);
709
+ root.addEventListener("pointerout", out);
710
+ root.addEventListener("focusin", focusIn);
711
+ root.addEventListener("focusout", focusOut);
712
+ return () => {
713
+ root.removeEventListener("pointerover", over);
714
+ root.removeEventListener("pointerout", out);
715
+ root.removeEventListener("focusin", focusIn);
716
+ root.removeEventListener("focusout", focusOut);
717
+ };
718
+ };
719
+ /**
720
+ * Calls `callback` once `element` leaves the document, for a popup that would otherwise stay anchored to nothing.
721
+ * @returns the function that stops watching
722
+ */
723
+ const onDisconnect = (element, callback) => {
724
+ const view = element.ownerDocument.defaultView;
725
+ if (!view?.MutationObserver) {
726
+ return () => undefined;
727
+ }
728
+ const observer = new view.MutationObserver(() => {
729
+ if (!element.isConnected) {
730
+ observer.disconnect();
731
+ callback();
732
+ }
733
+ });
734
+ observer.observe(element.ownerDocument.body, { childList: true, subtree: true });
735
+ return () => observer.disconnect();
736
+ };
737
+
738
+ const OPPOSITE = {
739
+ bottom: "top",
740
+ left: "right",
741
+ right: "left",
742
+ top: "bottom"
743
+ };
744
+ const resolveOverlaySide = (side, direction) => {
745
+ if (side === "start") {
746
+ return direction === "rtl" ? "right" : "left";
747
+ }
748
+ if (side === "end") {
749
+ return direction === "rtl" ? "left" : "right";
750
+ }
751
+ return side;
752
+ };
753
+ const positionFor = (side, gap, direction) => {
754
+ // The overlay's start and end follow its direction, so a physical side is translated for RTL.
755
+ const left = direction === "rtl" ? "end" : "start";
756
+ const right = direction === "rtl" ? "start" : "end";
757
+ switch (side) {
758
+ case "top":
759
+ return new ConnectionPositionPair({ originX: "center", originY: "top" }, { overlayX: "center", overlayY: "bottom" }, 0, -gap);
760
+ case "bottom":
761
+ return new ConnectionPositionPair({ originX: "center", originY: "bottom" }, { overlayX: "center", overlayY: "top" }, 0, gap);
762
+ case "left":
763
+ return new ConnectionPositionPair({ originX: left, originY: "center" }, { overlayX: right, overlayY: "center" }, -gap, 0);
764
+ case "right":
765
+ return new ConnectionPositionPair({ originX: right, originY: "center" }, { overlayX: left, overlayY: "center" }, gap, 0);
766
+ }
767
+ };
768
+ /**
769
+ * Positions for a popup centered on `side` of its anchor, flipping to the opposite side when it doesn't fit. Each
770
+ * position carries its own offset, so the gap stays between the popup and its anchor after a flip.
771
+ * @param gap the distance between the anchor and the popup, in pixels
772
+ * @param direction the overlay's direction
773
+ */
774
+ const overlaySidePositions = (side, gap, direction) => [positionFor(side, gap, direction), positionFor(OPPOSITE[side], gap, direction)];
775
+ /**
776
+ * The physical side of its anchor a popup ended up on, from the position the overlay chose.
777
+ */
778
+ const sideOfPosition = (position, direction) => {
779
+ if (position.overlayY === "bottom" && position.overlayX === "center") {
780
+ return "top";
781
+ }
782
+ if (position.overlayY === "top" && position.overlayX === "center") {
783
+ return "bottom";
784
+ }
785
+ // A popup to the anchor's right touches it with its left edge: the overlay's start in LTR, its end in RTL.
786
+ const leftEdge = position.overlayX === (direction === "rtl" ? "end" : "start");
787
+ return leftEdge ? "right" : "left";
788
+ };
789
+
354
790
  const restoreOverlayScroll = (overlayRef, element) => {
355
791
  requestAnimationFrame(() => {
356
792
  const scrollableContent = findScrollableElement(overlayRef.overlayElement);
@@ -380,26 +816,6 @@ const findScrollableElement = (container) => {
380
816
  return null;
381
817
  };
382
818
 
383
- const toPixels = (value) => (value != null ? `${value}px` : "");
384
- const setWindowStyles = (element, settings) => {
385
- if (!element) {
386
- return;
387
- }
388
- const classes = typeof settings.windowClass === "string" ? [settings.windowClass] : (settings.windowClass ?? []);
389
- classes
390
- .flatMap(className => (className ?? "").split(/\s+/))
391
- .filter(className => className !== "")
392
- .forEach(className => element.classList.add(className));
393
- const minWidth = toPixels(settings.minWidth);
394
- const minHeight = toPixels(settings.minHeight);
395
- const maxWidth = toPixels(settings.maxWidth);
396
- const maxHeight = toPixels(settings.maxHeight);
397
- const top = settings.top != null ? `${settings.top}px` : `calc(50% - ${element.getBoundingClientRect().height / 2}px)`;
398
- const left = settings.left != null ? `${settings.left}px` : `calc(50% - ${element.getBoundingClientRect().width / 2}px)`;
399
- const position = "absolute";
400
- Object.assign(element.style, { left, maxHeight, maxWidth, minHeight, minWidth, position, top });
401
- };
402
-
403
819
  /**
404
820
  * Converts a number or a string into a CSS-compliant value.
405
821
  * - If the input is a number (e.g., 100), it appends 'px'.
@@ -433,7 +849,7 @@ var NavigationKeys;
433
849
  NavigationKeys["PageUp"] = "PageUp";
434
850
  NavigationKeys["Space"] = " ";
435
851
  })(NavigationKeys || (NavigationKeys = {}));
436
- const NavigationKeysList = Object.keys(NavigationKeys);
852
+ const NavigationKeysList = Object.values(NavigationKeys);
437
853
  const isNavigationKey = (key) => {
438
854
  return NavigationKeysList.includes(key);
439
855
  };
@@ -460,5 +876,5 @@ const setupTypeahead = (typeaheadKey$) => {
460
876
  * Generated bundle index. Do not edit.
461
877
  */
462
878
 
463
- export { AttributeBinderDirective, NavigationKeys, NavigationKeysList, TYPEAHEAD_RESET_DELAY, createElementControlId, focusCanReturn, focusElement, hex2rgba, hsla2hsva, hsva2rgba, injectLabelledByText, isNavigationKey, isTypeaheadKey, isValidHex, isValidHsla, isValidRgb, restoreOverlayScroll, rgba2hex, rgba2hsla, rgba2hsva, rxFromResize, rxTimeout, setWindowStyles, setupTypeahead, string2Hsla, string2rgba, themeControlBackdropClasses, themeControlSurfaceClasses, themeOverlayBackdropClasses, themeOverlaySurfaceClasses, themeRaisedBackdropClasses, themeRaisedSurfaceClasses, toCssValue };
879
+ export { AttributeBinderDirective, HOVER_GRACE, HoverIntent, NavigationKeys, NavigationKeysList, TYPEAHEAD_RESET_DELAY, addAriaReference, createElementControlId, focusCanReturn, focusElement, hex2rgba, hsla2hsva, hsva2rgba, inertOutside, injectLabelledByText, isNavigationKey, isTypeaheadKey, isValidHex, isValidHsla, isValidRgb, listenForHover, onDisconnect, overlaySidePositions, positionGlobalOverlay, removeAriaReference, resolveOverlaySide, restoreOverlayScroll, rgba2hex, rgba2hsla, rgba2hsva, rxFromResize, rxTimeout, setupTypeahead, sideOfPosition, string2Hsla, string2rgba, themeControlBackdropClasses, themeControlSurfaceClasses, themeOverlayBackdropClasses, themeOverlaySurfaceClasses, themeRaisedBackdropClasses, themeRaisedSurfaceClasses, toCssValue };
464
880
  //# sourceMappingURL=nanahoshi-mona-ui-internal.mjs.map
@@ -301,6 +301,7 @@ const AR_SA_MESSAGES = {
301
301
  close: "إغلاق",
302
302
  error: "خطأ",
303
303
  info: "معلومات",
304
+ region: "الإشعارات",
304
305
  success: "نجاح",
305
306
  warning: "تحذير"
306
307
  },
@@ -358,6 +359,7 @@ const AR_SA_MESSAGES = {
358
359
  },
359
360
  splitButton: {
360
361
  menuButtonAriaLabel: "عرض خيارات القائمة",
362
+ menuButtonWithText: (text) => `مزيد من خيارات ${text}`,
361
363
  splitButton: (text) => (text ? `${text}، زر تقسيم` : "زر تقسيم")
362
364
  },
363
365
  splitter: {
@@ -418,6 +420,7 @@ const AR_SA_MESSAGES = {
418
420
  closeWindow: "إغلاق النافذة",
419
421
  maximize: "تكبير",
420
422
  minimize: "تصغير",
423
+ moveOrResizeWindow: "نقل النافذة أو تغيير حجمها. استخدم مفاتيح الأسهم للتحريك، أو Ctrl مع مفاتيح الأسهم لتغيير الحجم.",
421
424
  moveWindow: "نقل النافذة. استخدم مفاتيح الأسهم للتحريك.",
422
425
  resizeBottom: "تغيير حجم النافذة من الأسفل. استخدم مفاتيح الأسهم لتغيير الحجم.",
423
426
  resizeBottomLeft: "تغيير حجم النافذة من الزاوية السفلية اليسرى. استخدم مفاتيح الأسهم لتغيير الحجم.",
@@ -427,6 +430,7 @@ const AR_SA_MESSAGES = {
427
430
  resizeTop: "تغيير حجم النافذة من الأعلى. استخدم مفاتيح الأسهم لتغيير الحجم.",
428
431
  resizeTopLeft: "تغيير حجم النافذة من الزاوية العلوية اليسرى. استخدم مفاتيح الأسهم لتغيير الحجم.",
429
432
  resizeTopRight: "تغيير حجم النافذة من الزاوية العلوية اليمنى. استخدم مفاتيح الأسهم لتغيير الحجم.",
433
+ resizeWindow: "تغيير حجم النافذة. استخدم Ctrl مع مفاتيح الأسهم لتغيير الحجم.",
430
434
  restore: "استعادة"
431
435
  }
432
436
  };
@@ -303,6 +303,7 @@ const DE_DE_MESSAGES = {
303
303
  close: "Schließen",
304
304
  error: "Fehler",
305
305
  info: "Information",
306
+ region: "Benachrichtigungen",
306
307
  success: "Erfolg",
307
308
  warning: "Warnung"
308
309
  },
@@ -362,6 +363,7 @@ const DE_DE_MESSAGES = {
362
363
  },
363
364
  splitButton: {
364
365
  menuButtonAriaLabel: "Menüoptionen anzeigen",
366
+ menuButtonWithText: (text) => `Weitere Optionen für ${text}`,
365
367
  splitButton: (text) => (text ? `${text}, geteilte Schaltfläche` : "Geteilte Schaltfläche")
366
368
  },
367
369
  splitter: {
@@ -422,6 +424,7 @@ const DE_DE_MESSAGES = {
422
424
  closeWindow: "Fenster schließen",
423
425
  maximize: "Maximieren",
424
426
  minimize: "Minimieren",
427
+ moveOrResizeWindow: "Fenster verschieben oder Größe ändern. Pfeiltasten zum Verschieben, Strg und Pfeiltasten zum Ändern der Größe verwenden.",
425
428
  moveWindow: "Fenster verschieben. Pfeiltasten zum Verschieben verwenden.",
426
429
  resizeBottom: "Fenster von unten in der Größe ändern. Pfeiltasten zum Ändern der Größe verwenden.",
427
430
  resizeBottomLeft: "Fenster von der unteren linken Ecke in der Größe ändern. Pfeiltasten zum Ändern der Größe verwenden.",
@@ -431,6 +434,7 @@ const DE_DE_MESSAGES = {
431
434
  resizeTop: "Fenster von oben in der Größe ändern. Pfeiltasten zum Ändern der Größe verwenden.",
432
435
  resizeTopLeft: "Fenster von der oberen linken Ecke in der Größe ändern. Pfeiltasten zum Ändern der Größe verwenden.",
433
436
  resizeTopRight: "Fenster von der oberen rechten Ecke in der Größe ändern. Pfeiltasten zum Ändern der Größe verwenden.",
437
+ resizeWindow: "Fenstergröße ändern. Strg und Pfeiltasten zum Ändern der Größe verwenden.",
434
438
  restore: "Wiederherstellen"
435
439
  }
436
440
  };
@@ -303,6 +303,7 @@ const ES_ES_MESSAGES = {
303
303
  close: "Cerrar",
304
304
  error: "Error",
305
305
  info: "Información",
306
+ region: "Notificaciones",
306
307
  success: "Éxito",
307
308
  warning: "Advertencia"
308
309
  },
@@ -362,6 +363,7 @@ const ES_ES_MESSAGES = {
362
363
  },
363
364
  splitButton: {
364
365
  menuButtonAriaLabel: "Mostrar opciones de menú",
366
+ menuButtonWithText: (text) => `Más opciones de ${text}`,
365
367
  splitButton: (text) => (text ? `${text}, botón dividido` : "Botón dividido")
366
368
  },
367
369
  splitter: {
@@ -422,6 +424,7 @@ const ES_ES_MESSAGES = {
422
424
  closeWindow: "Cerrar ventana",
423
425
  maximize: "Maximizar",
424
426
  minimize: "Minimizar",
427
+ moveOrResizeWindow: "Mover o cambiar el tamaño de la ventana. Usa las teclas de flecha para mover, o Ctrl y las teclas de flecha para cambiar el tamaño.",
425
428
  moveWindow: "Mover ventana. Usa las teclas de flecha para mover.",
426
429
  resizeBottom: "Cambiar tamaño de ventana desde abajo. Usa las teclas de flecha para cambiar el tamaño.",
427
430
  resizeBottomLeft: "Cambiar tamaño de ventana desde la esquina inferior izquierda. Usa las teclas de flecha para cambiar el tamaño.",
@@ -431,6 +434,7 @@ const ES_ES_MESSAGES = {
431
434
  resizeTop: "Cambiar tamaño de ventana desde arriba. Usa las teclas de flecha para cambiar el tamaño.",
432
435
  resizeTopLeft: "Cambiar tamaño de ventana desde la esquina superior izquierda. Usa las teclas de flecha para cambiar el tamaño.",
433
436
  resizeTopRight: "Cambiar tamaño de ventana desde la esquina superior derecha. Usa las teclas de flecha para cambiar el tamaño.",
437
+ resizeWindow: "Cambiar el tamaño de la ventana. Usa Ctrl y las teclas de flecha para cambiar el tamaño.",
434
438
  restore: "Restaurar"
435
439
  }
436
440
  };
@@ -307,6 +307,7 @@ const FR_FR_MESSAGES = {
307
307
  close: "Fermer",
308
308
  error: "Erreur",
309
309
  info: "Information",
310
+ region: "Notifications",
310
311
  success: "Succès",
311
312
  warning: "Avertissement"
312
313
  },
@@ -366,6 +367,7 @@ const FR_FR_MESSAGES = {
366
367
  },
367
368
  splitButton: {
368
369
  menuButtonAriaLabel: "Afficher les options du menu",
370
+ menuButtonWithText: (text) => `Autres options pour ${text}`,
369
371
  splitButton: (text) => (text ? `${text}, bouton fractionné` : "Bouton fractionné")
370
372
  },
371
373
  splitter: {
@@ -429,6 +431,7 @@ const FR_FR_MESSAGES = {
429
431
  closeWindow: "Fermer la fenêtre",
430
432
  maximize: "Agrandir",
431
433
  minimize: "Réduire",
434
+ moveOrResizeWindow: "Déplacer ou redimensionner la fenêtre. Utilisez les touches fléchées pour la déplacer, ou Ctrl et les touches fléchées pour la redimensionner.",
432
435
  moveWindow: "Déplacer la fenêtre. Utilisez les touches fléchées pour la déplacer.",
433
436
  resizeBottom: "Redimensionner la fenêtre depuis le bas. Utilisez les touches fléchées pour redimensionner.",
434
437
  resizeBottomLeft: "Redimensionner la fenêtre depuis le coin inférieur gauche. Utilisez les touches fléchées pour redimensionner.",
@@ -438,6 +441,7 @@ const FR_FR_MESSAGES = {
438
441
  resizeTop: "Redimensionner la fenêtre depuis le haut. Utilisez les touches fléchées pour redimensionner.",
439
442
  resizeTopLeft: "Redimensionner la fenêtre depuis le coin supérieur gauche. Utilisez les touches fléchées pour redimensionner.",
440
443
  resizeTopRight: "Redimensionner la fenêtre depuis le coin supérieur droit. Utilisez les touches fléchées pour redimensionner.",
444
+ resizeWindow: "Redimensionner la fenêtre. Utilisez Ctrl et les touches fléchées pour la redimensionner.",
441
445
  restore: "Restaurer"
442
446
  }
443
447
  };
@@ -297,6 +297,7 @@ const ID_ID_MESSAGES = {
297
297
  close: "Tutup",
298
298
  error: "Kesalahan",
299
299
  info: "Informasi",
300
+ region: "Notifikasi",
300
301
  success: "Berhasil",
301
302
  warning: "Peringatan"
302
303
  },
@@ -354,6 +355,7 @@ const ID_ID_MESSAGES = {
354
355
  },
355
356
  splitButton: {
356
357
  menuButtonAriaLabel: "Tampilkan opsi menu",
358
+ menuButtonWithText: (text) => `Opsi ${text} lainnya`,
357
359
  splitButton: (text) => (text ? `${text}, tombol pisah` : "Tombol pisah")
358
360
  },
359
361
  splitter: {
@@ -414,6 +416,7 @@ const ID_ID_MESSAGES = {
414
416
  closeWindow: "Tutup jendela",
415
417
  maximize: "Maksimalkan",
416
418
  minimize: "Minimalkan",
419
+ moveOrResizeWindow: "Pindahkan atau ubah ukuran jendela. Gunakan tombol panah untuk memindahkan, atau Ctrl dan tombol panah untuk mengubah ukuran.",
417
420
  moveWindow: "Pindahkan jendela. Gunakan tombol panah untuk memindahkan.",
418
421
  resizeBottom: "Ubah ukuran jendela dari tepi bawah. Gunakan tombol panah untuk mengubah ukuran.",
419
422
  resizeBottomLeft: "Ubah ukuran jendela dari sudut kiri bawah. Gunakan tombol panah untuk mengubah ukuran.",
@@ -423,6 +426,7 @@ const ID_ID_MESSAGES = {
423
426
  resizeTop: "Ubah ukuran jendela dari tepi atas. Gunakan tombol panah untuk mengubah ukuran.",
424
427
  resizeTopLeft: "Ubah ukuran jendela dari sudut kiri atas. Gunakan tombol panah untuk mengubah ukuran.",
425
428
  resizeTopRight: "Ubah ukuran jendela dari sudut kanan atas. Gunakan tombol panah untuk mengubah ukuran.",
429
+ resizeWindow: "Ubah ukuran jendela. Gunakan Ctrl dan tombol panah untuk mengubah ukuran.",
426
430
  restore: "Pulihkan"
427
431
  }
428
432
  };