@maliardic/ma-ui 3.0.0 → 3.1.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maliardic/ma-ui",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "Standalone Angular UI components, directives and CSS variable themes.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"sideEffects": [
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
}
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@maliardic/ma-icon": "^3.
|
|
45
|
+
"@maliardic/ma-icon": "^3.1.0",
|
|
46
46
|
"tslib": "^2.3.0"
|
|
47
47
|
},
|
|
48
48
|
"publishConfig": {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as _angular_core from '@angular/core';
|
|
2
|
-
import { TemplateRef, Type, Provider, OnDestroy, OnInit, PipeTransform, AfterViewInit, AfterViewChecked, WritableSignal, InputSignal } from '@angular/core';
|
|
2
|
+
import { InjectionToken, TemplateRef, Type, Provider, OnDestroy, EnvironmentProviders, OnInit, PipeTransform, AfterViewInit, AfterViewChecked, WritableSignal, InputSignal } from '@angular/core';
|
|
3
3
|
import * as _maliardic_ma_icon from '@maliardic/ma-icon';
|
|
4
4
|
import { MaiconName, MaiconGlyph } from '@maliardic/ma-icon';
|
|
5
|
+
import { MaiconSolidName } from '@maliardic/ma-icon/solid';
|
|
5
6
|
import { ControlValueAccessor } from '@angular/forms';
|
|
6
7
|
import { ConnectedPosition } from '@angular/cdk/overlay';
|
|
7
8
|
import * as _maliardic_ma_ui from '@maliardic/ma-ui';
|
|
@@ -63,22 +64,70 @@ interface MaFields {
|
|
|
63
64
|
|
|
64
65
|
/** Name of an icon in the maicon set (`@maliardic/ma-icon`). */
|
|
65
66
|
type MIconName = MaiconName;
|
|
67
|
+
/** Drawing variant of an icon: the outline (default) or the filled solid drawing. */
|
|
68
|
+
type MIconVariant = "outline" | "solid";
|
|
66
69
|
/**
|
|
67
|
-
*
|
|
68
|
-
*
|
|
70
|
+
* An icon name with an explicit variant, e.g. `"heart:solid"` or `"heart:outline"`.
|
|
71
|
+
* `:solid` falls back to the outline when the icon has no solid drawing or `provideMIconSolid()`
|
|
72
|
+
* is not registered. `:outline` always draws the outline, also in active states.
|
|
69
73
|
*/
|
|
70
|
-
type
|
|
74
|
+
type MIconVariantName = `${MIconName}:${MIconVariant}`;
|
|
75
|
+
/** Any valid icon reference: a plain name or a name with a variant modifier. */
|
|
76
|
+
type MIconRef = MIconName | MIconVariantName;
|
|
77
|
+
/**
|
|
78
|
+
* Value accepted by `icon` inputs: a maicon name, optionally with `:solid` / `:outline`, or any
|
|
79
|
+
* other string (for example one coming from data). Known names still autocomplete (`:solid`
|
|
80
|
+
* only for icons that have a solid drawing); unknown names render nothing.
|
|
81
|
+
*/
|
|
82
|
+
type MIconInput = MIconName | `${MaiconSolidName}:solid` | (string & {});
|
|
71
83
|
/** Every icon name in the maicon set (`@maliardic/ma-icon`), alphabetical. */
|
|
72
84
|
declare const M_ICON_NAMES: readonly MIconName[];
|
|
73
|
-
/**
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
|
|
85
|
+
/** Solid drawings and options registered by `provideMIconSolid()`. */
|
|
86
|
+
interface MIconSolidConfig {
|
|
87
|
+
/** One fill path per icon name (`MAICON_SOLID` from `@maliardic/ma-icon/solid`). */
|
|
88
|
+
readonly glyphs: Readonly<Record<string, string>>;
|
|
89
|
+
/** When true, the active `m-tab` and pressed buttons switch to the solid drawing. */
|
|
90
|
+
readonly activeStates: boolean;
|
|
91
|
+
}
|
|
92
|
+
/** Holds the solid drawings. Empty unless `provideMIconSolid()` is in the providers. */
|
|
93
|
+
declare const M_ICON_SOLID: InjectionToken<MIconSolidConfig>;
|
|
94
|
+
/** A parsed icon reference. */
|
|
95
|
+
interface MIconParsed {
|
|
96
|
+
readonly name: MIconName;
|
|
97
|
+
/** The variant written in the reference, or `null` for a plain name. */
|
|
98
|
+
readonly variant: MIconVariant | null;
|
|
99
|
+
}
|
|
100
|
+
/** Splits `"heart:solid"` into name and variant. Returns `null` for unknown names or modifiers. */
|
|
101
|
+
declare function parseMIconName(value: string | null | undefined): MIconParsed | null;
|
|
102
|
+
/** The glyph that will be drawn for a reference, with the variant that was actually used. */
|
|
103
|
+
interface MIconResolved {
|
|
104
|
+
readonly name: MIconName;
|
|
105
|
+
readonly variant: MIconVariant;
|
|
106
|
+
readonly glyph: MaiconGlyph;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Resolves a reference to the glyph to draw. `"heart:solid"` gives the solid drawing when `solid`
|
|
110
|
+
* (from `M_ICON_SOLID`) has it, otherwise the outline. Returns `null` for unknown names.
|
|
111
|
+
*/
|
|
112
|
+
declare function resolveMIcon(value: string | null | undefined, solid?: MIconSolidConfig | null): MIconResolved | null;
|
|
113
|
+
/**
|
|
114
|
+
* Returns the glyph for a reference, or `null` for unknown / empty names. `:solid` needs the
|
|
115
|
+
* solid config (`inject(M_ICON_SOLID, { optional: true })`); without it the outline is returned.
|
|
116
|
+
*/
|
|
117
|
+
declare function mIconGlyph(name: string | null | undefined, solid?: MIconSolidConfig | null): MaiconGlyph | null;
|
|
118
|
+
/** True when `name` is an icon in the maicon set, optionally with `:solid` / `:outline`. */
|
|
119
|
+
declare function isMIconName(name: unknown): name is MIconRef;
|
|
120
|
+
/**
|
|
121
|
+
* The reference to draw for an icon in a stateful control: when `active` is true, automatic solid
|
|
122
|
+
* is on and the icon has a solid drawing, a plain `"heart"` becomes `"heart:solid"`. References
|
|
123
|
+
* with an explicit variant are kept as written.
|
|
124
|
+
*/
|
|
125
|
+
declare function mIconForState(value: string | null | undefined, active: boolean, solid?: MIconSolidConfig | null): string;
|
|
77
126
|
/**
|
|
78
127
|
* Builds the `<svg>` that `<m-icon>` renders (with the `m-icon` class on the svg itself), for places that
|
|
79
128
|
* create DOM imperatively (e.g. directives). Returns `null` for unknown names.
|
|
80
129
|
*/
|
|
81
|
-
declare function createMIconSvg(document: Document, name: string | null | undefined): SVGSVGElement | null;
|
|
130
|
+
declare function createMIconSvg(document: Document, name: string | null | undefined, solid?: MIconSolidConfig | null): SVGSVGElement | null;
|
|
82
131
|
/**
|
|
83
132
|
* Inline SVG icon from the maicon set (`@maliardic/ma-icon`). Size follows `font-size`, colour follows `color`.
|
|
84
133
|
*
|
|
@@ -86,15 +135,17 @@ declare function createMIconSvg(document: Document, name: string | null | undefi
|
|
|
86
135
|
* <m-icon name="search" />
|
|
87
136
|
* <button mButton aria-label="Ara"><m-icon name="search" /></button>
|
|
88
137
|
* <m-icon name="alert-triangle" label="Uyarı" />
|
|
138
|
+
* <m-icon name="heart:solid" /> <!-- needs provideMIconSolid() -->
|
|
89
139
|
* ```
|
|
90
140
|
*/
|
|
91
141
|
declare class MIcon {
|
|
92
|
-
/** Icon name. Unknown names render nothing. */
|
|
142
|
+
/** Icon name, optionally with `:solid` (e.g. `heart:solid`). Unknown names render nothing. */
|
|
93
143
|
readonly name: _angular_core.InputSignal<MIconInput | null | undefined>;
|
|
94
144
|
/** Accessible name. Empty means decorative (`aria-hidden`). */
|
|
95
145
|
readonly label: _angular_core.InputSignal<string | undefined>;
|
|
96
146
|
protected readonly strokeWidth = 1.5;
|
|
97
|
-
|
|
147
|
+
private readonly solid;
|
|
148
|
+
protected readonly resolved: _angular_core.Signal<MIconResolved | null>;
|
|
98
149
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<MIcon, never>;
|
|
99
150
|
static ɵcmp: _angular_core.ɵɵComponentDeclaration<MIcon, "m-icon", never, { "name": { "alias": "name"; "required": true; "isSignal": true; }; "label": { "alias": "label"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
100
151
|
}
|
|
@@ -162,8 +213,11 @@ declare class MBadge {
|
|
|
162
213
|
|
|
163
214
|
type MButtonType = "button" | "submit" | "reset";
|
|
164
215
|
declare class MButton {
|
|
216
|
+
protected readonly pressedAttr: _angular_core.Signal<string | null>;
|
|
165
217
|
readonly icon: _angular_core.InputSignal<MIconInput>;
|
|
166
218
|
readonly ariaLabel: _angular_core.InputSignal<string>;
|
|
219
|
+
/** Toggle state, forwarded to the inner button. A pressed button draws its icon solid. */
|
|
220
|
+
readonly ariaPressed: _angular_core.InputSignal<boolean | "true" | "false" | "mixed" | null | undefined>;
|
|
167
221
|
readonly size: _angular_core.InputSignal<MControlSize>;
|
|
168
222
|
readonly type: _angular_core.InputSignal<MButtonType>;
|
|
169
223
|
readonly block: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
@@ -171,7 +225,7 @@ declare class MButton {
|
|
|
171
225
|
readonly disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
172
226
|
readonly styleClass: _angular_core.InputSignal<string>;
|
|
173
227
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<MButton, never>;
|
|
174
|
-
static ɵcmp: _angular_core.ɵɵComponentDeclaration<MButton, "m-button", never, { "icon": { "alias": "icon"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "aria-label"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "type": { "alias": "type"; "required": false; "isSignal": true; }; "block": { "alias": "block"; "required": false; "isSignal": true; }; "iconOnly": { "alias": "iconOnly"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "styleClass": { "alias": "styleClass"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
|
|
228
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<MButton, "m-button", never, { "icon": { "alias": "icon"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "aria-label"; "required": false; "isSignal": true; }; "ariaPressed": { "alias": "aria-pressed"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "type": { "alias": "type"; "required": false; "isSignal": true; }; "block": { "alias": "block"; "required": false; "isSignal": true; }; "iconOnly": { "alias": "iconOnly"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "styleClass": { "alias": "styleClass"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
|
|
175
229
|
}
|
|
176
230
|
|
|
177
231
|
declare function provideValueAccessor(type: () => Type<unknown>): Provider;
|
|
@@ -469,6 +523,24 @@ declare class MFileList<T = unknown> {
|
|
|
469
523
|
static ɵcmp: _angular_core.ɵɵComponentDeclaration<MFileList<any>, "m-file-list", never, { "files": { "alias": "files"; "required": false; "isSignal": true; }; "nameField": { "alias": "nameField"; "required": false; "isSignal": true; }; "sizeField": { "alias": "sizeField"; "required": false; "isSignal": true; }; "typeField": { "alias": "typeField"; "required": false; "isSignal": true; }; "disabledField": { "alias": "disabledField"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "downloadable": { "alias": "downloadable"; "required": false; "isSignal": true; }; "removable": { "alias": "removable"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; "isSignal": true; }; "emptyMessage": { "alias": "emptyMessage"; "required": false; "isSignal": true; }; "unnamedLabel": { "alias": "unnamedLabel"; "required": false; "isSignal": true; }; "downloadLabel": { "alias": "downloadLabel"; "required": false; "isSignal": true; }; "removeLabel": { "alias": "removeLabel"; "required": false; "isSignal": true; }; }, { "download": "download"; "remove": "remove"; }, never, never, true, never>;
|
|
470
524
|
}
|
|
471
525
|
|
|
526
|
+
/** Options for `provideMIconSolid()`. */
|
|
527
|
+
interface MIconSolidOptions {
|
|
528
|
+
/**
|
|
529
|
+
* Switch the active `m-tab` and pressed buttons (`aria-pressed="true"`) to the icon's solid
|
|
530
|
+
* drawing automatically. Default `true`. Write `icon="heart:outline"` to keep one icon outline.
|
|
531
|
+
*/
|
|
532
|
+
activeStates?: boolean;
|
|
533
|
+
}
|
|
534
|
+
/**
|
|
535
|
+
* Registers the solid icon drawings (`MAICON_SOLID`, ~20 KB gzip) so `"heart:solid"` and the
|
|
536
|
+
* automatic active-state solid work. Apps that never call it do not ship the solid path data.
|
|
537
|
+
*
|
|
538
|
+
* ```ts
|
|
539
|
+
* bootstrapApplication(App, { providers: [provideMIconSolid()] });
|
|
540
|
+
* ```
|
|
541
|
+
*/
|
|
542
|
+
declare function provideMIconSolid(options?: MIconSolidOptions): EnvironmentProviders;
|
|
543
|
+
|
|
472
544
|
declare class MInput implements ControlValueAccessor {
|
|
473
545
|
readonly inputId: _angular_core.InputSignal<string>;
|
|
474
546
|
readonly type: _angular_core.InputSignal<MInputType>;
|
|
@@ -1442,6 +1514,7 @@ declare class MTab {
|
|
|
1442
1514
|
static ɵcmp: _angular_core.ɵɵComponentDeclaration<MTab, "m-tab", never, { "value": { "alias": "value"; "required": false; "isSignal": true; }; "label": { "alias": "label"; "required": false; "isSignal": true; }; "icon": { "alias": "icon"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "lazy": { "alias": "lazy"; "required": false; "isSignal": true; }; }, {}, ["headerTemplate", "lazyTemplate"], ["*"], true, never>;
|
|
1443
1515
|
}
|
|
1444
1516
|
declare class MTabs {
|
|
1517
|
+
private readonly solid;
|
|
1445
1518
|
readonly value: _angular_core.InputSignal<string>;
|
|
1446
1519
|
readonly size: _angular_core.InputSignal<MControlSize>;
|
|
1447
1520
|
readonly ariaLabel: _angular_core.InputSignal<string>;
|
|
@@ -1454,6 +1527,8 @@ declare class MTabs {
|
|
|
1454
1527
|
constructor();
|
|
1455
1528
|
protected tabTrack(tab: MTab): string;
|
|
1456
1529
|
protected isActive(tab: MTab): boolean;
|
|
1530
|
+
/** The active tab draws its icon solid when `provideMIconSolid()` allows it. */
|
|
1531
|
+
protected tabIcon(tab: MTab): string;
|
|
1457
1532
|
protected headerContext(tab: MTab): MTabHeaderTemplateContext;
|
|
1458
1533
|
protected selectTab(tab: MTab): void;
|
|
1459
1534
|
protected onTabKeydown(event: KeyboardEvent, tab: MTab): void;
|
|
@@ -1596,13 +1671,21 @@ declare class MButtonDirective {
|
|
|
1596
1671
|
private readonly elementRef;
|
|
1597
1672
|
private readonly renderer;
|
|
1598
1673
|
private readonly document;
|
|
1674
|
+
private readonly solid;
|
|
1599
1675
|
private iconElement;
|
|
1676
|
+
/** Mirrors `aria-pressed="true"` on the host (toggle buttons). */
|
|
1677
|
+
private readonly pressed;
|
|
1600
1678
|
readonly size: _angular_core.InputSignal<MControlSize>;
|
|
1601
|
-
/**
|
|
1679
|
+
/**
|
|
1680
|
+
* maicon name rendered before the content, optionally with `:solid`. While the button has
|
|
1681
|
+
* `aria-pressed="true"` it draws the solid variant (with `provideMIconSolid()`).
|
|
1682
|
+
*/
|
|
1602
1683
|
readonly icon: _angular_core.InputSignal<MIconInput>;
|
|
1603
1684
|
readonly block: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
1604
1685
|
readonly iconOnly: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
1605
1686
|
constructor();
|
|
1687
|
+
/** Follows `aria-pressed` however it is set (static attribute, `[attr.aria-pressed]`, …). */
|
|
1688
|
+
private watchPressed;
|
|
1606
1689
|
private syncIcon;
|
|
1607
1690
|
private removeIcon;
|
|
1608
1691
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<MButtonDirective, never>;
|
|
@@ -1735,5 +1818,5 @@ declare class Confirmation {
|
|
|
1735
1818
|
static ɵcmp: _angular_core.ɵɵComponentDeclaration<Confirmation, "m-confirmationDialog", never, { "acceptLabel": { "alias": "acceptLabel"; "required": false; "isSignal": true; }; "rejectLabel": { "alias": "rejectLabel"; "required": false; "isSignal": true; }; "acceptButtonStyle": { "alias": "acceptButtonStyle"; "required": false; "isSignal": true; }; "rejectButtonStyle": { "alias": "rejectButtonStyle"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
1736
1819
|
}
|
|
1737
1820
|
|
|
1738
|
-
export { Confirmation, MAccordion, MAccordionPanel, MBadge, MBadgeDirective, MButton, MButtonDirective, MCheckbox, MCommandMenu, MConfirmationService, MDatePicker, MDialog, MDrawer, MFieldValuePipe, MFileList, MFileUpload, MIcon, MInput, MInputDirective, MInputNumber, MInputNumberDirective, MListbox, MMenu, MMenuSearch, MMultiSelect, MPopover, MProgressBar, MProgressSpinner, MRadio, MRadioGroup, MSelect, MSwitch, MTab, MTable, MTableColumn, MTabs, MTextarea, MTieredMenu, MToast, MToastService, MTooltipDirective, M_ICON_NAMES, createMIconSvg, getFieldValue, isMIconName, mIconGlyph, noopTouched, provideValueAccessor, resolveFieldDisplayValue, resolveFieldRawValue, syncMThemeToOverlay };
|
|
1739
|
-
export type { MBadgePosition, MBadgeSeverity, MBadgeSize, MCheckboxChangeEvent, MChoiceOption, MChoiceOptionInput, MConfirmation, MControlChangeFn, MControlSize, MControlTouchedFn, MDrawerPosition, MFieldValueFormatter, MFieldValuePipeName, MFieldValueRow, MFieldValueSource, MIconInput, MIconName, MInputType, MListboxItemContext, MMenuItem, MMultiSelectChangeEvent, MPopoverPosition, MProgressBarMode, MProgressBarSeverity, MProgressBarSize, MProgressSpinnerMode, MProgressSpinnerSeverity, MProgressSpinnerSize, MSelectChangeEvent, MSelectOption, MSelectOptionInput, MSwitchChangeEvent, MTableColumnAlign, MTableColumnDef, MTableColumnState, MTableFilterMatchMode, MTableLazyLoadEvent, MTableRow, MTableSelectionMode, MTableSortDirection, MToastMessage, MToastOptions, MToastPosition, MToastType, MTooltipPosition, MaFieldData, MaFieldType, MaFieldValidations, MaFields };
|
|
1821
|
+
export { Confirmation, MAccordion, MAccordionPanel, MBadge, MBadgeDirective, MButton, MButtonDirective, MCheckbox, MCommandMenu, MConfirmationService, MDatePicker, MDialog, MDrawer, MFieldValuePipe, MFileList, MFileUpload, MIcon, MInput, MInputDirective, MInputNumber, MInputNumberDirective, MListbox, MMenu, MMenuSearch, MMultiSelect, MPopover, MProgressBar, MProgressSpinner, MRadio, MRadioGroup, MSelect, MSwitch, MTab, MTable, MTableColumn, MTabs, MTextarea, MTieredMenu, MToast, MToastService, MTooltipDirective, M_ICON_NAMES, M_ICON_SOLID, createMIconSvg, getFieldValue, isMIconName, mIconForState, mIconGlyph, noopTouched, parseMIconName, provideMIconSolid, provideValueAccessor, resolveFieldDisplayValue, resolveFieldRawValue, resolveMIcon, syncMThemeToOverlay };
|
|
1822
|
+
export type { MBadgePosition, MBadgeSeverity, MBadgeSize, MCheckboxChangeEvent, MChoiceOption, MChoiceOptionInput, MConfirmation, MControlChangeFn, MControlSize, MControlTouchedFn, MDrawerPosition, MFieldValueFormatter, MFieldValuePipeName, MFieldValueRow, MFieldValueSource, MIconInput, MIconName, MIconParsed, MIconRef, MIconResolved, MIconSolidConfig, MIconSolidOptions, MIconVariant, MIconVariantName, MInputType, MListboxItemContext, MMenuItem, MMultiSelectChangeEvent, MPopoverPosition, MProgressBarMode, MProgressBarSeverity, MProgressBarSize, MProgressSpinnerMode, MProgressSpinnerSeverity, MProgressSpinnerSize, MSelectChangeEvent, MSelectOption, MSelectOptionInput, MSwitchChangeEvent, MTableColumnAlign, MTableColumnDef, MTableColumnState, MTableFilterMatchMode, MTableLazyLoadEvent, MTableRow, MTableSelectionMode, MTableSortDirection, MToastMessage, MToastOptions, MToastPosition, MToastType, MTooltipPosition, MaFieldData, MaFieldType, MaFieldValidations, MaFields };
|