@cngx/common 0.1.0-rc.8 → 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/a11y/README.md +15 -2
- package/button/README.md +258 -0
- package/command/README.md +42 -2
- package/data/README.md +15 -12
- package/fesm2022/cngx-common-a11y.mjs +1076 -319
- package/fesm2022/cngx-common-a11y.mjs.map +1 -1
- package/fesm2022/cngx-common-audio.mjs +99 -77
- package/fesm2022/cngx-common-audio.mjs.map +1 -1
- package/fesm2022/cngx-common-button.mjs +1084 -0
- package/fesm2022/cngx-common-button.mjs.map +1 -0
- package/fesm2022/cngx-common-card.mjs +138 -78
- package/fesm2022/cngx-common-card.mjs.map +1 -1
- package/fesm2022/cngx-common-chart.mjs +799 -327
- package/fesm2022/cngx-common-chart.mjs.map +1 -1
- package/fesm2022/cngx-common-command.mjs +101 -25
- package/fesm2022/cngx-common-command.mjs.map +1 -1
- package/fesm2022/cngx-common-data.mjs +861 -423
- package/fesm2022/cngx-common-data.mjs.map +1 -1
- package/fesm2022/cngx-common-dialog.mjs +198 -160
- package/fesm2022/cngx-common-dialog.mjs.map +1 -1
- package/fesm2022/cngx-common-display.mjs +693 -329
- package/fesm2022/cngx-common-display.mjs.map +1 -1
- package/fesm2022/cngx-common-interactive.mjs +7303 -2774
- package/fesm2022/cngx-common-interactive.mjs.map +1 -1
- package/fesm2022/cngx-common-layout.mjs +2174 -442
- package/fesm2022/cngx-common-layout.mjs.map +1 -1
- package/fesm2022/cngx-common-menu-button.mjs +557 -0
- package/fesm2022/cngx-common-menu-button.mjs.map +1 -0
- package/fesm2022/cngx-common-popover.mjs +2109 -557
- package/fesm2022/cngx-common-popover.mjs.map +1 -1
- package/fesm2022/cngx-common-stepper.mjs +548 -419
- package/fesm2022/cngx-common-stepper.mjs.map +1 -1
- package/fesm2022/cngx-common-tabs.mjs +442 -331
- package/fesm2022/cngx-common-tabs.mjs.map +1 -1
- package/fesm2022/cngx-common-timeline.mjs +44 -71
- package/fesm2022/cngx-common-timeline.mjs.map +1 -1
- package/fesm2022/cngx-common.mjs +10 -10
- package/fesm2022/cngx-common.mjs.map +1 -1
- package/interactive/README.md +30 -19
- package/layout/README.md +17 -1
- package/menu-button/README.md +234 -0
- package/package.json +31 -8
- package/popover/README.md +81 -4
- package/popover/tooltip-indicator.scss +52 -0
- package/schematics/collection.json +9 -0
- package/schematics/ng-add/index.js +9 -0
- package/schematics/ng-add/schema.json +96 -0
- package/schematics/package.json +3 -0
- package/stepper/README.md +5 -5
- package/theming/components/cngx-accordion.css +36 -7
- package/theming/components/cngx-async.css +185 -37
- package/theming/components/cngx-backdrop.css +3 -1
- package/theming/components/cngx-badge.css +20 -5
- package/theming/components/cngx-bottom-sheet.css +2 -0
- package/theming/components/cngx-breadcrumb.css +3 -1
- package/theming/components/cngx-button-group.css +325 -0
- package/theming/components/cngx-button-toggle.css +55 -23
- package/theming/components/cngx-button.css +975 -0
- package/theming/components/cngx-data-grid.css +2 -0
- package/theming/components/cngx-dialog.css +3 -1
- package/theming/components/cngx-divider.css +24 -9
- package/theming/components/cngx-drawer.css +153 -0
- package/theming/components/cngx-icon-glyph.css +76 -0
- package/theming/components/cngx-listbox.css +79 -25
- package/theming/components/cngx-menu.css +112 -52
- package/theming/components/cngx-nav.css +1220 -0
- package/theming/components/cngx-popover-sheet.css +434 -0
- package/theming/components/cngx-popover.css +37 -9
- package/theming/components/cngx-recycler-placeholder.css +2 -0
- package/theming/components/cngx-ripple.css +74 -16
- package/theming/components/cngx-sidebar.css +71 -0
- package/theming/components/cngx-slider.css +3 -1
- package/theming/components/cngx-tooltip.css +2 -0
- package/timeline/README.md +2 -2
- package/types/cngx-common-a11y.d.ts +488 -112
- package/types/cngx-common-audio.d.ts +60 -88
- package/types/cngx-common-button.d.ts +698 -0
- package/types/cngx-common-card.d.ts +104 -78
- package/types/cngx-common-chart.d.ts +677 -389
- package/types/cngx-common-command.d.ts +55 -41
- package/types/cngx-common-data.d.ts +506 -360
- package/types/cngx-common-dialog.d.ts +94 -127
- package/types/cngx-common-display.d.ts +475 -300
- package/types/cngx-common-interactive.d.ts +4383 -1721
- package/types/cngx-common-layout.d.ts +1399 -288
- package/types/cngx-common-menu-button.d.ts +382 -0
- package/types/cngx-common-popover.d.ts +990 -268
- package/types/cngx-common-stepper.d.ts +374 -465
- package/types/cngx-common-tabs.d.ts +309 -403
- package/types/cngx-common-timeline.d.ts +50 -109
|
@@ -1,41 +1,79 @@
|
|
|
1
|
-
import { InjectionToken, inject, computed } from '@angular/core';
|
|
1
|
+
import { InjectionToken, inject, EnvironmentInjector, computed, isSignal } from '@angular/core';
|
|
2
|
+
import { cngxDevWarn } from '@cngx/utils';
|
|
2
3
|
import { foldForMatching, injectLocale } from '@cngx/core/utils';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
|
-
* Multi-token every `provideCommands` call contributes to.
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* @category common/command
|
|
11
|
-
* @since 0.1.0
|
|
6
|
+
* @internal Multi-token every `provideCommands` call contributes to. The
|
|
7
|
+
* generic is the collected array (as with Angular's `HTTP_INTERCEPTORS`), so
|
|
8
|
+
* `inject(CNGX_COMMAND_SOURCE)` returns the sources of the nearest level that
|
|
9
|
+
* provides it. Not part of the public API: a raw multi-provider would bypass
|
|
10
|
+
* the registry that carries a level's sources into the scopes below it.
|
|
12
11
|
*/
|
|
13
12
|
const CNGX_COMMAND_SOURCE = new InjectionToken('CNGX_COMMAND_SOURCE');
|
|
14
13
|
/**
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
14
|
+
* @internal Per-level registry: the sources of every `provideCommands` level
|
|
15
|
+
* above, plus this level's own. Resolved once per injector by the factory in
|
|
16
|
+
* `provideCommands`; not part of the public API.
|
|
17
|
+
*/
|
|
18
|
+
const CNGX_COMMAND_REGISTRY = new InjectionToken('CNGX_COMMAND_REGISTRY');
|
|
19
|
+
/**
|
|
20
|
+
* Registers one or more command sources. Call `provideCommands` from several
|
|
21
|
+
* app parts and `injectCommands` merges all of them, without a central list.
|
|
18
22
|
*
|
|
19
23
|
* Returns `Provider[]` (not `EnvironmentProviders`), so it registers at any
|
|
20
24
|
* injector scope - app root, a lazy route, or a component's `providers` /
|
|
21
25
|
* `viewProviders` - letting a route or component contribute a scoped command
|
|
22
|
-
* set
|
|
26
|
+
* set.
|
|
27
|
+
*
|
|
28
|
+
* A source is a static list, a `Signal` of commands, or a
|
|
29
|
+
* {@link CngxCommandSourceFactory} for a source that needs injection. The
|
|
30
|
+
* factory runs once in the injection context of the level it is registered
|
|
31
|
+
* at. Return a `Signal` from it to stay reactive: a factory returning a plain
|
|
32
|
+
* array (`() => store.items()`) is read at that first call and never again.
|
|
33
|
+
*
|
|
34
|
+
* ```ts
|
|
35
|
+
* // a source owned by a service
|
|
36
|
+
* { path: 'editor', providers: [provideCommands(() => inject(EditorStore).commands)] }
|
|
37
|
+
* ```
|
|
38
|
+
*
|
|
39
|
+
* A scoped call adds to the sets above it and never hides them, across route
|
|
40
|
+
* and component scopes: root and route scopes come first (outer to inner), then
|
|
41
|
+
* component scopes outer to inner. The same source reference registered at two
|
|
42
|
+
* levels is listed once. Command ids are unique in the merged list: a command
|
|
43
|
+
* whose `id` is already registered further out replaces that command in place,
|
|
44
|
+
* so a scope can swap a global command for its own version.
|
|
23
45
|
*
|
|
24
46
|
* ```ts
|
|
25
47
|
* // app root
|
|
26
48
|
* bootstrapApplication(AppComponent, { providers: [provideCommands(fileCommands)] });
|
|
49
|
+
* // a lazy route adds its set; its pages see fileCommands + reportCommands
|
|
50
|
+
* { path: 'reports', providers: [provideCommands(reportCommands)], component: Reports }
|
|
27
51
|
* // or component scope
|
|
28
52
|
* @Component({ viewProviders: [provideCommands(editorCommands)] })
|
|
29
53
|
* ```
|
|
30
54
|
*
|
|
31
|
-
* @
|
|
32
|
-
* @since 0.1.0
|
|
55
|
+
* @since 0.3.0
|
|
33
56
|
*/
|
|
34
57
|
function provideCommands(...sources) {
|
|
35
|
-
|
|
58
|
+
// Empty call: the parent registry flows through untouched.
|
|
59
|
+
if (sources.length === 0) {
|
|
60
|
+
return [];
|
|
61
|
+
}
|
|
62
|
+
return [
|
|
63
|
+
...sources.map((source) => isSourceValue(source)
|
|
64
|
+
? { provide: CNGX_COMMAND_SOURCE, useValue: source, multi: true }
|
|
65
|
+
: { provide: CNGX_COMMAND_SOURCE, useFactory: () => runFactory(source), multi: true }),
|
|
66
|
+
{
|
|
67
|
+
provide: CNGX_COMMAND_REGISTRY,
|
|
68
|
+
// The nearest CNGX_COMMAND_SOURCE is this level's own multi list, so the
|
|
69
|
+
// same factory works for environment, providers and viewProviders scopes.
|
|
70
|
+
useFactory: () => mergeSources(inject(CNGX_COMMAND_REGISTRY, { skipSelf: true, optional: true }) ?? [], inject(CNGX_COMMAND_SOURCE, { optional: true }) ?? []),
|
|
71
|
+
},
|
|
72
|
+
];
|
|
36
73
|
}
|
|
37
74
|
/**
|
|
38
|
-
* Merges
|
|
75
|
+
* Merges the command sources registered at this injector level and every level
|
|
76
|
+
* above it - route and component scopes alike - into one reactive
|
|
39
77
|
* `Signal<readonly CngxCommand[]>`. The merge carries an explicit `equal`
|
|
40
78
|
* (length + per-command identity) so re-emitting an identical set - the same
|
|
41
79
|
* command references in the same order - does not produce a fresh array and
|
|
@@ -43,12 +81,52 @@ function provideCommands(...sources) {
|
|
|
43
81
|
*
|
|
44
82
|
* Must run in an injection context.
|
|
45
83
|
*
|
|
46
|
-
* @
|
|
47
|
-
* @since 0.1.0
|
|
84
|
+
* @since 0.3.0
|
|
48
85
|
*/
|
|
49
86
|
function injectCommands() {
|
|
50
|
-
|
|
51
|
-
|
|
87
|
+
// A node resolves its element chain before its environment chain, so a
|
|
88
|
+
// routed component under a shell registry never reaches the route's
|
|
89
|
+
// registry. Read both trees once and join them: environment scopes first.
|
|
90
|
+
const sources = mergeSources(inject(EnvironmentInjector).get(CNGX_COMMAND_REGISTRY, null) ?? [], inject(CNGX_COMMAND_REGISTRY, { optional: true }) ?? [], inject(CNGX_COMMAND_SOURCE, { optional: true }) ?? []);
|
|
91
|
+
return computed(() => dedupeById(sources.flatMap(readSource)), { equal: commandsEqual });
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* @internal Keeps one command per `id`: the last registration (the innermost
|
|
95
|
+
* scope) wins, at the position of the first. A Map keeps a key's insertion slot
|
|
96
|
+
* when its value is replaced.
|
|
97
|
+
*/
|
|
98
|
+
function dedupeById(commands) {
|
|
99
|
+
const byId = new Map();
|
|
100
|
+
for (const command of commands) {
|
|
101
|
+
byId.set(command.id, command);
|
|
102
|
+
}
|
|
103
|
+
return byId.size === commands.length ? commands : [...byId.values()];
|
|
104
|
+
}
|
|
105
|
+
/** @internal Concatenates in argument order and drops repeated source references. */
|
|
106
|
+
function mergeSources(...lists) {
|
|
107
|
+
return [...new Set(lists.flat())];
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* @internal A `Signal` is callable too, so `isSignal` must decide before any
|
|
111
|
+
* function is taken for a factory.
|
|
112
|
+
*/
|
|
113
|
+
function isSourceValue(source) {
|
|
114
|
+
return isSignal(source) || Array.isArray(source);
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* @internal Runs a factory source. A non-source result (a JS caller, a cast)
|
|
118
|
+
* would otherwise surface as a TypeError deep inside the merged `computed`, so
|
|
119
|
+
* it is dropped here instead.
|
|
120
|
+
*/
|
|
121
|
+
function runFactory(factory) {
|
|
122
|
+
const source = factory();
|
|
123
|
+
if (isSourceValue(source)) {
|
|
124
|
+
return source;
|
|
125
|
+
}
|
|
126
|
+
if (typeof ngDevMode !== 'undefined' && ngDevMode) {
|
|
127
|
+
cngxDevWarn('CNGX1070', `provideCommands() factory returned ${source === null ? 'null' : typeof source}, not a command array or a Signal of one; it contributes no commands.`);
|
|
128
|
+
}
|
|
129
|
+
return [];
|
|
52
130
|
}
|
|
53
131
|
/** @internal Reads a source, unwrapping a signal or passing an array through. */
|
|
54
132
|
function readSource(source) {
|
|
@@ -81,8 +159,7 @@ function commandsEqual(a, b) {
|
|
|
81
159
|
* by its rules, e.g. Turkish `I` / `ı`; read inside a `computed()`, a locale
|
|
82
160
|
* switch re-ranks.
|
|
83
161
|
*
|
|
84
|
-
* @
|
|
85
|
-
* @since 0.1.0
|
|
162
|
+
* @since 0.3.0
|
|
86
163
|
*/
|
|
87
164
|
function createDefaultCommandMatcher(locale) {
|
|
88
165
|
// Folded label and keywords per command, re-folded only when the label, the
|
|
@@ -158,8 +235,7 @@ function scoreCommand({ label, keywords }, query) {
|
|
|
158
235
|
* without touching the panel. The fuzzy engine stays a consumer swap; the
|
|
159
236
|
* default bundle ships only the pure ranker.
|
|
160
237
|
*
|
|
161
|
-
* @
|
|
162
|
-
* @since 0.1.0
|
|
238
|
+
* @since 0.3.0
|
|
163
239
|
*/
|
|
164
240
|
const CNGX_COMMAND_MATCH_FACTORY = new InjectionToken('CNGX_COMMAND_MATCH_FACTORY', { providedIn: 'root', factory: () => () => createDefaultCommandMatcher(injectLocale()) });
|
|
165
241
|
|
|
@@ -167,5 +243,5 @@ const CNGX_COMMAND_MATCH_FACTORY = new InjectionToken('CNGX_COMMAND_MATCH_FACTOR
|
|
|
167
243
|
* Generated bundle index. Do not edit.
|
|
168
244
|
*/
|
|
169
245
|
|
|
170
|
-
export { CNGX_COMMAND_MATCH_FACTORY,
|
|
246
|
+
export { CNGX_COMMAND_MATCH_FACTORY, createDefaultCommandMatcher, injectCommands, provideCommands };
|
|
171
247
|
//# sourceMappingURL=cngx-common-command.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cngx-common-command.mjs","sources":["../../../projects/common/command/provide-commands.ts","../../../projects/common/command/match.ts","../../../projects/common/command/match-strategy.token.ts","../../../projects/common/command/cngx-common-command.ts"],"sourcesContent":["import {\n computed,\n inject,\n InjectionToken,\n type Provider,\n type Signal,\n} from '@angular/core';\n\nimport type { CngxCommand } from './command';\n\n/**\n * A command contribution. Either a static list or a reactive `Signal` of\n * commands - a signal source lets a contributor add or remove commands (or\n * flip a command's `disabled`) live, and `injectCommands` tracks it.\n *\n * @category common/command\n * @since 0.1.0\n */\nexport type CngxCommandSource = Signal<readonly CngxCommand[]> | readonly CngxCommand[];\n\n/**\n * Multi-token every `provideCommands` call contributes to. App parts register\n * command sets against it without a central list, mirroring `provideCngxMenu`.\n * The generic is the collected array (as with Angular's `HTTP_INTERCEPTORS`),\n * so `inject(CNGX_COMMAND_SOURCE)` returns every contributed source.\n *\n * @category common/command\n * @since 0.1.0\n */\nexport const CNGX_COMMAND_SOURCE = new InjectionToken<readonly CngxCommandSource[]>(\n 'CNGX_COMMAND_SOURCE',\n);\n\n/**\n * Registers one or more command sources. Each source becomes a `multi` entry\n * on {@link CNGX_COMMAND_SOURCE}; call `provideCommands` from several app parts\n * and `injectCommands` merges all of them.\n *\n * Returns `Provider[]` (not `EnvironmentProviders`), so it registers at any\n * injector scope - app root, a lazy route, or a component's `providers` /\n * `viewProviders` - letting a route or component contribute a scoped command\n * set without reaching for the raw {@link CNGX_COMMAND_SOURCE} multi-provider.\n *\n * ```ts\n * // app root\n * bootstrapApplication(AppComponent, { providers: [provideCommands(fileCommands)] });\n * // or component scope\n * @Component({ viewProviders: [provideCommands(editorCommands)] })\n * ```\n *\n * @category common/command\n * @since 0.1.0\n */\nexport function provideCommands(...sources: CngxCommandSource[]): Provider[] {\n return sources.map((source) => ({ provide: CNGX_COMMAND_SOURCE, useValue: source, multi: true }));\n}\n\n/**\n * Merges every registered {@link CNGX_COMMAND_SOURCE} into one reactive\n * `Signal<readonly CngxCommand[]>`. The merge carries an explicit `equal`\n * (length + per-command identity) so re-emitting an identical set - the same\n * command references in the same order - does not produce a fresh array and\n * cascade the downstream match `computed()`.\n *\n * Must run in an injection context.\n *\n * @category common/command\n * @since 0.1.0\n */\nexport function injectCommands(): Signal<readonly CngxCommand[]> {\n const sources = inject(CNGX_COMMAND_SOURCE, { optional: true }) ?? [];\n return computed(() => sources.flatMap(readSource), { equal: commandsEqual });\n}\n\n/** @internal Reads a source, unwrapping a signal or passing an array through. */\nfunction readSource(source: CngxCommandSource): readonly CngxCommand[] {\n return typeof source === 'function' ? source() : source;\n}\n\n/**\n * @internal Length + per-command identity. Identity subsumes id equality, so a\n * re-provided set of the same references short-circuits without re-emitting.\n */\nfunction commandsEqual(a: readonly CngxCommand[], b: readonly CngxCommand[]): boolean {\n if (a === b) {\n return true;\n }\n if (a.length !== b.length) {\n return false;\n }\n return a.every((command, i) => command === b[i]);\n}\n","import type { Signal } from '@angular/core';\nimport { foldForMatching } from '@cngx/core/utils';\n\nimport type { CngxCommand } from './command';\n\n/**\n * A command paired with its match score for a given query. Higher scores rank\n * first. The palette renders these in order; the row slot reads `command` and\n * the term to highlight.\n *\n * @category common/command\n * @since 0.1.0\n */\nexport interface CngxRankedCommand {\n /** The matched command. */\n readonly command: CngxCommand;\n /** Relevance score for the query; higher ranks first. `0` for an empty query. */\n readonly score: number;\n}\n\n/**\n * @deprecated Use {@link CngxRankedCommand}. Published under the unprefixed\n * name by mistake; the alias remains for compatibility and will be removed in\n * a future major.\n * @category common/command\n * @since 0.1.0\n */\nexport type RankedCommand = CngxRankedCommand;\n\n/**\n * Ranks and filters a command set against a query and optional scope. Swappable\n * via {@link CNGX_COMMAND_MATCH_FACTORY} - a consumer drops in Levenshtein or a\n * fuzzy engine without touching the panel.\n *\n * @category common/command\n * @since 0.1.0\n */\nexport type CngxCommandMatcher = (\n commands: readonly CngxCommand[],\n term: string,\n scope?: string,\n) => readonly CngxRankedCommand[];\n\n/**\n * Builds the default matcher: a pure label/keyword ranker. An empty query\n * returns every (scoped) command at score `0` in registration order; a\n * non-empty query keeps only commands that match label or keyword, ranked\n * label-exact > label-prefix > label-substring > keyword. The optional scope\n * filters to commands whose `group` equals it.\n *\n * Query, labels and keywords are compared case- and accent-tolerant\n * ({@link foldForMatching}): `uber` finds `Über`. Pass the app locale (the\n * default `CNGX_COMMAND_MATCH_FACTORY` passes `injectLocale()`) so case folds\n * by its rules, e.g. Turkish `I` / `ı`; read inside a `computed()`, a locale\n * switch re-ranks.\n *\n * @category common/command\n * @since 0.1.0\n */\nexport function createDefaultCommandMatcher(locale?: Signal<string>): CngxCommandMatcher {\n // Folded label and keywords per command, re-folded only when the label, the\n // keywords array or the locale changes - not on every keystroke.\n const folded = new WeakMap<CngxCommand, FoldedCommand>();\n const foldedFor = (command: CngxCommand, activeLocale: string | undefined): FoldedCommand => {\n const hit = folded.get(command);\n if (\n hit !== undefined &&\n hit.locale === activeLocale &&\n hit.sourceLabel === command.label &&\n hit.sourceKeywords === command.keywords\n ) {\n return hit;\n }\n const entry: FoldedCommand = {\n locale: activeLocale,\n sourceLabel: command.label,\n sourceKeywords: command.keywords,\n label: foldForMatching(command.label, activeLocale),\n keywords: (command.keywords ?? []).map((keyword) => foldForMatching(keyword, activeLocale)),\n };\n folded.set(command, entry);\n return entry;\n };\n\n return (commands, term, scope) => {\n const scoped = scope ? commands.filter((command) => command.group === scope) : commands;\n const activeLocale = locale?.();\n const query = foldForMatching(term.trim(), activeLocale);\n if (query.length === 0) {\n return scoped.map((command) => ({ command, score: 0 }));\n }\n\n const ranked: CngxRankedCommand[] = [];\n for (const command of scoped) {\n const score = scoreCommand(foldedFor(command, activeLocale), query);\n if (score > 0) {\n ranked.push({ command, score });\n }\n }\n // Stable within equal scores: the sort is stable in V8, so registration\n // order breaks ties.\n ranked.sort((a, b) => b.score - a.score);\n return ranked;\n };\n}\n\n/** @internal A command's label and keywords, folded for one locale. */\ninterface FoldedCommand {\n readonly locale: string | undefined;\n readonly sourceLabel: string;\n readonly sourceKeywords: CngxCommand['keywords'];\n readonly label: string;\n readonly keywords: readonly string[];\n}\n\n/** @internal Scores one folded command against a folded query; `0` means no match. */\nfunction scoreCommand({ label, keywords }: FoldedCommand, query: string): number {\n if (label === query) {\n return 100;\n }\n if (label.startsWith(query)) {\n return 80;\n }\n if (label.includes(query)) {\n return 60;\n }\n for (const value of keywords) {\n if (value === query) {\n return 50;\n }\n if (value.startsWith(query)) {\n return 40;\n }\n if (value.includes(query)) {\n return 20;\n }\n }\n return 0;\n}\n","import { InjectionToken } from '@angular/core';\nimport { injectLocale } from '@cngx/core/utils';\n\nimport { createDefaultCommandMatcher, type CngxCommandMatcher } from './match';\n\n/**\n * Factory producing a {@link CngxCommandMatcher}. The exact signature is\n * captured so an override matches it precisely. The panel calls it in an\n * injection context, so a factory may `inject()` what its matcher needs.\n *\n * @category common/command\n * @since 0.1.0\n */\nexport type CngxCommandMatchFactory = () => CngxCommandMatcher;\n\n/**\n * Swappable match-strategy seam. Defaults to {@link createDefaultCommandMatcher}\n * (pure label/keyword ranking, case- and accent-tolerant in the app locale). Override it - app-wide via `providers` or\n * per-component via `viewProviders` - to drop in a fuzzy/Levenshtein ranker\n * without touching the panel. The fuzzy engine stays a consumer swap; the\n * default bundle ships only the pure ranker.\n *\n * @category common/command\n * @since 0.1.0\n */\nexport const CNGX_COMMAND_MATCH_FACTORY = new InjectionToken<CngxCommandMatchFactory>(\n 'CNGX_COMMAND_MATCH_FACTORY',\n { providedIn: 'root', factory: () => () => createDefaultCommandMatcher(injectLocale()) },\n);\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;AAoBA;;;;;;;;AAQG;MACU,mBAAmB,GAAG,IAAI,cAAc,CACnD,qBAAqB;AAGvB;;;;;;;;;;;;;;;;;;;AAmBG;AACG,SAAU,eAAe,CAAC,GAAG,OAA4B,EAAA;IAC7D,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,MAAM,EAAE,OAAO,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AACnG;AAEA;;;;;;;;;;;AAWG;SACa,cAAc,GAAA;AAC5B,IAAA,MAAM,OAAO,GAAG,MAAM,CAAC,mBAAmB,EAAE,EAAE,QAAQ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;AACH;AAWA;AACA,SAAS,YAAY,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAiB,EAAE,KAAa,EAAA;AACrE,IAAA,IAAI,KAAK,KAAK,KAAK,EAAE;AACnB,QAAA,OAAO,GAAG;IACZ;AACA,IAAA,IAAI,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE;AAC3B,QAAA,OAAO,EAAE;IACX;AACA,IAAA,IAAI,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;AACzB,QAAA,OAAO,EAAE;IACX;AACA,IAAA,KAAK,MAAM,KAAK,IAAI,QAAQ,EAAE;AAC5B,QAAA,IAAI,KAAK,KAAK,KAAK,EAAE;AACnB,YAAA,OAAO,EAAE;QACX;AACA,QAAA,IAAI,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE;AAC3B,YAAA,OAAO,EAAE;QACX;AACA,QAAA,IAAI,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;AACzB,YAAA,OAAO,EAAE;QACX;IACF;AACA,IAAA,OAAO,CAAC;AACV;;AC3HA;;;;;;;;;AASG;AACI,MAAM,0BAA0B,GAAG,IAAI,cAAc,CAC1D,4BAA4B,EAC5B,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,MAAM,2BAA2B,CAAC,YAAY,EAAE,CAAC,EAAE;;AC3B1F;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"cngx-common-command.mjs","sources":["../../../projects/common/command/provide-commands.ts","../../../projects/common/command/match.ts","../../../projects/common/command/match-strategy.token.ts","../../../projects/common/command/cngx-common-command.ts"],"sourcesContent":["import {\n computed,\n EnvironmentInjector,\n inject,\n InjectionToken,\n isSignal,\n type Provider,\n type Signal,\n} from '@angular/core';\nimport { cngxDevWarn } from '@cngx/utils';\n\nimport type { CngxCommand } from './command';\n\n/**\n * A command contribution. Either a static list or a reactive `Signal` of\n * commands - a signal source lets a contributor add or remove commands (or\n * flip a command's `disabled`) live, and `injectCommands` tracks it.\n *\n * @since 0.3.0\n */\nexport type CngxCommandSource = Signal<readonly CngxCommand[]> | readonly CngxCommand[];\n\n/**\n * A source that needs injection. `provideCommands` runs it once, as a provider\n * factory in the injection context of the level it is registered at, so it can\n * call `inject()`. It is not a `computed`: a factory returning a plain array is\n * frozen at that first call. Return a `Signal` to stay reactive. A factory that\n * returns anything else contributes no commands and warns in dev mode\n * ([`CNGX1070`](/error-codes/cngx1070.md)).\n *\n * The factory must not call `injectCommands()`, directly or through a service\n * it injects at the same level: that reads the registry the factory is still\n * building, and Angular throws a circular-dependency error (NG0200).\n *\n * @relatedTo provideCommands\n * @since 0.3.0\n */\nexport type CngxCommandSourceFactory = () => CngxCommandSource;\n\n/**\n * @internal Multi-token every `provideCommands` call contributes to. The\n * generic is the collected array (as with Angular's `HTTP_INTERCEPTORS`), so\n * `inject(CNGX_COMMAND_SOURCE)` returns the sources of the nearest level that\n * provides it. Not part of the public API: a raw multi-provider would bypass\n * the registry that carries a level's sources into the scopes below it.\n */\nconst CNGX_COMMAND_SOURCE = new InjectionToken<readonly CngxCommandSource[]>(\n 'CNGX_COMMAND_SOURCE',\n);\n\n/**\n * @internal Per-level registry: the sources of every `provideCommands` level\n * above, plus this level's own. Resolved once per injector by the factory in\n * `provideCommands`; not part of the public API.\n */\nconst CNGX_COMMAND_REGISTRY = new InjectionToken<readonly CngxCommandSource[]>(\n 'CNGX_COMMAND_REGISTRY',\n);\n\n/**\n * Registers one or more command sources. Call `provideCommands` from several\n * app parts and `injectCommands` merges all of them, without a central list.\n *\n * Returns `Provider[]` (not `EnvironmentProviders`), so it registers at any\n * injector scope - app root, a lazy route, or a component's `providers` /\n * `viewProviders` - letting a route or component contribute a scoped command\n * set.\n *\n * A source is a static list, a `Signal` of commands, or a\n * {@link CngxCommandSourceFactory} for a source that needs injection. The\n * factory runs once in the injection context of the level it is registered\n * at. Return a `Signal` from it to stay reactive: a factory returning a plain\n * array (`() => store.items()`) is read at that first call and never again.\n *\n * ```ts\n * // a source owned by a service\n * { path: 'editor', providers: [provideCommands(() => inject(EditorStore).commands)] }\n * ```\n *\n * A scoped call adds to the sets above it and never hides them, across route\n * and component scopes: root and route scopes come first (outer to inner), then\n * component scopes outer to inner. The same source reference registered at two\n * levels is listed once. Command ids are unique in the merged list: a command\n * whose `id` is already registered further out replaces that command in place,\n * so a scope can swap a global command for its own version.\n *\n * ```ts\n * // app root\n * bootstrapApplication(AppComponent, { providers: [provideCommands(fileCommands)] });\n * // a lazy route adds its set; its pages see fileCommands + reportCommands\n * { path: 'reports', providers: [provideCommands(reportCommands)], component: Reports }\n * // or component scope\n * @Component({ viewProviders: [provideCommands(editorCommands)] })\n * ```\n *\n * @since 0.3.0\n */\nexport function provideCommands(\n ...sources: (CngxCommandSource | CngxCommandSourceFactory)[]\n): Provider[] {\n // Empty call: the parent registry flows through untouched.\n if (sources.length === 0) {\n return [];\n }\n return [\n ...sources.map((source) =>\n isSourceValue(source)\n ? { provide: CNGX_COMMAND_SOURCE, useValue: source, multi: true }\n : { provide: CNGX_COMMAND_SOURCE, useFactory: () => runFactory(source), multi: true },\n ),\n {\n provide: CNGX_COMMAND_REGISTRY,\n // The nearest CNGX_COMMAND_SOURCE is this level's own multi list, so the\n // same factory works for environment, providers and viewProviders scopes.\n useFactory: () =>\n mergeSources(\n inject(CNGX_COMMAND_REGISTRY, { skipSelf: true, optional: true }) ?? [],\n inject(CNGX_COMMAND_SOURCE, { optional: true }) ?? [],\n ),\n },\n ];\n}\n\n/**\n * Merges the command sources registered at this injector level and every level\n * above it - route and component scopes alike - into one reactive\n * `Signal<readonly CngxCommand[]>`. The merge carries an explicit `equal`\n * (length + per-command identity) so re-emitting an identical set - the same\n * command references in the same order - does not produce a fresh array and\n * cascade the downstream match `computed()`.\n *\n * Must run in an injection context.\n *\n * @since 0.3.0\n */\nexport function injectCommands(): Signal<readonly CngxCommand[]> {\n // A node resolves its element chain before its environment chain, so a\n // routed component under a shell registry never reaches the route's\n // registry. Read both trees once and join them: environment scopes first.\n const sources = mergeSources(\n inject(EnvironmentInjector).get(CNGX_COMMAND_REGISTRY, null) ?? [],\n inject(CNGX_COMMAND_REGISTRY, { optional: true }) ?? [],\n inject(CNGX_COMMAND_SOURCE, { optional: true }) ?? [],\n );\n return computed(() => dedupeById(sources.flatMap(readSource)), { equal: commandsEqual });\n}\n\n/**\n * @internal Keeps one command per `id`: the last registration (the innermost\n * scope) wins, at the position of the first. A Map keeps a key's insertion slot\n * when its value is replaced.\n */\nfunction dedupeById(commands: readonly CngxCommand[]): readonly CngxCommand[] {\n const byId = new Map<string, CngxCommand>();\n for (const command of commands) {\n byId.set(command.id, command);\n }\n return byId.size === commands.length ? commands : [...byId.values()];\n}\n\n/** @internal Concatenates in argument order and drops repeated source references. */\nfunction mergeSources(...lists: (readonly CngxCommandSource[])[]): readonly CngxCommandSource[] {\n return [...new Set(lists.flat())];\n}\n\n/**\n * @internal A `Signal` is callable too, so `isSignal` must decide before any\n * function is taken for a factory.\n */\nfunction isSourceValue(source: unknown): source is CngxCommandSource {\n return isSignal(source) || Array.isArray(source);\n}\n\n/**\n * @internal Runs a factory source. A non-source result (a JS caller, a cast)\n * would otherwise surface as a TypeError deep inside the merged `computed`, so\n * it is dropped here instead.\n */\nfunction runFactory(factory: CngxCommandSourceFactory): CngxCommandSource {\n const source: unknown = factory();\n if (isSourceValue(source)) {\n return source;\n }\n if (typeof ngDevMode !== 'undefined' && ngDevMode) {\n cngxDevWarn(\n 'CNGX1070',\n `provideCommands() factory returned ${source === null ? 'null' : typeof source}, not a command array or a Signal of one; it contributes no commands.`,\n );\n }\n return [];\n}\n\n/** @internal Reads a source, unwrapping a signal or passing an array through. */\nfunction readSource(source: CngxCommandSource): readonly CngxCommand[] {\n return typeof source === 'function' ? source() : source;\n}\n\n/**\n * @internal Length + per-command identity. Identity subsumes id equality, so a\n * re-provided set of the same references short-circuits without re-emitting.\n */\nfunction commandsEqual(a: readonly CngxCommand[], b: readonly CngxCommand[]): boolean {\n if (a === b) {\n return true;\n }\n if (a.length !== b.length) {\n return false;\n }\n return a.every((command, i) => command === b[i]);\n}\n","import type { Signal } from '@angular/core';\nimport { foldForMatching } from '@cngx/core/utils';\n\nimport type { CngxCommand } from './command';\n\n/**\n * A command paired with its match score for a given query. Higher scores rank\n * first. The palette renders these in order; the row slot reads `command` and\n * the term to highlight.\n *\n * @since 0.3.0\n */\nexport interface CngxRankedCommand {\n /** The matched command. */\n readonly command: CngxCommand;\n /** Relevance score for the query; higher ranks first. `0` for an empty query. */\n readonly score: number;\n}\n\n/**\n * @deprecated Use {@link CngxRankedCommand}. Published under the unprefixed\n * name by mistake; the alias remains for compatibility and will be removed in\n * a future major.\n * @since 0.3.0\n */\nexport type RankedCommand = CngxRankedCommand;\n\n/**\n * Ranks and filters a command set against a query and optional scope. Swappable\n * via {@link CNGX_COMMAND_MATCH_FACTORY} - a consumer drops in Levenshtein or a\n * fuzzy engine without touching the panel.\n *\n * @since 0.3.0\n */\nexport type CngxCommandMatcher = (\n commands: readonly CngxCommand[],\n term: string,\n scope?: string,\n) => readonly CngxRankedCommand[];\n\n/**\n * Builds the default matcher: a pure label/keyword ranker. An empty query\n * returns every (scoped) command at score `0` in registration order; a\n * non-empty query keeps only commands that match label or keyword, ranked\n * label-exact > label-prefix > label-substring > keyword. The optional scope\n * filters to commands whose `group` equals it.\n *\n * Query, labels and keywords are compared case- and accent-tolerant\n * ({@link foldForMatching}): `uber` finds `Über`. Pass the app locale (the\n * default `CNGX_COMMAND_MATCH_FACTORY` passes `injectLocale()`) so case folds\n * by its rules, e.g. Turkish `I` / `ı`; read inside a `computed()`, a locale\n * switch re-ranks.\n *\n * @since 0.3.0\n */\nexport function createDefaultCommandMatcher(locale?: Signal<string>): CngxCommandMatcher {\n // Folded label and keywords per command, re-folded only when the label, the\n // keywords array or the locale changes - not on every keystroke.\n const folded = new WeakMap<CngxCommand, FoldedCommand>();\n const foldedFor = (command: CngxCommand, activeLocale: string | undefined): FoldedCommand => {\n const hit = folded.get(command);\n if (\n hit !== undefined &&\n hit.locale === activeLocale &&\n hit.sourceLabel === command.label &&\n hit.sourceKeywords === command.keywords\n ) {\n return hit;\n }\n const entry: FoldedCommand = {\n locale: activeLocale,\n sourceLabel: command.label,\n sourceKeywords: command.keywords,\n label: foldForMatching(command.label, activeLocale),\n keywords: (command.keywords ?? []).map((keyword) => foldForMatching(keyword, activeLocale)),\n };\n folded.set(command, entry);\n return entry;\n };\n\n return (commands, term, scope) => {\n const scoped = scope ? commands.filter((command) => command.group === scope) : commands;\n const activeLocale = locale?.();\n const query = foldForMatching(term.trim(), activeLocale);\n if (query.length === 0) {\n return scoped.map((command) => ({ command, score: 0 }));\n }\n\n const ranked: CngxRankedCommand[] = [];\n for (const command of scoped) {\n const score = scoreCommand(foldedFor(command, activeLocale), query);\n if (score > 0) {\n ranked.push({ command, score });\n }\n }\n // Stable within equal scores: the sort is stable in V8, so registration\n // order breaks ties.\n ranked.sort((a, b) => b.score - a.score);\n return ranked;\n };\n}\n\n/** @internal A command's label and keywords, folded for one locale. */\ninterface FoldedCommand {\n readonly locale: string | undefined;\n readonly sourceLabel: string;\n readonly sourceKeywords: CngxCommand['keywords'];\n readonly label: string;\n readonly keywords: readonly string[];\n}\n\n/** @internal Scores one folded command against a folded query; `0` means no match. */\nfunction scoreCommand({ label, keywords }: FoldedCommand, query: string): number {\n if (label === query) {\n return 100;\n }\n if (label.startsWith(query)) {\n return 80;\n }\n if (label.includes(query)) {\n return 60;\n }\n for (const value of keywords) {\n if (value === query) {\n return 50;\n }\n if (value.startsWith(query)) {\n return 40;\n }\n if (value.includes(query)) {\n return 20;\n }\n }\n return 0;\n}\n","import { InjectionToken } from '@angular/core';\nimport { injectLocale } from '@cngx/core/utils';\n\nimport { createDefaultCommandMatcher, type CngxCommandMatcher } from './match';\n\n/**\n * Factory producing a {@link CngxCommandMatcher}. The exact signature is\n * captured so an override matches it precisely. The panel calls it in an\n * injection context, so a factory may `inject()` what its matcher needs.\n *\n * @since 0.3.0\n */\nexport type CngxCommandMatchFactory = () => CngxCommandMatcher;\n\n/**\n * Swappable match-strategy seam. Defaults to {@link createDefaultCommandMatcher}\n * (pure label/keyword ranking, case- and accent-tolerant in the app locale). Override it - app-wide via `providers` or\n * per-component via `viewProviders` - to drop in a fuzzy/Levenshtein ranker\n * without touching the panel. The fuzzy engine stays a consumer swap; the\n * default bundle ships only the pure ranker.\n *\n * @since 0.3.0\n */\nexport const CNGX_COMMAND_MATCH_FACTORY = new InjectionToken<CngxCommandMatchFactory>(\n 'CNGX_COMMAND_MATCH_FACTORY',\n { providedIn: 'root', factory: () => () => createDefaultCommandMatcher(injectLocale()) },\n);\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;AAuCA;;;;;;AAMG;AACH,MAAM,mBAAmB,GAAG,IAAI,cAAc,CAC5C,qBAAqB,CACtB;AAED;;;;AAIG;AACH,MAAM,qBAAqB,GAAG,IAAI,cAAc,CAC9C,uBAAuB,CACxB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCG;AACG,SAAU,eAAe,CAC7B,GAAG,OAAyD,EAAA;;AAG5D,IAAA,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE;AACxB,QAAA,OAAO,EAAE;IACX;IACA,OAAO;AACL,QAAA,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,KACpB,aAAa,CAAC,MAAM;AAClB,cAAE,EAAE,OAAO,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI;cAC7D,EAAE,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CACxF;AACD,QAAA;AACE,YAAA,OAAO,EAAE,qBAAqB;;;AAG9B,YAAA,UAAU,EAAE,MACV,YAAY,CACV,MAAM,CAAC,qBAAqB,EAAE,EAAE,QAAQ,EAAE,IAAI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