@commentkit/comment-kit 1.6.0 → 2.0.1
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 +298 -590
- package/README.md +421 -145
- package/SECURITY.md +47 -46
- package/dist/node/THIRD_PARTY_NOTICES.txt +56 -0
- package/dist/node/browser.js +17 -0
- package/dist/node/cli/api.js +226 -0
- package/dist/node/cli/bin.js +18 -0
- package/dist/node/cli/credentials.js +268 -0
- package/dist/node/cli/doctor.js +789 -0
- package/dist/node/cli/format.js +54 -0
- package/dist/node/cli/init.js +686 -0
- package/dist/node/cli/main.js +537 -0
- package/dist/node/cli/mcp.js +295 -0
- package/dist/node/cli/open.js +20 -0
- package/dist/node/plugins/astro-B5y1Gtbf.js +31 -0
- package/dist/node/plugins/astro.js +26 -0
- package/dist/node/plugins/git-BIXLbL3f.js +92 -0
- package/dist/node/plugins/jsx-Bg4BdSph.js +7958 -0
- package/dist/node/plugins/next.js +48 -0
- package/dist/node/plugins/options-THop1K92.js +71 -0
- package/dist/node/plugins/transform-CKiAuSbk.js +1155 -0
- package/dist/node/plugins/vite-BdAYUW10.js +74 -0
- package/dist/node/plugins/vite.js +1 -0
- package/dist/node/plugins/webpack-R2U2DLlY.js +35 -0
- package/dist/node/plugins/webpack-loader.cjs +21 -0
- package/dist/node/plugins/webpack-loader.js +18 -0
- package/dist/node/plugins/webpack.js +1 -0
- package/dist/node/shared/dashboard-places.js +33 -0
- package/dist/node/shared/endpoint.js +26 -0
- package/dist/node/shared/format.js +63 -0
- package/dist/node/types/astro.d.ts +11 -0
- package/dist/node/types/next.d.ts +34 -0
- package/dist/node/types/options.d.ts +59 -0
- package/dist/node/types/vite.d.ts +11 -0
- package/dist/node/types/webpack-loader.d.ts +22 -0
- package/dist/node/types/webpack.d.ts +27 -0
- package/dist/npm/THIRD_PARTY_NOTICES.txt +6 -6
- package/dist/npm/chunks/AgentSend-DOy3jhyF.js +68 -0
- package/dist/npm/chunks/Checklist-CW_SwMpS.js +282 -0
- package/dist/npm/chunks/Composer-Bveq5QrK.js +727 -0
- package/dist/npm/chunks/Guest-7hcN765o.js +270 -0
- package/dist/npm/chunks/MarkupEditor-6bJGpWGO.js +345 -0
- package/dist/npm/chunks/Panel-ChPUB68C.js +1211 -0
- package/dist/npm/chunks/Settings-CB5eEKnf.js +231 -0
- package/dist/npm/chunks/Shortcuts-eAyjJ89P.js +62 -0
- package/dist/npm/chunks/StyleEditor-CZTdAA5c.js +46 -0
- package/dist/npm/chunks/StylePanel-B4pHQUL9.js +199 -0
- package/dist/npm/chunks/TaskFields-C8BX0Sgg.js +289 -0
- package/dist/npm/chunks/ThreadCard-B1EsX3PR.js +1160 -0
- package/dist/npm/chunks/Viewer-DY6zb90M.js +114 -0
- package/dist/npm/chunks/{agent-BDMQtOzH.js → agent-MTQHr9ei.js} +9 -9
- package/dist/npm/chunks/{anchor-BsradQhn.js → anchor-BsQNVkHj.js} +108 -85
- package/dist/npm/chunks/{ar-8tPch6W4.js → ar-L5cQ-NPe.js} +71 -19
- package/dist/npm/chunks/card-bits-CTdrkYn8.js +53 -0
- package/dist/npm/chunks/{client-EFTWxHbJ.js → client-7eVxvg5j.js} +282 -290
- package/dist/npm/chunks/confetti-BIs5s14P.js +49 -0
- package/dist/npm/chunks/context-BuMl7A07.js +48 -0
- package/dist/npm/chunks/context-Cf6khm7A.js +20 -0
- package/dist/npm/chunks/{de-C63897uD.js → de-D0C-v6tP.js} +62 -18
- package/dist/npm/chunks/dialog-DvdIkCW0.js +3 -0
- package/dist/npm/chunks/dpop-0A76OPa9.js +96 -0
- package/dist/npm/chunks/drafts-B0ctr1g9.js +21 -0
- package/dist/npm/chunks/{es-CI2bSpvB.js → es-Bw4Dj9tN.js} +62 -18
- package/dist/npm/chunks/extension-DFVOvciD.js +62 -0
- package/dist/npm/chunks/{extension-BST6LH1q.js → extension-SmoH5AA4.js} +20 -12
- package/dist/npm/chunks/files-4lV9YQIX.js +114 -0
- package/dist/npm/chunks/{fr-rsVe-Lqk.js → fr-TkuQaIAa.js} +120 -76
- package/dist/npm/chunks/{hi-cvwbSaWP.js → hi-DXSH2U8d.js} +63 -19
- package/dist/npm/chunks/{i18n-C4v0M-6z.js → i18n-aVSu9TcJ.js} +136 -92
- package/dist/npm/chunks/identify-BGYh2dVo.js +106 -0
- package/dist/npm/chunks/{it-C8tnV0BF.js → it-CiWA_bch.js} +81 -37
- package/dist/npm/chunks/{ja-BWxDfC2f.js → ja-C-QmR3yz.js} +60 -16
- package/dist/npm/chunks/late-words-80_VWt8S.js +14 -0
- package/dist/npm/chunks/live-BExWHzQ7.js +85 -0
- package/dist/npm/chunks/locale-D8Q4Q2Nt.js +26 -0
- package/dist/npm/chunks/{nl-DNQ6eCht.js → nl-CEmZRqjX.js} +63 -19
- package/dist/npm/chunks/page-key-HSY3Lze5.js +62 -0
- package/dist/npm/chunks/{pick-CLyOdjnD.js → pick-B3sR7jtS.js} +45 -44
- package/dist/npm/chunks/pkce-CfZhiNBi.js +8 -0
- package/dist/npm/chunks/placement-BF_HOUDD.js +74 -0
- package/dist/npm/chunks/privacy-BWUGlHw5.js +57 -0
- package/dist/npm/chunks/{pt-BR-CkG7vpU2.js → pt-BR-b-a8sxO8.js} +62 -18
- package/dist/npm/chunks/{realtime-DIo-Wth4.js → realtime-C79zF50C.js} +14 -12
- package/dist/npm/chunks/report-DaVuoRYS.js +44 -0
- package/dist/npm/chunks/show-BoN8AC-F.js +97 -0
- package/dist/npm/chunks/signin-BOWr_WCo.js +75 -0
- package/dist/npm/chunks/{source-CS7C6wJA.js → source-mk3rGBBQ.js} +1 -1
- package/dist/npm/chunks/src-C8rZFyL_.js +215 -0
- package/dist/npm/chunks/start-CV4j78_q.js +1894 -0
- package/dist/npm/chunks/states-b9Bv3Ci7.js +3 -0
- package/dist/npm/chunks/upload-B2mkgMeJ.js +42 -0
- package/dist/npm/chunks/uploads-8AxyRq7g.js +1147 -0
- package/dist/npm/chunks/wrap-DW6EFbVQ.js +69 -0
- package/dist/npm/chunks/{zh-CN-BKuZOLBE.js → zh-CN-JTscW8u8.js} +61 -17
- package/dist/npm/element.js +58 -21
- package/dist/npm/headless.js +7 -3
- package/dist/npm/index.js +3 -3
- package/dist/npm/react.js +18 -11
- package/dist/npm/svelte.js +28 -12
- package/dist/npm/types/adapters/react.d.ts +4 -1
- package/dist/npm/types/adapters/svelte.d.ts +4 -1
- package/dist/npm/types/adapters/vue.d.ts +35 -2
- package/dist/npm/types/anchor/index.d.ts +19 -0
- package/dist/npm/types/capture/privacy.d.ts +14 -0
- package/dist/npm/types/core/api.d.ts +20 -1
- package/dist/npm/types/core/auth.d.ts +40 -21
- package/dist/npm/types/core/client.d.ts +60 -4
- package/dist/npm/types/core/page-key.d.ts +42 -0
- package/dist/npm/types/core/types.d.ts +87 -4
- package/dist/npm/types/element.d.ts +17 -7
- package/dist/npm/types/headless.d.ts +2 -1
- package/dist/npm/types/index.d.ts +16 -6
- package/dist/npm/vue.js +44 -9
- package/package.json +90 -14
- package/dist/npm/chunks/AgentSend-2JPDseOo.js +0 -63
- package/dist/npm/chunks/Checklist-BpDXQebo.js +0 -257
- package/dist/npm/chunks/Composer-CAyj-c8e.js +0 -677
- package/dist/npm/chunks/Guest-ZdFmTcXI.js +0 -187
- package/dist/npm/chunks/MarkupEditor-BFplZwFy.js +0 -332
- package/dist/npm/chunks/Panel-BhZ4XRDR.js +0 -861
- package/dist/npm/chunks/Settings-SPG9EHUZ.js +0 -204
- package/dist/npm/chunks/Shortcuts-C28HVDw6.js +0 -58
- package/dist/npm/chunks/StyleEditor-ByZMtq10.js +0 -43
- package/dist/npm/chunks/StylePanel-Iwhce2tE.js +0 -197
- package/dist/npm/chunks/TaskFields-BsP_fVJg.js +0 -273
- package/dist/npm/chunks/ThreadCard-BzVZdDCb.js +0 -1030
- package/dist/npm/chunks/Viewer-CqtGrdD8.js +0 -108
- package/dist/npm/chunks/card-bits-Bna-g3Py.js +0 -124
- package/dist/npm/chunks/confetti-DTKpwF3O.js +0 -40
- package/dist/npm/chunks/drafts-akdBsOd0.js +0 -50
- package/dist/npm/chunks/extension-D-V3utTm.js +0 -53
- package/dist/npm/chunks/live-BCpJVBeN.js +0 -33
- package/dist/npm/chunks/report-BBrT3r89.js +0 -27
- package/dist/npm/chunks/src-C4FsVoUp.js +0 -148
- package/dist/npm/chunks/start-i9M-r3aH.js +0 -1800
- package/dist/npm/chunks/upload-DSv7EyBD.js +0 -41
- package/dist/npm/chunks/uploads-I01kdqQF.js +0 -1103
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
import { c as e } from "./client-7eVxvg5j.js";
|
|
2
|
+
import { _ as t, b as n, c as r, d as i, f as a, m as o, u as s } from "./i18n-aVSu9TcJ.js";
|
|
3
|
+
import { i as c } from "./files-4lV9YQIX.js";
|
|
4
|
+
import { t as l } from "./dialog-DvdIkCW0.js";
|
|
5
|
+
import { C as u, M as d, a as f, b as p, h as m, i as h, r as g, s as _, y as v } from "./start-CV4j78_q.js";
|
|
6
|
+
_(l), _(".ck-settings .ck-card-body{grid-template-columns:minmax(0,1fr);gap:16px;display:grid}.ck-account{border-radius:var(--ck-radius-md);background:var(--ck-bg-muted);align-items:center;gap:12px;padding:12px;display:flex}.ck-account .ck-avatar{--ck-av:40px}.ck-account>div{min-width:0;font-size:var(--ck-fs-sm);gap:2px;display:grid}.ck-account .ck-msg-name,.ck-account .ck-muted{overflow-wrap:anywhere}.ck-setting h3{font-size:var(--ck-fs-sm);letter-spacing:.05em;text-transform:uppercase;color:var(--ck-text-muted);margin:0 0 8px;font-weight:600}.ck-root:-webkit-any(:lang(ar),:lang(hi),:lang(ja),:lang(zh)) .ck-setting h3{letter-spacing:0}.ck-root:is(:lang(ar),:lang(hi),:lang(ja),:lang(zh)) .ck-setting h3{letter-spacing:0}.ck-setting-hint{font-size:var(--ck-fs-sm);text-wrap:pretty;margin:8px 0 0}.ck-toggle{border-radius:var(--ck-radius-sm);width:100%;min-height:36px;color:var(--ck-text);font-size:var(--ck-fs);text-align:start;background:0 0;border:0;justify-content:space-between;align-items:center;gap:12px;padding:0;display:flex}.ck-toggle:focus-visible{outline-offset:2px}.ck-switch{border-radius:var(--ck-radius-pill);background:var(--ck-text-muted);width:36px;height:20px;transition:background-color var(--ck-fast);flex:none;position:relative}.ck-switch:after{content:\"\";top:2px;background:var(--ck-bg);width:16px;height:16px;box-shadow:var(--ck-shadow-sm);border-radius:50%;position:absolute}.ck-switch:not(:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))):after{left:2px}.ck-switch:not(:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))):after{left:2px}.ck-switch:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)):after{right:2px}.ck-switch:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)):after{right:2px}.ck-toggle[aria-checked=true] .ck-switch{background:var(--ck-accent)}.ck-toggle[aria-checked=true] .ck-switch:after{background:var(--ck-accent-ink)}.ck-toggle[aria-checked=true] .ck-switch:not(:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))):after{left:18px}.ck-toggle[aria-checked=true] .ck-switch:not(:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))):after{left:18px}.ck-toggle[aria-checked=true] .ck-switch:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)):after{right:18px}.ck-toggle[aria-checked=true] .ck-switch:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)):after{right:18px}.ck-segment{border-radius:var(--ck-radius-md);background:var(--ck-bg-muted);grid-template-columns:repeat(3,minmax(0,1fr));gap:2px;padding:4px;display:grid}.ck-segment button{border-radius:var(--ck-radius-sm);height:32px;color:var(--ck-text-muted);font-size:var(--ck-fs-md);white-space:nowrap;text-overflow:ellipsis;transition:background-color var(--ck-fast), color var(--ck-fast);background:0 0;border:0;padding:0 8px;font-weight:600;overflow:hidden}.ck-segment button[aria-checked=true]{background:var(--ck-bg);color:var(--ck-text);box-shadow:var(--ck-shadow-sm)}.ck-segment button:focus-visible{outline-offset:-2px}.ck-segment button:active{scale:.96}.ck-setting-links{border-top:1px solid var(--ck-hairline);gap:2px;padding-top:8px;display:grid}.ck-setting-links a,.ck-setting-links button{border-radius:var(--ck-radius-sm);width:100%;min-height:36px;color:var(--ck-text);font-size:var(--ck-fs);text-align:start;transition:background-color var(--ck-fast);background:0 0;border:0;align-items:center;gap:12px;padding:8px 12px;text-decoration:none;display:flex}.ck-setting-links :-webkit-any(a,button):focus-visible{outline-offset:-2px}.ck-setting-links :is(a,button):focus-visible{outline-offset:-2px}.ck-setting-links :-webkit-any(a,button):active{background:var(--ck-bg-hover)}.ck-setting-links :is(a,button):active{background:var(--ck-bg-hover)}.ck-setting-links svg{color:var(--ck-text-muted);flex:none}.ck-setting-links .ck-danger{color:var(--ck-danger)}.ck-setting-links .ck-danger svg{color:currentColor}.ck-team{grid-template-columns:minmax(0,1fr);gap:2px;margin:0;padding:0;list-style:none;display:grid}.ck-team li{min-height:32px;font-size:var(--ck-fs-md);align-items:center;gap:8px;padding-block-start:4px;padding-block-end:4px;display:flex}.ck-team-name{overflow-wrap:anywhere;min-width:0}.ck-team li>.ck-muted{flex:none}.ck-team-face{flex:none;display:inline-flex;position:relative}.ck-team-face .ck-avatar{--ck-av:24px}.ck-online{background:var(--ck-success);width:8px;height:8px;box-shadow:0 0 0 2px var(--ck-bg);border-radius:50%;position:absolute;bottom:-2px}.ck-online:not(:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){right:-2px}.ck-online:not(:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi))){right:-2px}.ck-online:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){left:-2px}.ck-online:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){left:-2px}.ck-team-role{font-size:var(--ck-fs-sm);margin-inline-start:auto}.ck-meter{border-radius:var(--ck-radius-pill);background:var(--ck-bg-muted);outline:1px solid var(--ck-hairline);outline-offset:-1px;height:6px;overflow:hidden}.ck-meter>span{background:var(--ck-accent);border-radius:inherit;height:100%;display:block}.ck-meter>span[data-high]{background:var(--ck-warning)}@media (hover:hover){.ck-setting-links a:hover,.ck-setting-links button:hover{background:var(--ck-bg-hover)}.ck-segment button:hover{color:var(--ck-text)}}@media (pointer:coarse){.ck-segment button,.ck-setting-links a,.ck-setting-links button{min-height:44px}}@media (forced-colors:active){.ck-segment button[aria-checked=true]{color:highlighttext;background:highlight}.ck-switch{background:canvas;border:1px solid canvastext}.ck-switch:after,.ck-toggle[aria-checked=true] .ck-switch:after{background:canvastext}.ck-toggle[aria-checked=true] .ck-switch{background:highlight}}@media (pointer:coarse){.ck-toggle{min-height:44px}}@media (prefers-reduced-motion:reduce){.ck-segment button:active{scale:none}}");
|
|
7
|
+
var y = [
|
|
8
|
+
["auto", "themeSystem"],
|
|
9
|
+
["light", "themeLight"],
|
|
10
|
+
["dark", "themeDark"]
|
|
11
|
+
];
|
|
12
|
+
function b({ client: l, onClose: _, onShortcuts: b, onHide: C, onSignOut: w }) {
|
|
13
|
+
let T = v(l.state, (e) => e.session), E = v(l.state, (e) => e.theme ?? l.options.theme ?? e.config?.appearance?.theme ?? "auto"), D = o(null), O = v(l.state, (e) => e.team), k = T?.role === "admin" || T?.role === "member", [A, j] = t(null), [M, N] = t(null);
|
|
14
|
+
i(() => {
|
|
15
|
+
k && (l.people().then((e) => j(e.filter((e) => e.role && e.role !== "reviewer")), () => j([])), l.usage().then(N, () => N(null)));
|
|
16
|
+
}, [k]), a(() => {
|
|
17
|
+
let e = D.current?.getRootNode(), t = e?.activeElement ?? document.activeElement;
|
|
18
|
+
return D.current?.focus({ preventScroll: !0 }), () => x(t, e);
|
|
19
|
+
}, []);
|
|
20
|
+
let P = l.options.shortcuts !== !1, F = !!T?.capabilities.triage, [I, L] = t(() => f(F));
|
|
21
|
+
i(() => g(() => L(f(F))), []);
|
|
22
|
+
let R = (t) => {
|
|
23
|
+
e(t), l.state.set({ theme: t });
|
|
24
|
+
}, z = d(T?.dashboard_url), B = A?.find((e) => e.id === T?.person.id)?.role, V = T ? r(`role_${B === "owner" ? "owner" : T.role}`) : "";
|
|
25
|
+
return /* @__PURE__ */ s("div", {
|
|
26
|
+
class: "ck-scrim",
|
|
27
|
+
"data-commentkit-ui": !0,
|
|
28
|
+
onClick: (e) => e.target === e.currentTarget && _(),
|
|
29
|
+
children: /* @__PURE__ */ s("div", {
|
|
30
|
+
class: "ck-card ck-dialog ck-settings",
|
|
31
|
+
role: "dialog",
|
|
32
|
+
"aria-modal": "true",
|
|
33
|
+
"aria-labelledby": "ck-settings-title",
|
|
34
|
+
onKeyDown: (e) => {
|
|
35
|
+
e.stopPropagation(), e.key === "Escape" ? _() : S(e);
|
|
36
|
+
},
|
|
37
|
+
children: [/* @__PURE__ */ s("div", {
|
|
38
|
+
class: "ck-card-head",
|
|
39
|
+
children: [/* @__PURE__ */ s("h2", {
|
|
40
|
+
class: "ck-card-title",
|
|
41
|
+
id: "ck-settings-title",
|
|
42
|
+
children: r("settings")
|
|
43
|
+
}), /* @__PURE__ */ s("button", {
|
|
44
|
+
class: "ck-ghost",
|
|
45
|
+
ref: D,
|
|
46
|
+
"aria-label": r("close"),
|
|
47
|
+
title: r("close"),
|
|
48
|
+
onClick: _,
|
|
49
|
+
children: /* @__PURE__ */ s(u, { name: "close" })
|
|
50
|
+
})]
|
|
51
|
+
}), /* @__PURE__ */ s("div", {
|
|
52
|
+
class: "ck-card-body",
|
|
53
|
+
children: [
|
|
54
|
+
T ? /* @__PURE__ */ s("section", {
|
|
55
|
+
class: "ck-account",
|
|
56
|
+
"aria-label": r("account"),
|
|
57
|
+
children: [/* @__PURE__ */ s(p, { person: T.person }), /* @__PURE__ */ s("div", { children: [
|
|
58
|
+
/* @__PURE__ */ s("bdi", {
|
|
59
|
+
class: "ck-msg-name",
|
|
60
|
+
children: T.person.name
|
|
61
|
+
}),
|
|
62
|
+
T.email ? /* @__PURE__ */ s("div", {
|
|
63
|
+
class: "ck-muted",
|
|
64
|
+
children: /* @__PURE__ */ s("bdi", { children: T.email })
|
|
65
|
+
}) : null,
|
|
66
|
+
/* @__PURE__ */ s("div", {
|
|
67
|
+
class: "ck-muted",
|
|
68
|
+
children: [
|
|
69
|
+
/* @__PURE__ */ s("bdi", { children: T.project.name }),
|
|
70
|
+
" · ",
|
|
71
|
+
V
|
|
72
|
+
]
|
|
73
|
+
})
|
|
74
|
+
] })]
|
|
75
|
+
}) : null,
|
|
76
|
+
/* @__PURE__ */ s("section", {
|
|
77
|
+
class: "ck-setting",
|
|
78
|
+
children: [
|
|
79
|
+
/* @__PURE__ */ s("h3", {
|
|
80
|
+
id: "ck-theme-label",
|
|
81
|
+
children: r("appearance")
|
|
82
|
+
}),
|
|
83
|
+
/* @__PURE__ */ s("div", {
|
|
84
|
+
class: "ck-segment",
|
|
85
|
+
role: "radiogroup",
|
|
86
|
+
"aria-labelledby": "ck-theme-label",
|
|
87
|
+
onKeyDown: (e) => m(e, "[role=radio]"),
|
|
88
|
+
children: y.map(([e, t]) => /* @__PURE__ */ s("button", {
|
|
89
|
+
role: "radio",
|
|
90
|
+
"aria-checked": E === e,
|
|
91
|
+
tabIndex: E === e ? 0 : -1,
|
|
92
|
+
onClick: () => R(e),
|
|
93
|
+
onFocus: () => E !== e && R(e),
|
|
94
|
+
children: r(t)
|
|
95
|
+
}))
|
|
96
|
+
}),
|
|
97
|
+
/* @__PURE__ */ s("p", {
|
|
98
|
+
class: "ck-muted ck-setting-hint",
|
|
99
|
+
children: r("appearanceHint")
|
|
100
|
+
})
|
|
101
|
+
]
|
|
102
|
+
}),
|
|
103
|
+
P ? /* @__PURE__ */ s("section", {
|
|
104
|
+
class: "ck-setting",
|
|
105
|
+
children: [
|
|
106
|
+
/* @__PURE__ */ s("h3", { children: r("shortcutsTitle") }),
|
|
107
|
+
/* @__PURE__ */ s("button", {
|
|
108
|
+
class: "ck-toggle",
|
|
109
|
+
role: "switch",
|
|
110
|
+
"aria-checked": I,
|
|
111
|
+
"aria-describedby": "ck-keys-hint",
|
|
112
|
+
onClick: () => h(!I),
|
|
113
|
+
children: [/* @__PURE__ */ s("span", { children: r("shortcutsSetting") }), /* @__PURE__ */ s("span", {
|
|
114
|
+
class: "ck-switch",
|
|
115
|
+
"aria-hidden": "true"
|
|
116
|
+
})]
|
|
117
|
+
}),
|
|
118
|
+
/* @__PURE__ */ s("p", {
|
|
119
|
+
class: "ck-muted ck-setting-hint",
|
|
120
|
+
id: "ck-keys-hint",
|
|
121
|
+
children: r("shortcutsSettingHint")
|
|
122
|
+
})
|
|
123
|
+
]
|
|
124
|
+
}) : null,
|
|
125
|
+
k && A?.length ? /* @__PURE__ */ s("section", {
|
|
126
|
+
class: "ck-setting",
|
|
127
|
+
children: [/* @__PURE__ */ s("h3", { children: r("team") }), /* @__PURE__ */ s("ul", {
|
|
128
|
+
class: "ck-team",
|
|
129
|
+
children: A.map((e) => /* @__PURE__ */ s("li", { children: [
|
|
130
|
+
/* @__PURE__ */ s("span", {
|
|
131
|
+
class: "ck-team-face",
|
|
132
|
+
children: [/* @__PURE__ */ s(p, { person: e }), O.some((t) => t.id === e.id) ? /* @__PURE__ */ s("span", {
|
|
133
|
+
class: "ck-online",
|
|
134
|
+
role: "img",
|
|
135
|
+
"aria-label": r("online")
|
|
136
|
+
}) : null]
|
|
137
|
+
}),
|
|
138
|
+
/* @__PURE__ */ s("bdi", {
|
|
139
|
+
class: "ck-team-name",
|
|
140
|
+
children: e.name
|
|
141
|
+
}),
|
|
142
|
+
e.id === T?.person.id ? /* @__PURE__ */ s("span", {
|
|
143
|
+
class: "ck-muted",
|
|
144
|
+
children: [
|
|
145
|
+
"(",
|
|
146
|
+
r("you"),
|
|
147
|
+
")"
|
|
148
|
+
]
|
|
149
|
+
}) : null,
|
|
150
|
+
/* @__PURE__ */ s("span", {
|
|
151
|
+
class: "ck-muted ck-team-role",
|
|
152
|
+
children: r(`role_${e.role === "owner" ? "owner" : e.role === "admin" ? "admin" : "member"}`)
|
|
153
|
+
})
|
|
154
|
+
] }))
|
|
155
|
+
})]
|
|
156
|
+
}) : null,
|
|
157
|
+
k && M ? /* @__PURE__ */ s("section", {
|
|
158
|
+
class: "ck-setting",
|
|
159
|
+
children: [/* @__PURE__ */ s("h3", { children: r("storage") }), M.limit_bytes ? /* @__PURE__ */ s(n, { children: [/* @__PURE__ */ s("div", {
|
|
160
|
+
class: "ck-meter",
|
|
161
|
+
role: "meter",
|
|
162
|
+
"aria-valuemin": 0,
|
|
163
|
+
"aria-valuemax": M.limit_bytes,
|
|
164
|
+
"aria-valuenow": M.used_bytes,
|
|
165
|
+
"aria-label": r("storage"),
|
|
166
|
+
children: /* @__PURE__ */ s("span", {
|
|
167
|
+
style: { width: `${Math.min(100, Math.round(M.used_bytes / M.limit_bytes * 100))}%` },
|
|
168
|
+
"data-high": M.used_bytes / M.limit_bytes > .85 || void 0
|
|
169
|
+
})
|
|
170
|
+
}), /* @__PURE__ */ s("p", {
|
|
171
|
+
class: "ck-muted ck-setting-hint",
|
|
172
|
+
children: r("storageUsed", {
|
|
173
|
+
used: c(M.used_bytes),
|
|
174
|
+
limit: c(M.limit_bytes)
|
|
175
|
+
})
|
|
176
|
+
})] }) : /* @__PURE__ */ s("p", {
|
|
177
|
+
class: "ck-muted ck-setting-hint",
|
|
178
|
+
children: r("storageUsedOnly", { used: c(M.used_bytes) })
|
|
179
|
+
})]
|
|
180
|
+
}) : null,
|
|
181
|
+
/* @__PURE__ */ s("nav", {
|
|
182
|
+
class: "ck-setting-links",
|
|
183
|
+
"aria-label": r("settings"),
|
|
184
|
+
children: [
|
|
185
|
+
z ? /* @__PURE__ */ s("a", {
|
|
186
|
+
href: z,
|
|
187
|
+
target: "_blank",
|
|
188
|
+
rel: "noopener noreferrer",
|
|
189
|
+
children: [/* @__PURE__ */ s(u, {
|
|
190
|
+
name: "link",
|
|
191
|
+
size: 16
|
|
192
|
+
}), r("openDashboard")]
|
|
193
|
+
}) : null,
|
|
194
|
+
b ? /* @__PURE__ */ s("button", {
|
|
195
|
+
onClick: () => (_(), b()),
|
|
196
|
+
children: [/* @__PURE__ */ s(u, {
|
|
197
|
+
name: "info",
|
|
198
|
+
size: 16
|
|
199
|
+
}), r("shortcutsTitle")]
|
|
200
|
+
}) : null,
|
|
201
|
+
F ? /* @__PURE__ */ s("button", {
|
|
202
|
+
onClick: C,
|
|
203
|
+
children: [/* @__PURE__ */ s(u, {
|
|
204
|
+
name: "close",
|
|
205
|
+
size: 16
|
|
206
|
+
}), r("hideWidget")]
|
|
207
|
+
}) : null,
|
|
208
|
+
T ? /* @__PURE__ */ s("button", {
|
|
209
|
+
class: "ck-danger",
|
|
210
|
+
onClick: () => (_(), w()),
|
|
211
|
+
children: [/* @__PURE__ */ s(u, {
|
|
212
|
+
name: "user",
|
|
213
|
+
size: 16
|
|
214
|
+
}), r("signOut")]
|
|
215
|
+
}) : null
|
|
216
|
+
]
|
|
217
|
+
})
|
|
218
|
+
]
|
|
219
|
+
})]
|
|
220
|
+
})
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
function x(e, t) {
|
|
224
|
+
(e instanceof HTMLElement && e.isConnected && e !== document.body ? e : t?.querySelector("[aria-haspopup=menu]"))?.focus({ preventScroll: !0 });
|
|
225
|
+
}
|
|
226
|
+
function S(e) {
|
|
227
|
+
if (e.key !== "Tab") return;
|
|
228
|
+
let t = e.currentTarget, n = [...t.querySelectorAll("a[href], button:not(:disabled), input:not(:disabled)")].filter((e) => e.tabIndex >= 0), r = t.getRootNode().activeElement, [i, a] = [n[0], n[n.length - 1]];
|
|
229
|
+
i && a && (e.shiftKey ? r === i || !t.contains(r) : r === a) && (e.preventDefault(), (e.shiftKey ? a : i).focus());
|
|
230
|
+
}
|
|
231
|
+
export { b as Settings };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { c as e, f as t, m as n, u as r } from "./i18n-aVSu9TcJ.js";
|
|
2
|
+
import { t as i } from "./dialog-DvdIkCW0.js";
|
|
3
|
+
import { C as a, s as o } from "./start-CV4j78_q.js";
|
|
4
|
+
o(i), o(".ck-keys{gap:12px;margin:0;display:grid}.ck-keys:focus-visible{outline-offset:-2px}.ck-scrim:has(.ck-keys){animation:none}.ck-scrim:has(.ck-keys) .ck-card{animation:none}.ck-keys div{grid-template-columns:minmax(96px,auto) 1fr;align-items:baseline;gap:12px;display:grid}.ck-keys dt{text-align:start}.ck-keys dd{color:var(--ck-text-muted);font-size:var(--ck-fs-md);margin:0}.ck-keys kbd{border:1px solid var(--ck-border);border-radius:var(--ck-radius-sm);background:var(--ck-bg-muted);color:var(--ck-text);font-family:var(--ck-mono);font-size:var(--ck-fs-sm);white-space:nowrap;border-bottom-width:2px;padding:0 7px;line-height:20px;display:inline-block}");
|
|
5
|
+
var s = [
|
|
6
|
+
["C", "shortcutComment"],
|
|
7
|
+
["J / K", "shortcutNext"],
|
|
8
|
+
["E", "shortcutResolve"],
|
|
9
|
+
["Esc", "shortcutClose"],
|
|
10
|
+
["Enter", "shortcutSend"],
|
|
11
|
+
["Shift + Enter", "shortcutNewLine"],
|
|
12
|
+
["⌘ / Ctrl + B · I · E", "shortcutFormat"],
|
|
13
|
+
["⌘ / Ctrl + Shift + K", "shortcutToggle"],
|
|
14
|
+
["?", "shortcutHelp"]
|
|
15
|
+
];
|
|
16
|
+
function c({ onClose: i }) {
|
|
17
|
+
let o = n(null), c = n(null);
|
|
18
|
+
return t(() => {
|
|
19
|
+
let e = o.current?.getRootNode(), t = e?.activeElement ?? document.activeElement;
|
|
20
|
+
return o.current?.focus({ preventScroll: !0 }), () => {
|
|
21
|
+
(t instanceof HTMLElement && t.isConnected && t !== document.body ? t : e?.querySelector("[aria-haspopup=menu]"))?.focus({ preventScroll: !0 });
|
|
22
|
+
};
|
|
23
|
+
}, []), /* @__PURE__ */ r("div", {
|
|
24
|
+
class: "ck-scrim",
|
|
25
|
+
"data-commentkit-ui": !0,
|
|
26
|
+
onClick: (e) => e.target === e.currentTarget && i(),
|
|
27
|
+
children: /* @__PURE__ */ r("div", {
|
|
28
|
+
class: "ck-card ck-dialog",
|
|
29
|
+
role: "dialog",
|
|
30
|
+
"aria-modal": "true",
|
|
31
|
+
"aria-labelledby": "ck-shortcuts-title",
|
|
32
|
+
onKeyDown: (e) => {
|
|
33
|
+
e.stopPropagation(), e.key === "Escape" || e.key === "?" ? (e.preventDefault(), i()) : e.key === "Tab" && (e.preventDefault(), (o.current?.getRootNode()?.activeElement === o.current ? c.current : o.current)?.focus());
|
|
34
|
+
},
|
|
35
|
+
children: [/* @__PURE__ */ r("div", {
|
|
36
|
+
class: "ck-card-head",
|
|
37
|
+
children: [/* @__PURE__ */ r("h2", {
|
|
38
|
+
class: "ck-card-title",
|
|
39
|
+
id: "ck-shortcuts-title",
|
|
40
|
+
children: e("shortcutsTitle")
|
|
41
|
+
}), /* @__PURE__ */ r("button", {
|
|
42
|
+
class: "ck-ghost",
|
|
43
|
+
ref: o,
|
|
44
|
+
"aria-label": e("close"),
|
|
45
|
+
title: e("close"),
|
|
46
|
+
onClick: i,
|
|
47
|
+
children: /* @__PURE__ */ r(a, { name: "close" })
|
|
48
|
+
})]
|
|
49
|
+
}), /* @__PURE__ */ r("dl", {
|
|
50
|
+
class: "ck-card-body ck-keys",
|
|
51
|
+
ref: c,
|
|
52
|
+
tabIndex: 0,
|
|
53
|
+
"aria-labelledby": "ck-shortcuts-title",
|
|
54
|
+
children: s.map(([t, n]) => /* @__PURE__ */ r("div", { children: [/* @__PURE__ */ r("dt", { children: /* @__PURE__ */ r("kbd", {
|
|
55
|
+
dir: "ltr",
|
|
56
|
+
children: t
|
|
57
|
+
}) }), /* @__PURE__ */ r("dd", { children: e(n) })] }))
|
|
58
|
+
})]
|
|
59
|
+
})
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
export { c as Shortcuts };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { _ as e, c as t, f as n, m as r, u as i } from "./i18n-aVSu9TcJ.js";
|
|
2
|
+
import { a, i as o, o as s } from "./uploads-8AxyRq7g.js";
|
|
3
|
+
import { r as c } from "./context-Cf6khm7A.js";
|
|
4
|
+
import { StylePanel as l } from "./StylePanel-B4pHQUL9.js";
|
|
5
|
+
// src/ui/StyleEditor.tsx
|
|
6
|
+
function u({ thread: u, element: d, onSaved: f, onClose: p }, m) {
|
|
7
|
+
let { client: h, reportError: g } = c(m), [_] = e(() => {
|
|
8
|
+
let e = s(d);
|
|
9
|
+
for (let t of a(u.style_changes)) t.from && (e[t.property] = t.from);
|
|
10
|
+
return e;
|
|
11
|
+
}), [v, y] = e(() => a(u.style_changes)), [b, x] = e(!1), S = r(null);
|
|
12
|
+
n(() => {
|
|
13
|
+
let e = new o(d);
|
|
14
|
+
return S.current = e, () => e.revert();
|
|
15
|
+
}, [d]), n(() => S.current?.apply(v), [v]);
|
|
16
|
+
let C = async () => {
|
|
17
|
+
if (!b) {
|
|
18
|
+
x(!0);
|
|
19
|
+
try {
|
|
20
|
+
f(await h.updateThread(u.id, { style_changes: a(v) })), p();
|
|
21
|
+
} catch (e) {
|
|
22
|
+
x(!1), g(e);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
return /* @__PURE__ */ i(l, {
|
|
27
|
+
base: _,
|
|
28
|
+
changes: v,
|
|
29
|
+
onChange: y,
|
|
30
|
+
onClose: p,
|
|
31
|
+
actions: /* @__PURE__ */ i("span", {
|
|
32
|
+
class: "ck-style-actions",
|
|
33
|
+
children: [/* @__PURE__ */ i("button", {
|
|
34
|
+
class: "ck-ghost ck-ghost-sm",
|
|
35
|
+
onClick: p,
|
|
36
|
+
children: t("cancel")
|
|
37
|
+
}), /* @__PURE__ */ i("button", {
|
|
38
|
+
class: "ck-btn ck-primary ck-style-done",
|
|
39
|
+
"aria-disabled": b || void 0,
|
|
40
|
+
onClick: () => void C(),
|
|
41
|
+
children: t("save")
|
|
42
|
+
})]
|
|
43
|
+
})
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
export { u as StyleEditor };
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import { _ as e, b as t, c as n, d as r, u as i } from "./i18n-aVSu9TcJ.js";
|
|
2
|
+
import { r as a, s as o } from "./uploads-8AxyRq7g.js";
|
|
3
|
+
import { s } from "./start-CV4j78_q.js";
|
|
4
|
+
// src/ui/StylePanel.tsx
|
|
5
|
+
s(".ck-style-panel{border-radius:var(--ck-radius-md);background:var(--ck-bg-muted);box-shadow:0 0 0 1px var(--ck-hairline);margin-top:8px;padding:8px 12px 12px}.ck-style-head{min-height:28px;font-size:var(--ck-fs-md);justify-content:space-between;align-items:center;gap:8px;display:flex}.ck-style-done{height:28px;font-size:var(--ck-fs-sm);padding:0 12px}.ck-style-actions{align-items:center;gap:4px;display:flex}.ck-style-actions .ck-ghost-sm{height:28px;padding:0 8px}.ck-style-hint{font-size:var(--ck-fs-sm);text-wrap:pretty;margin:4px 0 8px;line-height:1.4}.ck-style-rows{overscroll-behavior:contain;gap:4px;max-height:236px;margin-inline-start:-4px;margin-inline-end:-4px;padding-inline-start:4px;padding-inline-end:4px;display:grid;overflow:auto}.ck-style-row{border-radius:var(--ck-radius-sm);min-height:32px;transition:background-color var(--ck-fast);grid-template-columns:minmax(96px,40%) 1fr;align-items:center;column-gap:8px;padding:0 4px;display:grid}.ck-style-row[data-changed]{background:color-mix(in srgb, var(--ck-accent) 10%, transparent)}.ck-style-row .ck-error{grid-column:2;padding-block-start:4px;padding-block-end:4px}.ck-style-name{text-overflow:ellipsis;white-space:nowrap;min-width:0;font-size:var(--ck-fs-sm);color:var(--ck-text-muted);overflow:hidden}.ck-style-name code{font-family:var(--ck-mono);font-size:var(--ck-fs-xs)}.ck-style-row[data-changed] .ck-style-name{color:var(--ck-text)}.ck-style-control{align-items:center;gap:4px;min-width:0;display:flex}.ck-style-control .ck-style-input{width:auto;min-width:0;height:28px;font-size:var(--ck-fs-sm);font-family:var(--ck-mono);flex:1;padding:0 7px}.ck-style-control .ck-style-input[aria-invalid=true]{border-color:var(--ck-danger)}.ck-style-control .ck-style-input[aria-invalid=true]:focus{box-shadow:0 0 0 3px color-mix(in srgb, var(--ck-danger) 18%, transparent)}.ck-style-control .ck-ghost{width:24px;min-width:0;height:24px;min-height:0;font-size:var(--ck-fs);flex:none;place-items:center;padding:0;line-height:1;display:grid}.ck-style-control .ck-ghost:active{scale:.96}.ck-style-steps{flex:none;display:flex}.ck-style-swatch{width:16px;height:16px;box-shadow:inset 0 0 0 1px var(--ck-hairline), 0 0 0 1px var(--ck-border);border-radius:50%;flex:none;margin-inline-end:4px}.ck-style-undo:-webkit-any(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){scale:-1 1}.ck-style-undo:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)){scale:-1 1}@media (pointer:coarse){.ck-style-row{grid-template-columns:1fr;row-gap:4px;padding-block-start:8px;padding-block-end:8px}.ck-style-row .ck-error{grid-column:1}.ck-style-control .ck-style-input{font-size:var(--ck-fs-lg);height:44px}.ck-style-control .ck-ghost{width:44px;height:44px}.ck-style-rows{max-height:320px}}");
|
|
6
|
+
function c({ base: e, changes: t, onChange: r, onClose: o, actions: s }) {
|
|
7
|
+
let c = (n, i) => {
|
|
8
|
+
let a = t.filter((e) => e.property !== n);
|
|
9
|
+
if (i !== null && i === e[n]) return r(a);
|
|
10
|
+
let o = {
|
|
11
|
+
property: n,
|
|
12
|
+
from: e[n] || null,
|
|
13
|
+
to: i
|
|
14
|
+
}, s = t.findIndex((e) => e.property === n);
|
|
15
|
+
r(s === -1 ? [...t, o] : t.map((e, t) => t === s ? o : e));
|
|
16
|
+
};
|
|
17
|
+
return /* @__PURE__ */ i("div", {
|
|
18
|
+
class: "ck-style-panel",
|
|
19
|
+
role: "group",
|
|
20
|
+
"aria-label": n("adjustStyle"),
|
|
21
|
+
onKeyDown: (e) => {
|
|
22
|
+
e.stopPropagation(), e.key === "Escape" && o();
|
|
23
|
+
},
|
|
24
|
+
children: [
|
|
25
|
+
/* @__PURE__ */ i("div", {
|
|
26
|
+
class: "ck-style-head",
|
|
27
|
+
children: [/* @__PURE__ */ i("strong", { children: n("adjustStyle") }), s ?? /* @__PURE__ */ i("button", {
|
|
28
|
+
class: "ck-btn ck-style-done",
|
|
29
|
+
onClick: o,
|
|
30
|
+
children: n("styleDone")
|
|
31
|
+
})]
|
|
32
|
+
}),
|
|
33
|
+
/* @__PURE__ */ i("p", {
|
|
34
|
+
class: "ck-muted ck-style-hint",
|
|
35
|
+
children: n("adjustStyleHint")
|
|
36
|
+
}),
|
|
37
|
+
/* @__PURE__ */ i("div", {
|
|
38
|
+
class: "ck-style-rows",
|
|
39
|
+
children: a.map(({ property: n, kind: a, options: o }) => {
|
|
40
|
+
let s = t.find((e) => e.property === n);
|
|
41
|
+
return /* @__PURE__ */ i(l, {
|
|
42
|
+
property: n,
|
|
43
|
+
kind: a,
|
|
44
|
+
options: o,
|
|
45
|
+
base: e[n] ?? "",
|
|
46
|
+
value: s ? s.to : e[n] ?? "",
|
|
47
|
+
changed: !!s,
|
|
48
|
+
onSet: (e) => c(n, e),
|
|
49
|
+
onReset: () => r(t.filter((e) => e.property !== n))
|
|
50
|
+
}, n);
|
|
51
|
+
})
|
|
52
|
+
})
|
|
53
|
+
]
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
function l({ property: a, kind: s, options: c, base: l, value: f, changed: p, onSet: m, onReset: h }) {
|
|
57
|
+
let [g, _] = e(f ?? ""), [v, y] = e(!1);
|
|
58
|
+
r(() => {
|
|
59
|
+
_(f ?? ""), y(!1);
|
|
60
|
+
}, [f]);
|
|
61
|
+
let b = `ck-style-${a}`, x = (e) => {
|
|
62
|
+
let t = e.trim();
|
|
63
|
+
_(e);
|
|
64
|
+
let n = t !== "" && o(t);
|
|
65
|
+
y(t !== "" && !n), n && m(t);
|
|
66
|
+
}, S = (e, t = !1) => {
|
|
67
|
+
let n = s === "choice" ? d(c ?? [], f ?? l, e) : u(a, f ?? l, e * (t ? 10 : 1));
|
|
68
|
+
n !== null && m(n);
|
|
69
|
+
};
|
|
70
|
+
return /* @__PURE__ */ i("div", {
|
|
71
|
+
class: "ck-style-row",
|
|
72
|
+
"data-changed": p || void 0,
|
|
73
|
+
children: [
|
|
74
|
+
/* @__PURE__ */ i("label", {
|
|
75
|
+
for: b,
|
|
76
|
+
class: "ck-style-name",
|
|
77
|
+
title: a,
|
|
78
|
+
children: /* @__PURE__ */ i("code", { children: a })
|
|
79
|
+
}),
|
|
80
|
+
/* @__PURE__ */ i("div", {
|
|
81
|
+
class: "ck-style-control",
|
|
82
|
+
children: [
|
|
83
|
+
/* @__PURE__ */ i(t, { children: [
|
|
84
|
+
s === "color" ? /* @__PURE__ */ i("span", {
|
|
85
|
+
class: "ck-style-swatch",
|
|
86
|
+
"aria-hidden": "true",
|
|
87
|
+
style: { backgroundColor: f ?? l ?? "transparent" }
|
|
88
|
+
}) : null,
|
|
89
|
+
/* @__PURE__ */ i("input", {
|
|
90
|
+
id: b,
|
|
91
|
+
class: "ck-input ck-style-input",
|
|
92
|
+
type: "text",
|
|
93
|
+
spellcheck: !1,
|
|
94
|
+
autoComplete: "off",
|
|
95
|
+
maxLength: 120,
|
|
96
|
+
value: g,
|
|
97
|
+
placeholder: f === null ? n("styleRemoved") : "",
|
|
98
|
+
"aria-invalid": v,
|
|
99
|
+
"aria-describedby": v ? `${b}-error` : void 0,
|
|
100
|
+
onInput: (e) => x(e.target.value),
|
|
101
|
+
onKeyDown: (e) => {
|
|
102
|
+
s !== "color" && s !== "box" && (e.key === "ArrowUp" || e.key === "ArrowDown") && (e.preventDefault(), S(e.key === "ArrowUp" ? 1 : -1, e.shiftKey));
|
|
103
|
+
}
|
|
104
|
+
}),
|
|
105
|
+
s === "length" || s === "number" ? /* @__PURE__ */ i("span", {
|
|
106
|
+
class: "ck-style-steps",
|
|
107
|
+
children: [/* @__PURE__ */ i("button", {
|
|
108
|
+
class: "ck-ghost ck-ghost-sm",
|
|
109
|
+
"aria-label": n("styleDecrease", { property: a }),
|
|
110
|
+
onClick: () => S(-1),
|
|
111
|
+
children: "−"
|
|
112
|
+
}), /* @__PURE__ */ i("button", {
|
|
113
|
+
class: "ck-ghost ck-ghost-sm",
|
|
114
|
+
"aria-label": n("styleIncrease", { property: a }),
|
|
115
|
+
onClick: () => S(1),
|
|
116
|
+
children: "+"
|
|
117
|
+
})]
|
|
118
|
+
}) : s === "choice" ? /* @__PURE__ */ i("span", {
|
|
119
|
+
class: "ck-style-steps",
|
|
120
|
+
children: [/* @__PURE__ */ i("button", {
|
|
121
|
+
class: "ck-ghost ck-ghost-sm",
|
|
122
|
+
"aria-label": n("stylePrevious", { property: a }),
|
|
123
|
+
onClick: () => S(-1),
|
|
124
|
+
children: "‹"
|
|
125
|
+
}), /* @__PURE__ */ i("button", {
|
|
126
|
+
class: "ck-ghost ck-ghost-sm",
|
|
127
|
+
"aria-label": n("styleNext", { property: a }),
|
|
128
|
+
onClick: () => S(1),
|
|
129
|
+
children: "›"
|
|
130
|
+
})]
|
|
131
|
+
}) : null
|
|
132
|
+
] }),
|
|
133
|
+
p ? /* @__PURE__ */ i("button", {
|
|
134
|
+
class: "ck-ghost ck-ghost-sm",
|
|
135
|
+
"aria-label": n("styleReset", { property: a }),
|
|
136
|
+
title: n("styleReset", { property: a }),
|
|
137
|
+
onClick: h,
|
|
138
|
+
children: /* @__PURE__ */ i("svg", {
|
|
139
|
+
class: "ck-style-undo",
|
|
140
|
+
width: "12",
|
|
141
|
+
height: "12",
|
|
142
|
+
viewBox: "0 0 24 24",
|
|
143
|
+
fill: "none",
|
|
144
|
+
stroke: "currentColor",
|
|
145
|
+
"stroke-width": "2.2",
|
|
146
|
+
"stroke-linecap": "round",
|
|
147
|
+
"stroke-linejoin": "round",
|
|
148
|
+
"aria-hidden": "true",
|
|
149
|
+
children: /* @__PURE__ */ i("path", { d: "M4 9h11a5 5 0 0 1 0 10H9M8 5L4 9l4 4" })
|
|
150
|
+
})
|
|
151
|
+
}) : null,
|
|
152
|
+
f === null ? null : /* @__PURE__ */ i("button", {
|
|
153
|
+
class: "ck-ghost ck-ghost-sm",
|
|
154
|
+
"aria-label": n("styleRemoveValue", { property: a }),
|
|
155
|
+
title: n("styleRemoveValue", { property: a }),
|
|
156
|
+
onClick: () => m(null),
|
|
157
|
+
children: /* @__PURE__ */ i("svg", {
|
|
158
|
+
width: "12",
|
|
159
|
+
height: "12",
|
|
160
|
+
viewBox: "0 0 24 24",
|
|
161
|
+
fill: "none",
|
|
162
|
+
stroke: "currentColor",
|
|
163
|
+
"stroke-width": "2.2",
|
|
164
|
+
"stroke-linecap": "round",
|
|
165
|
+
"aria-hidden": "true",
|
|
166
|
+
children: /* @__PURE__ */ i("path", { d: "M6 6l12 12M18 6L6 18" })
|
|
167
|
+
})
|
|
168
|
+
})
|
|
169
|
+
]
|
|
170
|
+
}),
|
|
171
|
+
v ? /* @__PURE__ */ i("span", {
|
|
172
|
+
class: "ck-error",
|
|
173
|
+
id: `${b}-error`,
|
|
174
|
+
role: "alert",
|
|
175
|
+
children: n("styleInvalid")
|
|
176
|
+
}) : null
|
|
177
|
+
]
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
function u(e, t, n) {
|
|
181
|
+
let r = t === "normal" || t === "" ? e === "font-weight" ? "400" : e === "letter-spacing" ? "0px" : null : t === "bold" ? "700" : t, i = r ? /^(-?\d*\.?\d+)([a-z%]*)$/i.exec(r) : null;
|
|
182
|
+
if (!i) return null;
|
|
183
|
+
let [, a, o = ""] = i, s = e === "opacity" ? .05 : e === "font-weight" ? 100 : /^r?em$/i.test(o) || e === "line-height" && o === "" ? .05 : 1, c = Number(a) + n * s;
|
|
184
|
+
return e === "opacity" && (c = Math.min(1, Math.max(0, c))), e === "font-weight" && (c = Math.min(900, Math.max(100, c))), [
|
|
185
|
+
"font-size",
|
|
186
|
+
"border-width",
|
|
187
|
+
"border-radius",
|
|
188
|
+
"width",
|
|
189
|
+
"height",
|
|
190
|
+
"gap",
|
|
191
|
+
"line-height"
|
|
192
|
+
].includes(e) && (c = Math.max(0, c)), `${Math.round(c * 100) / 100}${o}`;
|
|
193
|
+
}
|
|
194
|
+
function d(e, t, n) {
|
|
195
|
+
if (!e.length) return null;
|
|
196
|
+
let r = e.indexOf(t);
|
|
197
|
+
return r === -1 ? n === 1 ? e[0] : e[e.length - 1] : e[(r + n + e.length) % e.length];
|
|
198
|
+
}
|
|
199
|
+
export { c as StylePanel };
|