@nanahoshi/mona-ui 0.49.0 → 0.51.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.
@@ -7,7 +7,7 @@ import { AnyPipe, PreventableEvent } from "@nanahoshi/mona-ui/common";
7
7
  import { MonaI18nService, mergeMessages } from "@nanahoshi/mona-ui/i18n";
8
8
  import { cva } from "class-variance-authority";
9
9
  import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
10
- import { createElementControlId, focusElement, inertOutside, positionGlobalOverlay, themeOverlaySurfaceClasses } from "@nanahoshi/mona-ui/internal";
10
+ import { createElementControlId, focusElement, inertOutside, positionGlobalOverlay, themeBackdropClassList, themeOverlaySurfaceClasses } from "@nanahoshi/mona-ui/internal";
11
11
  import { ReplaySubject, Subject, map, merge, take, takeUntil } from "rxjs";
12
12
  import { PopupCloseEvent, PopupCloseSource, PopupDataInjectionToken, PopupService } from "@nanahoshi/mona-ui/popup";
13
13
  import * as i1 from "@angular/cdk/a11y";
@@ -805,10 +805,9 @@ var DialogService = class DialogService {
805
805
  backdropClass: modal ? [
806
806
  "fixed",
807
807
  "inset-0",
808
- "bg-background/50",
808
+ ...themeBackdropClassList,
809
809
  "transition-opacity",
810
- "z-40",
811
- "backdrop-blur-xs"
810
+ "z-40"
812
811
  ] : "transparent",
813
812
  blockScroll: modal,
814
813
  closeOnBackdropClick: false,
@@ -8,7 +8,7 @@ import { MonaI18nService, formatNumber, injectComponentDirection } from "@nanaho
8
8
  import { injectLiveAnnouncer } from "@nanahoshi/mona-ui/internal/live-announcer";
9
9
  import { cva } from "class-variance-authority";
10
10
  import { takeUntilDestroyed, toObservable } from "@angular/core/rxjs-interop";
11
- import { createElementControlId, focusCanReturn, setupTypeahead, themeOverlaySurfaceClasses } from "@nanahoshi/mona-ui/internal";
11
+ import { createElementControlId, focusCanReturn, setupTypeahead, themeBackdropClassList, themeOverlaySurfaceClasses } from "@nanahoshi/mona-ui/internal";
12
12
  import { ListService } from "@nanahoshi/mona-ui/internal/list";
13
13
  import { Subject, filter, fromEvent, merge, switchMap, take, takeUntil } from "rxjs";
14
14
  import { PopupCloseEvent, PopupCloseSource, PopupDataInjectionToken, PopupRef, PopupService, dropdownPopupAnimation, slideFromBottomPopupAnimation } from "@nanahoshi/mona-ui/popup";
@@ -1204,8 +1204,7 @@ var DropdownPopupHandlerDirective = class DropdownPopupHandlerDirective {
1204
1204
  backdropClass: [
1205
1205
  "fixed",
1206
1206
  "inset-0",
1207
- "bg-background/50",
1208
- "backdrop-blur-xs",
1207
+ ...themeBackdropClassList,
1209
1208
  "[transition-duration:240ms]!"
1210
1209
  ],
1211
1210
  blockScroll: true,
@@ -658,6 +658,15 @@ const themeOverlaySurfaceClasses = `
658
658
  [background-color:var(--mona-effect-overlay-background-color,var(--color-surface-overlay))]
659
659
  ${themeOverlayBackdropClasses}
660
660
  `;
661
+ const themeBackdropFilterClasses = `
662
+ [backdrop-filter:var(--mona-effect-backdrop-backdrop-filter,blur(4px))]
663
+ [-webkit-backdrop-filter:var(--mona-effect-backdrop-backdrop-filter,blur(4px))]
664
+ `;
665
+ const themeBackdropClassList = [
666
+ "[background-color:var(--mona-effect-backdrop-background-color,color-mix(in_oklab,var(--color-background)_50%,transparent))]",
667
+ "[background-image:var(--mona-effect-backdrop-background-image,none)]",
668
+ ...themeBackdropFilterClasses.trim().split(/\s+/)
669
+ ];
661
670
  const HOVER_GRACE = 100;
662
671
  var HoverIntent = class {
663
672
  #config;
@@ -960,6 +969,6 @@ const setupTypeahead = (typeaheadKey$) => {
960
969
  })));
961
970
  return merge(keypress$, resetTrigger$).pipe(scan((buffer, action) => action.type === "reset" ? "" : buffer + action.value.toLowerCase(), ""), filter((buffer) => buffer.length > 0));
962
971
  };
963
- export { AttributeBinderDirective, FIELD_ASSOCIATION_BOUNDARY, HOVER_GRACE, HoverIntent, MONA_FIELDSET_DISABLED, MONA_FORM_FIELD, MONA_LABEL, NavigationKeys, RovingToolbar, TYPEAHEAD_RESET_DELAY, addAriaReference, colorKey, createElementControlId, createPageScrollBlockStrategy, focusCanReturn, focusElement, formatAlpha, hex2rgba, hsla2hsva, hsva2rgba, inertOutside, injectEffectiveDisabled, injectLabelAssociation, injectLabelledByText, isNavigationKey, isTypeaheadKey, isValidHex, listenForHover, matchesAccept, navigationKeysList, onDisconnect, overlaySidePositions, parseAccept, parseColor, positionGlobalOverlay, removeAriaReference, resolveOverlaySide, restoreOverlayScroll, rgba2hex, rgba2hsla, rgba2hsva, runUpload, rxFromResize, rxTimeout, setupTypeahead, sideOfPosition, themeControlBackdropClasses, themeControlSurfaceClasses, themeOverlayBackdropClasses, themeOverlaySurfaceClasses, themeRaisedBackdropClasses, themeRaisedSurfaceClasses, themeSelectionBarClasses, themeSelectionBorderClasses, toCssValue, toHeadingLevel };
972
+ export { AttributeBinderDirective, FIELD_ASSOCIATION_BOUNDARY, HOVER_GRACE, HoverIntent, MONA_FIELDSET_DISABLED, MONA_FORM_FIELD, MONA_LABEL, NavigationKeys, RovingToolbar, TYPEAHEAD_RESET_DELAY, addAriaReference, colorKey, createElementControlId, createPageScrollBlockStrategy, focusCanReturn, focusElement, formatAlpha, hex2rgba, hsla2hsva, hsva2rgba, inertOutside, injectEffectiveDisabled, injectLabelAssociation, injectLabelledByText, isNavigationKey, isTypeaheadKey, isValidHex, listenForHover, matchesAccept, navigationKeysList, onDisconnect, overlaySidePositions, parseAccept, parseColor, positionGlobalOverlay, removeAriaReference, resolveOverlaySide, restoreOverlayScroll, rgba2hex, rgba2hsla, rgba2hsva, runUpload, rxFromResize, rxTimeout, setupTypeahead, sideOfPosition, themeBackdropClassList, themeBackdropFilterClasses, themeControlBackdropClasses, themeControlSurfaceClasses, themeOverlayBackdropClasses, themeOverlaySurfaceClasses, themeRaisedBackdropClasses, themeRaisedSurfaceClasses, themeSelectionBarClasses, themeSelectionBorderClasses, toCssValue, toHeadingLevel };
964
973
 
965
974
  //# sourceMappingURL=nanahoshi-mona-ui-internal.mjs.map
@@ -7,7 +7,7 @@ import { MonaI18nService, injectComponentDirection, mergeMessages } from "@nanah
7
7
  import { twMerge } from "tailwind-merge";
8
8
  import { cva } from "class-variance-authority";
9
9
  import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
10
- import { createElementControlId, inertOutside, themeOverlaySurfaceClasses } from "@nanahoshi/mona-ui/internal";
10
+ import { createElementControlId, inertOutside, themeBackdropClassList, themeOverlaySurfaceClasses } from "@nanahoshi/mona-ui/internal";
11
11
  import { merge, take } from "rxjs";
12
12
  import { PopupCloseEvent, PopupCloseSource, PopupService, slideFromBottomPopupAnimation, slideFromLeftPopupAnimation, slideFromRightPopupAnimation, slideFromTopPopupAnimation } from "@nanahoshi/mona-ui/popup";
13
13
  import { CdkTrapFocus } from "@angular/cdk/a11y";
@@ -129,8 +129,7 @@ var SheetComponent = class SheetComponent {
129
129
  backdropClass: [
130
130
  "fixed",
131
131
  "inset-0",
132
- "bg-background/50",
133
- "backdrop-blur-xs",
132
+ ...themeBackdropClassList,
134
133
  "[transition-duration:240ms]!"
135
134
  ],
136
135
  blockScroll: true,
@@ -6,6 +6,7 @@ import { MonaI18nService } from "@nanahoshi/mona-ui/i18n";
6
6
  import { injectLiveAnnouncer } from "@nanahoshi/mona-ui/internal/live-announcer";
7
7
  import { twMerge } from "tailwind-merge";
8
8
  import { cva } from "class-variance-authority";
9
+ import { themeBackdropFilterClasses } from "@nanahoshi/mona-ui/internal";
9
10
  import { Subject, defer, finalize, takeUntil } from "rxjs";
10
11
  import { v4 } from "uuid";
11
12
  const SPINNER_DEFAULT_MESSAGES = {
@@ -191,7 +192,7 @@ i0.ɵɵngDeclareClassMetadata({
191
192
  const spinnerOverlayThemeVariants = cva(`
192
193
  isolate flex items-center justify-center
193
194
  pointer-events-auto select-none
194
- bg-background/60 backdrop-blur-xs
195
+ bg-background/60 ${themeBackdropFilterClasses}
195
196
  text-foreground
196
197
  `, {
197
198
  variants: { fullPage: {
@@ -228,8 +228,17 @@ function normalizeHue(hue) {
228
228
  function clamp(value, minimum, maximum) {
229
229
  return Math.min(Math.max(value, minimum), maximum);
230
230
  }
231
+ function createDefaultBackdropEffects() {
232
+ return Object.freeze({
233
+ "--mona-effect-backdrop-background-color": "color-mix(in oklab, var(--color-background) 50%, transparent)",
234
+ "--mona-effect-backdrop-fallback-background-color": "color-mix(in oklab, var(--color-background) 50%, transparent)",
235
+ "--mona-effect-backdrop-background-image": "none",
236
+ "--mona-effect-backdrop-backdrop-filter": "blur(4px)"
237
+ });
238
+ }
231
239
  function createDefaultThemeEffects() {
232
240
  return Object.freeze({
241
+ ...createDefaultBackdropEffects(),
233
242
  "--mona-effect-control-background-color": "var(--color-input-background)",
234
243
  "--mona-effect-control-fallback-background-color": "var(--color-input-background)",
235
244
  "--mona-effect-control-background-image": "none",
@@ -686,6 +695,7 @@ const lunaTheme = Object.freeze({
686
695
  "--mona-motion-standard": "320ms"
687
696
  }),
688
697
  effects: Object.freeze({
698
+ ...createDefaultBackdropEffects(),
689
699
  "--mona-effect-control-background-color": "rgb(243 244 245 / 0.78)",
690
700
  "--mona-effect-control-fallback-background-color": "#f3f4f5",
691
701
  "--mona-effect-control-background-image": "none",
@@ -733,6 +743,7 @@ const lunaTheme = Object.freeze({
733
743
  "--mona-motion-standard": "320ms"
734
744
  }),
735
745
  effects: Object.freeze({
746
+ ...createDefaultBackdropEffects(),
736
747
  "--mona-effect-control-background-color": "rgb(37 37 39 / 0.74)",
737
748
  "--mona-effect-control-fallback-background-color": "#252527",
738
749
  "--mona-effect-control-background-image": "none",
@@ -1744,6 +1755,7 @@ i0.ɵɵngDeclareClassMetadata({
1744
1755
  });
1745
1756
  const contrastBorders = [["--color-border-control", "--color-border-control-contrast"], ["--color-border-control-hover", "--color-border-control-contrast-hover"]];
1746
1757
  const effectLevels = [
1758
+ "backdrop",
1747
1759
  "control",
1748
1760
  "raised",
1749
1761
  "overlay"
@@ -6,7 +6,7 @@ import { ButtonDirective } from "@nanahoshi/mona-ui/button";
6
6
  import { MonaI18nService, mergeMessages } from "@nanahoshi/mona-ui/i18n";
7
7
  import { cva } from "class-variance-authority";
8
8
  import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
9
- import { createElementControlId, focusElement, inertOutside, positionGlobalOverlay, themeOverlaySurfaceClasses } from "@nanahoshi/mona-ui/internal";
9
+ import { createElementControlId, focusElement, inertOutside, positionGlobalOverlay, themeBackdropClassList, themeOverlaySurfaceClasses } from "@nanahoshi/mona-ui/internal";
10
10
  import { ReplaySubject, Subject, asapScheduler, fromEvent, map, merge, take, takeUntil } from "rxjs";
11
11
  import { PopupCloseEvent, PopupCloseSource, PopupDataInjectionToken, PopupService } from "@nanahoshi/mona-ui/popup";
12
12
  import * as i1 from "@angular/cdk/a11y";
@@ -1417,10 +1417,9 @@ var WindowService = class WindowService {
1417
1417
  backdropClass: modal ? [
1418
1418
  "fixed",
1419
1419
  "inset-0",
1420
- "bg-background/50",
1420
+ ...themeBackdropClassList,
1421
1421
  "transition-opacity",
1422
- "z-40",
1423
- "backdrop-blur-xs"
1422
+ "z-40"
1424
1423
  ] : "transparent",
1425
1424
  blockScroll: modal,
1426
1425
  closeOnBackdropClick: false,
package/package.json CHANGED
@@ -552,5 +552,5 @@
552
552
  "default": "./package.json"
553
553
  }
554
554
  },
555
- "version": "0.49.0"
555
+ "version": "0.51.0"
556
556
  }
@@ -43,12 +43,24 @@ export declare class BreadcrumbItemComponent {
43
43
  "itemClick": "itemClick";
44
44
  }, ["link"], ["*"], true, never>;
45
45
  }
46
- /** An item to render, or with no item, the collapse button. `index` is what the separator after it reports. */
46
+ /**
47
+ * An item, and whether it and the separator after it are folded. Every item and separator stays in the list, folded or
48
+ * not, so the breadcrumb can measure the whole trail.
49
+ */
47
50
  interface BreadcrumbEntry {
51
+ /** Whether the button that stands for the folded items comes before this item: the second of three or more. */
52
+ readonly foldButtonBefore: boolean;
53
+ readonly folded: boolean;
54
+ /** What the separator after the item reports. */
48
55
  readonly index: number;
49
- readonly item: BreadcrumbItemComponent | null;
50
- readonly key: unknown;
56
+ readonly item: BreadcrumbItemComponent;
57
+ readonly separatorFolded: boolean;
51
58
  }
59
+ /**
60
+ * A trail of `mona-breadcrumb-item`s that leads to the current page. When the trail is wider than its box, its middle
61
+ * folds behind a button that shows it again, the items nearest the start first, so the first item and the current page
62
+ * stay readable.
63
+ */
52
64
  export declare class BreadcrumbComponent implements BreadcrumbVariantInput {
53
65
  #private;
54
66
  protected readonly currentItemClass: import("@angular/core").Signal<string>;
@@ -81,7 +93,8 @@ export declare class BreadcrumbComponent implements BreadcrumbVariantInput {
81
93
  readonly lastItemCurrent: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
82
94
  /**
83
95
  * @description The most items to show before the middle of the trail collapses behind a button that shows it again.
84
- * The first and last items always stay, so anything below 2 counts as 2. `null` never collapses.
96
+ * The trail also folds whatever doesn't fit its width, with or without it. The first and last items always stay, so
97
+ * anything below 2 counts as 2. `null` sets no count.
85
98
  * @default null
86
99
  */
87
100
  readonly maxItems: import("@angular/core").InputSignalWithTransform<number | null, unknown>;
@@ -90,6 +103,7 @@ export declare class BreadcrumbComponent implements BreadcrumbVariantInput {
90
103
  * @default ""
91
104
  */
92
105
  readonly userClass: import("@angular/core").InputSignal<string>;
106
+ constructor();
93
107
  /**
94
108
  * Shows the whole trail. The button that was just activated goes away, so focus moves to the first item it revealed.
95
109
  */
@@ -315,6 +315,16 @@ export declare const themeRaisedBackdropClasses = "\n [background-image:var(-
315
315
  export declare const themeRaisedSurfaceClasses = "\n [background-color:var(--mona-effect-raised-background-color,var(--color-surface-raised))]\n \n [background-image:var(--mona-effect-raised-background-image,none)]\n [backdrop-filter:var(--mona-effect-raised-backdrop-filter,none)]\n [-webkit-backdrop-filter:var(--mona-effect-raised-backdrop-filter,none)]\n\n";
316
316
  export declare const themeOverlayBackdropClasses = "\n [background-image:var(--mona-effect-overlay-background-image,none)]\n [backdrop-filter:var(--mona-effect-overlay-backdrop-filter,none)]\n [-webkit-backdrop-filter:var(--mona-effect-overlay-backdrop-filter,none)]\n";
317
317
  export declare const themeOverlaySurfaceClasses = "\n [background-color:var(--mona-effect-overlay-background-color,var(--color-surface-overlay))]\n \n [background-image:var(--mona-effect-overlay-background-image,none)]\n [backdrop-filter:var(--mona-effect-overlay-backdrop-filter,none)]\n [-webkit-backdrop-filter:var(--mona-effect-overlay-backdrop-filter,none)]\n\n";
318
+ /**
319
+ * Blurs what's behind a modal's backdrop or a spinner's overlay, as much as the theme's backdrop asks. The fallback is
320
+ * Mona's, for a page without a theme provider.
321
+ */
322
+ export declare const themeBackdropFilterClasses = "\n [backdrop-filter:var(--mona-effect-backdrop-backdrop-filter,blur(4px))]\n [-webkit-backdrop-filter:var(--mona-effect-backdrop-backdrop-filter,blur(4px))]\n";
323
+ /**
324
+ * The backdrop behind a modal dialog, window or sheet, which dims the page and blurs it if the theme does. As a list,
325
+ * for a popup's `backdropClass`, which takes one class per entry.
326
+ */
327
+ export declare const themeBackdropClassList: readonly string[];
318
328
  /**
319
329
  * How long a popup opened by hovering waits after the pointer leaves its anchor, so the pointer can cross the gap
320
330
  * onto the popup and stay there (WCAG 1.4.13, Content on Hover or Focus).
@@ -29,7 +29,11 @@ type ThemeVariable = `--${string}`;
29
29
  type ThemeVariables = Readonly<Record<ThemeVariable, string>>;
30
30
  type ThemeMotionVariable = "--mona-motion-fast" | "--mona-motion-standard";
31
31
  type ThemeMotion = Readonly<Record<ThemeMotionVariable, string>>;
32
- type ThemeEffectLevel = "control" | "overlay" | "raised";
32
+ /**
33
+ * The materials a theme defines: `control` for fields, `raised` for elevated panels, `overlay` for menus, popups and
34
+ * dialogs, and `backdrop` for what dims the page behind a modal dialog, window or sheet.
35
+ */
36
+ type ThemeEffectLevel = "backdrop" | "control" | "overlay" | "raised";
33
37
  type ThemeEffectVariable = `--mona-effect-${ThemeEffectLevel}-background-color` | `--mona-effect-${ThemeEffectLevel}-fallback-background-color` | `--mona-effect-${ThemeEffectLevel}-background-image` | `--mona-effect-${ThemeEffectLevel}-backdrop-filter`;
34
38
  type ThemeEffects = Readonly<Record<ThemeEffectVariable, string>>;
35
39
  type ThemeShapeVariable = "--radius-sm" | "--radius-md" | "--radius-lg";
@@ -243,6 +247,10 @@ export declare const builtInThemes: Readonly<{
243
247
  "--mona-effect-overlay-fallback-background-color": "#f9f9fa";
244
248
  "--mona-effect-overlay-background-image": "none";
245
249
  "--mona-effect-overlay-backdrop-filter": "blur(28px) saturate(115%)";
250
+ "--mona-effect-backdrop-background-color": string;
251
+ "--mona-effect-backdrop-fallback-background-color": string;
252
+ "--mona-effect-backdrop-background-image": string;
253
+ "--mona-effect-backdrop-backdrop-filter": string;
246
254
  }>;
247
255
  shape: Readonly<Record<ThemeShapeVariable, string>>;
248
256
  custom: Readonly<{
@@ -290,6 +298,10 @@ export declare const builtInThemes: Readonly<{
290
298
  "--mona-effect-overlay-fallback-background-color": "#262628";
291
299
  "--mona-effect-overlay-background-image": "none";
292
300
  "--mona-effect-overlay-backdrop-filter": "blur(28px) saturate(115%)";
301
+ "--mona-effect-backdrop-background-color": string;
302
+ "--mona-effect-backdrop-fallback-background-color": string;
303
+ "--mona-effect-backdrop-background-image": string;
304
+ "--mona-effect-backdrop-backdrop-filter": string;
293
305
  }>;
294
306
  shape: Readonly<Record<ThemeShapeVariable, string>>;
295
307
  custom: Readonly<{
@@ -397,6 +409,10 @@ export declare const lunaTheme: Readonly<{
397
409
  "--mona-effect-overlay-fallback-background-color": "#f9f9fa";
398
410
  "--mona-effect-overlay-background-image": "none";
399
411
  "--mona-effect-overlay-backdrop-filter": "blur(28px) saturate(115%)";
412
+ "--mona-effect-backdrop-background-color": string;
413
+ "--mona-effect-backdrop-fallback-background-color": string;
414
+ "--mona-effect-backdrop-background-image": string;
415
+ "--mona-effect-backdrop-backdrop-filter": string;
400
416
  }>;
401
417
  shape: Readonly<Record<ThemeShapeVariable, string>>;
402
418
  custom: Readonly<{
@@ -444,6 +460,10 @@ export declare const lunaTheme: Readonly<{
444
460
  "--mona-effect-overlay-fallback-background-color": "#262628";
445
461
  "--mona-effect-overlay-background-image": "none";
446
462
  "--mona-effect-overlay-backdrop-filter": "blur(28px) saturate(115%)";
463
+ "--mona-effect-backdrop-background-color": string;
464
+ "--mona-effect-backdrop-fallback-background-color": string;
465
+ "--mona-effect-backdrop-background-image": string;
466
+ "--mona-effect-backdrop-backdrop-filter": string;
447
467
  }>;
448
468
  shape: Readonly<Record<ThemeShapeVariable, string>>;
449
469
  custom: Readonly<{