@molecule/app-sidebar-layout-angular 0.0.0-stage → 0.0.1-stage

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/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/README.md CHANGED
@@ -1,3 +1,11 @@
1
- # Temporary Holding Version
1
+ # @molecule/app-sidebar-layout-angular
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Vertical sidebar app shell: brand block + vertical NavLinks + user-menu slot, with a router outlet for nested routes
4
+
5
+ ```
6
+ npm install @molecule/app-sidebar-layout-angular
7
+ ```
8
+
9
+ Part of the [Molecule](https://www.molecule.dev) package fleet. This page carries the manifest summary; the full generated documentation ships with the package's first committed version.
10
+
11
+ License: Apache-2.0
@@ -0,0 +1,68 @@
1
+ /**
2
+ * Angular vertical sidebar app shell layout — the counterpart of
3
+ * `@molecule/app-sidebar-layout-react`: the same props and the same DOM for the
4
+ * same input.
5
+ *
6
+ * Exports `<SidebarLayout>` plus the `SidebarLayoutProps` and `SidebarNavItem`
7
+ * types — fixed-width left sidebar with brand link, vertical nav links, and
8
+ * bottom user-menu / theme-toggle slots; the main area on the right scrolls and
9
+ * renders the routed page.
10
+ *
11
+ * @example
12
+ * ```ts
13
+ * import { Component } from '@angular/core'
14
+ * import { SidebarLayout } from '@molecule/app-sidebar-layout-angular'
15
+ *
16
+ * const NAV = [
17
+ * { key: 'dashboard', to: '/dashboard', icon: 'dashboard', label: 'Dashboard' },
18
+ * { key: 'projects', to: '/projects', icon: 'folder', label: 'Projects' },
19
+ * { key: 'settings', to: '/settings', icon: 'settings', label: 'Settings' },
20
+ * ]
21
+ *
22
+ * @Component({
23
+ * selector: 'app-shell',
24
+ * standalone: true,
25
+ * imports: [SidebarLayout],
26
+ * template: `
27
+ * <div mol-sidebar-layout [appName]="'Acme App'" [navItems]="NAV">
28
+ * <app-user-menu slot="userMenu" />
29
+ * <router-outlet />
30
+ * </div>
31
+ * `,
32
+ * })
33
+ * export class Shell {
34
+ * readonly NAV = NAV
35
+ * }
36
+ * ```
37
+ *
38
+ * @remarks
39
+ * - Router required: reads the current location and renders router links, so
40
+ * it must be mounted inside the molecule router provider (the app shell
41
+ * does that at startup).
42
+ * - Node props are projected content: the bottom slots are selected by
43
+ * `[slot=userMenu]` / `[slot=themeToggle]`, everything else lands in the main
44
+ * container as the default projection (React's `<Outlet />`).
45
+ * - Fully ClassMap-driven: every layout/surface/border/text/state class is
46
+ * resolved through `getClassMap()` (`cm.pageShell`, `cm.page`, `cm.surface`,
47
+ * `cm.borderR`, …), so swapping the ClassMap bond restyles the whole shell.
48
+ * The sidebar WIDTH is applied via inline style from `sidebarWidth`
49
+ * (`'sm'`|`'md'`|`'lg'`|pixel `number`); the old `sidebarWidthClass` prop is
50
+ * `@deprecated` — parsed to pixels, never re-emitted as a class.
51
+ * - `icon` values are Material Symbols ligature names rendered with the
52
+ * `material-symbols-outlined` font class — the one documented icon-font
53
+ * exception. Without the font loaded, the raw icon name shows as text.
54
+ * - Active-nav highlighting picks the longest prefix-match of the current
55
+ * path; same-path links get a `#top` fragment appended.
56
+ * - `navAriaLabel` overrides the translated nav region name; without it the
57
+ * label comes from `t('sidebarLayout.aria.primaryNavigation')` (English
58
+ * default `'Primary navigation'`), so it follows a locale switch through its
59
+ * companion locale bond (`@molecule/app-locales-sidebar-layout`). Nav item
60
+ * `label`s stay plain caller strings — translate them upstream.
61
+ * - Requires a bonded ClassMap. Sibling: `@molecule/app-shell-layout-angular`
62
+ * is the top header/footer shell (router-free).
63
+ *
64
+ * @module
65
+ */
66
+ export * from './sidebar-layout.component.js';
67
+ export * from './types.js';
68
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgEG;AAEH,cAAc,+BAA+B,CAAA;AAC7C,cAAc,YAAY,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,68 @@
1
+ /**
2
+ * Angular vertical sidebar app shell layout — the counterpart of
3
+ * `@molecule/app-sidebar-layout-react`: the same props and the same DOM for the
4
+ * same input.
5
+ *
6
+ * Exports `<SidebarLayout>` plus the `SidebarLayoutProps` and `SidebarNavItem`
7
+ * types — fixed-width left sidebar with brand link, vertical nav links, and
8
+ * bottom user-menu / theme-toggle slots; the main area on the right scrolls and
9
+ * renders the routed page.
10
+ *
11
+ * @example
12
+ * ```ts
13
+ * import { Component } from '@angular/core'
14
+ * import { SidebarLayout } from '@molecule/app-sidebar-layout-angular'
15
+ *
16
+ * const NAV = [
17
+ * { key: 'dashboard', to: '/dashboard', icon: 'dashboard', label: 'Dashboard' },
18
+ * { key: 'projects', to: '/projects', icon: 'folder', label: 'Projects' },
19
+ * { key: 'settings', to: '/settings', icon: 'settings', label: 'Settings' },
20
+ * ]
21
+ *
22
+ * @Component({
23
+ * selector: 'app-shell',
24
+ * standalone: true,
25
+ * imports: [SidebarLayout],
26
+ * template: `
27
+ * <div mol-sidebar-layout [appName]="'Acme App'" [navItems]="NAV">
28
+ * <app-user-menu slot="userMenu" />
29
+ * <router-outlet />
30
+ * </div>
31
+ * `,
32
+ * })
33
+ * export class Shell {
34
+ * readonly NAV = NAV
35
+ * }
36
+ * ```
37
+ *
38
+ * @remarks
39
+ * - Router required: reads the current location and renders router links, so
40
+ * it must be mounted inside the molecule router provider (the app shell
41
+ * does that at startup).
42
+ * - Node props are projected content: the bottom slots are selected by
43
+ * `[slot=userMenu]` / `[slot=themeToggle]`, everything else lands in the main
44
+ * container as the default projection (React's `<Outlet />`).
45
+ * - Fully ClassMap-driven: every layout/surface/border/text/state class is
46
+ * resolved through `getClassMap()` (`cm.pageShell`, `cm.page`, `cm.surface`,
47
+ * `cm.borderR`, …), so swapping the ClassMap bond restyles the whole shell.
48
+ * The sidebar WIDTH is applied via inline style from `sidebarWidth`
49
+ * (`'sm'`|`'md'`|`'lg'`|pixel `number`); the old `sidebarWidthClass` prop is
50
+ * `@deprecated` — parsed to pixels, never re-emitted as a class.
51
+ * - `icon` values are Material Symbols ligature names rendered with the
52
+ * `material-symbols-outlined` font class — the one documented icon-font
53
+ * exception. Without the font loaded, the raw icon name shows as text.
54
+ * - Active-nav highlighting picks the longest prefix-match of the current
55
+ * path; same-path links get a `#top` fragment appended.
56
+ * - `navAriaLabel` overrides the translated nav region name; without it the
57
+ * label comes from `t('sidebarLayout.aria.primaryNavigation')` (English
58
+ * default `'Primary navigation'`), so it follows a locale switch through its
59
+ * companion locale bond (`@molecule/app-locales-sidebar-layout`). Nav item
60
+ * `label`s stay plain caller strings — translate them upstream.
61
+ * - Requires a bonded ClassMap. Sibling: `@molecule/app-shell-layout-angular`
62
+ * is the top header/footer shell (router-free).
63
+ *
64
+ * @module
65
+ */
66
+ export * from './sidebar-layout.component.js';
67
+ export * from './types.js';
68
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgEG;AAEH,cAAc,+BAA+B,CAAA;AAC7C,cAAc,YAAY,CAAA"}
@@ -0,0 +1,179 @@
1
+ /**
2
+ * SidebarLayout component (React parity).
3
+ *
4
+ * @module
5
+ */
6
+ import { type AfterViewChecked, type AfterViewInit, type DoCheck, type OnDestroy } from '@angular/core';
7
+ import type { UIClassMap } from '@molecule/app-ui';
8
+ import type { SidebarNavItem } from './types.js';
9
+ import * as i0 from "@angular/core";
10
+ /**
11
+ * SidebarLayout component.
12
+ *
13
+ * Fixed-width left sidebar with brand link + vertical router links + bottom
14
+ * user-menu / theme-toggle slots, and the `<main>` holding the routed page
15
+ * body. The host IS the outer `<div>` (`div[mol-sidebar-layout]`), matching
16
+ * React's root exactly. The page body is projected as the element's default
17
+ * content (React renders its router's `<Outlet />` in the `<main>`); the bottom
18
+ * slots are projected as `[slot=userMenu]` / `[slot=themeToggle]` content.
19
+ *
20
+ * The sidebar WIDTH is the one value a styling-agnostic ClassMap can't express,
21
+ * so it is applied via inline style from `sidebarWidth`; active-nav
22
+ * highlighting picks the longest prefix-match of the current path, and
23
+ * same-path links get a `#top` fragment appended. `label` is rendered as-is:
24
+ * pass an already-translated string.
25
+ */
26
+ export declare class SidebarLayout implements AfterViewInit, AfterViewChecked, DoCheck, OnDestroy {
27
+ /** Brand text shown at the top of the sidebar (typically the app name). */
28
+ appName: string;
29
+ /** Path the brand link navigates to (defaults to `'/'` at read time). */
30
+ logoTo?: string;
31
+ /** Vertical nav items rendered in the sidebar. */
32
+ navItems: ReadonlyArray<SidebarNavItem>;
33
+ /**
34
+ * Aria-label for the primary `<nav>`. Overrides the translated default
35
+ * (`sidebarLayout.aria.primaryNavigation`, English `'Primary navigation'`);
36
+ * prop > `t()` > default.
37
+ */
38
+ navAriaLabel?: string;
39
+ /** Sidebar width preset or explicit pixel number (defaults to `'md'` at read time). */
40
+ sidebarWidth?: string | number;
41
+ /** Deprecated Tailwind width utility, parsed to pixels (never emitted as a class). */
42
+ sidebarWidthClass?: string;
43
+ /** Extra classes on the outer wrapper. */
44
+ className?: string;
45
+ /** `data-mol-id` for AI-agent selectors. */
46
+ dataMolId?: string;
47
+ /** The projected bottom-slot container (detached when both slots are absent). */
48
+ private bottom?;
49
+ /** The placeholder `<span>` React renders while the user menu is absent. */
50
+ private placeholder?;
51
+ /** The `[slot=userMenu]` projection capture point. */
52
+ private userSlot?;
53
+ /** The `[slot=themeToggle]` projection capture point. */
54
+ private themeSlot?;
55
+ private readonly router;
56
+ private readonly i18n;
57
+ /** The current location, kept current so active items follow navigation. */
58
+ private readonly location;
59
+ private readonly stop;
60
+ private readonly guard;
61
+ /** Stops listening to the router when the component goes away. */
62
+ ngOnDestroy(): void;
63
+ /**
64
+ * The current class map.
65
+ * @returns The UIClassMap.
66
+ */
67
+ cm(): UIClassMap;
68
+ /**
69
+ * Computes the wrapper class list.
70
+ * @returns The class string.
71
+ */
72
+ classes(): string;
73
+ /**
74
+ * Computes the sidebar's class list.
75
+ * @returns The class string.
76
+ */
77
+ asideClasses(): string;
78
+ /**
79
+ * The inline sidebar width, in pixels.
80
+ * @returns The width in pixels.
81
+ */
82
+ widthPx(): number;
83
+ /**
84
+ * Computes the brand link class list.
85
+ * @returns The class string.
86
+ */
87
+ brandClasses(): string;
88
+ /**
89
+ * Computes the nav class list.
90
+ * @returns The class string.
91
+ */
92
+ navClasses(): string;
93
+ /**
94
+ * The nav region's accessible name: an explicit `navAriaLabel` wins,
95
+ * otherwise the translated default (the inline English keeps the DOM
96
+ * identical until a locale bond supplies the key).
97
+ *
98
+ * @returns The aria-label.
99
+ */
100
+ navLabel(): string;
101
+ /**
102
+ * The brand link destination (React's default parameter).
103
+ * @returns The link target.
104
+ */
105
+ logoPath(): string;
106
+ /**
107
+ * One nav item's link destination.
108
+ * @param item - The nav item.
109
+ * @returns The link target.
110
+ */
111
+ itemPath(item: SidebarNavItem): string;
112
+ /**
113
+ * Computes the icon span class list.
114
+ * @returns The class string.
115
+ */
116
+ iconClasses(): string;
117
+ /**
118
+ * Computes the bottom-slot container class list.
119
+ * @returns The class string.
120
+ */
121
+ bottomClasses(): string;
122
+ /**
123
+ * Computes the main content area class list.
124
+ * @returns The class string.
125
+ */
126
+ mainClasses(): string;
127
+ /**
128
+ * The key of the nav item whose `to` is the longest prefix-match of the
129
+ * current pathname.
130
+ *
131
+ * @returns The active item's key, or null when nothing matches.
132
+ */
133
+ activeKey(): string | null;
134
+ /**
135
+ * Whether one nav item is the active one at the current location.
136
+ * @param item - The nav item.
137
+ * @returns True when the item renders in its active state.
138
+ */
139
+ isActive(item: SidebarNavItem): boolean;
140
+ /**
141
+ * Computes the class list of one nav link: the shared nav-item treatment
142
+ * plus the active or idle variant.
143
+ * @param item - The nav item.
144
+ * @returns The class string.
145
+ */
146
+ itemClasses(item: SidebarNavItem): string;
147
+ /**
148
+ * Appends `#top` when `to` is the current path, so a same-route click still
149
+ * produces an observable URL change. React passes the bare `#top` and
150
+ * react-router resolves it against the location (`/#top` on the home route);
151
+ * this binding's `Link` renders `to` verbatim, so the root case is spelled
152
+ * out here.
153
+ *
154
+ * @param to - The link's destination.
155
+ * @returns The link target.
156
+ */
157
+ private samePathTarget;
158
+ /**
159
+ * Reconciles the projected bottom slots against React's branch once the view
160
+ * queries resolve.
161
+ */
162
+ ngAfterViewInit(): void;
163
+ /**
164
+ * Re-reconciles on later passes, so a change to the projected content swaps
165
+ * the branch the way React does.
166
+ */
167
+ ngDoCheck(): void;
168
+ /** Re-reconciles after each view update. */
169
+ ngAfterViewChecked(): void;
170
+ /**
171
+ * Applies React's condition: the bottom container renders only when a slot
172
+ * exists, and the placeholder `<span>` renders only while the user menu is
173
+ * absent and the theme toggle is present.
174
+ */
175
+ private reconcile;
176
+ static ɵfac: i0.ɵɵFactoryDeclaration<SidebarLayout, never>;
177
+ static ɵcmp: i0.ɵɵComponentDeclaration<SidebarLayout, "div[mol-sidebar-layout]", never, { "appName": { "alias": "appName"; "required": false; }; "logoTo": { "alias": "logoTo"; "required": false; }; "navItems": { "alias": "navItems"; "required": false; }; "navAriaLabel": { "alias": "navAriaLabel"; "required": false; }; "sidebarWidth": { "alias": "sidebarWidth"; "required": false; }; "sidebarWidthClass": { "alias": "sidebarWidthClass"; "required": false; }; "className": { "alias": "className"; "required": false; }; "dataMolId": { "alias": "dataMolId"; "required": false; }; }, {}, never, ["[slot=userMenu]", "[slot=themeToggle]", "*"], true, never>;
178
+ }
179
+ //# sourceMappingURL=sidebar-layout.component.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sidebar-layout.component.d.ts","sourceRoot":"","sources":["../src/sidebar-lay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,CAAmC;IAEzD,kEAAkE;IAClE,WAAW,IAAI,IAAI;IAInB;;;OAGG;IACH,EAAE,IAAI,UAAU;IAIhB;;;OAGG;IACH,OAAO,IAAI,MAAM;IAIjB;;;OAGG;IACH,YAAY,IAAI,MAAM;IAKtB;;;OAGG;IACH,OAAO,IAAI,MAAM;IAIjB;;;OAGG;IACH,YAAY,IAAI,MAAM;IAKtB;;;OAGG;IACH,UAAU,IAAI,MAAM;IAIpB;;;;;;OAMG;IACH,QAAQ,IAAI,MAAM;IASlB;;;OAGG;IACH,QAAQ,IAAI,MAAM;IAIlB;;;;OAIG;IACH,QAAQ,CAAC,IAAI,EAAE,cAAc,GAAG,MAAM;IAItC;;;OAGG;IACH,WAAW,IAAI,MAAM;IAIrB;;;OAGG;IACH,aAAa,IAAI,MAAM;IASvB;;;OAGG;IACH,WAAW,IAAI,MAAM;IAIrB;;;;;OAKG;IACH,SAAS,IAAI,MAAM,GAAG,IAAI;IAW1B;;;;OAIG;IACH,QAAQ,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO;IAIvC;;;;;OAKG;IACH,WAAW,CAAC,IAAI,EAAE,cAAc,GAAG,MAAM;IAezC;;;;;;;;;OASG;IACH,OAAO,CAAC,cAAc;IAOtB;;;OAGG;IACH,eAAe,IAAI,IAAI;IAIvB;;;OAGG;IACH,SAAS,IAAI,IAAI;IAIjB,4CAA4C;IAC5C,kBAAkB,IAAI,IAAI;IAI1B;;;;OAIG;IACH,OAAO,CAAC,SAAS;yCAzPN,aAAa;2CAAb,aAAa;CAiQzB"}
@@ -0,0 +1,399 @@
1
+ /**
2
+ * SidebarLayout component (React parity).
3
+ *
4
+ * @module
5
+ */
6
+ import { Component, inject, Renderer2, signal, ViewChild, } from '@angular/core';
7
+ import { Link, useRouterInstance, useTranslation } from '@molecule/app-angular';
8
+ import { getClassMap } from '@molecule/app-ui';
9
+ import { hasNodes, SlotGuard } from './slot-dom.js';
10
+ import * as i0 from "@angular/core";
11
+ const _c0 = ["bottom"];
12
+ const _c1 = ["placeholder"];
13
+ const _c2 = ["userSlot"];
14
+ const _c3 = ["themeSlot"];
15
+ const _c4 = [[["", "slot", "usermenu"]], [["", "slot", "themetoggle"]], "*"];
16
+ const _c5 = ["[slot=userMenu]", "[slot=themeToggle]", "*"];
17
+ const _forTrack0 = ($index, $item) => $item.key;
18
+ function SidebarLayout_For_5_Conditional_1_Template(rf, ctx) { if (rf & 1) {
19
+ i0.ɵɵelementStart(0, "span", 6);
20
+ i0.ɵɵtext(1);
21
+ i0.ɵɵelementEnd();
22
+ } if (rf & 2) {
23
+ const item_r1 = i0.ɵɵnextContext().$implicit;
24
+ const ctx_r1 = i0.ɵɵnextContext();
25
+ i0.ɵɵclassMap(ctx_r1.iconClasses());
26
+ i0.ɵɵadvance();
27
+ i0.ɵɵtextInterpolate(item_r1.icon);
28
+ } }
29
+ function SidebarLayout_For_5_Template(rf, ctx) { if (rf & 1) {
30
+ i0.ɵɵelementStart(0, "a", 4);
31
+ i0.ɵɵconditionalCreate(1, SidebarLayout_For_5_Conditional_1_Template, 2, 3, "span", 8);
32
+ i0.ɵɵelementStart(2, "span");
33
+ i0.ɵɵtext(3);
34
+ i0.ɵɵelementEnd()();
35
+ } if (rf & 2) {
36
+ const item_r1 = ctx.$implicit;
37
+ const ctx_r1 = i0.ɵɵnextContext();
38
+ i0.ɵɵclassMap(ctx_r1.itemClasses(item_r1));
39
+ i0.ɵɵproperty("molLink", ctx_r1.itemPath(item_r1));
40
+ i0.ɵɵattribute("data-mol-id", "nav-" + item_r1.key)("aria-current", ctx_r1.isActive(item_r1) ? "page" : null);
41
+ i0.ɵɵadvance();
42
+ i0.ɵɵconditional(item_r1.icon ? 1 : -1);
43
+ i0.ɵɵadvance(2);
44
+ i0.ɵɵtextInterpolate(item_r1.label);
45
+ } }
46
+ /** Pixel widths for the `sm` / `md` / `lg` presets. */
47
+ const SIDEBAR_WIDTH_PX = {
48
+ sm: 208,
49
+ md: 240,
50
+ lg: 256,
51
+ };
52
+ /**
53
+ * Resolves the effective sidebar pixel width from the stack-agnostic
54
+ * `sidebarWidth` prop, falling back to the deprecated `sidebarWidthClass`
55
+ * (a `w-<n>` Tailwind utility) for backward compatibility. The legacy class is
56
+ * PARSED to pixels — never re-emitted as a class.
57
+ *
58
+ * @param width - The stack-agnostic width preset or explicit pixel number.
59
+ * @param legacyWidthClass - Deprecated Tailwind width utility (e.g. `'w-64'`).
60
+ * @returns The sidebar width in pixels.
61
+ */
62
+ const resolveSidebarWidthPx = (width, legacyWidthClass) => {
63
+ if (typeof width === 'number')
64
+ return width;
65
+ if (width === 'sm' || width === 'md' || width === 'lg')
66
+ return SIDEBAR_WIDTH_PX[width];
67
+ if (legacyWidthClass) {
68
+ // Tailwind spacing scale: `w-<n>` === n × 0.25rem === n × 4px at a 16px root.
69
+ const match = /^w-(\d+(?:\.\d+)?)$/.exec(legacyWidthClass.trim());
70
+ if (match)
71
+ return Number(match[1]) * 4;
72
+ }
73
+ return SIDEBAR_WIDTH_PX.md;
74
+ };
75
+ /**
76
+ * SidebarLayout component.
77
+ *
78
+ * Fixed-width left sidebar with brand link + vertical router links + bottom
79
+ * user-menu / theme-toggle slots, and the `<main>` holding the routed page
80
+ * body. The host IS the outer `<div>` (`div[mol-sidebar-layout]`), matching
81
+ * React's root exactly. The page body is projected as the element's default
82
+ * content (React renders its router's `<Outlet />` in the `<main>`); the bottom
83
+ * slots are projected as `[slot=userMenu]` / `[slot=themeToggle]` content.
84
+ *
85
+ * The sidebar WIDTH is the one value a styling-agnostic ClassMap can't express,
86
+ * so it is applied via inline style from `sidebarWidth`; active-nav
87
+ * highlighting picks the longest prefix-match of the current path, and
88
+ * same-path links get a `#top` fragment appended. `label` is rendered as-is:
89
+ * pass an already-translated string.
90
+ */
91
+ export class SidebarLayout {
92
+ /** Brand text shown at the top of the sidebar (typically the app name). */
93
+ appName = '';
94
+ /** Path the brand link navigates to (defaults to `'/'` at read time). */
95
+ logoTo;
96
+ /** Vertical nav items rendered in the sidebar. */
97
+ navItems = [];
98
+ /**
99
+ * Aria-label for the primary `<nav>`. Overrides the translated default
100
+ * (`sidebarLayout.aria.primaryNavigation`, English `'Primary navigation'`);
101
+ * prop > `t()` > default.
102
+ */
103
+ navAriaLabel;
104
+ /** Sidebar width preset or explicit pixel number (defaults to `'md'` at read time). */
105
+ sidebarWidth;
106
+ /** Deprecated Tailwind width utility, parsed to pixels (never emitted as a class). */
107
+ sidebarWidthClass;
108
+ /** Extra classes on the outer wrapper. */
109
+ className;
110
+ /** `data-mol-id` for AI-agent selectors. */
111
+ dataMolId;
112
+ /** The projected bottom-slot container (detached when both slots are absent). */
113
+ bottom;
114
+ /** The placeholder `<span>` React renders while the user menu is absent. */
115
+ placeholder;
116
+ /** The `[slot=userMenu]` projection capture point. */
117
+ userSlot;
118
+ /** The `[slot=themeToggle]` projection capture point. */
119
+ themeSlot;
120
+ router = useRouterInstance();
121
+ i18n = useTranslation();
122
+ /** The current location, kept current so active items follow navigation. */
123
+ location = signal(this.router.getLocation(), /* @ts-ignore */
124
+ ...(ngDevMode ? [{ debugName: "location" }] : /* istanbul ignore next */ []));
125
+ stop = this.router.subscribe(() => this.location.set(this.router.getLocation()));
126
+ guard = new SlotGuard(inject(Renderer2));
127
+ /** Stops listening to the router when the component goes away. */
128
+ ngOnDestroy() {
129
+ this.stop();
130
+ }
131
+ /**
132
+ * The current class map.
133
+ * @returns The UIClassMap.
134
+ */
135
+ cm() {
136
+ return getClassMap();
137
+ }
138
+ /**
139
+ * Computes the wrapper class list.
140
+ * @returns The class string.
141
+ */
142
+ classes() {
143
+ return this.cm().cn(this.cm().pageShell, this.cm().page, this.className);
144
+ }
145
+ /**
146
+ * Computes the sidebar's class list.
147
+ * @returns The class string.
148
+ */
149
+ asideClasses() {
150
+ const cm = this.cm();
151
+ return cm.cn(cm.sp('p', 4), cm.shrink0, cm.flex({ direction: 'col' }), cm.surface, cm.borderR);
152
+ }
153
+ /**
154
+ * The inline sidebar width, in pixels.
155
+ * @returns The width in pixels.
156
+ */
157
+ widthPx() {
158
+ return resolveSidebarWidthPx(this.sidebarWidth, this.sidebarWidthClass);
159
+ }
160
+ /**
161
+ * Computes the brand link class list.
162
+ * @returns The class string.
163
+ */
164
+ brandClasses() {
165
+ const cm = this.cm();
166
+ return cm.cn(cm.textSize('xl'), cm.fontWeight('bold'), cm.sp('mb', 6), cm.displayBlock);
167
+ }
168
+ /**
169
+ * Computes the nav class list.
170
+ * @returns The class string.
171
+ */
172
+ navClasses() {
173
+ return this.cm().cn(this.cm().flex1, this.cm().stack(1));
174
+ }
175
+ /**
176
+ * The nav region's accessible name: an explicit `navAriaLabel` wins,
177
+ * otherwise the translated default (the inline English keeps the DOM
178
+ * identical until a locale bond supplies the key).
179
+ *
180
+ * @returns The aria-label.
181
+ */
182
+ navLabel() {
183
+ return (this.navAriaLabel ??
184
+ this.i18n.t('sidebarLayout.aria.primaryNavigation', undefined, {
185
+ defaultValue: 'Primary navigation',
186
+ }));
187
+ }
188
+ /**
189
+ * The brand link destination (React's default parameter).
190
+ * @returns The link target.
191
+ */
192
+ logoPath() {
193
+ return this.samePathTarget(this.logoTo ?? '/');
194
+ }
195
+ /**
196
+ * One nav item's link destination.
197
+ * @param item - The nav item.
198
+ * @returns The link target.
199
+ */
200
+ itemPath(item) {
201
+ return this.samePathTarget(item.to);
202
+ }
203
+ /**
204
+ * Computes the icon span class list.
205
+ * @returns The class string.
206
+ */
207
+ iconClasses() {
208
+ return this.cm().cn(this.cm().iconGlyphFont);
209
+ }
210
+ /**
211
+ * Computes the bottom-slot container class list.
212
+ * @returns The class string.
213
+ */
214
+ bottomClasses() {
215
+ const cm = this.cm();
216
+ return cm.cn(cm.sp('pt', 4), cm.flex({ align: 'center', justify: 'between', gap: 'sm' }), cm.borderT);
217
+ }
218
+ /**
219
+ * Computes the main content area class list.
220
+ * @returns The class string.
221
+ */
222
+ mainClasses() {
223
+ return this.cm().cn(this.cm().pageShellContent);
224
+ }
225
+ /**
226
+ * The key of the nav item whose `to` is the longest prefix-match of the
227
+ * current pathname.
228
+ *
229
+ * @returns The active item's key, or null when nothing matches.
230
+ */
231
+ activeKey() {
232
+ const pathname = this.location().pathname;
233
+ return this.navItems.reduce((bestKey, item) => {
234
+ const isMatch = pathname === item.to || pathname.startsWith(`${item.to}/`);
235
+ if (!isMatch)
236
+ return bestKey;
237
+ if (bestKey === null)
238
+ return item.key;
239
+ const best = this.navItems.find((i) => i.key === bestKey);
240
+ return best && item.to.length > best.to.length ? item.key : bestKey;
241
+ }, null);
242
+ }
243
+ /**
244
+ * Whether one nav item is the active one at the current location.
245
+ * @param item - The nav item.
246
+ * @returns True when the item renders in its active state.
247
+ */
248
+ isActive(item) {
249
+ return item.key === this.activeKey();
250
+ }
251
+ /**
252
+ * Computes the class list of one nav link: the shared nav-item treatment
253
+ * plus the active or idle variant.
254
+ * @param item - The nav item.
255
+ * @returns The class string.
256
+ */
257
+ itemClasses(item) {
258
+ const cm = this.cm();
259
+ return cm.cn(cm.flex({ align: 'center', gap: 'sm' }), cm.sp('px', 3), cm.sp('py', 2), cm.textSize('sm'), cm.fontWeight('medium'), cm.roundedFull, this.isActive(item)
260
+ ? cm.cn(cm.bgPrimaryContainer, cm.textOnPrimaryContainer)
261
+ : cm.cn(cm.textMuted, cm.link));
262
+ }
263
+ /**
264
+ * Appends `#top` when `to` is the current path, so a same-route click still
265
+ * produces an observable URL change. React passes the bare `#top` and
266
+ * react-router resolves it against the location (`/#top` on the home route);
267
+ * this binding's `Link` renders `to` verbatim, so the root case is spelled
268
+ * out here.
269
+ *
270
+ * @param to - The link's destination.
271
+ * @returns The link target.
272
+ */
273
+ samePathTarget(to) {
274
+ const pathname = this.location().pathname;
275
+ const samePath = pathname === to || pathname + '/' === to;
276
+ if (!samePath)
277
+ return to;
278
+ return `${to.replace(/\/$/, '') || '/'}#top`;
279
+ }
280
+ /**
281
+ * Reconciles the projected bottom slots against React's branch once the view
282
+ * queries resolve.
283
+ */
284
+ ngAfterViewInit() {
285
+ this.reconcile();
286
+ }
287
+ /**
288
+ * Re-reconciles on later passes, so a change to the projected content swaps
289
+ * the branch the way React does.
290
+ */
291
+ ngDoCheck() {
292
+ this.reconcile();
293
+ }
294
+ /** Re-reconciles after each view update. */
295
+ ngAfterViewChecked() {
296
+ this.reconcile();
297
+ }
298
+ /**
299
+ * Applies React's condition: the bottom container renders only when a slot
300
+ * exists, and the placeholder `<span>` renders only while the user menu is
301
+ * absent and the theme toggle is present.
302
+ */
303
+ reconcile() {
304
+ const user = this.userSlot?.nativeElement;
305
+ const theme = this.themeSlot?.nativeElement;
306
+ const hasUser = hasNodes(user);
307
+ const hasTheme = hasNodes(theme);
308
+ this.guard.toggle(this.bottom?.nativeElement, hasUser || hasTheme);
309
+ this.guard.toggle(this.placeholder?.nativeElement, !hasUser && hasTheme);
310
+ }
311
+ static ɵfac = function SidebarLayout_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || SidebarLayout)(); };
312
+ static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: SidebarLayout, selectors: [["div", "mol-sidebar-layout", ""]], viewQuery: function SidebarLayout_Query(rf, ctx) { if (rf & 1) {
313
+ i0.ɵɵviewQuery(_c0, 5)(_c1, 5)(_c2, 5)(_c3, 5);
314
+ } if (rf & 2) {
315
+ let _t;
316
+ i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.bottom = _t.first);
317
+ i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.placeholder = _t.first);
318
+ i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.userSlot = _t.first);
319
+ i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.themeSlot = _t.first);
320
+ } }, hostVars: 3, hostBindings: function SidebarLayout_HostBindings(rf, ctx) { if (rf & 2) {
321
+ i0.ɵɵattribute("data-mol-id", ctx.dataMolId ?? null);
322
+ i0.ɵɵclassMap(ctx.classes());
323
+ } }, inputs: { appName: "appName", logoTo: "logoTo", navItems: "navItems", navAriaLabel: "navAriaLabel", sidebarWidth: "sidebarWidth", sidebarWidthClass: "sidebarWidthClass", className: "className", dataMolId: "dataMolId" }, ngContentSelectors: _c5, decls: 18, vars: 17, consts: [["bottom", ""], ["placeholder", ""], ["userSlot", ""], ["themeSlot", ""], [3, "molLink"], [3, "molLink", "class"], ["aria-hidden", "true"], ["data-parity-unwrap", "", 2, "display", "contents"], ["aria-hidden", "true", 3, "class"]], template: function SidebarLayout_Template(rf, ctx) { if (rf & 1) {
324
+ i0.ɵɵprojectionDef(_c4);
325
+ i0.ɵɵelementStart(0, "aside")(1, "a", 4);
326
+ i0.ɵɵtext(2);
327
+ i0.ɵɵelementEnd();
328
+ i0.ɵɵelementStart(3, "nav");
329
+ i0.ɵɵrepeaterCreate(4, SidebarLayout_For_5_Template, 4, 7, "a", 5, _forTrack0);
330
+ i0.ɵɵelementEnd();
331
+ i0.ɵɵelementStart(6, "div", null, 0);
332
+ i0.ɵɵelement(8, "span", 6, 1);
333
+ i0.ɵɵelementStart(10, "span", 7, 2);
334
+ i0.ɵɵprojection(12);
335
+ i0.ɵɵelementEnd();
336
+ i0.ɵɵelementStart(13, "span", 7, 3);
337
+ i0.ɵɵprojection(15, 1);
338
+ i0.ɵɵelementEnd()()();
339
+ i0.ɵɵelementStart(16, "main");
340
+ i0.ɵɵprojection(17, 2);
341
+ i0.ɵɵelementEnd();
342
+ } if (rf & 2) {
343
+ i0.ɵɵclassMap(ctx.asideClasses());
344
+ i0.ɵɵstyleProp("width", ctx.widthPx(), "px");
345
+ i0.ɵɵadvance();
346
+ i0.ɵɵclassMap(ctx.brandClasses());
347
+ i0.ɵɵproperty("molLink", ctx.logoPath());
348
+ i0.ɵɵadvance();
349
+ i0.ɵɵtextInterpolate(ctx.appName);
350
+ i0.ɵɵadvance();
351
+ i0.ɵɵclassMap(ctx.navClasses());
352
+ i0.ɵɵattribute("aria-label", ctx.navLabel());
353
+ i0.ɵɵadvance();
354
+ i0.ɵɵrepeater(ctx.navItems);
355
+ i0.ɵɵadvance(2);
356
+ i0.ɵɵclassMap(ctx.bottomClasses());
357
+ i0.ɵɵadvance(10);
358
+ i0.ɵɵclassMap(ctx.mainClasses());
359
+ i0.ɵɵstyleProp("min-width", 0, "px");
360
+ } }, dependencies: [Link], encapsulation: 2 });
361
+ }
362
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(SidebarLayout, [{
363
+ type: Component,
364
+ args: [{
365
+ selector: 'div[mol-sidebar-layout]',
366
+ standalone: true,
367
+ imports: [Link],
368
+ inputs: [
369
+ 'appName',
370
+ 'logoTo',
371
+ 'navItems',
372
+ 'navAriaLabel',
373
+ 'sidebarWidth',
374
+ 'sidebarWidthClass',
375
+ 'className',
376
+ 'dataMolId',
377
+ ],
378
+ host: {
379
+ '[class]': 'classes()',
380
+ '[attr.data-mol-id]': 'dataMolId ?? null',
381
+ },
382
+ // prettier-ignore
383
+ template: `<aside [class]="asideClasses()" [style.width.px]="widthPx()"><a [molLink]="logoPath()" [class]="brandClasses()">{{ appName }}</a><nav [class]="navClasses()" [attr.aria-label]="navLabel()">@for (item of navItems; track item.key) {<a [molLink]="itemPath(item)" [attr.data-mol-id]="'nav-' + item.key" [attr.aria-current]="isActive(item) ? 'page' : null" [class]="itemClasses(item)">@if (item.icon) {<span [class]="iconClasses()" aria-hidden="true">{{ item.icon }}</span>}<span>{{ item.label }}</span></a>}</nav><div #bottom [class]="bottomClasses()"><span #placeholder aria-hidden="true"></span><span #userSlot data-parity-unwrap style="display: contents"><ng-content select="[slot=userMenu]"></ng-content></span><span #themeSlot data-parity-unwrap style="display: contents"><ng-content select="[slot=themeToggle]"></ng-content></span></div></aside><main [class]="mainClasses()" [style.min-width.px]="0"><ng-content></ng-content></main>`,
384
+ }]
385
+ }], null, { bottom: [{
386
+ type: ViewChild,
387
+ args: ['bottom']
388
+ }], placeholder: [{
389
+ type: ViewChild,
390
+ args: ['placeholder']
391
+ }], userSlot: [{
392
+ type: ViewChild,
393
+ args: ['userSlot']
394
+ }], themeSlot: [{
395
+ type: ViewChild,
396
+ args: ['themeSlot']
397
+ }] }); })();
398
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(SidebarLayout, { className: "SidebarLayout", filePath: "sidebar-layout.component.ts", lineNumber: 92 }); })();
399
+ //# sourceMappingURL=sidebar-layout.component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sidebar-layout.component.js","sourceRoot":"","sources":["../src/sidebar-layout.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAGL,SAAS,EAGT,MAAM,EAEN,SAAS,EACT,MAAM,EACN,SAAS,GACV,MAAM,eAAe,CAAA;AAEtB,OAAO,EAAE,IAAI,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAE/E,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE9C,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;;;;;;;;;;IAkEsW,+BAAiD;IAAA,YAAe;IAAA,iBAAO;;;;IAAjE,mCAAuB;IAAoB,cAAe;IAAf,kCAAe;;;IAAvO,4BAAsJ;IAAA,sFAAiB;IAAwE,4BAAM;IAAA,YAAgB;IAAO,AAAP,iBAAO,EAAI;;;;IAAtJ,0CAA2B;IAAlJ,kDAA0B;;IAAyH,cAAyF;IAAzF,uCAAyF;IAAM,eAAgB;IAAhB,mCAAgB;;AA/Dvf,uDAAuD;AACvD,MAAM,gBAAgB,GAAuC;IAC3D,EAAE,EAAE,GAAG;IACP,EAAE,EAAE,GAAG;IACP,EAAE,EAAE,GAAG;CACR,CAAA;AAED;;;;;;;;;GASG;AACH,MAAM,qBAAqB,GAAG,CAAC,KAAuB,EAAE,gBAAyB,EAAU,EAAE;IAC3F,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAA;IAC3C,IAAI,KAAK,KAAK,I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**
2
+ * DOM helpers for the projected capture points of {@link SidebarLayout}.
3
+ *
4
+ * React renders the bottom slot container only when a slot exists, and renders
5
+ * a bare placeholder `<span>` while the user menu is absent but the theme
6
+ * toggle is present. Angular projection needs an always-mounted `<ng-content>`
7
+ * capture point, so the container lives in the template unconditionally and
8
+ * these helpers reconcile it against React's DOM: the capture points are marked
9
+ * `data-parity-unwrap` (the conformance snapshot expands them, so they look like
10
+ * React's bare slot) and the container / placeholder are detached when React
11
+ * would not render them, re-attached from where they were removed.
12
+ *
13
+ * @module
14
+ */
15
+ import type { Renderer2 } from '@angular/core';
16
+ /**
17
+ * Whether an ng-content wrapper captured any element or text node.
18
+ *
19
+ * @param el - The wrapper element.
20
+ * @returns True when at least one projected node exists.
21
+ */
22
+ export declare const hasNodes: (el: Element | undefined | null) => boolean;
23
+ /**
24
+ * Attaches or detaches one template element against what React renders,
25
+ * remembering the parent it came from so it returns to the same place (the
26
+ * slot container's parent is the `<aside>`, not the component host).
27
+ */
28
+ export declare class SlotGuard {
29
+ private readonly renderer;
30
+ private readonly parents;
31
+ private readonly anchors;
32
+ /**
33
+ * Creates the guard.
34
+ *
35
+ * @param renderer - The DOM renderer.
36
+ */
37
+ constructor(renderer: Renderer2);
38
+ /**
39
+ * Attaches or detaches the element (contents move with it).
40
+ *
41
+ * @param el - The element to reconcile.
42
+ * @param shouldAttach - Whether it should be in the DOM.
43
+ */
44
+ toggle(el: Element | undefined | null, shouldAttach: boolean): void;
45
+ }
46
+ //# sourceMappingURL=slot-dom.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slot-dom.d.ts","sourceRoot":"","sources":["../src/slot-dom.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAE9C;;;;;GAKG;AACH,eAAO,MAAM,QAAQ,GAAI,IAAI,OAAO,GAAG,SAAS,GAAG,IAAI,KAAG,OAOzD,CAAA;AAED;;;;GAIG;AACH,qBAAa,SAAS;IASR,OAAO,CAAC,QAAQ,CAAC,QAAQ;IARrC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA2B;IACnD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA8B;IAEtD;;;;OAIG;gBAC0B,QAAQ,EAAE,SAAS;IAEhD;;;;;OAKG;IACH,MAAM,CAAC,EAAE,EAAE,OAAO,GAAG,SAAS,GAAG,IAAI,EAAE,YAAY,EAAE,OAAO,GAAG,IAAI;CAwBpE"}
@@ -0,0 +1,84 @@
1
+ /**
2
+ * DOM helpers for the projected capture points of {@link SidebarLayout}.
3
+ *
4
+ * React renders the bottom slot container only when a slot exists, and renders
5
+ * a bare placeholder `<span>` while the user menu is absent but the theme
6
+ * toggle is present. Angular projection needs an always-mounted `<ng-content>`
7
+ * capture point, so the container lives in the template unconditionally and
8
+ * these helpers reconcile it against React's DOM: the capture points are marked
9
+ * `data-parity-unwrap` (the conformance snapshot expands them, so they look like
10
+ * React's bare slot) and the container / placeholder are detached when React
11
+ * would not render them, re-attached from where they were removed.
12
+ *
13
+ * @module
14
+ */
15
+ /**
16
+ * Whether an ng-content wrapper captured any element or text node.
17
+ *
18
+ * @param el - The wrapper element.
19
+ * @returns True when at least one projected node exists.
20
+ */
21
+ export const hasNodes = (el) => {
22
+ if (!el)
23
+ return false;
24
+ for (const node of Array.from(el.childNodes)) {
25
+ if (node.nodeType === 1)
26
+ return true;
27
+ if (node.nodeType === 3 && (node.textContent ?? '').trim())
28
+ return true;
29
+ }
30
+ return false;
31
+ };
32
+ /**
33
+ * Attaches or detaches one template element against what React renders,
34
+ * remembering the parent it came from so it returns to the same place (the
35
+ * slot container's parent is the `<aside>`, not the component host).
36
+ */
37
+ export class SlotGuard {
38
+ renderer;
39
+ parents = new Map();
40
+ anchors = new Map();
41
+ /**
42
+ * Creates the guard.
43
+ *
44
+ * @param renderer - The DOM renderer.
45
+ */
46
+ constructor(renderer) {
47
+ this.renderer = renderer;
48
+ }
49
+ /**
50
+ * Attaches or detaches the element (contents move with it).
51
+ *
52
+ * @param el - The element to reconcile.
53
+ * @param shouldAttach - Whether it should be in the DOM.
54
+ */
55
+ toggle(el, shouldAttach) {
56
+ if (!el)
57
+ return;
58
+ if (shouldAttach) {
59
+ const parent = this.parents.get(el);
60
+ if (!parent || el.isConnected)
61
+ return;
62
+ const anchor = this.anchors.get(el);
63
+ if (anchor?.isConnected) {
64
+ parent.insertBefore(el, anchor);
65
+ this.renderer.removeChild(parent, anchor);
66
+ this.anchors.delete(el);
67
+ }
68
+ else {
69
+ parent.appendChild(el);
70
+ }
71
+ }
72
+ else if (el.isConnected && el.parentNode) {
73
+ const parent = el.parentNode;
74
+ this.parents.set(el, parent);
75
+ // A placeholder comment keeps the re-insertion position stable; the
76
+ // conformance normalizer strips comment nodes, so it never shows.
77
+ const anchor = this.renderer.createComment('slot');
78
+ parent.insertBefore(anchor, el);
79
+ this.anchors.set(el, anchor);
80
+ this.renderer.removeChild(parent, el);
81
+ }
82
+ }
83
+ }
84
+ //# sourceMappingURL=slot-dom.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slot-dom.js","sourceRoot":"","sources":["../src/slot-dom.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAIH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,EAA8B,EAAW,EAAE;IAClE,IAAI,CAAC,EAAE;QAAE,OAAO,KAAK,CAAA;IACrB,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC;QAC7C,IAAI,IAAI,CAAC,QAAQ,KAAK,CAAC;YAAE,OAAO,IAAI,CAAA;QACpC,IAAI,IAAI,CAAC,QAAQ,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE;YAAE,OAAO,IAAI,CAAA;IACzE,CAAC;IACD,OAAO,KAAK,CAAA;AAC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AM,EAAE,EAAE,CAAC,CAAA;YAC/B,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,EAAE,MAAM,CAAC,CAAA;YAC5B,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,MAAM,EAAE,EAAE,CAAC,CAAA;QACvC,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,73 @@
1
+ /**
2
+ * Types of `@molecule/app-sidebar-layout-angular` — the Angular counterpart of
3
+ * `@molecule/app-sidebar-layout-react`, same props and DOM.
4
+ *
5
+ * @module
6
+ */
7
+ /** Describes a single item in the sidebar's vertical navigation list. */
8
+ export interface SidebarNavItem {
9
+ /** Route path the link goes to. */
10
+ to: string;
11
+ /** Stable key — used for list tracking and i18n key suffix. */
12
+ key: string;
13
+ /** Material symbol icon name. */
14
+ icon?: string;
15
+ /** Visible label. Apps that route this through `t(...)` should pass the resolved string. */
16
+ label: string;
17
+ }
18
+ /**
19
+ * Semantic sidebar width. Mapped to a fixed pixel width internally and applied
20
+ * via inline style (a width is one of the "specific values" a styling-agnostic
21
+ * ClassMap cannot express as a swappable token) so the sidebar renders the same
22
+ * regardless of which ClassMap bond is active — no Tailwind width utility leaks
23
+ * into consumer code.
24
+ *
25
+ * - `sm` → 208px, `md` → 240px (default), `lg` → 256px.
26
+ * - Pass a raw `number` for an exact pixel width.
27
+ */
28
+ export type SidebarWidth = 'sm' | 'md' | 'lg' | number;
29
+ /**
30
+ * Props accepted by {@link SidebarLayout} — the same props
31
+ * `@molecule/app-sidebar-layout-react` accepts. Node props (`userMenu`,
32
+ * `themeToggle`, `children`) are projected content in Angular (an input cannot
33
+ * carry a node), so they are typed `unknown`: pass them in the host template,
34
+ * not as values.
35
+ */
36
+ export interface SidebarLayoutProps {
37
+ /** Brand text shown at the top of the sidebar (typically the app name). */
38
+ appName: string;
39
+ /** Path the brand link navigates to. Defaults to `'/'`. */
40
+ logoTo?: string;
41
+ /** Vertical nav items rendered in the sidebar. */
42
+ navItems: ReadonlyArray<SidebarNavItem>;
43
+ /** Bottom slot (typically a user menu), projected as `[slot=userMenu]` content. */
44
+ userMenu?: unknown;
45
+ /** Optional slot next to the user menu, projected as `[slot=themeToggle]` content. */
46
+ themeToggle?: unknown;
47
+ /**
48
+ * Aria-label for the primary `<nav>`. Overrides the translated default
49
+ * (`sidebarLayout.aria.primaryNavigation`, English `'Primary navigation'`);
50
+ * prop > `t()` > default.
51
+ */
52
+ navAriaLabel?: string;
53
+ /**
54
+ * Sidebar width — a stack-agnostic preset (`'sm'` | `'md'` | `'lg'`) or an
55
+ * exact pixel `number`. Applied via inline style. Defaults to `'md'` (240px).
56
+ */
57
+ sidebarWidth?: SidebarWidth;
58
+ /**
59
+ * Legacy sidebar-width prop retained only for backward compatibility: a
60
+ * `w-<n>` value is PARSED to a pixel width and applied via inline style
61
+ * (never re-emitted as a class). `sidebarWidth` takes precedence.
62
+ *
63
+ * @deprecated Use {@link SidebarLayoutProps.sidebarWidth} instead.
64
+ */
65
+ sidebarWidthClass?: string;
66
+ /** Extra classes on the outer wrapper. */
67
+ className?: string;
68
+ /** `data-mol-id` for AI-agent selectors. */
69
+ dataMolId?: string;
70
+ /** The routed page body, projected as the element's default content. */
71
+ children?: unknown;
72
+ }
73
+ //# 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,yEAAyE;AACzE,MAAM,WAAW,cAAc;IAC7B,mCAAmC;IACnC,EAAE,EAAE,MAAM,CAAA;IACV,+DAA+D;IAC/D,GAAG,EAAE,MAAM,CAAA;IACX,iCAAiC;IACjC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,4FAA4F;IAC5F,KAAK,EAAE,MAAM,CAAA;CACd;AAED;;;;;;;;;GASG;AACH,MAAM,MAAM,YAAY,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,MAAM,CAAA;AAEtD;;;;;;GAMG;AACH,MAAM,WAAW,kBAAkB;IACjC,2EAA2E;IAC3E,OAAO,EAAE,MAAM,CAAA;IACf,2DAA2D;IAC3D,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,kDAAkD;IAClD,QAAQ,EAAE,aAAa,CAAC,cAAc,CAAC,CAAA;IACvC,mFAAmF;IACnF,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,sFAAsF;IACtF,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB;;;OAGG;IACH,YAAY,CAAC,EAAE,YAAY,CAAA;IAC3B;;;;;;OAMG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,0CAA0C;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,4CAA4C;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,wEAAwE;IACxE,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB"}
package/dist/types.js ADDED
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Types of `@molecule/app-sidebar-layout-angular` — the Angular counterpart of
3
+ * `@molecule/app-sidebar-layout-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,72 @@
1
1
  {
2
2
  "name": "@molecule/app-sidebar-layout-angular",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.0.1-stage",
4
+ "description": "Vertical sidebar app shell: brand block + vertical NavLinks + user-menu slot, with a router outlet for nested routes",
5
+ "homepage": "https://www.molecule.dev/packages/app-sidebar-layout-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
+ "layout",
28
+ "sidebar",
29
+ "angular"
30
+ ],
31
+ "author": "Molecule Dev, Inc. (https://molecule.dev)",
32
+ "license": "Apache-2.0",
33
+ "repository": {
34
+ "type": "git",
35
+ "url": "https://github.com/molecule-dev/molecule.git",
36
+ "directory": "packages/app/features/sidebar-layout-angular"
37
+ },
38
+ "engines": {
39
+ "node": ">=20"
40
+ },
41
+ "bugs": "https://github.com/molecule-dev/molecule/issues",
42
+ "publishConfig": {
43
+ "access": "public"
44
+ },
45
+ "peerDependencies": {
46
+ "@angular/common": "^22.0.0",
47
+ "@angular/core": "^22.0.0",
48
+ "@angular/platform-browser": "^22.0.0",
49
+ "@molecule/app-angular": "^3.6.0",
50
+ "@molecule/app-ui": "^1.3.11",
51
+ "@molecule/app-ui-angular": "^1.1.0"
52
+ },
53
+ "devDependencies": {
54
+ "@angular/common": "22.2.3",
55
+ "@angular/compiler": "22.2.3",
56
+ "@angular/compiler-cli": "22.2.3",
57
+ "@angular/core": "22.2.3",
58
+ "@angular/platform-browser": "22.2.3",
59
+ "@molecule/app-angular": "3.7.2",
60
+ "@molecule/app-framework-conformance": "0.0.0",
61
+ "@molecule/app-i18n": "1.2.2",
62
+ "@molecule/app-icons": "1.0.4",
63
+ "@molecule/app-ui": "1.4.0",
64
+ "@molecule/app-ui-angular": "1.2.1",
65
+ "@types/node": "26.6.5",
66
+ "jsdom": "30.1.3",
67
+ "rxjs": "7.8.2",
68
+ "typescript": "6.0.3",
69
+ "vitest": "4.1.12",
70
+ "zone.js": "0.16.3"
71
+ }
72
+ }