@molecule/app-settings-container-angular 0.0.0-stage → 1.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.
@@ -0,0 +1,270 @@
1
+ /**
2
+ * SettingsSidebar component (React parity).
3
+ *
4
+ * @module
5
+ */
6
+ import { NgTemplateOutlet } from '@angular/common';
7
+ import { Component, signal, ViewChild, } from '@angular/core';
8
+ import { useTranslation } from '@molecule/app-angular';
9
+ import { getClassMap } from '@molecule/app-ui';
10
+ import { hasRenderableContent, hasText, isTemplate, isText } from './slots.js';
11
+ import * as i0 from "@angular/core";
12
+ const _c0 = ["footerEl"];
13
+ const _c1 = [[["", "slot", "footer"]]];
14
+ const _c2 = ["[slot=footer]"];
15
+ const _forTrack0 = ($index, $item) => $item.id;
16
+ function SettingsSidebar_For_1_Conditional_1_Conditional_0_Template(rf, ctx) { if (rf & 1) {
17
+ i0.ɵɵelementContainerStart(0);
18
+ i0.ɵɵtext(1);
19
+ i0.ɵɵelementContainerEnd();
20
+ } if (rf & 2) {
21
+ const item_r2 = i0.ɵɵnextContext(2).$implicit;
22
+ const ctx_r2 = i0.ɵɵnextContext();
23
+ i0.ɵɵadvance();
24
+ i0.ɵɵtextInterpolate(ctx_r2.textOf(item_r2.icon));
25
+ } }
26
+ function SettingsSidebar_For_1_Conditional_1_Conditional_1_Template(rf, ctx) { if (rf & 1) {
27
+ i0.ɵɵelementContainer(0, 4);
28
+ } if (rf & 2) {
29
+ const item_r2 = i0.ɵɵnextContext(2).$implicit;
30
+ const ctx_r2 = i0.ɵɵnextContext();
31
+ i0.ɵɵproperty("ngTemplateOutlet", ctx_r2.templateOf(item_r2.icon));
32
+ } }
33
+ function SettingsSidebar_For_1_Conditional_1_Template(rf, ctx) { if (rf & 1) {
34
+ i0.ɵɵconditionalCreate(0, SettingsSidebar_For_1_Conditional_1_Conditional_0_Template, 2, 1, "ng-container")(1, SettingsSidebar_For_1_Conditional_1_Conditional_1_Template, 1, 1, "ng-container", 4);
35
+ } if (rf & 2) {
36
+ const item_r2 = i0.ɵɵnextContext().$implicit;
37
+ const ctx_r2 = i0.ɵɵnextContext();
38
+ i0.ɵɵconditional(ctx_r2.isText(item_r2.icon) ? 0 : 1);
39
+ } }
40
+ function SettingsSidebar_For_1_Conditional_3_Template(rf, ctx) { if (rf & 1) {
41
+ i0.ɵɵelementContainerStart(0);
42
+ i0.ɵɵtext(1);
43
+ i0.ɵɵelementContainerEnd();
44
+ } if (rf & 2) {
45
+ const item_r2 = i0.ɵɵnextContext().$implicit;
46
+ const ctx_r2 = i0.ɵɵnextContext();
47
+ i0.ɵɵadvance();
48
+ i0.ɵɵtextInterpolate(ctx_r2.textOf(item_r2.label));
49
+ } }
50
+ function SettingsSidebar_For_1_Conditional_4_Template(rf, ctx) { if (rf & 1) {
51
+ i0.ɵɵelementContainer(0, 4);
52
+ } if (rf & 2) {
53
+ const item_r2 = i0.ɵɵnextContext().$implicit;
54
+ const ctx_r2 = i0.ɵɵnextContext();
55
+ i0.ɵɵproperty("ngTemplateOutlet", ctx_r2.templateOf(item_r2.label));
56
+ } }
57
+ function SettingsSidebar_For_1_Template(rf, ctx) { if (rf & 1) {
58
+ const _r1 = i0.ɵɵgetCurrentView();
59
+ i0.ɵɵelementStart(0, "button", 3);
60
+ i0.ɵɵlistener("click", function SettingsSidebar_For_1_Template_button_click_0_listener() { const item_r2 = i0.ɵɵrestoreView(_r1).$implicit; const ctx_r2 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r2.select(item_r2)); });
61
+ i0.ɵɵconditionalCreate(1, SettingsSidebar_For_1_Conditional_1_Template, 2, 1);
62
+ i0.ɵɵelementStart(2, "span");
63
+ i0.ɵɵconditionalCreate(3, SettingsSidebar_For_1_Conditional_3_Template, 2, 1, "ng-container")(4, SettingsSidebar_For_1_Conditional_4_Template, 1, 1, "ng-container", 4);
64
+ i0.ɵɵelementEnd()();
65
+ } if (rf & 2) {
66
+ const item_r2 = ctx.$implicit;
67
+ const ctx_r2 = i0.ɵɵnextContext();
68
+ i0.ɵɵclassMap(ctx_r2.itemClasses(item_r2));
69
+ i0.ɵɵattribute("aria-current", item_r2.id === ctx_r2.activeId ? "page" : null);
70
+ i0.ɵɵadvance();
71
+ i0.ɵɵconditional(item_r2.icon != null ? 1 : -1);
72
+ i0.ɵɵadvance(2);
73
+ i0.ɵɵconditional(ctx_r2.isText(item_r2.label) ? 3 : 4);
74
+ } }
75
+ function SettingsSidebar_Conditional_2_Conditional_2_Template(rf, ctx) { if (rf & 1) {
76
+ i0.ɵɵelementContainer(0, 4);
77
+ } if (rf & 2) {
78
+ i0.ɵɵproperty("ngTemplateOutlet", ctx);
79
+ } }
80
+ function SettingsSidebar_Conditional_2_Conditional_3_Template(rf, ctx) { if (rf & 1) {
81
+ i0.ɵɵelementContainerStart(0);
82
+ i0.ɵɵtext(1);
83
+ i0.ɵɵelementContainerEnd();
84
+ } if (rf & 2) {
85
+ const ctx_r2 = i0.ɵɵnextContext(2);
86
+ i0.ɵɵadvance();
87
+ i0.ɵɵtextInterpolate(ctx_r2.textOf(ctx_r2.footer));
88
+ } }
89
+ function SettingsSidebar_Conditional_2_Template(rf, ctx) { if (rf & 1) {
90
+ i0.ɵɵelementStart(0, "div", null, 0);
91
+ i0.ɵɵconditionalCreate(2, SettingsSidebar_Conditional_2_Conditional_2_Template, 1, 1, "ng-container", 4)(3, SettingsSidebar_Conditional_2_Conditional_3_Template, 2, 1, "ng-container");
92
+ i0.ɵɵprojection(4);
93
+ i0.ɵɵelementEnd();
94
+ } if (rf & 2) {
95
+ let tmp_3_0;
96
+ const ctx_r2 = i0.ɵɵnextContext();
97
+ i0.ɵɵclassMap(ctx_r2.footerClasses());
98
+ i0.ɵɵadvance(2);
99
+ i0.ɵɵconditional((tmp_3_0 = ctx_r2.footerTemplate()) ? 2 : ctx_r2.hasFooterText() ? 3 : -1, tmp_3_0);
100
+ } }
101
+ /**
102
+ * Vertical side-nav for settings pages.
103
+ *
104
+ * Controlled — the caller owns `activeId`; every item calls `onSelect` with
105
+ * its id. The host IS the `<nav>` (`nav[mol-settings-sidebar]`), matching
106
+ * React's root exactly, including the region name: the default `aria-label`
107
+ * resolves through `t()` with the `settingsContainer.aria.settings` key, so it
108
+ * follows the active locale; `ariaLabel` overrides it. An item's `label` and
109
+ * `icon` are projected node templates or plain text; the optional `footer` is
110
+ * `[slot=footer]` content or text, and renders only when React would render it.
111
+ */
112
+ export class SettingsSidebar {
113
+ /** Items to render, in order. */
114
+ items = [];
115
+ /** The id of the active item (controlled — the caller owns it). */
116
+ activeId;
117
+ /** Called with the clicked item's id. */
118
+ onSelect;
119
+ /** Optional footer — a template, `[slot=footer]` content, or plain text. */
120
+ footer;
121
+ /** Accessible label override; defaults to `t('settingsContainer.aria.settings', …)`. */
122
+ ariaLabel;
123
+ /** Extra classes. */
124
+ className;
125
+ /** The optional footer container (projected content lands here; read once). */
126
+ footerEl;
127
+ /** Whether a `[slot=footer]` projection landed (`null`: decided by the text input). */
128
+ footerProjected = signal(true, /* @ts-ignore */
129
+ ...(ngDevMode ? [{ debugName: "footerProjected" }] : /* istanbul ignore next */ []));
130
+ /** The i18n provider access (locale-reactive through the notifications signal). */
131
+ i18n = useTranslation();
132
+ /**
133
+ * Reads the optional footer's first render: when neither text nor projected
134
+ * content landed, React would not render it at all, so the optimistic render
135
+ * is withdrawn.
136
+ */
137
+ ngAfterViewInit() {
138
+ this.footerProjected.set(this.hasFooterText() ? null : hasRenderableContent(this.footerEl?.nativeElement));
139
+ }
140
+ /**
141
+ * The current class map.
142
+ * @returns The UIClassMap.
143
+ */
144
+ cm() {
145
+ return getClassMap();
146
+ }
147
+ /**
148
+ * Renders a text value the way React renders a node string.
149
+ * @param value - The prop value.
150
+ * @returns The text to render, or `''` when there is nothing.
151
+ */
152
+ textOf(value) {
153
+ return value === null || value === undefined ? '' : String(value);
154
+ }
155
+ /**
156
+ * Whether a value renders as text (React renders strings and numbers).
157
+ * @param value - The prop value.
158
+ * @returns True when the value renders as text.
159
+ */
160
+ isText(value) {
161
+ return isText(value);
162
+ }
163
+ /**
164
+ * A data value's node template, when it is one.
165
+ * @param value - The prop value.
166
+ * @returns The template, or null.
167
+ */
168
+ templateOf(value) {
169
+ return isTemplate(value) ? value : null;
170
+ }
171
+ /**
172
+ * The nav's class list (React's `cm.cn(cm.stack(1), className)`).
173
+ * @returns The class string.
174
+ */
175
+ classes() {
176
+ return this.cm().cn(this.cm().stack(1), this.className);
177
+ }
178
+ /**
179
+ * The nav's accessible name (React's
180
+ * `ariaLabel ?? t('settingsContainer.aria.settings', …)`).
181
+ * @returns The label text.
182
+ */
183
+ navLabel() {
184
+ return (this.ariaLabel ??
185
+ this.i18n.t('settingsContainer.aria.settings', undefined, { defaultValue: 'Settings' }));
186
+ }
187
+ /**
188
+ * One item's button class list, with React's active/inactive weight branch.
189
+ * @param item - The item.
190
+ * @returns The class string.
191
+ */
192
+ itemClasses(item) {
193
+ const active = item.id === this.activeId;
194
+ return this.cm().cn(this.cm().flex({ align: 'center', gap: 'sm' }), this.cm().sp('px', 3), this.cm().sp('py', 2), this.cm().textSize('sm'), active ? this.cm().fontWeight('semibold') : this.cm().fontWeight('medium'));
195
+ }
196
+ /**
197
+ * The footer container's class (`cm.sp('mt', 4)`).
198
+ * @returns The class string.
199
+ */
200
+ footerClasses() {
201
+ return this.cm().sp('mt', 4);
202
+ }
203
+ /**
204
+ * The footer as a template, when the caller passed a node.
205
+ * @returns The footer template, or null.
206
+ */
207
+ footerTemplate() {
208
+ return isTemplate(this.footer) ? this.footer : null;
209
+ }
210
+ /**
211
+ * Whether the footer input renders as truthy text (React's `footer && …`).
212
+ * @returns True when the footer text renders.
213
+ */
214
+ hasFooterText() {
215
+ return hasText(this.footer);
216
+ }
217
+ /**
218
+ * Whether the footer renders: React's `footer && …` on the text input, a
219
+ * template, or projected content.
220
+ * @returns True when the footer shows.
221
+ */
222
+ showFooter() {
223
+ return this.hasFooterText() || isTemplate(this.footer) || this.footerProjected() === true;
224
+ }
225
+ /**
226
+ * Activates an item (React's `onClick={() => onSelect(item.id)}`).
227
+ * @param item - The clicked item.
228
+ */
229
+ select(item) {
230
+ this.onSelect?.(item.id);
231
+ }
232
+ static ɵfac = function SettingsSidebar_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || SettingsSidebar)(); };
233
+ static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: SettingsSidebar, selectors: [["nav", "mol-settings-sidebar", ""]], viewQuery: function SettingsSidebar_Query(rf, ctx) { if (rf & 1) {
234
+ i0.ɵɵviewQuery(_c0, 5);
235
+ } if (rf & 2) {
236
+ let _t;
237
+ i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.footerEl = _t.first);
238
+ } }, hostVars: 3, hostBindings: function SettingsSidebar_HostBindings(rf, ctx) { if (rf & 2) {
239
+ i0.ɵɵattribute("aria-label", ctx.navLabel());
240
+ i0.ɵɵclassMap(ctx.classes());
241
+ } }, inputs: { items: "items", activeId: "activeId", onSelect: "onSelect", footer: "footer", ariaLabel: "ariaLabel", className: "className" }, ngContentSelectors: _c2, decls: 3, vars: 1, consts: [["footerEl", ""], ["type", "button", 3, "class"], [3, "class"], ["type", "button", 3, "click"], [3, "ngTemplateOutlet"]], template: function SettingsSidebar_Template(rf, ctx) { if (rf & 1) {
242
+ i0.ɵɵprojectionDef(_c1);
243
+ i0.ɵɵrepeaterCreate(0, SettingsSidebar_For_1_Template, 5, 5, "button", 1, _forTrack0);
244
+ i0.ɵɵconditionalCreate(2, SettingsSidebar_Conditional_2_Template, 5, 3, "div", 2);
245
+ } if (rf & 2) {
246
+ i0.ɵɵrepeater(ctx.items);
247
+ i0.ɵɵadvance(2);
248
+ i0.ɵɵconditional(ctx.showFooter() ? 2 : -1);
249
+ } }, dependencies: [NgTemplateOutlet], encapsulation: 2 });
250
+ }
251
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(SettingsSidebar, [{
252
+ type: Component,
253
+ args: [{
254
+ selector: 'nav[mol-settings-sidebar]',
255
+ standalone: true,
256
+ imports: [NgTemplateOutlet],
257
+ inputs: ['items', 'activeId', 'onSelect', 'footer', 'ariaLabel', 'className'],
258
+ host: {
259
+ '[class]': 'classes()',
260
+ '[attr.aria-label]': 'navLabel()',
261
+ },
262
+ // prettier-ignore
263
+ template: `@for (item of items; track item.id) {<button type="button" [attr.aria-current]="item.id === activeId ? 'page' : null" [class]="itemClasses(item)" (click)="select(item)">@if (item.icon != null) {@if (isText(item.icon)) {<ng-container>{{ textOf(item.icon) }}</ng-container>}@else {<ng-container [ngTemplateOutlet]="templateOf(item.icon)" />}}<span>@if (isText(item.label)) {<ng-container>{{ textOf(item.label) }}</ng-container>}@else {<ng-container [ngTemplateOutlet]="templateOf(item.label)" />}</span></button>}@if (showFooter()) {<div #footerEl [class]="footerClasses()">@if (footerTemplate(); as footerTpl) {<ng-container [ngTemplateOutlet]="footerTpl" />}@else if (hasFooterText()) {<ng-container>{{ textOf(footer) }}</ng-container>}<ng-content select="[slot=footer]"></ng-content></div>}`,
264
+ }]
265
+ }], null, { footerEl: [{
266
+ type: ViewChild,
267
+ args: ['footerEl']
268
+ }] }); })();
269
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(SettingsSidebar, { className: "SettingsSidebar", filePath: "settings-sidebar.component.ts", lineNumber: 47 }); })();
270
+ //# sourceMappingURL=settings-sidebar.component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"settings-sidebar.component.js","sourceRoot":"","sources":["../src/settings-sidebar.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAClD,OAAO,EAEL,SAAS,EAET,MAAM,EAEN,SAAS,GACV,MAAM,eAAe,CAAA;AAEtB,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAEtD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,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xR,2CAAwR;4BAPxxB,gBAAgB;;iFASf,eAAe;cAZ3B,SAAS;eAAC;gBACT,QAAQ,EAAE,2BAA2B;gBACrC,UAAU,EAAE,IAAI;gBAChB,OAAO,EAAE,CAAC,gBAAgB,CAAC;gBAC3B,MAAM,EAAE,CAAC,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,CAAC;gBAC7E,IAAI,EAAE;oBACJ,SAAS,EAAE,WAAW;oBACtB,mBAAmB,EAAE,YAAY;iBAClC;gBACD,kBAAkB;gBAClB,QAAQ,EAAE,yxBAAyxB;aACpyB;;kBAgBE,SAAS;mBAAC,UAAU;;kFAfV,eAAe"}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Helpers for the settings-page scaffold's optional, projected-slot regions.
3
+ *
4
+ * React renders those regions conditionally (`{node && <p>…</p>}`). Angular
5
+ * projection needs an always-mounted `<ng-content>` capture point, so the
6
+ * regions render optimistically and withdraw themselves when nothing landed —
7
+ * the same approach the framework's other feature ports use.
8
+ *
9
+ * @module
10
+ */
11
+ import type { TemplateRef } from '@angular/core';
12
+ /**
13
+ * Whether a node-valued prop is an Angular template (a projected node) rather
14
+ * than plain text. Checked structurally — `TemplateRef` is a type-only import
15
+ * in the emitted metadata, so `instanceof` is not dependable across bundles.
16
+ *
17
+ * @param value - The prop value.
18
+ * @returns True when it can be rendered with `ngTemplateOutlet`.
19
+ */
20
+ export declare const isTemplate: (value: unknown) => value is TemplateRef<unknown>;
21
+ /**
22
+ * Whether a value renders as text (React renders strings and numbers, and
23
+ * nothing for `null` / `undefined` / booleans).
24
+ *
25
+ * @param value - The prop value.
26
+ * @returns True when the value renders as text.
27
+ */
28
+ export declare const isText: (value: unknown) => boolean;
29
+ /**
30
+ * Whether an optional node prop renders — React's `{node && …}` truthiness for
31
+ * a string or number value.
32
+ *
33
+ * @param value - The prop value.
34
+ * @returns True when the value is truthy text.
35
+ */
36
+ export declare const hasText: (value: unknown) => boolean;
37
+ /**
38
+ * Whether an element carries renderable content (a projected slot landed, or
39
+ * its text input rendered).
40
+ *
41
+ * @param el - The element.
42
+ * @returns True when its children render anything.
43
+ */
44
+ export declare const hasRenderableContent: (el: HTMLElement | undefined | null) => boolean;
45
+ //# sourceMappingURL=slots.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slots.d.ts","sourceRoot":"","sources":["../src/slots.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAEhD;;;;;;;GAOG;AACH,eAAO,MAAM,UAAU,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,WAAW,CAAC,OAAO,CAGE,CAAA;AAE1E;;;;;;GAMG;AACH,eAAO,MAAM,MAAM,GAAI,OAAO,OAAO,KAAG,OACgB,CAAA;AAExD;;;;;;GAMG;AACH,eAAO,MAAM,OAAO,GAAI,OAAO,OAAO,KAAG,OAC4C,CAAA;AAarF;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,GAAI,IAAI,WAAW,GAAG,SAAS,GAAG,IAAI,KAAG,OACd,CAAA"}
package/dist/slots.js ADDED
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Helpers for the settings-page scaffold's optional, projected-slot regions.
3
+ *
4
+ * React renders those regions conditionally (`{node && <p>…</p>}`). Angular
5
+ * projection needs an always-mounted `<ng-content>` capture point, so the
6
+ * regions render optimistically and withdraw themselves when nothing landed —
7
+ * the same approach the framework's other feature ports use.
8
+ *
9
+ * @module
10
+ */
11
+ /**
12
+ * Whether a node-valued prop is an Angular template (a projected node) rather
13
+ * than plain text. Checked structurally — `TemplateRef` is a type-only import
14
+ * in the emitted metadata, so `instanceof` is not dependable across bundles.
15
+ *
16
+ * @param value - The prop value.
17
+ * @returns True when it can be rendered with `ngTemplateOutlet`.
18
+ */
19
+ export const isTemplate = (value) => typeof value === 'object' &&
20
+ value !== null &&
21
+ typeof value.createEmbeddedView === 'function';
22
+ /**
23
+ * Whether a value renders as text (React renders strings and numbers, and
24
+ * nothing for `null` / `undefined` / booleans).
25
+ *
26
+ * @param value - The prop value.
27
+ * @returns True when the value renders as text.
28
+ */
29
+ export const isText = (value) => typeof value === 'string' || typeof value === 'number';
30
+ /**
31
+ * Whether an optional node prop renders — React's `{node && …}` truthiness for
32
+ * a string or number value.
33
+ *
34
+ * @param value - The prop value.
35
+ * @returns True when the value is truthy text.
36
+ */
37
+ export const hasText = (value) => typeof value === 'string' ? value !== '' : typeof value === 'number' && value !== 0;
38
+ /**
39
+ * Whether a node renders anything (an element, or text with content beyond
40
+ * whitespace).
41
+ *
42
+ * @param node - The node.
43
+ * @returns True when it renders.
44
+ */
45
+ const hasRenderable = (node) => node.nodeType === Node.ELEMENT_NODE ||
46
+ (node.nodeType === Node.TEXT_NODE && (node.textContent ?? '').trim().length > 0);
47
+ /**
48
+ * Whether an element carries renderable content (a projected slot landed, or
49
+ * its text input rendered).
50
+ *
51
+ * @param el - The element.
52
+ * @returns True when its children render anything.
53
+ */
54
+ export const hasRenderableContent = (el) => el ? Array.from(el.childNodes).some(hasRenderable) : false;
55
+ //# sourceMappingURL=slots.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slots.js","sourceRoot":"","sources":["../src/slots.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,KAAc,EAAiC,EAAE,CAC1E,OAAO,KAAK,KAAK,QAAQ;IACzB,KAAK,KAAK,IAAI;IACd,OAAQ,KAA8B,CAAC,kBAAkB,KAAK,UAAU,CAAA;AAE1E;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,KAAc,EAAW,EAAE,CAChD,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,QAAQ,CAAA;AAExD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,KAAc,EAAW,EAAE,CACjD,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,KAAK,EAAE,CAAC,CAAC,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,CAAC,CAAA;AAErF;;;;;;GAMG;AACH,MAAM,aAAa,GAAG,CAAC,IAAU,EAAW,EAAE,CAC5C,IAAI,CAAC,QAAQ,KAAK,IAAI,CAAC,YAAY;IACnC,CAAC,IAAI,CAAC,QAAQ,KAAK,IAAI,CAAC,SAAS,IAAI,CAAC,IAAI,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC,CAAA;AAElF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,EAAkC,EAAW,EAAE,CAClF,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,KAAK,CAAA"}
@@ -0,0 +1,89 @@
1
+ /**
2
+ * Types of `@molecule/app-settings-container-angular` — the Angular
3
+ * counterpart of `@molecule/app-settings-container-react`, same props and DOM.
4
+ *
5
+ * @module
6
+ */
7
+ /**
8
+ * Props accepted by the settings layout — the same props
9
+ * `@molecule/app-settings-container-react`'s `SettingsLayout` accepts.
10
+ * Node props (`sidebar`, `header`, `children`) are projected content in
11
+ * Angular (an input cannot carry a node), so they are typed `unknown`: pass
12
+ * them in the host template as `[slot=sidebar]`, `[slot=header]` and default
13
+ * content.
14
+ */
15
+ export interface SettingsLayoutProps {
16
+ /** Left-side navigation, projected as `[slot=sidebar]` content. */
17
+ sidebar?: unknown;
18
+ /** Main content area, projected as the element's default content. */
19
+ children?: unknown;
20
+ /** Optional header, projected as `[slot=header]` content. */
21
+ header?: unknown;
22
+ /** Extra classes on the outer wrapper. */
23
+ className?: string;
24
+ /** `data-mol-id` for AI-agent selectors. */
25
+ dataMolId?: string;
26
+ }
27
+ /**
28
+ * Props accepted by the content wrapper — the same props React's
29
+ * `SettingsContent` accepts. Its only node prop (`children`) is projected
30
+ * default content.
31
+ */
32
+ export interface SettingsContentProps {
33
+ /** Active section content, projected as the element's default content. */
34
+ children?: unknown;
35
+ /** Extra classes. */
36
+ className?: string;
37
+ }
38
+ /** A single navigable item in the settings sidebar. */
39
+ export interface SettingsSidebarItem {
40
+ /** Unique id; the active item is the one whose id equals `activeId`. */
41
+ id: string;
42
+ /** Visible label — a projected node template, or plain text. */
43
+ label: unknown;
44
+ /** Optional leading icon — a projected node template, or plain text. */
45
+ icon?: unknown;
46
+ }
47
+ /**
48
+ * Props accepted by the settings sidebar — the same props React's
49
+ * `SettingsSidebar` accepts. `footer` is projected as `[slot=footer]`
50
+ * content, or passed as text.
51
+ */
52
+ export interface SettingsSidebarProps {
53
+ /** Items to render, in order. */
54
+ items: SettingsSidebarItem[];
55
+ /** The id of the active item (controlled — the caller owns it). */
56
+ activeId: string;
57
+ /** Called with the clicked item's id. */
58
+ onSelect: (id: string) => void;
59
+ /** Optional footer, projected as `[slot=footer]` content or passed as text. */
60
+ footer?: unknown;
61
+ /**
62
+ * Accessible name for the `<nav>` region. Overrides the translated /
63
+ * `defaultValue` `'Settings'` (prop > `t()` > default).
64
+ */
65
+ ariaLabel?: string;
66
+ /** Extra classes. */
67
+ className?: string;
68
+ }
69
+ /**
70
+ * Props accepted by the settings section — the same props React's
71
+ * `SettingsSection` accepts. `title`, `description` and `footer` are node
72
+ * props: projected content (`[slot=title]`, `[slot=description]`,
73
+ * `[slot=footer]`) or plain text.
74
+ */
75
+ export interface SettingsSectionProps {
76
+ /** Section heading — a projected node template, or plain text. */
77
+ title?: unknown;
78
+ /** Optional description under the heading — a projected node template, or plain text. */
79
+ description?: unknown;
80
+ /** Section body, projected as the element's default content. */
81
+ children?: unknown;
82
+ /** Optional footer row — a projected node template, or plain text. */
83
+ footer?: unknown;
84
+ /** Extra classes on the Card. */
85
+ className?: string;
86
+ /** `data-mol-id` for AI-agent selectors. */
87
+ dataMolId?: string;
88
+ }
89
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;;;;GAOG;AACH,MAAM,WAAW,mBAAmB;IAClC,mEAAmE;IACnE,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,qEAAqE;IACrE,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,6DAA6D;IAC7D,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,0CAA0C;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,4CAA4C;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED;;;;GAIG;AACH,MAAM,WAAW,oBAAoB;IACnC,0EAA0E;IAC1E,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,qBAAqB;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,uDAAuD;AACvD,MAAM,WAAW,mBAAmB;IAClC,wEAAwE;IACxE,EAAE,EAAE,MAAM,CAAA;IACV,gEAAgE;IAChE,KAAK,EAAE,OAAO,CAAA;IACd,wEAAwE;IACxE,IAAI,CAAC,EAAE,OAAO,CAAA;CACf;AAED;;;;GAIG;AACH,MAAM,WAAW,oBAAoB;IACnC,iCAAiC;IACjC,KAAK,EAAE,mBAAmB,EAAE,CAAA;IAC5B,mEAAmE;IACnE,QAAQ,EAAE,MAAM,CAAA;IAChB,yCAAyC;IACzC,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAA;IAC9B,+EAA+E;IAC/E,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,qBAAqB;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED;;;;;GAKG;AACH,MAAM,WAAW,oBAAoB;IACnC,kEAAkE;IAClE,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,yFAAyF;IACzF,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,gEAAgE;IAChE,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,sEAAsE;IACtE,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,iCAAiC;IACjC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,4CAA4C;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB"}
package/dist/types.js ADDED
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Types of `@molecule/app-settings-container-angular` — the Angular
3
+ * counterpart of `@molecule/app-settings-container-react`, same props and DOM.
4
+ *
5
+ * @module
6
+ */
7
+ export {};
8
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
package/package.json CHANGED
@@ -1,6 +1,71 @@
1
1
  {
2
2
  "name": "@molecule/app-settings-container-angular",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "1.1.0",
4
+ "description": "Angular layout for Settings pages (sidebar + content + section cards)",
5
+ "homepage": "https://www.molecule.dev/packages/app-settings-container-angular",
6
+ "type": "module",
7
+ "main": "dist/index.js",
8
+ "types": "dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js"
13
+ }
14
+ },
15
+ "files": [
16
+ "dist",
17
+ "README.md"
18
+ ],
19
+ "scripts": {
20
+ "build": "ngc",
21
+ "dev": "ngc --watch",
22
+ "test": "vitest run",
23
+ "test:watch": "vitest"
24
+ },
25
+ "keywords": [
26
+ "molecule",
27
+ "settings-container",
28
+ "angular"
29
+ ],
30
+ "author": "Molecule Dev, Inc. (https://molecule.dev)",
31
+ "license": "Apache-2.0",
32
+ "repository": {
33
+ "type": "git",
34
+ "url": "https://github.com/molecule-dev/molecule.git",
35
+ "directory": "packages/app/features/settings-container-angular"
36
+ },
37
+ "engines": {
38
+ "node": ">=20"
39
+ },
40
+ "bugs": "https://github.com/molecule-dev/molecule/issues",
41
+ "publishConfig": {
42
+ "access": "public"
43
+ },
44
+ "peerDependencies": {
45
+ "@angular/common": "^22.0.0",
46
+ "@angular/core": "^22.0.0",
47
+ "@angular/platform-browser": "^22.0.0",
48
+ "@molecule/app-angular": "^3.5.0",
49
+ "@molecule/app-ui": "^1.0.1",
50
+ "@molecule/app-ui-angular": "^1.1.0"
51
+ },
52
+ "devDependencies": {
53
+ "@angular/common": "22.2.3",
54
+ "@angular/compiler": "22.2.3",
55
+ "@angular/compiler-cli": "22.2.3",
56
+ "@angular/core": "22.2.3",
57
+ "@angular/platform-browser": "22.2.3",
58
+ "@molecule/app-angular": "3.9.0",
59
+ "@molecule/app-framework-conformance": "0.0.0",
60
+ "@molecule/app-i18n": "1.2.2",
61
+ "@molecule/app-icons": "1.0.4",
62
+ "@molecule/app-ui": "1.5.0",
63
+ "@molecule/app-ui-angular": "1.3.1",
64
+ "@types/node": "26.6.5",
65
+ "jsdom": "30.1.3",
66
+ "rxjs": "7.8.2",
67
+ "typescript": "6.0.3",
68
+ "vitest": "4.1.12",
69
+ "zone.js": "0.16.3"
70
+ }
71
+ }