@molecule/app-flashcard-card-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,361 @@
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:48.313Z
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-flashcard-card-angular
10
+
11
+ Angular flashcard study card — the counterpart of
12
+ `@molecule/app-flashcard-card-react`: the same props and the same DOM for
13
+ the same input.
14
+
15
+ Exports `<FlashcardCard>` — it shows the front (prompt), a "Show answer"
16
+ reveal button, then the back (answer) with four SM-2-compatible grade
17
+ buttons (Again / Hard / Good / Easy). The app owns the spaced-repetition
18
+ scheduling; the card only reports the grade.
19
+
20
+ > **Auto-generated, AI-first package reference** for the [molecule.dev](https://molecule.dev) ecosystem.
21
+ > It is written to be read by coding agents as much as by people, and is generated from this
22
+ > package's source — edit `src/index.ts` JSDoc, not this file.
23
+
24
+ ## Quick Start
25
+
26
+ ```ts
27
+ import { Component } from '@angular/core'
28
+ import { FlashcardCard } from '@molecule/app-flashcard-card-angular'
29
+
30
+ @Component({
31
+ selector: 'app-study',
32
+ standalone: true,
33
+ imports: [FlashcardCard],
34
+ template: `
35
+ <div mol-flashcard-card [progress]="'Card 3 of 20'" [onGrade]="onGrade">
36
+ <span slot="front">What is the capital of France?</span>
37
+ <span slot="back">Paris</span>
38
+ </div>
39
+ `,
40
+ })
41
+ export class StudyView {
42
+ onGrade(grade: string): void {
43
+ console.log(grade)
44
+ }
45
+ }
46
+ ```
47
+
48
+ ## Type
49
+
50
+ `feature`
51
+
52
+ ## Installation
53
+
54
+ ```bash
55
+ npm install @molecule/app-flashcard-card-angular @angular/common @angular/core @angular/platform-browser @molecule/app-angular @molecule/app-ui @molecule/app-ui-angular
56
+ ```
57
+
58
+ ## API
59
+
60
+ ### Interfaces
61
+
62
+ #### `FlashcardCardProps`
63
+
64
+ Props accepted by {@link FlashcardCard} — the same props
65
+ `@molecule/app-flashcard-card-react` accepts. Node props (`front`, `back`,
66
+ `progress`) are projected content in Angular (an input cannot carry a node),
67
+ so they are typed `unknown`: pass them as `[slot=front]` / `[slot=back]` /
68
+ `[slot=progress]` content, or as plain strings.
69
+
70
+ ```typescript
71
+ interface FlashcardCardProps {
72
+ /** Front content (prompt), projected as `[slot=front]` content or a string. */
73
+ front?: unknown
74
+ /** Back content (answer), projected as `[slot=back]` content or a string. */
75
+ back?: unknown
76
+ /** Optional progress / position, projected as `[slot=progress]` content or a string. */
77
+ progress?: unknown
78
+ /** Called when the user grades the card after revealing the answer. */
79
+ onGrade?: (grade: SrsGrade) => void
80
+ /** Initially show the answer. Read once, like React's `useState`. */
81
+ defaultRevealed?: boolean
82
+ /** Extra classes on the card. */
83
+ className?: string
84
+ }
85
+ ```
86
+
87
+ ### Types
88
+
89
+ #### `SrsGrade`
90
+
91
+ SM-2-compatible grade values the caller uses to schedule the next review.
92
+ Same union as React's `SrsGrade`.
93
+
94
+ ```typescript
95
+ type SrsGrade = 'again' | 'hard' | 'good' | 'easy'
96
+ ```
97
+
98
+ ### Classes
99
+
100
+ #### `FlashcardCard`
101
+
102
+ FlashcardCard component.
103
+
104
+ Flashcard study component — front face → reveal back → SM-2 style grade
105
+ buttons (Again / Hard / Good / Easy). The host IS React's root `<div>`
106
+ (`div[mol-flashcard-card]`), carrying the `Card` classes exactly as React's
107
+ `Card` does. `front` / `back` / `progress` are projected content
108
+ (`[slot=front]`, `[slot=back]`, `[slot=progress]`) or plain string inputs;
109
+ the button labels go through `useTranslation()` with React's exact keys and
110
+ English defaults. Grading flips the card back to its front face.
111
+
112
+ ```typescript
113
+ @Component({
114
+ selector: 'div[mol-flashcard-card]',
115
+ standalone: true,
116
+ imports: [Button],
117
+ inputs: ['front', 'back', 'progress', 'onGrade', 'defaultRevealed', 'className'],
118
+ host: {
119
+ '[class]': 'cardClasses()',
120
+ },
121
+ // prettier-ignore
122
+ template: `<div [class]="stackClasses()"><div #progressWrap [class]="progressClasses()">@if (hasProgress) {<ng-container>{{ progress }}</ng-container>}<ng-content select="[slot=progress]"></ng-content></div><div [class]="faceClasses()" #face>@if (revealed()) {@if (hasBack) {<ng-container>{{ back }}</ng-container>}<ng-content select="[slot=back]"></ng-content>} @else {@if (hasFront) {<ng-container>{{ front }}</ng-container>}<ng-content select="[slot=front]"></ng-content>}</div>@if (!revealed()) {<button mol-button [variant]="'solid'" [color]="'primary'" (click)="reveal()">{{ revealLabel() }}</button>} @else {<div [class]="gridClasses()"><button mol-button [variant]="'outline'" [color]="'error'" (click)="grade('again')">{{ againLabel() }}</button><button mol-button [variant]="'outline'" [color]="'warning'" (click)="grade('hard')">{{ hardLabel() }}</button><button mol-button [variant]="'outline'" [color]="'primary'" (click)="grade('good')">{{ goodLabel() }}</button><button mol-button [variant]="'outline'" [color]="'success'" (click)="grade('easy')">{{ easyLabel() }}</button></div>}</div>`,
123
+ })
124
+ export class FlashcardCard implements AfterViewInit, DoCheck {
125
+ /** Front content (prompt) — a string input, or `[slot=front]` projected content. */
126
+ front?: unknown
127
+ /** Back content (answer) — a string input, or `[slot=back]` projected content. */
128
+ back?: unknown
129
+ /** Optional progress / position — a string input, or `[slot=progress]` content. */
130
+ progress?: unknown
131
+ /** Called when the user grades the card after revealing the answer. */
132
+ onGrade?: (grade: SrsGrade) => void
133
+ /** Initially show the answer. Read once, like React's `useState`. */
134
+ defaultRevealed?: boolean
135
+ /** Extra classes on the card. */
136
+ className?: string
137
+
138
+ /** The progress wrapper (always in the template; detached when empty). */
139
+ @ViewChild('progressWrap') private progressWrap?: ElementRef<HTMLDivElement>
140
+ /** The face element the front/back content renders into. */
141
+ @ViewChild('face') private face?: ElementRef<HTMLDivElement>
142
+
143
+ /** The i18n provider above the card (the button labels). */
144
+ private readonly i18n = useTranslation()
145
+
146
+ /** Whether the answer face is showing. */
147
+ private readonly revealedState = signal(false)
148
+
149
+ /** Whether a `[slot=progress]` projection landed (an empty wrapper is removed). */
150
+ private progressProjected = false
151
+
152
+ /** Whether the view queries have been read (nothing is withdrawn before). */
153
+ private viewReady = false
154
+
155
+ /**
156
+ * The current class map.
157
+ * @returns The UIClassMap.
158
+ */
159
+ cm(): UIClassMap {
160
+ return getClassMap()
161
+ }
162
+
163
+ /**
164
+ * Computes the card class list — React's `Card` with the default
165
+ * `elevated` variant and `md` padding, plus `className`.
166
+ * @returns The class string.
167
+ */
168
+ cardClasses(): string {
169
+ const cm = this.cm()
170
+ return cm.cn(cm.card({ variant: 'elevated' }), cm.cardPadding('md'), this.className)
171
+ }
172
+
173
+ /**
174
+ * The outer stack class list.
175
+ * @returns The class string.
176
+ */
177
+ stackClasses(): string {
178
+ return this.cm().stack(4)
179
+ }
180
+
181
+ /**
182
+ * The progress row class list.
183
+ * @returns The class string.
184
+ */
185
+ progressClasses(): string {
186
+ const cm = this.cm()
187
+ return cm.cn(cm.textSize('xs'), cm.fontWeight('semibold'), cm.textCenter)
188
+ }
189
+
190
+ /**
191
+ * The face class list.
192
+ * @returns The class string.
193
+ */
194
+ faceClasses(): string {
195
+ const cm = this.cm()
196
+ return cm.cn(cm.sp('p', 6), cm.textCenter, cm.cn(cm.textSize('xl')))
197
+ }
198
+
199
+ /**
200
+ * The grade-button grid class list.
201
+ * @returns The class string.
202
+ */
203
+ gridClasses(): string {
204
+ return this.cm().grid({ cols: 4, gap: 'sm' })
205
+ }
206
+
207
+ /**
208
+ * Whether the answer face is showing.
209
+ * @returns True when revealed.
210
+ */
211
+ revealed(): boolean {
212
+ return this.revealedState()
213
+ }
214
+
215
+ /**
216
+ * Whether the front arrives as a text input (projected content otherwise).
217
+ * @returns True when `front` is a non-empty string.
218
+ */
219
+ get hasFront(): boolean {
220
+ return typeof this.front === 'string' && this.front.length > 0
221
+ }
222
+
223
+ /**
224
+ * Whether the back arrives as a text input (projected content otherwise).
225
+ * @returns True when `back` is a non-empty string.
226
+ */
227
+ get hasBack(): boolean {
228
+ return typeof this.back === 'string' && this.back.length > 0
229
+ }
230
+
231
+ /**
232
+ * Whether the progress row renders at all — React's `{progress && …}`.
233
+ * @returns True when a text or projected progress row exists.
234
+ */
235
+ get hasProgress(): boolean {
236
+ return (typeof this.progress === 'string' && this.progress.length > 0) || this.progressProjected
237
+ }
238
+
239
+ /**
240
+ * The reveal button's label.
241
+ * @returns The translated text.
242
+ */
243
+ revealLabel(): string {
244
+ return this.i18n.t('flashcard.reveal', {}, { defaultValue: 'Show answer' })
245
+ }
246
+
247
+ /**
248
+ * The Again button's label.
249
+ * @returns The translated text.
250
+ */
251
+ againLabel(): string {
252
+ return this.i18n.t('flashcard.again', {}, { defaultValue: 'Again' })
253
+ }
254
+
255
+ /**
256
+ * The Hard button's label.
257
+ * @returns The translated text.
258
+ */
259
+ hardLabel(): string {
260
+ return this.i18n.t('flashcard.hard', {}, { defaultValue: 'Hard' })
261
+ }
262
+
263
+ /**
264
+ * The Good button's label.
265
+ * @returns The translated text.
266
+ */
267
+ goodLabel(): string {
268
+ return this.i18n.t('flashcard.good', {}, { defaultValue: 'Good' })
269
+ }
270
+
271
+ /**
272
+ * The Easy button's label.
273
+ * @returns The translated text.
274
+ */
275
+ easyLabel(): string {
276
+ return this.i18n.t('flashcard.easy', {}, { defaultValue: 'Easy' })
277
+ }
278
+
279
+ /** Reveals the answer face. */
280
+ reveal(): void {
281
+ this.revealedState.set(true)
282
+ }
283
+
284
+ /**
285
+ * Forwards the selected grade to the parent and resets the card to hidden.
286
+ * @param grade - The selected SM-2 grade.
287
+ */
288
+ grade(grade: SrsGrade): void {
289
+ this.onGrade?.(grade)
290
+ this.revealedState.set(false)
291
+ }
292
+
293
+ /** Reads the initial `defaultRevealed` once — React's `useState` semantics. */
294
+ ngOnInit(): void {
295
+ this.revealedState.set(!!this.defaultRevealed)
296
+ }
297
+
298
+ /**
299
+ * Reads whether a progress row was projected, then withdraws the wrapper
300
+ * when neither a text input nor projected content landed (React renders no
301
+ * wrapper at all in that case). View queries resolve only at view init.
302
+ */
303
+ ngAfterViewInit(): void {
304
+ const wrap = this.progressWrap?.nativeElement
305
+ if (wrap) this.progressProjected = hasNodes(wrap)
306
+ this.viewReady = true
307
+ this.withdrawEmptyProgress()
308
+ }
309
+
310
+ /**
311
+ * Withdraws the progress wrapper once nothing fills it (React renders
312
+ * `{progress && <div>…</div>}` — nothing when progress is absent).
313
+ */
314
+ ngDoCheck(): void {
315
+ if (this.viewReady) this.withdrawEmptyProgress()
316
+ }
317
+
318
+ /** Detaches the progress row when neither a text nor a projected input fills it. */
319
+ private withdrawEmptyProgress(): void {
320
+ const wrap = this.progressWrap?.nativeElement
321
+ if (!wrap || !wrap.isConnected || this.hasProgress) return
322
+ wrap.remove()
323
+ }
324
+ }
325
+ ```
326
+
327
+ ## Injection Notes
328
+
329
+ ### Requirements
330
+
331
+ Peer dependencies:
332
+
333
+ - `@angular/common` ^22.0.0
334
+ - `@angular/core` ^22.0.0
335
+ - `@angular/platform-browser` ^22.0.0
336
+ - `@molecule/app-angular` ^3.5.0
337
+ - `@molecule/app-ui` ^1.0.1
338
+ - `@molecule/app-ui-angular` ^1.1.0
339
+
340
+ ### Runtime Dependencies
341
+
342
+ - `@angular/common`
343
+ - `@angular/core`
344
+ - `@angular/platform-browser`
345
+ - `@molecule/app-angular`
346
+ - `@molecule/app-ui`
347
+ - `@molecule/app-ui-angular`
348
+
349
+ Grading flips the card back to its FRONT face (ready for the next card) —
350
+ swap the projected content to advance the deck after `onGrade` fires. There
351
+ is no flip animation; the reveal is an instant content swap.
352
+
353
+ The host element is the card surface itself (`div[mol-flashcard-card]`),
354
+ carrying the `Card` classes React renders. The buttons come from
355
+ `@molecule/app-ui-angular`'s `Button` (`button[mol-button]`); their labels
356
+ translate via `@molecule/app-locales-flashcard-card` with English fallbacks
357
+ inline.
358
+
359
+ ## Translations
360
+
361
+ Translation strings are provided by `@molecule/app-locales-flashcard-card`.
@@ -0,0 +1,147 @@
1
+ /**
2
+ * FlashcardCard component (React parity).
3
+ *
4
+ * @module
5
+ */
6
+ import { type AfterViewInit, type DoCheck } from '@angular/core';
7
+ import type { UIClassMap } from '@molecule/app-ui';
8
+ import type { SrsGrade } from './types.js';
9
+ import * as i0 from "@angular/core";
10
+ /**
11
+ * FlashcardCard component.
12
+ *
13
+ * Flashcard study component — front face → reveal back → SM-2 style grade
14
+ * buttons (Again / Hard / Good / Easy). The host IS React's root `<div>`
15
+ * (`div[mol-flashcard-card]`), carrying the `Card` classes exactly as React's
16
+ * `Card` does. `front` / `back` / `progress` are projected content
17
+ * (`[slot=front]`, `[slot=back]`, `[slot=progress]`) or plain string inputs;
18
+ * the button labels go through `useTranslation()` with React's exact keys and
19
+ * English defaults. Grading flips the card back to its front face.
20
+ */
21
+ export declare class FlashcardCard implements AfterViewInit, DoCheck {
22
+ /** Front content (prompt) — a string input, or `[slot=front]` projected content. */
23
+ front?: unknown;
24
+ /** Back content (answer) — a string input, or `[slot=back]` projected content. */
25
+ back?: unknown;
26
+ /** Optional progress / position — a string input, or `[slot=progress]` content. */
27
+ progress?: unknown;
28
+ /** Called when the user grades the card after revealing the answer. */
29
+ onGrade?: (grade: SrsGrade) => void;
30
+ /** Initially show the answer. Read once, like React's `useState`. */
31
+ defaultRevealed?: boolean;
32
+ /** Extra classes on the card. */
33
+ className?: string;
34
+ /** The progress wrapper (always in the template; detached when empty). */
35
+ private progressWrap?;
36
+ /** The face element the front/back content renders into. */
37
+ private face?;
38
+ /** The i18n provider above the card (the button labels). */
39
+ private readonly i18n;
40
+ /** Whether the answer face is showing. */
41
+ private readonly revealedState;
42
+ /** Whether a `[slot=progress]` projection landed (an empty wrapper is removed). */
43
+ private progressProjected;
44
+ /** Whether the view queries have been read (nothing is withdrawn before). */
45
+ private viewReady;
46
+ /**
47
+ * The current class map.
48
+ * @returns The UIClassMap.
49
+ */
50
+ cm(): UIClassMap;
51
+ /**
52
+ * Computes the card class list — React's `Card` with the default
53
+ * `elevated` variant and `md` padding, plus `className`.
54
+ * @returns The class string.
55
+ */
56
+ cardClasses(): string;
57
+ /**
58
+ * The outer stack class list.
59
+ * @returns The class string.
60
+ */
61
+ stackClasses(): string;
62
+ /**
63
+ * The progress row class list.
64
+ * @returns The class string.
65
+ */
66
+ progressClasses(): string;
67
+ /**
68
+ * The face class list.
69
+ * @returns The class string.
70
+ */
71
+ faceClasses(): string;
72
+ /**
73
+ * The grade-button grid class list.
74
+ * @returns The class string.
75
+ */
76
+ gridClasses(): string;
77
+ /**
78
+ * Whether the answer face is showing.
79
+ * @returns True when revealed.
80
+ */
81
+ revealed(): boolean;
82
+ /**
83
+ * Whether the front arrives as a text input (projected content otherwise).
84
+ * @returns True when `front` is a non-empty string.
85
+ */
86
+ get hasFront(): boolean;
87
+ /**
88
+ * Whether the back arrives as a text input (projected content otherwise).
89
+ * @returns True when `back` is a non-empty string.
90
+ */
91
+ get hasBack(): boolean;
92
+ /**
93
+ * Whether the progress row renders at all — React's `{progress && …}`.
94
+ * @returns True when a text or projected progress row exists.
95
+ */
96
+ get hasProgress(): boolean;
97
+ /**
98
+ * The reveal button's label.
99
+ * @returns The translated text.
100
+ */
101
+ revealLabel(): string;
102
+ /**
103
+ * The Again button's label.
104
+ * @returns The translated text.
105
+ */
106
+ againLabel(): string;
107
+ /**
108
+ * The Hard button's label.
109
+ * @returns The translated text.
110
+ */
111
+ hardLabel(): string;
112
+ /**
113
+ * The Good button's label.
114
+ * @returns The translated text.
115
+ */
116
+ goodLabel(): string;
117
+ /**
118
+ * The Easy button's label.
119
+ * @returns The translated text.
120
+ */
121
+ easyLabel(): string;
122
+ /** Reveals the answer face. */
123
+ reveal(): void;
124
+ /**
125
+ * Forwards the selected grade to the parent and resets the card to hidden.
126
+ * @param grade - The selected SM-2 grade.
127
+ */
128
+ grade(grade: SrsGrade): void;
129
+ /** Reads the initial `defaultRevealed` once — React's `useState` semantics. */
130
+ ngOnInit(): void;
131
+ /**
132
+ * Reads whether a progress row was projected, then withdraws the wrapper
133
+ * when neither a text input nor projected content landed (React renders no
134
+ * wrapper at all in that case). View queries resolve only at view init.
135
+ */
136
+ ngAfterViewInit(): void;
137
+ /**
138
+ * Withdraws the progress wrapper once nothing fills it (React renders
139
+ * `{progress && <div>…</div>}` — nothing when progress is absent).
140
+ */
141
+ ngDoCheck(): void;
142
+ /** Detaches the progress row when neither a text nor a projected input fills it. */
143
+ private withdrawEmptyProgress;
144
+ static ɵfac: i0.ɵɵFactoryDeclaration<FlashcardCard, never>;
145
+ static ɵcmp: i0.ɵɵComponentDeclaration<FlashcardCard, "div[mol-flashcard-card]", never, { "front": { "alias": "front"; "required": false; }; "back": { "alias": "back"; "required": false; }; "progress": { "alias": "progress"; "required": false; }; "onGrade": { "alias": "onGrade"; "required": false; }; "defaultRevealed": { "alias": "defaultRevealed"; "required": false; }; "className": { "alias": "className"; "required": false; }; }, {}, never, ["[slot=progress]", "[slot=back]", "[slot=front]"], true, never>;
146
+ }
147
+ //# sourceMappingURL=flashcard-card.component.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flashcard-card.component.d.ts","sourceRoot":"","sources":["../src/flashcard-card.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,KAAK,aAAa,EAElB,KAAK,OAAO,EAIb,MAAM,eAAe,CAAA;AAGtB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAIlD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;;AAiB1C;;;;;;;;;;GAUG;AACH,qBAWa,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AGG;IACH,SAAS,IAAI,MAAM;IAInB;;;OAGG;IACH,SAAS,IAAI,MAAM;IAInB,+BAA+B;IAC/B,MAAM,IAAI,IAAI;IAId;;;OAGG;IACH,KAAK,CAAC,KAAK,EAAE,QAAQ,GAAG,IAAI;IAK5B,+EAA+E;IAC/E,QAAQ,IAAI,IAAI;IAIhB;;;;OAIG;IACH,eAAe,IAAI,IAAI;IAOvB;;;OAGG;IACH,SAAS,IAAI,IAAI;IAIjB,oFAAoF;IACpF,OAAO,CAAC,qBAAqB;yCAnMlB,aAAa;2CAAb,aAAa;CAwMzB"}
@@ -0,0 +1,367 @@
1
+ /**
2
+ * FlashcardCard component (React parity).
3
+ *
4
+ * @module
5
+ */
6
+ import { Component, signal, ViewChild, } from '@angular/core';
7
+ import { useTranslation } from '@molecule/app-angular';
8
+ import { getClassMap } from '@molecule/app-ui';
9
+ import { Button } from '@molecule/app-ui-angular';
10
+ import * as i0 from "@angular/core";
11
+ const _c0 = ["progressWrap"];
12
+ const _c1 = ["face"];
13
+ const _c2 = [[["", "slot", "progress"]], [["", "slot", "back"]], [["", "slot", "front"]]];
14
+ const _c3 = ["[slot=progress]", "[slot=back]", "[slot=front]"];
15
+ function FlashcardCard_Conditional_3_Template(rf, ctx) { if (rf & 1) {
16
+ i0.ɵɵelementContainerStart(0);
17
+ i0.ɵɵtext(1);
18
+ i0.ɵɵelementContainerEnd();
19
+ } if (rf & 2) {
20
+ const ctx_r0 = i0.ɵɵnextContext();
21
+ i0.ɵɵadvance();
22
+ i0.ɵɵtextInterpolate(ctx_r0.progress);
23
+ } }
24
+ function FlashcardCard_Conditional_7_Conditional_0_Template(rf, ctx) { if (rf & 1) {
25
+ i0.ɵɵelementContainerStart(0);
26
+ i0.ɵɵtext(1);
27
+ i0.ɵɵelementContainerEnd();
28
+ } if (rf & 2) {
29
+ const ctx_r0 = i0.ɵɵnextContext(2);
30
+ i0.ɵɵadvance();
31
+ i0.ɵɵtextInterpolate(ctx_r0.back);
32
+ } }
33
+ function FlashcardCard_Conditional_7_Template(rf, ctx) { if (rf & 1) {
34
+ i0.ɵɵconditionalCreate(0, FlashcardCard_Conditional_7_Conditional_0_Template, 2, 1, "ng-container");
35
+ i0.ɵɵprojection(1, 1);
36
+ } if (rf & 2) {
37
+ const ctx_r0 = i0.ɵɵnextContext();
38
+ i0.ɵɵconditional(ctx_r0.hasBack ? 0 : -1);
39
+ } }
40
+ function FlashcardCard_Conditional_8_Conditional_0_Template(rf, ctx) { if (rf & 1) {
41
+ i0.ɵɵelementContainerStart(0);
42
+ i0.ɵɵtext(1);
43
+ i0.ɵɵelementContainerEnd();
44
+ } if (rf & 2) {
45
+ const ctx_r0 = i0.ɵɵnextContext(2);
46
+ i0.ɵɵadvance();
47
+ i0.ɵɵtextInterpolate(ctx_r0.front);
48
+ } }
49
+ function FlashcardCard_Conditional_8_Template(rf, ctx) { if (rf & 1) {
50
+ i0.ɵɵconditionalCreate(0, FlashcardCard_Conditional_8_Conditional_0_Template, 2, 1, "ng-container");
51
+ i0.ɵɵprojection(1, 2);
52
+ } if (rf & 2) {
53
+ const ctx_r0 = i0.ɵɵnextContext();
54
+ i0.ɵɵconditional(ctx_r0.hasFront ? 0 : -1);
55
+ } }
56
+ function FlashcardCard_Conditional_9_Template(rf, ctx) { if (rf & 1) {
57
+ const _r2 = i0.ɵɵgetCurrentView();
58
+ i0.ɵɵelementStart(0, "button", 4);
59
+ i0.ɵɵlistener("click", function FlashcardCard_Conditional_9_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r2); const ctx_r0 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r0.reveal()); });
60
+ i0.ɵɵtext(1);
61
+ i0.ɵɵelementEnd();
62
+ } if (rf & 2) {
63
+ const ctx_r0 = i0.ɵɵnextContext();
64
+ i0.ɵɵproperty("variant", "solid")("color", "primary");
65
+ i0.ɵɵadvance();
66
+ i0.ɵɵtextInterpolate(ctx_r0.revealLabel());
67
+ } }
68
+ function FlashcardCard_Conditional_10_Template(rf, ctx) { if (rf & 1) {
69
+ const _r3 = i0.ɵɵgetCurrentView();
70
+ i0.ɵɵelementStart(0, "div")(1, "button", 4);
71
+ i0.ɵɵlistener("click", function FlashcardCard_Conditional_10_Template_button_click_1_listener() { i0.ɵɵrestoreView(_r3); const ctx_r0 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r0.grade("again")); });
72
+ i0.ɵɵtext(2);
73
+ i0.ɵɵelementEnd();
74
+ i0.ɵɵelementStart(3, "button", 4);
75
+ i0.ɵɵlistener("click", function FlashcardCard_Conditional_10_Template_button_click_3_listener() { i0.ɵɵrestoreView(_r3); const ctx_r0 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r0.grade("hard")); });
76
+ i0.ɵɵtext(4);
77
+ i0.ɵɵelementEnd();
78
+ i0.ɵɵelementStart(5, "button", 4);
79
+ i0.ɵɵlistener("click", function FlashcardCard_Conditional_10_Template_button_click_5_listener() { i0.ɵɵrestoreView(_r3); const ctx_r0 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r0.grade("good")); });
80
+ i0.ɵɵtext(6);
81
+ i0.ɵɵelementEnd();
82
+ i0.ɵɵelementStart(7, "button", 4);
83
+ i0.ɵɵlistener("click", function FlashcardCard_Conditional_10_Template_button_click_7_listener() { i0.ɵɵrestoreView(_r3); const ctx_r0 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r0.grade("easy")); });
84
+ i0.ɵɵtext(8);
85
+ i0.ɵɵelementEnd()();
86
+ } if (rf & 2) {
87
+ const ctx_r0 = i0.ɵɵnextContext();
88
+ i0.ɵɵclassMap(ctx_r0.gridClasses());
89
+ i0.ɵɵadvance();
90
+ i0.ɵɵproperty("variant", "outline")("color", "error");
91
+ i0.ɵɵadvance();
92
+ i0.ɵɵtextInterpolate(ctx_r0.againLabel());
93
+ i0.ɵɵadvance();
94
+ i0.ɵɵproperty("variant", "outline")("color", "warning");
95
+ i0.ɵɵadvance();
96
+ i0.ɵɵtextInterpolate(ctx_r0.hardLabel());
97
+ i0.ɵɵadvance();
98
+ i0.ɵɵproperty("variant", "outline")("color", "primary");
99
+ i0.ɵɵadvance();
100
+ i0.ɵɵtextInterpolate(ctx_r0.goodLabel());
101
+ i0.ɵɵadvance();
102
+ i0.ɵɵproperty("variant", "outline")("color", "success");
103
+ i0.ɵɵadvance();
104
+ i0.ɵɵtextInterpolate(ctx_r0.easyLabel());
105
+ } }
106
+ /**
107
+ * Whether an ng-content wrapper captured any element or text node.
108
+ *
109
+ * @param el - The wrapper element.
110
+ * @returns True when at least one projected node exists.
111
+ */
112
+ const hasNodes = (el) => {
113
+ if (!el)
114
+ return false;
115
+ for (const node of Array.from(el.childNodes)) {
116
+ if (node.nodeType === 1)
117
+ return true;
118
+ if (node.nodeType === 3 && (node.textContent ?? '').trim())
119
+ return true;
120
+ }
121
+ return false;
122
+ };
123
+ /**
124
+ * FlashcardCard component.
125
+ *
126
+ * Flashcard study component — front face → reveal back → SM-2 style grade
127
+ * buttons (Again / Hard / Good / Easy). The host IS React's root `<div>`
128
+ * (`div[mol-flashcard-card]`), carrying the `Card` classes exactly as React's
129
+ * `Card` does. `front` / `back` / `progress` are projected content
130
+ * (`[slot=front]`, `[slot=back]`, `[slot=progress]`) or plain string inputs;
131
+ * the button labels go through `useTranslation()` with React's exact keys and
132
+ * English defaults. Grading flips the card back to its front face.
133
+ */
134
+ export class FlashcardCard {
135
+ /** Front content (prompt) — a string input, or `[slot=front]` projected content. */
136
+ front;
137
+ /** Back content (answer) — a string input, or `[slot=back]` projected content. */
138
+ back;
139
+ /** Optional progress / position — a string input, or `[slot=progress]` content. */
140
+ progress;
141
+ /** Called when the user grades the card after revealing the answer. */
142
+ onGrade;
143
+ /** Initially show the answer. Read once, like React's `useState`. */
144
+ defaultRevealed;
145
+ /** Extra classes on the card. */
146
+ className;
147
+ /** The progress wrapper (always in the template; detached when empty). */
148
+ progressWrap;
149
+ /** The face element the front/back content renders into. */
150
+ face;
151
+ /** The i18n provider above the card (the button labels). */
152
+ i18n = useTranslation();
153
+ /** Whether the answer face is showing. */
154
+ revealedState = signal(false, /* @ts-ignore */
155
+ ...(ngDevMode ? [{ debugName: "revealedState" }] : /* istanbul ignore next */ []));
156
+ /** Whether a `[slot=progress]` projection landed (an empty wrapper is removed). */
157
+ progressProjected = false;
158
+ /** Whether the view queries have been read (nothing is withdrawn before). */
159
+ viewReady = false;
160
+ /**
161
+ * The current class map.
162
+ * @returns The UIClassMap.
163
+ */
164
+ cm() {
165
+ return getClassMap();
166
+ }
167
+ /**
168
+ * Computes the card class list — React's `Card` with the default
169
+ * `elevated` variant and `md` padding, plus `className`.
170
+ * @returns The class string.
171
+ */
172
+ cardClasses() {
173
+ const cm = this.cm();
174
+ return cm.cn(cm.card({ variant: 'elevated' }), cm.cardPadding('md'), this.className);
175
+ }
176
+ /**
177
+ * The outer stack class list.
178
+ * @returns The class string.
179
+ */
180
+ stackClasses() {
181
+ return this.cm().stack(4);
182
+ }
183
+ /**
184
+ * The progress row class list.
185
+ * @returns The class string.
186
+ */
187
+ progressClasses() {
188
+ const cm = this.cm();
189
+ return cm.cn(cm.textSize('xs'), cm.fontWeight('semibold'), cm.textCenter);
190
+ }
191
+ /**
192
+ * The face class list.
193
+ * @returns The class string.
194
+ */
195
+ faceClasses() {
196
+ const cm = this.cm();
197
+ return cm.cn(cm.sp('p', 6), cm.textCenter, cm.cn(cm.textSize('xl')));
198
+ }
199
+ /**
200
+ * The grade-button grid class list.
201
+ * @returns The class string.
202
+ */
203
+ gridClasses() {
204
+ return this.cm().grid({ cols: 4, gap: 'sm' });
205
+ }
206
+ /**
207
+ * Whether the answer face is showing.
208
+ * @returns True when revealed.
209
+ */
210
+ revealed() {
211
+ return this.revealedState();
212
+ }
213
+ /**
214
+ * Whether the front arrives as a text input (projected content otherwise).
215
+ * @returns True when `front` is a non-empty string.
216
+ */
217
+ get hasFront() {
218
+ return typeof this.front === 'string' && this.front.length > 0;
219
+ }
220
+ /**
221
+ * Whether the back arrives as a text input (projected content otherwise).
222
+ * @returns True when `back` is a non-empty string.
223
+ */
224
+ get hasBack() {
225
+ return typeof this.back === 'string' && this.back.length > 0;
226
+ }
227
+ /**
228
+ * Whether the progress row renders at all — React's `{progress && …}`.
229
+ * @returns True when a text or projected progress row exists.
230
+ */
231
+ get hasProgress() {
232
+ return (typeof this.progress === 'string' && this.progress.length > 0) || this.progressProjected;
233
+ }
234
+ /**
235
+ * The reveal button's label.
236
+ * @returns The translated text.
237
+ */
238
+ revealLabel() {
239
+ return this.i18n.t('flashcard.reveal', {}, { defaultValue: 'Show answer' });
240
+ }
241
+ /**
242
+ * The Again button's label.
243
+ * @returns The translated text.
244
+ */
245
+ againLabel() {
246
+ return this.i18n.t('flashcard.again', {}, { defaultValue: 'Again' });
247
+ }
248
+ /**
249
+ * The Hard button's label.
250
+ * @returns The translated text.
251
+ */
252
+ hardLabel() {
253
+ return this.i18n.t('flashcard.hard', {}, { defaultValue: 'Hard' });
254
+ }
255
+ /**
256
+ * The Good button's label.
257
+ * @returns The translated text.
258
+ */
259
+ goodLabel() {
260
+ return this.i18n.t('flashcard.good', {}, { defaultValue: 'Good' });
261
+ }
262
+ /**
263
+ * The Easy button's label.
264
+ * @returns The translated text.
265
+ */
266
+ easyLabel() {
267
+ return this.i18n.t('flashcard.easy', {}, { defaultValue: 'Easy' });
268
+ }
269
+ /** Reveals the answer face. */
270
+ reveal() {
271
+ this.revealedState.set(true);
272
+ }
273
+ /**
274
+ * Forwards the selected grade to the parent and resets the card to hidden.
275
+ * @param grade - The selected SM-2 grade.
276
+ */
277
+ grade(grade) {
278
+ this.onGrade?.(grade);
279
+ this.revealedState.set(false);
280
+ }
281
+ /** Reads the initial `defaultRevealed` once — React's `useState` semantics. */
282
+ ngOnInit() {
283
+ this.revealedState.set(!!this.defaultRevealed);
284
+ }
285
+ /**
286
+ * Reads whether a progress row was projected, then withdraws the wrapper
287
+ * when neither a text input nor projected content landed (React renders no
288
+ * wrapper at all in that case). View queries resolve only at view init.
289
+ */
290
+ ngAfterViewInit() {
291
+ const wrap = this.progressWrap?.nativeElement;
292
+ if (wrap)
293
+ this.progressProjected = hasNodes(wrap);
294
+ this.viewReady = true;
295
+ this.withdrawEmptyProgress();
296
+ }
297
+ /**
298
+ * Withdraws the progress wrapper once nothing fills it (React renders
299
+ * `{progress && <div>…</div>}` — nothing when progress is absent).
300
+ */
301
+ ngDoCheck() {
302
+ if (this.viewReady)
303
+ this.withdrawEmptyProgress();
304
+ }
305
+ /** Detaches the progress row when neither a text nor a projected input fills it. */
306
+ withdrawEmptyProgress() {
307
+ const wrap = this.progressWrap?.nativeElement;
308
+ if (!wrap || !wrap.isConnected || this.hasProgress)
309
+ return;
310
+ wrap.remove();
311
+ }
312
+ static ɵfac = function FlashcardCard_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || FlashcardCard)(); };
313
+ static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: FlashcardCard, selectors: [["div", "mol-flashcard-card", ""]], viewQuery: function FlashcardCard_Query(rf, ctx) { if (rf & 1) {
314
+ i0.ɵɵviewQuery(_c0, 5)(_c1, 5);
315
+ } if (rf & 2) {
316
+ let _t;
317
+ i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.progressWrap = _t.first);
318
+ i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.face = _t.first);
319
+ } }, hostVars: 2, hostBindings: function FlashcardCard_HostBindings(rf, ctx) { if (rf & 2) {
320
+ i0.ɵɵclassMap(ctx.cardClasses());
321
+ } }, inputs: { front: "front", back: "back", progress: "progress", onGrade: "onGrade", defaultRevealed: "defaultRevealed", className: "className" }, ngContentSelectors: _c3, decls: 11, vars: 9, consts: [["progressWrap", ""], ["face", ""], ["mol-button", "", 3, "variant", "color"], [3, "class"], ["mol-button", "", 3, "click", "variant", "color"]], template: function FlashcardCard_Template(rf, ctx) { if (rf & 1) {
322
+ i0.ɵɵprojectionDef(_c2);
323
+ i0.ɵɵelementStart(0, "div")(1, "div", null, 0);
324
+ i0.ɵɵconditionalCreate(3, FlashcardCard_Conditional_3_Template, 2, 1, "ng-container");
325
+ i0.ɵɵprojection(4);
326
+ i0.ɵɵelementEnd();
327
+ i0.ɵɵelementStart(5, "div", null, 1);
328
+ i0.ɵɵconditionalCreate(7, FlashcardCard_Conditional_7_Template, 2, 1)(8, FlashcardCard_Conditional_8_Template, 2, 1);
329
+ i0.ɵɵelementEnd();
330
+ i0.ɵɵconditionalCreate(9, FlashcardCard_Conditional_9_Template, 2, 3, "button", 2)(10, FlashcardCard_Conditional_10_Template, 9, 14, "div", 3);
331
+ i0.ɵɵelementEnd();
332
+ } if (rf & 2) {
333
+ i0.ɵɵclassMap(ctx.stackClasses());
334
+ i0.ɵɵadvance();
335
+ i0.ɵɵclassMap(ctx.progressClasses());
336
+ i0.ɵɵadvance(2);
337
+ i0.ɵɵconditional(ctx.hasProgress ? 3 : -1);
338
+ i0.ɵɵadvance(2);
339
+ i0.ɵɵclassMap(ctx.faceClasses());
340
+ i0.ɵɵadvance(2);
341
+ i0.ɵɵconditional(ctx.revealed() ? 7 : 8);
342
+ i0.ɵɵadvance(2);
343
+ i0.ɵɵconditional(!ctx.revealed() ? 9 : 10);
344
+ } }, dependencies: [Button], encapsulation: 2 });
345
+ }
346
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(FlashcardCard, [{
347
+ type: Component,
348
+ args: [{
349
+ selector: 'div[mol-flashcard-card]',
350
+ standalone: true,
351
+ imports: [Button],
352
+ inputs: ['front', 'back', 'progress', 'onGrade', 'defaultRevealed', 'className'],
353
+ host: {
354
+ '[class]': 'cardClasses()',
355
+ },
356
+ // prettier-ignore
357
+ template: `<div [class]="stackClasses()"><div #progressWrap [class]="progressClasses()">@if (hasProgress) {<ng-container>{{ progress }}</ng-container>}<ng-content select="[slot=progress]"></ng-content></div><div [class]="faceClasses()" #face>@if (revealed()) {@if (hasBack) {<ng-container>{{ back }}</ng-container>}<ng-content select="[slot=back]"></ng-content>} @else {@if (hasFront) {<ng-container>{{ front }}</ng-container>}<ng-content select="[slot=front]"></ng-content>}</div>@if (!revealed()) {<button mol-button [variant]="'solid'" [color]="'primary'" (click)="reveal()">{{ revealLabel() }}</button>} @else {<div [class]="gridClasses()"><button mol-button [variant]="'outline'" [color]="'error'" (click)="grade('again')">{{ againLabel() }}</button><button mol-button [variant]="'outline'" [color]="'warning'" (click)="grade('hard')">{{ hardLabel() }}</button><button mol-button [variant]="'outline'" [color]="'primary'" (click)="grade('good')">{{ goodLabel() }}</button><button mol-button [variant]="'outline'" [color]="'success'" (click)="grade('easy')">{{ easyLabel() }}</button></div>}</div>`,
358
+ }]
359
+ }], null, { progressWrap: [{
360
+ type: ViewChild,
361
+ args: ['progressWrap']
362
+ }], face: [{
363
+ type: ViewChild,
364
+ args: ['face']
365
+ }] }); })();
366
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(FlashcardCard, { className: "FlashcardCard", filePath: "flashcard-card.component.ts", lineNumber: 60 }); })();
367
+ //# sourceMappingURL=flashcard-card.component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flashcard-card.component.js","sourceRoot":"","sources":["../src/flashcard-card.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAEL,SAAS,EAGT,MAAM,EACN,SAAS,GACV,MAAM,eAAe,CAAA;AAEtB,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAEtD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAA;;;;;;;IAuC4D,6BAAc;IAAA,YAAc;;;;IAAd,cAAc;IAAd,qCAAc;;;IAA4I,6BAAc;IAAA,YAAU;;;;IAAV,cAAU;IAAV,iCAAU;;;IAAvC,mGAAe;IAAwC,qBAA8C;;;IAArG,yCAAuD;;;IAAuE,6BAAc;IAAA,YAAW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— the counterpart of
3
+ * `@molecule/app-flashcard-card-react`: the same props and the same DOM for
4
+ * the same input.
5
+ *
6
+ * Exports `<FlashcardCard>` — it shows the front (prompt), a "Show answer"
7
+ * reveal button, then the back (answer) with four SM-2-compatible grade
8
+ * buttons (Again / Hard / Good / Easy). The app owns the spaced-repetition
9
+ * scheduling; the card only reports the grade.
10
+ *
11
+ * @example
12
+ * ```ts
13
+ * import { Component } from '@angular/core'
14
+ * import { FlashcardCard } from '@molecule/app-flashcard-card-angular'
15
+ *
16
+ * @Component({
17
+ * selector: 'app-study',
18
+ * standalone: true,
19
+ * imports: [FlashcardCard],
20
+ * template: `
21
+ * <div mol-flashcard-card [progress]="'Card 3 of 20'" [onGrade]="onGrade">
22
+ * <span slot="front">What is the capital of France?</span>
23
+ * <span slot="back">Paris</span>
24
+ * </div>
25
+ * `,
26
+ * })
27
+ * export class StudyView {
28
+ * onGrade(grade: string): void {
29
+ * console.log(grade)
30
+ * }
31
+ * }
32
+ * ```
33
+ *
34
+ * @remarks
35
+ * Grading flips the card back to its FRONT face (ready for the next card) —
36
+ * swap the projected content to advance the deck after `onGrade` fires. There
37
+ * is no flip animation; the reveal is an instant content swap.
38
+ *
39
+ * The host element is the card surface itself (`div[mol-flashcard-card]`),
40
+ * carrying the `Card` classes React renders. The buttons come from
41
+ * `@molecule/app-ui-angular`'s `Button` (`button[mol-button]`); their labels
42
+ * translate via `@molecule/app-locales-flashcard-card` with English fallbacks
43
+ * inline.
44
+ *
45
+ * @module
46
+ */
47
+ export * from './flashcard-card.component.js';
48
+ export * from './types.js';
49
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AAEH,cAAc,+BAA+B,CAAA;AAC7C,cAAc,YAAY,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Angular flashcard study card — the counterpart of
3
+ * `@molecule/app-flashcard-card-react`: the same props and the same DOM for
4
+ * the same input.
5
+ *
6
+ * Exports `<FlashcardCard>` — it shows the front (prompt), a "Show answer"
7
+ * reveal button, then the back (answer) with four SM-2-compatible grade
8
+ * buttons (Again / Hard / Good / Easy). The app owns the spaced-repetition
9
+ * scheduling; the card only reports the grade.
10
+ *
11
+ * @example
12
+ * ```ts
13
+ * import { Component } from '@angular/core'
14
+ * import { FlashcardCard } from '@molecule/app-flashcard-card-angular'
15
+ *
16
+ * @Component({
17
+ * selector: 'app-study',
18
+ * standalone: true,
19
+ * imports: [FlashcardCard],
20
+ * template: `
21
+ * <div mol-flashcard-card [progress]="'Card 3 of 20'" [onGrade]="onGrade">
22
+ * <span slot="front">What is the capital of France?</span>
23
+ * <span slot="back">Paris</span>
24
+ * </div>
25
+ * `,
26
+ * })
27
+ * export class StudyView {
28
+ * onGrade(grade: string): void {
29
+ * console.log(grade)
30
+ * }
31
+ * }
32
+ * ```
33
+ *
34
+ * @remarks
35
+ * Grading flips the card back to its FRONT face (ready for the next card) —
36
+ * swap the projected content to advance the deck after `onGrade` fires. There
37
+ * is no flip animation; the reveal is an instant content swap.
38
+ *
39
+ * The host element is the card surface itself (`div[mol-flashcard-card]`),
40
+ * carrying the `Card` classes React renders. The buttons come from
41
+ * `@molecule/app-ui-angular`'s `Button` (`button[mol-button]`); their labels
42
+ * translate via `@molecule/app-locales-flashcard-card` with English fallbacks
43
+ * inline.
44
+ *
45
+ * @module
46
+ */
47
+ export * from './flashcard-card.component.js';
48
+ export * from './types.js';
49
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AAEH,cAAc,+BAA+B,CAAA;AAC7C,cAAc,YAAY,CAAA"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Types of `@molecule/app-flashcard-card-angular` — the Angular counterpart of
3
+ * `@molecule/app-flashcard-card-react`, same props and DOM.
4
+ *
5
+ * @module
6
+ */
7
+ /**
8
+ * SM-2-compatible grade values the caller uses to schedule the next review.
9
+ * Same union as React's `SrsGrade`.
10
+ */
11
+ export type SrsGrade = 'again' | 'hard' | 'good' | 'easy';
12
+ /**
13
+ * Props accepted by {@link FlashcardCard} — the same props
14
+ * `@molecule/app-flashcard-card-react` accepts. Node props (`front`, `back`,
15
+ * `progress`) are projected content in Angular (an input cannot carry a node),
16
+ * so they are typed `unknown`: pass them as `[slot=front]` / `[slot=back]` /
17
+ * `[slot=progress]` content, or as plain strings.
18
+ */
19
+ export interface FlashcardCardProps {
20
+ /** Front content (prompt), projected as `[slot=front]` content or a string. */
21
+ front?: unknown;
22
+ /** Back content (answer), projected as `[slot=back]` content or a string. */
23
+ back?: unknown;
24
+ /** Optional progress / position, projected as `[slot=progress]` content or a string. */
25
+ progress?: unknown;
26
+ /** Called when the user grades the card after revealing the answer. */
27
+ onGrade?: (grade: SrsGrade) => void;
28
+ /** Initially show the answer. Read once, like React's `useState`. */
29
+ defaultRevealed?: boolean;
30
+ /** Extra classes on the card. */
31
+ className?: string;
32
+ }
33
+ //# 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;;;GAGG;AACH,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAA;AAEzD;;;;;;GAMG;AACH,MAAM,WAAW,kBAAkB;IACjC,+EAA+E;IAC/E,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,6EAA6E;IAC7E,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,wFAAwF;IACxF,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,uEAAuE;IACvE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,QAAQ,KAAK,IAAI,CAAA;IACnC,qEAAqE;IACrE,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,iCAAiC;IACjC,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB"}
package/dist/types.js ADDED
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Types of `@molecule/app-flashcard-card-angular` — the Angular counterpart of
3
+ * `@molecule/app-flashcard-card-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-flashcard-card-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": "Flashcard flip component with front/back + spaced-repetition grade buttons",
5
+ "homepage": "https://www.molecule.dev/packages/app-flashcard-card-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
+ "flashcard-card",
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/flashcard-card-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
+ }