@molecule/app-status-badge-angular 1.1.0 → 1.1.2
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
CHANGED
|
@@ -3,7 +3,7 @@ AUTO-GENERATED — DO NOT EDIT THIS FILE.
|
|
|
3
3
|
Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
|
|
4
4
|
Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
|
|
5
5
|
To change this document, edit the module-level JSDoc in src/index.ts.
|
|
6
|
-
Generated: 2026-11-
|
|
6
|
+
Generated: 2026-11-28T22:55:35.277Z
|
|
7
7
|
-->
|
|
8
8
|
|
|
9
9
|
# @molecule/app-status-badge-angular
|
|
@@ -144,6 +144,7 @@ icon.
|
|
|
144
144
|
@Component({
|
|
145
145
|
selector: 'span[mol-status-badge]',
|
|
146
146
|
standalone: true,
|
|
147
|
+
hostDirectives: [MolPlacement],
|
|
147
148
|
inputs: ['kind', 'appearance', 'className'],
|
|
148
149
|
host: {
|
|
149
150
|
'[class]': 'classes()',
|
|
@@ -153,7 +154,7 @@ icon.
|
|
|
153
154
|
></span>
|
|
154
155
|
<ng-content></ng-content>`,
|
|
155
156
|
})
|
|
156
|
-
export class StatusBadge
|
|
157
|
+
export class StatusBadge {
|
|
157
158
|
/** Semantic kind — maps to ClassMap badge color variants (defaults to `'neutral'`). */
|
|
158
159
|
kind?: StatusKind
|
|
159
160
|
/** Visual appearance variant (defaults to `'ui'`). */
|
|
@@ -164,8 +165,6 @@ export class StatusBadge implements AfterViewInit {
|
|
|
164
165
|
/** The icon wrapper (always in the template; detached when unused). */
|
|
165
166
|
@ViewChild('iconSlot') iconSlot?: ElementRef<HTMLSpanElement>
|
|
166
167
|
|
|
167
|
-
private readonly sync = new SlotWrapper(inject(ElementRef), inject(Renderer2))
|
|
168
|
-
|
|
169
168
|
/**
|
|
170
169
|
* The current class map.
|
|
171
170
|
* @returns The UIClassMap.
|
|
@@ -205,14 +204,16 @@ export class StatusBadge implements AfterViewInit {
|
|
|
205
204
|
}
|
|
206
205
|
|
|
207
206
|
/**
|
|
208
|
-
*
|
|
209
|
-
*
|
|
210
|
-
*
|
|
211
|
-
*
|
|
207
|
+
* Renders the icon wrapper only while its slot has content — React renders
|
|
208
|
+
* no wrapper for an absent icon. The `<ng-content>` capture point stays in
|
|
209
|
+
* the template, so the wrapper leaves the page instead, and comes back when
|
|
210
|
+
* a consumer projects an icon later.
|
|
212
211
|
*/
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
212
|
+
constructor() {
|
|
213
|
+
usePlacement((hasContent) => {
|
|
214
|
+
const icon = this.iconSlot?.nativeElement
|
|
215
|
+
setElementPresent(icon, icon ? hasContent(icon) : false)
|
|
216
|
+
})
|
|
216
217
|
}
|
|
217
218
|
}
|
|
218
219
|
```
|
|
@@ -308,7 +309,7 @@ Peer dependencies:
|
|
|
308
309
|
- `@angular/common` ^22.0.0
|
|
309
310
|
- `@angular/core` ^22.0.0
|
|
310
311
|
- `@angular/platform-browser` ^22.0.0
|
|
311
|
-
- `@molecule/app-angular` ^3.
|
|
312
|
+
- `@molecule/app-angular` ^3.13.0 || ^4.0.0
|
|
312
313
|
- `@molecule/app-ui` ^1.0.1
|
|
313
314
|
- `@molecule/app-ui-angular` ^1.1.0
|
|
314
315
|
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @module
|
|
5
5
|
*/
|
|
6
|
-
import type
|
|
7
|
-
import { ElementRef } from '@angular/core';
|
|
6
|
+
import { type ElementRef } from '@angular/core';
|
|
8
7
|
import type { UIClassMap } from '@molecule/app-ui';
|
|
9
8
|
import type { StatusKind } from './types.js';
|
|
10
9
|
import * as i0 from "@angular/core";
|
|
10
|
+
import * as i1 from "@molecule/app-angular";
|
|
11
11
|
/**
|
|
12
12
|
* Semantic status badge — maps status kinds to ClassMap color variants.
|
|
13
13
|
*
|
|
@@ -20,7 +20,7 @@ import * as i0 from "@angular/core";
|
|
|
20
20
|
* projection carries no nodes, exactly as React renders nothing for an absent
|
|
21
21
|
* icon.
|
|
22
22
|
*/
|
|
23
|
-
export declare class StatusBadge
|
|
23
|
+
export declare class StatusBadge {
|
|
24
24
|
/** Semantic kind — maps to ClassMap badge color variants (defaults to `'neutral'`). */
|
|
25
25
|
kind?: StatusKind;
|
|
26
26
|
/** Visual appearance variant (defaults to `'ui'`). */
|
|
@@ -29,7 +29,6 @@ export declare class StatusBadge implements AfterViewInit {
|
|
|
29
29
|
className?: string;
|
|
30
30
|
/** The icon wrapper (always in the template; detached when unused). */
|
|
31
31
|
iconSlot?: ElementRef<HTMLSpanElement>;
|
|
32
|
-
private readonly sync;
|
|
33
32
|
/**
|
|
34
33
|
* The current class map.
|
|
35
34
|
* @returns The UIClassMap.
|
|
@@ -52,13 +51,13 @@ export declare class StatusBadge implements AfterViewInit {
|
|
|
52
51
|
*/
|
|
53
52
|
iconClass(): string;
|
|
54
53
|
/**
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
54
|
+
* Renders the icon wrapper only while its slot has content — React renders
|
|
55
|
+
* no wrapper for an absent icon. The `<ng-content>` capture point stays in
|
|
56
|
+
* the template, so the wrapper leaves the page instead, and comes back when
|
|
57
|
+
* a consumer projects an icon later.
|
|
59
58
|
*/
|
|
60
|
-
|
|
59
|
+
constructor();
|
|
61
60
|
static ɵfac: i0.ɵɵFactoryDeclaration<StatusBadge, never>;
|
|
62
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<StatusBadge, "span[mol-status-badge]", never, { "kind": { "alias": "kind"; "required": false; }; "appearance": { "alias": "appearance"; "required": false; }; "className": { "alias": "className"; "required": false; }; }, {}, never, ["[slot=icon]", "*"], true,
|
|
61
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<StatusBadge, "span[mol-status-badge]", never, { "kind": { "alias": "kind"; "required": false; }; "appearance": { "alias": "appearance"; "required": false; }; "className": { "alias": "className"; "required": false; }; }, {}, never, ["[slot=icon]", "*"], true, [{ directive: typeof i1.MolPlacement; inputs: {}; outputs: {}; }]>;
|
|
63
62
|
}
|
|
64
63
|
//# sourceMappingURL=status-badge.component.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status-badge.component.d.ts","sourceRoot":"","sources":["../src/status-badge.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"status-badge.component.d.ts","sourceRoot":"","sources":["../src/status-badge.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAa,KAAK,UAAU,EAAa,MAAM,eAAe,CAAA;AAGrE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAGlD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;;;AAU5C;;;;;;;;;;;GAWG;AACH,qBAaa,WAAW;IACtB,uFAAuF;IACvF,IAAI,CAAC,EAAE,UAAU,CAAA;IACjB,sDAAsD;IACtD,UAAU,CAAC,EAAE,IAAI,GAAG,gBAAgB,CAAA;IACpC,4DAA4D;IAC5D,SAAS,CAAC,EAAE,MAAM,CAAA;IAElB,uEAAuE;IAChD,QAAQ,CAAC,EAAE,UAAU,CAAC,eAAe,CAAC,CAAA;IAE7D;;;OAGG;IACH,EAAE,IAAI,UAAU;IAIhB;;;OAGG;IACH,SAAS,IAAI,UAAU;IAIvB;;;;OAIG;IACH,OAAO,IAAI,MAAM;IASjB;;;OAGG;IACH,SAAS,IAAI,MAAM;IAInB;;;;;OAKG;;yCAtDQ,WAAW;2CAAX,WAAW;CA6DvB"}
|
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* StatusBadge component (React parity).
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import { Component, ViewChild } from '@angular/core';
|
|
7
|
+
import { MolPlacement, setElementPresent, usePlacement } from '@molecule/app-angular';
|
|
2
8
|
import { getClassMap } from '@molecule/app-ui';
|
|
3
|
-
import { hasNodes, SlotWrapper } from '@molecule/app-ui-angular';
|
|
4
9
|
import * as i0 from "@angular/core";
|
|
10
|
+
import * as i1 from "@molecule/app-angular";
|
|
5
11
|
const _c0 = ["iconSlot"];
|
|
6
12
|
const _c1 = [[["", "slot", "icon"]], "*"];
|
|
7
13
|
const _c2 = ["[slot=icon]", "*"];
|
|
@@ -33,7 +39,6 @@ export class StatusBadge {
|
|
|
33
39
|
className;
|
|
34
40
|
/** The icon wrapper (always in the template; detached when unused). */
|
|
35
41
|
iconSlot;
|
|
36
|
-
sync = new SlotWrapper(inject(ElementRef), inject(Renderer2));
|
|
37
42
|
/**
|
|
38
43
|
* The current class map.
|
|
39
44
|
* @returns The UIClassMap.
|
|
@@ -69,14 +74,16 @@ export class StatusBadge {
|
|
|
69
74
|
return this.cm().sp('mr', 1);
|
|
70
75
|
}
|
|
71
76
|
/**
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
77
|
+
* Renders the icon wrapper only while its slot has content — React renders
|
|
78
|
+
* no wrapper for an absent icon. The `<ng-content>` capture point stays in
|
|
79
|
+
* the template, so the wrapper leaves the page instead, and comes back when
|
|
80
|
+
* a consumer projects an icon later.
|
|
76
81
|
*/
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
82
|
+
constructor() {
|
|
83
|
+
usePlacement((hasContent) => {
|
|
84
|
+
const icon = this.iconSlot?.nativeElement;
|
|
85
|
+
setElementPresent(icon, icon ? hasContent(icon) : false);
|
|
86
|
+
});
|
|
80
87
|
}
|
|
81
88
|
static ɵfac = function StatusBadge_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || StatusBadge)(); };
|
|
82
89
|
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: StatusBadge, selectors: [["span", "mol-status-badge", ""]], viewQuery: function StatusBadge_Query(rf, ctx) { if (rf & 1) {
|
|
@@ -86,7 +93,7 @@ export class StatusBadge {
|
|
|
86
93
|
i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.iconSlot = _t.first);
|
|
87
94
|
} }, hostVars: 2, hostBindings: function StatusBadge_HostBindings(rf, ctx) { if (rf & 2) {
|
|
88
95
|
i0.ɵɵclassMap(ctx.classes());
|
|
89
|
-
} }, inputs: { kind: "kind", appearance: "appearance", className: "className" }, ngContentSelectors: _c2, decls: 4, vars: 2, consts: [["iconSlot", ""]], template: function StatusBadge_Template(rf, ctx) { if (rf & 1) {
|
|
96
|
+
} }, inputs: { kind: "kind", appearance: "appearance", className: "className" }, features: [i0.ɵɵHostDirectivesFeature([i1.MolPlacement])], ngContentSelectors: _c2, decls: 4, vars: 2, consts: [["iconSlot", ""]], template: function StatusBadge_Template(rf, ctx) { if (rf & 1) {
|
|
90
97
|
i0.ɵɵprojectionDef(_c1);
|
|
91
98
|
i0.ɵɵdomElementStart(0, "span", null, 0);
|
|
92
99
|
i0.ɵɵprojection(2);
|
|
@@ -101,6 +108,7 @@ export class StatusBadge {
|
|
|
101
108
|
args: [{
|
|
102
109
|
selector: 'span[mol-status-badge]',
|
|
103
110
|
standalone: true,
|
|
111
|
+
hostDirectives: [MolPlacement],
|
|
104
112
|
inputs: ['kind', 'appearance', 'className'],
|
|
105
113
|
host: {
|
|
106
114
|
'[class]': 'classes()',
|
|
@@ -110,7 +118,7 @@ export class StatusBadge {
|
|
|
110
118
|
></span>
|
|
111
119
|
<ng-content></ng-content>`,
|
|
112
120
|
}]
|
|
113
|
-
}],
|
|
121
|
+
}], () => [], { iconSlot: [{
|
|
114
122
|
type: ViewChild,
|
|
115
123
|
args: ['iconSlot']
|
|
116
124
|
}] }); })();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status-badge.component.js","sourceRoot":"","sources":["../src/status-badge.component.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"status-badge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CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,CAAA;IAC5D,CAAC;IAED;;;OAGG;IACH,SAAS;QACP,OAAO,IAAI,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC,CAAA;IAC9B,CAAC;IAED;;;;;OAKG;IACH;QACE,YAAY,CAAC,CAAC,UAAU,EAAE,EAAE;YAC1B,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,EAAE,aAAa,CAAA;YACzC,iBAAiB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAA;QAC1D,CAAC,CAAC,CAAA;IACJ,CAAC;qGA5DU,WAAW;6DAAX,WAAW;;;;;;YAAX,cAAA,aAAS,CAAE;;;YALX,wCACN;YAAA,kBACF;YAAA,oBAAO;YACR,qBAAyB;;YAHV,8BAAqB;;;iFAK3B,WAAW;cAbvB,SAAS;eAAC;gBACT,QAAQ,EAAE,wBAAwB;gBAClC,UAAU,EAAE,IAAI;gBAChB,cAAc,EAAE,CAAC,YAAY,CAAC;gBAC9B,MAAM,EAAE,CAAC,MAAM,EAAE,YAAY,EAAE,WAAW,CAAC;gBAC3C,IAAI,EAAE;oBACJ,SAAS,EAAE,WAAW;iBACvB;gBACD,QAAQ,EAAE;;;8BAGkB;aAC7B;;kBAUE,SAAS;mBAAC,UAAU;;kFATV,WAAW"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@molecule/app-status-badge-angular",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"description": "Angular status badge / pill with semantic kinds",
|
|
5
5
|
"homepage": "https://www.molecule.dev/packages/app-status-badge-angular",
|
|
6
6
|
"type": "module",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"@angular/common": "^22.0.0",
|
|
46
46
|
"@angular/core": "^22.0.0",
|
|
47
47
|
"@angular/platform-browser": "^22.0.0",
|
|
48
|
-
"@molecule/app-angular": "^3.
|
|
48
|
+
"@molecule/app-angular": "^3.13.0 || ^4.0.0",
|
|
49
49
|
"@molecule/app-ui": "^1.0.1",
|
|
50
50
|
"@molecule/app-ui-angular": "^1.1.0"
|
|
51
51
|
},
|
|
@@ -55,14 +55,14 @@
|
|
|
55
55
|
"@angular/compiler-cli": "22.2.3",
|
|
56
56
|
"@angular/core": "22.2.3",
|
|
57
57
|
"@angular/platform-browser": "22.2.3",
|
|
58
|
-
"@molecule/app-angular": "
|
|
58
|
+
"@molecule/app-angular": "4.0.0",
|
|
59
59
|
"@molecule/app-framework-conformance": "0.0.0",
|
|
60
|
-
"@molecule/app-i18n": "1.
|
|
60
|
+
"@molecule/app-i18n": "1.4.0",
|
|
61
61
|
"@molecule/app-icons": "1.0.4",
|
|
62
|
-
"@molecule/app-ui": "1.
|
|
63
|
-
"@molecule/app-ui-angular": "1.
|
|
62
|
+
"@molecule/app-ui": "1.17.0",
|
|
63
|
+
"@molecule/app-ui-angular": "1.13.3",
|
|
64
64
|
"@types/node": "26.6.5",
|
|
65
|
-
"jsdom": "
|
|
65
|
+
"jsdom": "31.0.1",
|
|
66
66
|
"rxjs": "7.8.2",
|
|
67
67
|
"typescript": "6.0.3",
|
|
68
68
|
"vitest": "4.1.12",
|