@commentkit/comment-kit 0.7.7 → 1.0.0-beta.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.
Files changed (109) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/README.md +108 -762
  3. package/SECURITY.md +19 -14
  4. package/dist/npm/THIRD_PARTY_NOTICES.txt +73 -0
  5. package/dist/npm/chunks/anchor-DT-Ynhh1.js +270 -0
  6. package/dist/npm/chunks/client-D1vrh_5G.js +590 -0
  7. package/dist/{shared/capture-colors-D0uLr-vZ.js → npm/chunks/colors-CX-IPjvb.js} +2 -0
  8. package/dist/npm/chunks/html2canvas-_mjSRP3G.js +4011 -0
  9. package/dist/npm/chunks/mount-Ce1MZrcm.js +2485 -0
  10. package/dist/{shared/pusher-CnhQgAvF.js → npm/chunks/pusher-DRKlokR8.js} +224 -222
  11. package/dist/npm/chunks/realtime-5SvAvTUU.js +23 -0
  12. package/dist/npm/chunks/rolldown-runtime-VHNaYcLd.js +13 -0
  13. package/dist/npm/chunks/src-DJjfvVsa.js +330 -0
  14. package/dist/npm/element.js +24 -0
  15. package/dist/npm/headless.js +3 -0
  16. package/dist/npm/index.js +3 -0
  17. package/dist/npm/react.js +17 -0
  18. package/dist/npm/svelte.js +8 -0
  19. package/dist/npm/types/adapters/react.d.ts +9 -0
  20. package/dist/npm/types/adapters/svelte.d.ts +9 -0
  21. package/dist/npm/types/adapters/vue.d.ts +46 -0
  22. package/dist/npm/types/anchor/index.d.ts +49 -0
  23. package/dist/npm/types/core/api.d.ts +29 -0
  24. package/dist/npm/types/core/auth.d.ts +48 -0
  25. package/dist/npm/types/core/client.d.ts +100 -0
  26. package/dist/npm/types/core/store.d.ts +7 -0
  27. package/dist/npm/types/core/types.d.ts +278 -0
  28. package/dist/npm/types/element.d.ts +10 -0
  29. package/dist/npm/types/headless.d.ts +7 -0
  30. package/dist/npm/types/index.d.ts +30 -0
  31. package/dist/npm/vue.js +32 -0
  32. package/package.json +65 -173
  33. package/dist/THIRD_PARTY_NOTICES.txt +0 -284
  34. package/dist/angular.es.js +0 -321
  35. package/dist/comment-kit.es.js +0 -218
  36. package/dist/demo.es.js +0 -483
  37. package/dist/headless.es.js +0 -4
  38. package/dist/preact.es.js +0 -117
  39. package/dist/qwik.es.js +0 -1
  40. package/dist/qwik.qwik.mjs +0 -114
  41. package/dist/react.es.js +0 -98
  42. package/dist/shared/ShadowRootContext-DD6a0QaI.js +0 -11
  43. package/dist/shared/annotation-icons-Dh-bmNYK.js +0 -172
  44. package/dist/shared/annotation-toolbar-zeiCmKIr.js +0 -1086
  45. package/dist/shared/attachment-refresh-DAacLaRu.js +0 -94
  46. package/dist/shared/bridge-CJoGYngu.js +0 -177
  47. package/dist/shared/button-D4GHW6oZ.js +0 -474
  48. package/dist/shared/button-group-BVR7iT-S.js +0 -91
  49. package/dist/shared/capture-privacy-CiOrcAlt.js +0 -101
  50. package/dist/shared/comment-drawing-canvas-Btc12IsS.js +0 -124
  51. package/dist/shared/comment-icon-D8JTCEJ7.js +0 -607
  52. package/dist/shared/comment-image-lightbox--QpbcAtH.js +0 -190
  53. package/dist/shared/comment-images-content-C_r4SHM-.js +0 -214
  54. package/dist/shared/comment-kit-core-CmLUFujd.js +0 -3682
  55. package/dist/shared/comment-kit-ui-BHwYuSIi.js +0 -19391
  56. package/dist/shared/comment-screenshot-annotator-zJZyO-XM.js +0 -151
  57. package/dist/shared/comment-screenshot-overlay-CoKTYB0J.js +0 -205
  58. package/dist/shared/comment-shortcut-groups-CfEmkitU.js +0 -153
  59. package/dist/shared/createReactComponent-BZHeRbD0.js +0 -45
  60. package/dist/shared/dev-export-panel-Cnt6oCZU.js +0 -207
  61. package/dist/shared/dev-grab-B85jo9AS.js +0 -197
  62. package/dist/shared/dist-D9A5k-N4.js +0 -617
  63. package/dist/shared/dom-Bhf4WFtY.js +0 -223
  64. package/dist/shared/element-selector-Cng84xC7.js +0 -902
  65. package/dist/shared/error-boundary-D3PD74vI.js +0 -21
  66. package/dist/shared/errors-Bu5ajEmB.js +0 -22
  67. package/dist/shared/icons-nzMOLzrm.js +0 -266
  68. package/dist/shared/input-UPtAj0M6.js +0 -111
  69. package/dist/shared/mount-ui-Dz7FB_Ak.js +0 -208
  70. package/dist/shared/realtime-recovery-BjlV-ewc.js +0 -162
  71. package/dist/shared/realtime-yGLX4wMK.js +0 -334
  72. package/dist/shared/request-activity-DQrAUwfA.js +0 -11
  73. package/dist/shared/screenshot-B5-hwpmt.js +0 -199
  74. package/dist/shared/separator-UhJb0Row.js +0 -3955
  75. package/dist/shared/shadow-root-B58ZI2yz.js +0 -133
  76. package/dist/shared/styles-CnYsLS2f.js +0 -2
  77. package/dist/shared/text-B4HHZNaa.js +0 -23
  78. package/dist/shared/token-session-D92MYbNu.js +0 -25
  79. package/dist/shared/useLabelableId-8n0QmH8N.js +0 -154
  80. package/dist/shared/useRender-Uxk1OPK-.js +0 -5
  81. package/dist/shared/useValueChanged-DKq5cMot.js +0 -92
  82. package/dist/shared/validation-3wbbbuX0.js +0 -70
  83. package/dist/shared/websocket-manager-KhH4hL0Q.js +0 -381
  84. package/dist/solid.es.js +0 -98
  85. package/dist/svelte.es.js +0 -130
  86. package/dist/types/adapters/bridge.d.ts +0 -122
  87. package/dist/types/angular/index.d.ts +0 -145
  88. package/dist/types/core/agent-context.d.ts +0 -17
  89. package/dist/types/core/api-client.d.ts +0 -155
  90. package/dist/types/core/comment-kit-core.d.ts +0 -254
  91. package/dist/types/core/local-demo.d.ts +0 -60
  92. package/dist/types/core/types.d.ts +0 -770
  93. package/dist/types/core/websocket-manager.d.ts +0 -125
  94. package/dist/types/core/write-access.d.ts +0 -11
  95. package/dist/types/demo.d.ts +0 -17
  96. package/dist/types/headless.d.ts +0 -8
  97. package/dist/types/index.d.ts +0 -87
  98. package/dist/types/preact/index.d.ts +0 -25
  99. package/dist/types/qwik/index.d.ts +0 -73
  100. package/dist/types/react/client.d.ts +0 -31
  101. package/dist/types/react/index.d.ts +0 -4
  102. package/dist/types/solid/index.d.ts +0 -37
  103. package/dist/types/svelte/index.d.ts +0 -55
  104. package/dist/types/utils/dom.d.ts +0 -59
  105. package/dist/types/utils/event-emitter.d.ts +0 -11
  106. package/dist/types/vue/index.d.ts +0 -87
  107. package/dist/vue.es.js +0 -148
  108. package/docs/api-reference.md +0 -405
  109. package/docs/local-demo.md +0 -60
@@ -1,21 +0,0 @@
1
- import e from "react";
2
- var t = class extends e.Component {
3
- constructor(...e) {
4
- super(...e), this.state = { hasError: !1 };
5
- }
6
- static getDerivedStateFromError() {
7
- return { hasError: !0 };
8
- }
9
- componentDidUpdate(e) {
10
- this.state.hasError && e.resetKey !== this.props.resetKey && this.setState({ hasError: !1 });
11
- }
12
- componentDidCatch(e, t) {
13
- try {
14
- console.error("[CommentKit] UI error caught by ErrorBoundary:", e, t.componentStack);
15
- } catch {}
16
- }
17
- render() {
18
- return this.state.hasError ? this.props.fallback ?? null : this.props.children;
19
- }
20
- };
21
- export { t as ErrorBoundary };
@@ -1,22 +0,0 @@
1
- function e(e) {
2
- return typeof e == "object" && !!e && "error" in e && "message" in e && "code" in e;
3
- }
4
- function t(e) {
5
- return e instanceof Error ? e.message : String(e);
6
- }
7
- function n(n) {
8
- return e(n) ? n : {
9
- error: "init_failed",
10
- message: t(n),
11
- code: 500
12
- };
13
- }
14
- function r(e) {
15
- return {
16
- error: "mount_failed",
17
- message: "Failed to mount CommentKit UI",
18
- code: 500,
19
- details: { cause: e instanceof Error ? e.message : String(e) }
20
- };
21
- }
22
- export { r as n, n as t };
@@ -1,266 +0,0 @@
1
- import * as e from "react";
2
- import { jsxs as t } from "react/jsx-runtime";
3
- function n(n, r) {
4
- let i = e.forwardRef(function({ size: n = 24, stroke: i = 2, strokeWidth: a = i, children: o, ...s }, c) {
5
- return /* @__PURE__ */ t("svg", {
6
- ref: c,
7
- xmlns: "http://www.w3.org/2000/svg",
8
- width: n,
9
- height: n,
10
- viewBox: "0 0 24 24",
11
- fill: "none",
12
- color: "currentColor",
13
- stroke: "currentColor",
14
- strokeWidth: a,
15
- ...s,
16
- children: [r.map(([t, n]) => e.createElement(t, {
17
- ...n,
18
- stroke: "currentColor",
19
- strokeWidth: a
20
- })), o]
21
- });
22
- });
23
- return i.displayName = n, i;
24
- }
25
- var r = n("Tick02Icon", [["path", {
26
- d: "M5 14L8.5 17.5L19 6.5",
27
- stroke: "currentColor",
28
- strokeLinecap: "round",
29
- strokeLinejoin: "round",
30
- strokeWidth: "1.5",
31
- key: "0"
32
- }]]), i = n("MinusSignIcon", [["path", {
33
- d: "M20 12L4 12",
34
- stroke: "currentColor",
35
- strokeLinecap: "round",
36
- strokeLinejoin: "round",
37
- strokeWidth: "1.5",
38
- key: "0"
39
- }]]), a = n("ArrowRight01Icon", [["path", {
40
- d: "M9.00005 6C9.00005 6 15 10.4189 15 12C15 13.5812 9 18 9 18",
41
- stroke: "currentColor",
42
- strokeLinecap: "round",
43
- strokeLinejoin: "round",
44
- strokeWidth: "1.5",
45
- key: "0"
46
- }]]), o = n("MoreHorizontalCircle01Icon", [
47
- ["path", {
48
- d: "M21 12C21 11.1716 20.3284 10.5 19.5 10.5C18.6716 10.5 18 11.1716 18 12C18 12.8284 18.6716 13.5 19.5 13.5C20.3284 13.5 21 12.8284 21 12Z",
49
- stroke: "currentColor",
50
- strokeWidth: "1.5",
51
- key: "0"
52
- }],
53
- ["path", {
54
- d: "M13.5 12C13.5 11.1716 12.8284 10.5 12 10.5C11.1716 10.5 10.5 11.1716 10.5 12C10.5 12.8284 11.1716 13.5 12 13.5C12.8284 13.5 13.5 12.8284 13.5 12Z",
55
- stroke: "currentColor",
56
- strokeWidth: "1.5",
57
- key: "1"
58
- }],
59
- ["path", {
60
- d: "M6 12C6 11.1716 5.32843 10.5 4.5 10.5C3.67157 10.5 3 11.1716 3 12C3 12.8284 3.67157 13.5 4.5 13.5C5.32843 13.5 6 12.8284 6 12Z",
61
- stroke: "currentColor",
62
- strokeWidth: "1.5",
63
- key: "2"
64
- }]
65
- ]), s = n("UnfoldMoreIcon", [["path", {
66
- d: "M18 14C18 14 13.5811 19 12 19C10.4188 19 6 14 6 14",
67
- stroke: "currentColor",
68
- strokeLinecap: "round",
69
- strokeLinejoin: "round",
70
- strokeWidth: "1.5",
71
- key: "0"
72
- }], ["path", {
73
- d: "M18 9.99996C18 9.99996 13.5811 5.00001 12 5C10.4188 4.99999 6 10 6 10",
74
- stroke: "currentColor",
75
- strokeLinecap: "round",
76
- strokeLinejoin: "round",
77
- strokeWidth: "1.5",
78
- key: "1"
79
- }]]), c = n("ArrowUp01Icon", [["path", {
80
- d: "M17.9998 15C17.9998 15 13.5809 9.00001 11.9998 9C10.4187 8.99999 5.99985 15 5.99985 15",
81
- stroke: "currentColor",
82
- strokeLinecap: "round",
83
- strokeLinejoin: "round",
84
- strokeWidth: "1.5",
85
- key: "0"
86
- }]]), l = n("ArrowDown01Icon", [["path", {
87
- d: "M18 9.00005C18 9.00005 13.5811 15 12 15C10.4188 15 6 9 6 9",
88
- stroke: "currentColor",
89
- strokeLinecap: "round",
90
- strokeLinejoin: "round",
91
- strokeWidth: "1.5",
92
- key: "0"
93
- }]]), u = n("Cancel01Icon", [["path", {
94
- d: "M18 6L6.00081 17.9992M17.9992 18L6 6.00085",
95
- stroke: "currentColor",
96
- strokeLinecap: "round",
97
- strokeLinejoin: "round",
98
- strokeWidth: "1.5",
99
- key: "0"
100
- }]]), d = n("CheckmarkCircle02Icon", [["path", {
101
- d: "M22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22C17.5228 22 22 17.5228 22 12Z",
102
- stroke: "currentColor",
103
- strokeWidth: "1.5",
104
- key: "0"
105
- }], ["path", {
106
- d: "M8 12.5L10.5 15L16 9",
107
- stroke: "currentColor",
108
- strokeLinecap: "round",
109
- strokeLinejoin: "round",
110
- strokeWidth: "1.5",
111
- key: "1"
112
- }]]), f = n("InformationCircleIcon", [
113
- ["circle", {
114
- cx: "12",
115
- cy: "12",
116
- r: "10",
117
- stroke: "currentColor",
118
- strokeLinecap: "round",
119
- strokeLinejoin: "round",
120
- strokeWidth: "1.5",
121
- key: "0"
122
- }],
123
- ["path", {
124
- d: "M12 16V12",
125
- stroke: "currentColor",
126
- strokeLinecap: "round",
127
- strokeLinejoin: "round",
128
- strokeWidth: "1.5",
129
- key: "1"
130
- }],
131
- ["path", {
132
- d: "M12.125 8.25H12M12.25 8.25C12.25 8.11193 12.1381 8 12 8C11.8619 8 11.75 8.11193 11.75 8.25C11.75 8.38807 11.8619 8.5 12 8.5C12.1381 8.5 12.25 8.38807 12.25 8.25Z",
133
- stroke: "currentColor",
134
- strokeLinecap: "round",
135
- strokeLinejoin: "round",
136
- strokeWidth: "1.5",
137
- key: "2"
138
- }]
139
- ]), p = n("Alert02Icon", [
140
- ["path", {
141
- d: "M13.9248 21H10.0752C5.44476 21 3.12955 21 2.27636 19.4939C1.42317 17.9879 2.60736 15.9914 4.97574 11.9985L6.90057 8.75333C9.17559 4.91778 10.3131 3 12 3C13.6869 3 14.8244 4.91777 17.0994 8.75332L19.0243 11.9985C21.3926 15.9914 22.5768 17.9879 21.7236 19.4939C20.8704 21 18.5552 21 13.9248 21Z",
142
- stroke: "currentColor",
143
- strokeLinecap: "round",
144
- strokeLinejoin: "round",
145
- strokeWidth: "1.5",
146
- key: "0"
147
- }],
148
- ["path", {
149
- d: "M12 9V13",
150
- stroke: "currentColor",
151
- strokeLinecap: "round",
152
- strokeLinejoin: "round",
153
- strokeWidth: "1.5",
154
- key: "1"
155
- }],
156
- ["path", {
157
- d: "M12.125 16.75H12M12.25 16.75C12.25 16.8881 12.1381 17 12 17C11.8619 17 11.75 16.8881 11.75 16.75C11.75 16.6119 11.8619 16.5 12 16.5C12.1381 16.5 12.25 16.6119 12.25 16.75Z",
158
- stroke: "currentColor",
159
- strokeLinecap: "round",
160
- strokeLinejoin: "round",
161
- strokeWidth: "1.5",
162
- key: "2"
163
- }]
164
- ]);
165
- n("MultiplicationSignCircleIcon", [["path", {
166
- d: "M15.5 8.5L12 12M12 12L8.5 15.5M12 12L15.5 15.5M12 12L8.5 8.5",
167
- stroke: "currentColor",
168
- strokeLinecap: "round",
169
- strokeLinejoin: "round",
170
- strokeWidth: "1.5",
171
- key: "0"
172
- }], ["circle", {
173
- cx: "12",
174
- cy: "12",
175
- r: "10",
176
- stroke: "currentColor",
177
- strokeWidth: "1.5",
178
- key: "1"
179
- }]]);
180
- var m = n("MultiplicationSignCircleIcon", [["path", {
181
- d: "M15.5 8.5L12 12M12 12L8.5 15.5M12 12L15.5 15.5M12 12L8.5 8.5",
182
- stroke: "currentColor",
183
- strokeLinecap: "round",
184
- strokeLinejoin: "round",
185
- strokeWidth: "1.5",
186
- key: "0"
187
- }], ["circle", {
188
- cx: "12",
189
- cy: "12",
190
- r: "10",
191
- stroke: "currentColor",
192
- strokeWidth: "1.5",
193
- key: "1"
194
- }]]), h = n("Loading03Icon", [
195
- ["path", {
196
- d: "M12 3V6",
197
- stroke: "currentColor",
198
- strokeLinecap: "round",
199
- strokeWidth: "1.5",
200
- key: "0"
201
- }],
202
- ["path", {
203
- d: "M12 18V21",
204
- stroke: "currentColor",
205
- strokeLinecap: "round",
206
- strokeWidth: "1.5",
207
- key: "1"
208
- }],
209
- ["path", {
210
- d: "M21 12L18 12",
211
- stroke: "currentColor",
212
- strokeLinecap: "round",
213
- strokeWidth: "1.5",
214
- key: "2"
215
- }],
216
- ["path", {
217
- d: "M6 12L3 12",
218
- stroke: "currentColor",
219
- strokeLinecap: "round",
220
- strokeWidth: "1.5",
221
- key: "3"
222
- }],
223
- ["path", {
224
- d: "M18.3635 5.63672L16.2422 7.75804",
225
- stroke: "currentColor",
226
- strokeLinecap: "round",
227
- strokeWidth: "1.5",
228
- key: "4"
229
- }],
230
- ["path", {
231
- d: "M7.75804 16.2422L5.63672 18.3635",
232
- stroke: "currentColor",
233
- strokeLinecap: "round",
234
- strokeWidth: "1.5",
235
- key: "5"
236
- }],
237
- ["path", {
238
- d: "M18.3635 18.3635L16.2422 16.2422",
239
- stroke: "currentColor",
240
- strokeLinecap: "round",
241
- strokeWidth: "1.5",
242
- key: "6"
243
- }],
244
- ["path", {
245
- d: "M7.75804 7.75804L5.63672 5.63672",
246
- stroke: "currentColor",
247
- strokeLinecap: "round",
248
- strokeWidth: "1.5",
249
- key: "7"
250
- }]
251
- ]), g = n("ArrowDown02Icon", [["path", {
252
- d: "M12 18.502V5.00195",
253
- stroke: "currentColor",
254
- strokeLinecap: "round",
255
- strokeLinejoin: "round",
256
- strokeWidth: "1.5",
257
- key: "0"
258
- }], ["path", {
259
- d: "M18 13.002C18 13.002 13.5811 19.0019 12 19.002C10.4188 19.002 6 13.002 6 13.002",
260
- stroke: "currentColor",
261
- strokeLinecap: "round",
262
- strokeLinejoin: "round",
263
- strokeWidth: "1.5",
264
- key: "1"
265
- }]]);
266
- export { l as a, d as c, h as d, i as f, r as i, o as l, u as m, p as n, a as o, s as p, g as r, c as s, m as t, f as u };
@@ -1,111 +0,0 @@
1
- import { F as e, f as t, l as n, o as r } from "./button-D4GHW6oZ.js";
2
- import { P as i, S as a, j as o, t as s } from "./useValueChanged-DKq5cMot.js";
3
- import { a as c, c as l, i as u, n as d, r as f, t as p, u as m } from "./useLabelableId-8n0QmH8N.js";
4
- import * as h from "react";
5
- import { createContext as g, useContext as _ } from "react";
6
- import { jsx as v, jsxs as y } from "react/jsx-runtime";
7
- var b = h.createContext({
8
- canWrite: !0,
9
- canManageComments: !1,
10
- planRequired: !1,
11
- message: ""
12
- });
13
- function x() {
14
- return h.useContext(b);
15
- }
16
- function S() {
17
- let e = x();
18
- return e.canWrite ? null : /* @__PURE__ */ y("div", {
19
- className: "ck-read-only-notice",
20
- role: "status",
21
- children: [/* @__PURE__ */ v("p", { children: e.message }), e.planRequired ? /* @__PURE__ */ v("a", {
22
- href: "https://commentkit.dev/pricing",
23
- target: "_blank",
24
- rel: "noopener noreferrer",
25
- children: "View plans"
26
- }) : null]
27
- });
28
- }
29
- var C = g(!1);
30
- function w() {
31
- return _(C);
32
- }
33
- var T = /*#__PURE__*/ h.forwardRef(function(r, g) {
34
- let { render: _, className: v, id: y, name: b, value: x, disabled: S = !1, onValueChange: C, defaultValue: w, autoFocus: T = !1, style: E, ...D } = r, { state: O, name: k, disabled: A, setTouched: j, setDirty: M, validityData: N, setFilled: P, validationMode: F, validation: I } = l(), { clearErrors: L, elementRef: R, submitCountRef: z } = f(), B = A || S, V = k ?? b, H = {
35
- ...O,
36
- disabled: B
37
- }, { labelId: U } = d(), W = p({ id: y }), G = x !== void 0, K = x == null ? void 0 : String(x), q = t(() => I.inputRef.current?.value);
38
- u(I.inputRef, W, K, q, !B, b), e(() => {
39
- let e = K ?? I.inputRef.current?.value;
40
- e !== void 0 && P(e !== "");
41
- }, [
42
- K,
43
- w,
44
- I.inputRef,
45
- P
46
- ]), s(K, () => {
47
- K !== void 0 && (L(V), M(K !== (N.initialValue ?? "")), I.change(K));
48
- });
49
- let J = h.useRef(null), Y = c(B, J), X = i();
50
- return n("input", r, {
51
- ref: [g, J],
52
- state: H,
53
- props: [
54
- {
55
- id: W,
56
- disabled: B,
57
- name: V,
58
- ref: I.inputRef,
59
- "aria-labelledby": U,
60
- autoFocus: T,
61
- ...G ? { value: x } : { defaultValue: w },
62
- onChange(e) {
63
- let t = e.currentTarget.value, n = o(a, e.nativeEvent);
64
- C?.(t, n), !G && (M(t !== (N.initialValue ?? "")), P(t !== ""), !e.nativeEvent.defaultPrevented && !n.isCanceled && (L(V), I.change(t)));
65
- },
66
- onFocus() {
67
- Y(!0);
68
- },
69
- onBlur(e) {
70
- if (j(!0), Y(!1), F === "onBlur") {
71
- let t = e.currentTarget.value;
72
- I.commit(t), G && queueMicrotask(() => {
73
- let e = I.inputRef.current?.value;
74
- e !== void 0 && e !== t && e !== (N.initialValue ?? "") && I.commit(e);
75
- });
76
- }
77
- },
78
- onKeyDown(e) {
79
- if (e.currentTarget.tagName === "INPUT" && e.key === "Enter") {
80
- j(!0);
81
- let t = e.currentTarget.value, n = e.currentTarget.form;
82
- if (n && n === R.current && !e.defaultPrevented) {
83
- let t = e.currentTarget, n = z.current;
84
- X.start(0, () => {
85
- z.current === n && I.commit(t.value);
86
- });
87
- } else I.commit(t);
88
- }
89
- }
90
- },
91
- D,
92
- (e) => I.getValidationProps(B, e)
93
- ],
94
- stateAttributesMapping: m
95
- });
96
- }), E = /*#__PURE__*/ h.forwardRef(function(e, t) {
97
- return /*#__PURE__*/ v(T, {
98
- ref: t,
99
- ...e
100
- });
101
- }), D = h.forwardRef(function({ className: e, type: t, ...n }, i) {
102
- return /* @__PURE__ */ v(E, {
103
- ref: i,
104
- type: t,
105
- "data-slot": "input",
106
- className: r("ck-input", e),
107
- ...n
108
- });
109
- });
110
- D.displayName = "Input";
111
- export { b as a, S as i, C as n, x as o, w as r, D as t };
@@ -1,208 +0,0 @@
1
- import { o as e } from "./websocket-manager-KhH4hL0Q.js";
2
- import { u as t } from "./comment-kit-core-CmLUFujd.js";
3
- import { n } from "./errors-Bu5ajEmB.js";
4
- var r = null, i = /* @__PURE__ */ new Set();
5
- function a() {
6
- return r;
7
- }
8
- function o(e) {
9
- r = e;
10
- for (let e of i) e();
11
- }
12
- function s(e) {
13
- return i.add(e), () => {
14
- i.delete(e);
15
- };
16
- }
17
- function c() {
18
- r = null;
19
- for (let e of i) e();
20
- }
21
- function l(e) {
22
- return typeof e.requiresShortcut != "function" || !e.requiresShortcut();
23
- }
24
- function u(e, t) {
25
- return !!(t.isLoginModalVisible || t.isShortcutsOverlayVisible || t.isSidebarVisible || t.activeTool || t.selectedComment || t.activeComment || t.activeDrawing || t.activeScreenshot || t.error || t.isAuthenticated && (l(e) || t.isOverlayVisible));
26
- }
27
- function d(e, t) {
28
- return !!(!e.isOverlayVisible && t.isOverlayVisible || !e.isSidebarVisible && t.isSidebarVisible || !e.isLoginModalVisible && t.isLoginModalVisible || !e.isShortcutsOverlayVisible && t.isShortcutsOverlayVisible || !e.isAuthenticated && t.isAuthenticated || t.activeTool && t.activeTool !== e.activeTool || t.selectedComment && t.selectedComment.id !== e.selectedComment?.id || !e.activeComment && t.activeComment || !e.activeDrawing && t.activeDrawing || !e.activeScreenshot && t.activeScreenshot);
29
- }
30
- var f = "\n:host{all:initial;position:fixed;z-index:2147483647;font-family:var(--font-brand-sans,system-ui,sans-serif);color-scheme:light dark;--ck-bg:#f7f6f2;--ck-fg:#121316;--ck-border:#d9d6cf;--ck-primary:#ff5733;--ck-on-primary:#121316}\n:host([hidden]){display:none}\n:host([data-theme=dark]){--ck-bg:#121316;--ck-fg:#f7f6f2;--ck-border:#424348}\n@media(prefers-color-scheme:dark){:host(:not([data-theme=light])){--ck-bg:#121316;--ck-fg:#f7f6f2;--ck-border:#424348}}\n*{box-sizing:border-box} .launcher{display:flex;align-items:center;gap:8px;max-width:min(360px,calc(100vw - 32px));padding:8px;border:1px solid var(--ck-border);border-radius:16px;background:var(--ck-bg);color:var(--ck-fg);box-shadow:0 4px 18px #0002;font:14px/1.4 var(--font-brand-sans,system-ui,sans-serif)}\nbutton{appearance:none;display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:40px;padding:8px 12px;border:0;border-radius:10px;background:transparent;color:inherit;font:inherit;cursor:pointer}button:focus-visible{outline:2px solid var(--ck-primary);outline-offset:2px}button:disabled{cursor:wait;opacity:.7}button[data-primary]{background:var(--ck-primary);color:var(--ck-on-primary)}svg{width:24px;height:24px;flex:none}.message{margin:0;max-width:200px} [role=alert]{font-size:13px}\n";
31
- function p(e, t) {
32
- let n = document.createElement("div");
33
- n.setAttribute("data-commentkit-launcher", ""), n.setAttribute("data-commentkit-ui", "");
34
- let r = t.config?.ui?.position ?? "bottom-right";
35
- n.style.setProperty(r.startsWith("top") ? "top" : "bottom", "16px"), n.style.setProperty(r.endsWith("left") ? "left" : "right", "16px");
36
- let i = n.attachShadow({ mode: "open" }), o = document.createElement("style");
37
- o.textContent = f;
38
- let c = document.createElement("div");
39
- c.className = "launcher", i.append(o, c), e.append(n);
40
- let l = document.documentElement, u = window.matchMedia("(prefers-color-scheme: dark)"), d = () => {
41
- let e = t.config?.ui?.theme, r = e === "dark" || e === "light" ? e : null, i = l.style.colorScheme;
42
- n.dataset.theme = a() ?? r ?? (l.classList.contains("dark") ? "dark" : l.classList.contains("light") ? "light" : i === "light" || i === "dark" ? i : u.matches ? "dark" : "light");
43
- };
44
- d();
45
- let p = new MutationObserver(d);
46
- p.observe(l, {
47
- attributes: !0,
48
- attributeFilter: ["class", "style"]
49
- }), u.addEventListener("change", d);
50
- let m = s(d), h = (e, t) => {
51
- let n = document.createElement("button");
52
- return n.type = "button", n.textContent = e, n.addEventListener("click", t), n;
53
- };
54
- return {
55
- render(e, r = !0) {
56
- if (n.hidden = !r, c.replaceChildren(), r) {
57
- if (e === "idle") {
58
- let e = h("Comments", t.onActivate);
59
- e.setAttribute("aria-label", "Open Comments"), e.setAttribute("data-primary", "");
60
- let n = document.createElementNS("http://www.w3.org/2000/svg", "svg");
61
- n.setAttribute("viewBox", "0 0 64 64"), n.setAttribute("aria-hidden", "true");
62
- let r = document.createElementNS(n.namespaceURI, "path");
63
- r.setAttribute("d", "M31.5 4.8C17.3 4.4 7 15.2 7 29c0 13 8.5 21.2 20.9 23 1.6.2 2.1 1.2 2.1 2.5v6.9c0 1.7 1.2 2.1 2.5.9C38.2 57.4 48.5 48.7 53.6 40.2c3.5-5.8 4.7-11.8 3.2-18.1C54.3 11.5 44.7 4.6 31.5 4.8ZM23.1 20h16.7c3.4 0 4.7 1.7 4.7 4.8v7c0 3.2-1.6 4.6-4.7 4.6h-9.2l-5.4 5c-1 .9-1.9.4-1.6-1l.7-4h-1.2c-3.3 0-4.6-1.6-4.6-4.6v-7c0-3.1 1.3-4.8 4.6-4.8Z"), r.setAttribute("fill", "currentColor"), r.setAttribute("fill-rule", "evenodd"), n.append(r), e.prepend(n), c.append(e);
64
- } else {
65
- let n = document.createElement("p");
66
- n.className = "message", n.setAttribute("role", e === "error" ? "alert" : "status"), n.textContent = e === "error" ? "Could not load CommentKit. Check your connection and try again." : "Loading CommentKit…", c.append(n), e === "error" && c.append(h("Retry", t.onActivate)), c.append(h("Cancel", t.onCancel));
67
- }
68
- }
69
- },
70
- remove() {
71
- p.disconnect(), u.removeEventListener("change", d), m(), n.remove();
72
- }
73
- };
74
- }
75
- var m = /* @__PURE__ */ e({ mountCommentKitUI: () => b });
76
- function h(e, t) {
77
- try {
78
- return e?.[t];
79
- } catch {
80
- return;
81
- }
82
- }
83
- function g(e, t) {
84
- let n = h(e, t) ?? h(h(e, "default"), t);
85
- if (typeof n == "function") return n;
86
- throw TypeError(`React module did not provide ${t}`);
87
- }
88
- function _(e) {
89
- let t = e;
90
- if (!t || typeof t.getState != "function" || typeof t.on != "function") throw TypeError("CommentKit UI requires a valid CommentKitCore instance");
91
- }
92
- function v() {
93
- if (typeof document > "u" || !document.body) throw Error("CommentKit UI requires a browser document body");
94
- return document.body;
95
- }
96
- function y(e) {
97
- return typeof e == "function";
98
- }
99
- async function b(e, r = {}) {
100
- _(e);
101
- let i = v(), a = typeof e.getConfig == "function" ? e.getConfig() : void 0;
102
- if (r.signal?.aborted || a?.enabled === !1) return { unmount() {} };
103
- if (i.querySelector("[data-commentkit], [data-commentkit-host]")) return console.warn("[CommentKit] UI is already mounted on this page — skipping duplicate mount. Destroy the existing instance first if you need to remount."), { unmount() {} };
104
- let o = e.getState(), s = document.createElement("div");
105
- s.setAttribute("data-commentkit", ""), i.appendChild(s);
106
- let c = !1, f = () => {
107
- let e = t();
108
- e !== c && (c = e, s.style.display = e ? "none" : "", b && S && S(o));
109
- }, m = new MutationObserver(f);
110
- m.observe(i, {
111
- subtree: !0,
112
- childList: !0,
113
- attributes: !0,
114
- attributeFilter: [
115
- "open",
116
- "role",
117
- "aria-modal",
118
- "hidden",
119
- "class",
120
- "style"
121
- ]
122
- });
123
- let h = !0, b = null, x = null, S = null, C = null, w = 0, T = !1, E = !1, D = !1, O = o, k = u(e, o), A = null;
124
- f();
125
- let j = () => {
126
- if (!h) return;
127
- h = !1, m.disconnect(), w++, r.signal?.removeEventListener("abort", j);
128
- try {
129
- x?.();
130
- } catch {}
131
- x = null;
132
- let e = b;
133
- b = null;
134
- let t = () => {
135
- try {
136
- e?.unmount();
137
- } catch {}
138
- };
139
- e && r.deferUnmount ? queueMicrotask(t) : t(), A?.remove(), A = null, s.remove();
140
- }, M = () => {
141
- D = !0, E = !0, T = !1, w++, C = null, o.activeTool && e.setTool(null), o.isLoginModalVisible && e.toggleLoginModal(), o.isShortcutsOverlayVisible && e.toggleShortcutsOverlay(), o.isSidebarVisible && e.toggleSidebar(), !l(e) && e.getState().isOverlayVisible && e.toggleOverlay(), O = e.getState(), k = u(e, O), D = !1, A?.render("idle", l(e));
142
- }, N = () => {
143
- if (!h || b) return Promise.resolve();
144
- if (C) return C;
145
- T = !1, E = !1;
146
- let t = ++w;
147
- return A?.render("loading"), C = (async () => {
148
- try {
149
- let [n, r, i, l, u, d] = await Promise.all([
150
- import("react"),
151
- import("react-dom/client"),
152
- import("./styles-CnYsLS2f.js"),
153
- import("./shadow-root-B58ZI2yz.js"),
154
- import("./error-boundary-D3PD74vI.js"),
155
- import("./comment-kit-ui-BHwYuSIi.js").then((e) => e.t)
156
- ]);
157
- if (!h || t !== w) return;
158
- let f = g(n, "createElement"), p = g(r, "createRoot"), m = l.ShadowContainer, _ = u.ErrorBoundary;
159
- A?.remove(), A = null, b = p(s), S = (t) => {
160
- h && b && b.render(f(_, null, f(l.HostModalContext.Provider, { value: c }, f(m, {
161
- styles: i.default,
162
- config: a
163
- }, f(d.CommentKitUI, {
164
- core: e,
165
- state: t
166
- })))));
167
- }, S(o);
168
- } catch (r) {
169
- if (!h || t !== w) return;
170
- try {
171
- b?.unmount();
172
- } catch {}
173
- b = null, S = null, T = !0, A ||= P(), A.render("error");
174
- try {
175
- e.emit("error", n(r));
176
- } catch {}
177
- } finally {
178
- t === w && (C = null);
179
- }
180
- })(), C;
181
- }, P = () => p(s, {
182
- config: a,
183
- onActivate: () => {
184
- !T && l(e) && !e.getState().isSidebarVisible && e.toggleSidebar(), N();
185
- },
186
- onCancel: M
187
- }), F = (t) => {
188
- if (!h || (o = t, D)) return;
189
- if (b && S) {
190
- S(t);
191
- return;
192
- }
193
- let n = u(e, t);
194
- (!n || E && d(O, t)) && (E = !1), k && !n && C && (w++, C = null, A?.render("idle", l(e)));
195
- let r = n && !k;
196
- k = n, n && (!T || r) && !E ? N() : !C && !T && A?.render("idle", l(e));
197
- };
198
- try {
199
- A = P(), A.render("idle", l(e));
200
- let t = e.on("state:changed", F);
201
- if (!y(t)) throw TypeError("CommentKit core subscription did not return an unsubscribe function");
202
- x = t, r.signal?.addEventListener("abort", j, { once: !0 }), r.signal?.aborted ? j() : k && N();
203
- } catch (e) {
204
- throw j(), e;
205
- }
206
- return { unmount: j };
207
- }
208
- export { o as a, c as i, m as n, s as o, a as r, b as t };