@molecule/app-flashcard-card-react 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +136 -0
  2. package/package.json +16 -9
package/README.md ADDED
@@ -0,0 +1,136 @@
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-08-04T01:50:45.476Z
7
+ -->
8
+
9
+ # @molecule/app-flashcard-card-react
10
+
11
+ > **Auto-generated, AI-first package reference** for the [molecule.dev](https://molecule.dev) ecosystem.
12
+ > It is written to be read by coding agents as much as by people, and is generated from this
13
+ > package's source — edit `src/index.ts` JSDoc, not this file.
14
+
15
+ Flashcard study card — shows the front (prompt), a "Show answer"
16
+ reveal button, then the back (answer) with four SM-2-compatible
17
+ grade buttons (Again / Hard / Good / Easy). The app owns the
18
+ spaced-repetition scheduling; the card only reports the grade.
19
+
20
+ Exports `<FlashcardCard>` and the `SrsGrade` type.
21
+
22
+ ## Quick Start
23
+
24
+ ```tsx
25
+ import { FlashcardCard } from '@molecule/app-flashcard-card-react'
26
+
27
+ function StudyView() {
28
+ return (
29
+ <FlashcardCard
30
+ front={<span>What is the capital of France?</span>}
31
+ back={<span>Paris</span>}
32
+ progress="Card 3 of 20"
33
+ onGrade={(grade) => scheduleNext(card.id, grade)}
34
+ />
35
+ )
36
+ }
37
+ ```
38
+
39
+ ## Type
40
+
41
+ `feature`
42
+
43
+ ## Installation
44
+
45
+ ```bash
46
+ npm install @molecule/app-flashcard-card-react @molecule/app-react @molecule/app-ui @molecule/app-ui-react react
47
+ npm install -D @types/react
48
+ ```
49
+
50
+ ## API
51
+
52
+ ### Interfaces
53
+
54
+ #### `FlashcardCardProps`
55
+
56
+ Props for {@link FlashcardCard}.
57
+
58
+ ```typescript
59
+ interface FlashcardCardProps {
60
+ /** Front content (prompt). */
61
+ front: ReactNode
62
+ /** Back content (answer). */
63
+ back: ReactNode
64
+ /** Called when the user grades the card after revealing the answer. */
65
+ onGrade?: (grade: SrsGrade) => void
66
+ /** Optional progress / position. */
67
+ progress?: ReactNode
68
+ /** Initially show the answer. */
69
+ defaultRevealed?: boolean
70
+ /** Extra classes. */
71
+ className?: string
72
+ }
73
+ ```
74
+
75
+ ### Types
76
+
77
+ #### `SrsGrade`
78
+
79
+ SM-2-compatible grade values the caller uses to schedule the next review.
80
+
81
+ ```typescript
82
+ type SrsGrade = 'again' | 'hard' | 'good' | 'easy'
83
+ ```
84
+
85
+ ### Functions
86
+
87
+ #### `FlashcardCard(props)`
88
+
89
+ Flashcard study component — front face → reveal back → SM-2 style
90
+ grade buttons (Again / Hard / Good / Easy). Apps own the
91
+ spaced-repetition scheduling logic.
92
+
93
+ ```typescript
94
+ function FlashcardCard({
95
+ front,
96
+ back,
97
+ onGrade,
98
+ progress,
99
+ defaultRevealed,
100
+ className,
101
+ }: FlashcardCardProps): ReactElement<unknown, string | JSXElementConstructor<any>>
102
+ ```
103
+
104
+ - `props` — Component props (see {@link FlashcardCardProps}).
105
+
106
+ ## Injection Notes
107
+
108
+ ### Requirements
109
+
110
+ Peer dependencies:
111
+
112
+ - `@molecule/app-react` ^1.0.1
113
+ - `@molecule/app-ui` ^1.0.1
114
+ - `@molecule/app-ui-react` ^1.0.1
115
+ - `react` ^18.0.0 || ^19.0.0
116
+
117
+ ### Runtime Dependencies
118
+
119
+ - `@molecule/app-react`
120
+ - `@molecule/app-ui`
121
+ - `@molecule/app-ui-react`
122
+ - `react`
123
+
124
+ Grading flips the card back to its FRONT face (ready for the next
125
+ card) — swap the `front` / `back` props to advance the deck after
126
+ `onGrade` fires. There is no flip animation; the reveal is an
127
+ instant content swap.
128
+
129
+ Renders with the `Card` / `Button` primitives from the
130
+ `@molecule/app-ui-react` peer dependency. Button labels translate
131
+ via `@molecule/app-locales-flashcard-card` with English fallbacks
132
+ inline.
133
+
134
+ ## Translations
135
+
136
+ Translation strings are provided by `@molecule/app-locales-flashcard-card`.
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "@molecule/app-flashcard-card-react",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Flashcard flip component with front/back + spaced-repetition grade buttons",
5
+ "homepage": "https://www.molecule.dev/packages/app-flashcard-card-react",
5
6
  "type": "module",
6
7
  "main": "dist/index.js",
7
8
  "types": "dist/index.d.ts",
@@ -17,7 +18,8 @@
17
18
  }
18
19
  },
19
20
  "files": [
20
- "dist"
21
+ "dist",
22
+ "README.md"
21
23
  ],
22
24
  "keywords": [
23
25
  "molecule",
@@ -25,22 +27,27 @@
25
27
  "react"
26
28
  ],
27
29
  "license": "Apache-2.0",
30
+ "repository": {
31
+ "type": "git",
32
+ "url": "https://github.com/molecule-dev/molecule.git",
33
+ "directory": "packages/app/features/flashcard-card-react"
34
+ },
28
35
  "peerDependencies": {
29
- "@molecule/app-react": "^1.0.0",
30
- "@molecule/app-ui": "^1.0.0",
31
- "@molecule/app-ui-react": "^1.0.0",
36
+ "@molecule/app-react": "^1.0.1",
37
+ "@molecule/app-ui": "^1.0.1",
38
+ "@molecule/app-ui-react": "^1.0.1",
32
39
  "react": "^18.0.0 || ^19.0.0"
33
40
  },
34
41
  "devDependencies": {
35
- "@molecule/app-react": "1.0.0",
36
- "@molecule/app-ui": "1.0.0",
37
- "@molecule/app-ui-react": "1.0.0",
42
+ "@molecule/app-react": "1.5.1",
43
+ "@molecule/app-ui": "1.1.1",
44
+ "@molecule/app-ui-react": "1.0.2",
38
45
  "@types/node": "26.1.2",
39
46
  "@types/react": "19.2.17",
40
47
  "@types/react-dom": "19.2.3",
41
48
  "react": "19.2.8",
42
49
  "react-dom": "19.2.8",
43
50
  "typescript": "6.0.3",
44
- "vitest": "4.1.10"
51
+ "vitest": "4.1.11"
45
52
  }
46
53
  }