@molecule/app-reputation-badge-solid 0.0.0-stage → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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,288 @@
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-21T12:47:10.261Z
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-reputation-badge-solid
10
+
11
+ Solid reputation/karma surfaces — `<ReputationBadge>` and `<BadgeShelf>` —
12
+ for forum, discussion-board, and social flagships.
13
+
14
+ `<ReputationBadge score={n} />` renders a compact-formatted score ("1.5k")
15
+ plus a tier chip; the tier derives from `score` via `levelForScore` and
16
+ `DEFAULT_THRESHOLDS` (contributor 100, trusted 500, veteran 2000,
17
+ legend 10000) unless you pass `level` or `thresholds`. `variant` is
18
+ `'compact'` (default) or `'full'` (stacked with a "Reputation" caption).
19
+ `<BadgeShelf badges limit onClick />` renders earned-badge icons with a
20
+ trailing `+N` overflow chip (`onClick(null)` signals "expand all").
21
+
22
+ This is the Solid counterpart of `@molecule/app-reputation-badge-react`: same
23
+ exports, same props (React names), same DOM for the same input.
24
+
25
+ > **Auto-generated, AI-first package reference** for the [molecule.dev](https://molecule.dev) ecosystem.
26
+ > It is written to be read by coding agents as much as by people, and is generated from this
27
+ > package's source — edit `src/index.ts` JSDoc, not this file.
28
+
29
+ ## Quick Start
30
+
31
+ ```tsx
32
+ import { BadgeShelf, ReputationBadge } from '@molecule/app-reputation-badge-solid'
33
+ import type { Badge } from '@molecule/app-reputation-badge-solid'
34
+
35
+ function ProfileHeader(props: {
36
+ score: number
37
+ badges: Badge[]
38
+ onBadgeClick: (badge: Badge | null) => void
39
+ }) {
40
+ return (
41
+ <div>
42
+ <ReputationBadge score={props.score} variant="full" />
43
+ <BadgeShelf badges={props.badges} limit={5} onClick={props.onBadgeClick} />
44
+ </div>
45
+ )
46
+ }
47
+ ```
48
+
49
+ ## Type
50
+
51
+ `feature`
52
+
53
+ ## Installation
54
+
55
+ ```bash
56
+ npm install @molecule/app-reputation-badge-solid @molecule/app-solid @molecule/app-ui @molecule/app-ui-solid solid-js
57
+ ```
58
+
59
+ ## API
60
+
61
+ ### Interfaces
62
+
63
+ #### `ReputationThresholds`
64
+
65
+ Optional thresholds for deriving a `ReputationLevel` from a numeric score.
66
+
67
+ If a `level` prop isn't passed to `<ReputationBadge>`, the component will
68
+ pick the highest level whose threshold the `score` meets or exceeds.
69
+
70
+ Default thresholds:
71
+
72
+ - `contributor` >= 100
73
+ - `trusted` >= 500
74
+ - `veteran` >= 2000
75
+ - `legend` >= 10000
76
+ - below 100 → `newcomer`
77
+
78
+ ```typescript
79
+ interface ReputationThresholds {
80
+ /** Score >= contributor threshold ⇒ `'contributor'`. */
81
+ contributor: number
82
+ /** Score >= trusted threshold ⇒ `'trusted'`. */
83
+ trusted: number
84
+ /** Score >= veteran threshold ⇒ `'veteran'`. */
85
+ veteran: number
86
+ /** Score >= legend threshold ⇒ `'legend'`. */
87
+ legend: number
88
+ }
89
+ ```
90
+
91
+ #### `Badge`
92
+
93
+ A single earned badge — one icon on the `<BadgeShelf>` row.
94
+
95
+ ```typescript
96
+ interface Badge {
97
+ /** Stable identifier (used as the row key + click payload). */
98
+ id: string
99
+ /** Display name (translated upstream — passed verbatim). */
100
+ name: string
101
+ /** Optional longer description, shown in the native tooltip. */
102
+ description?: string
103
+ /** Icon glyph or short emoji (rendered inline). Mutually exclusive with `iconSrc`. */
104
+ icon?: string
105
+ /** Image URL for the badge icon. */
106
+ iconSrc?: string
107
+ /** ISO date string the badge was earned (passed back via `onClick`). */
108
+ earnedAt?: string
109
+ }
110
+ ```
111
+
112
+ #### `ReputationBadgeProps`
113
+
114
+ Props accepted by the `ReputationBadge` component — the same props
115
+ React's `@molecule/app-reputation-badge-react` accepts.
116
+
117
+ ```typescript
118
+ interface ReputationBadgeProps {
119
+ /** Numeric reputation / karma score. */
120
+ score: number
121
+ /**
122
+ * Explicit reputation level. If omitted, derived from `score` via
123
+ * `levelForScore` using `thresholds` (or `DEFAULT_THRESHOLDS`).
124
+ */
125
+ level?: ReputationLevel
126
+ /** Override the default score → level thresholds. */
127
+ thresholds?: ReputationThresholds
128
+ /**
129
+ * Layout variant.
130
+ * - `'compact'` (default) — score number inline with a small level chip.
131
+ * - `'full'` — stacked layout with a "Reputation" caption above the row.
132
+ */
133
+ variant?: 'compact' | 'full'
134
+ /** Extra classes merged onto the outer wrapper. */
135
+ className?: string
136
+ }
137
+ ```
138
+
139
+ #### `BadgeShelfProps`
140
+
141
+ Props accepted by the `BadgeShelf` component — the same props React's
142
+ `@molecule/app-reputation-badge-react` accepts.
143
+
144
+ ```typescript
145
+ interface BadgeShelfProps {
146
+ /** Earned badges to display, ordered most-prominent-first. */
147
+ badges: Badge[]
148
+ /**
149
+ * Maximum number of badge icons rendered inline. Any remaining are
150
+ * summarised in a trailing `+N` overflow chip.
151
+ *
152
+ * @default 5
153
+ */
154
+ limit?: number
155
+ /**
156
+ * Click handler — invoked with the clicked badge (or `null` when the
157
+ * trailing overflow chip is clicked, signalling "expand all").
158
+ */
159
+ onClick?: (badge: Badge | null) => void
160
+ /** Extra classes merged onto the outer row. */
161
+ className?: string
162
+ }
163
+ ```
164
+
165
+ ### Types
166
+
167
+ #### `ReputationLevel`
168
+
169
+ Reputation level identifiers — used to pick a tier color/label.
170
+
171
+ Apps that need finer granularity can pass a `level` string of any value;
172
+ unknown values fall back to `'newcomer'` styling.
173
+
174
+ ```typescript
175
+ type ReputationLevel = 'newcomer' | 'contributor' | 'trusted' | 'veteran' | 'legend'
176
+ ```
177
+
178
+ ### Functions
179
+
180
+ #### `BadgeShelf(props)`
181
+
182
+ Horizontal row of small badge icons earned by a user — used alongside
183
+ `<ReputationBadge>` to surface community achievements on profile headers,
184
+ post bylines, and detail pages.
185
+
186
+ Each icon shows its name in a native `title` tooltip for low-friction
187
+ accessibility. Clicking a badge invokes `onClick(badge)`; clicking the
188
+ trailing `+N` chip invokes `onClick(null)` so the host page can expand a
189
+ full list.
190
+
191
+ ```typescript
192
+ function BadgeShelf(props: BadgeShelfProps): JSX.Element
193
+ ```
194
+
195
+ - `props` — Component props (see `BadgeShelfProps`).
196
+
197
+ **Returns:** The rendered shelf, or `null` if no badges are supplied.
198
+
199
+ #### `ReputationBadge(props)`
200
+
201
+ User reputation / karma display.
202
+
203
+ Renders a numeric score paired with a tier chip whose color reflects the
204
+ derived (or explicit) `level`. Tier color comes from the active ClassMap
205
+ bond's `cm.badge()` helper, so apps swapping styling libraries restyle these
206
+ chips for free.
207
+
208
+ ```typescript
209
+ function ReputationBadge(props: ReputationBadgeProps): JSX.Element
210
+ ```
211
+
212
+ - `props` — Component props (see `ReputationBadgeProps`).
213
+
214
+ **Returns:** The rendered reputation badge element.
215
+
216
+ #### `levelForScore(score, thresholds)`
217
+
218
+ Derive a {@link ReputationLevel} from a numeric score.
219
+
220
+ Picks the highest level whose threshold is met or exceeded. Any score
221
+ below `thresholds.contributor` returns `'newcomer'`.
222
+
223
+ ```typescript
224
+ function levelForScore(score: number, thresholds?: ReputationThresholds): ReputationLevel
225
+ ```
226
+
227
+ - `score` — Reputation score (any non-negative number).
228
+ - `thresholds` — Optional override thresholds; defaults to {@link DEFAULT_THRESHOLDS}.
229
+
230
+ **Returns:** The derived reputation level.
231
+
232
+ #### `colorForLevel(level)`
233
+
234
+ Return the semantic Badge color for a given level.
235
+
236
+ Unknown levels fall back to `'secondary'`.
237
+
238
+ ```typescript
239
+ function colorForLevel(
240
+ level: ReputationLevel,
241
+ ): 'primary' | 'secondary' | 'success' | 'warning' | 'info'
242
+ ```
243
+
244
+ - `level` — The reputation level.
245
+
246
+ **Returns:** A badge color name from `@molecule/app-ui-vue`.
247
+
248
+ ### Constants
249
+
250
+ #### `DEFAULT_THRESHOLDS`
251
+
252
+ Default thresholds used when no `thresholds` prop is supplied.
253
+
254
+ ```typescript
255
+ const DEFAULT_THRESHOLDS: ReputationThresholds
256
+ ```
257
+
258
+ ## Injection Notes
259
+
260
+ ### Requirements
261
+
262
+ Peer dependencies:
263
+
264
+ - `@molecule/app-solid` ^3.5.0
265
+ - `@molecule/app-ui` ^1.0.1
266
+ - `@molecule/app-ui-solid` ^1.1.0
267
+ - `solid-js` ^1.8.0
268
+
269
+ ### Runtime Dependencies
270
+
271
+ - `@molecule/app-solid`
272
+ - `@molecule/app-ui`
273
+ - `@molecule/app-ui-solid`
274
+ - `solid-js`
275
+
276
+ - Both components throw unless rendered inside `MoleculeProvider` with
277
+ `i18n` (`useTranslation()` needs it) and a ClassMap bonded via
278
+ `setClassMap()`.
279
+ - This package exports a `Badge` TYPE (earned-badge data shape) — distinct
280
+ from the `Badge` COMPONENT in `@molecule/app-ui-solid`; alias one when
281
+ importing both in a file.
282
+ - Server-side score/badge issuance pairs with `@molecule/api-reputation`.
283
+ - Translations live in the companion `@molecule/app-locales-reputation-badge`
284
+ bond (registered).
285
+
286
+ ## Translations
287
+
288
+ Translation strings are provided by `@molecule/app-locales-reputation-badge`.
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Solid earned-badges shelf.
3
+ *
4
+ * Solid counterpart of `@molecule/app-reputation-badge-react`'s `BadgeShelf` —
5
+ * the same props (React names), the same ClassMap tokens, the same i18n keys
6
+ * and the same DOM for the same input.
7
+ *
8
+ * @module
9
+ */
10
+ import type { Component } from 'solid-js';
11
+ import type { BadgeShelfProps } from './types.js';
12
+ /**
13
+ * Horizontal row of small badge icons earned by a user — used alongside
14
+ * `<ReputationBadge>` to surface community achievements on profile headers,
15
+ * post bylines, and detail pages.
16
+ *
17
+ * Each icon shows its name in a native `title` tooltip for low-friction
18
+ * accessibility. Clicking a badge invokes `onClick(badge)`; clicking the
19
+ * trailing `+N` chip invokes `onClick(null)` so the host page can expand a
20
+ * full list.
21
+ *
22
+ * @param props - Component props (see `BadgeShelfProps`).
23
+ * @returns The rendered shelf, or `null` if no badges are supplied.
24
+ */
25
+ export declare const BadgeShelf: Component<BadgeShelfProps>;
26
+ //# sourceMappingURL=BadgeShelf.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BadgeShelf.d.ts","sourceRoot":"","sources":["../src/BadgeShelf.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAMzC,OAAO,KAAK,EAAS,eAAe,EAAE,MAAM,YAAY,CAAA;AAExD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,UAAU,EAAE,SAAS,CAAC,eAAe,CAiHjD,CAAA"}
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Solid earned-badges shelf.
3
+ *
4
+ * Solid counterpart of `@molecule/app-reputation-badge-react`'s `BadgeShelf` —
5
+ * the same props (React names), the same ClassMap tokens, the same i18n keys
6
+ * and the same DOM for the same input.
7
+ *
8
+ * @module
9
+ */
10
+ import { For, Show } from 'solid-js';
11
+ import { useTranslation } from '@molecule/app-solid';
12
+ import { getClassMap } from '@molecule/app-ui';
13
+ /**
14
+ * Horizontal row of small badge icons earned by a user — used alongside
15
+ * `<ReputationBadge>` to surface community achievements on profile headers,
16
+ * post bylines, and detail pages.
17
+ *
18
+ * Each icon shows its name in a native `title` tooltip for low-friction
19
+ * accessibility. Clicking a badge invokes `onClick(badge)`; clicking the
20
+ * trailing `+N` chip invokes `onClick(null)` so the host page can expand a
21
+ * full list.
22
+ *
23
+ * @param props - Component props (see `BadgeShelfProps`).
24
+ * @returns The rendered shelf, or `null` if no badges are supplied.
25
+ */
26
+ export const BadgeShelf = (props) => {
27
+ const cm = getClassMap();
28
+ const { t } = useTranslation();
29
+ const visible = () => (props.badges ?? []).slice(0, props.limit ?? 5);
30
+ const overflow = () => Math.max(0, (props.badges?.length ?? 0) - visible().length);
31
+ const interactive = () => typeof props.onClick === 'function';
32
+ const tooltip = (badge) => badge.description ? `${badge.name} — ${badge.description}` : badge.name;
33
+ const overflowLabel = () => t('badgeShelf.overflow.aria', { count: overflow() }, { defaultValue: 'Show {{count}} more badges' });
34
+ return (<Show when={(props.badges?.length ?? 0) > 0}>
35
+ <ul class={cm.cn(cm.flex({ align: 'center', gap: 'xs' }), props.className)} data-mol-id="badge-shelf" aria-label={t('badgeShelf.aria', { count: props.badges?.length ?? 0 }, { defaultValue: '{{count}} badges earned' })}>
36
+ <For each={visible()}>
37
+ {(badge) => (<li class={cm.cn(cm.flex({ align: 'center', justify: 'center' }))} data-mol-id="badge-shelf-item" data-badge-id={badge.id}>
38
+ {interactive() ? (<button type="button" class={cm.cn(cm.flex({ align: 'center', justify: 'center' }), cm.roundedFull)} onClick={() => props.onClick?.(badge)} title={tooltip(badge)} aria-label={badge.name} data-mol-id="badge-shelf-button">
39
+ {badge.iconSrc ? (<img src={badge.iconSrc} alt="" class={cm.cn(cm.shrink0)} style={{ width: '24px', height: '24px' }} data-mol-id="badge-shelf-icon-img"/>) : (<span aria-hidden="true" data-mol-id="badge-shelf-icon-glyph">
40
+ {badge.icon ?? '*'}
41
+ </span>)}
42
+ </button>) : (<span title={tooltip(badge)} aria-label={badge.name} role="img">
43
+ {badge.iconSrc ? (<img src={badge.iconSrc} alt="" class={cm.cn(cm.shrink0)} style={{ width: '24px', height: '24px' }} data-mol-id="badge-shelf-icon-img"/>) : (<span aria-hidden="true" data-mol-id="badge-shelf-icon-glyph">
44
+ {badge.icon ?? '*'}
45
+ </span>)}
46
+ </span>)}
47
+ </li>)}
48
+ </For>
49
+ <Show when={overflow() > 0}>
50
+ <li class={cm.cn(cm.flex({ align: 'center', justify: 'center' }))} data-mol-id="badge-shelf-overflow">
51
+ <Show when={interactive()} fallback={<span class={cm.cn(cm.textSize('xs'), cm.fontWeight('semibold'))} aria-label={overflowLabel()}>
52
+ +{overflow()}
53
+ </span>}>
54
+ <button type="button" class={cm.cn(cm.flex({ align: 'center', justify: 'center' }), cm.roundedFull, cm.textSize('xs'), cm.fontWeight('semibold'))} onClick={() => props.onClick?.(null)} aria-label={overflowLabel()} data-mol-id="badge-shelf-overflow-button">
55
+ +{overflow()}
56
+ </button>
57
+ </Show>
58
+ </li>
59
+ </Show>
60
+ </ul>
61
+ </Show>);
62
+ };
63
+ //# sourceMappingURL=BadgeShelf.jsx.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BadgeShelf.jsx","sourceRoot":"","sources":["../src/BadgeShelf.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;AAEpC,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAI9C;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,UAAU,GAA+B,CAAC,KAAK,EAAE,EAAE;IAC9D,MAAM,EAAE,GAAG,WAAW,EAAE,CAAA;IACxB,MAAM,EAAE,CAAC,EAAE,GAAG,cAAc,EAAE,CAAA;IAE9B,MAAM,OAAO,GAAG,GAAY,EAAE,CAAC,CAAC,KAAK,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,KAAK,IAAI,CAAC,CAAC,CAAA;IAC9E,MAAM,QAAQ,GAAG,GAAW,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,IAAI,CAAC,CAAC,GAAG,OAAO,EAAE,CAAC,MAAM,CAAC,CAAA;IAC1F,MAAM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R,CAAC,CAED;cAAA,CAAC,MAAM,CACL,IAAI,CAAC,QAAQ,CACb,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,CACV,EAAE,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,EAC/C,EAAE,CAAC,WAAW,EACd,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,EACjB,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,CAC1B,CAAC,CACF,OAAO,CAAC,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,CAAC,CACrC,UAAU,CAAC,CAAC,aAAa,EAAE,CAAC,CAC5B,WAAW,CAAC,6BAA6B,CAEzC;iBAAC,CAAC,QAAQ,EAAE,CACd;cAAA,EAAE,MAAM,CACV;YAAA,EAAE,IAAI,CACR;UAAA,EAAE,EAAE,CACN;QAAA,EAAE,IAAI,CACR;MAAA,EAAE,EAAE,CACN;IAAA,EAAE,IAAI,CAAC,CACR,CAAA;AACH,CAAC,CAAA"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Solid user reputation / karma display.
3
+ *
4
+ * Solid counterpart of `@molecule/app-reputation-badge-react`'s
5
+ * `ReputationBadge` — the same props (React names), the same ClassMap tokens,
6
+ * the same i18n keys and the same DOM for the same input.
7
+ *
8
+ * @module
9
+ */
10
+ import type { Component } from 'solid-js';
11
+ import type { ReputationBadgeProps } from './types.js';
12
+ /**
13
+ * User reputation / karma display.
14
+ *
15
+ * Renders a numeric score paired with a tier chip whose color reflects the
16
+ * derived (or explicit) `level`. Tier color comes from the active ClassMap
17
+ * bond's `cm.badge()` helper, so apps swapping styling libraries restyle these
18
+ * chips for free.
19
+ *
20
+ * @param props - Component props (see `ReputationBadgeProps`).
21
+ * @returns The rendered reputation badge element.
22
+ */
23
+ export declare const ReputationBadge: Component<ReputationBadgeProps>;
24
+ //# sourceMappingURL=ReputationBadge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReputationBadge.d.ts","sourceRoot":"","sources":["../src/ReputationBadge.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAOzC,OAAO,KAAK,EAAE,oBAAoB,EAAmB,MAAM,YAAY,CAAA;AAoEvE;;;;;;;;;;GAUG;AACH,eAAO,MAAM,eAAe,EAAE,SAAS,CAAC,oBAAoB,CAmD3D,CAAA"}
@@ -0,0 +1,113 @@
1
+ /**
2
+ * Solid user reputation / karma display.
3
+ *
4
+ * Solid counterpart of `@molecule/app-reputation-badge-react`'s
5
+ * `ReputationBadge` — the same props (React names), the same ClassMap tokens,
6
+ * the same i18n keys and the same DOM for the same input.
7
+ *
8
+ * @module
9
+ */
10
+ import { useTranslation } from '@molecule/app-solid';
11
+ import { getClassMap } from '@molecule/app-ui';
12
+ import { Badge } from '@molecule/app-ui-solid';
13
+ import { colorForLevel, DEFAULT_THRESHOLDS, levelForScore } from './levels.js';
14
+ /**
15
+ * Resolve a level's translated label — exactly React's `levelLabel`: one
16
+ * LITERAL i18n key per in-contract level, and the literal
17
+ * `reputationBadge.level.fallback` key (whose English is the bare `{{level}}`
18
+ * placeholder, so an unknown id renders as itself) for anything else.
19
+ *
20
+ * Literal keys, never one built from the level id: the i18n gate can only see
21
+ * literal keys, so a key built at runtime that no locale bond carries leaves
22
+ * every non-English user on English with nothing reporting it.
23
+ *
24
+ * @param t - The bonded translate function.
25
+ * @param level - The level id (may be out of contract).
26
+ * @returns The translated label.
27
+ */
28
+ function levelLabel(t, level) {
29
+ switch (level) {
30
+ case 'newcomer':
31
+ return t('reputationBadge.level.newcomer', {}, { defaultValue: 'Newcomer' });
32
+ case 'contributor':
33
+ return t('reputationBadge.level.contributor', {}, { defaultValue: 'Contributor' });
34
+ case 'trusted':
35
+ return t('reputationBadge.level.trusted', {}, { defaultValue: 'Trusted' });
36
+ case 'veteran':
37
+ return t('reputationBadge.level.veteran', {}, { defaultValue: 'Veteran' });
38
+ case 'legend':
39
+ return t('reputationBadge.level.legend', {}, { defaultValue: 'Legend' });
40
+ default:
41
+ return t('reputationBadge.level.fallback', { level }, { defaultValue: '{{level}}' });
42
+ }
43
+ }
44
+ /**
45
+ * Compact-thousands formatter — keeps the badge readable at large scores.
46
+ *
47
+ * Examples: `42` → `"42"`, `1500` → `"1.5k"`, `12300` → `"12.3k"`,
48
+ * `1_250_000` → `"1.3m"`.
49
+ *
50
+ * @param score - The score to format.
51
+ * @returns A short human-readable string.
52
+ */
53
+ function formatScore(score) {
54
+ if (!Number.isFinite(score))
55
+ return '0';
56
+ const sign = score < 0 ? '-' : '';
57
+ const abs = Math.abs(score);
58
+ if (abs >= 1_000_000) {
59
+ return `${sign}${trimZero((abs / 1_000_000).toFixed(1))}m`;
60
+ }
61
+ if (abs >= 1_000) {
62
+ return `${sign}${trimZero((abs / 1_000).toFixed(1))}k`;
63
+ }
64
+ return `${sign}${Math.round(abs)}`;
65
+ }
66
+ /**
67
+ * Drop a trailing `.0` from a fixed-precision number string.
68
+ *
69
+ * @param s - The fixed-precision string (e.g. `"1.0"`).
70
+ * @returns The cleaned string (e.g. `"1"`).
71
+ */
72
+ function trimZero(s) {
73
+ return s.endsWith('.0') ? s.slice(0, -2) : s;
74
+ }
75
+ /**
76
+ * User reputation / karma display.
77
+ *
78
+ * Renders a numeric score paired with a tier chip whose color reflects the
79
+ * derived (or explicit) `level`. Tier color comes from the active ClassMap
80
+ * bond's `cm.badge()` helper, so apps swapping styling libraries restyle these
81
+ * chips for free.
82
+ *
83
+ * @param props - Component props (see `ReputationBadgeProps`).
84
+ * @returns The rendered reputation badge element.
85
+ */
86
+ export const ReputationBadge = (props) => {
87
+ const cm = getClassMap();
88
+ const { t } = useTranslation();
89
+ const resolvedLevel = () => props.level ?? levelForScore(props.score, props.thresholds ?? DEFAULT_THRESHOLDS);
90
+ const color = () => colorForLevel(resolvedLevel());
91
+ const label = () => levelLabel(t, resolvedLevel());
92
+ const formattedScore = () => formatScore(props.score);
93
+ const ariaLabel = () => t('reputationBadge.aria', { score: formattedScore(), level: label() }, { defaultValue: '{{score}} reputation, {{level}}' });
94
+ return (<>
95
+ {props.variant === 'full' ? (<div class={cm.cn(cm.stack(1), props.className)} data-mol-id="reputation-badge" aria-label={ariaLabel()}>
96
+ <span class={cm.cn(cm.textSize('xs'), cm.fontWeight('medium'))}>
97
+ {t('reputationBadge.caption', {}, { defaultValue: 'Reputation' })}
98
+ </span>
99
+ <div class={cm.flex({ align: 'center', gap: 'sm' })} data-mol-id="reputation-badge-row">
100
+ <span class={cm.cn(cm.textSize('lg'), cm.fontWeight('bold'))} data-mol-id="reputation-badge-score">
101
+ {formattedScore()}
102
+ </span>
103
+ <Badge color={color()}>{label()}</Badge>
104
+ </div>
105
+ </div>) : (<span class={cm.cn(cm.flex({ align: 'center', gap: 'xs' }), props.className)} data-mol-id="reputation-badge" aria-label={ariaLabel()}>
106
+ <span class={cm.fontWeight('semibold')} data-mol-id="reputation-badge-score">
107
+ {formattedScore()}
108
+ </span>
109
+ <Badge color={color()}>{label()}</Badge>
110
+ </span>)}
111
+ </>);
112
+ };
113
+ //# sourceMappingURL=ReputationBadge.jsx.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReputationBadge.jsx","sourceRoot":"","sources":["../src/ReputationBadge.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AAE9C,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAM9E;;;;;;;;;;;;;GAaG;AACH,SAAS,UAAU,CAAC,CAAY,EAAE,KAAsB;IACtD,QAAQ,KAAK,EAAE,CAAC;QACd,KAAK,UAAU;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AAC,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC,CACvE,WAAW,CAAC,kBAAkB,CAC9B,UAAU,CAAC,CAAC,SAAS,EAAE,CAAC,CAExB;UAAA,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC,WAAW,CAAC,wBAAwB,CAC1E;YAAA,CAAC,cAAc,EAAE,CACnB;UAAA,EAAE,IAAI,CACN;UAAA,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,EAAE,KAAK,CACzC;QAAA,EAAE,IAAI,CAAC,CACR,CACH;IAAA,GAAG,CACJ,CAAA;AACH,CAAC,CAAA"}
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Solid reputation/karma surfaces — `<ReputationBadge>` and `<BadgeShelf>` —
3
+ * for forum, discussion-board, and social flagships.
4
+ *
5
+ * `<ReputationBadge score={n} />` renders a compact-formatted score ("1.5k")
6
+ * plus a tier chip; the tier derives from `score` via `levelForScore` and
7
+ * `DEFAULT_THRESHOLDS` (contributor 100, trusted 500, veteran 2000,
8
+ * legend 10000) unless you pass `level` or `thresholds`. `variant` is
9
+ * `'compact'` (default) or `'full'` (stacked with a "Reputation" caption).
10
+ * `<BadgeShelf badges limit onClick />` renders earned-badge icons with a
11
+ * trailing `+N` overflow chip (`onClick(null)` signals "expand all").
12
+ *
13
+ * This is the Solid counterpart of `@molecule/app-reputation-badge-react`: same
14
+ * exports, same props (React names), same DOM for the same input.
15
+ *
16
+ * @example
17
+ * ```tsx
18
+ * import { BadgeShelf, ReputationBadge } from '@molecule/app-reputation-badge-solid'
19
+ * import type { Badge } from '@molecule/app-reputation-badge-solid'
20
+ *
21
+ * function ProfileHeader(props: {
22
+ * score: number
23
+ * badges: Badge[]
24
+ * onBadgeClick: (badge: Badge | null) => void
25
+ * }) {
26
+ * return (
27
+ * <div>
28
+ * <ReputationBadge score={props.score} variant="full" />
29
+ * <BadgeShelf badges={props.badges} limit={5} onClick={props.onBadgeClick} />
30
+ * </div>
31
+ * )
32
+ * }
33
+ * ```
34
+ *
35
+ * @remarks
36
+ * - Both components throw unless rendered inside `MoleculeProvider` with
37
+ * `i18n` (`useTranslation()` needs it) and a ClassMap bonded via
38
+ * `setClassMap()`.
39
+ * - This package exports a `Badge` TYPE (earned-badge data shape) — distinct
40
+ * from the `Badge` COMPONENT in `@molecule/app-ui-solid`; alias one when
41
+ * importing both in a file.
42
+ * - Server-side score/badge issuance pairs with `@molecule/api-reputation`.
43
+ * - Translations live in the companion `@molecule/app-locales-reputation-badge`
44
+ * bond (registered).
45
+ *
46
+ * @module
47
+ */
48
+ export * from './BadgeShelf.jsx';
49
+ export * from './levels.js';
50
+ export * from './ReputationBadge.jsx';
51
+ export * from './types.js';
52
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AAEH,cAAc,kBAAkB,CAAA;AAChC,cAAc,aAAa,CAAA;AAC3B,cAAc,uBAAuB,CAAA;AACrC,cAAc,YAAY,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Solid reputation/karma surfaces — `<ReputationBadge>` and `<BadgeShelf>` —
3
+ * for forum, discussion-board, and social flagships.
4
+ *
5
+ * `<ReputationBadge score={n} />` renders a compact-formatted score ("1.5k")
6
+ * plus a tier chip; the tier derives from `score` via `levelForScore` and
7
+ * `DEFAULT_THRESHOLDS` (contributor 100, trusted 500, veteran 2000,
8
+ * legend 10000) unless you pass `level` or `thresholds`. `variant` is
9
+ * `'compact'` (default) or `'full'` (stacked with a "Reputation" caption).
10
+ * `<BadgeShelf badges limit onClick />` renders earned-badge icons with a
11
+ * trailing `+N` overflow chip (`onClick(null)` signals "expand all").
12
+ *
13
+ * This is the Solid counterpart of `@molecule/app-reputation-badge-react`: same
14
+ * exports, same props (React names), same DOM for the same input.
15
+ *
16
+ * @example
17
+ * ```tsx
18
+ * import { BadgeShelf, ReputationBadge } from '@molecule/app-reputation-badge-solid'
19
+ * import type { Badge } from '@molecule/app-reputation-badge-solid'
20
+ *
21
+ * function ProfileHeader(props: {
22
+ * score: number
23
+ * badges: Badge[]
24
+ * onBadgeClick: (badge: Badge | null) => void
25
+ * }) {
26
+ * return (
27
+ * <div>
28
+ * <ReputationBadge score={props.score} variant="full" />
29
+ * <BadgeShelf badges={props.badges} limit={5} onClick={props.onBadgeClick} />
30
+ * </div>
31
+ * )
32
+ * }
33
+ * ```
34
+ *
35
+ * @remarks
36
+ * - Both components throw unless rendered inside `MoleculeProvider` with
37
+ * `i18n` (`useTranslation()` needs it) and a ClassMap bonded via
38
+ * `setClassMap()`.
39
+ * - This package exports a `Badge` TYPE (earned-badge data shape) — distinct
40
+ * from the `Badge` COMPONENT in `@molecule/app-ui-solid`; alias one when
41
+ * importing both in a file.
42
+ * - Server-side score/badge issuance pairs with `@molecule/api-reputation`.
43
+ * - Translations live in the companion `@molecule/app-locales-reputation-badge`
44
+ * bond (registered).
45
+ *
46
+ * @module
47
+ */
48
+ export * from './BadgeShelf.jsx';
49
+ export * from './levels.js';
50
+ export * from './ReputationBadge.jsx';
51
+ export * from './types.js';
52
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AAEH,cAAc,kBAAkB,CAAA;AAChC,cAAc,aAAa,CAAA;AAC3B,cAAc,uBAAuB,CAAA;AACrC,cAAc,YAAY,CAAA"}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Pure helpers for mapping reputation scores to levels and tier colors.
3
+ *
4
+ * Kept framework-free so they're trivially unit-testable, and identical to
5
+ * `@molecule/app-reputation-badge-react`'s helpers so both packages agree on
6
+ * every derivation.
7
+ *
8
+ * @module
9
+ */
10
+ import type { ReputationLevel, ReputationThresholds } from './types.js';
11
+ /**
12
+ * Default thresholds used when no `thresholds` prop is supplied.
13
+ */
14
+ export declare const DEFAULT_THRESHOLDS: ReputationThresholds;
15
+ /**
16
+ * Derive a {@link ReputationLevel} from a numeric score.
17
+ *
18
+ * Picks the highest level whose threshold is met or exceeded. Any score
19
+ * below `thresholds.contributor` returns `'newcomer'`.
20
+ *
21
+ * @param score - Reputation score (any non-negative number).
22
+ * @param thresholds - Optional override thresholds; defaults to {@link DEFAULT_THRESHOLDS}.
23
+ * @returns The derived reputation level.
24
+ */
25
+ export declare function levelForScore(score: number, thresholds?: ReputationThresholds): ReputationLevel;
26
+ /**
27
+ * Return the semantic Badge color for a given level.
28
+ *
29
+ * Unknown levels fall back to `'secondary'`.
30
+ *
31
+ * @param level - The reputation level.
32
+ * @returns A badge color name from `@molecule/app-ui-vue`.
33
+ */
34
+ export declare function colorForLevel(level: ReputationLevel): 'primary' | 'secondary' | 'success' | 'warning' | 'info';
35
+ //# sourceMappingURL=levels.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"levels.d.ts","sourceRoot":"","sources":["../src/levels.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA;AAEvE;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,oBAKhC,CAAA;AAED;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAC3B,KAAK,EAAE,MAAM,EACb,UAAU,GAAE,oBAAyC,GACpD,eAAe,CAMjB;AAmBD;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAC3B,KAAK,EAAE,eAAe,GACrB,SAAS,GAAG,WAAW,GAAG,SAAS,GAAG,SAAS,GAAG,MAAM,CAE1D"}
package/dist/levels.js ADDED
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Pure helpers for mapping reputation scores to levels and tier colors.
3
+ *
4
+ * Kept framework-free so they're trivially unit-testable, and identical to
5
+ * `@molecule/app-reputation-badge-react`'s helpers so both packages agree on
6
+ * every derivation.
7
+ *
8
+ * @module
9
+ */
10
+ /**
11
+ * Default thresholds used when no `thresholds` prop is supplied.
12
+ */
13
+ export const DEFAULT_THRESHOLDS = {
14
+ contributor: 100,
15
+ trusted: 500,
16
+ veteran: 2000,
17
+ legend: 10000,
18
+ };
19
+ /**
20
+ * Derive a {@link ReputationLevel} from a numeric score.
21
+ *
22
+ * Picks the highest level whose threshold is met or exceeded. Any score
23
+ * below `thresholds.contributor` returns `'newcomer'`.
24
+ *
25
+ * @param score - Reputation score (any non-negative number).
26
+ * @param thresholds - Optional override thresholds; defaults to {@link DEFAULT_THRESHOLDS}.
27
+ * @returns The derived reputation level.
28
+ */
29
+ export function levelForScore(score, thresholds = DEFAULT_THRESHOLDS) {
30
+ if (score >= thresholds.legend)
31
+ return 'legend';
32
+ if (score >= thresholds.veteran)
33
+ return 'veteran';
34
+ if (score >= thresholds.trusted)
35
+ return 'trusted';
36
+ if (score >= thresholds.contributor)
37
+ return 'contributor';
38
+ return 'newcomer';
39
+ }
40
+ /**
41
+ * Maps a {@link ReputationLevel} to the semantic Badge color used by the
42
+ * shared `<Badge>` component (`@molecule/app-ui-solid`).
43
+ *
44
+ * Apps that swap the ClassMap bond automatically restyle these chips.
45
+ */
46
+ const LEVEL_TO_COLOR = {
47
+ newcomer: 'secondary',
48
+ contributor: 'info',
49
+ trusted: 'primary',
50
+ veteran: 'success',
51
+ legend: 'warning',
52
+ };
53
+ /**
54
+ * Return the semantic Badge color for a given level.
55
+ *
56
+ * Unknown levels fall back to `'secondary'`.
57
+ *
58
+ * @param level - The reputation level.
59
+ * @returns A badge color name from `@molecule/app-ui-vue`.
60
+ */
61
+ export function colorForLevel(level) {
62
+ return LEVEL_TO_COLOR[level] ?? 'secondary';
63
+ }
64
+ //# sourceMappingURL=levels.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"levels.js","sourceRoot":"","sources":["../src/levels.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAyB;IACtD,WAAW,EAAE,GAAG;IAChB,OAAO,EAAE,GAAG;IACZ,OAAO,EAAE,IAAI;IACb,MAAM,EAAE,KAAK;CACd,CAAA;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,aAAa,CAC3B,KAAa,EACb,aAAmC,kBAAkB;IAErD,IAAI,KAAK,IAAI,UAAU,CAAC,MAAM;QAAE,OAAO,QAAQ,CAAA;IAC/C,IAAI,KAAK,IAAI,UAAU,CAAC,OAAO;QAAE,OAAO,SAAS,CAAA;IACjD,IAAI,KAAK,IAAI,UAAU,CAAC,OAAO;QAAE,OAAO,SAAS,CAAA;IACjD,IAAI,KAAK,IAAI,UAAU,CAAC,WAAW;QAAE,OAAO,aAAa,CAAA;IACzD,OAAO,UAAU,CAAA;AACnB,CAAC;AAED;;;;;GAKG;AACH,MAAM,cAAc,GAGhB;IACF,QAAQ,EAAE,WAAW;IACrB,WAAW,EAAE,MAAM;IACnB,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,SAAS;IAClB,MAAM,EAAE,SAAS;CAClB,CAAA;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,aAAa,CAC3B,KAAsB;IAEtB,OAAO,cAAc,CAAC,KAAK,CAAC,IAAI,WAAW,CAAA;AAC7C,CAAC"}
@@ -0,0 +1,98 @@
1
+ /**
2
+ * Public types for the reputation-badge-solid feature.
3
+ *
4
+ * @module
5
+ */
6
+ /**
7
+ * Reputation level identifiers — used to pick a tier color/label.
8
+ *
9
+ * Apps that need finer granularity can pass a `level` string of any value;
10
+ * unknown values fall back to `'newcomer'` styling.
11
+ */
12
+ export type ReputationLevel = 'newcomer' | 'contributor' | 'trusted' | 'veteran' | 'legend';
13
+ /**
14
+ * Optional thresholds for deriving a `ReputationLevel` from a numeric score.
15
+ *
16
+ * If a `level` prop isn't passed to `<ReputationBadge>`, the component will
17
+ * pick the highest level whose threshold the `score` meets or exceeds.
18
+ *
19
+ * Default thresholds:
20
+ * - `contributor` >= 100
21
+ * - `trusted` >= 500
22
+ * - `veteran` >= 2000
23
+ * - `legend` >= 10000
24
+ * - below 100 → `newcomer`
25
+ */
26
+ export interface ReputationThresholds {
27
+ /** Score >= contributor threshold ⇒ `'contributor'`. */
28
+ contributor: number;
29
+ /** Score >= trusted threshold ⇒ `'trusted'`. */
30
+ trusted: number;
31
+ /** Score >= veteran threshold ⇒ `'veteran'`. */
32
+ veteran: number;
33
+ /** Score >= legend threshold ⇒ `'legend'`. */
34
+ legend: number;
35
+ }
36
+ /**
37
+ * A single earned badge — one icon on the `<BadgeShelf>` row.
38
+ */
39
+ export interface Badge {
40
+ /** Stable identifier (used as the row key + click payload). */
41
+ id: string;
42
+ /** Display name (translated upstream — passed verbatim). */
43
+ name: string;
44
+ /** Optional longer description, shown in the native tooltip. */
45
+ description?: string;
46
+ /** Icon glyph or short emoji (rendered inline). Mutually exclusive with `iconSrc`. */
47
+ icon?: string;
48
+ /** Image URL for the badge icon. */
49
+ iconSrc?: string;
50
+ /** ISO date string the badge was earned (passed back via `onClick`). */
51
+ earnedAt?: string;
52
+ }
53
+ /**
54
+ * Props accepted by the `ReputationBadge` component — the same props
55
+ * React's `@molecule/app-reputation-badge-react` accepts.
56
+ */
57
+ export interface ReputationBadgeProps {
58
+ /** Numeric reputation / karma score. */
59
+ score: number;
60
+ /**
61
+ * Explicit reputation level. If omitted, derived from `score` via
62
+ * `levelForScore` using `thresholds` (or `DEFAULT_THRESHOLDS`).
63
+ */
64
+ level?: ReputationLevel;
65
+ /** Override the default score → level thresholds. */
66
+ thresholds?: ReputationThresholds;
67
+ /**
68
+ * Layout variant.
69
+ * - `'compact'` (default) — score number inline with a small level chip.
70
+ * - `'full'` — stacked layout with a "Reputation" caption above the row.
71
+ */
72
+ variant?: 'compact' | 'full';
73
+ /** Extra classes merged onto the outer wrapper. */
74
+ className?: string;
75
+ }
76
+ /**
77
+ * Props accepted by the `BadgeShelf` component — the same props React's
78
+ * `@molecule/app-reputation-badge-react` accepts.
79
+ */
80
+ export interface BadgeShelfProps {
81
+ /** Earned badges to display, ordered most-prominent-first. */
82
+ badges: Badge[];
83
+ /**
84
+ * Maximum number of badge icons rendered inline. Any remaining are
85
+ * summarised in a trailing `+N` overflow chip.
86
+ *
87
+ * @default 5
88
+ */
89
+ limit?: number;
90
+ /**
91
+ * Click handler — invoked with the clicked badge (or `null` when the
92
+ * trailing overflow chip is clicked, signalling "expand all").
93
+ */
94
+ onClick?: (badge: Badge | null) => void;
95
+ /** Extra classes merged onto the outer row. */
96
+ className?: string;
97
+ }
98
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;GAKG;AACH,MAAM,MAAM,eAAe,GAAG,UAAU,GAAG,aAAa,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAA;AAE3F;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,oBAAoB;IACnC,wDAAwD;IACxD,WAAW,EAAE,MAAM,CAAA;IACnB,gDAAgD;IAChD,OAAO,EAAE,MAAM,CAAA;IACf,gDAAgD;IAChD,OAAO,EAAE,MAAM,CAAA;IACf,8CAA8C;IAC9C,MAAM,EAAE,MAAM,CAAA;CACf;AAED;;GAEG;AACH,MAAM,WAAW,KAAK;IACpB,+DAA+D;IAC/D,EAAE,EAAE,MAAM,CAAA;IACV,4DAA4D;IAC5D,IAAI,EAAE,MAAM,CAAA;IACZ,gEAAgE;IAChE,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,sFAAsF;IACtF,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,oCAAoC;IACpC,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,wEAAwE;IACxE,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC,wCAAwC;IACxC,KAAK,EAAE,MAAM,CAAA;IACb;;;OAGG;IACH,KAAK,CAAC,EAAE,eAAe,CAAA;IACvB,qDAAqD;IACrD,UAAU,CAAC,EAAE,oBAAoB,CAAA;IACjC;;;;OAIG;IACH,OAAO,CAAC,EAAE,SAAS,GAAG,MAAM,CAAA;IAC5B,mDAAmD;IACnD,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,8DAA8D;IAC9D,MAAM,EAAE,KAAK,EAAE,CAAA;IACf;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;;OAGG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,KAAK,IAAI,CAAA;IACvC,+CAA+C;IAC/C,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB"}
package/dist/types.js ADDED
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Public types for the reputation-badge-solid feature.
3
+ *
4
+ * @module
5
+ */
6
+ export {};
7
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
package/package.json CHANGED
@@ -1,6 +1,66 @@
1
1
  {
2
2
  "name": "@molecule/app-reputation-badge-solid",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "1.1.0",
4
+ "description": "User reputation/karma badge with score, level chip, and earned-badges shelf",
5
+ "homepage": "https://www.molecule.dev/packages/app-reputation-badge-solid",
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": "tsc",
21
+ "dev": "tsc --watch",
22
+ "test": "vitest run",
23
+ "test:watch": "vitest"
24
+ },
25
+ "keywords": [
26
+ "molecule",
27
+ "reputation",
28
+ "badge",
29
+ "karma",
30
+ "solid"
31
+ ],
32
+ "author": "Molecule Dev, Inc. (https://molecule.dev)",
33
+ "license": "Apache-2.0",
34
+ "repository": {
35
+ "type": "git",
36
+ "url": "https://github.com/molecule-dev/molecule.git",
37
+ "directory": "packages/app/features/reputation-badge-solid"
38
+ },
39
+ "engines": {
40
+ "node": ">=20"
41
+ },
42
+ "bugs": "https://github.com/molecule-dev/molecule/issues",
43
+ "publishConfig": {
44
+ "access": "public"
45
+ },
46
+ "peerDependencies": {
47
+ "@molecule/app-solid": "^3.5.0",
48
+ "@molecule/app-ui": "^1.0.1",
49
+ "@molecule/app-ui-solid": "^1.1.0",
50
+ "solid-js": "^1.8.0"
51
+ },
52
+ "devDependencies": {
53
+ "@molecule/app-framework-conformance": "0.0.0",
54
+ "@molecule/app-i18n": "1.2.2",
55
+ "@molecule/app-icons": "1.0.4",
56
+ "@molecule/app-solid": "3.9.0",
57
+ "@molecule/app-ui": "1.5.0",
58
+ "@molecule/app-ui-solid": "1.2.1",
59
+ "@types/node": "26.6.5",
60
+ "jsdom": "30.1.3",
61
+ "solid-js": "1.9.17",
62
+ "typescript": "6.0.3",
63
+ "vite-plugin-solid": "2.11.15",
64
+ "vitest": "4.1.12"
65
+ }
66
+ }