@juice-js/layout 2.5.0-alpha.4 → 3.0.0-alpha.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.
@@ -1,218 +0,0 @@
1
- // The Juice palettes, as Material 3 tonal palettes. Primary, secondary, tertiary and error come from
2
- // 'ng generate @angular/material:theme-color'; the neutrals are the slate and zinc grey scales interpolated in CIELAB
3
- // at each M3 tone, because the generator keeps too much of a grey seed's chroma (a slate seed gives blue surfaces).
4
- @use 'sass:map';
5
-
6
- @function _palette($tones, $neutral) {
7
- $rest: (secondary: map.get($tones, secondary), neutral: $neutral, neutral-variant: $neutral, error: map.get($tones, error));
8
- @return (
9
- primary: map.merge(map.get($tones, primary), $rest),
10
- tertiary: map.merge(map.get($tones, tertiary), $rest),
11
- );
12
- }
13
-
14
- /// Slate greys and the Juice teal (#0f766e).
15
- $teal: _palette((
16
- primary: (
17
- 0: #000000,
18
- 10: #00201d,
19
- 20: #003733,
20
- 25: #00433e,
21
- 30: #00504a,
22
- 35: #005d56,
23
- 40: #006a63,
24
- 50: #27847c,
25
- 60: #479e96,
26
- 70: #64bab0,
27
- 80: #80d5cb,
28
- 90: #9cf2e8,
29
- 95: #b2fff5,
30
- 98: #e4fffa,
31
- 99: #f2fffc,
32
- 100: #ffffff,
33
- ),
34
- secondary: (
35
- 0: #000000,
36
- 10: #00201d,
37
- 20: #173532,
38
- 25: #22413d,
39
- 30: #2e4c48,
40
- 35: #3a5854,
41
- 40: #466460,
42
- 50: #5e7d79,
43
- 60: #779792,
44
- 70: #91b2ad,
45
- 80: #accdc8,
46
- 90: #c8e9e4,
47
- 95: #d6f8f2,
48
- 98: #e4fffa,
49
- 99: #f2fffc,
50
- 100: #ffffff,
51
- ),
52
- tertiary: (
53
- 0: #000000,
54
- 10: #250e46,
55
- 20: #3a255c,
56
- 25: #463068,
57
- 30: #523c74,
58
- 35: #5e4781,
59
- 40: #6a538e,
60
- 50: #846ca8,
61
- 60: #9e85c4,
62
- 70: #b9a0e0,
63
- 80: #d5bbfd,
64
- 90: #ecdcff,
65
- 95: #f7edff,
66
- 98: #fef7ff,
67
- 99: #fffbff,
68
- 100: #ffffff,
69
- ),
70
- error: (
71
- 0: #000000,
72
- 10: #40000d,
73
- 20: #67001b,
74
- 25: #7c0022,
75
- 30: #920029,
76
- 35: #a80031,
77
- 40: #bb0f3a,
78
- 50: #df3151,
79
- 60: #ff516a,
80
- 70: #ff8791,
81
- 80: #ffb2b7,
82
- 90: #ffdadb,
83
- 95: #ffedec,
84
- 98: #fff8f7,
85
- 99: #fffbff,
86
- 100: #ffffff,
87
- ),
88
- ), (
89
- 0: #000000,
90
- 4: #080d1d,
91
- 6: #0d1324,
92
- 10: #131b2e,
93
- 12: #161f32,
94
- 17: #1f2a3c,
95
- 20: #253144,
96
- 22: #293548,
97
- 24: #2d3a4d,
98
- 25: #2f3c50,
99
- 30: #3a485c,
100
- 35: #455367,
101
- 40: #515f74,
102
- 50: #68788f,
103
- 60: #8392a8,
104
- 70: #9eacc0,
105
- 80: #bcc8d6,
106
- 87: #d2dbe6,
107
- 90: #dce3ec,
108
- 92: #e3e9f0,
109
- 94: #e9eef4,
110
- 95: #edf1f6,
111
- 96: #f0f4f8,
112
- 98: #f7fafc,
113
- 99: #fbfcfd,
114
- 100: #ffffff,
115
- ));
116
-
117
- /// Zinc greys and indigo (#4f46e5).
118
- $indigo: _palette((
119
- primary: (
120
- 0: #000000,
121
- 10: #0f0069,
122
- 20: #1d00a5,
123
- 25: #2606c2,
124
- 30: #3323cc,
125
- 35: #4034d7,
126
- 40: #4d44e3,
127
- 50: #6760fd,
128
- 60: #8582ff,
129
- 70: #a4a1ff,
130
- 80: #c3c0ff,
131
- 90: #e2dfff,
132
- 95: #f2efff,
133
- 98: #fcf8ff,
134
- 99: #fffbff,
135
- 100: #ffffff,
136
- ),
137
- secondary: (
138
- 0: #000000,
139
- 10: #140f54,
140
- 20: #2a276a,
141
- 25: #353375,
142
- 30: #413f82,
143
- 35: #4c4b8e,
144
- 40: #58579b,
145
- 50: #7170b6,
146
- 60: #8b89d2,
147
- 70: #a6a4ee,
148
- 80: #c3c0ff,
149
- 90: #e2dfff,
150
- 95: #f2efff,
151
- 98: #fcf8ff,
152
- 99: #fffbff,
153
- 100: #ffffff,
154
- ),
155
- tertiary: (
156
- 0: #000000,
157
- 10: #37003b,
158
- 20: #5a005f,
159
- 25: #6c0073,
160
- 30: #7f0087,
161
- 35: #8f1297,
162
- 40: #9e25a4,
163
- 50: #bb43bf,
164
- 60: #d95fdc,
165
- 70: #f87af9,
166
- 80: #ffa9fa,
167
- 90: #ffd6f8,
168
- 95: #ffebf9,
169
- 98: #fff7fa,
170
- 99: #fffbff,
171
- 100: #ffffff,
172
- ),
173
- error: (
174
- 0: #000000,
175
- 10: #40000d,
176
- 20: #67001b,
177
- 25: #7c0022,
178
- 30: #920029,
179
- 35: #a80031,
180
- 40: #bb0f3a,
181
- 50: #df3151,
182
- 60: #ff516a,
183
- 70: #ff8791,
184
- 80: #ffb2b7,
185
- 90: #ffdadb,
186
- 95: #ffedec,
187
- 98: #fff8f7,
188
- 99: #fffbff,
189
- 100: #ffffff,
190
- ),
191
- ), (
192
- 0: #000000,
193
- 4: #0e0e10,
194
- 6: #131316,
195
- 10: #1b1b1e,
196
- 12: #1f1f22,
197
- 17: #2a2a2d,
198
- 20: #303034,
199
- 22: #343439,
200
- 24: #39393f,
201
- 25: #3b3b41,
202
- 30: #46464e,
203
- 35: #52525b,
204
- 40: #5e5e67,
205
- 50: #76767f,
206
- 60: #909099,
207
- 70: #aaaab3,
208
- 80: #c6c6cb,
209
- 87: #dadadd,
210
- 90: #e2e2e5,
211
- 92: #e8e8ea,
212
- 94: #eeeeef,
213
- 95: #f0f0f2,
214
- 96: #f3f3f4,
215
- 98: #f9f9f9,
216
- 99: #fcfcfc,
217
- 100: #ffffff,
218
- ));
@@ -1,273 +0,0 @@
1
- // juice-layout's styles. Material 3 apps include theme() once: Material, the layout's own components, the palettes
2
- // the viewer can switch between (LayoutService.setPalette), and the shared --juice-* tokens that the Juice pages
3
- // (audit, observability, notifications…) read, so the whole app follows one palette, light and dark.
4
- //
5
- // @use '@juice-js/layout' as layout;
6
- // @include layout.theme(); // teal (default) and indigo
7
- // @include layout.theme((default: indigo, density: -1));
8
- // @include layout.theme((palettes: (brand: $my-m3-palettes))); // more palettes, beside the built-in ones
9
- //
10
- // layout-component-themes() and layout-component-colors() are the Material 2 mixins of 1.x, kept for apps that have
11
- // not moved to Material 3 yet; they get no palettes and no --juice-* tokens.
12
- @forward 'palettes' show $teal, $indigo;
13
- @use 'palettes';
14
- @use '@angular/material' as mat;
15
- @use 'sass:map';
16
- @use 'sass:meta';
17
-
18
- // ─── Material 3 ───
19
-
20
- /// The built-in palettes, by the name data-juice-palette and LayoutConfig.palettes use.
21
- $palettes: ('teal': palettes.$teal, 'indigo': palettes.$indigo);
22
-
23
- /// Material 3 theme, layout components and palettes.
24
- /// @param $options
25
- /// default: the palette before the viewer picks one ('teal')
26
- /// palettes: more palettes, name → (primary: <M3 palette>, tertiary: <M3 palette>), e.g. from
27
- /// 'ng generate @angular/material:theme-color'; a built-in name replaces that palette
28
- /// typography: mat.theme typography (Roboto)
29
- /// density: mat.theme density, 0 to -5 (0)
30
- @mixin theme($options: ()) {
31
- $o: map.merge((default: 'teal', palettes: (), typography: Roboto, density: 0), $options);
32
- $all: map.merge($palettes, map.get($o, palettes));
33
- $default: '' + map.get($o, default);
34
- @if not map.has-key($all, $default) {
35
- @error "Unknown juice-layout palette '#{$default}': use one of #{map.keys($all)}.";
36
- }
37
-
38
- html {
39
- color-scheme: light;
40
- @include mat.theme((
41
- color: _color(map.get($all, $default)),
42
- typography: map.get($o, typography),
43
- density: map.get($o, density),
44
- ));
45
- @include tokens();
46
- }
47
- // LayoutService (the dark mode switch) puts .dark on body; the theme's colours are light-dark() pairs.
48
- .dark { color-scheme: dark; }
49
- @each $name, $palette in $all {
50
- [data-juice-palette='#{$name}'] {
51
- @include mat.theme((color: _color($palette)));
52
- @include tokens();
53
- }
54
- }
55
- body {
56
- background: var(--mat-sys-surface);
57
- color: var(--mat-sys-on-surface);
58
- }
59
- @include scale();
60
- @include components();
61
- }
62
-
63
- /// The Juice Consoles' type and radius scale (--jc-font-*, --jc-radius-*), which the shared page header and the Consoles' pages read. Under
64
- /// a zero-specificity :where(:root), so an app's own values win whatever the order. theme() includes it.
65
- @mixin scale() {
66
- :where(:root) {
67
- --jc-font-xs: 11px; --jc-font-sm: 12px; --jc-font-md: 13px; --jc-font-lg: 14px; --jc-font-xl: 16px; --jc-font-2xl: 20px; --jc-font-fig: 24px;
68
- --jc-radius-sm: 4px; --jc-radius: 8px; --jc-radius-pill: 999px;
69
- }
70
- }
71
-
72
- @function _color($palette) {
73
- @return (primary: map.get($palette, primary), tertiary: map.get($palette, tertiary), theme-type: color-scheme);
74
- }
75
-
76
- /// The shared tokens of the Juice pages, from Material 3's system colours: include it where those are defined.
77
- /// Status tones have no M3 role except error, so ok, warn and info are fixed light/dark pairs.
78
- @mixin tokens() {
79
- --juice-bg: var(--mat-sys-surface);
80
- --juice-surface: light-dark(var(--mat-sys-surface-container-lowest), var(--mat-sys-surface-container));
81
- --juice-border: var(--mat-sys-surface-container-highest);
82
- --juice-text: var(--mat-sys-on-surface);
83
- --juice-muted: var(--mat-sys-on-surface-variant);
84
- --juice-accent: var(--mat-sys-primary);
85
- --juice-on-accent: var(--mat-sys-on-primary);
86
- // The keyboard focus ring: primary is tone 40 in light and 80 in dark, well over 3:1 on the surfaces either way.
87
- --juice-focus: var(--mat-sys-primary);
88
- --juice-select: #{_tint(var(--juice-accent))};
89
- --juice-ok: light-dark(#047857, #34d399);
90
- --juice-warn: light-dark(#b45309, #fbbf24);
91
- --juice-bad: var(--mat-sys-error);
92
- --juice-info: light-dark(#0369a1, #38bdf8);
93
- --juice-none: var(--juice-muted);
94
- @each $tone in (ok, warn, bad, info, none) {
95
- --juice-#{$tone}-bg: #{_tint(var(--juice-#{$tone}))};
96
- }
97
- }
98
-
99
- // A tone on the surface: 14% in light, 22% in dark.
100
- @function _tint($color) {
101
- @return light-dark(color-mix(in srgb, #{$color} 14%, var(--juice-surface)),
102
- color-mix(in srgb, #{$color} 22%, var(--juice-surface)));
103
- }
104
-
105
- /// The layout's components in Material 3's system colours (theme() includes it).
106
- @mixin components() {
107
- html { scroll-behavior: smooth; }
108
- html, body, app-root, app-page, app-page > .container { height: 100%; margin: 0; display: block; }
109
- .p-4 { padding: 1rem !important; }
110
-
111
- // Touch targets of at least 40px on a phone: the shell's own toolbar (its icon buttons, and any select or chip an app
112
- // puts in it), never the pages' content.
113
- @media (max-width: 599.98px) {
114
- app-page > .container > .mat-toolbar {
115
- .mat-mdc-icon-button.mat-mdc-button-base { width: 40px; height: 40px; padding: 8px; }
116
- .mat-mdc-form-field-infix { min-height: 40px; }
117
- .mat-mdc-chip.mat-mdc-standard-chip { min-height: 40px; }
118
- }
119
- }
120
-
121
- // A visible keyboard focus ring on the shell's own controls (Material draws only a faint state layer, with `outline: none`):
122
- // the toolbar's buttons and links, the menu's entries and the skip link. Inside the menu it is drawn inward, where the
123
- // scrolling list would clip it. Pages draw their own.
124
- app-page > .container > .mat-toolbar :focus-visible,
125
- app-page > .container > .skip-link:focus-visible {
126
- outline: 2px solid var(--juice-focus, currentcolor);
127
- outline-offset: 2px;
128
- }
129
- app-page .mat-sidenav :focus-visible {
130
- outline: 2px solid var(--juice-focus, currentcolor);
131
- outline-offset: -2px;
132
- }
133
-
134
- ::-webkit-scrollbar { width: 10px; height: 10px; }
135
- ::-webkit-scrollbar-thumb { background: var(--mat-sys-outline-variant); border-radius: 10px; }
136
- ::-webkit-scrollbar-track { background: transparent; }
137
-
138
- .mat-sidenav {
139
- .mat-expansion-panel-body .mat-mdc-list-item-title { font-size: 0.9rem; }
140
- @include mat.list-density(-2);
141
- .mdc-list-item--with-leading-icon {
142
- .mdc-list-item__start { color: var(--mat-sys-on-surface-variant); }
143
- &:hover {
144
- .mdc-list-item__start, .mdc-list-item__primary-text { color: var(--mat-sys-primary); }
145
- }
146
- &.active {
147
- background-color: var(--mat-sys-secondary-container);
148
- .mdc-list-item__start, .mdc-list-item__primary-text { color: var(--mat-sys-on-secondary-container); }
149
- }
150
- }
151
- }
152
-
153
- // Material only colours .mat-mdc-menu-item; other content in a panel (headers, notification items) inherits from
154
- // the overlay container.
155
- .mat-mdc-menu-panel { color: var(--mat-sys-on-surface); }
156
- }
157
-
158
- // ─── Material 2 (1.x) ───
159
-
160
-
161
- @mixin layout-component-themes($theme) {
162
- .mat-sidenav {
163
- .mat-expansion-panel-body{
164
- .mat-mdc-list-item-title{
165
- font-size: 0.9rem;
166
- }
167
- }
168
- @include mat.list-density(-2);
169
- }
170
-
171
- html {
172
- scroll-behavior: smooth;
173
- }
174
-
175
- html, body, app-root, app-page, app-page>.container{
176
- height: 100%;
177
- margin: 0;
178
- display: block;
179
- }
180
-
181
- .p-4 {
182
- padding: 1rem !important;
183
- }
184
-
185
- @include layout-component-colors($theme);
186
- }
187
- @mixin layout-component-colors($theme) {
188
- $color-config: mat.m2-get-color-config($theme);
189
- $primary-palette: map.get($color-config, 'primary');
190
- $background-palette: map.get($color-config, 'background');
191
- $accent-palette: map.get($color-config, 'accent');
192
- $is-dark-theme: map.get($theme, is-dark);
193
-
194
- $primary: map.get($primary-palette, 500);
195
- $powderPrimary: map.get($primary-palette, 200);
196
- $lightPrimary: map.get($primary-palette, A100);
197
- $darkPrimary: map.get($primary-palette, 800);
198
-
199
- $gray-palette: mat.m2-define-palette(mat.$m2-gray-palette);
200
-
201
- $black: #0A1014;
202
- $superlightgray: map.get($gray-palette, 50);
203
- $lightgray: map.get($gray-palette, 200);
204
- $darkgray: map.get($gray-palette, 700);
205
- $deepgray: map.get($gray-palette, 900);
206
-
207
- /** Scrollbar */
208
- /* width */
209
- ::-webkit-scrollbar {
210
- width: 10px;
211
- height: 10px;
212
- }
213
- ::-webkit-scrollbar-thumb {
214
- background: map.get($accent-palette, 300);
215
- border-radius: 10px;
216
- }
217
- /* Track */
218
- ::-webkit-scrollbar-track {
219
- box-shadow: inset 0 0 5px grey;
220
- border-radius: 10px;
221
- }
222
- /** Scrollbar */
223
-
224
- /** Sidenav */
225
- .mat-sidenav {
226
- .mdc-list-item--with-leading-icon{
227
- .mdc-list-item__start{
228
- color: map.get($accent-palette, 400);
229
- }
230
- &:hover{
231
- .mdc-list-item__start{
232
- color: map.get($accent-palette, 600);
233
- }
234
- .mdc-list-item__primary-text{
235
- color: if(sass($is-dark-theme): $powderPrimary; else: $primary);
236
- text-shadow: 0 0 5px if(sass($is-dark-theme): $black; else: white);
237
- }
238
- &.active {
239
- .mdc-list-item__primary-text{
240
- color: if(sass($is-dark-theme): $powderPrimary; else: $darkPrimary);
241
- }
242
- }
243
- }
244
- &.active{
245
- background-color: if(sass($is-dark-theme): $darkgray; else: $lightgray);
246
-
247
- .mdc-list-item__primary-text{
248
- color: if(sass($is-dark-theme): $lightPrimary; else: $darkPrimary);
249
- }
250
- }
251
- }
252
- }
253
- /** Sidenav */
254
-
255
- /** Menu panel */
256
- // Material only colours .mat-mdc-menu-item; any other content in a panel
257
- // (headers, lists, notification items) inherits from the overlay container,
258
- // which has no theme colour — black text on the dark-theme panel.
259
- $foreground-palette: map.get($color-config, 'foreground');
260
- .mat-mdc-menu-panel {
261
- color: var(--mat-menu-item-label-text-color, #{map.get($foreground-palette, text)});
262
- }
263
- /** Menu panel */
264
-
265
- /** Page switcher */
266
- juice-page-switcher {
267
- --jps-text: #{map.get($foreground-palette, text)};
268
- --jps-muted: #{map.get($foreground-palette, secondary-text)};
269
- --jps-line: #{map.get($foreground-palette, divider)};
270
- --jps-selected: #{map.get($background-palette, hover)};
271
- }
272
- /** Page switcher */
273
- }