@processpuzzle/base-app 0.2.1
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/README.md +12 -0
- package/assets/i18n/base_app/de.json +86 -0
- package/assets/i18n/base_app/en.json +86 -0
- package/assets/i18n/base_app/es.json +86 -0
- package/assets/i18n/base_app/fr.json +86 -0
- package/assets/i18n/base_app/hu.json +86 -0
- package/fesm2022/processpuzzle-base-app.mjs +2403 -0
- package/fesm2022/processpuzzle-base-app.mjs.map +1 -0
- package/package.json +47 -0
- package/theme/pp-material-themes.scss +81 -0
- package/types/processpuzzle-base-app.d.ts +1244 -0
- package/types/processpuzzle-base-app.d.ts.map +1 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
@use 'sass:list';
|
|
2
|
+
@use '@angular/material' as mat;
|
|
3
|
+
|
|
4
|
+
////
|
|
5
|
+
/// The four Material themes an `AppDefinition` may name in `theme.materialTheme`, each emitted under a
|
|
6
|
+
/// class so that a *subtree* can wear one — which is what lets the designer's Preview tab render a
|
|
7
|
+
/// previewed application in its own theme while the designer around it keeps its own.
|
|
8
|
+
///
|
|
9
|
+
/// This works because `mat.theme()` emits nothing but `--mat-sys-*` custom properties: a Material theme
|
|
10
|
+
/// is a set of cascading variables, so it can be declared on any element rather than only on `html`.
|
|
11
|
+
/// Angular's own prebuilt themes (`@angular/material/prebuilt-themes/*.css`) cannot be reused for this —
|
|
12
|
+
/// their `html` selector is baked into the shipped CSS — so the palettes are referenced directly here.
|
|
13
|
+
/// The four names and their palette pairs match those prebuilt files, and `MATERIAL_THEMES` in
|
|
14
|
+
/// `app-definition.ts` is the list this has to stay in step with.
|
|
15
|
+
///
|
|
16
|
+
/// `theme-type: color-scheme` is what keeps this to four blocks rather than twelve: it emits every token
|
|
17
|
+
/// as `light-dark(<light>, <dark>)`, and `light-dark()` resolves against the **element's own**
|
|
18
|
+
/// `color-scheme`. So one block per palette serves light, dark and auto, and the three scheme classes at
|
|
19
|
+
/// the bottom are the entire light/dark switch.
|
|
20
|
+
///
|
|
21
|
+
/// ### Registering it
|
|
22
|
+
/// A global stylesheet rather than a component's, because four full token sets are ~32 kB (about 3 kB
|
|
23
|
+
/// gzipped) and Angular's `anyComponentStyle` budget is meant to catch exactly that shape of file. Add it
|
|
24
|
+
/// to the consuming application's `styles` array, next to `pp-colors.css`:
|
|
25
|
+
///
|
|
26
|
+
/// ```jsonc
|
|
27
|
+
/// "styles": [
|
|
28
|
+
/// "libs/js-shared/base-widget-frontend/src/theme/pp-colors.css",
|
|
29
|
+
/// "libs/js-shared/base-app-frontend/src/theme/pp-material-themes.scss",
|
|
30
|
+
/// "src/styles.scss"
|
|
31
|
+
/// ]
|
|
32
|
+
/// ```
|
|
33
|
+
///
|
|
34
|
+
/// Without it, `AppShellComponent` still sets the classes and simply inherits the host application's
|
|
35
|
+
/// theme — a missing registration costs theming, not correctness.
|
|
36
|
+
///
|
|
37
|
+
/// ### Known limitation: CDK overlays
|
|
38
|
+
/// A dialog, menu, tooltip, snackbar or `mat-select` panel renders into `.cdk-overlay-container`, a child
|
|
39
|
+
/// of `<body>` and therefore outside the themed subtree, so it keeps the host application's theme. This
|
|
40
|
+
/// does not arise in a standalone deployment, where the application's theme is the document's; in the
|
|
41
|
+
/// Preview tab an overlay opened from inside the preview will look like the designer. Closing that needs
|
|
42
|
+
/// a per-panel class or a scoped `OverlayContainer`, neither of which belongs in a stylesheet.
|
|
43
|
+
////
|
|
44
|
+
|
|
45
|
+
$pp-material-themes: (
|
|
46
|
+
azure-blue: (mat.$azure-palette, mat.$blue-palette),
|
|
47
|
+
rose-red: (mat.$rose-palette, mat.$red-palette),
|
|
48
|
+
magenta-violet: (mat.$magenta-palette, mat.$violet-palette),
|
|
49
|
+
cyan-orange: (mat.$cyan-palette, mat.$orange-palette),
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
@each $name, $palettes in $pp-material-themes {
|
|
53
|
+
.pp-theme-#{$name} {
|
|
54
|
+
@include mat.theme(
|
|
55
|
+
(
|
|
56
|
+
color: (
|
|
57
|
+
theme-type: color-scheme,
|
|
58
|
+
primary: list.nth($palettes, 1),
|
|
59
|
+
tertiary: list.nth($palettes, 2),
|
|
60
|
+
),
|
|
61
|
+
typography: Roboto,
|
|
62
|
+
density: 0,
|
|
63
|
+
)
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// Which half of every light-dark() above is used. Also the real CSS `color-scheme`, so that native
|
|
69
|
+
// widgets — scrollbars, date and colour pickers, form controls — match the previewed application rather
|
|
70
|
+
// than the page hosting it.
|
|
71
|
+
.pp-scheme-light {
|
|
72
|
+
color-scheme: light;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.pp-scheme-dark {
|
|
76
|
+
color-scheme: dark;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.pp-scheme-auto {
|
|
80
|
+
color-scheme: light dark;
|
|
81
|
+
}
|