@molecule/app-forum-thread-row-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 +202 -0
- package/README.md +386 -2
- package/dist/forum-thread-row.component.d.ts +215 -0
- package/dist/forum-thread-row.component.d.ts.map +1 -0
- package/dist/forum-thread-row.component.js +507 -0
- package/dist/forum-thread-row.component.js.map +1 -0
- package/dist/index.d.ts +61 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +61 -0
- package/dist/index.js.map +1 -0
- package/dist/slot-dom.d.ts +63 -0
- package/dist/slot-dom.d.ts.map +1 -0
- package/dist/slot-dom.js +109 -0
- package/dist/slot-dom.js.map +1 -0
- package/dist/types.d.ts +43 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +8 -0
- package/dist/types.js.map +1 -0
- package/package.json +69 -4
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ForumThreadRow component (React parity).
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import { type AfterViewInit, type DoCheck, ElementRef } from '@angular/core';
|
|
7
|
+
import type { UIClassMap } from '@molecule/app-ui';
|
|
8
|
+
import * as i0 from "@angular/core";
|
|
9
|
+
/**
|
|
10
|
+
* ForumThreadRow component.
|
|
11
|
+
*
|
|
12
|
+
* Forum / discussion-board thread row. Shows the title, optional excerpt, vote
|
|
13
|
+
* score + reply/view counts, pin/lock badges, author, and timestamp. The host
|
|
14
|
+
* IS the root `<article>` (`article[mol-forum-thread-row]`), matching React's
|
|
15
|
+
* root exactly. The counter labels ("votes", "replies", "views") and the
|
|
16
|
+
* pin/lock aria-labels are the same hardcoded English React renders (React has
|
|
17
|
+
* no companion locale bond yet).
|
|
18
|
+
*
|
|
19
|
+
* The node props are projected slots: `title`, `excerpt`, `author`,
|
|
20
|
+
* `createdAt`, `tags` and `voteControls` each render inside the wrapper
|
|
21
|
+
* element React renders for them. String inputs render as text instead —
|
|
22
|
+
* React's truthiness branch applies: an empty string renders nothing. The
|
|
23
|
+
* capture wrappers reconcile against that in {@link ForumThreadRow.ngDoCheck}.
|
|
24
|
+
*/
|
|
25
|
+
export declare class ForumThreadRow implements AfterViewInit, DoCheck {
|
|
26
|
+
/** Thread title (string/number renders as text; nodes are `[slot=title]` content). */
|
|
27
|
+
title?: unknown;
|
|
28
|
+
/** Optional snippet of the OP body (string as text; nodes are `[slot=excerpt]` content). */
|
|
29
|
+
excerpt?: unknown;
|
|
30
|
+
/** Aggregate vote score / upvotes (React's `!== undefined` branch). */
|
|
31
|
+
voteScore?: number;
|
|
32
|
+
/** Reply count (React's `!== undefined` branch). */
|
|
33
|
+
replyCount?: number;
|
|
34
|
+
/** View count (React's `!== undefined` branch). */
|
|
35
|
+
viewCount?: number;
|
|
36
|
+
/** Optional pinned indicator. */
|
|
37
|
+
pinned?: boolean;
|
|
38
|
+
/** Optional locked indicator. */
|
|
39
|
+
locked?: boolean;
|
|
40
|
+
/** Author display (string as text; nodes are `[slot=author]` content). */
|
|
41
|
+
author?: unknown;
|
|
42
|
+
/** Created-at display (string as text; nodes are `[slot=createdAt]` content). */
|
|
43
|
+
createdAt?: unknown;
|
|
44
|
+
/** Tag chips (string as text; nodes are `[slot=tags]` content). */
|
|
45
|
+
tags?: unknown;
|
|
46
|
+
/** Right-side voting controls (string as text; nodes are `[slot=voteControls]` content). */
|
|
47
|
+
voteControls?: unknown;
|
|
48
|
+
/** Click handler; receives the DOM click event (React's `onClick`). */
|
|
49
|
+
onClick?: (event: Event) => void;
|
|
50
|
+
/** Extra classes. */
|
|
51
|
+
className?: string;
|
|
52
|
+
/** The vote-controls wrapper `<div>` (detached when the slot is empty). */
|
|
53
|
+
voteControlsWrap?: ElementRef<HTMLElement>;
|
|
54
|
+
/** The score `<div>` (detached when React would not render it). */
|
|
55
|
+
scoreWrap?: ElementRef<HTMLElement>;
|
|
56
|
+
/** The excerpt `<p>` (detached when no excerpt input and the slot is empty). */
|
|
57
|
+
excerptWrap?: ElementRef<HTMLElement>;
|
|
58
|
+
/** The author `<span>` (detached when no author input and the slot is empty). */
|
|
59
|
+
authorWrap?: ElementRef<HTMLElement>;
|
|
60
|
+
/** The created-at `<span>` (detached when no createdAt input and the slot is empty). */
|
|
61
|
+
createdAtWrap?: ElementRef<HTMLElement>;
|
|
62
|
+
/** The tags wrapper `<div>` (detached when no tags input and the slot is empty). */
|
|
63
|
+
tagsWrap?: ElementRef<HTMLElement>;
|
|
64
|
+
private readonly guard;
|
|
65
|
+
/**
|
|
66
|
+
* The current class map.
|
|
67
|
+
* @returns The UIClassMap.
|
|
68
|
+
*/
|
|
69
|
+
cm(): UIClassMap;
|
|
70
|
+
/**
|
|
71
|
+
* Computes the row's class list (`cm.flex({ align: 'start', gap: 'sm' })` +
|
|
72
|
+
* `cm.sp('p', 3)` + `cm.cursorPointer` only with an `onClick` +
|
|
73
|
+
* `className`).
|
|
74
|
+
* @returns The class string.
|
|
75
|
+
*/
|
|
76
|
+
classes(): string;
|
|
77
|
+
/**
|
|
78
|
+
* Computes the vote-controls wrapper's class (`cm.shrink0`).
|
|
79
|
+
* @returns The class string.
|
|
80
|
+
*/
|
|
81
|
+
voteControlsClasses(): string;
|
|
82
|
+
/**
|
|
83
|
+
* Computes the score block's class (`cm.shrink0` + `cm.textCenter` +
|
|
84
|
+
* `cm.stack(0)`).
|
|
85
|
+
* @returns The class string.
|
|
86
|
+
*/
|
|
87
|
+
scoreClasses(): string;
|
|
88
|
+
/**
|
|
89
|
+
* Computes the score value's class (`cm.textSize('sm')` +
|
|
90
|
+
* `cm.fontWeight('bold')`).
|
|
91
|
+
* @returns The class string.
|
|
92
|
+
*/
|
|
93
|
+
scoreValueClasses(): string;
|
|
94
|
+
/**
|
|
95
|
+
* Computes the "votes" label's class (`cm.textSize('xs')`).
|
|
96
|
+
* @returns The class string.
|
|
97
|
+
*/
|
|
98
|
+
scoreLabelClasses(): string;
|
|
99
|
+
/**
|
|
100
|
+
* Computes the stack's class (`cm.flex1` + `cm.stack(1)`).
|
|
101
|
+
* @returns The class string.
|
|
102
|
+
*/
|
|
103
|
+
stackClasses(): string;
|
|
104
|
+
/**
|
|
105
|
+
* Computes the header's class (`cm.flex({ align: 'center', gap: 'sm',
|
|
106
|
+
* wrap: 'wrap' })`).
|
|
107
|
+
* @returns The class string.
|
|
108
|
+
*/
|
|
109
|
+
headerClasses(): string;
|
|
110
|
+
/**
|
|
111
|
+
* Computes the title's class (`cm.textSize('base')` +
|
|
112
|
+
* `cm.fontWeight('semibold')`).
|
|
113
|
+
* @returns The class string.
|
|
114
|
+
*/
|
|
115
|
+
titleClasses(): string;
|
|
116
|
+
/**
|
|
117
|
+
* Computes the excerpt's class (`cm.textSize('sm')`).
|
|
118
|
+
* @returns The class string.
|
|
119
|
+
*/
|
|
120
|
+
excerptClasses(): string;
|
|
121
|
+
/**
|
|
122
|
+
* Computes the meta row's class (`cm.flex({ align: 'center', gap: 'sm',
|
|
123
|
+
* wrap: 'wrap' })`).
|
|
124
|
+
* @returns The class string.
|
|
125
|
+
*/
|
|
126
|
+
metaClasses(): string;
|
|
127
|
+
/**
|
|
128
|
+
* Computes the author span's class (`cm.textSize('xs')` +
|
|
129
|
+
* `cm.fontWeight('semibold')`).
|
|
130
|
+
* @returns The class string.
|
|
131
|
+
*/
|
|
132
|
+
authorClasses(): string;
|
|
133
|
+
/**
|
|
134
|
+
* Computes the created-at span's class (`cm.textSize('xs')`).
|
|
135
|
+
* @returns The class string.
|
|
136
|
+
*/
|
|
137
|
+
createdAtClasses(): string;
|
|
138
|
+
/**
|
|
139
|
+
* Computes the reply/view count spans' class (`cm.textSize('xs')`).
|
|
140
|
+
* @returns The class string.
|
|
141
|
+
*/
|
|
142
|
+
countClasses(): string;
|
|
143
|
+
/**
|
|
144
|
+
* Computes the tags row's class (`cm.flex({ align: 'center', gap: 'xs',
|
|
145
|
+
* wrap: 'wrap' })`).
|
|
146
|
+
* @returns The class string.
|
|
147
|
+
*/
|
|
148
|
+
tagsClasses(): string;
|
|
149
|
+
/**
|
|
150
|
+
* The input's text (React's `{expr}` for a text child: strings and numbers
|
|
151
|
+
* render; a node arrives as `[slot=<name>]` content instead).
|
|
152
|
+
* @param value - The input value.
|
|
153
|
+
* @returns The text, or `''` for a node value.
|
|
154
|
+
*/
|
|
155
|
+
private textOf;
|
|
156
|
+
/**
|
|
157
|
+
* The title input's text.
|
|
158
|
+
* @returns The text, or `''` for a node title.
|
|
159
|
+
*/
|
|
160
|
+
titleText(): string;
|
|
161
|
+
/**
|
|
162
|
+
* The excerpt input's text.
|
|
163
|
+
* @returns The text, or `''` for a node value.
|
|
164
|
+
*/
|
|
165
|
+
excerptText(): string;
|
|
166
|
+
/**
|
|
167
|
+
* The author input's text.
|
|
168
|
+
* @returns The text, or `''` for a node value.
|
|
169
|
+
*/
|
|
170
|
+
authorText(): string;
|
|
171
|
+
/**
|
|
172
|
+
* The createdAt input's text.
|
|
173
|
+
* @returns The text, or `''` for a node value.
|
|
174
|
+
*/
|
|
175
|
+
createdAtText(): string;
|
|
176
|
+
/**
|
|
177
|
+
* The tags input's text.
|
|
178
|
+
* @returns The text, or `''` for a node value.
|
|
179
|
+
*/
|
|
180
|
+
tagsText(): string;
|
|
181
|
+
/**
|
|
182
|
+
* The voteControls input's text.
|
|
183
|
+
* @returns The text, or `''` for a node value.
|
|
184
|
+
*/
|
|
185
|
+
voteControlsText(): string;
|
|
186
|
+
/**
|
|
187
|
+
* Whether React would render the vote-controls wrapper: a text value or
|
|
188
|
+
* projected slot content.
|
|
189
|
+
* @returns True when vote controls are present.
|
|
190
|
+
*/
|
|
191
|
+
private hasVoteControls;
|
|
192
|
+
/** Runs the click handler the way React forwards the DOM event. */
|
|
193
|
+
handleClick(event: Event): void;
|
|
194
|
+
/**
|
|
195
|
+
* Reconciles the wrappers once the view queries resolve.
|
|
196
|
+
*/
|
|
197
|
+
ngAfterViewInit(): void;
|
|
198
|
+
/**
|
|
199
|
+
* Re-reconciles on later passes (a props step may add an excerpt or an
|
|
200
|
+
* author, or empty a previously set value, which React re-renders).
|
|
201
|
+
*/
|
|
202
|
+
ngDoCheck(): void;
|
|
203
|
+
/**
|
|
204
|
+
* Applies React's conditions: the vote-controls wrapper renders when the
|
|
205
|
+
* string input is non-empty or the slot holds projected content; the score
|
|
206
|
+
* block renders when `voteScore !== undefined` and no vote controls are
|
|
207
|
+
* supplied; each text-node wrapper renders when its value is truthy or the
|
|
208
|
+
* slot holds projected content. Re-read every pass, so a props step that
|
|
209
|
+
* empties a previously set value drops the wrapper.
|
|
210
|
+
*/
|
|
211
|
+
private reconcile;
|
|
212
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ForumThreadRow, never>;
|
|
213
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ForumThreadRow, "article[mol-forum-thread-row]", never, { "title": { "alias": "title"; "required": false; }; "excerpt": { "alias": "excerpt"; "required": false; }; "voteScore": { "alias": "voteScore"; "required": false; }; "replyCount": { "alias": "replyCount"; "required": false; }; "viewCount": { "alias": "viewCount"; "required": false; }; "pinned": { "alias": "pinned"; "required": false; }; "locked": { "alias": "locked"; "required": false; }; "author": { "alias": "author"; "required": false; }; "createdAt": { "alias": "createdAt"; "required": false; }; "tags": { "alias": "tags"; "required": false; }; "voteControls": { "alias": "voteControls"; "required": false; }; "onClick": { "alias": "onClick"; "required": false; }; "className": { "alias": "className"; "required": false; }; }, {}, never, ["[slot=voteControls]", "[slot=title]", "[slot=excerpt]", "[slot=author]", "[slot=createdAt]", "[slot=tags]"], true, never>;
|
|
214
|
+
}
|
|
215
|
+
//# sourceMappingURL=forum-thread-row.component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"forum-thread-row.component.d.ts","sourceRoot":"","sources":["../src/forum-thread-row.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,KAAK,aAAa,EAElB,KAAK,OAAO,EACZ,UAAU,EAIX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