@juice-js/layout 2.4.2 → 2.5.0-alpha.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juice-js/layout",
3
- "version": "2.4.2",
3
+ "version": "2.5.0-alpha.2",
4
4
  "description": "Juice layout",
5
5
  "author": {
6
6
  "name": "jack@creatorflow.io"
@@ -19,8 +19,8 @@
19
19
  "url": "git+https://github.com/PavellisLabs/juice-layout.git"
20
20
  },
21
21
  "peerDependencies": {
22
- "@juice-js/core": "2.4.2",
23
- "@juice-js/localize": "2.4.2"
22
+ "@juice-js/core": "2.5.0-alpha.2",
23
+ "@juice-js/localize": "2.5.0-alpha.2"
24
24
  },
25
25
  "dependencies": {
26
26
  "tslib": "^2.3.0"
@@ -32,6 +32,9 @@
32
32
  "types": "./types/juice-js-layout.d.ts",
33
33
  "default": "./fesm2022/juice-js-layout.mjs"
34
34
  },
35
+ "./page-header": {
36
+ "sass": "./styles/_page-header.scss"
37
+ },
35
38
  "./package.json": {
36
39
  "default": "./package.json"
37
40
  }
@@ -40,5 +43,5 @@
40
43
  "typings": "types/juice-js-layout.d.ts",
41
44
  "type": "module",
42
45
  "readme": "ERROR: No README data found!",
43
- "_id": "@juice-js/layout@2.4.2"
46
+ "_id": "@juice-js/layout@2.5.0-alpha.2"
44
47
  }
@@ -0,0 +1,9 @@
1
+ // The shared page header (jc-page-header) and the visually hidden label (.jc-sr-only). Plain CSS: `@use '@juice-js/layout/page-header';`
2
+ // once in the app's global styles, with or without layout.theme(). It reads only CSS variables, each with a fallback: --jc-border and
3
+ // --jc-muted (else layout.theme()'s --juice-border and --juice-muted), --jc-font-2xl and --jc-font-md (layout.theme()'s type scale).
4
+ .jc-page-header { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 4px 0 12px; border-bottom: 1px solid var(--jc-border, var(--juice-border, currentcolor)); margin-bottom: 12px; }
5
+ .jc-page-header .jc-crumb, .jc-page-header .jc-crumb-sep, .jc-page-subtitle { color: var(--jc-muted, var(--juice-muted, inherit)); }
6
+ .jc-page-title { font-size: var(--jc-font-2xl, 20px); margin: 0; font-weight: 500; }
7
+ .jc-page-subtitle { font-size: var(--jc-font-md, 13px); }
8
+ .jc-page-header .jc-spacer { flex: 1; }
9
+ .jc-sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
@@ -56,9 +56,19 @@ $palettes: ('teal': palettes.$teal, 'indigo': palettes.$indigo);
56
56
  background: var(--mat-sys-surface);
57
57
  color: var(--mat-sys-on-surface);
58
58
  }
59
+ @include scale();
59
60
  @include components();
60
61
  }
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
+
62
72
  @function _color($palette) {
63
73
  @return (primary: map.get($palette, primary), tertiary: map.get($palette, tertiary), theme-type: color-scheme);
64
74
  }
@@ -73,6 +83,8 @@ $palettes: ('teal': palettes.$teal, 'indigo': palettes.$indigo);
73
83
  --juice-muted: var(--mat-sys-on-surface-variant);
74
84
  --juice-accent: var(--mat-sys-primary);
75
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);
76
88
  --juice-select: #{_tint(var(--juice-accent))};
77
89
  --juice-ok: light-dark(#047857, #34d399);
78
90
  --juice-warn: light-dark(#b45309, #fbbf24);
@@ -106,6 +118,19 @@ $palettes: ('teal': palettes.$teal, 'indigo': palettes.$indigo);
106
118
  }
107
119
  }
108
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
+
109
134
  ::-webkit-scrollbar { width: 10px; height: 10px; }
110
135
  ::-webkit-scrollbar-thumb { background: var(--mat-sys-outline-variant); border-radius: 10px; }
111
136
  ::-webkit-scrollbar-track { background: transparent; }
@@ -345,6 +345,14 @@ declare class TooltipDirective {
345
345
  static ngAcceptInputType_tooltipDisplay: unknown;
346
346
  }
347
347
 
348
+ /**
349
+ * The side menu's entry on display ({@link mostSpecificLink}), provided by the menu to its groups: up to date as soon as a navigation
350
+ * ends, while their `activeLink` input waits for the next change detection.
351
+ */
352
+ declare abstract class MenuActiveLink {
353
+ abstract readonly activeLink: string | null;
354
+ }
355
+
348
356
  /** A count shown on a side menu entry, such as requests waiting for the user. */
349
357
  interface MenuBadge {
350
358
  /** Shown while above zero; above 99 it reads `99+`. */
@@ -373,7 +381,7 @@ declare class MenuBadgeService {
373
381
  static ɵprov: i0.ɵɵInjectableDeclaration<MenuBadgeService>;
374
382
  }
375
383
 
376
- declare class NavMenuComponent {
384
+ declare class NavMenuComponent implements MenuActiveLink {
377
385
  private service;
378
386
  layout: LayoutService;
379
387
  private tenantService;
@@ -416,6 +424,8 @@ declare class NavMenuComponent {
416
424
  */
417
425
  declare class ExpandableMenuComponent {
418
426
  private readonly router;
427
+ /** The side menu it is in, which knows the entry on display as soon as a navigation ends. */
428
+ private readonly menu;
419
429
  private readonly cdr;
420
430
  private readonly panel;
421
431
  private _item;
@@ -431,7 +441,11 @@ declare class ExpandableMenuComponent {
431
441
  * The path of the entry on display across the whole menu (the most specific one, see `mostSpecificLink`), given by
432
442
  * the menu. Left out (undefined), the group goes by its own pages alone.
433
443
  */
434
- activeLink?: string | null;
444
+ set activeLink(value: string | null | undefined);
445
+ get activeLink(): string | null | undefined;
446
+ private _activeLink?;
447
+ /** The entry on display: the menu's, current as soon as a navigation ends; else the input's. */
448
+ private get current();
435
449
  set item(value: MenuItem);
436
450
  get item(): MenuItem;
437
451
  TooltipPosition: typeof TooltipPosition;
@@ -447,12 +461,14 @@ declare class ExpandableMenuComponent {
447
461
  private update;
448
462
  /** The URL's path, without query string or fragment. */
449
463
  private path;
464
+ /** Whether a page of the group is the page on display. */
465
+ protected isChildActive(child: MenuItem): boolean;
466
+ /** Whether the menu's entry on display (activeLink) is this link. */
467
+ private isMenuActive;
450
468
  /**
451
469
  * How a child's link matches: with the pages under it, unless other pages of the group sit under it too (a link to
452
470
  * `/` or to the tenant's root), which would make it match every page.
453
471
  */
454
- /** Whether a page of the group is the page on display. */
455
- protected isChildActive(child: MenuItem): boolean;
456
472
  protected matching(link: string, links?: readonly string[]): IsActiveMatchOptions;
457
473
  private get childLinks();
458
474
  private isActive;
@@ -653,5 +669,24 @@ declare class UserProfileDialogModule {
653
669
  static ɵinj: i0.ɵɵInjectorDeclaration<UserProfileDialogModule>;
654
670
  }
655
671
 
656
- export { DevGuard, ExpandableMenuComponent, LAYOUT_PALETTES, LAYOUT_TOOLBAR_ITEMS, LayoutModule, LayoutService, MenuBadgeComponent, MenuBadgeService, NavMenuComponent, PageComponent, PageNotfoundComponent, PageSwitcherComponent, PageSwitcherService, ProfileDialogService, SearchService, TooltipDirective, TooltipModule, TooltipPosition, UserProfileDialogModule, flatten, isSearchablePage };
657
- export type { LayoutPalette, MenuBadge, PageEntry, SearchablePage };
672
+ /** One step of a page's way back: its name and, if it is a link, where it goes. */
673
+ interface PageCrumb {
674
+ label: string;
675
+ link?: readonly unknown[] | string;
676
+ }
677
+ /**
678
+ * The header of a page that isn't about one environment or time range (a module's page, the notification pages): the way back, the title as
679
+ * the page's h1, a line under it, and the page's actions on the right (project them in, filters too). Shared by the Juice Consoles; its
680
+ * styles are `@use '@juice-js/layout/page-header'` (classes .jc-page-header, .jc-page-title, .jc-page-subtitle, .jc-crumb, .jc-crumb-sep,
681
+ * .jc-spacer, .jc-sr-only), which read only CSS variables, each with a fallback.
682
+ */
683
+ declare class PageHeader {
684
+ readonly title: i0.InputSignal<string>;
685
+ readonly subtitle: i0.InputSignal<string | null>;
686
+ readonly crumbs: i0.InputSignal<readonly PageCrumb[]>;
687
+ static ɵfac: i0.ɵɵFactoryDeclaration<PageHeader, never>;
688
+ static ɵcmp: i0.ɵɵComponentDeclaration<PageHeader, "jc-page-header", never, { "title": { "alias": "title"; "required": true; "isSignal": true; }; "subtitle": { "alias": "subtitle"; "required": false; "isSignal": true; }; "crumbs": { "alias": "crumbs"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
689
+ }
690
+
691
+ export { DevGuard, ExpandableMenuComponent, LAYOUT_PALETTES, LAYOUT_TOOLBAR_ITEMS, LayoutModule, LayoutService, MenuBadgeComponent, MenuBadgeService, NavMenuComponent, PageComponent, PageHeader, PageNotfoundComponent, PageSwitcherComponent, PageSwitcherService, ProfileDialogService, SearchService, TooltipDirective, TooltipModule, TooltipPosition, UserProfileDialogModule, flatten, isSearchablePage };
692
+ export type { LayoutPalette, MenuBadge, PageCrumb, PageEntry, SearchablePage };