@molecule/app-checklist-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,345 @@
1
- # Temporary Holding Version
1
+ <!--
2
+ AUTO-GENERATED — DO NOT EDIT THIS FILE.
3
+ Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
4
+ Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
5
+ To change this document, edit the module-level JSDoc in src/index.ts.
6
+ Generated: 2026-11-15T09:11:08.035Z
7
+ -->
2
8
 
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.
9
+ # @molecule/app-checklist-angular
10
+
11
+ Angular onboarding checklist with checkboxes and overall progress bar.
12
+
13
+ Exports `<Checklist>` and the `ChecklistItem` type. It is the Angular
14
+ counterpart of `@molecule/app-checklist-react`: the same props (React
15
+ names), the same DOM for the same input, and the same `onToggle` calls, so
16
+ an app switches framework by changing only the package name in its imports.
17
+
18
+ > **Auto-generated, AI-first package reference** for the [molecule.dev](https://molecule.dev) ecosystem.
19
+ > It is written to be read by coding agents as much as by people, and is generated from this
20
+ > package's source — edit `src/index.ts` JSDoc, not this file.
21
+
22
+ ## Quick Start
23
+
24
+ ```ts
25
+ import { Component, signal } from '@angular/core'
26
+ import { Checklist, type ChecklistItem } from '@molecule/app-checklist-angular'
27
+
28
+ @Component({
29
+ selector: 'app-onboarding',
30
+ standalone: true,
31
+ imports: [Checklist],
32
+ template: `
33
+ <div mol-checklist [items]="items()" [onToggle]="toggle" [title]="'Getting started'"></div>
34
+ `,
35
+ })
36
+ export class Onboarding {
37
+ readonly items = signal<ChecklistItem[]>([
38
+ { id: 'profile', label: 'Complete your profile', completed: true },
39
+ { id: 'invite', label: 'Invite a team member', completed: false },
40
+ { id: 'project', label: 'Create your first project', completed: false },
41
+ ])
42
+
43
+ readonly toggle = (id: string, next: boolean): void => {
44
+ this.items.update((items) =>
45
+ items.map((item) => (item.id === id ? { ...item, completed: next } : item)),
46
+ )
47
+ }
48
+ }
49
+ ```
50
+
51
+ ## Type
52
+
53
+ `feature`
54
+
55
+ ## Installation
56
+
57
+ ```bash
58
+ npm install @molecule/app-checklist-angular @angular/common @angular/core @angular/platform-browser @molecule/app-angular @molecule/app-ui @molecule/app-ui-angular
59
+ ```
60
+
61
+ ## API
62
+
63
+ ### Interfaces
64
+
65
+ #### `ChecklistItem`
66
+
67
+ A single item in the checklist, tracking its label, description, and
68
+ completion state. Node-valued `label`/`description` arrive as a template
69
+ (the conformance kit's data-prop node value), or as plain text.
70
+
71
+ ```typescript
72
+ interface ChecklistItem {
73
+ /** Stable identity, used as the list key and the checkbox `aria-label` fallback. */
74
+ id: string
75
+ /** Item label: text, or a template. */
76
+ label: string | TemplateRef<unknown>
77
+ /** Optional description / hint shown under the label: text, or a template. */
78
+ description?: string | TemplateRef<unknown>
79
+ /** Completion state. */
80
+ completed: boolean
81
+ /** When true, the item is rendered disabled and uncheckable. */
82
+ disabled?: boolean
83
+ }
84
+ ```
85
+
86
+ #### `ChecklistProps`
87
+
88
+ Props accepted by {@link Checklist} — the same props
89
+ `@molecule/app-checklist-react` accepts. The node-valued `title` is
90
+ projected in Angular (`[slot=title]`) as well as accepted as a text input.
91
+
92
+ ```typescript
93
+ interface ChecklistProps {
94
+ /** The checklist items, rendered in order. */
95
+ items: ChecklistItem[]
96
+ /** Called when an item is toggled, with its id and the checkbox's new state. */
97
+ onToggle: (id: string, next: boolean) => void
98
+ /** Show overall progress bar above the list. Defaults to true. */
99
+ showProgress?: boolean
100
+ /** Optional title above the checklist: text, or `[slot=title]` content. */
101
+ title?: unknown
102
+ /** Extra classes on the outer wrapper. */
103
+ className?: string
104
+ }
105
+ ```
106
+
107
+ ### Classes
108
+
109
+ #### `Checklist`
110
+
111
+ Checklist component.
112
+
113
+ Onboarding-style checklist with checkboxes, optional descriptions and an
114
+ overall progress bar derived from `items`. The host IS the root `<div>`
115
+ (`div[mol-checklist]`), matching React's root exactly. Same props (React
116
+ names), same DOM, same `onToggle(id, next)` calls as
117
+ `@molecule/app-checklist-react`'s `Checklist`. A node-valued `title` is
118
+ projected (`[slot=title]`); a string input renders as text. Node-valued
119
+ `label`/`description` on an item arrive as templates and render through
120
+ `NgTemplateOutlet`. The component is fully controlled: it never mutates
121
+ `completed`; persist the toggle in `onToggle(id, next)` and pass updated
122
+ `items` again.
123
+
124
+ ```typescript
125
+ @Component({
126
+ selector: 'div[mol-checklist]',
127
+ standalone: true,
128
+ imports: [Checkbox, NgTemplateOutlet],
129
+ inputs: ['items', 'onToggle', 'showProgress', 'title', 'className'],
130
+ host: {
131
+ '[class]': 'classes()',
132
+ },
133
+ // prettier-ignore
134
+ template: `@if (showTitle()) {<h3 #titleEl [class]="titleClasses()">@if (hasTextTitle()) {<ng-container>{{ title }}</ng-container>}@if (titleTemplate()) {<ng-container [ngTemplateOutlet]="titleTemplate()"></ng-container>}<ng-content select="[slot=title]"></ng-content></h3>}@if (showProgressEnabled()) {<div [class]="cm().stack(1)"><div [class]="cm().flex({ justify: 'between', align: 'center' })"><span [class]="cm().textSize('xs')">{{ progressText() }}</span><span [class]="cm().cn(cm().textSize('xs'), cm().fontWeight('semibold'))">{{ pct() }}%</span></div><div [class]="cm().cn(cm().progress(), cm().progressHeight('sm'))"><div [class]="cm().cn(cm().progressBar(), cm().progressColor('primary'))" [style.width]="pct() + '%'"></div></div></div>}<ul [class]="cm().stack(2)">@for (item of items; track item.id) {<li [class]="cm().flex({ align: 'start', gap: 'sm' })"><span [class]="cm().shrink0"><div mol-checkbox [checked]="item.completed" [disabled]="item.disabled" [attr.aria-label]="ariaLabel(item)" (change)="toggle(item, $event)"></div></span><div [class]="cm().cn(cm().flex1, cm().stack(0))"><span [class]="labelClasses(item)" [style.text-decoration]="item.completed ? 'line-through' : null" [style.opacity]="item.completed ? 0.6 : null">@if (isText(item.label)) {<ng-container>{{ item.label }}</ng-container>}@else {<ng-container [ngTemplateOutlet]="templateOf(item.label)"></ng-container>}</span>@if (item.description) {<span [class]="cm().textSize('xs')">@if (isText(item.description)) {<ng-container>{{ item.description }}</ng-container>}@else {<ng-container [ngTemplateOutlet]="templateOf(item.description)"></ng-container>}</span>}</div></li>}</ul>`,
135
+ })
136
+ export class Checklist implements AfterViewInit {
137
+ /** The checklist items, rendered in order. */
138
+ items: ChecklistItem[] = []
139
+ /** Called when an item is toggled, with its id and the checkbox's new state. */
140
+ onToggle?: (id: string, next: boolean) => void
141
+ /** Show the progress block (defaults to true at read time). */
142
+ showProgress?: boolean
143
+ /** Optional title: text, or projected `[slot=title]` content. */
144
+ title?: unknown
145
+ /** Extra classes on the outer wrapper. */
146
+ className?: string
147
+
148
+ /** The rendered `<h3>` (its content decides whether a title exists at all). */
149
+ @ViewChild('titleEl') private titleEl?: ElementRef<HTMLHeadingElement>
150
+
151
+ /** Whether a `[slot=title]` projection landed (true until the first view proves otherwise). */
152
+ private readonly titleProjected = signal(true)
153
+
154
+ /** i18n state; its `t` reads the provider on every call. */
155
+ private readonly i18n = useTranslation()
156
+
157
+ /**
158
+ * The current class map.
159
+ * @returns The UIClassMap.
160
+ */
161
+ cm(): UIClassMap {
162
+ return getClassMap()
163
+ }
164
+
165
+ /**
166
+ * Computes the root class list.
167
+ * @returns The class string.
168
+ */
169
+ classes(): string {
170
+ return this.cm().cn(this.cm().stack(3), this.className)
171
+ }
172
+
173
+ /**
174
+ * Computes the title's class list.
175
+ * @returns The class string.
176
+ */
177
+ titleClasses(): string {
178
+ return this.cm().cn(this.cm().textSize('base'), this.cm().fontWeight('semibold'))
179
+ }
180
+
181
+ /**
182
+ * Computes one item label's class list (React's weight switch).
183
+ * @param item - The checklist item.
184
+ * @returns The class string.
185
+ */
186
+ labelClasses(item: ChecklistItem): string {
187
+ return this.cm().cn(
188
+ this.cm().textSize('sm'),
189
+ item.completed ? this.cm().fontWeight('medium') : this.cm().fontWeight('semibold'),
190
+ )
191
+ }
192
+
193
+ /**
194
+ * The number of items.
195
+ * @returns The item count.
196
+ */
197
+ total(): number {
198
+ return this.items.length
199
+ }
200
+
201
+ /**
202
+ * The number of completed items.
203
+ * @returns The completed count.
204
+ */
205
+ done(): number {
206
+ return this.items.filter((item) => item.completed).length
207
+ }
208
+
209
+ /**
210
+ * The completion percentage (0 for an empty list).
211
+ * @returns The rounded percentage.
212
+ */
213
+ pct(): number {
214
+ return this.total() === 0 ? 0 : Math.round((this.done() / this.total()) * 100)
215
+ }
216
+
217
+ /**
218
+ * The translated progress summary.
219
+ * @returns The progress text.
220
+ */
221
+ progressText(): string {
222
+ return this.i18n.t(
223
+ 'checklist.progress',
224
+ { done: this.done(), total: this.total() },
225
+ { defaultValue: '{{done}} of {{total}} complete' },
226
+ )
227
+ }
228
+
229
+ /**
230
+ * React's `showProgress = true` default: only an explicit `false` hides it.
231
+ * @returns Whether the progress block renders.
232
+ */
233
+ showProgressEnabled(): boolean {
234
+ return this.showProgress !== false
235
+ }
236
+
237
+ /**
238
+ * Whether the title is a non-empty text input.
239
+ * @returns True when the title input renders as text.
240
+ */
241
+ hasTextTitle(): boolean {
242
+ return typeof this.title === 'string' && this.title !== ''
243
+ }
244
+
245
+ /**
246
+ * The title's template, when the title arrives as a node value.
247
+ * @returns The template, or null.
248
+ */
249
+ titleTemplate(): TemplateRef<unknown> | null {
250
+ return this.templateOf(this.title)
251
+ }
252
+
253
+ /**
254
+ * Whether the `<h3>` renders: React's `title &&` on the text input, a title
255
+ * template, or projected `[slot=title]` content (withdrawn at view init when
256
+ * none of the three is present).
257
+ * @returns True when the title shows.
258
+ */
259
+ showTitle(): boolean {
260
+ return this.hasTextTitle() || this.titleTemplate() !== null || this.titleProjected()
261
+ }
262
+
263
+ /**
264
+ * Reads the rendered `<h3>` once: when neither a title input nor projected
265
+ * content landed, React would not render the element at all, so the
266
+ * optimistic render is withdrawn.
267
+ */
268
+ ngAfterViewInit(): void {
269
+ const el = this.titleEl?.nativeElement
270
+ if (el && !this.hasTextTitle() && this.titleTemplate() === null && !hasRenderableContent(el)) {
271
+ this.titleProjected.set(false)
272
+ }
273
+ }
274
+
275
+ /**
276
+ * Whether a value is plain text (React renders it as text, not as nodes).
277
+ * @param value - A label, description or title.
278
+ * @returns True when the value is a string.
279
+ */
280
+ isText(value: unknown): value is string {
281
+ return typeof value === 'string'
282
+ }
283
+
284
+ /**
285
+ * Narrows a value to an embedded template.
286
+ * @param value - A label, description or title.
287
+ * @returns The template, or null.
288
+ */
289
+ templateOf(value: unknown): TemplateRef<unknown> | null {
290
+ return value instanceof TemplateRef ? value : null
291
+ }
292
+
293
+ /**
294
+ * React's `aria-label`: the label text when it is a plain string, else the item id.
295
+ * @param item - The checklist item.
296
+ * @returns The accessible name.
297
+ */
298
+ ariaLabel(item: ChecklistItem): string {
299
+ return typeof item.label === 'string' ? item.label : item.id
300
+ }
301
+
302
+ /**
303
+ * React's controlled-checkbox `onChange`: report the input's new state.
304
+ * @param item - The toggled item.
305
+ * @param event - The click event React's checkbox change fires with.
306
+ */
307
+ toggle(item: ChecklistItem, event: Event): void {
308
+ const target = event.target as HTMLInputElement
309
+ this.onToggle?.(item.id, target.checked)
310
+ }
311
+ }
312
+ ```
313
+
314
+ ## Injection Notes
315
+
316
+ ### Requirements
317
+
318
+ Peer dependencies:
319
+
320
+ - `@angular/common` ^22.0.0
321
+ - `@angular/core` ^22.0.0
322
+ - `@angular/platform-browser` ^22.0.0
323
+ - `@molecule/app-angular` ^3.5.0
324
+ - `@molecule/app-ui` ^1.0.1
325
+ - `@molecule/app-ui-angular` ^1.1.0
326
+
327
+ ### Runtime Dependencies
328
+
329
+ - `@angular/common`
330
+ - `@angular/core`
331
+ - `@angular/platform-browser`
332
+ - `@molecule/app-angular`
333
+ - `@molecule/app-ui`
334
+ - `@molecule/app-ui-angular`
335
+
336
+ The progress line uses the i18n key `checklist.progress` (`{{done}}`,
337
+ `{{total}}`), translated by the `@molecule/app-locales-checklist` companion
338
+ bond. `label`/`description`/`title` are consumer-provided nodes — pass
339
+ translated strings via `t()`. The component is fully controlled: it never
340
+ mutates `completed`; persist the toggle in `onToggle(id, next)` and pass
341
+ updated `items` again.
342
+
343
+ ## Translations
344
+
345
+ Translation strings are provided by `@molecule/app-locales-checklist`.
@@ -0,0 +1,132 @@
1
+ import { type AfterViewInit, TemplateRef } from '@angular/core';
2
+ import type { UIClassMap } from '@molecule/app-ui';
3
+ import type { ChecklistItem } from './types.js';
4
+ import * as i0 from "@angular/core";
5
+ /**
6
+ * Checklist component.
7
+ *
8
+ * Onboarding-style checklist with checkboxes, optional descriptions and an
9
+ * overall progress bar derived from `items`. The host IS the root `<div>`
10
+ * (`div[mol-checklist]`), matching React's root exactly. Same props (React
11
+ * names), same DOM, same `onToggle(id, next)` calls as
12
+ * `@molecule/app-checklist-react`'s `Checklist`. A node-valued `title` is
13
+ * projected (`[slot=title]`); a string input renders as text. Node-valued
14
+ * `label`/`description` on an item arrive as templates and render through
15
+ * `NgTemplateOutlet`. The component is fully controlled: it never mutates
16
+ * `completed`; persist the toggle in `onToggle(id, next)` and pass updated
17
+ * `items` again.
18
+ */
19
+ export declare class Checklist implements AfterViewInit {
20
+ /** The checklist items, rendered in order. */
21
+ items: ChecklistItem[];
22
+ /** Called when an item is toggled, with its id and the checkbox's new state. */
23
+ onToggle?: (id: string, next: boolean) => void;
24
+ /** Show the progress block (defaults to true at read time). */
25
+ showProgress?: boolean;
26
+ /** Optional title: text, or projected `[slot=title]` content. */
27
+ title?: unknown;
28
+ /** Extra classes on the outer wrapper. */
29
+ className?: string;
30
+ /** The rendered `<h3>` (its content decides whether a title exists at all). */
31
+ private titleEl?;
32
+ /** Whether a `[slot=title]` projection landed (true until the first view proves otherwise). */
33
+ private readonly titleProjected;
34
+ /** i18n state; its `t` reads the provider on every call. */
35
+ private readonly i18n;
36
+ /**
37
+ * The current class map.
38
+ * @returns The UIClassMap.
39
+ */
40
+ cm(): UIClassMap;
41
+ /**
42
+ * Computes the root class list.
43
+ * @returns The class string.
44
+ */
45
+ classes(): string;
46
+ /**
47
+ * Computes the title's class list.
48
+ * @returns The class string.
49
+ */
50
+ titleClasses(): string;
51
+ /**
52
+ * Computes one item label's class list (React's weight switch).
53
+ * @param item - The checklist item.
54
+ * @returns The class string.
55
+ */
56
+ labelClasses(item: ChecklistItem): string;
57
+ /**
58
+ * The number of items.
59
+ * @returns The item count.
60
+ */
61
+ total(): number;
62
+ /**
63
+ * The number of completed items.
64
+ * @returns The completed count.
65
+ */
66
+ done(): number;
67
+ /**
68
+ * The completion percentage (0 for an empty list).
69
+ * @returns The rounded percentage.
70
+ */
71
+ pct(): number;
72
+ /**
73
+ * The translated progress summary.
74
+ * @returns The progress text.
75
+ */
76
+ progressText(): string;
77
+ /**
78
+ * React's `showProgress = true` default: only an explicit `false` hides it.
79
+ * @returns Whether the progress block renders.
80
+ */
81
+ showProgressEnabled(): boolean;
82
+ /**
83
+ * Whether the title is a non-empty text input.
84
+ * @returns True when the title input renders as text.
85
+ */
86
+ hasTextTitle(): boolean;
87
+ /**
88
+ * The title's template, when the title arrives as a node value.
89
+ * @returns The template, or null.
90
+ */
91
+ titleTemplate(): TemplateRef<unknown> | null;
92
+ /**
93
+ * Whether the `<h3>` renders: React's `title &&` on the text input, a title
94
+ * template, or projected `[slot=title]` content (withdrawn at view init when
95
+ * none of the three is present).
96
+ * @returns True when the title shows.
97
+ */
98
+ showTitle(): boolean;
99
+ /**
100
+ * Reads the rendered `<h3>` once: when neither a title input nor projected
101
+ * content landed, React would not render the element at all, so the
102
+ * optimistic render is withdrawn.
103
+ */
104
+ ngAfterViewInit(): void;
105
+ /**
106
+ * Whether a value is plain text (React renders it as text, not as nodes).
107
+ * @param value - A label, description or title.
108
+ * @returns True when the value is a string.
109
+ */
110
+ isText(value: unknown): value is string;
111
+ /**
112
+ * Narrows a value to an embedded template.
113
+ * @param value - A label, description or title.
114
+ * @returns The template, or null.
115
+ */
116
+ templateOf(value: unknown): TemplateRef<unknown> | null;
117
+ /**
118
+ * React's `aria-label`: the label text when it is a plain string, else the item id.
119
+ * @param item - The checklist item.
120
+ * @returns The accessible name.
121
+ */
122
+ ariaLabel(item: ChecklistItem): string;
123
+ /**
124
+ * React's controlled-checkbox `onChange`: report the input's new state.
125
+ * @param item - The toggled item.
126
+ * @param event - The click event React's checkbox change fires with.
127
+ */
128
+ toggle(item: ChecklistItem, event: Event): void;
129
+ static ɵfac: i0.ɵɵFactoryDeclaration<Checklist, never>;
130
+ static ɵcmp: i0.ɵɵComponentDeclaration<Checklist, "div[mol-checklist]", never, { "items": { "alias": "items"; "required": false; }; "onToggle": { "alias": "onToggle"; "required": false; }; "showProgress": { "alias": "showProgress"; "required": false; }; "title": { "alias": "title"; "required": false; }; "className": { "alias": "className"; "required": false; }; }, {}, never, ["[slot=title]"], true, never>;
131
+ }
132
+ //# sourceMappingURL=checklist.component.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checklist.component.d.ts","sourceRoot":"","sources":["../src/checklist.component.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,KAAK,aAAa,EAIlB,WAAW,EAEZ,MAAM,eAAe,CAAA;AAGtB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAIlD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;;AAgB/C;;;;;;;;;;;;;GAaG;AACH,qBAWa,SAAU,YAAW,aAAa;IAC7C,8CAA8C;IAC9C,KAAK,EAAE,aAAa,EAAE,CAAK;IAC3B,gFAAgF;IAChF,QAAQ,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IAC9C,+DAA+D;IAC/D,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,iEAAiE;IACjE,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,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common';
7
+ import { Component, signal, TemplateRef, ViewChild, } from '@angular/core';
8
+ import { useTranslation } from '@molecule/app-angular';
9
+ import { getClassMap } from '@molecule/app-ui';
10
+ import { Checkbox } from '@molecule/app-ui-angular';
11
+ import * as i0 from "@angular/core";
12
+ const _c0 = ["titleEl"];
13
+ const _c1 = [[["", "slot", "title"]]];
14
+ const _c2 = ["[slot=title]"];
15
+ const _c3 = () => ({ justify: "between", align: "center" });
16
+ const _c4 = () => ({ align: "start", gap: "sm" });
17
+ const _forTrack0 = ($index, $item) => $item.id;
18
+ function Checklist_Conditional_0_Conditional_2_Template(rf, ctx) { if (rf & 1) {
19
+ i0.ɵɵelementContainerStart(0);
20
+ i0.ɵɵtext(1);
21
+ i0.ɵɵelementContainerEnd();
22
+ } if (rf & 2) {
23
+ const ctx_r0 = i0.ɵɵnextContext(2);
24
+ i0.ɵɵadvance();
25
+ i0.ɵɵtextInterpolate(ctx_r0.title);
26
+ } }
27
+ function Checklist_Conditional_0_Conditional_3_Template(rf, ctx) { if (rf & 1) {
28
+ i0.ɵɵelementContainer(0, 2);
29
+ } if (rf & 2) {
30
+ const ctx_r0 = i0.ɵɵnextContext(2);
31
+ i0.ɵɵproperty("ngTemplateOutlet", ctx_r0.titleTemplate());
32
+ } }
33
+ function Checklist_Conditional_0_Template(rf, ctx) { if (rf & 1) {
34
+ i0.ɵɵelementStart(0, "h3", null, 0);
35
+ i0.ɵɵconditionalCreate(2, Checklist_Conditional_0_Conditional_2_Template, 2, 1, "ng-container");
36
+ i0.ɵɵconditionalCreate(3, Checklist_Conditional_0_Conditional_3_Template, 1, 1, "ng-container", 2);
37
+ i0.ɵɵprojection(4);
38
+ i0.ɵɵelementEnd();
39
+ } if (rf & 2) {
40
+ const ctx_r0 = i0.ɵɵnextContext();
41
+ i0.ɵɵclassMap(ctx_r0.titleClasses());
42
+ i0.ɵɵadvance(2);
43
+ i0.ɵɵconditional(ctx_r0.hasTextTitle() ? 2 : -1);
44
+ i0.ɵɵadvance();
45
+ i0.ɵɵconditional(ctx_r0.titleTemplate() ? 3 : -1);
46
+ } }
47
+ function Checklist_Conditional_1_Template(rf, ctx) { if (rf & 1) {
48
+ i0.ɵɵelementStart(0, "div")(1, "div")(2, "span");
49
+ i0.ɵɵtext(3);
50
+ i0.ɵɵelementEnd();
51
+ i0.ɵɵelementStart(4, "span");
52
+ i0.ɵɵtext(5);
53
+ i0.ɵɵelementEnd()();
54
+ i0.ɵɵelementStart(6, "div");
55
+ i0.ɵɵelement(7, "div");
56
+ i0.ɵɵelementEnd()();
57
+ } if (rf & 2) {
58
+ const ctx_r0 = i0.ɵɵnextContext();
59
+ i0.ɵɵclassMap(ctx_r0.cm().stack(1));
60
+ i0.ɵɵadvance();
61
+ i0.ɵɵclassMap(ctx_r0.cm().flex(i0.ɵɵpureFunction0(16, _c3)));
62
+ i0.ɵɵadvance();
63
+ i0.ɵɵclassMap(ctx_r0.cm().textSize("xs"));
64
+ i0.ɵɵadvance();
65
+ i0.ɵɵtextInterpolate(ctx_r0.progressText());
66
+ i0.ɵɵadvance();
67
+ i0.ɵɵclassMap(ctx_r0.cm().cn(ctx_r0.cm().textSize("xs"), ctx_r0.cm().fontWeight("semibold")));
68
+ i0.ɵɵadvance();
69
+ i0.ɵɵtextInterpolate1("", ctx_r0.pct(), "%");
70
+ i0.ɵɵadvance();
71
+ i0.ɵɵclassMap(ctx_r0.cm().cn(ctx_r0.cm().progress(), ctx_r0.cm().progressHeight("sm")));
72
+ i0.ɵɵadvance();
73
+ i0.ɵɵclassMap(ctx_r0.cm().cn(ctx_r0.cm().progressBar(), ctx_r0.cm().progressColor("primary")));
74
+ i0.ɵɵstyleProp("width", ctx_r0.pct() + "%");
75
+ } }
76
+ function Checklist_For_4_Conditional_5_Template(rf, ctx) { if (rf & 1) {
77
+ i0.ɵɵelementContainerStart(0);
78
+ i0.ɵɵtext(1);
79
+ i0.ɵɵelementContainerEnd();
80
+ } if (rf & 2) {
81
+ const item_r3 = i0.ɵɵnextContext().$implicit;
82
+ i0.ɵɵadvance();
83
+ i0.ɵɵtextInterpolate(item_r3.label);
84
+ } }
85
+ function Checklist_For_4_Conditional_6_Template(rf, ctx) { if (rf & 1) {
86
+ i0.ɵɵelementContainer(0, 2);
87
+ } if (rf & 2) {
88
+ const item_r3 = i0.ɵɵnextContext().$implicit;
89
+ const ctx_r0 = i0.ɵɵnextContext();
90
+ i0.ɵɵproperty("ngTemplateOutlet", ctx_r0.templateOf(item_r3.label));
91
+ } }
92
+ function Checklist_For_4_Conditional_7_Conditional_1_Template(rf, ctx) { if (rf & 1) {
93
+ i0.ɵɵelementContainerStart(0);
94
+ i0.ɵɵtext(1);
95
+ i0.ɵɵelementContainerEnd();
96
+ } if (rf & 2) {
97
+ const item_r3 = i0.ɵɵnextContext(2).$implicit;
98
+ i0.ɵɵadvance();
99
+ i0.ɵɵtextInterpolate(item_r3.description);
100
+ } }
101
+ function Checklist_For_4_Conditional_7_Conditional_2_Template(rf, ctx) { if (rf & 1) {
102
+ i0.ɵɵelementContainer(0, 2);
103
+ } if (rf & 2) {
104
+ const item_r3 = i0.ɵɵnextContext(2).$implicit;
105
+ const ctx_r0 = i0.ɵɵnextContext();
106
+ i0.ɵɵproperty("ngTemplateOutlet", ctx_r0.templateOf(item_r3.description));
107
+ } }
108
+ function Checklist_For_4_Conditional_7_Template(rf, ctx) { if (rf & 1) {
109
+ i0.ɵɵelementStart(0, "span");
110
+ i0.ɵɵconditionalCreate(1, Checklist_For_4_Conditional_7_Conditional_1_Template, 2, 1, "ng-container")(2, Checklist_For_4_Conditional_7_Conditional_2_Template, 1, 1, "ng-container", 2);
111
+ i0.ɵɵelementEnd();
112
+ } if (rf & 2) {
113
+ const item_r3 = i0.ɵɵnextContext().$implicit;
114
+ const ctx_r0 = i0.ɵɵnextContext();
115
+ i0.ɵɵclassMap(ctx_r0.cm().textSize("xs"));
116
+ i0.ɵɵadvance();
117
+ i0.ɵɵconditional(ctx_r0.isText(item_r3.description) ? 1 : 2);
118
+ } }
119
+ function Checklist_For_4_Template(rf, ctx) { if (rf & 1) {
120
+ const _r2 = i0.ɵɵgetCurrentView();
121
+ i0.ɵɵelementStart(0, "li")(1, "span")(2, "div", 3);
122
+ i0.ɵɵlistener("change", function Checklist_For_4_Template_div_change_2_listener($event) { const item_r3 = i0.ɵɵrestoreView(_r2).$implicit; const ctx_r0 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r0.toggle(item_r3, $event)); });
123
+ i0.ɵɵelementEnd()();
124
+ i0.ɵɵelementStart(3, "div")(4, "span");
125
+ i0.ɵɵconditionalCreate(5, Checklist_For_4_Conditional_5_Template, 2, 1, "ng-container")(6, Checklist_For_4_Conditional_6_Template, 1, 1, "ng-container", 2);
126
+ i0.ɵɵelementEnd();
127
+ i0.ɵɵconditionalCreate(7, Checklist_For_4_Conditional_7_Template, 3, 3, "span", 1);
128
+ i0.ɵɵelementEnd()();
129
+ } if (rf & 2) {
130
+ const item_r3 = ctx.$implicit;
131
+ const ctx_r0 = i0.ɵɵnextContext();
132
+ i0.ɵɵclassMap(ctx_r0.cm().flex(i0.ɵɵpureFunction0(17, _c4)));
133
+ i0.ɵɵadvance();
134
+ i0.ɵɵclassMap(ctx_r0.cm().shrink0);
135
+ i0.ɵɵadvance();
136
+ i0.ɵɵproperty("checked", item_r3.completed)("disabled", item_r3.disabled);
137
+ i0.ɵɵattribute("aria-label", ctx_r0.ariaLabel(item_r3));
138
+ i0.ɵɵadvance();
139
+ i0.ɵɵclassMap(ctx_r0.cm().cn(ctx_r0.cm().flex1, ctx_r0.cm().stack(0)));
140
+ i0.ɵɵadvance();
141
+ i0.ɵɵclassMap(ctx_r0.labelClasses(item_r3));
142
+ i0.ɵɵstyleProp("text-decoration", item_r3.completed ? "line-through" : null)("opacity", item_r3.completed ? 0.6 : null);
143
+ i0.ɵɵadvance();
144
+ i0.ɵɵconditional(ctx_r0.isText(item_r3.label) ? 5 : 6);
145
+ i0.ɵɵadvance(2);
146
+ i0.ɵɵconditional(item_r3.description ? 7 : -1);
147
+ } }
148
+ /**
149
+ * Whether a wrapper element renders anything besides its static content: an
150
+ * element child (a projected `[slot=title]` landed) or non-empty text.
151
+ *
152
+ * @param node - The wrapper element.
153
+ * @returns True when its children render anything.
154
+ */
155
+ const hasRenderableContent = (node) => Array.from(node.childNodes).some((child) => child.nodeType === Node.ELEMENT_NODE ||
156
+ (child.nodeType === Node.TEXT_NODE && (child.textContent ?? '').trim().length > 0));
157
+ /**
158
+ * Checklist component.
159
+ *
160
+ * Onboarding-style checklist with checkboxes, optional descriptions and an
161
+ * overall progress bar derived from `items`. The host IS the root `<div>`
162
+ * (`div[mol-checklist]`), matching React's root exactly. Same props (React
163
+ * names), same DOM, same `onToggle(id, next)` calls as
164
+ * `@molecule/app-checklist-react`'s `Checklist`. A node-valued `title` is
165
+ * projected (`[slot=title]`); a string input renders as text. Node-valued
166
+ * `label`/`description` on an item arrive as templates and render through
167
+ * `NgTemplateOutlet`. The component is fully controlled: it never mutates
168
+ * `completed`; persist the toggle in `onToggle(id, next)` and pass updated
169
+ * `items` again.
170
+ */
171
+ export class Checklist {
172
+ /** The checklist items, rendered in order. */
173
+ items = [];
174
+ /** Called when an item is toggled, with its id and the checkbox's new state. */
175
+ onToggle;
176
+ /** Show the progress block (defaults to true at read time). */
177
+ showProgress;
178
+ /** Optional title: text, or projected `[slot=title]` content. */
179
+ title;
180
+ /** Extra classes on the outer wrapper. */
181
+ className;
182
+ /** The rendered `<h3>` (its content decides whether a title exists at all). */
183
+ titleEl;
184
+ /** Whether a `[slot=title]` projection landed (true until the first view proves otherwise). */
185
+ titleProjected = signal(true, /* @ts-ignore */
186
+ ...(ngDevMode ? [{ debugName: "titleProjected" }] : /* istanbul ignore next */ []));
187
+ /** i18n state; its `t` reads the provider on every call. */
188
+ i18n = useTranslation();
189
+ /**
190
+ * The current class map.
191
+ * @returns The UIClassMap.
192
+ */
193
+ cm() {
194
+ return getClassMap();
195
+ }
196
+ /**
197
+ * Computes the root class list.
198
+ * @returns The class string.
199
+ */
200
+ classes() {
201
+ return this.cm().cn(this.cm().stack(3), this.className);
202
+ }
203
+ /**
204
+ * Computes the title's class list.
205
+ * @returns The class string.
206
+ */
207
+ titleClasses() {
208
+ return this.cm().cn(this.cm().textSize('base'), this.cm().fontWeight('semibold'));
209
+ }
210
+ /**
211
+ * Computes one item label's class list (React's weight switch).
212
+ * @param item - The checklist item.
213
+ * @returns The class string.
214
+ */
215
+ labelClasses(item) {
216
+ return this.cm().cn(this.cm().textSize('sm'), item.completed ? this.cm().fontWeight('medium') : this.cm().fontWeight('semibold'));
217
+ }
218
+ /**
219
+ * The number of items.
220
+ * @returns The item count.
221
+ */
222
+ total() {
223
+ return this.items.length;
224
+ }
225
+ /**
226
+ * The number of completed items.
227
+ * @returns The completed count.
228
+ */
229
+ done() {
230
+ return this.items.filter((item) => item.completed).length;
231
+ }
232
+ /**
233
+ * The completion percentage (0 for an empty list).
234
+ * @returns The rounded percentage.
235
+ */
236
+ pct() {
237
+ return this.total() === 0 ? 0 : Math.round((this.done() / this.total()) * 100);
238
+ }
239
+ /**
240
+ * The translated progress summary.
241
+ * @returns The progress text.
242
+ */
243
+ progressText() {
244
+ return this.i18n.t('checklist.progress', { done: this.done(), total: this.total() }, { defaultValue: '{{done}} of {{total}} complete' });
245
+ }
246
+ /**
247
+ * React's `showProgress = true` default: only an explicit `false` hides it.
248
+ * @returns Whether the progress block renders.
249
+ */
250
+ showProgressEnabled() {
251
+ return this.showProgress !== false;
252
+ }
253
+ /**
254
+ * Whether the title is a non-empty text input.
255
+ * @returns True when the title input renders as text.
256
+ */
257
+ hasTextTitle() {
258
+ return typeof this.title === 'string' && this.title !== '';
259
+ }
260
+ /**
261
+ * The title's template, when the title arrives as a node value.
262
+ * @returns The template, or null.
263
+ */
264
+ titleTemplate() {
265
+ return this.templateOf(this.title);
266
+ }
267
+ /**
268
+ * Whether the `<h3>` renders: React's `title &&` on the text input, a title
269
+ * template, or projected `[slot=title]` content (withdrawn at view init when
270
+ * none of the three is present).
271
+ * @returns True when the title shows.
272
+ */
273
+ showTitle() {
274
+ return this.hasTextTitle() || this.titleTemplate() !== null || this.titleProjected();
275
+ }
276
+ /**
277
+ * Reads the rendered `<h3>` once: when neither a title input nor projected
278
+ * content landed, React would not render the element at all, so the
279
+ * optimistic render is withdrawn.
280
+ */
281
+ ngAfterViewInit() {
282
+ const el = this.titleEl?.nativeElement;
283
+ if (el && !this.hasTextTitle() && this.titleTemplate() === null && !hasRenderableContent(el)) {
284
+ this.titleProjected.set(false);
285
+ }
286
+ }
287
+ /**
288
+ * Whether a value is plain text (React renders it as text, not as nodes).
289
+ * @param value - A label, description or title.
290
+ * @returns True when the value is a string.
291
+ */
292
+ isText(value) {
293
+ return typeof value === 'string';
294
+ }
295
+ /**
296
+ * Narrows a value to an embedded template.
297
+ * @param value - A label, description or title.
298
+ * @returns The template, or null.
299
+ */
300
+ templateOf(value) {
301
+ return value instanceof TemplateRef ? value : null;
302
+ }
303
+ /**
304
+ * React's `aria-label`: the label text when it is a plain string, else the item id.
305
+ * @param item - The checklist item.
306
+ * @returns The accessible name.
307
+ */
308
+ ariaLabel(item) {
309
+ return typeof item.label === 'string' ? item.label : item.id;
310
+ }
311
+ /**
312
+ * React's controlled-checkbox `onChange`: report the input's new state.
313
+ * @param item - The toggled item.
314
+ * @param event - The click event React's checkbox change fires with.
315
+ */
316
+ toggle(item, event) {
317
+ const target = event.target;
318
+ this.onToggle?.(item.id, target.checked);
319
+ }
320
+ static ɵfac = function Checklist_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || Checklist)(); };
321
+ static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: Checklist, selectors: [["div", "mol-checklist", ""]], viewQuery: function Checklist_Query(rf, ctx) { if (rf & 1) {
322
+ i0.ɵɵviewQuery(_c0, 5);
323
+ } if (rf & 2) {
324
+ let _t;
325
+ i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.titleEl = _t.first);
326
+ } }, hostVars: 2, hostBindings: function Checklist_HostBindings(rf, ctx) { if (rf & 2) {
327
+ i0.ɵɵclassMap(ctx.classes());
328
+ } }, inputs: { items: "items", onToggle: "onToggle", showProgress: "showProgress", title: "title", className: "className" }, ngContentSelectors: _c2, decls: 5, vars: 4, consts: [["titleEl", ""], [3, "class"], [3, "ngTemplateOutlet"], ["mol-checkbox", "", 3, "change", "checked", "disabled"]], template: function Checklist_Template(rf, ctx) { if (rf & 1) {
329
+ i0.ɵɵprojectionDef(_c1);
330
+ i0.ɵɵconditionalCreate(0, Checklist_Conditional_0_Template, 5, 4, "h3", 1);
331
+ i0.ɵɵconditionalCreate(1, Checklist_Conditional_1_Template, 8, 17, "div", 1);
332
+ i0.ɵɵelementStart(2, "ul");
333
+ i0.ɵɵrepeaterCreate(3, Checklist_For_4_Template, 8, 18, "li", 1, _forTrack0);
334
+ i0.ɵɵelementEnd();
335
+ } if (rf & 2) {
336
+ i0.ɵɵconditional(ctx.showTitle() ? 0 : -1);
337
+ i0.ɵɵadvance();
338
+ i0.ɵɵconditional(ctx.showProgressEnabled() ? 1 : -1);
339
+ i0.ɵɵadvance();
340
+ i0.ɵɵclassMap(ctx.cm().stack(2));
341
+ i0.ɵɵadvance();
342
+ i0.ɵɵrepeater(ctx.items);
343
+ } }, dependencies: [Checkbox, NgTemplateOutlet], encapsulation: 2 });
344
+ }
345
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(Checklist, [{
346
+ type: Component,
347
+ args: [{
348
+ selector: 'div[mol-checklist]',
349
+ standalone: true,
350
+ imports: [Checkbox, NgTemplateOutlet],
351
+ inputs: ['items', 'onToggle', 'showProgress', 'title', 'className'],
352
+ host: {
353
+ '[class]': 'classes()',
354
+ },
355
+ // prettier-ignore
356
+ template: `@if (showTitle()) {<h3 #titleEl [class]="titleClasses()">@if (hasTextTitle()) {<ng-container>{{ title }}</ng-container>}@if (titleTemplate()) {<ng-container [ngTemplateOutlet]="titleTemplate()"></ng-container>}<ng-content select="[slot=title]"></ng-content></h3>}@if (showProgressEnabled()) {<div [class]="cm().stack(1)"><div [class]="cm().flex({ justify: 'between', align: 'center' })"><span [class]="cm().textSize('xs')">{{ progressText() }}</span><span [class]="cm().cn(cm().textSize('xs'), cm().fontWeight('semibold'))">{{ pct() }}%</span></div><div [class]="cm().cn(cm().progress(), cm().progressHeight('sm'))"><div [class]="cm().cn(cm().progressBar(), cm().progressColor('primary'))" [style.width]="pct() + '%'"></div></div></div>}<ul [class]="cm().stack(2)">@for (item of items; track item.id) {<li [class]="cm().flex({ align: 'start', gap: 'sm' })"><span [class]="cm().shrink0"><div mol-checkbox [checked]="item.completed" [disabled]="item.disabled" [attr.aria-label]="ariaLabel(item)" (change)="toggle(item, $event)"></div></span><div [class]="cm().cn(cm().flex1, cm().stack(0))"><span [class]="labelClasses(item)" [style.text-decoration]="item.completed ? 'line-through' : null" [style.opacity]="item.completed ? 0.6 : null">@if (isText(item.label)) {<ng-container>{{ item.label }}</ng-container>}@else {<ng-container [ngTemplateOutlet]="templateOf(item.label)"></ng-container>}</span>@if (item.description) {<span [class]="cm().textSize('xs')">@if (isText(item.description)) {<ng-container>{{ item.description }}</ng-container>}@else {<ng-container [ngTemplateOutlet]="templateOf(item.description)"></ng-container>}</span>}</div></li>}</ul>`,
357
+ }]
358
+ }], null, { titleEl: [{
359
+ type: ViewChild,
360
+ args: ['titleEl']
361
+ }] }); })();
362
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(Checklist, { className: "Checklist", filePath: "checklist.component.ts", lineNumber: 63 }); })();
363
+ //# sourceMappingURL=checklist.component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checklist.component.js","sourceRoot":"","sources":["../src/checklist.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAClD,OAAO,EAEL,SAAS,EAET,MAAM,EACN,WAAW,EACX,SAAS,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;OAIG;IACH,SAAS,CAAC,IAAmB;QAC3B,OAAO,OAAO,IAAI,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAA;IAC9D,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,IAAmB,EAAE,KAAY;QACtC,MAAM,MAAM,GAAG,KAAK,CAAC,MAA0B,CAAA;QAC/C,IAAI,CAAC,QAAQ,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,MAAM,CAAC,OAAO,CAAC,CAAA;IAC1C,CAAC;mGA9KU,SAAS;6DAAT,SAAS;;;;;;YAAT,cAAA,aAAS,CAAA;;;YAFT,0EAAmB;YAAoP,4EAA6B;YAA6b,0BAA4B;YAAA,4EAAi3B;YAAA,iBAAK;;YAAnnD,0CAAuQ;YAAA,cAA0d;YAA1d,oDAA0d;YAAI,cAAuB;YAAvB,gCAAuB;YAAC,cAAi3B;YAAj3B,wBAAi3B;4BAN/mD,QAAQ,EAAE,gBAAgB;;iFAQzB,SAAS;cAXrB,SAAS;eAAC;gBACT,QAAQ,EAAE,oBAAoB;gBAC9B,UAAU,EAAE,IAAI;gBAChB,OAAO,EAAE,CAAC,QAAQ,EAAE,gBAAgB,CAAC;gBACrC,MAAM,EAAE,CAAC,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,OAAO,EAAE,WAAW,CAAC;gBACnE,IAAI,EAAE;oBACJ,SAAS,EAAE,WAAW;iBACvB;gBACD,kBAAkB;gBAClB,QAAQ,EAAE,qnDAAqnD;aAChoD;;kBAcE,SAAS;mBAAC,SAAS;;kFAbT,SAAS"}
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Angular onboarding checklist with checkboxes and overall progress bar.
3
+ *
4
+ * Exports `<Checklist>` and the `ChecklistItem` type. It is the Angular
5
+ * counterpart of `@molecule/app-checklist-react`: the same props (React
6
+ * names), the same DOM for the same input, and the same `onToggle` calls, so
7
+ * an app switches framework by changing only the package name in its imports.
8
+ *
9
+ * @example
10
+ * ```ts
11
+ * import { Component, signal } from '@angular/core'
12
+ * import { Checklist, type ChecklistItem } from '@molecule/app-checklist-angular'
13
+ *
14
+ * @Component({
15
+ * selector: 'app-onboarding',
16
+ * standalone: true,
17
+ * imports: [Checklist],
18
+ * template: `
19
+ * <div
20
+ * mol-checklist
21
+ * [items]="items()"
22
+ * [onToggle]="toggle"
23
+ * [title]="'Getting started'"
24
+ * ></div>
25
+ * `,
26
+ * })
27
+ * export class Onboarding {
28
+ * readonly items = signal<ChecklistItem[]>([
29
+ * { id: 'profile', label: 'Complete your profile', completed: true },
30
+ * { id: 'invite', label: 'Invite a team member', completed: false },
31
+ * { id: 'project', label: 'Create your first project', completed: false },
32
+ * ])
33
+ *
34
+ * readonly toggle = (id: string, next: boolean): void => {
35
+ * this.items.update((items) =>
36
+ * items.map((item) => (item.id === id ? { ...item, completed: next } : item)),
37
+ * )
38
+ * }
39
+ * }
40
+ * ```
41
+ *
42
+ * @remarks
43
+ * The progress line uses the i18n key `checklist.progress` (`{{done}}`,
44
+ * `{{total}}`), translated by the `@molecule/app-locales-checklist` companion
45
+ * bond. `label`/`description`/`title` are consumer-provided nodes — pass
46
+ * translated strings via `t()`. The component is fully controlled: it never
47
+ * mutates `completed`; persist the toggle in `onToggle(id, next)` and pass
48
+ * updated `items` again.
49
+ *
50
+ * @module
51
+ */
52
+ export * from './checklist.component.js';
53
+ export * from './types.js';
54
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AAEH,cAAc,0BAA0B,CAAA;AACxC,cAAc,YAAY,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Angular onboarding checklist with checkboxes and overall progress bar.
3
+ *
4
+ * Exports `<Checklist>` and the `ChecklistItem` type. It is the Angular
5
+ * counterpart of `@molecule/app-checklist-react`: the same props (React
6
+ * names), the same DOM for the same input, and the same `onToggle` calls, so
7
+ * an app switches framework by changing only the package name in its imports.
8
+ *
9
+ * @example
10
+ * ```ts
11
+ * import { Component, signal } from '@angular/core'
12
+ * import { Checklist, type ChecklistItem } from '@molecule/app-checklist-angular'
13
+ *
14
+ * @Component({
15
+ * selector: 'app-onboarding',
16
+ * standalone: true,
17
+ * imports: [Checklist],
18
+ * template: `
19
+ * <div
20
+ * mol-checklist
21
+ * [items]="items()"
22
+ * [onToggle]="toggle"
23
+ * [title]="'Getting started'"
24
+ * ></div>
25
+ * `,
26
+ * })
27
+ * export class Onboarding {
28
+ * readonly items = signal<ChecklistItem[]>([
29
+ * { id: 'profile', label: 'Complete your profile', completed: true },
30
+ * { id: 'invite', label: 'Invite a team member', completed: false },
31
+ * { id: 'project', label: 'Create your first project', completed: false },
32
+ * ])
33
+ *
34
+ * readonly toggle = (id: string, next: boolean): void => {
35
+ * this.items.update((items) =>
36
+ * items.map((item) => (item.id === id ? { ...item, completed: next } : item)),
37
+ * )
38
+ * }
39
+ * }
40
+ * ```
41
+ *
42
+ * @remarks
43
+ * The progress line uses the i18n key `checklist.progress` (`{{done}}`,
44
+ * `{{total}}`), translated by the `@molecule/app-locales-checklist` companion
45
+ * bond. `label`/`description`/`title` are consumer-provided nodes — pass
46
+ * translated strings via `t()`. The component is fully controlled: it never
47
+ * mutates `completed`; persist the toggle in `onToggle(id, next)` and pass
48
+ * updated `items` again.
49
+ *
50
+ * @module
51
+ */
52
+ export * from './checklist.component.js';
53
+ export * from './types.js';
54
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AAEH,cAAc,0BAA0B,CAAA;AACxC,cAAc,YAAY,CAAA"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Types of `@molecule/app-checklist-angular` — the Angular counterpart of
3
+ * `@molecule/app-checklist-react`, same props and DOM.
4
+ *
5
+ * @module
6
+ */
7
+ import type { TemplateRef } from '@angular/core';
8
+ /**
9
+ * A single item in the checklist, tracking its label, description, and
10
+ * completion state. Node-valued `label`/`description` arrive as a template
11
+ * (the conformance kit's data-prop node value), or as plain text.
12
+ */
13
+ export interface ChecklistItem {
14
+ /** Stable identity, used as the list key and the checkbox `aria-label` fallback. */
15
+ id: string;
16
+ /** Item label: text, or a template. */
17
+ label: string | TemplateRef<unknown>;
18
+ /** Optional description / hint shown under the label: text, or a template. */
19
+ description?: string | TemplateRef<unknown>;
20
+ /** Completion state. */
21
+ completed: boolean;
22
+ /** When true, the item is rendered disabled and uncheckable. */
23
+ disabled?: boolean;
24
+ }
25
+ /**
26
+ * Props accepted by {@link Checklist} — the same props
27
+ * `@molecule/app-checklist-react` accepts. The node-valued `title` is
28
+ * projected in Angular (`[slot=title]`) as well as accepted as a text input.
29
+ */
30
+ export interface ChecklistProps {
31
+ /** The checklist items, rendered in order. */
32
+ items: ChecklistItem[];
33
+ /** Called when an item is toggled, with its id and the checkbox's new state. */
34
+ onToggle: (id: string, next: boolean) => void;
35
+ /** Show overall progress bar above the list. Defaults to true. */
36
+ showProgress?: boolean;
37
+ /** Optional title above the checklist: text, or `[slot=title]` content. */
38
+ title?: unknown;
39
+ /** Extra classes on the outer wrapper. */
40
+ className?: string;
41
+ }
42
+ //# 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,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAEhD;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC5B,oFAAoF;IACpF,EAAE,EAAE,MAAM,CAAA;IACV,uCAAuC;IACvC,KAAK,EAAE,MAAM,GAAG,WAAW,CAAC,OAAO,CAAC,CAAA;IACpC,8EAA8E;IAC9E,WAAW,CAAC,EAAE,MAAM,GAAG,WAAW,CAAC,OAAO,CAAC,CAAA;IAC3C,wBAAwB;IACxB,SAAS,EAAE,OAAO,CAAA;IAClB,gEAAgE;IAChE,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAED;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,8CAA8C;IAC9C,KAAK,EAAE,aAAa,EAAE,CAAA;IACtB,gFAAgF;IAChF,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IAC7C,kEAAkE;IAClE,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,2EAA2E;IAC3E,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,0CAA0C;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB"}
package/dist/types.js ADDED
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Types of `@molecule/app-checklist-angular` — the Angular counterpart of
3
+ * `@molecule/app-checklist-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-checklist-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": "Onboarding checklist with checkable items + progress bar",
5
+ "homepage": "https://www.molecule.dev/packages/app-checklist-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
+ "checklist",
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/checklist-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.6.0",
59
+ "@molecule/app-framework-conformance": "0.0.0",
60
+ "@molecule/app-i18n": "1.2.1",
61
+ "@molecule/app-icons": "1.0.4",
62
+ "@molecule/app-ui": "1.3.11",
63
+ "@molecule/app-ui-angular": "1.1.2",
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
+ }