@flxgde/gigamenu 0.7.0 → 0.8.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 +110 -10
- package/fesm2022/flxgde-gigamenu.mjs +67 -18
- package/fesm2022/flxgde-gigamenu.mjs.map +1 -1
- package/package.json +1 -1
- package/styles.css +2 -2
- package/types/flxgde-gigamenu.d.ts +56 -5
package/README.md
CHANGED
|
@@ -18,21 +18,41 @@ A keyboard-driven command palette menu for Angular applications. Inspired by VS
|
|
|
18
18
|
- **Dark mode**: Configurable class name support
|
|
19
19
|
- **Icon libraries**: Support for emoji and CSS icon classes (FontAwesome, PrimeIcons, etc.)
|
|
20
20
|
- **Type-safe**: Full TypeScript support with helper functions
|
|
21
|
-
- **Tailwind CSS**: Beautiful default styling
|
|
21
|
+
- **Tailwind CSS**: Beautiful default styling, themeable via CSS variables
|
|
22
22
|
|
|
23
23
|
## Installation
|
|
24
24
|
|
|
25
25
|
```bash
|
|
26
|
-
npm install gigamenu
|
|
26
|
+
npm install @flxgde/gigamenu
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
+
Peer dependencies: `@angular/common`, `@angular/core` and `@angular/router` (19 - 22).
|
|
30
|
+
|
|
31
|
+
### Styles
|
|
32
|
+
|
|
33
|
+
The component is styled with Tailwind CSS 4 utility classes. Pick one of the following:
|
|
34
|
+
|
|
35
|
+
- **Prebuilt CSS** (no Tailwind needed in your app): add the stylesheet to your global styles, e.g. in `angular.json`
|
|
36
|
+
(`"styles": ["node_modules/@flxgde/gigamenu/styles.css", ...]`) or in a CSS file:
|
|
37
|
+
```css
|
|
38
|
+
@import "@flxgde/gigamenu/styles.css";
|
|
39
|
+
```
|
|
40
|
+
- **Tailwind 4 in your app**: let Tailwind scan the package so the utilities are generated by your build:
|
|
41
|
+
```css
|
|
42
|
+
@import "tailwindcss";
|
|
43
|
+
@source "../node_modules/@flxgde/gigamenu/fesm2022";
|
|
44
|
+
```
|
|
45
|
+
(adjust the relative path to the location of your CSS file).
|
|
46
|
+
|
|
47
|
+
Colors, radius and dark mode are driven by CSS variables, see [Theming](#theming).
|
|
48
|
+
|
|
29
49
|
## Usage
|
|
30
50
|
|
|
31
51
|
### 1. Import the component
|
|
32
52
|
|
|
33
53
|
```typescript
|
|
34
54
|
import { Component, inject, OnInit } from '@angular/core';
|
|
35
|
-
import { GigamenuComponent, GigamenuService } from 'gigamenu';
|
|
55
|
+
import { GigamenuComponent, GigamenuService } from '@flxgde/gigamenu';
|
|
36
56
|
|
|
37
57
|
@Component({
|
|
38
58
|
selector: 'app-root',
|
|
@@ -46,6 +66,7 @@ export class App implements OnInit {
|
|
|
46
66
|
private readonly gigamenu = inject(GigamenuService);
|
|
47
67
|
|
|
48
68
|
ngOnInit(): void {
|
|
69
|
+
// The router is injected lazily, no setup needed (setRouter() is optional)
|
|
49
70
|
// Auto-discover routes from Angular Router
|
|
50
71
|
this.gigamenu.discoverRoutes();
|
|
51
72
|
}
|
|
@@ -76,6 +97,21 @@ this.gigamenu.registerPage({
|
|
|
76
97
|
});
|
|
77
98
|
```
|
|
78
99
|
|
|
100
|
+
Paths may contain a `#fragment` and a `?query` string and can be combined with `:param` placeholders:
|
|
101
|
+
|
|
102
|
+
```typescript
|
|
103
|
+
this.gigamenu.registerPage({
|
|
104
|
+
id: 'page:select-virtual-scroll',
|
|
105
|
+
label: 'Select: Virtual Scroll',
|
|
106
|
+
path: '/select?tab=api#virtual-scroll',
|
|
107
|
+
});
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
The path is parsed with `Router.parseUrl()` and navigated with `navigateByUrl()`. Parameter values are URL-encoded.
|
|
111
|
+
To scroll to the fragment, enable anchor scrolling in your router
|
|
112
|
+
(`provideRouter(routes, withInMemoryScrolling({ anchorScrolling: 'enabled' }))`).
|
|
113
|
+
Auto-discovered routes keep working as before.
|
|
114
|
+
|
|
79
115
|
### 4. Commands with Parameters
|
|
80
116
|
|
|
81
117
|
Commands can define parameters that are filled in step-by-step:
|
|
@@ -192,7 +228,7 @@ Customize the appearance of menu items, empty states, header, footer, or the ent
|
|
|
192
228
|
|
|
193
229
|
| Method | Description |
|
|
194
230
|
|--------|-------------|
|
|
195
|
-
| `setRouter(router)` |
|
|
231
|
+
| `setRouter(router)` | Optional: use a specific router instance (by default the router is injected lazily) |
|
|
196
232
|
| `open()` | Open the menu |
|
|
197
233
|
| `close()` | Close the menu |
|
|
198
234
|
| `toggle()` | Toggle menu visibility |
|
|
@@ -206,13 +242,34 @@ Customize the appearance of menu items, empty states, header, footer, or the ent
|
|
|
206
242
|
|
|
207
243
|
### Configuration
|
|
208
244
|
|
|
245
|
+
```typescript
|
|
246
|
+
this.gigamenu.configure({ frecency: false, showFooter: false, labels: { footerBrand: '' } });
|
|
247
|
+
```
|
|
248
|
+
|
|
209
249
|
```typescript
|
|
210
250
|
interface GigamenuConfig {
|
|
211
251
|
placeholder?: string; // Search input placeholder
|
|
212
252
|
maxResults?: number; // Maximum items to show (default: 10)
|
|
213
253
|
autoDiscoverRoutes?: boolean; // Auto-discover on init
|
|
214
254
|
argSeparator?: string; // Separator between args when passed to action
|
|
215
|
-
darkModeClass?: string; // CSS class
|
|
255
|
+
darkModeClass?: string; // CSS class on <html> that enables dark mode (default: 'dark')
|
|
256
|
+
autocompleteTabBehavior?: 'cycle' | 'accept-first'; // default: 'cycle'
|
|
257
|
+
autocompleteDismiss?: 'on-type' | 'manual'; // default: 'on-type'
|
|
258
|
+
frecency?: boolean; // Usage-based ranking + localStorage persistence (default: true)
|
|
259
|
+
showFooter?: boolean; // Footer with key hints and branding (default: true)
|
|
260
|
+
showCategoryTags?: boolean; // "page" / "command" tag on each item (default: true)
|
|
261
|
+
labels?: GigamenuLabels; // Override built-in texts
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
interface GigamenuLabels { // all optional, defaults in parentheses
|
|
265
|
+
pageBadge?: string; // icon fallback for pages ('P')
|
|
266
|
+
commandBadge?: string; // icon fallback for commands ('C')
|
|
267
|
+
pageTag?: string; // category tag ('page')
|
|
268
|
+
commandTag?: string; // category tag ('command')
|
|
269
|
+
paramHint?: string; // hint next to items with param autocomplete ('Tab')
|
|
270
|
+
footerBrand?: string; // branding in the footer, '' hides it ('gigamenu')
|
|
271
|
+
noResults?: string; // empty state ('No results found')
|
|
272
|
+
navigate?: string; params?: string; next?: string; select?: string; execute?: string; // footer key hints
|
|
216
273
|
}
|
|
217
274
|
```
|
|
218
275
|
|
|
@@ -324,7 +381,7 @@ Gigamenu uses intelligent ranking based on **frequency** and **recency** of sele
|
|
|
324
381
|
- Persists to localStorage for cross-session learning
|
|
325
382
|
- Auto-prunes low-scoring entries (max 100 terms, 10 items per term)
|
|
326
383
|
|
|
327
|
-
|
|
384
|
+
It works automatically. Set `frecency: false` in the config to disable ranking and persistence entirely (nothing is read from or written to localStorage).
|
|
328
385
|
|
|
329
386
|
### Parameter Color Coding
|
|
330
387
|
|
|
@@ -368,12 +425,55 @@ Filled parameter values in the breadcrumb are color-coded:
|
|
|
368
425
|
|
|
369
426
|
## Styling
|
|
370
427
|
|
|
371
|
-
|
|
428
|
+
See [Installation > Styles](#styles) for including the CSS.
|
|
429
|
+
|
|
430
|
+
### Dark mode
|
|
431
|
+
|
|
432
|
+
The panel is dark when `<html>` has the dark mode class (default `dark`, configurable via `darkModeClass`).
|
|
433
|
+
The class is observed, so toggling it at runtime updates the panel. The OS color scheme is not used.
|
|
372
434
|
|
|
373
435
|
```typescript
|
|
374
|
-
this.gigamenu.configure({
|
|
375
|
-
|
|
376
|
-
|
|
436
|
+
this.gigamenu.configure({ darkModeClass: 'dark-theme' });
|
|
437
|
+
```
|
|
438
|
+
|
|
439
|
+
### Theming
|
|
440
|
+
|
|
441
|
+
All colors and the radius are CSS custom properties. Set them on `gm-gigamenu` or `:root`; a variable you set applies
|
|
442
|
+
to light **and** dark mode (let your own tokens switch per theme). Unset variables keep the built-in light/dark defaults.
|
|
443
|
+
|
|
444
|
+
| Variable | Used for |
|
|
445
|
+
|----------|----------|
|
|
446
|
+
| `--gm-bg` | Panel background |
|
|
447
|
+
| `--gm-fg` | Primary text |
|
|
448
|
+
| `--gm-fg-muted` | Secondary text (descriptions, footer, ESC key) |
|
|
449
|
+
| `--gm-fg-subtle` | Placeholder, search icon, breadcrumb separators |
|
|
450
|
+
| `--gm-fg-icon` | Icon-class icons and the P/C badge text |
|
|
451
|
+
| `--gm-border` | Panel border and dividers |
|
|
452
|
+
| `--gm-hover-bg` / `--gm-selected-bg` | Hovered / selected item |
|
|
453
|
+
| `--gm-badge-bg` | P/C fallback icon badge |
|
|
454
|
+
| `--gm-kbd-bg` / `--gm-kbd-border` | Key caps and the param hint |
|
|
455
|
+
| `--gm-accent-bg` / `--gm-accent-hover-bg` / `--gm-accent-fg` | Breadcrumb action chip |
|
|
456
|
+
| `--gm-page-bg` / `--gm-page-fg` | "page" tag |
|
|
457
|
+
| `--gm-command-bg` / `--gm-command-fg` | "command" tag |
|
|
458
|
+
| `--gm-param-1` ... `--gm-param-5` | Parameter colors (cycled) |
|
|
459
|
+
| `--gm-radius` | Panel radius (items use this minus 0.25rem). Default `0.75rem` |
|
|
460
|
+
| `--gm-overlay` | Backdrop color. Default `rgb(0 0 0 / 50%)` |
|
|
461
|
+
|
|
462
|
+
Example, mapping to another design system's tokens:
|
|
463
|
+
|
|
464
|
+
```css
|
|
465
|
+
gm-gigamenu {
|
|
466
|
+
--gm-bg: var(--surface-card);
|
|
467
|
+
--gm-fg: var(--text-color);
|
|
468
|
+
--gm-fg-muted: var(--text-color-secondary);
|
|
469
|
+
--gm-border: var(--surface-border);
|
|
470
|
+
--gm-hover-bg: var(--surface-hover);
|
|
471
|
+
--gm-selected-bg: color-mix(in srgb, var(--primary-color) 12%, transparent);
|
|
472
|
+
--gm-accent-bg: color-mix(in srgb, var(--primary-color) 15%, transparent);
|
|
473
|
+
--gm-accent-fg: var(--primary-color);
|
|
474
|
+
--gm-radius: var(--border-radius);
|
|
475
|
+
--gm-overlay: rgb(0 0 0 / 40%);
|
|
476
|
+
}
|
|
377
477
|
```
|
|
378
478
|
|
|
379
479
|
## Architecture
|
|
@@ -1,15 +1,30 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { signal, computed, Injectable,
|
|
2
|
+
import { inject, Injector, signal, computed, Injectable, TemplateRef, Directive, PLATFORM_ID, Inject, viewChild, contentChild, DestroyRef, effect, untracked, HostListener, Component } from '@angular/core';
|
|
3
|
+
import { Router } from '@angular/router';
|
|
3
4
|
import { isPlatformBrowser, NgTemplateOutlet } from '@angular/common';
|
|
4
5
|
|
|
5
|
-
/** Colors for parameter highlighting */
|
|
6
|
+
/** Colors for parameter highlighting (themeable via --gm-param-1 ... --gm-param-5) */
|
|
6
7
|
const PARAM_COLORS = [
|
|
7
|
-
'text-
|
|
8
|
-
'text-
|
|
9
|
-
'text-
|
|
10
|
-
'text-
|
|
11
|
-
'text-
|
|
8
|
+
'text-(color:--_gm-param-1)',
|
|
9
|
+
'text-(color:--_gm-param-2)',
|
|
10
|
+
'text-(color:--_gm-param-3)',
|
|
11
|
+
'text-(color:--_gm-param-4)',
|
|
12
|
+
'text-(color:--_gm-param-5)',
|
|
12
13
|
];
|
|
14
|
+
const DEFAULT_LABELS = {
|
|
15
|
+
pageBadge: 'P',
|
|
16
|
+
commandBadge: 'C',
|
|
17
|
+
pageTag: 'page',
|
|
18
|
+
commandTag: 'command',
|
|
19
|
+
paramHint: 'Tab',
|
|
20
|
+
footerBrand: 'gigamenu',
|
|
21
|
+
noResults: 'No results found',
|
|
22
|
+
navigate: 'navigate',
|
|
23
|
+
params: 'params',
|
|
24
|
+
next: 'next',
|
|
25
|
+
select: 'select',
|
|
26
|
+
execute: 'execute',
|
|
27
|
+
};
|
|
13
28
|
const DEFAULT_CONFIG = {
|
|
14
29
|
placeholder: 'Search pages and commands...',
|
|
15
30
|
maxResults: 10,
|
|
@@ -18,6 +33,9 @@ const DEFAULT_CONFIG = {
|
|
|
18
33
|
darkModeClass: 'dark',
|
|
19
34
|
autocompleteTabBehavior: 'cycle',
|
|
20
35
|
autocompleteDismiss: 'on-type',
|
|
36
|
+
frecency: true,
|
|
37
|
+
showFooter: true,
|
|
38
|
+
showCategoryTags: true,
|
|
21
39
|
};
|
|
22
40
|
/**
|
|
23
41
|
* Helper function to define a command with type safety.
|
|
@@ -32,6 +50,7 @@ const DEFAULT_PROVIDER_OPTIONS = {
|
|
|
32
50
|
group: '',
|
|
33
51
|
};
|
|
34
52
|
class GigamenuService {
|
|
53
|
+
injector = inject(Injector);
|
|
35
54
|
_router;
|
|
36
55
|
_items = signal(new Map(), /* @ts-ignore */
|
|
37
56
|
...(ngDevMode ? [{ debugName: "_items" }] : /* istanbul ignore next */ []));
|
|
@@ -47,16 +66,14 @@ class GigamenuService {
|
|
|
47
66
|
isOpen = this._isOpen.asReadonly();
|
|
48
67
|
config = this._config.asReadonly();
|
|
49
68
|
/**
|
|
50
|
-
*
|
|
69
|
+
* Optionally set the router instance. By default the router is injected lazily
|
|
70
|
+
* on first use, so calling this is only needed to use a different instance.
|
|
51
71
|
*/
|
|
52
72
|
setRouter(router) {
|
|
53
73
|
this._router = router;
|
|
54
74
|
}
|
|
55
75
|
get router() {
|
|
56
|
-
|
|
57
|
-
throw new Error('GigamenuService: Router not set. Call setRouter() in your app initialization.');
|
|
58
|
-
}
|
|
59
|
-
return this._router;
|
|
76
|
+
return (this._router ??= this.injector.get(Router));
|
|
60
77
|
}
|
|
61
78
|
configure(config) {
|
|
62
79
|
this._config.update((current) => ({ ...current, ...config }));
|
|
@@ -139,16 +156,17 @@ class GigamenuService {
|
|
|
139
156
|
// Replace each parameter with corresponding arg value
|
|
140
157
|
paramsToReplace.forEach((param, index) => {
|
|
141
158
|
if (argValues[index]) {
|
|
142
|
-
path = path.replace(`:${param}`, argValues[index]);
|
|
159
|
+
path = path.replace(`:${param}`, encodeURIComponent(argValues[index]));
|
|
143
160
|
}
|
|
144
161
|
});
|
|
145
162
|
}
|
|
146
|
-
|
|
163
|
+
// Parse as a full URL so `#fragment` and `?query` parts are supported
|
|
164
|
+
this.router.navigateByUrl(this.router.parseUrl(path));
|
|
147
165
|
},
|
|
148
166
|
});
|
|
149
167
|
}
|
|
150
168
|
extractParamNames(path) {
|
|
151
|
-
const paramRegex = /:([
|
|
169
|
+
const paramRegex = /:([^/?#]+)/g;
|
|
152
170
|
const params = [];
|
|
153
171
|
let match;
|
|
154
172
|
while ((match = paramRegex.exec(path)) !== null) {
|
|
@@ -970,6 +988,7 @@ const DECAY_FACTOR = 0.9;
|
|
|
970
988
|
class FrecencyService {
|
|
971
989
|
data = {};
|
|
972
990
|
isBrowser;
|
|
991
|
+
gigamenu = inject(GigamenuService);
|
|
973
992
|
constructor(platformId) {
|
|
974
993
|
this.isBrowser = isPlatformBrowser(platformId);
|
|
975
994
|
this.load();
|
|
@@ -978,6 +997,8 @@ class FrecencyService {
|
|
|
978
997
|
* Record that an item was selected for a given search term.
|
|
979
998
|
*/
|
|
980
999
|
recordSelection(searchTerm, itemId) {
|
|
1000
|
+
if (!this.enabled)
|
|
1001
|
+
return;
|
|
981
1002
|
// Always record to global for overall frecency
|
|
982
1003
|
this.recordToKey(GLOBAL_KEY, itemId);
|
|
983
1004
|
// Also record to specific search term if provided
|
|
@@ -1015,6 +1036,8 @@ class FrecencyService {
|
|
|
1015
1036
|
*/
|
|
1016
1037
|
getScores(searchTerm) {
|
|
1017
1038
|
const scores = new Map();
|
|
1039
|
+
if (!this.enabled)
|
|
1040
|
+
return scores;
|
|
1018
1041
|
const normalizedTerm = this.normalizeTerm(searchTerm);
|
|
1019
1042
|
// If no search term, return global scores
|
|
1020
1043
|
if (!normalizedTerm) {
|
|
@@ -1052,6 +1075,8 @@ class FrecencyService {
|
|
|
1052
1075
|
* Returns itemId if there's a strong match, null otherwise.
|
|
1053
1076
|
*/
|
|
1054
1077
|
getTopMatch(searchTerm) {
|
|
1078
|
+
if (!this.enabled)
|
|
1079
|
+
return null;
|
|
1055
1080
|
const normalizedTerm = this.normalizeTerm(searchTerm);
|
|
1056
1081
|
if (!normalizedTerm)
|
|
1057
1082
|
return null;
|
|
@@ -1066,6 +1091,10 @@ class FrecencyService {
|
|
|
1066
1091
|
}
|
|
1067
1092
|
return null;
|
|
1068
1093
|
}
|
|
1094
|
+
/** Disabled via `frecency: false` in the config (reactive, reads a signal). */
|
|
1095
|
+
get enabled() {
|
|
1096
|
+
return this.gigamenu.config().frecency !== false;
|
|
1097
|
+
}
|
|
1069
1098
|
calculateScore(entry) {
|
|
1070
1099
|
const ageInHours = (Date.now() - entry.lastUsed) / (60 * 60 * 24);
|
|
1071
1100
|
const recencyScore = Math.pow(DECAY_FACTOR, ageInHours);
|
|
@@ -1142,6 +1171,14 @@ class GigamenuComponent {
|
|
|
1142
1171
|
...(ngDevMode ? [{ debugName: "footerTemplate" }] : /* istanbul ignore next */ []));
|
|
1143
1172
|
panelTemplate = contentChild(GigamenuPanelTemplate, /* @ts-ignore */
|
|
1144
1173
|
...(ngDevMode ? [{ debugName: "panelTemplate" }] : /* istanbul ignore next */ []));
|
|
1174
|
+
// Dark mode: mirrors the configured dark mode class on <html>
|
|
1175
|
+
dark = signal(false, /* @ts-ignore */
|
|
1176
|
+
...(ngDevMode ? [{ debugName: "dark" }] : /* istanbul ignore next */ []));
|
|
1177
|
+
labels = computed(() => ({
|
|
1178
|
+
...DEFAULT_LABELS,
|
|
1179
|
+
...this.service.config().labels,
|
|
1180
|
+
}), /* @ts-ignore */
|
|
1181
|
+
...(ngDevMode ? [{ debugName: "labels" }] : /* istanbul ignore next */ []));
|
|
1145
1182
|
// Core state signals
|
|
1146
1183
|
query = signal('', /* @ts-ignore */
|
|
1147
1184
|
...(ngDevMode ? [{ debugName: "query" }] : /* istanbul ignore next */ []));
|
|
@@ -1250,6 +1287,18 @@ class GigamenuComponent {
|
|
|
1250
1287
|
this.service = service;
|
|
1251
1288
|
this.frecency = frecency;
|
|
1252
1289
|
this.isBrowser = isPlatformBrowser(platformId);
|
|
1290
|
+
// Track the dark mode class on <html> (class name is configurable)
|
|
1291
|
+
if (this.isBrowser) {
|
|
1292
|
+
const root = document.documentElement;
|
|
1293
|
+
const sync = () => this.dark.set(root.classList.contains(this.service.config().darkModeClass ?? 'dark'));
|
|
1294
|
+
const observer = new MutationObserver(sync);
|
|
1295
|
+
observer.observe(root, { attributes: true, attributeFilter: ['class'] });
|
|
1296
|
+
inject(DestroyRef).onDestroy(() => observer.disconnect());
|
|
1297
|
+
effect(() => {
|
|
1298
|
+
this.service.config();
|
|
1299
|
+
untracked(sync);
|
|
1300
|
+
});
|
|
1301
|
+
}
|
|
1253
1302
|
// Focus effect
|
|
1254
1303
|
effect(() => {
|
|
1255
1304
|
if (this.service.isOpen() && this.isBrowser) {
|
|
@@ -1679,11 +1728,11 @@ class GigamenuComponent {
|
|
|
1679
1728
|
}
|
|
1680
1729
|
}
|
|
1681
1730
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: GigamenuComponent, deps: [{ token: GigamenuService }, { token: FrecencyService }, { token: PLATFORM_ID }], target: i0.ɵɵFactoryTarget.Component });
|
|
1682
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: GigamenuComponent, isStandalone: true, selector: "gm-gigamenu", host: { listeners: { "document:keydown": "onGlobalKeydown($event)" } }, queries: [{ propertyName: "itemTemplate", first: true, predicate: GigamenuItemTemplate, descendants: true, isSignal: true }, { propertyName: "emptyTemplate", first: true, predicate: GigamenuEmptyTemplate, descendants: true, isSignal: true }, { propertyName: "headerTemplate", first: true, predicate: GigamenuHeaderTemplate, descendants: true, isSignal: true }, { propertyName: "footerTemplate", first: true, predicate: GigamenuFooterTemplate, descendants: true, isSignal: true }, { propertyName: "panelTemplate", first: true, predicate: GigamenuPanelTemplate, descendants: true, isSignal: true }], viewQueries: [{ propertyName: "searchInput", first: true, predicate: ["searchInput"], descendants: true, isSignal: true }, { propertyName: "listContainer", first: true, predicate: ["listContainer"], descendants: true, isSignal: true }], ngImport: i0, template: "@if (service.isOpen()) {\n<div\n class=\"fixed inset-0 z-50 flex items-stretch justify-center sm:items-start sm:pt-[15vh]\"\n (click)=\"onBackdropClick($event)\"\n>\n <div class=\"fixed inset-0 bg-black/50 backdrop-blur-sm\"></div>\n\n <!-- Custom panel template -->\n @if (panelTemplate(); as pt) {\n <ng-container\n [ngTemplateOutlet]=\"pt.template\"\n [ngTemplateOutletContext]=\"getPanelContext()\"\n ></ng-container>\n } @else {\n <!-- Default panel -->\n <div\n class=\"relative z-10 w-full flex flex-col overflow-hidden border border-neutral-200 bg-white shadow-2xl dark:border-neutral-700 dark:bg-neutral-900 sm:max-w-xl sm:min-h-50 sm:flex-none sm:rounded-xl\"\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label=\"Command menu\"\n >\n <!-- Header -->\n @if (headerTemplate(); as ht) {\n <ng-container\n [ngTemplateOutlet]=\"ht.template\"\n [ngTemplateOutletContext]=\"getHeaderContext()\"\n ></ng-container>\n } @else {\n <div class=\"border-b border-neutral-200 dark:border-neutral-700\">\n <!-- Breadcrumb (when action is locked) -->\n @if (lockedAction(); as action) {\n <div class=\"flex flex-wrap items-center gap-1 px-4 py-2 text-sm\">\n <button\n type=\"button\"\n (click)=\"unlockActionFromUI()\"\n class=\"inline-flex items-center gap-1.5 rounded-md bg-blue-100 px-2 py-1 font-medium text-blue-800 hover:bg-blue-200 dark:bg-blue-900/40 dark:text-blue-300 dark:hover:bg-blue-900/60\"\n >\n @if (action.icon) {\n <span>{{ action.icon }}</span>\n }\n {{ action.label }}\n </button>\n @for (value of paramValues(); track $index) {\n <span class=\"text-neutral-400\">\u203A</span>\n <button\n type=\"button\"\n (click)=\"goToParam($index)\"\n [class]=\"'rounded-md px-2 py-1 font-medium hover:opacity-80 ' + getParamColor($index)\"\n >\n <span class=\"text-xs opacity-60\">{{ action.params?.[$index] }}:</span>\n {{ value }}\n </button>\n }\n @if (currentParamName(); as paramName) {\n <span class=\"text-neutral-400\">\u203A</span>\n <span class=\"text-neutral-500 dark:text-neutral-400 italic\">{{ paramName }}:</span>\n }\n </div>\n }\n\n <!-- Search input row -->\n <div class=\"flex items-center px-4\">\n <svg\n class=\"h-5 w-5 text-neutral-400\"\n fill=\"none\"\n stroke=\"currentColor\"\n viewBox=\"0 0 24 24\"\n >\n <path\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n stroke-width=\"2\"\n d=\"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z\"\n />\n </svg>\n <input\n #searchInput\n type=\"text\"\n [placeholder]=\"lockedAction() ? (currentParamName() ?? 'Enter value...') : service.config().placeholder\"\n [value]=\"query()\"\n (input)=\"onQueryChange($event)\"\n (keydown)=\"onInputKeydown($event)\"\n class=\"w-full px-3 py-4 text-base text-neutral-900 placeholder-neutral-400 outline-none dark:text-neutral-100 bg-transparent\"\n />\n <kbd\n class=\"rounded border border-neutral-200 bg-neutral-100 px-1.5 py-0.5 text-xs text-neutral-500 dark:border-neutral-600 dark:bg-neutral-800 dark:text-neutral-400\"\n >\n ESC\n </kbd>\n </div>\n </div>\n }\n\n <!-- Items list -->\n <div #listContainer class=\"flex-1 overflow-y-auto p-2 sm:flex-none sm:max-h-80\">\n @if (displayItems().length === 0) {\n <!-- Empty state -->\n @if (emptyTemplate(); as et) {\n <ng-container\n [ngTemplateOutlet]=\"et.template\"\n [ngTemplateOutletContext]=\"getEmptyContext()\"\n ></ng-container>\n } @else {\n <div class=\"px-3 py-8 text-center text-neutral-500\">\n @if (lockedAction()) {\n @if (hasAutocomplete()) {\n Type to search...\n } @else {\n Enter a value and press Tab or Enter\n }\n } @else {\n No results found\n }\n </div>\n }\n } @else {\n @for (item of displayItems(); track item.id; let i = $index) {\n <!-- Custom item template -->\n @if (itemTemplate(); as it) {\n <ng-container\n [ngTemplateOutlet]=\"it.template\"\n [ngTemplateOutletContext]=\"getItemContext(item, i)\"\n ></ng-container>\n } @else {\n <!-- Default item -->\n <button\n type=\"button\"\n (click)=\"onItemClick(item, i)\"\n (mouseenter)=\"selectedIndex.set(i)\"\n [attr.data-index]=\"i\"\n [class]=\"\n 'flex w-full items-center gap-3 rounded-lg px-3 py-2.5 text-left transition-colors ' +\n (selectedIndex() === i\n ? 'bg-neutral-100 dark:bg-neutral-800'\n : 'hover:bg-neutral-50 dark:hover:bg-neutral-800/50')\n \"\n >\n @if (!lockedAction()) {\n <!-- Action mode: show icon -->\n @if (item.iconClass) {\n <i [class]=\"item.iconClass + ' text-lg text-neutral-600 dark:text-neutral-300'\"></i>\n } @else if (item.icon) {\n <span class=\"text-lg\">{{ item.icon }}</span>\n } @else {\n <span\n class=\"flex h-6 w-6 items-center justify-center rounded bg-neutral-200 text-xs font-medium text-neutral-600 dark:bg-neutral-700 dark:text-neutral-300\"\n >\n {{ item.category === 'page' ? 'P' : 'C' }}\n </span>\n }\n }\n <div class=\"flex-1 min-w-0\">\n <div class=\"truncate font-medium text-neutral-900 dark:text-neutral-100\">\n {{ item.label }}@if (!lockedAction() && item.params) { @for (param of item.params; track $index) {<span class=\"whitespace-pre\"> </span><span [class]=\"getParamColor($index)\"><{{ param }}></span>}@if (item.paramProviders) {<span class=\"ml-2 inline-flex items-center rounded border border-neutral-300 bg-neutral-100 px-1 py-0.5 text-[10px] font-normal text-neutral-500 dark:border-neutral-600 dark:bg-neutral-700 dark:text-neutral-400\">Tab</span>}}\n </div>\n @if (item.description) {\n <div class=\"truncate text-sm text-neutral-500 dark:text-neutral-400\">\n {{ item.description }}\n </div>\n }\n </div>\n @if (!lockedAction()) {\n <span\n class=\"rounded-full px-2 py-0.5 text-xs\"\n [class]=\"\n item.category === 'page'\n ? 'bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400'\n : 'bg-purple-100 text-purple-700 dark:bg-purple-900/30 dark:text-purple-400'\n \"\n >\n {{ item.category }}\n </span>\n }\n </button>\n }\n }\n }\n </div>\n\n <!-- Footer -->\n @if (footerTemplate(); as ft) {\n <ng-container\n [ngTemplateOutlet]=\"ft.template\"\n [ngTemplateOutletContext]=\"getFooterContext()\"\n ></ng-container>\n } @else {\n <div\n class=\"flex items-center justify-between border-t border-neutral-200 px-4 py-2 text-xs text-neutral-500 dark:border-neutral-700\"\n >\n <div class=\"flex items-center gap-3\">\n <span class=\"flex items-center gap-1\">\n <kbd class=\"rounded border border-neutral-300 bg-neutral-100 px-1 dark:border-neutral-600 dark:bg-neutral-800\">\u2191</kbd>\n <kbd class=\"rounded border border-neutral-300 bg-neutral-100 px-1 dark:border-neutral-600 dark:bg-neutral-800\">\u2193</kbd>\n navigate\n </span>\n <span class=\"flex items-center gap-1\">\n <kbd class=\"rounded border border-neutral-300 bg-neutral-100 px-1 dark:border-neutral-600 dark:bg-neutral-800\">Tab</kbd>\n @if (lockedAction()) {\n next\n } @else {\n params\n }\n </span>\n <span class=\"flex items-center gap-1\">\n <kbd class=\"rounded border border-neutral-300 bg-neutral-100 px-1 dark:border-neutral-600 dark:bg-neutral-800\">\u21B5</kbd>\n @if (lockedAction()) {\n execute\n } @else {\n select\n }\n </span>\n </div>\n <span>gigamenu</span>\n </div>\n }\n </div>\n }\n</div>\n}\n", styles: [":host{display:contents}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
|
|
1731
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: GigamenuComponent, isStandalone: true, selector: "gm-gigamenu", host: { listeners: { "document:keydown": "onGlobalKeydown($event)" }, properties: { "attr.data-gm-dark": "dark() ? \"\" : null" } }, queries: [{ propertyName: "itemTemplate", first: true, predicate: GigamenuItemTemplate, descendants: true, isSignal: true }, { propertyName: "emptyTemplate", first: true, predicate: GigamenuEmptyTemplate, descendants: true, isSignal: true }, { propertyName: "headerTemplate", first: true, predicate: GigamenuHeaderTemplate, descendants: true, isSignal: true }, { propertyName: "footerTemplate", first: true, predicate: GigamenuFooterTemplate, descendants: true, isSignal: true }, { propertyName: "panelTemplate", first: true, predicate: GigamenuPanelTemplate, descendants: true, isSignal: true }], viewQueries: [{ propertyName: "searchInput", first: true, predicate: ["searchInput"], descendants: true, isSignal: true }, { propertyName: "listContainer", first: true, predicate: ["listContainer"], descendants: true, isSignal: true }], ngImport: i0, template: "@if (service.isOpen()) {\n<div\n class=\"fixed inset-0 z-50 flex items-stretch justify-center sm:items-start sm:pt-[15vh]\"\n (click)=\"onBackdropClick($event)\"\n>\n <div class=\"fixed inset-0 bg-(--_gm-overlay) backdrop-blur-sm\"></div>\n\n <!-- Custom panel template -->\n @if (panelTemplate(); as pt) {\n <ng-container\n [ngTemplateOutlet]=\"pt.template\"\n [ngTemplateOutletContext]=\"getPanelContext()\"\n ></ng-container>\n } @else {\n <!-- Default panel -->\n <div\n class=\"relative z-10 w-full flex flex-col overflow-hidden border border-(color:--_gm-border) bg-(--_gm-bg) text-(color:--_gm-fg) shadow-2xl sm:max-w-xl sm:min-h-50 sm:flex-none sm:rounded-(--_gm-radius)\"\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label=\"Command menu\"\n >\n <!-- Header -->\n @if (headerTemplate(); as ht) {\n <ng-container\n [ngTemplateOutlet]=\"ht.template\"\n [ngTemplateOutletContext]=\"getHeaderContext()\"\n ></ng-container>\n } @else {\n <div class=\"border-b border-(color:--_gm-border)\">\n <!-- Breadcrumb (when action is locked) -->\n @if (lockedAction(); as action) {\n <div class=\"flex flex-wrap items-center gap-1 px-4 py-2 text-sm\">\n <button\n type=\"button\"\n (click)=\"unlockActionFromUI()\"\n class=\"inline-flex items-center gap-1.5 rounded-md bg-(--_gm-accent-bg) px-2 py-1 font-medium text-(color:--_gm-accent-fg) hover:bg-(--_gm-accent-hover-bg)\"\n >\n @if (action.icon) {\n <span>{{ action.icon }}</span>\n }\n {{ action.label }}\n </button>\n @for (value of paramValues(); track $index) {\n <span class=\"text-(color:--_gm-fg-subtle)\">\u203A</span>\n <button\n type=\"button\"\n (click)=\"goToParam($index)\"\n [class]=\"'rounded-md px-2 py-1 font-medium hover:opacity-80 ' + getParamColor($index)\"\n >\n <span class=\"text-xs opacity-60\">{{ action.params?.[$index] }}:</span>\n {{ value }}\n </button>\n }\n @if (currentParamName(); as paramName) {\n <span class=\"text-(color:--_gm-fg-subtle)\">\u203A</span>\n <span class=\"text-(color:--_gm-fg-muted) italic\">{{ paramName }}:</span>\n }\n </div>\n }\n\n <!-- Search input row -->\n <div class=\"flex items-center px-4\">\n <svg\n class=\"h-5 w-5 text-(color:--_gm-fg-subtle)\"\n fill=\"none\"\n stroke=\"currentColor\"\n viewBox=\"0 0 24 24\"\n >\n <path\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n stroke-width=\"2\"\n d=\"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z\"\n />\n </svg>\n <input\n #searchInput\n type=\"text\"\n [placeholder]=\"lockedAction() ? (currentParamName() ?? 'Enter value...') : service.config().placeholder\"\n [value]=\"query()\"\n (input)=\"onQueryChange($event)\"\n (keydown)=\"onInputKeydown($event)\"\n class=\"w-full px-3 py-4 text-base text-(color:--_gm-fg) placeholder-(--_gm-fg-subtle) outline-none bg-transparent\"\n />\n <kbd\n class=\"rounded border border-(color:--_gm-kbd-border) bg-(--_gm-kbd-bg) px-1.5 py-0.5 text-xs text-(color:--_gm-fg-muted)\"\n >\n ESC\n </kbd>\n </div>\n </div>\n }\n\n <!-- Items list -->\n <div #listContainer class=\"flex-1 overflow-y-auto p-2 sm:flex-none sm:max-h-80\">\n @if (displayItems().length === 0) {\n <!-- Empty state -->\n @if (emptyTemplate(); as et) {\n <ng-container\n [ngTemplateOutlet]=\"et.template\"\n [ngTemplateOutletContext]=\"getEmptyContext()\"\n ></ng-container>\n } @else {\n <div class=\"px-3 py-8 text-center text-(color:--_gm-fg-muted)\">\n @if (lockedAction()) {\n @if (hasAutocomplete()) {\n Type to search...\n } @else {\n Enter a value and press Tab or Enter\n }\n } @else {\n {{ labels().noResults }}\n }\n </div>\n }\n } @else {\n @for (item of displayItems(); track item.id; let i = $index) {\n <!-- Custom item template -->\n @if (itemTemplate(); as it) {\n <ng-container\n [ngTemplateOutlet]=\"it.template\"\n [ngTemplateOutletContext]=\"getItemContext(item, i)\"\n ></ng-container>\n } @else {\n <!-- Default item -->\n <button\n type=\"button\"\n (click)=\"onItemClick(item, i)\"\n (mouseenter)=\"selectedIndex.set(i)\"\n [attr.data-index]=\"i\"\n [class]=\"\n 'flex w-full items-center gap-3 rounded-[calc(var(--_gm-radius)-0.25rem)] px-3 py-2.5 text-left transition-colors ' +\n (selectedIndex() === i\n ? 'bg-(--_gm-selected-bg)'\n : 'hover:bg-(--_gm-hover-bg)')\n \"\n >\n @if (!lockedAction()) {\n <!-- Action mode: show icon -->\n @if (item.iconClass) {\n <i [class]=\"item.iconClass + ' text-lg text-(color:--_gm-fg-icon)'\"></i>\n } @else if (item.icon) {\n <span class=\"text-lg\">{{ item.icon }}</span>\n } @else {\n <span\n class=\"flex h-6 w-6 items-center justify-center rounded bg-(--_gm-badge-bg) text-xs font-medium text-(color:--_gm-fg-icon)\"\n >\n {{ item.category === 'page' ? labels().pageBadge : labels().commandBadge }}\n </span>\n }\n }\n <div class=\"flex-1 min-w-0\">\n <div class=\"truncate font-medium text-(color:--_gm-fg)\">\n {{ item.label }}@if (!lockedAction() && item.params) { @for (param of item.params; track $index) {<span class=\"whitespace-pre\"> </span><span [class]=\"getParamColor($index)\"><{{ param }}></span>}@if (item.paramProviders) {<span class=\"ml-2 inline-flex items-center rounded border border-(color:--_gm-kbd-border) bg-(--_gm-kbd-bg) px-1 py-0.5 text-[10px] font-normal text-(color:--_gm-fg-muted)\">{{ labels().paramHint }}</span>}}\n </div>\n @if (item.description) {\n <div class=\"truncate text-sm text-(color:--_gm-fg-muted)\">\n {{ item.description }}\n </div>\n }\n </div>\n @if (!lockedAction() && service.config().showCategoryTags !== false) {\n <span\n class=\"rounded-full px-2 py-0.5 text-xs\"\n [class]=\"\n item.category === 'page'\n ? 'bg-(--_gm-page-bg) text-(color:--_gm-page-fg)'\n : 'bg-(--_gm-command-bg) text-(color:--_gm-command-fg)'\n \"\n >\n {{ item.category === 'page' ? labels().pageTag : labels().commandTag }}\n </span>\n }\n </button>\n }\n }\n }\n </div>\n\n <!-- Footer -->\n @if (footerTemplate(); as ft) {\n <ng-container\n [ngTemplateOutlet]=\"ft.template\"\n [ngTemplateOutletContext]=\"getFooterContext()\"\n ></ng-container>\n } @else if (service.config().showFooter !== false) {\n <div\n class=\"flex items-center justify-between border-t border-(color:--_gm-border) px-4 py-2 text-xs text-(color:--_gm-fg-muted)\"\n >\n <div class=\"flex items-center gap-3\">\n <span class=\"flex items-center gap-1\">\n <kbd class=\"rounded border border-(color:--_gm-kbd-border) bg-(--_gm-kbd-bg) px-1\">\u2191</kbd>\n <kbd class=\"rounded border border-(color:--_gm-kbd-border) bg-(--_gm-kbd-bg) px-1\">\u2193</kbd>\n {{ labels().navigate }}\n </span>\n <span class=\"flex items-center gap-1\">\n <kbd class=\"rounded border border-(color:--_gm-kbd-border) bg-(--_gm-kbd-bg) px-1\">Tab</kbd>\n @if (lockedAction()) {\n {{ labels().next }}\n } @else {\n {{ labels().params }}\n }\n </span>\n <span class=\"flex items-center gap-1\">\n <kbd class=\"rounded border border-(color:--_gm-kbd-border) bg-(--_gm-kbd-bg) px-1\">\u21B5</kbd>\n @if (lockedAction()) {\n {{ labels().execute }}\n } @else {\n {{ labels().select }}\n }\n </span>\n </div>\n <span>{{ labels().footerBrand }}</span>\n </div>\n }\n </div>\n }\n</div>\n}\n", styles: [":host{display:contents;--_gm-bg: var(--gm-bg, oklch(100% 0 0));--_gm-fg: var(--gm-fg, oklch(20.5% 0 0));--_gm-fg-muted: var(--gm-fg-muted, oklch(55.6% 0 0));--_gm-fg-subtle: var(--gm-fg-subtle, oklch(70.8% 0 0));--_gm-fg-icon: var(--gm-fg-icon, oklch(43.9% 0 0));--_gm-border: var(--gm-border, oklch(92.2% 0 0));--_gm-hover-bg: var(--gm-hover-bg, oklch(98.5% 0 0));--_gm-selected-bg: var(--gm-selected-bg, oklch(97% 0 0));--_gm-badge-bg: var(--gm-badge-bg, oklch(92.2% 0 0));--_gm-kbd-bg: var(--gm-kbd-bg, oklch(97% 0 0));--_gm-kbd-border: var(--gm-kbd-border, oklch(87% 0 0));--_gm-accent-bg: var(--gm-accent-bg, oklch(93.2% .032 255.585));--_gm-accent-hover-bg: var(--gm-accent-hover-bg, oklch(88.2% .059 254.128));--_gm-accent-fg: var(--gm-accent-fg, oklch(42.4% .199 265.638));--_gm-page-bg: var(--gm-page-bg, oklch(93.2% .032 255.585));--_gm-page-fg: var(--gm-page-fg, oklch(48.8% .243 264.376));--_gm-command-bg: var(--gm-command-bg, oklch(94.6% .033 307.174));--_gm-command-fg: var(--gm-command-fg, oklch(49.6% .265 301.924));--_gm-param-1: var(--gm-param-1, oklch(62.3% .214 259.815));--_gm-param-2: var(--gm-param-2, oklch(72.3% .219 149.579));--_gm-param-3: var(--gm-param-3, oklch(70.5% .213 47.604));--_gm-param-4: var(--gm-param-4, oklch(65.6% .241 354.308));--_gm-param-5: var(--gm-param-5, oklch(71.5% .143 215.221));--_gm-radius: var(--gm-radius, .75rem);--_gm-overlay: var(--gm-overlay, rgb(0 0 0 / 50%))}:host([data-gm-dark]){--_gm-bg: var(--gm-bg, oklch(20.5% 0 0));--_gm-fg: var(--gm-fg, oklch(97% 0 0));--_gm-fg-muted: var(--gm-fg-muted, oklch(70.8% 0 0));--_gm-fg-icon: var(--gm-fg-icon, oklch(87% 0 0));--_gm-border: var(--gm-border, oklch(37.1% 0 0));--_gm-hover-bg: var(--gm-hover-bg, oklch(26.9% 0 0 / 50%));--_gm-selected-bg: var(--gm-selected-bg, oklch(26.9% 0 0));--_gm-badge-bg: var(--gm-badge-bg, oklch(37.1% 0 0));--_gm-kbd-bg: var(--gm-kbd-bg, oklch(26.9% 0 0));--_gm-kbd-border: var(--gm-kbd-border, oklch(43.9% 0 0));--_gm-accent-bg: var(--gm-accent-bg, oklch(37.9% .146 265.522 / 40%));--_gm-accent-hover-bg: var(--gm-accent-hover-bg, oklch(37.9% .146 265.522 / 60%));--_gm-accent-fg: var(--gm-accent-fg, oklch(80.9% .105 251.813));--_gm-page-bg: var(--gm-page-bg, oklch(37.9% .146 265.522 / 30%));--_gm-page-fg: var(--gm-page-fg, oklch(70.7% .165 254.624));--_gm-command-bg: var(--gm-command-bg, oklch(38.1% .176 304.987 / 30%));--_gm-command-fg: var(--gm-command-fg, oklch(71.4% .203 305.504));--_gm-param-1: var(--gm-param-1, oklch(70.7% .165 254.624));--_gm-param-2: var(--gm-param-2, oklch(79.2% .209 151.711));--_gm-param-3: var(--gm-param-3, oklch(75% .183 55.934));--_gm-param-4: var(--gm-param-4, oklch(71.8% .202 349.761));--_gm-param-5: var(--gm-param-5, oklch(78.9% .154 211.53))}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
|
|
1683
1732
|
}
|
|
1684
1733
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: GigamenuComponent, decorators: [{
|
|
1685
1734
|
type: Component,
|
|
1686
|
-
args: [{ selector: 'gm-gigamenu', standalone: true, imports: [NgTemplateOutlet], template: "@if (service.isOpen()) {\n<div\n class=\"fixed inset-0 z-50 flex items-stretch justify-center sm:items-start sm:pt-[15vh]\"\n (click)=\"onBackdropClick($event)\"\n>\n <div class=\"fixed inset-0 bg-black/50 backdrop-blur-sm\"></div>\n\n <!-- Custom panel template -->\n @if (panelTemplate(); as pt) {\n <ng-container\n [ngTemplateOutlet]=\"pt.template\"\n [ngTemplateOutletContext]=\"getPanelContext()\"\n ></ng-container>\n } @else {\n <!-- Default panel -->\n <div\n class=\"relative z-10 w-full flex flex-col overflow-hidden border border-neutral-200 bg-white shadow-2xl dark:border-neutral-700 dark:bg-neutral-900 sm:max-w-xl sm:min-h-50 sm:flex-none sm:rounded-xl\"\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label=\"Command menu\"\n >\n <!-- Header -->\n @if (headerTemplate(); as ht) {\n <ng-container\n [ngTemplateOutlet]=\"ht.template\"\n [ngTemplateOutletContext]=\"getHeaderContext()\"\n ></ng-container>\n } @else {\n <div class=\"border-b border-neutral-200 dark:border-neutral-700\">\n <!-- Breadcrumb (when action is locked) -->\n @if (lockedAction(); as action) {\n <div class=\"flex flex-wrap items-center gap-1 px-4 py-2 text-sm\">\n <button\n type=\"button\"\n (click)=\"unlockActionFromUI()\"\n class=\"inline-flex items-center gap-1.5 rounded-md bg-blue-100 px-2 py-1 font-medium text-blue-800 hover:bg-blue-200 dark:bg-blue-900/40 dark:text-blue-300 dark:hover:bg-blue-900/60\"\n >\n @if (action.icon) {\n <span>{{ action.icon }}</span>\n }\n {{ action.label }}\n </button>\n @for (value of paramValues(); track $index) {\n <span class=\"text-neutral-400\">\u203A</span>\n <button\n type=\"button\"\n (click)=\"goToParam($index)\"\n [class]=\"'rounded-md px-2 py-1 font-medium hover:opacity-80 ' + getParamColor($index)\"\n >\n <span class=\"text-xs opacity-60\">{{ action.params?.[$index] }}:</span>\n {{ value }}\n </button>\n }\n @if (currentParamName(); as paramName) {\n <span class=\"text-neutral-400\">\u203A</span>\n <span class=\"text-neutral-500 dark:text-neutral-400 italic\">{{ paramName }}:</span>\n }\n </div>\n }\n\n <!-- Search input row -->\n <div class=\"flex items-center px-4\">\n <svg\n class=\"h-5 w-5 text-neutral-400\"\n fill=\"none\"\n stroke=\"currentColor\"\n viewBox=\"0 0 24 24\"\n >\n <path\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n stroke-width=\"2\"\n d=\"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z\"\n />\n </svg>\n <input\n #searchInput\n type=\"text\"\n [placeholder]=\"lockedAction() ? (currentParamName() ?? 'Enter value...') : service.config().placeholder\"\n [value]=\"query()\"\n (input)=\"onQueryChange($event)\"\n (keydown)=\"onInputKeydown($event)\"\n class=\"w-full px-3 py-4 text-base text-neutral-900 placeholder-neutral-400 outline-none dark:text-neutral-100 bg-transparent\"\n />\n <kbd\n class=\"rounded border border-neutral-200 bg-neutral-100 px-1.5 py-0.5 text-xs text-neutral-500 dark:border-neutral-600 dark:bg-neutral-800 dark:text-neutral-400\"\n >\n ESC\n </kbd>\n </div>\n </div>\n }\n\n <!-- Items list -->\n <div #listContainer class=\"flex-1 overflow-y-auto p-2 sm:flex-none sm:max-h-80\">\n @if (displayItems().length === 0) {\n <!-- Empty state -->\n @if (emptyTemplate(); as et) {\n <ng-container\n [ngTemplateOutlet]=\"et.template\"\n [ngTemplateOutletContext]=\"getEmptyContext()\"\n ></ng-container>\n } @else {\n <div class=\"px-3 py-8 text-center text-neutral-500\">\n @if (lockedAction()) {\n @if (hasAutocomplete()) {\n Type to search...\n } @else {\n Enter a value and press Tab or Enter\n }\n } @else {\n No results found\n }\n </div>\n }\n } @else {\n @for (item of displayItems(); track item.id; let i = $index) {\n <!-- Custom item template -->\n @if (itemTemplate(); as it) {\n <ng-container\n [ngTemplateOutlet]=\"it.template\"\n [ngTemplateOutletContext]=\"getItemContext(item, i)\"\n ></ng-container>\n } @else {\n <!-- Default item -->\n <button\n type=\"button\"\n (click)=\"onItemClick(item, i)\"\n (mouseenter)=\"selectedIndex.set(i)\"\n [attr.data-index]=\"i\"\n [class]=\"\n 'flex w-full items-center gap-3 rounded-lg px-3 py-2.5 text-left transition-colors ' +\n (selectedIndex() === i\n ? 'bg-neutral-100 dark:bg-neutral-800'\n : 'hover:bg-neutral-50 dark:hover:bg-neutral-800/50')\n \"\n >\n @if (!lockedAction()) {\n <!-- Action mode: show icon -->\n @if (item.iconClass) {\n <i [class]=\"item.iconClass + ' text-lg text-neutral-600 dark:text-neutral-300'\"></i>\n } @else if (item.icon) {\n <span class=\"text-lg\">{{ item.icon }}</span>\n } @else {\n <span\n class=\"flex h-6 w-6 items-center justify-center rounded bg-neutral-200 text-xs font-medium text-neutral-600 dark:bg-neutral-700 dark:text-neutral-300\"\n >\n {{ item.category === 'page' ? 'P' : 'C' }}\n </span>\n }\n }\n <div class=\"flex-1 min-w-0\">\n <div class=\"truncate font-medium text-neutral-900 dark:text-neutral-100\">\n {{ item.label }}@if (!lockedAction() && item.params) { @for (param of item.params; track $index) {<span class=\"whitespace-pre\"> </span><span [class]=\"getParamColor($index)\"><{{ param }}></span>}@if (item.paramProviders) {<span class=\"ml-2 inline-flex items-center rounded border border-neutral-300 bg-neutral-100 px-1 py-0.5 text-[10px] font-normal text-neutral-500 dark:border-neutral-600 dark:bg-neutral-700 dark:text-neutral-400\">Tab</span>}}\n </div>\n @if (item.description) {\n <div class=\"truncate text-sm text-neutral-500 dark:text-neutral-400\">\n {{ item.description }}\n </div>\n }\n </div>\n @if (!lockedAction()) {\n <span\n class=\"rounded-full px-2 py-0.5 text-xs\"\n [class]=\"\n item.category === 'page'\n ? 'bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400'\n : 'bg-purple-100 text-purple-700 dark:bg-purple-900/30 dark:text-purple-400'\n \"\n >\n {{ item.category }}\n </span>\n }\n </button>\n }\n }\n }\n </div>\n\n <!-- Footer -->\n @if (footerTemplate(); as ft) {\n <ng-container\n [ngTemplateOutlet]=\"ft.template\"\n [ngTemplateOutletContext]=\"getFooterContext()\"\n ></ng-container>\n } @else {\n <div\n class=\"flex items-center justify-between border-t border-neutral-200 px-4 py-2 text-xs text-neutral-500 dark:border-neutral-700\"\n >\n <div class=\"flex items-center gap-3\">\n <span class=\"flex items-center gap-1\">\n <kbd class=\"rounded border border-neutral-300 bg-neutral-100 px-1 dark:border-neutral-600 dark:bg-neutral-800\">\u2191</kbd>\n <kbd class=\"rounded border border-neutral-300 bg-neutral-100 px-1 dark:border-neutral-600 dark:bg-neutral-800\">\u2193</kbd>\n navigate\n </span>\n <span class=\"flex items-center gap-1\">\n <kbd class=\"rounded border border-neutral-300 bg-neutral-100 px-1 dark:border-neutral-600 dark:bg-neutral-800\">Tab</kbd>\n @if (lockedAction()) {\n next\n } @else {\n params\n }\n </span>\n <span class=\"flex items-center gap-1\">\n <kbd class=\"rounded border border-neutral-300 bg-neutral-100 px-1 dark:border-neutral-600 dark:bg-neutral-800\">\u21B5</kbd>\n @if (lockedAction()) {\n execute\n } @else {\n select\n }\n </span>\n </div>\n <span>gigamenu</span>\n </div>\n }\n </div>\n }\n</div>\n}\n", styles: [":host{display:contents}\n"] }]
|
|
1735
|
+
args: [{ selector: 'gm-gigamenu', standalone: true, imports: [NgTemplateOutlet], host: { '[attr.data-gm-dark]': 'dark() ? "" : null' }, template: "@if (service.isOpen()) {\n<div\n class=\"fixed inset-0 z-50 flex items-stretch justify-center sm:items-start sm:pt-[15vh]\"\n (click)=\"onBackdropClick($event)\"\n>\n <div class=\"fixed inset-0 bg-(--_gm-overlay) backdrop-blur-sm\"></div>\n\n <!-- Custom panel template -->\n @if (panelTemplate(); as pt) {\n <ng-container\n [ngTemplateOutlet]=\"pt.template\"\n [ngTemplateOutletContext]=\"getPanelContext()\"\n ></ng-container>\n } @else {\n <!-- Default panel -->\n <div\n class=\"relative z-10 w-full flex flex-col overflow-hidden border border-(color:--_gm-border) bg-(--_gm-bg) text-(color:--_gm-fg) shadow-2xl sm:max-w-xl sm:min-h-50 sm:flex-none sm:rounded-(--_gm-radius)\"\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label=\"Command menu\"\n >\n <!-- Header -->\n @if (headerTemplate(); as ht) {\n <ng-container\n [ngTemplateOutlet]=\"ht.template\"\n [ngTemplateOutletContext]=\"getHeaderContext()\"\n ></ng-container>\n } @else {\n <div class=\"border-b border-(color:--_gm-border)\">\n <!-- Breadcrumb (when action is locked) -->\n @if (lockedAction(); as action) {\n <div class=\"flex flex-wrap items-center gap-1 px-4 py-2 text-sm\">\n <button\n type=\"button\"\n (click)=\"unlockActionFromUI()\"\n class=\"inline-flex items-center gap-1.5 rounded-md bg-(--_gm-accent-bg) px-2 py-1 font-medium text-(color:--_gm-accent-fg) hover:bg-(--_gm-accent-hover-bg)\"\n >\n @if (action.icon) {\n <span>{{ action.icon }}</span>\n }\n {{ action.label }}\n </button>\n @for (value of paramValues(); track $index) {\n <span class=\"text-(color:--_gm-fg-subtle)\">\u203A</span>\n <button\n type=\"button\"\n (click)=\"goToParam($index)\"\n [class]=\"'rounded-md px-2 py-1 font-medium hover:opacity-80 ' + getParamColor($index)\"\n >\n <span class=\"text-xs opacity-60\">{{ action.params?.[$index] }}:</span>\n {{ value }}\n </button>\n }\n @if (currentParamName(); as paramName) {\n <span class=\"text-(color:--_gm-fg-subtle)\">\u203A</span>\n <span class=\"text-(color:--_gm-fg-muted) italic\">{{ paramName }}:</span>\n }\n </div>\n }\n\n <!-- Search input row -->\n <div class=\"flex items-center px-4\">\n <svg\n class=\"h-5 w-5 text-(color:--_gm-fg-subtle)\"\n fill=\"none\"\n stroke=\"currentColor\"\n viewBox=\"0 0 24 24\"\n >\n <path\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n stroke-width=\"2\"\n d=\"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z\"\n />\n </svg>\n <input\n #searchInput\n type=\"text\"\n [placeholder]=\"lockedAction() ? (currentParamName() ?? 'Enter value...') : service.config().placeholder\"\n [value]=\"query()\"\n (input)=\"onQueryChange($event)\"\n (keydown)=\"onInputKeydown($event)\"\n class=\"w-full px-3 py-4 text-base text-(color:--_gm-fg) placeholder-(--_gm-fg-subtle) outline-none bg-transparent\"\n />\n <kbd\n class=\"rounded border border-(color:--_gm-kbd-border) bg-(--_gm-kbd-bg) px-1.5 py-0.5 text-xs text-(color:--_gm-fg-muted)\"\n >\n ESC\n </kbd>\n </div>\n </div>\n }\n\n <!-- Items list -->\n <div #listContainer class=\"flex-1 overflow-y-auto p-2 sm:flex-none sm:max-h-80\">\n @if (displayItems().length === 0) {\n <!-- Empty state -->\n @if (emptyTemplate(); as et) {\n <ng-container\n [ngTemplateOutlet]=\"et.template\"\n [ngTemplateOutletContext]=\"getEmptyContext()\"\n ></ng-container>\n } @else {\n <div class=\"px-3 py-8 text-center text-(color:--_gm-fg-muted)\">\n @if (lockedAction()) {\n @if (hasAutocomplete()) {\n Type to search...\n } @else {\n Enter a value and press Tab or Enter\n }\n } @else {\n {{ labels().noResults }}\n }\n </div>\n }\n } @else {\n @for (item of displayItems(); track item.id; let i = $index) {\n <!-- Custom item template -->\n @if (itemTemplate(); as it) {\n <ng-container\n [ngTemplateOutlet]=\"it.template\"\n [ngTemplateOutletContext]=\"getItemContext(item, i)\"\n ></ng-container>\n } @else {\n <!-- Default item -->\n <button\n type=\"button\"\n (click)=\"onItemClick(item, i)\"\n (mouseenter)=\"selectedIndex.set(i)\"\n [attr.data-index]=\"i\"\n [class]=\"\n 'flex w-full items-center gap-3 rounded-[calc(var(--_gm-radius)-0.25rem)] px-3 py-2.5 text-left transition-colors ' +\n (selectedIndex() === i\n ? 'bg-(--_gm-selected-bg)'\n : 'hover:bg-(--_gm-hover-bg)')\n \"\n >\n @if (!lockedAction()) {\n <!-- Action mode: show icon -->\n @if (item.iconClass) {\n <i [class]=\"item.iconClass + ' text-lg text-(color:--_gm-fg-icon)'\"></i>\n } @else if (item.icon) {\n <span class=\"text-lg\">{{ item.icon }}</span>\n } @else {\n <span\n class=\"flex h-6 w-6 items-center justify-center rounded bg-(--_gm-badge-bg) text-xs font-medium text-(color:--_gm-fg-icon)\"\n >\n {{ item.category === 'page' ? labels().pageBadge : labels().commandBadge }}\n </span>\n }\n }\n <div class=\"flex-1 min-w-0\">\n <div class=\"truncate font-medium text-(color:--_gm-fg)\">\n {{ item.label }}@if (!lockedAction() && item.params) { @for (param of item.params; track $index) {<span class=\"whitespace-pre\"> </span><span [class]=\"getParamColor($index)\"><{{ param }}></span>}@if (item.paramProviders) {<span class=\"ml-2 inline-flex items-center rounded border border-(color:--_gm-kbd-border) bg-(--_gm-kbd-bg) px-1 py-0.5 text-[10px] font-normal text-(color:--_gm-fg-muted)\">{{ labels().paramHint }}</span>}}\n </div>\n @if (item.description) {\n <div class=\"truncate text-sm text-(color:--_gm-fg-muted)\">\n {{ item.description }}\n </div>\n }\n </div>\n @if (!lockedAction() && service.config().showCategoryTags !== false) {\n <span\n class=\"rounded-full px-2 py-0.5 text-xs\"\n [class]=\"\n item.category === 'page'\n ? 'bg-(--_gm-page-bg) text-(color:--_gm-page-fg)'\n : 'bg-(--_gm-command-bg) text-(color:--_gm-command-fg)'\n \"\n >\n {{ item.category === 'page' ? labels().pageTag : labels().commandTag }}\n </span>\n }\n </button>\n }\n }\n }\n </div>\n\n <!-- Footer -->\n @if (footerTemplate(); as ft) {\n <ng-container\n [ngTemplateOutlet]=\"ft.template\"\n [ngTemplateOutletContext]=\"getFooterContext()\"\n ></ng-container>\n } @else if (service.config().showFooter !== false) {\n <div\n class=\"flex items-center justify-between border-t border-(color:--_gm-border) px-4 py-2 text-xs text-(color:--_gm-fg-muted)\"\n >\n <div class=\"flex items-center gap-3\">\n <span class=\"flex items-center gap-1\">\n <kbd class=\"rounded border border-(color:--_gm-kbd-border) bg-(--_gm-kbd-bg) px-1\">\u2191</kbd>\n <kbd class=\"rounded border border-(color:--_gm-kbd-border) bg-(--_gm-kbd-bg) px-1\">\u2193</kbd>\n {{ labels().navigate }}\n </span>\n <span class=\"flex items-center gap-1\">\n <kbd class=\"rounded border border-(color:--_gm-kbd-border) bg-(--_gm-kbd-bg) px-1\">Tab</kbd>\n @if (lockedAction()) {\n {{ labels().next }}\n } @else {\n {{ labels().params }}\n }\n </span>\n <span class=\"flex items-center gap-1\">\n <kbd class=\"rounded border border-(color:--_gm-kbd-border) bg-(--_gm-kbd-bg) px-1\">\u21B5</kbd>\n @if (lockedAction()) {\n {{ labels().execute }}\n } @else {\n {{ labels().select }}\n }\n </span>\n </div>\n <span>{{ labels().footerBrand }}</span>\n </div>\n }\n </div>\n }\n</div>\n}\n", styles: [":host{display:contents;--_gm-bg: var(--gm-bg, oklch(100% 0 0));--_gm-fg: var(--gm-fg, oklch(20.5% 0 0));--_gm-fg-muted: var(--gm-fg-muted, oklch(55.6% 0 0));--_gm-fg-subtle: var(--gm-fg-subtle, oklch(70.8% 0 0));--_gm-fg-icon: var(--gm-fg-icon, oklch(43.9% 0 0));--_gm-border: var(--gm-border, oklch(92.2% 0 0));--_gm-hover-bg: var(--gm-hover-bg, oklch(98.5% 0 0));--_gm-selected-bg: var(--gm-selected-bg, oklch(97% 0 0));--_gm-badge-bg: var(--gm-badge-bg, oklch(92.2% 0 0));--_gm-kbd-bg: var(--gm-kbd-bg, oklch(97% 0 0));--_gm-kbd-border: var(--gm-kbd-border, oklch(87% 0 0));--_gm-accent-bg: var(--gm-accent-bg, oklch(93.2% .032 255.585));--_gm-accent-hover-bg: var(--gm-accent-hover-bg, oklch(88.2% .059 254.128));--_gm-accent-fg: var(--gm-accent-fg, oklch(42.4% .199 265.638));--_gm-page-bg: var(--gm-page-bg, oklch(93.2% .032 255.585));--_gm-page-fg: var(--gm-page-fg, oklch(48.8% .243 264.376));--_gm-command-bg: var(--gm-command-bg, oklch(94.6% .033 307.174));--_gm-command-fg: var(--gm-command-fg, oklch(49.6% .265 301.924));--_gm-param-1: var(--gm-param-1, oklch(62.3% .214 259.815));--_gm-param-2: var(--gm-param-2, oklch(72.3% .219 149.579));--_gm-param-3: var(--gm-param-3, oklch(70.5% .213 47.604));--_gm-param-4: var(--gm-param-4, oklch(65.6% .241 354.308));--_gm-param-5: var(--gm-param-5, oklch(71.5% .143 215.221));--_gm-radius: var(--gm-radius, .75rem);--_gm-overlay: var(--gm-overlay, rgb(0 0 0 / 50%))}:host([data-gm-dark]){--_gm-bg: var(--gm-bg, oklch(20.5% 0 0));--_gm-fg: var(--gm-fg, oklch(97% 0 0));--_gm-fg-muted: var(--gm-fg-muted, oklch(70.8% 0 0));--_gm-fg-icon: var(--gm-fg-icon, oklch(87% 0 0));--_gm-border: var(--gm-border, oklch(37.1% 0 0));--_gm-hover-bg: var(--gm-hover-bg, oklch(26.9% 0 0 / 50%));--_gm-selected-bg: var(--gm-selected-bg, oklch(26.9% 0 0));--_gm-badge-bg: var(--gm-badge-bg, oklch(37.1% 0 0));--_gm-kbd-bg: var(--gm-kbd-bg, oklch(26.9% 0 0));--_gm-kbd-border: var(--gm-kbd-border, oklch(43.9% 0 0));--_gm-accent-bg: var(--gm-accent-bg, oklch(37.9% .146 265.522 / 40%));--_gm-accent-hover-bg: var(--gm-accent-hover-bg, oklch(37.9% .146 265.522 / 60%));--_gm-accent-fg: var(--gm-accent-fg, oklch(80.9% .105 251.813));--_gm-page-bg: var(--gm-page-bg, oklch(37.9% .146 265.522 / 30%));--_gm-page-fg: var(--gm-page-fg, oklch(70.7% .165 254.624));--_gm-command-bg: var(--gm-command-bg, oklch(38.1% .176 304.987 / 30%));--_gm-command-fg: var(--gm-command-fg, oklch(71.4% .203 305.504));--_gm-param-1: var(--gm-param-1, oklch(70.7% .165 254.624));--_gm-param-2: var(--gm-param-2, oklch(79.2% .209 151.711));--_gm-param-3: var(--gm-param-3, oklch(75% .183 55.934));--_gm-param-4: var(--gm-param-4, oklch(71.8% .202 349.761));--_gm-param-5: var(--gm-param-5, oklch(78.9% .154 211.53))}\n"] }]
|
|
1687
1736
|
}], ctorParameters: () => [{ type: GigamenuService }, { type: FrecencyService }, { type: undefined, decorators: [{
|
|
1688
1737
|
type: Inject,
|
|
1689
1738
|
args: [PLATFORM_ID]
|
|
@@ -1696,5 +1745,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImpor
|
|
|
1696
1745
|
* Generated bundle index. Do not edit.
|
|
1697
1746
|
*/
|
|
1698
1747
|
|
|
1699
|
-
export { DEFAULT_CONFIG, FrecencyService, GigamenuComponent, GigamenuEmptyTemplate, GigamenuFooterTemplate, GigamenuHeaderTemplate, GigamenuItemTemplate, GigamenuPanelTemplate, GigamenuService, PARAM_COLORS, defineCommand };
|
|
1748
|
+
export { DEFAULT_CONFIG, DEFAULT_LABELS, FrecencyService, GigamenuComponent, GigamenuEmptyTemplate, GigamenuFooterTemplate, GigamenuHeaderTemplate, GigamenuItemTemplate, GigamenuPanelTemplate, GigamenuService, PARAM_COLORS, defineCommand };
|
|
1700
1749
|
//# sourceMappingURL=flxgde-gigamenu.mjs.map
|