@ovyn/menu 0.3.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/README.md ADDED
@@ -0,0 +1,64 @@
1
+ # Menu
2
+
3
+ This project was generated using [Angular CLI](https://github.com/angular/angular-cli) version 21.2.0.
4
+
5
+ ## Code scaffolding
6
+
7
+ Angular CLI includes powerful code scaffolding tools. To generate a new component, run:
8
+
9
+ ```bash
10
+ ng generate component component-name
11
+ ```
12
+
13
+ For a complete list of available schematics (such as `components`, `directives`, or `pipes`), run:
14
+
15
+ ```bash
16
+ ng generate --help
17
+ ```
18
+
19
+ ## Building
20
+
21
+ To build the library, run:
22
+
23
+ ```bash
24
+ ng build menu
25
+ ```
26
+
27
+ This command will compile your project, and the build artifacts will be placed in the `dist/` directory.
28
+
29
+ ### Publishing the Library
30
+
31
+ Once the project is built, you can publish your library by following these steps:
32
+
33
+ 1. Navigate to the `dist` directory:
34
+
35
+ ```bash
36
+ cd dist/menu
37
+ ```
38
+
39
+ 2. Run the `npm publish` command to publish your library to the npm registry:
40
+ ```bash
41
+ npm publish
42
+ ```
43
+
44
+ ## Running unit tests
45
+
46
+ To execute unit tests with the [Karma](https://karma-runner.github.io) test runner, use the following command:
47
+
48
+ ```bash
49
+ ng test
50
+ ```
51
+
52
+ ## Running end-to-end tests
53
+
54
+ For end-to-end (e2e) testing, run:
55
+
56
+ ```bash
57
+ ng e2e
58
+ ```
59
+
60
+ Angular CLI does not come with an end-to-end testing framework by default. You can choose one that suits your needs.
61
+
62
+ ## Additional Resources
63
+
64
+ For more information on using the Angular CLI, including detailed command references, visit the [Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page.
@@ -0,0 +1,106 @@
1
+ import * as i0 from '@angular/core';
2
+ import { InjectionToken, inject, signal, Injectable, input, output, Component, contentChild, linkedSignal } from '@angular/core';
3
+ import { BreakpointObserver } from '@angular/cdk/layout';
4
+ import { toSignal } from '@angular/core/rxjs-interop';
5
+ import { map } from 'rxjs';
6
+ import { RouterLink, RouterLinkActive, RouterOutlet } from '@angular/router';
7
+ import { Ripple } from 'primeng/ripple';
8
+ import { Popover } from 'primeng/popover';
9
+ import { NgTemplateOutlet, JsonPipe } from '@angular/common';
10
+ import { Button } from 'primeng/button';
11
+ import { Drawer } from 'primeng/drawer';
12
+ import { Image } from 'primeng/image';
13
+
14
+ const MENU_CONFIG = new InjectionToken('MENU_CONFIG');
15
+ const DEFAULT_MENU_CONFIG = {
16
+ location: 'top',
17
+ links: [],
18
+ collapseBreakpoint: 768,
19
+ };
20
+ const provideMenu = (config) => {
21
+ return ([
22
+ { provide: MENU_CONFIG, useValue: config },
23
+ MenuConfigService
24
+ ]);
25
+ };
26
+
27
+ class MenuConfigService {
28
+ $config = inject(MENU_CONFIG);
29
+ $breakpoint = inject(BreakpointObserver);
30
+ location = signal(this.$config.location ?? 'top', ...(ngDevMode ? [{ debugName: "location" }] : []));
31
+ links = signal(this.$config.links ?? [], ...(ngDevMode ? [{ debugName: "links" }] : []));
32
+ userActions = signal(this.$config.userActions ?? [], ...(ngDevMode ? [{ debugName: "userActions" }] : []));
33
+ logoSrc = signal(this.$config.logoSrc, ...(ngDevMode ? [{ debugName: "logoSrc" }] : []));
34
+ collapsed = toSignal(this.$breakpoint.observe(`(max-width: ${this.$config.collapseBreakpoint - 0.02}px)`).pipe(map((result) => result.matches)), { initialValue: false });
35
+ setLocation(location) {
36
+ this.location.set(location);
37
+ }
38
+ setLinks(links) {
39
+ this.links.set(links);
40
+ }
41
+ setUserActions(actions) {
42
+ this.userActions.set(actions);
43
+ }
44
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: MenuConfigService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
45
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: MenuConfigService, providedIn: 'root' });
46
+ }
47
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: MenuConfigService, decorators: [{
48
+ type: Injectable,
49
+ args: [{ providedIn: 'root' }]
50
+ }] });
51
+
52
+ class MenuItem {
53
+ linkInput = input.required({ ...(ngDevMode ? { debugName: "linkInput" } : {}), alias: 'link' });
54
+ location = input(...(ngDevMode ? [undefined, { debugName: "location" }] : []));
55
+ onChildClickEvent = output({ alias: 'onChildClick' });
56
+ open = signal(false, ...(ngDevMode ? [{ debugName: "open" }] : []));
57
+ onChildClick(link) {
58
+ this.onChildClickEvent.emit(link);
59
+ }
60
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: MenuItem, deps: [], target: i0.ɵɵFactoryTarget.Component });
61
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.1", type: MenuItem, isStandalone: true, selector: "menu-item", inputs: { linkInput: { classPropertyName: "linkInput", publicName: "link", isSignal: true, isRequired: true, transformFunction: null }, location: { classPropertyName: "location", publicName: "location", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onChildClickEvent: "onChildClick" }, ngImport: i0, template: "<!-- Feuille : lien simple -->\n@let link = linkInput();\n@if (!link.children?.length) {\n <a pRipple\n [routerLink]=\"link.route\"\n [routerLinkActive]=\"'bg-[var(--m-menu-item-active)]! font-semibold'\"\n [attr.aria-disabled]=\"link.disabled || null\"\n class=\"flex items-center gap-2 no-underline text-inherit whitespace-nowrap\n rounded-(--m-menu-item-radius)\n px-(--m-menu-item-pad-x) py-(--m-menu-item-pad-y)\n hover:bg-(--m-menu-item-hover) transition-colors cursor-pointer\n aria-disabled:opacity-40 aria-disabled:pointer-events-none\"\n (click)=\"onChildClick(link)\">\n @if (link.icon) { <i [class]=\"link.icon\" class=\"shrink-0\"></i> }\n <span class=\"flex-1\">{{ link.label }}</span>\n @if (link.badge != null) {\n <span class=\"text-xs px-2 py-0.5 rounded-full bg-(--m-menu-item-hover)\">\n {{ link.badge }}</span>\n }\n </a>\n}\n@else {\n <!-- Branche avec enfants -->\n <!-- TOP : bouton + popover dropdown -->\n @if (location() === 'top') {\n <button pRipple type=\"button\"\n class=\"flex items-center gap-2 whitespace-nowrap\n rounded-(--m-menu-item-radius)\n px-(--m-menu-item-pad-x) py-(--m-menu-item-pad-y)\n hover:bg-(--m-menu-item-hover) transition-colors cursor-pointer\n text-inherit bg-transparent border-0\"\n (click)=\"pop.toggle($event)\">\n @if (link.icon) { <i [class]=\"link.icon\"></i> }\n <span>{{ link.label }}</span>\n <i class=\"pi pi-angle-down text-xl\"></i>\n </button>\n\n <p-popover #pop styleClass=\"m-menu-panel\">\n <div class=\"flex flex-col gap-0.5 min-w-48\n text-(--m-menu-panel-fg)\">\n @for (child of link.children; track child.label) {\n <menu-item [link]=\"child\" location=\"top\"\n (onChildClick)=\"onChildClick($event); pop.hide()\" />\n }\n </div>\n </p-popover>\n }\n @else {\n <!-- LEFT : en-t\u00EAte cliquable + accord\u00E9on inline -->\n <button pRipple type=\"button\"\n class=\"w-full flex items-center gap-2\n rounded-(--m-menu-item-radius)\n px-(--m-menu-item-pad-x) py-(--m-menu-item-pad-y)\n hover:bg-(--m-menu-item-hover) transition-colors cursor-pointer\n text-inherit bg-transparent border-0\"\n (click)=\"open.set(!open())\">\n @if (link.icon) { <i [class]=\"link.icon\"></i> }\n <span class=\"flex-1 text-left\">{{ link.label }}</span>\n <i class=\"pi text-xs transition-transform\"\n [class.pi-angle-down]=\"!open()\" [class.pi-angle-up]=\"open()\"></i>\n </button>\n\n @if (open()) {\n <div class=\"flex flex-col gap-0.5 pl-4 mt-0.5\">\n @for (child of link.children; track child.label) {\n <menu-item [link]=\"child\" location=\"left\"\n (onChildClick)=\"onChildClickEvent.emit($event)\" />\n }\n </div>\n }\n }\n}\n", styles: [""], dependencies: [{ kind: "component", type: MenuItem, selector: "menu-item", inputs: ["link", "location"], outputs: ["onChildClick"] }, { kind: "directive", type: RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "directive", type: Ripple, selector: "[pRipple]" }, { kind: "directive", type: RouterLinkActive, selector: "[routerLinkActive]", inputs: ["routerLinkActiveOptions", "ariaCurrentWhenActive", "routerLinkActive"], outputs: ["isActiveChange"], exportAs: ["routerLinkActive"] }, { kind: "component", type: Popover, selector: "p-popover", inputs: ["ariaLabel", "ariaLabelledBy", "dismissable", "style", "styleClass", "appendTo", "autoZIndex", "ariaCloseLabel", "baseZIndex", "focusOnShow", "showTransitionOptions", "hideTransitionOptions", "motionOptions"], outputs: ["onShow", "onHide"] }] });
62
+ }
63
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: MenuItem, decorators: [{
64
+ type: Component,
65
+ args: [{ selector: 'menu-item', imports: [RouterLink, Ripple, RouterLinkActive, Popover], template: "<!-- Feuille : lien simple -->\n@let link = linkInput();\n@if (!link.children?.length) {\n <a pRipple\n [routerLink]=\"link.route\"\n [routerLinkActive]=\"'bg-[var(--m-menu-item-active)]! font-semibold'\"\n [attr.aria-disabled]=\"link.disabled || null\"\n class=\"flex items-center gap-2 no-underline text-inherit whitespace-nowrap\n rounded-(--m-menu-item-radius)\n px-(--m-menu-item-pad-x) py-(--m-menu-item-pad-y)\n hover:bg-(--m-menu-item-hover) transition-colors cursor-pointer\n aria-disabled:opacity-40 aria-disabled:pointer-events-none\"\n (click)=\"onChildClick(link)\">\n @if (link.icon) { <i [class]=\"link.icon\" class=\"shrink-0\"></i> }\n <span class=\"flex-1\">{{ link.label }}</span>\n @if (link.badge != null) {\n <span class=\"text-xs px-2 py-0.5 rounded-full bg-(--m-menu-item-hover)\">\n {{ link.badge }}</span>\n }\n </a>\n}\n@else {\n <!-- Branche avec enfants -->\n <!-- TOP : bouton + popover dropdown -->\n @if (location() === 'top') {\n <button pRipple type=\"button\"\n class=\"flex items-center gap-2 whitespace-nowrap\n rounded-(--m-menu-item-radius)\n px-(--m-menu-item-pad-x) py-(--m-menu-item-pad-y)\n hover:bg-(--m-menu-item-hover) transition-colors cursor-pointer\n text-inherit bg-transparent border-0\"\n (click)=\"pop.toggle($event)\">\n @if (link.icon) { <i [class]=\"link.icon\"></i> }\n <span>{{ link.label }}</span>\n <i class=\"pi pi-angle-down text-xl\"></i>\n </button>\n\n <p-popover #pop styleClass=\"m-menu-panel\">\n <div class=\"flex flex-col gap-0.5 min-w-48\n text-(--m-menu-panel-fg)\">\n @for (child of link.children; track child.label) {\n <menu-item [link]=\"child\" location=\"top\"\n (onChildClick)=\"onChildClick($event); pop.hide()\" />\n }\n </div>\n </p-popover>\n }\n @else {\n <!-- LEFT : en-t\u00EAte cliquable + accord\u00E9on inline -->\n <button pRipple type=\"button\"\n class=\"w-full flex items-center gap-2\n rounded-(--m-menu-item-radius)\n px-(--m-menu-item-pad-x) py-(--m-menu-item-pad-y)\n hover:bg-(--m-menu-item-hover) transition-colors cursor-pointer\n text-inherit bg-transparent border-0\"\n (click)=\"open.set(!open())\">\n @if (link.icon) { <i [class]=\"link.icon\"></i> }\n <span class=\"flex-1 text-left\">{{ link.label }}</span>\n <i class=\"pi text-xs transition-transform\"\n [class.pi-angle-down]=\"!open()\" [class.pi-angle-up]=\"open()\"></i>\n </button>\n\n @if (open()) {\n <div class=\"flex flex-col gap-0.5 pl-4 mt-0.5\">\n @for (child of link.children; track child.label) {\n <menu-item [link]=\"child\" location=\"left\"\n (onChildClick)=\"onChildClickEvent.emit($event)\" />\n }\n </div>\n }\n }\n}\n" }]
66
+ }], propDecorators: { linkInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "link", required: true }] }], location: [{ type: i0.Input, args: [{ isSignal: true, alias: "location", required: false }] }], onChildClickEvent: [{ type: i0.Output, args: ["onChildClick"] }] } });
67
+
68
+ class MMenu {
69
+ $config = inject(MenuConfigService);
70
+ logoTemplate = contentChild('logo', ...(ngDevMode ? [{ debugName: "logoTemplate" }] : []));
71
+ actionsTemplate = contentChild('actions', ...(ngDevMode ? [{ debugName: "actionsTemplate" }] : []));
72
+ contentTemplate = contentChild('content', ...(ngDevMode ? [{ debugName: "contentTemplate" }] : []));
73
+ logoSrc = this.$config.logoSrc;
74
+ items = this.$config.links;
75
+ location = this.$config.location;
76
+ collapsed = this.$config.collapsed;
77
+ userActions = this.$config.userActions;
78
+ drawerOpened = signal(false, ...(ngDevMode ? [{ debugName: "drawerOpened" }] : []));
79
+ renderLocation = linkedSignal({ ...(ngDevMode ? { debugName: "renderLocation" } : {}), source: () => ({
80
+ collapsed: this.collapsed(),
81
+ location: this.location(),
82
+ }),
83
+ computation: ({ collapsed, location }) => (collapsed ? 'left' : location) });
84
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: MMenu, deps: [], target: i0.ɵɵFactoryTarget.Component });
85
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.1", type: MMenu, isStandalone: true, selector: "m-menu", queries: [{ propertyName: "logoTemplate", first: true, predicate: ["logo"], descendants: true, isSignal: true }, { propertyName: "actionsTemplate", first: true, predicate: ["actions"], descendants: true, isSignal: true }, { propertyName: "contentTemplate", first: true, predicate: ["content"], descendants: true, isSignal: true }], ngImport: i0, template: "<!-- Fragment r\u00E9utilisable : liste de liens -->\n<ng-template #linkList let-orient=\"orient\">\n <nav class=\"flex\" [class.flex-row]=\"orient === 'top'\" [class.flex-col]=\"orient === 'left'\"\n [class.items-center]=\"orient === 'top'\"\n [style.gap]=\"orient === 'top' ? '0.5rem' : '0.25rem'\">\n @for (link of items(); track link.label) {\n <menu-item [link]=\"link\" [location]=\"orient\"\n (onChildClick)=\"drawerOpened.set(false)\" />\n }\n </nav>\n</ng-template>\n\n<!-- Fragments logo / actions / contenu avec fallback -->\n<ng-template #logoSlot>\n @let logo = logoTemplate();\n @if (logo) { <ng-container [ngTemplateOutlet]=\"logo\" /> }\n @else {\n @if (logoSrc()) {\n <!-- <img [src]=\"logoSrc()\" alt=\"\" class=\"img-logo\" />-->\n <p-image [src]=\"logoSrc()\" class=\"h-16 w-16 cursor-pointer flex items-center justify-center\" />\n }\n @else {\n <span class=\"font-bold text-lg px-2\">App</span>\n }\n }\n</ng-template>\n\n<ng-template #actionsSlot>\n @let actions = actionsTemplate();\n @if (actions) {\n <ng-container [ngTemplateOutlet]=\"actions\" [ngTemplateOutletContext]=\"{$implicit: userActions()}\" />\n }\n</ng-template>\n\n<ng-template #contentSlot>\n @let content = contentTemplate();\n @if (content) { <ng-container [ngTemplateOutlet]=\"content\" /> }\n @else { <router-outlet /> }\n</ng-template>\n\n@if (collapsed()) {\n <!-- ============ REPLI\u00C9 (mobile) : hamburger + drawer ============ -->\n <div class=\"h-screen flex flex-col text-(--m-menu-fg)\">\n <header class=\"flex items-center px-(--m-menu-pad-x)\n h-(--m-menu-bar-height) [background:var(--m-menu-bg)]\">\n <p-button variant=\"text\" icon=\"pi pi-bars\" styleClass=\"text-white!\"\n (click)=\"drawerOpened.set(true)\" />\n <div class=\"ml-2\"><ng-container [ngTemplateOutlet]=\"logoSlot\" /></div>\n <nav class=\"ml-auto\"><ng-container [ngTemplateOutlet]=\"actionsSlot\" /></nav>\n </header>\n\n <p-drawer [(visible)]=\"drawerOpened\" position=\"left\" [modal]=\"true\"\n styleClass=\"!border-0 w-[var(--m-menu-rail-width)]\">\n <ng-template #headless>\n <div class=\"h-full flex flex-col text-(--m-menu-fg)\n [background:var(--m-menu-bg)] p-(--m-menu-pad-x) gap-4\">\n <div class=\"flex items-center justify-between\">\n <ng-container [ngTemplateOutlet]=\"logoSlot\" />\n <p-button variant=\"text\" icon=\"pi pi-times\" styleClass=\"text-white!\"\n (click)=\"drawerOpened.set(false)\" />\n </div>\n <ng-container [ngTemplateOutlet]=\"linkList\" [ngTemplateOutletContext]=\"{ orient: 'left' }\" />\n <nav class=\"mt-auto\"><ng-container [ngTemplateOutlet]=\"actionsSlot\" /></nav>\n </div>\n </ng-template>\n </p-drawer>\n\n <main class=\"flex-1 overflow-auto\">\n <ng-container [ngTemplateOutlet]=\"contentSlot\" />\n </main>\n </div>\n}\n\n@else if (location() === 'top') {\n <!-- ============ TOP : barre horizontale ============ -->\n <div class=\"h-screen flex flex-col\">\n <header class=\"top\">\n <ng-container [ngTemplateOutlet]=\"logoSlot\" />\n <ng-container [ngTemplateOutlet]=\"linkList\" [ngTemplateOutletContext]=\"{ orient: 'top' }\" />\n <nav class=\"ml-auto flex flex-row items-center\"><ng-container [ngTemplateOutlet]=\"actionsSlot\" /></nav>\n </header>\n <main class=\"flex-1 overflow-auto\">\n <ng-container [ngTemplateOutlet]=\"contentSlot\" />\n </main>\n </div>\n}\n\n@else {\n <!-- ============ LEFT : rail vertical ============ -->\n <div class=\"h-screen flex flex-row\">\n <aside class=\"left\">\n <ng-container [ngTemplateOutlet]=\"logoSlot\" />\n <ng-container [ngTemplateOutlet]=\"linkList\" [ngTemplateOutletContext]=\"{ orient: 'left' }\" />\n <nav class=\"mt-auto\"><ng-container [ngTemplateOutlet]=\"actionsSlot\" /></nav>\n </aside>\n <main class=\"flex-1 overflow-auto\">\n <ng-container [ngTemplateOutlet]=\"contentSlot\" />\n </main>\n </div>\n}\n\n<!--<ng-container [ngTemplateOutlet]=\"linkList\" [ngTemplateOutletContext]=\"{ orient: location() }\" />-->\n", styles: ["@reference \"tailwindcss\";.img-logo{height:var(--m-menu-bar-height);aspect-ratio:1 / 1}aside.left{@apply w-(--m-menu-rail-width) p-(--m-menu-pad-x);@apply flex flex-col gap-4;@apply text-(--m-menu-fg);background:var(--m-menu-bg)}header.top{@apply flex gap-(--m-menu-gap) items-center;@apply h-(--m-menu-bar-height) px-(--m-menu-pad-x);@apply text-(--m-menu-fg);background:var(--m-menu-bg)}\n"], dependencies: [{ kind: "component", type: MenuItem, selector: "menu-item", inputs: ["link", "location"], outputs: ["onChildClick"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: RouterOutlet, selector: "router-outlet", inputs: ["name", "routerOutletData"], outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }, { kind: "component", type: Button, selector: "p-button", inputs: ["hostName", "type", "badge", "disabled", "raised", "rounded", "text", "plain", "outlined", "link", "tabindex", "size", "variant", "style", "styleClass", "badgeClass", "badgeSeverity", "ariaLabel", "autofocus", "iconPos", "icon", "label", "loading", "loadingIcon", "severity", "buttonProps", "fluid"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "component", type: Drawer, selector: "p-drawer", inputs: ["appendTo", "motionOptions", "blockScroll", "style", "styleClass", "ariaCloseLabel", "autoZIndex", "baseZIndex", "modal", "closeButtonProps", "dismissible", "showCloseIcon", "closeOnEscape", "transitionOptions", "visible", "position", "fullScreen", "header", "maskStyle", "closable"], outputs: ["onShow", "onHide", "visibleChange"] }, { kind: "component", type: Image, selector: "p-image", inputs: ["imageClass", "imageStyle", "styleClass", "src", "srcSet", "sizes", "previewImageSrc", "previewImageSrcSet", "previewImageSizes", "alt", "width", "height", "loading", "preview", "showTransitionOptions", "hideTransitionOptions", "modalEnterAnimation", "modalLeaveAnimation", "appendTo", "maskMotionOptions", "motionOptions"], outputs: ["onShow", "onHide", "onImageError"] }] });
86
+ }
87
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: MMenu, decorators: [{
88
+ type: Component,
89
+ args: [{ selector: 'm-menu', imports: [MenuItem, NgTemplateOutlet, RouterOutlet, Button, Drawer, Image, JsonPipe], template: "<!-- Fragment r\u00E9utilisable : liste de liens -->\n<ng-template #linkList let-orient=\"orient\">\n <nav class=\"flex\" [class.flex-row]=\"orient === 'top'\" [class.flex-col]=\"orient === 'left'\"\n [class.items-center]=\"orient === 'top'\"\n [style.gap]=\"orient === 'top' ? '0.5rem' : '0.25rem'\">\n @for (link of items(); track link.label) {\n <menu-item [link]=\"link\" [location]=\"orient\"\n (onChildClick)=\"drawerOpened.set(false)\" />\n }\n </nav>\n</ng-template>\n\n<!-- Fragments logo / actions / contenu avec fallback -->\n<ng-template #logoSlot>\n @let logo = logoTemplate();\n @if (logo) { <ng-container [ngTemplateOutlet]=\"logo\" /> }\n @else {\n @if (logoSrc()) {\n <!-- <img [src]=\"logoSrc()\" alt=\"\" class=\"img-logo\" />-->\n <p-image [src]=\"logoSrc()\" class=\"h-16 w-16 cursor-pointer flex items-center justify-center\" />\n }\n @else {\n <span class=\"font-bold text-lg px-2\">App</span>\n }\n }\n</ng-template>\n\n<ng-template #actionsSlot>\n @let actions = actionsTemplate();\n @if (actions) {\n <ng-container [ngTemplateOutlet]=\"actions\" [ngTemplateOutletContext]=\"{$implicit: userActions()}\" />\n }\n</ng-template>\n\n<ng-template #contentSlot>\n @let content = contentTemplate();\n @if (content) { <ng-container [ngTemplateOutlet]=\"content\" /> }\n @else { <router-outlet /> }\n</ng-template>\n\n@if (collapsed()) {\n <!-- ============ REPLI\u00C9 (mobile) : hamburger + drawer ============ -->\n <div class=\"h-screen flex flex-col text-(--m-menu-fg)\">\n <header class=\"flex items-center px-(--m-menu-pad-x)\n h-(--m-menu-bar-height) [background:var(--m-menu-bg)]\">\n <p-button variant=\"text\" icon=\"pi pi-bars\" styleClass=\"text-white!\"\n (click)=\"drawerOpened.set(true)\" />\n <div class=\"ml-2\"><ng-container [ngTemplateOutlet]=\"logoSlot\" /></div>\n <nav class=\"ml-auto\"><ng-container [ngTemplateOutlet]=\"actionsSlot\" /></nav>\n </header>\n\n <p-drawer [(visible)]=\"drawerOpened\" position=\"left\" [modal]=\"true\"\n styleClass=\"!border-0 w-[var(--m-menu-rail-width)]\">\n <ng-template #headless>\n <div class=\"h-full flex flex-col text-(--m-menu-fg)\n [background:var(--m-menu-bg)] p-(--m-menu-pad-x) gap-4\">\n <div class=\"flex items-center justify-between\">\n <ng-container [ngTemplateOutlet]=\"logoSlot\" />\n <p-button variant=\"text\" icon=\"pi pi-times\" styleClass=\"text-white!\"\n (click)=\"drawerOpened.set(false)\" />\n </div>\n <ng-container [ngTemplateOutlet]=\"linkList\" [ngTemplateOutletContext]=\"{ orient: 'left' }\" />\n <nav class=\"mt-auto\"><ng-container [ngTemplateOutlet]=\"actionsSlot\" /></nav>\n </div>\n </ng-template>\n </p-drawer>\n\n <main class=\"flex-1 overflow-auto\">\n <ng-container [ngTemplateOutlet]=\"contentSlot\" />\n </main>\n </div>\n}\n\n@else if (location() === 'top') {\n <!-- ============ TOP : barre horizontale ============ -->\n <div class=\"h-screen flex flex-col\">\n <header class=\"top\">\n <ng-container [ngTemplateOutlet]=\"logoSlot\" />\n <ng-container [ngTemplateOutlet]=\"linkList\" [ngTemplateOutletContext]=\"{ orient: 'top' }\" />\n <nav class=\"ml-auto flex flex-row items-center\"><ng-container [ngTemplateOutlet]=\"actionsSlot\" /></nav>\n </header>\n <main class=\"flex-1 overflow-auto\">\n <ng-container [ngTemplateOutlet]=\"contentSlot\" />\n </main>\n </div>\n}\n\n@else {\n <!-- ============ LEFT : rail vertical ============ -->\n <div class=\"h-screen flex flex-row\">\n <aside class=\"left\">\n <ng-container [ngTemplateOutlet]=\"logoSlot\" />\n <ng-container [ngTemplateOutlet]=\"linkList\" [ngTemplateOutletContext]=\"{ orient: 'left' }\" />\n <nav class=\"mt-auto\"><ng-container [ngTemplateOutlet]=\"actionsSlot\" /></nav>\n </aside>\n <main class=\"flex-1 overflow-auto\">\n <ng-container [ngTemplateOutlet]=\"contentSlot\" />\n </main>\n </div>\n}\n\n<!--<ng-container [ngTemplateOutlet]=\"linkList\" [ngTemplateOutletContext]=\"{ orient: location() }\" />-->\n", styles: ["@reference \"tailwindcss\";.img-logo{height:var(--m-menu-bar-height);aspect-ratio:1 / 1}aside.left{@apply w-(--m-menu-rail-width) p-(--m-menu-pad-x);@apply flex flex-col gap-4;@apply text-(--m-menu-fg);background:var(--m-menu-bg)}header.top{@apply flex gap-(--m-menu-gap) items-center;@apply h-(--m-menu-bar-height) px-(--m-menu-pad-x);@apply text-(--m-menu-fg);background:var(--m-menu-bg)}\n"] }]
90
+ }], propDecorators: { logoTemplate: [{ type: i0.ContentChild, args: ['logo', { isSignal: true }] }], actionsTemplate: [{ type: i0.ContentChild, args: ['actions', { isSignal: true }] }], contentTemplate: [{ type: i0.ContentChild, args: ['content', { isSignal: true }] }] } });
91
+
92
+ /*
93
+ * Public API Surface of menu
94
+ */
95
+ // export * from './lib/container/menu';
96
+ // export * from './lib/components/m-menu-vertical/m-menu-vertical';
97
+ // export * from './lib/components/m-menu-horizontal/m-menu-horizontal';
98
+ // export * from './lib/providers/menu-config';
99
+ // export * from './lib/styles/m-menu.theme'
100
+
101
+ /**
102
+ * Generated bundle index. Do not edit.
103
+ */
104
+
105
+ export { DEFAULT_MENU_CONFIG, MENU_CONFIG, MMenu, MenuConfigService, provideMenu };
106
+ //# sourceMappingURL=ovyn-menu.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ovyn-menu.mjs","sources":["../../../projects/menu/src/lib/menu.provider.ts","../../../projects/menu/src/lib/menu-config.service.ts","../../../projects/menu/src/lib/menu-item/menu-item.ts","../../../projects/menu/src/lib/menu-item/menu-item.html","../../../projects/menu/src/lib/m-menu/m-menu.ts","../../../projects/menu/src/lib/m-menu/m-menu.html","../../../projects/menu/src/public-api.ts","../../../projects/menu/src/ovyn-menu.ts"],"sourcesContent":["import { MenuLink, MenuLocation } from './menu.model';\nimport {\n EnvironmentProviders,\n InjectionToken,\n makeEnvironmentProviders,\n Provider,\n} from '@angular/core';\nimport { MenuConfigService } from './menu-config.service';\nimport { MenuItem } from './menu-item/menu-item';\n\nexport interface MenuConfig {\n location: MenuLocation;\n links: MenuLink[];\n collapseBreakpoint: number;\n logoSrc?: string;\n userActions?: MenuLink[];\n}\n\nexport const MENU_CONFIG = new InjectionToken<MenuConfig>('MENU_CONFIG');\n\nexport const DEFAULT_MENU_CONFIG: MenuConfig = {\n location:'top',\n links: [],\n collapseBreakpoint: 768,\n};\n\nexport const provideMenu = (config: Partial<MenuConfig>): Provider => {\n return ([\n { provide: MENU_CONFIG, useValue: config },\n MenuConfigService\n ])\n}\n","import { inject, Injectable, signal } from '@angular/core';\r\nimport { BreakpointObserver } from '@angular/cdk/layout';\r\nimport { MenuLink, MenuLocation } from './menu.model';\r\nimport { toSignal } from '@angular/core/rxjs-interop';\r\nimport { map } from 'rxjs';\r\nimport { MENU_CONFIG } from './menu.provider';\r\n\r\n@Injectable({ providedIn: 'root' })\r\nexport class MenuConfigService {\r\n private readonly $config = inject(MENU_CONFIG);\r\n private readonly $breakpoint = inject(BreakpointObserver);\r\n\r\n readonly location = signal<MenuLocation>(this.$config.location ?? 'top');\r\n readonly links = signal<MenuLink[]>(this.$config.links ?? []);\r\n readonly userActions = signal<MenuLink[]>(this.$config.userActions ?? []);\r\n readonly logoSrc = signal<string | undefined>(this.$config.logoSrc);\r\n\r\n readonly collapsed = toSignal(\r\n this.$breakpoint.observe(`(max-width: ${this.$config.collapseBreakpoint - 0.02}px)`).pipe(map((result) => result.matches)),\r\n { initialValue: false }\r\n );\r\n\r\n setLocation(location: MenuLocation) {\r\n this.location.set(location);\r\n }\r\n setLinks(links: MenuLink[]) {\r\n this.links.set(links);\r\n }\r\n setUserActions(actions: MenuLink[]) {\r\n this.userActions.set(actions);\r\n }\r\n}\r\n","import { Component, input, output, signal } from '@angular/core';\nimport { MenuLink, MenuLocation } from '../menu.model';\nimport { RouterLink, RouterLinkActive } from '@angular/router';\nimport { Ripple } from 'primeng/ripple';\nimport { Popover } from 'primeng/popover';\n\n@Component({\n selector: 'menu-item',\n imports: [RouterLink, Ripple, RouterLinkActive, Popover],\n templateUrl: './menu-item.html',\n styleUrl: './menu-item.css',\n})\nexport class MenuItem {\n readonly linkInput = input.required<MenuLink>({ alias: 'link' });\n readonly location = input<MenuLocation>();\n\n onChildClickEvent = output<MenuLink>({ alias: 'onChildClick' });\n\n readonly open = signal(false);\n\n protected onChildClick(link: MenuLink) {\n this.onChildClickEvent.emit(link);\n }\n}\n","<!-- Feuille : lien simple -->\n@let link = linkInput();\n@if (!link.children?.length) {\n <a pRipple\n [routerLink]=\"link.route\"\n [routerLinkActive]=\"'bg-[var(--m-menu-item-active)]! font-semibold'\"\n [attr.aria-disabled]=\"link.disabled || null\"\n class=\"flex items-center gap-2 no-underline text-inherit whitespace-nowrap\n rounded-(--m-menu-item-radius)\n px-(--m-menu-item-pad-x) py-(--m-menu-item-pad-y)\n hover:bg-(--m-menu-item-hover) transition-colors cursor-pointer\n aria-disabled:opacity-40 aria-disabled:pointer-events-none\"\n (click)=\"onChildClick(link)\">\n @if (link.icon) { <i [class]=\"link.icon\" class=\"shrink-0\"></i> }\n <span class=\"flex-1\">{{ link.label }}</span>\n @if (link.badge != null) {\n <span class=\"text-xs px-2 py-0.5 rounded-full bg-(--m-menu-item-hover)\">\n {{ link.badge }}</span>\n }\n </a>\n}\n@else {\n <!-- Branche avec enfants -->\n <!-- TOP : bouton + popover dropdown -->\n @if (location() === 'top') {\n <button pRipple type=\"button\"\n class=\"flex items-center gap-2 whitespace-nowrap\n rounded-(--m-menu-item-radius)\n px-(--m-menu-item-pad-x) py-(--m-menu-item-pad-y)\n hover:bg-(--m-menu-item-hover) transition-colors cursor-pointer\n text-inherit bg-transparent border-0\"\n (click)=\"pop.toggle($event)\">\n @if (link.icon) { <i [class]=\"link.icon\"></i> }\n <span>{{ link.label }}</span>\n <i class=\"pi pi-angle-down text-xl\"></i>\n </button>\n\n <p-popover #pop styleClass=\"m-menu-panel\">\n <div class=\"flex flex-col gap-0.5 min-w-48\n text-(--m-menu-panel-fg)\">\n @for (child of link.children; track child.label) {\n <menu-item [link]=\"child\" location=\"top\"\n (onChildClick)=\"onChildClick($event); pop.hide()\" />\n }\n </div>\n </p-popover>\n }\n @else {\n <!-- LEFT : en-tête cliquable + accordéon inline -->\n <button pRipple type=\"button\"\n class=\"w-full flex items-center gap-2\n rounded-(--m-menu-item-radius)\n px-(--m-menu-item-pad-x) py-(--m-menu-item-pad-y)\n hover:bg-(--m-menu-item-hover) transition-colors cursor-pointer\n text-inherit bg-transparent border-0\"\n (click)=\"open.set(!open())\">\n @if (link.icon) { <i [class]=\"link.icon\"></i> }\n <span class=\"flex-1 text-left\">{{ link.label }}</span>\n <i class=\"pi text-xs transition-transform\"\n [class.pi-angle-down]=\"!open()\" [class.pi-angle-up]=\"open()\"></i>\n </button>\n\n @if (open()) {\n <div class=\"flex flex-col gap-0.5 pl-4 mt-0.5\">\n @for (child of link.children; track child.label) {\n <menu-item [link]=\"child\" location=\"left\"\n (onChildClick)=\"onChildClickEvent.emit($event)\" />\n }\n </div>\n }\n }\n}\n","import { Component, contentChild, inject, input, linkedSignal, signal, TemplateRef } from '@angular/core';\nimport { MenuConfigService } from '../menu-config.service';\nimport { MenuItem } from '../menu-item/menu-item';\nimport { JsonPipe, NgTemplateOutlet } from '@angular/common';\nimport { RouterOutlet } from '@angular/router';\nimport { Button } from 'primeng/button';\nimport { Drawer } from 'primeng/drawer';\nimport { Image } from 'primeng/image';\nimport { MenuLink } from '../menu.model';\n\n@Component({\n selector: 'm-menu',\n imports: [MenuItem, NgTemplateOutlet, RouterOutlet, Button, Drawer, Image, JsonPipe],\n templateUrl: './m-menu.html',\n styleUrl: './m-menu.css',\n})\nexport class MMenu {\n private readonly $config = inject(MenuConfigService);\n\n logoTemplate = contentChild<TemplateRef<unknown>>('logo');\n actionsTemplate = contentChild<TemplateRef<any>>('actions');\n contentTemplate = contentChild<TemplateRef<unknown>>('content');\n\n readonly logoSrc = this.$config.logoSrc;\n readonly items = this.$config.links;\n readonly location = this.$config.location;\n readonly collapsed = this.$config.collapsed;\n readonly userActions = this.$config.userActions;\n drawerOpened = signal<boolean>(false);\n\n readonly renderLocation = linkedSignal({\n source: () => ({\n collapsed: this.collapsed(),\n location: this.location(),\n }),\n computation: ({ collapsed, location }) => (collapsed ? 'left' : location),\n });\n}\n","<!-- Fragment réutilisable : liste de liens -->\n<ng-template #linkList let-orient=\"orient\">\n <nav class=\"flex\" [class.flex-row]=\"orient === 'top'\" [class.flex-col]=\"orient === 'left'\"\n [class.items-center]=\"orient === 'top'\"\n [style.gap]=\"orient === 'top' ? '0.5rem' : '0.25rem'\">\n @for (link of items(); track link.label) {\n <menu-item [link]=\"link\" [location]=\"orient\"\n (onChildClick)=\"drawerOpened.set(false)\" />\n }\n </nav>\n</ng-template>\n\n<!-- Fragments logo / actions / contenu avec fallback -->\n<ng-template #logoSlot>\n @let logo = logoTemplate();\n @if (logo) { <ng-container [ngTemplateOutlet]=\"logo\" /> }\n @else {\n @if (logoSrc()) {\n <!-- <img [src]=\"logoSrc()\" alt=\"\" class=\"img-logo\" />-->\n <p-image [src]=\"logoSrc()\" class=\"h-16 w-16 cursor-pointer flex items-center justify-center\" />\n }\n @else {\n <span class=\"font-bold text-lg px-2\">App</span>\n }\n }\n</ng-template>\n\n<ng-template #actionsSlot>\n @let actions = actionsTemplate();\n @if (actions) {\n <ng-container [ngTemplateOutlet]=\"actions\" [ngTemplateOutletContext]=\"{$implicit: userActions()}\" />\n }\n</ng-template>\n\n<ng-template #contentSlot>\n @let content = contentTemplate();\n @if (content) { <ng-container [ngTemplateOutlet]=\"content\" /> }\n @else { <router-outlet /> }\n</ng-template>\n\n@if (collapsed()) {\n <!-- ============ REPLIÉ (mobile) : hamburger + drawer ============ -->\n <div class=\"h-screen flex flex-col text-(--m-menu-fg)\">\n <header class=\"flex items-center px-(--m-menu-pad-x)\n h-(--m-menu-bar-height) [background:var(--m-menu-bg)]\">\n <p-button variant=\"text\" icon=\"pi pi-bars\" styleClass=\"text-white!\"\n (click)=\"drawerOpened.set(true)\" />\n <div class=\"ml-2\"><ng-container [ngTemplateOutlet]=\"logoSlot\" /></div>\n <nav class=\"ml-auto\"><ng-container [ngTemplateOutlet]=\"actionsSlot\" /></nav>\n </header>\n\n <p-drawer [(visible)]=\"drawerOpened\" position=\"left\" [modal]=\"true\"\n styleClass=\"!border-0 w-[var(--m-menu-rail-width)]\">\n <ng-template #headless>\n <div class=\"h-full flex flex-col text-(--m-menu-fg)\n [background:var(--m-menu-bg)] p-(--m-menu-pad-x) gap-4\">\n <div class=\"flex items-center justify-between\">\n <ng-container [ngTemplateOutlet]=\"logoSlot\" />\n <p-button variant=\"text\" icon=\"pi pi-times\" styleClass=\"text-white!\"\n (click)=\"drawerOpened.set(false)\" />\n </div>\n <ng-container [ngTemplateOutlet]=\"linkList\" [ngTemplateOutletContext]=\"{ orient: 'left' }\" />\n <nav class=\"mt-auto\"><ng-container [ngTemplateOutlet]=\"actionsSlot\" /></nav>\n </div>\n </ng-template>\n </p-drawer>\n\n <main class=\"flex-1 overflow-auto\">\n <ng-container [ngTemplateOutlet]=\"contentSlot\" />\n </main>\n </div>\n}\n\n@else if (location() === 'top') {\n <!-- ============ TOP : barre horizontale ============ -->\n <div class=\"h-screen flex flex-col\">\n <header class=\"top\">\n <ng-container [ngTemplateOutlet]=\"logoSlot\" />\n <ng-container [ngTemplateOutlet]=\"linkList\" [ngTemplateOutletContext]=\"{ orient: 'top' }\" />\n <nav class=\"ml-auto flex flex-row items-center\"><ng-container [ngTemplateOutlet]=\"actionsSlot\" /></nav>\n </header>\n <main class=\"flex-1 overflow-auto\">\n <ng-container [ngTemplateOutlet]=\"contentSlot\" />\n </main>\n </div>\n}\n\n@else {\n <!-- ============ LEFT : rail vertical ============ -->\n <div class=\"h-screen flex flex-row\">\n <aside class=\"left\">\n <ng-container [ngTemplateOutlet]=\"logoSlot\" />\n <ng-container [ngTemplateOutlet]=\"linkList\" [ngTemplateOutletContext]=\"{ orient: 'left' }\" />\n <nav class=\"mt-auto\"><ng-container [ngTemplateOutlet]=\"actionsSlot\" /></nav>\n </aside>\n <main class=\"flex-1 overflow-auto\">\n <ng-container [ngTemplateOutlet]=\"contentSlot\" />\n </main>\n </div>\n}\n\n<!--<ng-container [ngTemplateOutlet]=\"linkList\" [ngTemplateOutletContext]=\"{ orient: location() }\" />-->\n","/*\n * Public API Surface of menu\n */\n\n// export * from './lib/container/menu';\n// export * from './lib/components/m-menu-vertical/m-menu-vertical';\n// export * from './lib/components/m-menu-horizontal/m-menu-horizontal';\n// export * from './lib/providers/menu-config';\n// export * from './lib/styles/m-menu.theme'\n\nexport * from './lib/m-menu/m-menu';\nexport * from './lib/menu-config.service';\nexport * from './lib/menu.model';\nexport * from './lib/menu.provider';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;;;;MAkBa,WAAW,GAAG,IAAI,cAAc,CAAa,aAAa;AAEhE,MAAM,mBAAmB,GAAe;AAC7C,IAAA,QAAQ,EAAC,KAAK;AACd,IAAA,KAAK,EAAE,EAAE;AACT,IAAA,kBAAkB,EAAE,GAAG;;AAGlB,MAAM,WAAW,GAAG,CAAC,MAA2B,KAAc;AACnE,IAAA,QAAQ;AACN,QAAA,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,EAAE;QAC1C;AACD,KAAA;AACH;;MCvBa,iBAAiB,CAAA;AACX,IAAA,OAAO,GAAG,MAAM,CAAC,WAAW,CAAC;AAC7B,IAAA,WAAW,GAAG,MAAM,CAAC,kBAAkB,CAAC;IAEhD,QAAQ,GAAG,MAAM,CAAe,IAAI,CAAC,OAAO,CAAC,QAAQ,IAAI,KAAK,EAAA,IAAA,SAAA,GAAA,CAAA,EAAA,SAAA,EAAA,UAAA,EAAA,CAAA,GAAA,EAAA,CAAA,CAAC;IAC/D,KAAK,GAAG,MAAM,CAAa,IAAI,CAAC,OAAO,CAAC,KAAK,IAAI,EAAE,EAAA,IAAA,SAAA,GAAA,CAAA,EAAA,SAAA,EAAA,OAAA,EAAA,CAAA,GAAA,EAAA,CAAA,CAAC;IACpD,WAAW,GAAG,MAAM,CAAa,IAAI,CAAC,OAAO,CAAC,WAAW,IAAI,EAAE,EAAA,IAAA,SAAA,GAAA,CAAA,EAAA,SAAA,EAAA,aAAA,EAAA,CAAA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G;AAEH;AACA;AACA;AACA;AACA;;ACRA;;AAEG;;;;"}
package/package.json ADDED
@@ -0,0 +1,48 @@
1
+ {
2
+ "name": "@ovyn/menu",
3
+ "version": "0.3.0",
4
+ "peerDependencies": {
5
+ "@angular/common": "^21.2.0",
6
+ "@angular/core": "^21.2.0",
7
+ "@primeuix/themes": "^2.0.3",
8
+ "@angular/cdk": "^21.2.0",
9
+ "primeng": "^21.1.3",
10
+ "tailwindcss-primeui": "^0.6.1"
11
+ },
12
+ "exports": {
13
+ ".": {
14
+ "types": "./types/ovyn-menu.d.ts",
15
+ "esm": "./esm2022/ovyn-ng-menu.mjs",
16
+ "default": "./fesm2022/ovyn-menu.mjs"
17
+ },
18
+ "./styles/menu-theme.css": {
19
+ "style": "./styles/menu-theme.css",
20
+ "default": "./styles/menu-theme.css"
21
+ },
22
+ "./package.json": {
23
+ "default": "./package.json"
24
+ }
25
+ },
26
+ "dependencies": {
27
+ "tslib": "^2.3.0"
28
+ },
29
+ "keywords": [
30
+ "ng",
31
+ "angular",
32
+ "primeng",
33
+ "menu"
34
+ ],
35
+ "author": "Flavian Ovyn",
36
+ "license": "MIT",
37
+ "repository": {
38
+ "type": "git",
39
+ "url": "git+https://gitlab.com/fovyn-private/ovyn-lib/-/tree/main/projects/menu.git"
40
+ },
41
+ "bugs": {
42
+ "url": "https://gitlab.com/fovyn-private/ovyn-lib.git/issues"
43
+ },
44
+ "homepage": "https://gitlab.com/fovyn-private/ovyn-lib/-/tree/main/projects/menu#readme",
45
+ "sideEffects": false,
46
+ "module": "fesm2022/ovyn-menu.mjs",
47
+ "typings": "types/ovyn-menu.d.ts"
48
+ }
@@ -0,0 +1,42 @@
1
+ @import 'tailwindcss';
2
+
3
+ @layer primeng;
4
+
5
+ :root {
6
+ /* Alias applicatifs → tokens du preset, avec valeur par défaut en fallback */
7
+ --m-menu-bar-height: var(--p-menu-bar-height, 4rem);
8
+ --m-menu-rail-width: var(--p-menu-rail-width, 16rem);
9
+ --m-menu-gap: var(--p-menu-gap, calc(var(--spacing, 0.5rem) * 4));
10
+ --m-menu-pad-x: var(--p-menu-pad-x, calc(var(--spacing, 0.5rem) * 2));
11
+
12
+ --m-menu-bg: var(--p-menu-bg, linear-gradient(90deg, #63c1c9 0%, #82c9a0 45%, #bdd977 100%));
13
+ --m-menu-fg: var(--p-menu-fg, #ffffff);
14
+
15
+ --m-menu-item-radius: var(--p-menu-item-radius, var(--spacing, 0.5rem));
16
+ --m-menu-item-padx: var(--p-menu-item-pad-x, calc(var(--spacing) * 1.5));
17
+ --m-menu-item-pady: var(--p-menu-item-pad-y, var(--spacing, 0.5rem));
18
+ --m-menu-item-hover: var(--p-menu-item-hover, rgb(255 255 255 / 0.15));
19
+ --m-menu-item-active: var(--p-menu-item-active, rgb(255 255 255 / 0.24));
20
+
21
+ --m-menu-panel-bg: var(--p-menu-panel-bg, #1e293b);
22
+ --m-menu-panel-fg: var(--p-menu-panel-fg, #f1f5f9);
23
+ --m-menu-panel-radius: var(--p-menu-panel-radius, calc(var(--spacing, 0.5rem) * 1.5));
24
+
25
+ /* Pas un token CSS runtime (media query) → reste en dur */
26
+ --m-menu-breakpoint: 768px;
27
+ }
28
+
29
+ @layer primeng {
30
+ .m-menu-panel.p-popover {
31
+ background: var(--m-menu-panel-bg);
32
+ color: var(--m-menu-panel-fg);
33
+ border: 0;
34
+ border-radius: var(--m-menu-panel-radius);
35
+ }
36
+ .m-menu-panel .p-popover-content { padding: var(--m-menu-item-padx) var(--m-menu-item-pady); }
37
+
38
+ .m-menu-panel menu-item a:hover,
39
+ .m-menu-panel menu-item button:hover {
40
+ background: rgb(255 255 255 / 0.08);
41
+ }
42
+ }
@@ -0,0 +1,71 @@
1
+ import * as _ovyn_menu from '@ovyn/menu';
2
+ import * as _angular_core from '@angular/core';
3
+ import { TemplateRef, InjectionToken, Provider } from '@angular/core';
4
+
5
+ type MenuLocation = 'top' | 'left';
6
+ interface MenuLink {
7
+ label: string;
8
+ icon?: string;
9
+ route?: string | string[];
10
+ badge?: string | number;
11
+ disabled?: boolean;
12
+ visible?: boolean;
13
+ children?: MenuLink[];
14
+ }
15
+ interface MenuThemeConfig {
16
+ barHeight: string;
17
+ railWidth: string;
18
+ bg: string;
19
+ fg: string;
20
+ itemHover: string;
21
+ itemActive: string;
22
+ panelBg: string;
23
+ panelFg: string;
24
+ panelRadius: string;
25
+ }
26
+ type MenuTheme = Partial<MenuThemeConfig>;
27
+
28
+ declare class MMenu {
29
+ private readonly $config;
30
+ logoTemplate: _angular_core.Signal<TemplateRef<unknown> | undefined>;
31
+ actionsTemplate: _angular_core.Signal<TemplateRef<any> | undefined>;
32
+ contentTemplate: _angular_core.Signal<TemplateRef<unknown> | undefined>;
33
+ readonly logoSrc: _angular_core.WritableSignal<string | undefined>;
34
+ readonly items: _angular_core.WritableSignal<MenuLink[]>;
35
+ readonly location: _angular_core.WritableSignal<_ovyn_menu.MenuLocation>;
36
+ readonly collapsed: _angular_core.Signal<boolean>;
37
+ readonly userActions: _angular_core.WritableSignal<MenuLink[]>;
38
+ drawerOpened: _angular_core.WritableSignal<boolean>;
39
+ readonly renderLocation: _angular_core.WritableSignal<_ovyn_menu.MenuLocation>;
40
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<MMenu, never>;
41
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<MMenu, "m-menu", never, {}, {}, ["logoTemplate", "actionsTemplate", "contentTemplate"], never, true, never>;
42
+ }
43
+
44
+ declare class MenuConfigService {
45
+ private readonly $config;
46
+ private readonly $breakpoint;
47
+ readonly location: _angular_core.WritableSignal<MenuLocation>;
48
+ readonly links: _angular_core.WritableSignal<MenuLink[]>;
49
+ readonly userActions: _angular_core.WritableSignal<MenuLink[]>;
50
+ readonly logoSrc: _angular_core.WritableSignal<string | undefined>;
51
+ readonly collapsed: _angular_core.Signal<boolean>;
52
+ setLocation(location: MenuLocation): void;
53
+ setLinks(links: MenuLink[]): void;
54
+ setUserActions(actions: MenuLink[]): void;
55
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<MenuConfigService, never>;
56
+ static ɵprov: _angular_core.ɵɵInjectableDeclaration<MenuConfigService>;
57
+ }
58
+
59
+ interface MenuConfig {
60
+ location: MenuLocation;
61
+ links: MenuLink[];
62
+ collapseBreakpoint: number;
63
+ logoSrc?: string;
64
+ userActions?: MenuLink[];
65
+ }
66
+ declare const MENU_CONFIG: InjectionToken<MenuConfig>;
67
+ declare const DEFAULT_MENU_CONFIG: MenuConfig;
68
+ declare const provideMenu: (config: Partial<MenuConfig>) => Provider;
69
+
70
+ export { DEFAULT_MENU_CONFIG, MENU_CONFIG, MMenu, MenuConfigService, provideMenu };
71
+ export type { MenuConfig, MenuLink, MenuLocation, MenuTheme, MenuThemeConfig };