@almoamendev/ngx-md3 0.6.0 → 0.7.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@almoamendev/ngx-md3",
3
- "version": "0.6.0",
3
+ "version": "0.7.1",
4
4
  "description": "MD3-style Angular components & style library",
5
5
  "author": "Murtadha (Hussain) Almoamen",
6
6
  "license": "MIT",
@@ -624,18 +624,68 @@ type ViewportWidth = 'compact' | 'medium' | 'expanded' | 'large' | 'extra-large'
624
624
 
625
625
  type ViewportHeight = 'compact' | 'medium' | 'expanded';
626
626
 
627
+ type Md3NavigationMode = 'none' | 'navigation-bar' | 'navigation-rail' | 'standard-drawer' | 'modal-drawer';
628
+ /**
629
+ * The state of the window and of the document, for the whole application.
630
+ *
631
+ * This service is a singleton on purpose. A layout region can appear more than once — a page
632
+ * scaffold, and a contained layout inside a full screen dialog — and each one keeps its own
633
+ * scroll and inset state in its own {@link LayoutService}. The window size, the breakpoints,
634
+ * the reading direction and the color scheme belong to the document, so they live here and
635
+ * every layout reads the same values.
636
+ */
637
+ declare class ViewportService {
638
+ private readonly document;
639
+ private readonly breakpointObserver;
640
+ private readonly widthQueries;
641
+ private readonly heightQueries;
642
+ readonly viewport: _angular_core.Signal<{
643
+ width: number;
644
+ height: number;
645
+ } | {
646
+ readonly width: number;
647
+ readonly height: number;
648
+ }>;
649
+ readonly widthClass: _angular_core.Signal<ViewportWidth>;
650
+ readonly heightClass: _angular_core.Signal<ViewportHeight>;
651
+ readonly direction: _angular_core.WritableSignal<"ltr" | "rtl">;
652
+ readonly isCompact: _angular_core.Signal<boolean>;
653
+ readonly isMedium: _angular_core.Signal<boolean>;
654
+ readonly isExpanded: _angular_core.Signal<boolean>;
655
+ readonly isLarge: _angular_core.Signal<boolean>;
656
+ readonly isExtraLarge: _angular_core.Signal<boolean>;
657
+ readonly isPortrait: _angular_core.Signal<boolean>;
658
+ readonly isLandscape: _angular_core.Signal<boolean>;
659
+ readonly preferredNavigationMode: _angular_core.Signal<"navigation-bar" | "navigation-rail" | "standard-drawer">;
660
+ darkMode: _angular_core.WritableSignal<boolean>;
661
+ constructor();
662
+ setDirection(direction: 'ltr' | 'rtl'): void;
663
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<ViewportService, never>;
664
+ static ɵprov: _angular_core.ɵɵInjectableDeclaration<ViewportService>;
665
+ }
666
+
627
667
  type FloatingBarSide = 'blockStart' | 'blockEnd';
628
668
  interface FloatingInset {
629
669
  blockStart: number;
630
670
  blockEnd: number;
631
671
  }
632
- type Md3NavigationMode = 'none' | 'navigation-bar' | 'navigation-rail' | 'standard-drawer' | 'modal-drawer';
672
+
673
+ /**
674
+ * The state of one layout container: what its main pane scrolls, and what its floating bars
675
+ * cover.
676
+ *
677
+ * The service is provided at the root, and the page scaffold uses that root instance. A
678
+ * contained layout — `md3-layout`, the one a full screen dialog holds — provides its own
679
+ * instance instead, so a toolbar inside it reads the scroll and the insets of that layout and
680
+ * never of the page behind it.
681
+ *
682
+ * The window size, the breakpoints, the reading direction and the color scheme belong to the
683
+ * document, not to a container. They live in {@link ViewportService}, and every instance of
684
+ * this service exposes the same signals, so an instance stays a complete view of the layout.
685
+ */
633
686
  declare class LayoutService {
634
- private readonly document;
635
- private readonly breakpointObserver;
687
+ private readonly viewportService;
636
688
  private readonly router;
637
- private readonly widthQueries;
638
- private readonly heightQueries;
639
689
  private mainPaneSub?;
640
690
  private mainPaneEl?;
641
691
  private panesContainerResizeObserver?;
@@ -654,18 +704,17 @@ declare class LayoutService {
654
704
  */
655
705
  readonly isScrollingDown: _angular_core.WritableSignal<boolean>;
656
706
  /**
657
- * Distance, in pixels, between the viewport bottom and the bottom edge of
658
- * the scaffold's .md3-panes-container — i.e. whatever the bottom scaffold
659
- * bar (nav bar) currently reserves, or 0 when there is none. Overlay-based
660
- * components anchored to the viewport bottom (like Snackbar) read this so
661
- * they never render lower than the panes container.
707
+ * Distance, in pixels, between the bottom of the container and the bottom edge of
708
+ * the .md3-panes-container — i.e. whatever the bottom bar currently reserves, or 0 when
709
+ * there is none. Overlay-based components anchored to the bottom (like Snackbar) read
710
+ * this so they never render lower than the panes container.
662
711
  */
663
712
  readonly bottomInset: _angular_core.WritableSignal<number>;
664
713
  /**
665
- * Space a floating scaffold bar covers but does not reserve, per logical block side.
714
+ * Space a floating bar covers but does not reserve, per logical block side.
666
715
  *
667
716
  * A floating toolbar in a bar region leaves the layout flow, so its grid track collapses
668
- * and the content flows under it. This signal reports what it covers, so the scaffold can
717
+ * and the content flows under it. This signal reports what it covers, so the layout can
669
718
  * pad the main pane and overlays can stay clear of it.
670
719
  *
671
720
  * A floating toolbar in a *rail* region stays in the flow and reserves its own space, so
@@ -673,8 +722,8 @@ declare class LayoutService {
673
722
  */
674
723
  readonly floatingInset: _angular_core.WritableSignal<FloatingInset>;
675
724
  /**
676
- * The distance from the viewport bottom that a viewport-anchored overlay must keep clear.
677
- * It covers both the reserved bottom bar and any floating bottom bar over it.
725
+ * The distance from the bottom that an anchored overlay must keep clear. It covers both
726
+ * the reserved bottom bar and any floating bottom bar over it.
678
727
  */
679
728
  readonly bottomSafeInset: _angular_core.Signal<number>;
680
729
  readonly viewport: _angular_core.Signal<{
@@ -705,10 +754,10 @@ declare class LayoutService {
705
754
  private updateScrollDirection;
706
755
  registerPanesContainer(element: HTMLElement): void;
707
756
  /**
708
- * Register a floating bar so the scaffold and the overlays know what it covers.
757
+ * Register a floating bar so the layout and the overlays know what it covers.
709
758
  *
710
- * Call this for a floating toolbar in a scaffold *bar* region only. A rail region keeps
711
- * the toolbar in the layout flow, so it reserves its own space and needs no inset.
759
+ * Call this for a floating toolbar in a *bar* region only. A rail region keeps the toolbar
760
+ * in the layout flow, so it reserves its space and needs no inset.
712
761
  */
713
762
  registerFloatingBar(element: HTMLElement, side: FloatingBarSide): void;
714
763
  unregisterFloatingBar(element: HTMLElement): void;
@@ -740,6 +789,35 @@ declare class Scaffold implements AfterViewInit, OnDestroy {
740
789
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<Scaffold, "md3-scaffold", never, {}, {}, never, ["[md3-scaffold-bar=top]", "[md3-scaffold-rail=leading]", "[md3-scaffold-pane=start]", "[md3-scaffold-pane=main]", "[md3-scaffold-pane=end]", "[md3-scaffold-rail=trailing]", "[md3-scaffold-bar=bottom]"], true, never>;
741
790
  }
742
791
 
792
+ /**
793
+ * A layout region shell that fills its parent instead of the window.
794
+ *
795
+ * It places the same regions as `md3-scaffold` — the bar rows, the rail columns and the three
796
+ * panes — so the same region attributes work inside it:
797
+ *
798
+ * ```html
799
+ * <md3-layout>
800
+ * <md3-toolbar md3-scaffold-bar="bottom" toolbar-type="floating">...</md3-toolbar>
801
+ *
802
+ * <div md3-scaffold-pane="main">...</div>
803
+ * </md3-layout>
804
+ * ```
805
+ *
806
+ * Use it wherever a page-sized scaffold does not fit: the content of a full screen dialog, a
807
+ * card, a preview pane. A full screen dialog is the common one, because a toolbar needs a bar
808
+ * or a rail region and the dialog shell has none of its own.
809
+ *
810
+ * The layout provides its own {@link LayoutService}, so everything inside it reads the scroll
811
+ * position and the floating insets of *this* container. A floating toolbar therefore pads the
812
+ * main pane of the layout, and `scroll-action` follows the pane of the layout — never the page
813
+ * behind it. The window size, the breakpoints, the reading direction and the color scheme stay
814
+ * shared with the rest of the application.
815
+ */
816
+ declare class Layout extends Scaffold {
817
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<Layout, never>;
818
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<Layout, "md3-layout", never, {}, {}, never, ["[md3-scaffold-bar=top]", "[md3-scaffold-rail=leading]", "[md3-scaffold-pane=start]", "[md3-scaffold-pane=main]", "[md3-scaffold-pane=end]", "[md3-scaffold-rail=trailing]", "[md3-scaffold-bar=bottom]"], true, never>;
819
+ }
820
+
743
821
  declare class ScaffoldBar {
744
822
  region: _angular_core.InputSignal<"top" | "bottom">;
745
823
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<ScaffoldBar, never>;
@@ -1450,6 +1528,16 @@ type AppBarScrollingStyle = 'none' | 'transparent' | 'elevate';
1450
1528
  declare class AppBar implements ButtonContext {
1451
1529
  private el;
1452
1530
  private layoutService;
1531
+ private readonly inDialog;
1532
+ /**
1533
+ * The landmark role of the bar.
1534
+ *
1535
+ * A page has one banner, and the app bar of the page is it. A bar inside a dialog is not
1536
+ * the banner of the document — a banner nested in a dialog misleads a screen reader — so a
1537
+ * bar that finds itself in one carries no role. Set this input to force either value.
1538
+ */
1539
+ barRole: _angular_core.InputSignal<"none" | "banner" | null>;
1540
+ protected readonly resolvedRole: Signal<string | null>;
1453
1541
  title: _angular_core.InputSignal<string | null>;
1454
1542
  subtitle: _angular_core.InputSignal<string | null>;
1455
1543
  appBarType: _angular_core.InputSignal<AppBarType>;
@@ -1472,7 +1560,7 @@ declare class AppBar implements ButtonContext {
1472
1560
  private hasCollapsibleBottom;
1473
1561
  private getHostFontSize;
1474
1562
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<AppBar, never>;
1475
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<AppBar, "md3-app-bar", never, { "title": { "alias": "bar-title"; "required": false; "isSignal": true; }; "subtitle": { "alias": "bar-subtitle"; "required": false; "isSignal": true; }; "appBarType": { "alias": "bar-type"; "required": false; "isSignal": true; }; "appBarScrollingStyle": { "alias": "scroll-style"; "required": false; "isSignal": true; }; "autoHide": { "alias": "auto-hide"; "required": false; "isSignal": true; }; "centerAligned": { "alias": "center-aligned"; "required": false; "isSignal": true; }; }, {}, ["logo", "avatar"], ["[md3-app-bar-leading]", "[md3-search-leading]", "[md3-input-element]", "[md3-search-trailing]", "[md3-app-bar-logo]", "[md3-app-bar-trailing]", "[md3-avatar]"], true, never>;
1563
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<AppBar, "md3-app-bar", never, { "barRole": { "alias": "bar-role"; "required": false; "isSignal": true; }; "title": { "alias": "bar-title"; "required": false; "isSignal": true; }; "subtitle": { "alias": "bar-subtitle"; "required": false; "isSignal": true; }; "appBarType": { "alias": "bar-type"; "required": false; "isSignal": true; }; "appBarScrollingStyle": { "alias": "scroll-style"; "required": false; "isSignal": true; }; "autoHide": { "alias": "auto-hide"; "required": false; "isSignal": true; }; "centerAligned": { "alias": "center-aligned"; "required": false; "isSignal": true; }; }, {}, ["logo", "avatar"], ["[md3-app-bar-leading]", "[md3-search-leading]", "[md3-input-element]", "[md3-search-trailing]", "[md3-app-bar-logo]", "[md3-app-bar-trailing]", "[md3-avatar]"], true, never>;
1476
1564
  }
1477
1565
 
1478
1566
  declare class AppBarLogo {
@@ -1898,21 +1986,35 @@ declare class DialogActions {
1898
1986
  }
1899
1987
 
1900
1988
  /**
1901
- * Material 3 full screen dialog shell. It covers the viewport and lays its
1902
- * content out like the scaffold does, with a main pane and a side sheet outlet
1903
- * on each side, so side sheets opened while it is up land inside the dialog
1904
- * instead of behind it.
1989
+ * Material 3 full screen dialog shell. It covers the viewport and holds the content.
1990
+ *
1991
+ * The content is an `md3-layout`. The layout places the regions the bar rows for an app bar
1992
+ * or a toolbar, the rail columns, and the panes where side sheets open — so the dialog itself
1993
+ * places nothing but the content. A content root that is not a layout gets a warning in
1994
+ * development mode, and the shell falls back to panes of its own, so a side sheet never opens
1995
+ * behind the dialog where nobody can see it.
1905
1996
  */
1906
1997
  declare class FullScreenDialog extends CdkDialogContainer implements DialogContainer, AfterViewInit {
1907
1998
  private readonly surface;
1999
+ private readonly mainPane;
1908
2000
  private readonly startOutlet;
1909
2001
  private readonly endOutlet;
1910
2002
  private readonly sheets;
2003
+ /** True while the shell holds the side sheet outlets, which happens without a layout only. */
2004
+ private ownsSideSheetOutlets;
1911
2005
  isActive: _angular_core.WritableSignal<boolean>;
1912
2006
  protected readonly config: DialogConfig<unknown>;
1913
2007
  get surfaceElement(): HTMLElement | null;
1914
2008
  ngAfterViewInit(): void;
1915
2009
  ngOnDestroy(): void;
2010
+ /**
2011
+ * The layout at the root of the content, if the content brought one.
2012
+ *
2013
+ * The root is either the layout itself, or the component that holds it — a dialog is
2014
+ * normally opened with a component whose own template starts with `md3-layout`.
2015
+ */
2016
+ private findContentLayout;
2017
+ private checkContentLayout;
1916
2018
  startEnterAnimation(): void;
1917
2019
  setActive(value: boolean): void;
1918
2020
  recaptureFocus(): void;
@@ -1920,18 +2022,6 @@ declare class FullScreenDialog extends CdkDialogContainer implements DialogConta
1920
2022
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<FullScreenDialog, "md3-fullscreen-dialog", never, {}, {}, never, never, true, never>;
1921
2023
  }
1922
2024
 
1923
- /**
1924
- * Header of a full screen dialog: a leading icon button to leave the dialog,
1925
- * the headline, and a trailing action. It sticks to the top of the dialog while
1926
- * the content scrolls underneath.
1927
- */
1928
- declare class FullScreenDialogHeader implements ButtonContext {
1929
- buttonContextSize: Signal<ButtonSize>;
1930
- buttonContextWidth: Signal<IconButtonWidth>;
1931
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<FullScreenDialogHeader, never>;
1932
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<FullScreenDialogHeader, "md3-fullscreen-dialog-header", never, {}, {}, never, ["[md3-icon-button][md3-header-leading]", "*", "[md3-header-trailing]"], true, never>;
1933
- }
1934
-
1935
2025
  declare class Menu implements AfterContentInit {
1936
2026
  private el;
1937
2027
  private readonly portalOutlet;
@@ -2366,5 +2456,5 @@ declare class SnackbarService {
2366
2456
  static ɵprov: _angular_core.ɵɵInjectableDeclaration<SnackbarService>;
2367
2457
  }
2368
2458
 
2369
- export { AppBar, AppBarLogo, Avatar, BOTTOM_SHEET_COMPONENT, BOTTOM_SHEET_CONFIG, BOTTOM_SHEET_DATA, Badge, BottomSheetRef, BottomSheetService, Button, ButtonGroup, CAROUSEL_STRATEGIES, Card, Carousel, CarouselItem, Checkbox, ChipAvatar, Chips, CircularProgressIndicator, DIALOG_COMPONENT, DIALOG_CONFIG, DIALOG_DATA, Dialog, DialogActions, DialogBody, DialogHeader, DialogRef, DialogService, Divider, FloatingActionButton, FullScreenDialog, FullScreenDialogHeader, Grid, GridItem, IconButton, IconElement, InputElement, LayoutService, LinearProgressIndicator, List, ListItem, ListItemPrimaryAction, ListLeading, ListSlot, LoadingIndicator, MENU_COMPONENT, MENU_CONFIG, MENU_DATA, MaterialIcon, Menu, MenuGroup, MenuItem, MenuRef, MenuService, ModalBottomSheetRef, NavigationBar, NavigationGroup, NavigationItem, NavigationRail, RadioButton, SIDE_SHEET_COMPONENT, SIDE_SHEET_CONFIG, SIDE_SHEET_DATA, SNACKBAR_ACTION_LABEL, SNACKBAR_CONFIG, SNACKBAR_MESSAGE, Scaffold, ScaffoldBar, ScaffoldPane, ScaffoldRail, SheetsService, SideSheetActions, SideSheetBody, SideSheetHeader, SideSheetRef, Slider, Snackbar, SnackbarRef, SnackbarService, SplitButton, StandardBottomSheetRef, StateComponent, SupportingText, Switch, TextField, Toolbar, ToolbarItem, TypeBody, TypeDisplay, TypeHeadline, TypeLabel, TypeTitle, buildGeometry, clampIndex, indexForScrollOffset, multiBrowseStrategy, parseCarouselAspectRatio, resolveItemGeometry, resolveState, scrollOffsetForIndex, sizeBandFor };
2459
+ export { AppBar, AppBarLogo, Avatar, BOTTOM_SHEET_COMPONENT, BOTTOM_SHEET_CONFIG, BOTTOM_SHEET_DATA, Badge, BottomSheetRef, BottomSheetService, Button, ButtonGroup, CAROUSEL_STRATEGIES, Card, Carousel, CarouselItem, Checkbox, ChipAvatar, Chips, CircularProgressIndicator, DIALOG_COMPONENT, DIALOG_CONFIG, DIALOG_DATA, Dialog, DialogActions, DialogBody, DialogHeader, DialogRef, DialogService, Divider, FloatingActionButton, FullScreenDialog, Grid, GridItem, IconButton, IconElement, InputElement, Layout, LayoutService, LinearProgressIndicator, List, ListItem, ListItemPrimaryAction, ListLeading, ListSlot, LoadingIndicator, MENU_COMPONENT, MENU_CONFIG, MENU_DATA, MaterialIcon, Menu, MenuGroup, MenuItem, MenuRef, MenuService, ModalBottomSheetRef, NavigationBar, NavigationGroup, NavigationItem, NavigationRail, RadioButton, SIDE_SHEET_COMPONENT, SIDE_SHEET_CONFIG, SIDE_SHEET_DATA, SNACKBAR_ACTION_LABEL, SNACKBAR_CONFIG, SNACKBAR_MESSAGE, Scaffold, ScaffoldBar, ScaffoldPane, ScaffoldRail, SheetsService, SideSheetActions, SideSheetBody, SideSheetHeader, SideSheetRef, Slider, Snackbar, SnackbarRef, SnackbarService, SplitButton, StandardBottomSheetRef, StateComponent, SupportingText, Switch, TextField, Toolbar, ToolbarItem, TypeBody, TypeDisplay, TypeHeadline, TypeLabel, TypeTitle, ViewportService, buildGeometry, clampIndex, indexForScrollOffset, multiBrowseStrategy, parseCarouselAspectRatio, resolveItemGeometry, resolveState, scrollOffsetForIndex, sizeBandFor };
2370
2460
  export type { AppBarScrollingStyle, AppBarType, BottomSheetConfig, BottomSheetContainer, BottomSheetState, BottomSheetSurfaceHost, BottomSheetType, ButtonGroupSelection, ButtonGroupType, ButtonSize, ButtonType, CardType, CarouselAlignment, CarouselArrangement, CarouselGeometry, CarouselItemGeometry, CarouselItemSize, CarouselKeyline, CarouselKeylineState, CarouselLayout, CarouselOrientation, CarouselStrategy, CarouselStrategyContext, ChipStyle, ChipType, DialogConfig, DialogContainer, DialogRole, FabSize, FabType, FloatingBarSide, FloatingInset, FullScreenDialogConfig, IconButtonType, IconButtonWidth, ListLeadingSize, ListLeadingType, Md3NavigationMode, MenuConfig, MenuPositionOrigin, MenuPositionX, MenuPositionY, MenuScrollStrategy, PreviousDialog, SideSheetConfig, SideSheetContainer, SideSheetSide, SideSheetType, SliderSize, SnackbarConfig, SnackbarDismiss, SnackbarDismissReason, SnackbarPoliteness, SplitButtonType, StandardBottomSheetHost, TextColor, TextSize, ToolbarAlignment, ToolbarColor, ToolbarOrientation, ToolbarRegion, ToolbarScrollAction, ToolbarType };