@nanahoshi/mona-ui 0.50.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.
- package/docs/api/index.json +1 -1
- package/docs/api/theme.json +1 -1
- package/docs/api/theme.md +6 -3
- package/docs/manifest.json +1 -1
- package/docs/theming-custom-themes.md +32 -10
- package/docs/theming.md +13 -13
- package/fesm2022/nanahoshi-mona-ui-command.mjs +3 -4
- package/fesm2022/nanahoshi-mona-ui-dialog.mjs +3 -4
- package/fesm2022/nanahoshi-mona-ui-dropdowns.mjs +2 -3
- package/fesm2022/nanahoshi-mona-ui-internal.mjs +10 -1
- package/fesm2022/nanahoshi-mona-ui-sheet.mjs +2 -3
- package/fesm2022/nanahoshi-mona-ui-spinner.mjs +2 -1
- package/fesm2022/nanahoshi-mona-ui-theme.mjs +12 -0
- package/fesm2022/nanahoshi-mona-ui-window.mjs +3 -4
- package/package.json +1 -1
- package/types/nanahoshi-mona-ui-internal.d.ts +10 -0
- package/types/nanahoshi-mona-ui-theme.d.ts +21 -1
|
@@ -66,15 +66,15 @@ Register themes in the application's root providers. The theme service writes on
|
|
|
66
66
|
|
|
67
67
|
Each variant is a complete `ThemeProfile`, with these sections:
|
|
68
68
|
|
|
69
|
-
| Section | Tokens
|
|
70
|
-
| ------------ |
|
|
71
|
-
| `colors` | Every `--color-*` token that Mona Light defines
|
|
72
|
-
| `shadows` | `--shadow-control`, `--shadow-raised`, `--shadow-overlay`
|
|
73
|
-
| `shape` | `--radius-sm`, `--radius-md`, `--radius-lg`
|
|
74
|
-
| `motion` | `--mona-motion-fast`, `--mona-motion-standard`
|
|
75
|
-
| `effects` | `--mona-effect-*`, for the `control`, `raised` and `
|
|
76
|
-
| `components` | Tokens for single components, such as `--mona-menubar-background`
|
|
77
|
-
| `custom` | Optional. Any other variables
|
|
69
|
+
| Section | Tokens | What they control |
|
|
70
|
+
| ------------ | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
|
|
71
|
+
| `colors` | Every `--color-*` token that Mona Light defines | Backgrounds, text, borders, states and charts. See [Color Roles](theming-custom-colors.md#color-roles). |
|
|
72
|
+
| `shadows` | `--shadow-control`, `--shadow-raised`, `--shadow-overlay` | How far controls, raised panels and overlays stand off the page. |
|
|
73
|
+
| `shape` | `--radius-sm`, `--radius-md`, `--radius-lg` | Corner radii. |
|
|
74
|
+
| `motion` | `--mona-motion-fast`, `--mona-motion-standard` | Animation durations. |
|
|
75
|
+
| `effects` | `--mona-effect-*`, for the `control`, `raised`, `overlay` and `backdrop` materials | Translucent or opaque backgrounds, and the backdrop behind a modal. See [Materials](#materials). |
|
|
76
|
+
| `components` | Tokens for single components, such as `--mona-menubar-background` | Calendar, list, menubar, pager and slider details. |
|
|
77
|
+
| `custom` | Optional. Any other variables | Optional tokens, such as [indicator colors](#indicator-colors), and tokens of your own. |
|
|
78
78
|
|
|
79
79
|
Every token in the first six sections is required, except the two [contrast borders](#contrast-borders). A variant that's missing one throws while the application starts, and the error lists what's missing. The easiest way to get them all is to start from a built-in theme, or to copy one of its variants, such as `monaTheme.variants.light`, and change the values.
|
|
80
80
|
|
|
@@ -82,7 +82,7 @@ A variable in `custom` can't reuse the name of a required token. To add a color
|
|
|
82
82
|
|
|
83
83
|
### Materials
|
|
84
84
|
|
|
85
|
-
The `effects` section defines
|
|
85
|
+
The `effects` section defines four materials: `control` for fields and similar controls, `raised` for elevated panels, `overlay` for menus, popups and dialogs, and `backdrop` for what dims the page behind a modal dialog, window or sheet. Each material has four tokens. Here is Luna Light's overlay:
|
|
86
86
|
|
|
87
87
|
```typescript
|
|
88
88
|
"--mona-effect-overlay-background-color": "rgb(249 249 250 / 0.72)",
|
|
@@ -93,6 +93,28 @@ The `effects` section defines three materials: `control` for fields and similar
|
|
|
93
93
|
|
|
94
94
|
When the browser has no `backdrop-filter`, or the user asks for less transparency, the theme service uses the fallback color and drops the image and the filter. So the fallback has to be opaque, and readable on its own. For an opaque theme, use the same color for both and `none` for the image and the filter, as Mona does: `monaTheme.variants.light.effects` is a good starting point.
|
|
95
95
|
|
|
96
|
+
### The Backdrop
|
|
97
|
+
|
|
98
|
+
The backdrop is the exception: its fallback stays translucent, since it has to show the page it dims. Every built-in theme dims the page with half its background color and blurs it slightly:
|
|
99
|
+
|
|
100
|
+
```typescript
|
|
101
|
+
"--mona-effect-backdrop-background-color": "color-mix(in oklab, var(--color-background) 50%, transparent)",
|
|
102
|
+
"--mona-effect-backdrop-fallback-background-color": "color-mix(in oklab, var(--color-background) 50%, transparent)",
|
|
103
|
+
"--mona-effect-backdrop-background-image": "none",
|
|
104
|
+
"--mona-effect-backdrop-backdrop-filter": "blur(4px)"
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
For a dim without the blur, set `--mona-effect-backdrop-backdrop-filter` to `none`. A spinner's overlay keeps a dim of its own, but takes the backdrop's filter, so it stops blurring too. To change only that in a built-in theme, [override](theming-custom-colors.md#override-specific-tokens) the one token:
|
|
108
|
+
|
|
109
|
+
```typescript
|
|
110
|
+
provideThemeOverrides({
|
|
111
|
+
theme: "mona",
|
|
112
|
+
common: { effects: { "--mona-effect-backdrop-backdrop-filter": "none" } }
|
|
113
|
+
});
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
When the user asks for less transparency, the theme service drops the blur in any case, and the page stays dimmed.
|
|
117
|
+
|
|
96
118
|
### Indicator Colors
|
|
97
119
|
|
|
98
120
|
Where a fill alone shows a value, as in slider ranges, progress bars, switches, radio buttons, tab bars and steps, components draw it with `--mona-indicator-color`, and what sits on the fill with `--mona-indicator-foreground`. Both fall back to the primary color and its foreground.
|
package/docs/theming.md
CHANGED
|
@@ -12,14 +12,14 @@ A theme is a set of design tokens: named values such as `--color-primary` or `--
|
|
|
12
12
|
|
|
13
13
|
A theme defines these kinds of tokens:
|
|
14
14
|
|
|
15
|
-
| Tokens | Examples | What they control
|
|
16
|
-
| ---------------- | ---------------------------------------------- |
|
|
17
|
-
| Colors | `--color-surface`, `--color-primary` | Backgrounds, text, borders and states.
|
|
18
|
-
| Shadows | `--shadow-control`, `--shadow-raised` | How far controls, raised panels and overlays stand off the page.
|
|
19
|
-
| Shape | `--radius-sm`, `--radius-md`, `--radius-lg` | Corner radii.
|
|
20
|
-
| Motion | `--mona-motion-fast`, `--mona-motion-standard` | Animation durations.
|
|
21
|
-
| Materials | `--mona-effect-overlay-backdrop-filter` | Translucent, blurred backgrounds, such as Luna's glass.
|
|
22
|
-
| Component tokens | `--mona-menubar-background` | Details of single components.
|
|
15
|
+
| Tokens | Examples | What they control |
|
|
16
|
+
| ---------------- | ---------------------------------------------- | ----------------------------------------------------------------------------------------------------------- |
|
|
17
|
+
| Colors | `--color-surface`, `--color-primary` | Backgrounds, text, borders and states. |
|
|
18
|
+
| Shadows | `--shadow-control`, `--shadow-raised` | How far controls, raised panels and overlays stand off the page. |
|
|
19
|
+
| Shape | `--radius-sm`, `--radius-md`, `--radius-lg` | Corner radii. |
|
|
20
|
+
| Motion | `--mona-motion-fast`, `--mona-motion-standard` | Animation durations. |
|
|
21
|
+
| Materials | `--mona-effect-overlay-backdrop-filter` | Translucent, blurred backgrounds, such as Luna's glass, and the backdrop that dims the page behind a modal. |
|
|
22
|
+
| Component tokens | `--mona-menubar-background` | Details of single components. |
|
|
23
23
|
|
|
24
24
|
Most themes have a light and a dark variant. The theme and the variant together, such as Mona Dark, decide which tokens are in effect.
|
|
25
25
|
|
|
@@ -214,11 +214,11 @@ In plain CSS, read the variables directly:
|
|
|
214
214
|
|
|
215
215
|
The tokens already change with the variant, so most styles need nothing more. For the rest, the theme service sets these attributes on the root element:
|
|
216
216
|
|
|
217
|
-
| Attribute | Value
|
|
218
|
-
| ------------------------ |
|
|
219
|
-
| `data-mona-theme` | The theme's name, such as `mona`.
|
|
220
|
-
| `data-mona-variant` | `light` or `dark`.
|
|
221
|
-
| `data-mona-transparency` | `full`, or `reduced` when materials are opaque because the browser has no `backdrop-filter` or the user asked for less transparency. |
|
|
217
|
+
| Attribute | Value |
|
|
218
|
+
| ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
219
|
+
| `data-mona-theme` | The theme's name, such as `mona`. |
|
|
220
|
+
| `data-mona-variant` | `light` or `dark`. |
|
|
221
|
+
| `data-mona-transparency` | `full`, or `reduced` when materials are opaque and nothing is blurred, because the browser has no `backdrop-filter` or the user asked for less transparency. |
|
|
222
222
|
|
|
223
223
|
Tailwind's `dark:` variant follows the operating system, not the theme. To make it follow the theme, add this line to your global stylesheet, after the imports:
|
|
224
224
|
|
|
@@ -5,7 +5,7 @@ import { LucideSearch } from "@lucide/angular";
|
|
|
5
5
|
import { MonaI18nService, formatNumber } from "@nanahoshi/mona-ui/i18n";
|
|
6
6
|
import { injectLiveAnnouncer } from "@nanahoshi/mona-ui/internal/live-announcer";
|
|
7
7
|
import { cva } from "class-variance-authority";
|
|
8
|
-
import { createElementControlId, inertOutside, positionGlobalOverlay } from "@nanahoshi/mona-ui/internal";
|
|
8
|
+
import { createElementControlId, inertOutside, positionGlobalOverlay, themeBackdropClassList } from "@nanahoshi/mona-ui/internal";
|
|
9
9
|
import { merge, take } from "rxjs";
|
|
10
10
|
import { ImmutableSet } from "@mirei/ts-collections";
|
|
11
11
|
import { PopupService } from "@nanahoshi/mona-ui/popup";
|
|
@@ -552,10 +552,9 @@ var CommandDialogComponent = class CommandDialogComponent {
|
|
|
552
552
|
backdropClass: [
|
|
553
553
|
"fixed",
|
|
554
554
|
"inset-0",
|
|
555
|
-
|
|
555
|
+
...themeBackdropClassList,
|
|
556
556
|
"transition-opacity",
|
|
557
|
-
"z-40"
|
|
558
|
-
"backdrop-blur-xs"
|
|
557
|
+
"z-40"
|
|
559
558
|
],
|
|
560
559
|
blockScroll: true,
|
|
561
560
|
closeOnBackdropClick: true,
|
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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
|
@@ -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
|
-
|
|
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<{
|