g-comments 0.2.1 → 0.2.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.
- package/CHANGELOG.md +9 -0
- package/README.md +12 -2
- package/dist/{chunk-WACVXJHD.js → chunk-EWWBVJ2B.js} +5 -5
- package/dist/chunk-EWWBVJ2B.js.map +1 -0
- package/dist/{chunk-IBNNENCZ.cjs → chunk-I2L3IAXL.cjs} +5 -4
- package/dist/chunk-I2L3IAXL.cjs.map +1 -0
- package/dist/element.js +21 -12
- package/dist/element.js.map +1 -1
- package/dist/index.cjs +16 -16
- package/dist/index.js +1 -1
- package/dist/react.cjs +56 -34
- package/dist/react.cjs.map +1 -1
- package/dist/react.js +25 -3
- package/dist/react.js.map +1 -1
- package/package.json +1 -1
- package/styles/styles.css +9 -0
- package/dist/chunk-IBNNENCZ.cjs.map +0 -1
- package/dist/chunk-WACVXJHD.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,15 @@ All notable changes to `g-comments` are listed here. The format follows
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [0.2.2] - 2026-10-20
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
|
|
13
|
+
- Classic topics (no nested replies) read the way the forum shows them: one
|
|
14
|
+
linear list, with a "Replying to @user" link on comments that answer another
|
|
15
|
+
one. New replies land in the list instead of under their parent. Needs
|
|
16
|
+
discourse-comments f6312bf or later for the server side.
|
|
17
|
+
|
|
9
18
|
## [0.2.1] - 2026-10-20
|
|
10
19
|
|
|
11
20
|
### Changed
|
package/README.md
CHANGED
|
@@ -128,6 +128,13 @@ Also available: `Comments.Meta` (author, badges, permalink time),
|
|
|
128
128
|
`Comments.DevPanel`. The `List` render function is reused for replies at every
|
|
129
129
|
depth, and `Item` keeps the inline reply, edit, report and delete panels.
|
|
130
130
|
|
|
131
|
+
## Classic topics
|
|
132
|
+
|
|
133
|
+
A forum without nested replies (or a topic switched to classic mode) reads as
|
|
134
|
+
one linear list in posting order, like the forum itself: a comment that answers
|
|
135
|
+
another carries a "Replying to @user" link instead of being nested under it,
|
|
136
|
+
and `thread.nested` is `false`.
|
|
137
|
+
|
|
131
138
|
## Styling
|
|
132
139
|
|
|
133
140
|
`g-comments/styles.css` styles everything under the widget root
|
|
@@ -281,8 +288,11 @@ discourse-comments::part(gc-comment--pinned) {
|
|
|
281
288
|
`unstyled` drops the default stylesheet's effect (the classes and parts stay),
|
|
282
289
|
`theme="inherit"` derives the neutral colours from the page's text colour, and
|
|
283
290
|
`theme="forum"` loads the forum's palettes, fonts and theme CSS into the shadow
|
|
284
|
-
root (see "Use the forum's look").
|
|
285
|
-
|
|
291
|
+
root (see "Use the forum's look"). Tokens set on the element or an ancestor
|
|
292
|
+
reach the widget by inheritance, which a forum stylesheet that sets `--gc-*`
|
|
293
|
+
on `.gc-root` would override; with `theme="forum"`, set your tokens on
|
|
294
|
+
`discourse-comments::part(gc-root)` instead, which always wins. The count
|
|
295
|
+
element has no styles of its own and inherits the page's font.
|
|
286
296
|
|
|
287
297
|
`defineElements({ comments: "my-comments", count: "my-count" })` registers the
|
|
288
298
|
same elements under other names; names that are already defined are left
|
|
@@ -2392,7 +2392,7 @@ var CommentThread = class {
|
|
|
2392
2392
|
if (!insertable(comment) || this.#deletedAt.has(comment.id)) {
|
|
2393
2393
|
continue;
|
|
2394
2394
|
}
|
|
2395
|
-
const parentNumber = comment.reply_to?.number;
|
|
2395
|
+
const parentNumber = this.#state.thread.nested ? comment.reply_to?.number : void 0;
|
|
2396
2396
|
if (parentNumber === void 0) {
|
|
2397
2397
|
if (me !== null && comment.author?.id === me) {
|
|
2398
2398
|
tree = insertRoot(tree, comment, rootPosition(sort));
|
|
@@ -2470,7 +2470,7 @@ var CommentThread = class {
|
|
|
2470
2470
|
this.#record({ kind: "comments", comments: [comment], insertable: /* @__PURE__ */ new Set([comment.id]), ticket });
|
|
2471
2471
|
const sort = this.#state.sort;
|
|
2472
2472
|
let comments = this.#state.comments;
|
|
2473
|
-
if (replyTo !== void 0) {
|
|
2473
|
+
if (replyTo !== void 0 && this.#state.thread.nested) {
|
|
2474
2474
|
comments = insertReply(comments, replyTo, comment, replyPosition(sort), { bumpCounts: true }) ?? comments;
|
|
2475
2475
|
} else {
|
|
2476
2476
|
comments = insertRoot(comments, comment, rootPosition(sort));
|
|
@@ -3063,6 +3063,6 @@ function createTranslator(locale, overrides = {}) {
|
|
|
3063
3063
|
};
|
|
3064
3064
|
}
|
|
3065
3065
|
|
|
3066
|
-
export { CommentsError, PACKAGE_NAME, STORAGE_PREFIX, clientRegistry, createClient, createClientRegistry, createComposerTimer, createTranslator, currentUrlWithoutHash, defaultPageUrl, en, encodeRef, findComment, isCommentsError, isVirtualThread, locales, memoryStorage, normalizeForum, ptBR, resolveLocale };
|
|
3067
|
-
//# sourceMappingURL=chunk-
|
|
3068
|
-
//# sourceMappingURL=chunk-
|
|
3066
|
+
export { CommentsError, PACKAGE_NAME, STORAGE_PREFIX, clientRegistry, createClient, createClientRegistry, createComposerTimer, createTranslator, currentUrlWithoutHash, defaultPageUrl, en, encodeRef, findByNumber, findComment, isCommentsError, isVirtualThread, locales, memoryStorage, normalizeForum, ptBR, resolveLocale };
|
|
3067
|
+
//# sourceMappingURL=chunk-EWWBVJ2B.js.map
|
|
3068
|
+
//# sourceMappingURL=chunk-EWWBVJ2B.js.map
|