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/dist/index.cjs
CHANGED
|
@@ -1,68 +1,68 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkI2L3IAXL_cjs = require('./chunk-I2L3IAXL.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
Object.defineProperty(exports, "CommentsError", {
|
|
8
8
|
enumerable: true,
|
|
9
|
-
get: function () { return
|
|
9
|
+
get: function () { return chunkI2L3IAXL_cjs.CommentsError; }
|
|
10
10
|
});
|
|
11
11
|
Object.defineProperty(exports, "PACKAGE_NAME", {
|
|
12
12
|
enumerable: true,
|
|
13
|
-
get: function () { return
|
|
13
|
+
get: function () { return chunkI2L3IAXL_cjs.PACKAGE_NAME; }
|
|
14
14
|
});
|
|
15
15
|
Object.defineProperty(exports, "clientRegistry", {
|
|
16
16
|
enumerable: true,
|
|
17
|
-
get: function () { return
|
|
17
|
+
get: function () { return chunkI2L3IAXL_cjs.clientRegistry; }
|
|
18
18
|
});
|
|
19
19
|
Object.defineProperty(exports, "createClient", {
|
|
20
20
|
enumerable: true,
|
|
21
|
-
get: function () { return
|
|
21
|
+
get: function () { return chunkI2L3IAXL_cjs.createClient; }
|
|
22
22
|
});
|
|
23
23
|
Object.defineProperty(exports, "createClientRegistry", {
|
|
24
24
|
enumerable: true,
|
|
25
|
-
get: function () { return
|
|
25
|
+
get: function () { return chunkI2L3IAXL_cjs.createClientRegistry; }
|
|
26
26
|
});
|
|
27
27
|
Object.defineProperty(exports, "createComposerTimer", {
|
|
28
28
|
enumerable: true,
|
|
29
|
-
get: function () { return
|
|
29
|
+
get: function () { return chunkI2L3IAXL_cjs.createComposerTimer; }
|
|
30
30
|
});
|
|
31
31
|
Object.defineProperty(exports, "createTranslator", {
|
|
32
32
|
enumerable: true,
|
|
33
|
-
get: function () { return
|
|
33
|
+
get: function () { return chunkI2L3IAXL_cjs.createTranslator; }
|
|
34
34
|
});
|
|
35
35
|
Object.defineProperty(exports, "en", {
|
|
36
36
|
enumerable: true,
|
|
37
|
-
get: function () { return
|
|
37
|
+
get: function () { return chunkI2L3IAXL_cjs.en; }
|
|
38
38
|
});
|
|
39
39
|
Object.defineProperty(exports, "encodeRef", {
|
|
40
40
|
enumerable: true,
|
|
41
|
-
get: function () { return
|
|
41
|
+
get: function () { return chunkI2L3IAXL_cjs.encodeRef; }
|
|
42
42
|
});
|
|
43
43
|
Object.defineProperty(exports, "isCommentsError", {
|
|
44
44
|
enumerable: true,
|
|
45
|
-
get: function () { return
|
|
45
|
+
get: function () { return chunkI2L3IAXL_cjs.isCommentsError; }
|
|
46
46
|
});
|
|
47
47
|
Object.defineProperty(exports, "isVirtualThread", {
|
|
48
48
|
enumerable: true,
|
|
49
|
-
get: function () { return
|
|
49
|
+
get: function () { return chunkI2L3IAXL_cjs.isVirtualThread; }
|
|
50
50
|
});
|
|
51
51
|
Object.defineProperty(exports, "locales", {
|
|
52
52
|
enumerable: true,
|
|
53
|
-
get: function () { return
|
|
53
|
+
get: function () { return chunkI2L3IAXL_cjs.locales; }
|
|
54
54
|
});
|
|
55
55
|
Object.defineProperty(exports, "memoryStorage", {
|
|
56
56
|
enumerable: true,
|
|
57
|
-
get: function () { return
|
|
57
|
+
get: function () { return chunkI2L3IAXL_cjs.memoryStorage; }
|
|
58
58
|
});
|
|
59
59
|
Object.defineProperty(exports, "ptBR", {
|
|
60
60
|
enumerable: true,
|
|
61
|
-
get: function () { return
|
|
61
|
+
get: function () { return chunkI2L3IAXL_cjs.ptBR; }
|
|
62
62
|
});
|
|
63
63
|
Object.defineProperty(exports, "resolveLocale", {
|
|
64
64
|
enumerable: true,
|
|
65
|
-
get: function () { return
|
|
65
|
+
get: function () { return chunkI2L3IAXL_cjs.resolveLocale; }
|
|
66
66
|
});
|
|
67
67
|
//# sourceMappingURL=index.cjs.map
|
|
68
68
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { CommentsError, PACKAGE_NAME, clientRegistry, createClient, createClientRegistry, createComposerTimer, createTranslator, en, encodeRef, isCommentsError, isVirtualThread, locales, memoryStorage, ptBR, resolveLocale } from './chunk-
|
|
1
|
+
export { CommentsError, PACKAGE_NAME, clientRegistry, createClient, createClientRegistry, createComposerTimer, createTranslator, en, encodeRef, isCommentsError, isVirtualThread, locales, memoryStorage, ptBR, resolveLocale } from './chunk-EWWBVJ2B.js';
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
package/dist/react.cjs
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var chunkI2L3IAXL_cjs = require('./chunk-I2L3IAXL.cjs');
|
|
5
5
|
var react = require('react');
|
|
6
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
7
|
|
|
8
8
|
var useIsomorphicLayoutEffect = typeof window === "undefined" ? react.useEffect : react.useLayoutEffect;
|
|
9
9
|
function toCommentsError(error) {
|
|
10
|
-
if (
|
|
10
|
+
if (chunkI2L3IAXL_cjs.isCommentsError(error)) {
|
|
11
11
|
return error;
|
|
12
12
|
}
|
|
13
|
-
return new
|
|
13
|
+
return new chunkI2L3IAXL_cjs.CommentsError("unknown", error instanceof Error ? error.message : String(error), {
|
|
14
14
|
cause: error
|
|
15
15
|
});
|
|
16
16
|
}
|
|
@@ -87,12 +87,12 @@ function formatAbsolute(iso, locale) {
|
|
|
87
87
|
|
|
88
88
|
// src/react/context.ts
|
|
89
89
|
var CommentsContext = react.createContext(null);
|
|
90
|
-
var defaultTranslator =
|
|
90
|
+
var defaultTranslator = chunkI2L3IAXL_cjs.createTranslator();
|
|
91
91
|
function useCommentsContext(forum) {
|
|
92
92
|
const value = useOptionalCommentsContext(forum);
|
|
93
93
|
if (!value) {
|
|
94
94
|
throw new Error(
|
|
95
|
-
`${
|
|
95
|
+
`${chunkI2L3IAXL_cjs.PACKAGE_NAME}: render this inside <DiscourseComments forum="\u2026"> or pass a \`forum\` prop`
|
|
96
96
|
);
|
|
97
97
|
}
|
|
98
98
|
return value;
|
|
@@ -100,13 +100,13 @@ function useCommentsContext(forum) {
|
|
|
100
100
|
function useOptionalCommentsContext(forum) {
|
|
101
101
|
const context = react.useContext(CommentsContext);
|
|
102
102
|
const standalone = react.useMemo(() => {
|
|
103
|
-
if (forum === void 0 || context &&
|
|
103
|
+
if (forum === void 0 || context && chunkI2L3IAXL_cjs.normalizeForum(forum).base === context.client.forum) {
|
|
104
104
|
return null;
|
|
105
105
|
}
|
|
106
106
|
return {
|
|
107
|
-
client:
|
|
107
|
+
client: chunkI2L3IAXL_cjs.clientRegistry.acquire({ forum }),
|
|
108
108
|
t: context?.t ?? defaultTranslator,
|
|
109
|
-
locale: context?.locale ??
|
|
109
|
+
locale: context?.locale ?? chunkI2L3IAXL_cjs.resolveLocale(void 0),
|
|
110
110
|
messages: context?.messages,
|
|
111
111
|
theme: context?.theme ?? "auto",
|
|
112
112
|
appearance: context?.appearance,
|
|
@@ -119,7 +119,7 @@ function useOptionalCommentsContext(forum) {
|
|
|
119
119
|
function useClient() {
|
|
120
120
|
const context = react.useContext(CommentsContext);
|
|
121
121
|
if (!context) {
|
|
122
|
-
throw new Error(`${
|
|
122
|
+
throw new Error(`${chunkI2L3IAXL_cjs.PACKAGE_NAME}: useClient() needs a <DiscourseComments> provider`);
|
|
123
123
|
}
|
|
124
124
|
return context.client;
|
|
125
125
|
}
|
|
@@ -138,11 +138,11 @@ function DiscourseComments(props) {
|
|
|
138
138
|
debug
|
|
139
139
|
};
|
|
140
140
|
const client = react.useMemo(
|
|
141
|
-
() => explicitClient ??
|
|
141
|
+
() => explicitClient ?? chunkI2L3IAXL_cjs.clientRegistry.acquire(creation),
|
|
142
142
|
[explicitClient, forum]
|
|
143
143
|
);
|
|
144
144
|
const messagesKey = messages ? JSON.stringify(messages) : "";
|
|
145
|
-
const t = react.useMemo(() =>
|
|
145
|
+
const t = react.useMemo(() => chunkI2L3IAXL_cjs.createTranslator(locale, messages), [locale, messagesKey]);
|
|
146
146
|
const onEventRef = react.useRef(onEvent);
|
|
147
147
|
react.useEffect(() => {
|
|
148
148
|
onEventRef.current = onEvent;
|
|
@@ -151,7 +151,7 @@ function DiscourseComments(props) {
|
|
|
151
151
|
() => ({
|
|
152
152
|
client,
|
|
153
153
|
t,
|
|
154
|
-
locale:
|
|
154
|
+
locale: chunkI2L3IAXL_cjs.resolveLocale(locale),
|
|
155
155
|
messages,
|
|
156
156
|
theme,
|
|
157
157
|
appearance,
|
|
@@ -549,7 +549,7 @@ function useThreadFor(client, { identifier, url, title, sort }, onOpenError) {
|
|
|
549
549
|
const [opened, setOpened] = react.useState(
|
|
550
550
|
{ thread: null, error: null }
|
|
551
551
|
);
|
|
552
|
-
const pageKey = url === void 0 ?
|
|
552
|
+
const pageKey = url === void 0 ? chunkI2L3IAXL_cjs.currentUrlWithoutHash() ?? "" : "";
|
|
553
553
|
const latest = react.useRef({ title, sort, onOpenError });
|
|
554
554
|
latest.current = { title, sort, onOpenError };
|
|
555
555
|
const requestedSort = react.useRef(sort);
|
|
@@ -615,14 +615,14 @@ var RootContext = react.createContext(null);
|
|
|
615
615
|
function useRootContext(component = "This component") {
|
|
616
616
|
const value = react.useContext(RootContext);
|
|
617
617
|
if (!value) {
|
|
618
|
-
throw new Error(`${
|
|
618
|
+
throw new Error(`${chunkI2L3IAXL_cjs.PACKAGE_NAME}: ${component} must be rendered inside <Comments.Root>`);
|
|
619
619
|
}
|
|
620
620
|
return value;
|
|
621
621
|
}
|
|
622
622
|
function Root(props) {
|
|
623
623
|
const context = useOptionalCommentsContext(props.forum);
|
|
624
624
|
if (!context) {
|
|
625
|
-
return /* @__PURE__ */ jsxRuntime.jsx("section", { className: cx("gc-root", "gc-root--unconfigured", props.className), "data-gc-unconfigured": "", children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "gc-notice", children: `${
|
|
625
|
+
return /* @__PURE__ */ jsxRuntime.jsx("section", { className: cx("gc-root", "gc-root--unconfigured", props.className), "data-gc-unconfigured": "", children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "gc-notice", children: `${chunkI2L3IAXL_cjs.PACKAGE_NAME}: render <Comments> inside <DiscourseComments forum="\u2026"> or pass a forum prop.` }) });
|
|
626
626
|
}
|
|
627
627
|
return /* @__PURE__ */ jsxRuntime.jsx(ConfiguredRoot, { ...props });
|
|
628
628
|
}
|
|
@@ -651,10 +651,10 @@ function ConfiguredRoot(props) {
|
|
|
651
651
|
const { client, emit } = context;
|
|
652
652
|
const rootRef = react.useRef(null);
|
|
653
653
|
const t = react.useMemo(
|
|
654
|
-
() => localeProp ?
|
|
654
|
+
() => localeProp ? chunkI2L3IAXL_cjs.createTranslator(localeProp, context.messages) : context.t,
|
|
655
655
|
[localeProp, context.messages, context.t]
|
|
656
656
|
);
|
|
657
|
-
const locale = localeProp ?
|
|
657
|
+
const locale = localeProp ? chunkI2L3IAXL_cjs.resolveLocale(localeProp) : context.locale;
|
|
658
658
|
const theme = themeProp ?? context.theme;
|
|
659
659
|
const { variables, elements } = react.useMemo(
|
|
660
660
|
() => mergeAppearance(context.appearance, appearance),
|
|
@@ -783,7 +783,7 @@ function ConfiguredRoot(props) {
|
|
|
783
783
|
const id = requestedHighlight;
|
|
784
784
|
const request = ++viewRequest.current;
|
|
785
785
|
void (async () => {
|
|
786
|
-
let location =
|
|
786
|
+
let location = chunkI2L3IAXL_cjs.findComment(thread.snapshot().comments, id);
|
|
787
787
|
if (!location) {
|
|
788
788
|
try {
|
|
789
789
|
await thread.context(id);
|
|
@@ -793,7 +793,7 @@ function ConfiguredRoot(props) {
|
|
|
793
793
|
}
|
|
794
794
|
return;
|
|
795
795
|
}
|
|
796
|
-
location =
|
|
796
|
+
location = chunkI2L3IAXL_cjs.findComment(thread.snapshot().comments, id);
|
|
797
797
|
}
|
|
798
798
|
if (!location || request !== viewRequest.current) {
|
|
799
799
|
return;
|
|
@@ -801,7 +801,7 @@ function ConfiguredRoot(props) {
|
|
|
801
801
|
if (location.depth > maxDepth) {
|
|
802
802
|
const cut = location.depth - maxDepth;
|
|
803
803
|
const tree = thread.snapshot().comments;
|
|
804
|
-
const ancestors = location.path.slice(0, cut).map((ancestorId) =>
|
|
804
|
+
const ancestors = location.path.slice(0, cut).map((ancestorId) => chunkI2L3IAXL_cjs.findComment(tree, ancestorId)?.node).filter((node) => node !== void 0);
|
|
805
805
|
setFocusView({ id: location.path[cut], ancestors, truncated: false });
|
|
806
806
|
} else {
|
|
807
807
|
setFocusView(null);
|
|
@@ -828,7 +828,7 @@ function ConfiguredRoot(props) {
|
|
|
828
828
|
}, [client, signInMode]);
|
|
829
829
|
const threadKey = snapshot?.thread.key;
|
|
830
830
|
const draftKey = react.useCallback(
|
|
831
|
-
(scope) => threadKey === void 0 ? null : `${
|
|
831
|
+
(scope) => threadKey === void 0 ? null : `${chunkI2L3IAXL_cjs.STORAGE_PREFIX}:${client.forum}:draft:${threadKey}:${scope}`,
|
|
832
832
|
[client.forum, threadKey]
|
|
833
833
|
);
|
|
834
834
|
const value = {
|
|
@@ -1072,7 +1072,7 @@ function ComposerForm({
|
|
|
1072
1072
|
const textareaRef = react.useRef(null);
|
|
1073
1073
|
const fileRef = react.useRef(null);
|
|
1074
1074
|
const pendingSelection = react.useRef(null);
|
|
1075
|
-
const [timer] = react.useState(
|
|
1075
|
+
const [timer] = react.useState(chunkI2L3IAXL_cjs.createComposerTimer);
|
|
1076
1076
|
const draftKey = editing ? null : root.draftKey(replyTo ? `reply:${replyTo.id}` : "root");
|
|
1077
1077
|
const [value, setValueState] = react.useState(() => draftKey ? readDraft(draftKey) : "");
|
|
1078
1078
|
const valueRef = react.useRef(value);
|
|
@@ -1632,7 +1632,7 @@ var ItemContext = react.createContext(null);
|
|
|
1632
1632
|
function useItemContext(component) {
|
|
1633
1633
|
const value = react.useContext(ItemContext);
|
|
1634
1634
|
if (!value) {
|
|
1635
|
-
throw new Error(`${
|
|
1635
|
+
throw new Error(`${chunkI2L3IAXL_cjs.PACKAGE_NAME}: ${component} must be rendered inside <Comments.Item>`);
|
|
1636
1636
|
}
|
|
1637
1637
|
return value;
|
|
1638
1638
|
}
|
|
@@ -1661,7 +1661,7 @@ function UserAvatar({
|
|
|
1661
1661
|
return /* @__PURE__ */ jsxRuntime.jsx("span", { className: cx("gc-avatar", "gc-avatar--placeholder", className), "aria-hidden": "true", children: initial3 });
|
|
1662
1662
|
}
|
|
1663
1663
|
function Meta({ className }) {
|
|
1664
|
-
const { comment } = useItemContext("Comments.Meta");
|
|
1664
|
+
const { comment, depth } = useItemContext("Comments.Meta");
|
|
1665
1665
|
const { t, locale, client, elements } = useRootContext("Comments.Meta");
|
|
1666
1666
|
const author = comment.author;
|
|
1667
1667
|
const name = author ? author.name || author.username : null;
|
|
@@ -1682,9 +1682,31 @@ function Meta({ className }) {
|
|
|
1682
1682
|
t("pinned")
|
|
1683
1683
|
] }),
|
|
1684
1684
|
/* @__PURE__ */ jsxRuntime.jsx("a", { className: "gc-comment__time", href: `#gc-${comment.id}`, children: /* @__PURE__ */ jsxRuntime.jsx(RelativeTime, { iso: comment.created_at, locale }) }),
|
|
1685
|
-
comment.edited && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "gc-comment__edited", title: formatAbsolute(comment.updated_at, locale), children: t("edited") })
|
|
1685
|
+
comment.edited && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "gc-comment__edited", title: formatAbsolute(comment.updated_at, locale), children: t("edited") }),
|
|
1686
|
+
comment.reply_to && depth === 0 && /* @__PURE__ */ jsxRuntime.jsx(ReplyReference, { reference: comment.reply_to })
|
|
1686
1687
|
] });
|
|
1687
1688
|
}
|
|
1689
|
+
function ReplyReference({ reference }) {
|
|
1690
|
+
const { t, snapshot, focusComment } = useRootContext("Comments.Meta");
|
|
1691
|
+
const label = t("replyingTo", { username: reference.username ?? "" });
|
|
1692
|
+
const parent = snapshot ? chunkI2L3IAXL_cjs.findByNumber(snapshot.comments, reference.number) : null;
|
|
1693
|
+
if (!parent) {
|
|
1694
|
+
return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "gc-comment__reply-to", children: label });
|
|
1695
|
+
}
|
|
1696
|
+
const id = parent.node.id;
|
|
1697
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1698
|
+
"a",
|
|
1699
|
+
{
|
|
1700
|
+
className: "gc-comment__reply-to",
|
|
1701
|
+
href: `#gc-${id}`,
|
|
1702
|
+
onClick: (event) => {
|
|
1703
|
+
event.preventDefault();
|
|
1704
|
+
focusComment(id, { scroll: true });
|
|
1705
|
+
},
|
|
1706
|
+
children: label
|
|
1707
|
+
}
|
|
1708
|
+
);
|
|
1709
|
+
}
|
|
1688
1710
|
function RelativeTime({ iso, locale }) {
|
|
1689
1711
|
const [now, setNow] = react.useState(Date.now);
|
|
1690
1712
|
react.useEffect(() => onMinuteTick(() => setNow(Date.now())), []);
|
|
@@ -1753,7 +1775,7 @@ function Actions({ className }) {
|
|
|
1753
1775
|
key: "copy",
|
|
1754
1776
|
label: t("copyLink"),
|
|
1755
1777
|
onSelect: () => {
|
|
1756
|
-
const href = `${
|
|
1778
|
+
const href = `${chunkI2L3IAXL_cjs.currentUrlWithoutHash() ?? ""}#gc-${comment.id}`;
|
|
1757
1779
|
const clipboard = typeof navigator === "undefined" ? void 0 : navigator.clipboard;
|
|
1758
1780
|
if (!clipboard) {
|
|
1759
1781
|
window.location.hash = `gc-${comment.id}`;
|
|
@@ -2095,7 +2117,7 @@ function DevPanel({ className }) {
|
|
|
2095
2117
|
}
|
|
2096
2118
|
return /* @__PURE__ */ jsxRuntime.jsxs("details", { className: cx("gc-devpanel", "gc-devpanel--ok", className), children: [
|
|
2097
2119
|
/* @__PURE__ */ jsxRuntime.jsxs("summary", { className: "gc-devpanel__title", children: [
|
|
2098
|
-
|
|
2120
|
+
chunkI2L3IAXL_cjs.PACKAGE_NAME,
|
|
2099
2121
|
" diagnostics"
|
|
2100
2122
|
] }),
|
|
2101
2123
|
/* @__PURE__ */ jsxRuntime.jsxs("dl", { className: "gc-devpanel__details", children: [
|
|
@@ -2124,10 +2146,10 @@ function DevPanel({ className }) {
|
|
|
2124
2146
|
"aside",
|
|
2125
2147
|
{
|
|
2126
2148
|
className: cx("gc-devpanel", className),
|
|
2127
|
-
"aria-label": `${
|
|
2149
|
+
"aria-label": `${chunkI2L3IAXL_cjs.PACKAGE_NAME} setup diagnostics`,
|
|
2128
2150
|
children: [
|
|
2129
2151
|
/* @__PURE__ */ jsxRuntime.jsxs("p", { className: "gc-devpanel__title", children: [
|
|
2130
|
-
|
|
2152
|
+
chunkI2L3IAXL_cjs.PACKAGE_NAME,
|
|
2131
2153
|
" could not load comments"
|
|
2132
2154
|
] }),
|
|
2133
2155
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "gc-devpanel__summary", children: summary }),
|
|
@@ -2305,7 +2327,7 @@ function List({ children, className }) {
|
|
|
2305
2327
|
const listClass = cx("gc-list", elements.list, className);
|
|
2306
2328
|
if (focusView) {
|
|
2307
2329
|
const tree = snapshot.comments;
|
|
2308
|
-
const target =
|
|
2330
|
+
const target = chunkI2L3IAXL_cjs.findComment(tree, focusView.id)?.node;
|
|
2309
2331
|
return /* @__PURE__ */ jsxRuntime.jsx(ListContext.Provider, { value: render, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "gc-focus", children: [
|
|
2310
2332
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2311
2333
|
"button",
|
|
@@ -2323,7 +2345,7 @@ function List({ children, className }) {
|
|
|
2323
2345
|
focusView.ancestors.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("ol", { className: "gc-context", children: focusView.ancestors.map((ancestor) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2324
2346
|
Item,
|
|
2325
2347
|
{
|
|
2326
|
-
comment:
|
|
2348
|
+
comment: chunkI2L3IAXL_cjs.findComment(tree, ancestor.id)?.node ?? ancestor,
|
|
2327
2349
|
showReplies: false
|
|
2328
2350
|
},
|
|
2329
2351
|
ancestor.id
|
|
@@ -2476,7 +2498,7 @@ function Replies() {
|
|
|
2476
2498
|
root.reportError("loadReplies", error);
|
|
2477
2499
|
return;
|
|
2478
2500
|
}
|
|
2479
|
-
const loaded3 =
|
|
2501
|
+
const loaded3 = chunkI2L3IAXL_cjs.findComment(thread.snapshot().comments, comment.id)?.node.children ?? [];
|
|
2480
2502
|
const first = loaded3.find((child) => !before.has(child.id));
|
|
2481
2503
|
if (first) {
|
|
2482
2504
|
root.focusComment(first.id);
|
|
@@ -2721,7 +2743,7 @@ function useCommentCount(ref, options = {}) {
|
|
|
2721
2743
|
}
|
|
2722
2744
|
function safeEncode(ref) {
|
|
2723
2745
|
try {
|
|
2724
|
-
return
|
|
2746
|
+
return chunkI2L3IAXL_cjs.encodeRef(ref);
|
|
2725
2747
|
} catch {
|
|
2726
2748
|
return null;
|
|
2727
2749
|
}
|
|
@@ -2736,7 +2758,7 @@ function CommentCount({
|
|
|
2736
2758
|
className
|
|
2737
2759
|
}) {
|
|
2738
2760
|
const context = useOptionalCommentsContext(forum);
|
|
2739
|
-
const pageUrl = url ??
|
|
2761
|
+
const pageUrl = url ?? chunkI2L3IAXL_cjs.defaultPageUrl();
|
|
2740
2762
|
const ref = topicId !== void 0 ? { topicId } : identifier !== void 0 ? { identifier, host } : pageUrl ? { url: pageUrl } : null;
|
|
2741
2763
|
const { count } = useCommentCount(ref, { forum });
|
|
2742
2764
|
if (!context) {
|