@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,4 +1,4 @@
|
|
|
1
|
-
import { Signal,
|
|
1
|
+
import { Signal, Provider, InjectionToken } from '@angular/core';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* A single registrable command - a labelled action the command palette can
|
|
@@ -10,8 +10,7 @@ import { Signal, InjectionToken, Provider } from '@angular/core';
|
|
|
10
10
|
* parameter: a payload rides on `data` as `unknown` and the row slot narrows
|
|
11
11
|
* it at the use-site.
|
|
12
12
|
*
|
|
13
|
-
* @
|
|
14
|
-
* @since 0.1.0
|
|
13
|
+
* @since 0.3.0
|
|
15
14
|
*/
|
|
16
15
|
interface CngxCommand {
|
|
17
16
|
/** Stable identity. Drives the merge `equal` and the `aria-activedescendant` id. */
|
|
@@ -42,8 +41,7 @@ interface CngxCommand {
|
|
|
42
41
|
* an empty query, then categories) and the consumer's async result source is a
|
|
43
42
|
* `CngxAsyncState<CngxCommandGroup[]>`.
|
|
44
43
|
*
|
|
45
|
-
* @
|
|
46
|
-
* @since 0.1.0
|
|
44
|
+
* @since 0.3.0
|
|
47
45
|
*/
|
|
48
46
|
interface CngxCommandGroup {
|
|
49
47
|
/** Stable identity for the group header slot and change detection. */
|
|
@@ -57,8 +55,7 @@ interface CngxCommandGroup {
|
|
|
57
55
|
* @deprecated Use {@link CngxCommandGroup}. Published under the unprefixed
|
|
58
56
|
* name by mistake; the alias remains for compatibility and will be removed in
|
|
59
57
|
* a future major.
|
|
60
|
-
* @
|
|
61
|
-
* @since 0.1.0
|
|
58
|
+
* @since 0.3.0
|
|
62
59
|
*/
|
|
63
60
|
type CommandGroup = CngxCommandGroup;
|
|
64
61
|
|
|
@@ -67,43 +64,67 @@ type CommandGroup = CngxCommandGroup;
|
|
|
67
64
|
* commands - a signal source lets a contributor add or remove commands (or
|
|
68
65
|
* flip a command's `disabled`) live, and `injectCommands` tracks it.
|
|
69
66
|
*
|
|
70
|
-
* @
|
|
71
|
-
* @since 0.1.0
|
|
67
|
+
* @since 0.3.0
|
|
72
68
|
*/
|
|
73
69
|
type CngxCommandSource = Signal<readonly CngxCommand[]> | readonly CngxCommand[];
|
|
74
70
|
/**
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
71
|
+
* A source that needs injection. `provideCommands` runs it once, as a provider
|
|
72
|
+
* factory in the injection context of the level it is registered at, so it can
|
|
73
|
+
* call `inject()`. It is not a `computed`: a factory returning a plain array is
|
|
74
|
+
* frozen at that first call. Return a `Signal` to stay reactive. A factory that
|
|
75
|
+
* returns anything else contributes no commands and warns in dev mode
|
|
76
|
+
* ([`CNGX1070`](/error-codes/cngx1070.md)).
|
|
77
|
+
*
|
|
78
|
+
* The factory must not call `injectCommands()`, directly or through a service
|
|
79
|
+
* it injects at the same level: that reads the registry the factory is still
|
|
80
|
+
* building, and Angular throws a circular-dependency error (NG0200).
|
|
81
|
+
*
|
|
82
|
+
* @relatedTo provideCommands
|
|
83
|
+
* @since 0.3.0
|
|
82
84
|
*/
|
|
83
|
-
|
|
85
|
+
type CngxCommandSourceFactory = () => CngxCommandSource;
|
|
84
86
|
/**
|
|
85
|
-
* Registers one or more command sources.
|
|
86
|
-
*
|
|
87
|
-
* and `injectCommands` merges all of them.
|
|
87
|
+
* Registers one or more command sources. Call `provideCommands` from several
|
|
88
|
+
* app parts and `injectCommands` merges all of them, without a central list.
|
|
88
89
|
*
|
|
89
90
|
* Returns `Provider[]` (not `EnvironmentProviders`), so it registers at any
|
|
90
91
|
* injector scope - app root, a lazy route, or a component's `providers` /
|
|
91
92
|
* `viewProviders` - letting a route or component contribute a scoped command
|
|
92
|
-
* set
|
|
93
|
+
* set.
|
|
94
|
+
*
|
|
95
|
+
* A source is a static list, a `Signal` of commands, or a
|
|
96
|
+
* {@link CngxCommandSourceFactory} for a source that needs injection. The
|
|
97
|
+
* factory runs once in the injection context of the level it is registered
|
|
98
|
+
* at. Return a `Signal` from it to stay reactive: a factory returning a plain
|
|
99
|
+
* array (`() => store.items()`) is read at that first call and never again.
|
|
100
|
+
*
|
|
101
|
+
* ```ts
|
|
102
|
+
* // a source owned by a service
|
|
103
|
+
* { path: 'editor', providers: [provideCommands(() => inject(EditorStore).commands)] }
|
|
104
|
+
* ```
|
|
105
|
+
*
|
|
106
|
+
* A scoped call adds to the sets above it and never hides them, across route
|
|
107
|
+
* and component scopes: root and route scopes come first (outer to inner), then
|
|
108
|
+
* component scopes outer to inner. The same source reference registered at two
|
|
109
|
+
* levels is listed once. Command ids are unique in the merged list: a command
|
|
110
|
+
* whose `id` is already registered further out replaces that command in place,
|
|
111
|
+
* so a scope can swap a global command for its own version.
|
|
93
112
|
*
|
|
94
113
|
* ```ts
|
|
95
114
|
* // app root
|
|
96
115
|
* bootstrapApplication(AppComponent, { providers: [provideCommands(fileCommands)] });
|
|
116
|
+
* // a lazy route adds its set; its pages see fileCommands + reportCommands
|
|
117
|
+
* { path: 'reports', providers: [provideCommands(reportCommands)], component: Reports }
|
|
97
118
|
* // or component scope
|
|
98
119
|
* @Component({ viewProviders: [provideCommands(editorCommands)] })
|
|
99
120
|
* ```
|
|
100
121
|
*
|
|
101
|
-
* @
|
|
102
|
-
* @since 0.1.0
|
|
122
|
+
* @since 0.3.0
|
|
103
123
|
*/
|
|
104
|
-
declare function provideCommands(...sources: CngxCommandSource[]): Provider[];
|
|
124
|
+
declare function provideCommands(...sources: (CngxCommandSource | CngxCommandSourceFactory)[]): Provider[];
|
|
105
125
|
/**
|
|
106
|
-
* Merges
|
|
126
|
+
* Merges the command sources registered at this injector level and every level
|
|
127
|
+
* above it - route and component scopes alike - into one reactive
|
|
107
128
|
* `Signal<readonly CngxCommand[]>`. The merge carries an explicit `equal`
|
|
108
129
|
* (length + per-command identity) so re-emitting an identical set - the same
|
|
109
130
|
* command references in the same order - does not produce a fresh array and
|
|
@@ -111,8 +132,7 @@ declare function provideCommands(...sources: CngxCommandSource[]): Provider[];
|
|
|
111
132
|
*
|
|
112
133
|
* Must run in an injection context.
|
|
113
134
|
*
|
|
114
|
-
* @
|
|
115
|
-
* @since 0.1.0
|
|
135
|
+
* @since 0.3.0
|
|
116
136
|
*/
|
|
117
137
|
declare function injectCommands(): Signal<readonly CngxCommand[]>;
|
|
118
138
|
|
|
@@ -121,8 +141,7 @@ declare function injectCommands(): Signal<readonly CngxCommand[]>;
|
|
|
121
141
|
* first. The palette renders these in order; the row slot reads `command` and
|
|
122
142
|
* the term to highlight.
|
|
123
143
|
*
|
|
124
|
-
* @
|
|
125
|
-
* @since 0.1.0
|
|
144
|
+
* @since 0.3.0
|
|
126
145
|
*/
|
|
127
146
|
interface CngxRankedCommand {
|
|
128
147
|
/** The matched command. */
|
|
@@ -134,8 +153,7 @@ interface CngxRankedCommand {
|
|
|
134
153
|
* @deprecated Use {@link CngxRankedCommand}. Published under the unprefixed
|
|
135
154
|
* name by mistake; the alias remains for compatibility and will be removed in
|
|
136
155
|
* a future major.
|
|
137
|
-
* @
|
|
138
|
-
* @since 0.1.0
|
|
156
|
+
* @since 0.3.0
|
|
139
157
|
*/
|
|
140
158
|
type RankedCommand = CngxRankedCommand;
|
|
141
159
|
/**
|
|
@@ -143,8 +161,7 @@ type RankedCommand = CngxRankedCommand;
|
|
|
143
161
|
* via {@link CNGX_COMMAND_MATCH_FACTORY} - a consumer drops in Levenshtein or a
|
|
144
162
|
* fuzzy engine without touching the panel.
|
|
145
163
|
*
|
|
146
|
-
* @
|
|
147
|
-
* @since 0.1.0
|
|
164
|
+
* @since 0.3.0
|
|
148
165
|
*/
|
|
149
166
|
type CngxCommandMatcher = (commands: readonly CngxCommand[], term: string, scope?: string) => readonly CngxRankedCommand[];
|
|
150
167
|
/**
|
|
@@ -160,8 +177,7 @@ type CngxCommandMatcher = (commands: readonly CngxCommand[], term: string, scope
|
|
|
160
177
|
* by its rules, e.g. Turkish `I` / `ı`; read inside a `computed()`, a locale
|
|
161
178
|
* switch re-ranks.
|
|
162
179
|
*
|
|
163
|
-
* @
|
|
164
|
-
* @since 0.1.0
|
|
180
|
+
* @since 0.3.0
|
|
165
181
|
*/
|
|
166
182
|
declare function createDefaultCommandMatcher(locale?: Signal<string>): CngxCommandMatcher;
|
|
167
183
|
|
|
@@ -170,8 +186,7 @@ declare function createDefaultCommandMatcher(locale?: Signal<string>): CngxComma
|
|
|
170
186
|
* captured so an override matches it precisely. The panel calls it in an
|
|
171
187
|
* injection context, so a factory may `inject()` what its matcher needs.
|
|
172
188
|
*
|
|
173
|
-
* @
|
|
174
|
-
* @since 0.1.0
|
|
189
|
+
* @since 0.3.0
|
|
175
190
|
*/
|
|
176
191
|
type CngxCommandMatchFactory = () => CngxCommandMatcher;
|
|
177
192
|
/**
|
|
@@ -181,10 +196,9 @@ type CngxCommandMatchFactory = () => CngxCommandMatcher;
|
|
|
181
196
|
* without touching the panel. The fuzzy engine stays a consumer swap; the
|
|
182
197
|
* default bundle ships only the pure ranker.
|
|
183
198
|
*
|
|
184
|
-
* @
|
|
185
|
-
* @since 0.1.0
|
|
199
|
+
* @since 0.3.0
|
|
186
200
|
*/
|
|
187
201
|
declare const CNGX_COMMAND_MATCH_FACTORY: InjectionToken<CngxCommandMatchFactory>;
|
|
188
202
|
|
|
189
|
-
export { CNGX_COMMAND_MATCH_FACTORY,
|
|
190
|
-
export type { CngxCommand, CngxCommandGroup, CngxCommandMatchFactory, CngxCommandMatcher, CngxCommandSource, CngxRankedCommand, CommandGroup, RankedCommand };
|
|
203
|
+
export { CNGX_COMMAND_MATCH_FACTORY, createDefaultCommandMatcher, injectCommands, provideCommands };
|
|
204
|
+
export type { CngxCommand, CngxCommandGroup, CngxCommandMatchFactory, CngxCommandMatcher, CngxCommandSource, CngxCommandSourceFactory, CngxRankedCommand, CommandGroup, RankedCommand };
|