@nxgt/material 3.35.1 → 3.37.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.
- package/CHANGELOG.md +12 -0
- package/README.md +1 -1
- package/dist/{button-EMWOFSDB.js → button-CB4nSAMd.js} +2 -1
- package/dist/charts.js +1 -1
- package/dist/components/ui/actions/icon-button/icon-button.css +58 -0
- package/dist/{components-jh9l5bIA.js → components-mqgqmfvj.js} +19761 -19742
- package/dist/components.js +20 -20
- package/dist/{dialog-Cdv9IXVo.js → dialog-DR9rACzY.js} +1 -1
- package/dist/dnd.js +1 -1
- package/dist/editor.js +906 -907
- package/dist/{icon-badge-BFScQnp9.js → icon-badge-DXEBeS1y.js} +2 -2
- package/dist/{icon-button-ifTpXt0A.js → icon-button-CN9r5TNE.js} +51 -32
- package/dist/lib/components/ui/actions/button/button.d.ts +8 -0
- package/dist/lib/components/ui/actions/icon-button/icon-button.d.ts +14 -0
- package/dist/lib/components/ui/collections/data-table/hooks.d.ts +6 -1
- package/dist/lib/components/ui/collections/filter/bar/filter-bar-view.d.ts +1 -1
- package/dist/lib/components/ui/collections/filter/facets/filter-facets.d.ts +1 -1
- package/dist/lib/components/ui/collections/filter/facets/partials/filter-facets-footer.d.ts +4 -1
- package/dist/lib/components/ui/collections/filter/facets/partials/filter-facets-panel.d.ts +3 -1
- package/dist/lib/components/ui/collections/filter/filter-presets.d.ts +1 -1
- package/dist/lib/components/ui/collections/filter/query/types.d.ts +13 -0
- package/dist/lib/components/ui/collections/filter/sections/sheet/filter-sheet-footer.d.ts +3 -1
- package/dist/lib/components/ui/collections/filter/sections/sheet/filter-sheet.d.ts +3 -1
- package/dist/lib/components/ui/collections/filter/types-props.d.ts +3 -0
- package/dist/lib/components/ui/feedback/confirm-dialog/confirm-dialog.d.ts +7 -1
- package/dist/lib/components/ui/feedback/confirmation-dialog/confirmation-dialog.d.ts +7 -1
- package/dist/lib/components/ui/fields/attributes/attribute-dialog.d.ts +4 -1
- package/dist/lib/components/ui/fields/attributes/attributes-field/attributes-dialog-field.d.ts +4 -1
- package/dist/lib/components/ui/fields/attributes/attributes-field/attributes-inline-field.d.ts +1 -1
- package/dist/lib/components/ui/fields/contacts/contact-dialog.d.ts +4 -1
- package/dist/lib/components/ui/fields/contacts/contacts-dialog-form-field.d.ts +4 -1
- package/dist/lib/components/ui/fields/contacts/contacts-form-field.d.ts +4 -1
- package/dist/lib/components/ui/fields/opening-hours/opening-hours-dialog-form-field.d.ts +4 -1
- package/dist/lib/components/ui/fields/opening-hours/opening-hours-dialog.d.ts +4 -1
- package/dist/lib/components/ui/fields/opening-hours/opening-hours-form-field.d.ts +4 -1
- package/dist/lib/components/ui/fields/postal-address/postal-address-dialog.d.ts +4 -1
- package/dist/lib/components/ui/fields/postal-address/postal-address-form-field.d.ts +4 -1
- package/dist/lib/components/ui/media/image-cropper/image-cropper.d.ts +4 -1
- package/dist/lib/components/ui/widgets/rich-text-editor/types.d.ts +3 -0
- package/dist/main.js +32 -32
- package/dist/map.js +4 -4
- package/dist/material.css +1 -1
- package/dist/pdf-reader.js +1 -1
- package/dist/{public-CYdnlHqA.js → public-BdJCVnGS.js} +3 -3
- package/dist/{sortable-provider-CY_YD3Ee.js → sortable-provider-BshacF8v.js} +1 -1
- package/dist/{use-chat-composer-CoyqPKbt.js → use-chat-composer-C82hvxm4.js} +11 -10
- package/docs/components/buttons-and-actions.md +29 -1
- package/docs/components/data-table-filter-and-lists.md +10 -1
- package/docs/components/feedback-and-status.md +3 -1
- package/docs/components/form-fields.md +10 -4
- package/docs/components/media-and-files.md +1 -0
- package/docs/components/primitives.md +1 -1
- package/docs/components/rich-widgets.md +2 -2
- package/lib/components/ui/actions/icon-button/icon-button.css +58 -0
- package/package.json +1 -1
package/dist/editor.js
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
import { t as e } from "./ui.utils-CAnKTCw5.js";
|
|
2
2
|
import { t } from "./utils-BLfntITJ.js";
|
|
3
|
-
import { $i as n, A as r, B as i, C as a, Cn as o, D as s, Dn as c, E as l, En as u, Er as d, F as f, Fn as p, G as m, H as h, In as g, J as _, K as v, Ln as y, M as b, N as x, O as S, On as C, P as w, Qn as ee, Rn as T, S as E, T as D, Tn as te, Tr as ne, U as O, V as re, Vn as k, W as ie, X as ae, Xi as oe, Y as se, Zi as ce, _n as le, a as ue, an as de, bn as fe, c as pe, d as me, g as he, hr as ge, i as _e, in as ve, j as ye, k as be, l as xe, m as Se, mn as Ce, p as we, pn as Te, q as Ee, rn as De, s as Oe, t as ke, vn as Ae, vr as je, w as Me, wn as Ne, x as Pe, xn as Fe, yn as Ie, z as Le, zn as Re } from "./use-chat-composer-
|
|
4
|
-
import { f as ze } from "./dialog-
|
|
3
|
+
import { $i as n, A as r, B as i, C as a, Cn as o, D as s, Dn as c, E as l, En as u, Er as d, F as f, Fn as p, G as m, H as h, In as g, J as _, K as v, Ln as y, M as b, N as x, O as S, On as C, P as w, Qn as ee, Rn as T, S as E, T as D, Tn as te, Tr as ne, U as O, V as re, Vn as k, W as ie, X as ae, Xi as oe, Y as se, Zi as ce, _n as le, a as ue, an as de, bn as fe, c as pe, d as me, g as he, hr as ge, i as _e, in as ve, j as ye, k as be, l as xe, m as Se, mn as Ce, p as we, pn as Te, q as Ee, rn as De, s as Oe, t as ke, vn as Ae, vr as je, w as Me, wn as Ne, x as Pe, xn as Fe, yn as Ie, z as Le, zn as Re } from "./use-chat-composer-C82hvxm4.js";
|
|
4
|
+
import { f as ze } from "./dialog-DR9rACzY.js";
|
|
5
5
|
import { c as Be, i as Ve, n as He, o as Ue, r as We, s as Ge, t as Ke, u as A } from "./dropdown-menu-CpSnRXd-.js";
|
|
6
6
|
import { c as qe, o as Je, s as Ye } from "./toolbar-items-B1W-uVHS.js";
|
|
7
7
|
import { t as j } from "./use-material-translation-BK2YYCY3.js";
|
|
8
|
-
import { t as M } from "./button-
|
|
9
|
-
import { t as N } from "./icon-button-
|
|
10
|
-
import { r as
|
|
11
|
-
import { a as
|
|
12
|
-
import { n as
|
|
13
|
-
import { n as
|
|
14
|
-
import { t as
|
|
15
|
-
import { Ft as
|
|
16
|
-
import { t as
|
|
17
|
-
import { n as
|
|
18
|
-
import { Z as
|
|
19
|
-
import { a as
|
|
20
|
-
import { d as
|
|
21
|
-
import { t as
|
|
22
|
-
import { n as
|
|
23
|
-
import { ArrowDown as
|
|
24
|
-
import { Suspense as
|
|
8
|
+
import { n as Xe, t as M } from "./button-CB4nSAMd.js";
|
|
9
|
+
import { t as N } from "./icon-button-CN9r5TNE.js";
|
|
10
|
+
import { r as Ze, t as Qe } from "./field-blur-CJHzVSh9.js";
|
|
11
|
+
import { a as $e, s as P } from "./dist-C3GR7kJd.js";
|
|
12
|
+
import { n as et, t as tt } from "./toggle-group-BMJNcFAC.js";
|
|
13
|
+
import { n as nt } from "./icon-badge-DXEBeS1y.js";
|
|
14
|
+
import { t as rt } from "./use-mobile-BDro060N.js";
|
|
15
|
+
import { Ft as it, Ht as at, Nt as ot, Ot as st, St as ct, bt as F, ht as I, mt as L, n as R, wt as z, xt as lt, yt as ut } from "./dist-moutbfbd.js";
|
|
16
|
+
import { t as dt } from "./markdown-Dw_uH7j7.js";
|
|
17
|
+
import { n as ft, r as B, t as pt } from "./create-store-Dqp-PLLn.js";
|
|
18
|
+
import { Z as mt, w as ht } from "./youtube-node-OWSNlYCc.js";
|
|
19
|
+
import { a as gt, i as _t, n as vt, r as yt } from "./convert-XAkWyO8-.js";
|
|
20
|
+
import { d as bt, n as xt, r as St, u as Ct } from "./headless-extensions-CvmdhANJ.js";
|
|
21
|
+
import { t as wt } from "./render-json-BOhvPnSv.js";
|
|
22
|
+
import { n as Tt, r as Et } from "./collab-colors-CDkjUVoQ.js";
|
|
23
|
+
import { ArrowDown as Dt, ArrowUp as Ot, AtSign as kt, CaseSensitive as At, Check as jt, ChevronDown as Mt, ChevronLeft as Nt, ChevronRight as Pt, ChevronUp as Ft, Code as It, Copy as Lt, CornerDownLeft as Rt, File as zt, Focus as Bt, GripVertical as Vt, Heading1 as Ht, Heading2 as Ut, Heading3 as Wt, Languages as Gt, List as Kt, ListOrdered as qt, Maximize2 as Jt, MessageSquare as Yt, MessageSquarePlus as Xt, Minimize2 as Zt, PenLine as Qt, Pilcrow as $t, Plus as en, Quote as tn, Replace as nn, RotateCcw as rn, Search as an, Smile as on, Sparkles as sn, SpellCheck as cn, Square as ln, TableOfContents as un, TextCursorInput as dn, TextQuote as fn, Trash2 as pn, WandSparkles as mn, WholeWord as hn, X as gn } from "lucide-react";
|
|
24
|
+
import { Suspense as _n, lazy as vn, useCallback as V, useEffect as H, useId as yn, useLayoutEffect as bn, useMemo as U, useRef as W, useState as G, useSyncExternalStore as xn } from "react";
|
|
25
25
|
import { Fragment as K, jsx as q, jsxs as J } from "react/jsx-runtime";
|
|
26
|
-
import { createPortal as
|
|
26
|
+
import { createPortal as Sn } from "react-dom";
|
|
27
27
|
//#region lib/components/ui/widgets/editor/extensions/assistant/editor-extensions.ts
|
|
28
|
-
var
|
|
28
|
+
var Cn = (e) => e.extensionManager.baseExtensions;
|
|
29
29
|
//#endregion
|
|
30
30
|
//#region lib/components/ui/widgets/editor/extensions/assistant/apply-result.ts
|
|
31
|
-
function
|
|
31
|
+
function wn(e, t, n, r) {
|
|
32
32
|
let i = r.content ?? [];
|
|
33
33
|
if (n === "below") {
|
|
34
34
|
let n = e.resolve(t.to);
|
|
@@ -62,108 +62,108 @@ function Cn(e, t, n, r) {
|
|
|
62
62
|
content: i.length === 1 && i[0]?.type === "paragraph" && t.from !== t.to && a.parent.isTextblock && a.sameParent(e.resolve(t.to)) ? i[0]?.content ?? [] : i
|
|
63
63
|
};
|
|
64
64
|
}
|
|
65
|
-
var
|
|
65
|
+
var Tn = /* @__PURE__ */ new Set([
|
|
66
66
|
"image",
|
|
67
67
|
"gallery",
|
|
68
68
|
"youtube"
|
|
69
|
-
]),
|
|
69
|
+
]), En = /* @__PURE__ */ new Set(["paragraph", "heading"]), Dn = (e) => {
|
|
70
70
|
let t = typeof e.attrs?.alt == "string" ? e.attrs.alt.trim() : "", n = e.type === "youtube" ? "video" : e.type === "gallery" ? "gallery" : "image";
|
|
71
71
|
return t ? `[${n}: ${t}]` : `[${n}]`;
|
|
72
72
|
};
|
|
73
|
-
function
|
|
73
|
+
function On(e, t) {
|
|
74
74
|
if (t === "keep" || !e.content) return e;
|
|
75
|
-
let n =
|
|
76
|
-
if (e.type &&
|
|
75
|
+
let n = En.has(e.type ?? ""), r = e.content.flatMap((e) => {
|
|
76
|
+
if (e.type && Tn.has(e.type)) {
|
|
77
77
|
if (t === "drop") return [];
|
|
78
78
|
let r = {
|
|
79
79
|
type: "text",
|
|
80
|
-
text:
|
|
80
|
+
text: Dn(e)
|
|
81
81
|
};
|
|
82
82
|
return [n ? r : {
|
|
83
83
|
type: "paragraph",
|
|
84
84
|
content: [r]
|
|
85
85
|
}];
|
|
86
86
|
}
|
|
87
|
-
return [
|
|
87
|
+
return [On(e, t)];
|
|
88
88
|
});
|
|
89
89
|
return {
|
|
90
90
|
...e,
|
|
91
91
|
content: r
|
|
92
92
|
};
|
|
93
93
|
}
|
|
94
|
-
async function
|
|
95
|
-
let r =
|
|
96
|
-
return
|
|
94
|
+
async function kn(e, t, n = "drop") {
|
|
95
|
+
let r = Cn(e);
|
|
96
|
+
return On(St(await vt(t, { extensions: r }), r), n);
|
|
97
97
|
}
|
|
98
|
-
async function
|
|
99
|
-
let a = await
|
|
98
|
+
async function An(e, t, n, r, i = {}) {
|
|
99
|
+
let a = await kn(e, t, i.allowMedia ? "keep" : "drop");
|
|
100
100
|
if (e.isDestroyed || !e.isEditable) return !1;
|
|
101
101
|
let o = n();
|
|
102
102
|
if (!o) return !1;
|
|
103
103
|
let s = e.state.doc.content.size, c = {
|
|
104
104
|
from: Math.min(o.from, s),
|
|
105
105
|
to: Math.min(o.to, s)
|
|
106
|
-
}, l =
|
|
106
|
+
}, l = wn(e.state.doc, c, r, a);
|
|
107
107
|
return l.content.length ? e.chain().focus().insertContentAt(l.range, l.content).run() : !1;
|
|
108
108
|
}
|
|
109
109
|
//#endregion
|
|
110
110
|
//#region lib/components/ui/widgets/editor/extensions/assistant/assistant-actions.ts
|
|
111
|
-
var
|
|
111
|
+
var jn = [
|
|
112
112
|
"professional",
|
|
113
113
|
"friendly",
|
|
114
114
|
"direct"
|
|
115
|
-
],
|
|
115
|
+
], Mn = [
|
|
116
116
|
"en",
|
|
117
117
|
"fr",
|
|
118
118
|
"es",
|
|
119
119
|
"de",
|
|
120
120
|
"pt"
|
|
121
|
-
],
|
|
121
|
+
], Nn = {
|
|
122
122
|
en: "English",
|
|
123
123
|
fr: "French",
|
|
124
124
|
es: "Spanish",
|
|
125
125
|
de: "German",
|
|
126
126
|
pt: "Portuguese"
|
|
127
|
-
},
|
|
128
|
-
function
|
|
129
|
-
let t = (t, n) => e(
|
|
127
|
+
}, Pn = (e) => `material.editor.assistant.${e}`;
|
|
128
|
+
function Fn(e) {
|
|
129
|
+
let t = (t, n) => e(Pn(`action.${t}`), n);
|
|
130
130
|
return [
|
|
131
131
|
{
|
|
132
132
|
id: "improve",
|
|
133
133
|
label: t("improve", "Improve writing"),
|
|
134
|
-
icon:
|
|
134
|
+
icon: mn,
|
|
135
135
|
prompt: "Improve the writing: clearer, smoother, same meaning and language.",
|
|
136
136
|
needsSelection: !0
|
|
137
137
|
},
|
|
138
138
|
{
|
|
139
139
|
id: "fix",
|
|
140
140
|
label: t("fix", "Fix spelling & grammar"),
|
|
141
|
-
icon:
|
|
141
|
+
icon: cn,
|
|
142
142
|
prompt: "Fix the spelling and grammar. Change nothing else.",
|
|
143
143
|
needsSelection: !0
|
|
144
144
|
},
|
|
145
145
|
{
|
|
146
146
|
id: "shorter",
|
|
147
147
|
label: t("shorter", "Make shorter"),
|
|
148
|
-
icon:
|
|
148
|
+
icon: Zt,
|
|
149
149
|
prompt: "Make it shorter and keep the meaning.",
|
|
150
150
|
needsSelection: !0
|
|
151
151
|
},
|
|
152
152
|
{
|
|
153
153
|
id: "longer",
|
|
154
154
|
label: t("longer", "Make longer"),
|
|
155
|
-
icon:
|
|
155
|
+
icon: Jt,
|
|
156
156
|
prompt: "Make it longer: develop the ideas and keep the meaning.",
|
|
157
157
|
needsSelection: !0
|
|
158
158
|
},
|
|
159
159
|
{
|
|
160
160
|
id: "tone",
|
|
161
161
|
label: t("tone", "Change tone"),
|
|
162
|
-
icon:
|
|
162
|
+
icon: on,
|
|
163
163
|
needsSelection: !0,
|
|
164
|
-
actions:
|
|
164
|
+
actions: jn.map((t) => ({
|
|
165
165
|
id: `tone:${t}`,
|
|
166
|
-
label: e(
|
|
166
|
+
label: e(Pn(`tone.${t}`), t[0]?.toUpperCase() + t.slice(1)),
|
|
167
167
|
prompt: `Rewrite it in a ${t} tone.`,
|
|
168
168
|
needsSelection: !0
|
|
169
169
|
}))
|
|
@@ -171,33 +171,33 @@ function Pn(e) {
|
|
|
171
171
|
{
|
|
172
172
|
id: "summarise",
|
|
173
173
|
label: t("summarise", "Summarise"),
|
|
174
|
-
icon:
|
|
174
|
+
icon: fn,
|
|
175
175
|
prompt: "Summarise it in a few sentences.",
|
|
176
176
|
needsSelection: !0
|
|
177
177
|
},
|
|
178
178
|
{
|
|
179
179
|
id: "continue",
|
|
180
180
|
label: t("continue", "Continue writing"),
|
|
181
|
-
icon:
|
|
181
|
+
icon: Qt,
|
|
182
182
|
prompt: "Continue the text from where it stops, in the same style.",
|
|
183
183
|
needsSelection: !1
|
|
184
184
|
},
|
|
185
185
|
{
|
|
186
186
|
id: "translate",
|
|
187
187
|
label: t("translate", "Translate"),
|
|
188
|
-
icon:
|
|
188
|
+
icon: Gt,
|
|
189
189
|
needsSelection: !0,
|
|
190
|
-
actions:
|
|
190
|
+
actions: Mn.map((t) => ({
|
|
191
191
|
id: `translate:${t}`,
|
|
192
|
-
label: e(
|
|
193
|
-
prompt: `Translate it into ${
|
|
192
|
+
label: e(Pn(`lang.${t}`), Nn[t]),
|
|
193
|
+
prompt: `Translate it into ${Nn[t]}.`,
|
|
194
194
|
needsSelection: !0
|
|
195
195
|
}))
|
|
196
196
|
}
|
|
197
197
|
];
|
|
198
198
|
}
|
|
199
|
-
function
|
|
200
|
-
let n =
|
|
199
|
+
function In(e, t) {
|
|
200
|
+
let n = Fn(t);
|
|
201
201
|
for (let t of e ?? []) {
|
|
202
202
|
let e = n.findIndex((e) => e.id === t.id);
|
|
203
203
|
e < 0 ? n.push(t) : n[e] = {
|
|
@@ -207,15 +207,15 @@ function Fn(e, t) {
|
|
|
207
207
|
}
|
|
208
208
|
return n;
|
|
209
209
|
}
|
|
210
|
-
function
|
|
210
|
+
function Ln(e, t) {
|
|
211
211
|
return e.filter((e) => t || !e.needsSelection).map((e) => e.actions ? {
|
|
212
212
|
...e,
|
|
213
|
-
actions:
|
|
213
|
+
actions: Ln(e.actions, t)
|
|
214
214
|
} : e);
|
|
215
215
|
}
|
|
216
216
|
//#endregion
|
|
217
217
|
//#region lib/components/ui/widgets/editor/extensions/assistant/assistant-shell.tsx
|
|
218
|
-
function
|
|
218
|
+
function Rn(e, t) {
|
|
219
219
|
return U(() => ({ current: { getBoundingClientRect: () => {
|
|
220
220
|
let { from: n, to: r } = t.getState().range;
|
|
221
221
|
try {
|
|
@@ -226,9 +226,9 @@ function Ln(e, t) {
|
|
|
226
226
|
}
|
|
227
227
|
} } }), [e, t]);
|
|
228
228
|
}
|
|
229
|
-
function
|
|
230
|
-
let s =
|
|
231
|
-
return s ?
|
|
229
|
+
function zn({ editor: e, controller: t, label: n, slot: r = "editor-assistant", locked: i, onDismiss: a, children: o }) {
|
|
230
|
+
let s = rt(), c = Rn(e, t);
|
|
231
|
+
return s ? Sn(/* @__PURE__ */ q("section", {
|
|
232
232
|
role: "dialog",
|
|
233
233
|
"aria-label": n,
|
|
234
234
|
"data-slot": r,
|
|
@@ -257,7 +257,7 @@ function Rn({ editor: e, controller: t, label: n, slot: r = "editor-assistant",
|
|
|
257
257
|
}
|
|
258
258
|
//#endregion
|
|
259
259
|
//#region lib/components/ui/widgets/editor/extensions/assistant/assistant-menu.tsx
|
|
260
|
-
function
|
|
260
|
+
function Bn(e) {
|
|
261
261
|
if (![
|
|
262
262
|
"ArrowDown",
|
|
263
263
|
"ArrowUp",
|
|
@@ -267,8 +267,8 @@ function zn(e) {
|
|
|
267
267
|
let t = [...e.currentTarget.querySelectorAll("input, [role=menuitem]")], n = t.indexOf(document.activeElement), r = e.key === "ArrowUp" ? -1 : 1, i = e.key === "Home" ? 0 : e.key === "End" ? t.length - 1 : (n + r + t.length) % t.length;
|
|
268
268
|
e.preventDefault(), t[i]?.focus();
|
|
269
269
|
}
|
|
270
|
-
function
|
|
271
|
-
let { t: r } = j(), [i, a] = G(null), o = U(() =>
|
|
270
|
+
function Vn({ actions: e, hasSelection: t, onChoose: n }) {
|
|
271
|
+
let { t: r } = j(), [i, a] = G(null), o = U(() => Ln(i?.actions ?? e, t), [
|
|
272
272
|
i,
|
|
273
273
|
e,
|
|
274
274
|
t
|
|
@@ -280,9 +280,9 @@ function Bn({ actions: e, hasSelection: t, onChoose: n }) {
|
|
|
280
280
|
});
|
|
281
281
|
};
|
|
282
282
|
return /* @__PURE__ */ J("div", {
|
|
283
|
-
onKeyDown:
|
|
283
|
+
onKeyDown: Bn,
|
|
284
284
|
className: "grid gap-2",
|
|
285
|
-
children: [/* @__PURE__ */ q(
|
|
285
|
+
children: [/* @__PURE__ */ q(Hn, { onAsk: (e) => n({
|
|
286
286
|
action: "ask",
|
|
287
287
|
label: e,
|
|
288
288
|
prompt: e
|
|
@@ -290,11 +290,11 @@ function Bn({ actions: e, hasSelection: t, onChoose: n }) {
|
|
|
290
290
|
role: "menu",
|
|
291
291
|
"aria-label": i?.label ?? r("material.editor.assistant.actions", "Actions"),
|
|
292
292
|
className: "grid gap-0.5",
|
|
293
|
-
children: [i && /* @__PURE__ */ q(
|
|
294
|
-
icon: /* @__PURE__ */ q(
|
|
293
|
+
children: [i && /* @__PURE__ */ q(Un, {
|
|
294
|
+
icon: /* @__PURE__ */ q(Nt, { className: "size-4" }),
|
|
295
295
|
label: r("material.editor.assistant.back", "Back"),
|
|
296
296
|
onClick: () => a(null)
|
|
297
|
-
}), o.map((e) => /* @__PURE__ */ q(
|
|
297
|
+
}), o.map((e) => /* @__PURE__ */ q(Un, {
|
|
298
298
|
icon: e.icon && /* @__PURE__ */ q(e.icon, { className: "size-4" }),
|
|
299
299
|
label: e.label,
|
|
300
300
|
submenu: !!e.actions,
|
|
@@ -303,7 +303,7 @@ function Bn({ actions: e, hasSelection: t, onChoose: n }) {
|
|
|
303
303
|
})]
|
|
304
304
|
});
|
|
305
305
|
}
|
|
306
|
-
function
|
|
306
|
+
function Hn({ onAsk: e }) {
|
|
307
307
|
let { t } = j(), [n, r] = G(""), i = W(null);
|
|
308
308
|
H(() => i.current?.focus({ preventScroll: !0 }), []);
|
|
309
309
|
let a = () => {
|
|
@@ -328,11 +328,11 @@ function Vn({ onAsk: e }) {
|
|
|
328
328
|
disabled: !n.trim(),
|
|
329
329
|
onClick: a,
|
|
330
330
|
className: "size-9",
|
|
331
|
-
children: /* @__PURE__ */ q(
|
|
331
|
+
children: /* @__PURE__ */ q(Ot, {})
|
|
332
332
|
})]
|
|
333
333
|
});
|
|
334
334
|
}
|
|
335
|
-
function
|
|
335
|
+
function Un({ icon: e, label: n, submenu: r, onClick: i }) {
|
|
336
336
|
return /* @__PURE__ */ J("button", {
|
|
337
337
|
type: "button",
|
|
338
338
|
role: "menuitem",
|
|
@@ -348,23 +348,23 @@ function Hn({ icon: e, label: n, submenu: r, onClick: i }) {
|
|
|
348
348
|
className: "min-w-0 flex-1 truncate",
|
|
349
349
|
children: n
|
|
350
350
|
}),
|
|
351
|
-
r && /* @__PURE__ */ q(
|
|
351
|
+
r && /* @__PURE__ */ q(Pt, { className: "size-4 text-muted-foreground rtl:rotate-180" })
|
|
352
352
|
]
|
|
353
353
|
});
|
|
354
354
|
}
|
|
355
355
|
//#endregion
|
|
356
356
|
//#region lib/components/ui/widgets/editor/extensions/assistant/assistant-preview.tsx
|
|
357
|
-
var
|
|
358
|
-
function
|
|
357
|
+
var Wn = 90;
|
|
358
|
+
function Gn({ editor: e, markdown: t }) {
|
|
359
359
|
let [n, r] = G(null);
|
|
360
360
|
return H(() => {
|
|
361
361
|
let n = !0, i = setTimeout(() => {
|
|
362
|
-
|
|
363
|
-
n && r(
|
|
362
|
+
kn(e, t, "inert").then((t) => {
|
|
363
|
+
n && r(wt(t, void 0, Cn(e)));
|
|
364
364
|
}).catch(() => {
|
|
365
365
|
n && r(/* @__PURE__ */ q("p", { children: t }));
|
|
366
366
|
});
|
|
367
|
-
},
|
|
367
|
+
}, Wn);
|
|
368
368
|
return () => {
|
|
369
369
|
n = !1, clearTimeout(i);
|
|
370
370
|
};
|
|
@@ -379,14 +379,14 @@ function Wn({ editor: e, markdown: t }) {
|
|
|
379
379
|
}
|
|
380
380
|
//#endregion
|
|
381
381
|
//#region lib/components/ui/widgets/editor/extensions/assistant/assistant-result.tsx
|
|
382
|
-
async function
|
|
382
|
+
async function Kn(e) {
|
|
383
383
|
try {
|
|
384
384
|
return await navigator.clipboard.writeText(e), !0;
|
|
385
385
|
} catch {
|
|
386
386
|
return !1;
|
|
387
387
|
}
|
|
388
388
|
}
|
|
389
|
-
function
|
|
389
|
+
function qn({ text: e }) {
|
|
390
390
|
let { t } = j(), [n, r] = G(!1);
|
|
391
391
|
return H(() => {
|
|
392
392
|
if (!n) return;
|
|
@@ -395,11 +395,11 @@ function Kn({ text: e }) {
|
|
|
395
395
|
}, [n]), /* @__PURE__ */ J(M, {
|
|
396
396
|
variant: "ghost",
|
|
397
397
|
size: "sm",
|
|
398
|
-
onClick: async () => r(await
|
|
399
|
-
children: [q(n ?
|
|
398
|
+
onClick: async () => r(await Kn(e)),
|
|
399
|
+
children: [q(n ? jt : Lt, {}), n ? t("material.editor.assistant.copied", "Copied") : t("material.editor.assistant.copy", "Copy")]
|
|
400
400
|
});
|
|
401
401
|
}
|
|
402
|
-
function
|
|
402
|
+
function Jn({ state: e, on: t }) {
|
|
403
403
|
let { t: n } = j(), r = W(null);
|
|
404
404
|
return H(() => r.current?.focus({ preventScroll: !0 }), []), /* @__PURE__ */ J("div", {
|
|
405
405
|
className: "flex flex-wrap items-center gap-1.5",
|
|
@@ -409,7 +409,7 @@ function qn({ state: e, on: t }) {
|
|
|
409
409
|
size: "sm",
|
|
410
410
|
disabled: e.applying,
|
|
411
411
|
onClick: () => t.onApply("replace"),
|
|
412
|
-
children: [/* @__PURE__ */ q(
|
|
412
|
+
children: [/* @__PURE__ */ q(nn, {}), n("material.editor.assistant.replace", "Replace selection")]
|
|
413
413
|
}),
|
|
414
414
|
/* @__PURE__ */ J(M, {
|
|
415
415
|
ref: e.hasSelection ? void 0 : r,
|
|
@@ -417,26 +417,26 @@ function qn({ state: e, on: t }) {
|
|
|
417
417
|
size: "sm",
|
|
418
418
|
disabled: e.applying,
|
|
419
419
|
onClick: () => t.onApply("below"),
|
|
420
|
-
children: [/* @__PURE__ */ q(
|
|
420
|
+
children: [/* @__PURE__ */ q(Rt, {}), n("material.editor.assistant.insert-below", "Insert below")]
|
|
421
421
|
}),
|
|
422
|
-
/* @__PURE__ */ q(
|
|
422
|
+
/* @__PURE__ */ q(qn, { text: e.text }),
|
|
423
423
|
/* @__PURE__ */ J(M, {
|
|
424
424
|
variant: "ghost",
|
|
425
425
|
size: "sm",
|
|
426
426
|
disabled: e.applying,
|
|
427
427
|
onClick: t.onRetry,
|
|
428
|
-
children: [/* @__PURE__ */ q(
|
|
428
|
+
children: [/* @__PURE__ */ q(rn, {}), n("material.editor.assistant.retry", "Retry")]
|
|
429
429
|
}),
|
|
430
430
|
/* @__PURE__ */ J(M, {
|
|
431
431
|
variant: "ghost",
|
|
432
432
|
size: "sm",
|
|
433
433
|
onClick: t.onDiscard,
|
|
434
|
-
children: [/* @__PURE__ */ q(
|
|
434
|
+
children: [/* @__PURE__ */ q(gn, {}), n("material.editor.assistant.discard", "Discard")]
|
|
435
435
|
})
|
|
436
436
|
]
|
|
437
437
|
});
|
|
438
438
|
}
|
|
439
|
-
function
|
|
439
|
+
function Yn({ state: e, on: t }) {
|
|
440
440
|
let { t: n } = j(), r = W(null);
|
|
441
441
|
return H(() => r.current?.focus({ preventScroll: !0 }), []), /* @__PURE__ */ J("div", {
|
|
442
442
|
className: "grid gap-2",
|
|
@@ -452,7 +452,7 @@ function Jn({ state: e, on: t }) {
|
|
|
452
452
|
ref: r,
|
|
453
453
|
size: "sm",
|
|
454
454
|
onClick: t.onRetry,
|
|
455
|
-
children: [/* @__PURE__ */ q(
|
|
455
|
+
children: [/* @__PURE__ */ q(rn, {}), n("material.editor.assistant.retry", "Retry")]
|
|
456
456
|
}),
|
|
457
457
|
/* @__PURE__ */ q(M, {
|
|
458
458
|
variant: "ghost",
|
|
@@ -470,7 +470,7 @@ function Jn({ state: e, on: t }) {
|
|
|
470
470
|
})]
|
|
471
471
|
});
|
|
472
472
|
}
|
|
473
|
-
function
|
|
473
|
+
function Xn({ editor: e, state: t, on: n, status: r }) {
|
|
474
474
|
let { t: i } = j(), a = W(null), o = t.phase === "streaming";
|
|
475
475
|
return H(() => {
|
|
476
476
|
o && a.current?.focus({ preventScroll: !0 });
|
|
@@ -478,7 +478,7 @@ function Yn({ editor: e, state: t, on: n, status: r }) {
|
|
|
478
478
|
className: "grid gap-2",
|
|
479
479
|
children: [
|
|
480
480
|
r,
|
|
481
|
-
t.text && /* @__PURE__ */ q(
|
|
481
|
+
t.text && /* @__PURE__ */ q(Gn, {
|
|
482
482
|
editor: e,
|
|
483
483
|
markdown: t.text
|
|
484
484
|
}),
|
|
@@ -487,8 +487,8 @@ function Yn({ editor: e, state: t, on: n, status: r }) {
|
|
|
487
487
|
variant: "tonal",
|
|
488
488
|
size: "sm",
|
|
489
489
|
onClick: n.onStop,
|
|
490
|
-
children: [/* @__PURE__ */ q(
|
|
491
|
-
}) }) : /* @__PURE__ */ q(
|
|
490
|
+
children: [/* @__PURE__ */ q(ln, {}), i("material.editor.assistant.stop", "Stop")]
|
|
491
|
+
}) }) : /* @__PURE__ */ q(Jn, {
|
|
492
492
|
state: t,
|
|
493
493
|
on: n
|
|
494
494
|
})
|
|
@@ -497,12 +497,12 @@ function Yn({ editor: e, state: t, on: n, status: r }) {
|
|
|
497
497
|
}
|
|
498
498
|
//#endregion
|
|
499
499
|
//#region lib/components/ui/widgets/editor/extensions/assistant/assistant-stage.tsx
|
|
500
|
-
function
|
|
500
|
+
function Zn({ label: e, onDiscard: t }) {
|
|
501
501
|
let { t: n } = j();
|
|
502
502
|
return /* @__PURE__ */ J("div", {
|
|
503
503
|
className: "flex items-center gap-2",
|
|
504
504
|
children: [
|
|
505
|
-
/* @__PURE__ */ q(
|
|
505
|
+
/* @__PURE__ */ q(sn, {
|
|
506
506
|
className: "size-4 text-primary-text",
|
|
507
507
|
"aria-hidden": !0
|
|
508
508
|
}),
|
|
@@ -515,30 +515,30 @@ function Xn({ label: e, onDiscard: t }) {
|
|
|
515
515
|
"aria-label": n("material.editor.assistant.discard", "Discard"),
|
|
516
516
|
onClick: t,
|
|
517
517
|
className: "size-7",
|
|
518
|
-
children: /* @__PURE__ */ q(
|
|
518
|
+
children: /* @__PURE__ */ q(gn, {})
|
|
519
519
|
})
|
|
520
520
|
]
|
|
521
521
|
});
|
|
522
522
|
}
|
|
523
|
-
function
|
|
524
|
-
return t.phase === "menu" ? /* @__PURE__ */ J(K, { children: [/* @__PURE__ */ q(
|
|
523
|
+
function Qn({ editor: e, state: t, actions: n, onChoose: r, on: i }) {
|
|
524
|
+
return t.phase === "menu" ? /* @__PURE__ */ J(K, { children: [/* @__PURE__ */ q($n, { note: t.note }), /* @__PURE__ */ q(Vn, {
|
|
525
525
|
actions: n,
|
|
526
526
|
hasSelection: t.hasSelection,
|
|
527
527
|
onChoose: r
|
|
528
|
-
})] }) : t.phase === "error" ? /* @__PURE__ */ q(
|
|
528
|
+
})] }) : t.phase === "error" ? /* @__PURE__ */ q(Yn, {
|
|
529
529
|
state: t,
|
|
530
530
|
on: i
|
|
531
|
-
}) : t.phase === "streaming" || t.phase === "done" ? /* @__PURE__ */ q(
|
|
531
|
+
}) : t.phase === "streaming" || t.phase === "done" ? /* @__PURE__ */ q(Xn, {
|
|
532
532
|
editor: e,
|
|
533
533
|
state: t,
|
|
534
534
|
on: i,
|
|
535
|
-
status: /* @__PURE__ */ J(K, { children: [/* @__PURE__ */ q(
|
|
535
|
+
status: /* @__PURE__ */ J(K, { children: [/* @__PURE__ */ q(er, {
|
|
536
536
|
phase: t.phase,
|
|
537
537
|
stopped: t.stopped
|
|
538
|
-
}), /* @__PURE__ */ q(
|
|
538
|
+
}), /* @__PURE__ */ q($n, { note: t.note })] })
|
|
539
539
|
}) : null;
|
|
540
540
|
}
|
|
541
|
-
function
|
|
541
|
+
function $n({ note: e }) {
|
|
542
542
|
let { t } = j();
|
|
543
543
|
return e ? /* @__PURE__ */ q("p", {
|
|
544
544
|
role: "status",
|
|
@@ -547,7 +547,7 @@ function Qn({ note: e }) {
|
|
|
547
547
|
children: e === "selection-gone" ? t("material.editor.assistant.selection-gone", "The selected text was removed.") : t("material.editor.assistant.read-only", "The document is read-only.")
|
|
548
548
|
}) : null;
|
|
549
549
|
}
|
|
550
|
-
function
|
|
550
|
+
function er({ phase: e, stopped: t }) {
|
|
551
551
|
let { t: n } = j(), r = n("material.editor.assistant.writing", "Writing…");
|
|
552
552
|
return /* @__PURE__ */ q("div", {
|
|
553
553
|
role: "status",
|
|
@@ -561,13 +561,13 @@ function $n({ phase: e, stopped: t }) {
|
|
|
561
561
|
}
|
|
562
562
|
//#endregion
|
|
563
563
|
//#region lib/components/ui/widgets/editor/extensions/assistant/assistant-storage.ts
|
|
564
|
-
var
|
|
564
|
+
var tr = (e) => {
|
|
565
565
|
let t = e.storage.assistant;
|
|
566
566
|
return t?.controller ? t : void 0;
|
|
567
567
|
};
|
|
568
568
|
//#endregion
|
|
569
569
|
//#region lib/components/ui/widgets/editor/extensions/assistant/assistant-state.ts
|
|
570
|
-
function
|
|
570
|
+
function nr(e, t) {
|
|
571
571
|
let { range: n } = e, r = t(n.from, 1), i = Math.max(r, t(n.to, -1));
|
|
572
572
|
return r === n.from && i === n.to ? null : e.hasSelection && r === i ? {
|
|
573
573
|
range: {
|
|
@@ -581,7 +581,7 @@ function tr(e, t) {
|
|
|
581
581
|
to: i
|
|
582
582
|
} };
|
|
583
583
|
}
|
|
584
|
-
var
|
|
584
|
+
var rr = {
|
|
585
585
|
phase: "idle",
|
|
586
586
|
range: {
|
|
587
587
|
from: 0,
|
|
@@ -594,29 +594,29 @@ var nr = {
|
|
|
594
594
|
run: null,
|
|
595
595
|
applying: !1,
|
|
596
596
|
note: null
|
|
597
|
-
},
|
|
598
|
-
function
|
|
599
|
-
let t =
|
|
600
|
-
return
|
|
597
|
+
}, ir = () => () => {}, ar = (e) => e ? tr(e)?.controller : void 0;
|
|
598
|
+
function or(e) {
|
|
599
|
+
let t = ar(e);
|
|
600
|
+
return xn(t?.subscribe ?? ir, t?.getState ?? (() => rr), () => rr);
|
|
601
601
|
}
|
|
602
602
|
//#endregion
|
|
603
603
|
//#region lib/components/ui/widgets/editor/extensions/assistant/assistant-panel.tsx
|
|
604
|
-
function
|
|
604
|
+
function sr(e) {
|
|
605
605
|
let { handle: t, chrome: n } = k(), r = t.features.some((e) => e.key === "assistant");
|
|
606
|
-
return !t.editor || !r || n.state.panel !== "assistant" ? null : /* @__PURE__ */ q(
|
|
606
|
+
return !t.editor || !r || n.state.panel !== "assistant" ? null : /* @__PURE__ */ q(cr, {});
|
|
607
607
|
}
|
|
608
|
-
function
|
|
609
|
-
let { t: e, language: t } = j(), { handle: n } = k(), r = n.editor, i =
|
|
608
|
+
function cr() {
|
|
609
|
+
let { t: e, language: t } = j(), { handle: n } = k(), r = n.editor, i = tr(r), a = or(r), o = i?.controller, s = U(() => In(i?.actions, e), [i?.actions, e]);
|
|
610
610
|
if (H(() => (o?.getState().phase === "idle" && o.begin(), () => o?.reset()), [o]), !o || a.phase === "idle") return null;
|
|
611
611
|
let c = (e) => {
|
|
612
612
|
o.close(), e !== "outside" && r.commands.focus();
|
|
613
613
|
}, l = () => c("discard"), u = (e) => void o.run({
|
|
614
614
|
...e,
|
|
615
615
|
locale: t ?? "en"
|
|
616
|
-
}), d = (e) => void o.apply(async (t) => await
|
|
616
|
+
}), d = (e) => void o.apply(async (t) => await An(r, a.text, t, e, { allowMedia: i?.allowMedia }) ? "done" : r.isEditable ? "nothing" : "read-only"), f = (e) => {
|
|
617
617
|
e.key === "Escape" && (e.preventDefault(), e.stopPropagation(), c("escape"));
|
|
618
618
|
}, p = e("material.editor.assistant.title", "Assistant");
|
|
619
|
-
return /* @__PURE__ */ q(
|
|
619
|
+
return /* @__PURE__ */ q(zn, {
|
|
620
620
|
editor: r,
|
|
621
621
|
controller: o,
|
|
622
622
|
label: p,
|
|
@@ -626,10 +626,10 @@ function sr() {
|
|
|
626
626
|
ref: o.setPanel,
|
|
627
627
|
onKeyDown: f,
|
|
628
628
|
className: "grid gap-2.5",
|
|
629
|
-
children: [/* @__PURE__ */ q(
|
|
629
|
+
children: [/* @__PURE__ */ q(Zn, {
|
|
630
630
|
label: a.run?.label ?? p,
|
|
631
631
|
onDiscard: l
|
|
632
|
-
}), /* @__PURE__ */ q(
|
|
632
|
+
}), /* @__PURE__ */ q(Qn, {
|
|
633
633
|
editor: r,
|
|
634
634
|
state: a,
|
|
635
635
|
actions: s,
|
|
@@ -647,18 +647,18 @@ function sr() {
|
|
|
647
647
|
}
|
|
648
648
|
//#endregion
|
|
649
649
|
//#region lib/components/ui/widgets/editor/extensions/collab/use-presence.ts
|
|
650
|
-
var
|
|
651
|
-
function
|
|
650
|
+
var lr = [], ur = () => () => {};
|
|
651
|
+
function dr() {
|
|
652
652
|
let { editor: e } = k().handle;
|
|
653
|
-
return
|
|
653
|
+
return fr(e);
|
|
654
654
|
}
|
|
655
|
-
function
|
|
655
|
+
function fr(e) {
|
|
656
656
|
let t = e?.storage.nxgtPresence?.store ?? null;
|
|
657
|
-
return
|
|
657
|
+
return xn(t ? t.subscribe : ur, t ? t.getSnapshot : () => lr, () => lr);
|
|
658
658
|
}
|
|
659
659
|
//#endregion
|
|
660
660
|
//#region lib/components/ui/widgets/editor/extensions/collab/editor-presence.tsx
|
|
661
|
-
var
|
|
661
|
+
var pr = {
|
|
662
662
|
connecting: [
|
|
663
663
|
"warning",
|
|
664
664
|
"material.editor.collab.status.connecting",
|
|
@@ -675,7 +675,7 @@ var fr = {
|
|
|
675
675
|
"Offline"
|
|
676
676
|
]
|
|
677
677
|
};
|
|
678
|
-
function
|
|
678
|
+
function mr({ user: e }) {
|
|
679
679
|
return /* @__PURE__ */ q("span", {
|
|
680
680
|
role: "img",
|
|
681
681
|
"aria-label": e.name,
|
|
@@ -683,17 +683,17 @@ function pr({ user: e }) {
|
|
|
683
683
|
className: "flex",
|
|
684
684
|
children: /* @__PURE__ */ q(he, { fallback: /* @__PURE__ */ q("span", {
|
|
685
685
|
ref: (t) => {
|
|
686
|
-
t?.style.setProperty("--nxgt-collab-color", e.color), t?.style.setProperty("--nxgt-collab-fg",
|
|
686
|
+
t?.style.setProperty("--nxgt-collab-color", e.color), t?.style.setProperty("--nxgt-collab-fg", Et(e.color));
|
|
687
687
|
},
|
|
688
688
|
className: "grid size-full place-items-center rounded-full bg-[var(--nxgt-collab-color)] text-[var(--nxgt-collab-fg)]",
|
|
689
|
-
children:
|
|
689
|
+
children: Tt(e.name)
|
|
690
690
|
}) })
|
|
691
691
|
});
|
|
692
692
|
}
|
|
693
|
-
function
|
|
694
|
-
let { t: i } = j(), a =
|
|
693
|
+
function hr({ status: e, max: n = 4, className: r }) {
|
|
694
|
+
let { t: i } = j(), a = dr();
|
|
695
695
|
if (!e && a.length === 0) return null;
|
|
696
|
-
let [o, s, c] = e ?
|
|
696
|
+
let [o, s, c] = e ? pr[e] : [];
|
|
697
697
|
return /* @__PURE__ */ J("div", {
|
|
698
698
|
"data-slot": "editor-presence",
|
|
699
699
|
"data-status": e,
|
|
@@ -709,16 +709,16 @@ function mr({ status: e, max: n = 4, className: r }) {
|
|
|
709
709
|
max: n,
|
|
710
710
|
role: "group",
|
|
711
711
|
"aria-label": i("material.editor.collab.people", "{count, plural, one {# person editing} other {# people editing}}", { count: a.length }),
|
|
712
|
-
children: a.map((e) => /* @__PURE__ */ q(
|
|
712
|
+
children: a.map((e) => /* @__PURE__ */ q(mr, { user: e }, e.clientId))
|
|
713
713
|
})]
|
|
714
714
|
});
|
|
715
715
|
}
|
|
716
716
|
//#endregion
|
|
717
717
|
//#region lib/components/ui/widgets/editor/extensions/comments/comment-field.ts
|
|
718
|
-
var
|
|
718
|
+
var gr = "[&_textarea]:min-w-0", _r = (e) => e.key === "Enter" && (e.metaKey || e.ctrlKey);
|
|
719
719
|
//#endregion
|
|
720
720
|
//#region lib/components/ui/widgets/editor/extensions/comments/comment-composer-form.tsx
|
|
721
|
-
function
|
|
721
|
+
function vr({ composer: e, body: t, onBody: n, onSubmit: r, onDismiss: i }) {
|
|
722
722
|
let { t: a } = j(), o = e.error === "invalid-id" ? a("material.editor.comments.invalid-id", "The adapter answered a thread id that is not allowed.") : e.error;
|
|
723
723
|
return /* @__PURE__ */ J("form", {
|
|
724
724
|
className: "grid grid-cols-[minmax(0,1fr)] gap-2.5",
|
|
@@ -734,7 +734,7 @@ function _r({ composer: e, body: t, onBody: n, onSubmit: r, onDismiss: i }) {
|
|
|
734
734
|
children: e.quote
|
|
735
735
|
}),
|
|
736
736
|
/* @__PURE__ */ q(C, {
|
|
737
|
-
className:
|
|
737
|
+
className: gr,
|
|
738
738
|
"aria-label": a("material.editor.comments.body-label", "Comment"),
|
|
739
739
|
placeholder: a("material.editor.comments.placeholder", "Write a comment…"),
|
|
740
740
|
value: t,
|
|
@@ -743,7 +743,7 @@ function _r({ composer: e, body: t, onBody: n, onSubmit: r, onDismiss: i }) {
|
|
|
743
743
|
readOnly: e.pending,
|
|
744
744
|
onChange: (e) => n(e.target.value),
|
|
745
745
|
onKeyDown: (e) => {
|
|
746
|
-
|
|
746
|
+
_r(e) && (e.preventDefault(), r());
|
|
747
747
|
}
|
|
748
748
|
}),
|
|
749
749
|
o && /* @__PURE__ */ q("p", {
|
|
@@ -751,7 +751,7 @@ function _r({ composer: e, body: t, onBody: n, onSubmit: r, onDismiss: i }) {
|
|
|
751
751
|
className: "text-error text-xs",
|
|
752
752
|
children: a("material.editor.comments.failed", "Not saved: {message}", { message: o })
|
|
753
753
|
}),
|
|
754
|
-
/* @__PURE__ */ q(
|
|
754
|
+
/* @__PURE__ */ q(yr, {
|
|
755
755
|
pending: e.pending,
|
|
756
756
|
empty: !t.trim(),
|
|
757
757
|
onDismiss: i
|
|
@@ -759,14 +759,14 @@ function _r({ composer: e, body: t, onBody: n, onSubmit: r, onDismiss: i }) {
|
|
|
759
759
|
]
|
|
760
760
|
});
|
|
761
761
|
}
|
|
762
|
-
function
|
|
762
|
+
function yr({ pending: e, empty: t, onDismiss: n }) {
|
|
763
763
|
let { t: r } = j();
|
|
764
764
|
return /* @__PURE__ */ J("div", {
|
|
765
765
|
className: "flex justify-end gap-2",
|
|
766
766
|
children: [/* @__PURE__ */ q(M, {
|
|
767
767
|
type: "button",
|
|
768
768
|
size: "sm",
|
|
769
|
-
variant:
|
|
769
|
+
variant: Xe,
|
|
770
770
|
disabled: e,
|
|
771
771
|
onClick: n,
|
|
772
772
|
children: r("material.editor.comments.cancel", "Cancel")
|
|
@@ -781,7 +781,7 @@ function vr({ pending: e, empty: t, onDismiss: n }) {
|
|
|
781
781
|
}
|
|
782
782
|
//#endregion
|
|
783
783
|
//#region lib/components/ui/widgets/editor/extensions/comments/comments-state.ts
|
|
784
|
-
var
|
|
784
|
+
var br = (e = !1) => ({
|
|
785
785
|
phase: "loading",
|
|
786
786
|
loadError: null,
|
|
787
787
|
threads: [],
|
|
@@ -794,22 +794,22 @@ var yr = (e = !1) => ({
|
|
|
794
794
|
}), Y = (e) => {
|
|
795
795
|
let t = e.storage.comments;
|
|
796
796
|
return t?.controller ? t : void 0;
|
|
797
|
-
},
|
|
798
|
-
function
|
|
799
|
-
let t =
|
|
800
|
-
return
|
|
797
|
+
}, xr = () => () => {}, Sr = br(), Cr = (e) => e ? Y(e)?.controller : void 0;
|
|
798
|
+
function wr(e) {
|
|
799
|
+
let t = Cr(e);
|
|
800
|
+
return xn(t?.subscribe ?? xr, t?.getState ?? (() => Sr), () => Sr);
|
|
801
801
|
}
|
|
802
802
|
//#endregion
|
|
803
803
|
//#region lib/components/ui/widgets/editor/extensions/comments/comments-live.tsx
|
|
804
|
-
var
|
|
804
|
+
var Tr = {
|
|
805
805
|
added: ["added", "Comment added"],
|
|
806
806
|
replied: ["replied", "Reply added"],
|
|
807
807
|
resolved: ["resolved-notice", "Thread resolved"],
|
|
808
808
|
reopened: ["reopened-notice", "Thread reopened"],
|
|
809
809
|
deleted: ["deleted-notice", "Thread deleted"]
|
|
810
810
|
};
|
|
811
|
-
function
|
|
812
|
-
let { t } = j(), { notice: n } =
|
|
811
|
+
function Er({ editor: e }) {
|
|
812
|
+
let { t } = j(), { notice: n } = wr(e), r = n ? Tr[n.kind] : null;
|
|
813
813
|
return /* @__PURE__ */ q("div", {
|
|
814
814
|
role: "status",
|
|
815
815
|
"aria-live": "polite",
|
|
@@ -820,19 +820,19 @@ function Tr({ editor: e }) {
|
|
|
820
820
|
}
|
|
821
821
|
//#endregion
|
|
822
822
|
//#region lib/components/ui/widgets/editor/extensions/comments/comment-composer.tsx
|
|
823
|
-
function
|
|
823
|
+
function Dr(e) {
|
|
824
824
|
let { handle: t } = k(), { editor: n } = t;
|
|
825
|
-
return !n || !Y(n) ? null : /* @__PURE__ */ J(K, { children: [/* @__PURE__ */ q(
|
|
825
|
+
return !n || !Y(n) ? null : /* @__PURE__ */ J(K, { children: [/* @__PURE__ */ q(Or, { editor: n }), /* @__PURE__ */ q(Er, { editor: n })] });
|
|
826
826
|
}
|
|
827
|
-
function
|
|
827
|
+
function Or({ editor: e }) {
|
|
828
828
|
let t = Y(e)?.controller;
|
|
829
|
-
return
|
|
829
|
+
return wr(e).composer === null ? null : /* @__PURE__ */ q(kr, {
|
|
830
830
|
editor: e,
|
|
831
831
|
controller: t
|
|
832
832
|
});
|
|
833
833
|
}
|
|
834
|
-
function
|
|
835
|
-
let { t: n } = j(), { chrome: r } = k(), i =
|
|
834
|
+
function kr({ editor: e, controller: t }) {
|
|
835
|
+
let { t: n } = j(), { chrome: r } = k(), i = wr(e).composer, { actions: a } = r;
|
|
836
836
|
H(() => (a.setBubbleSuppressed(!0), () => {
|
|
837
837
|
a.setBubbleSuppressed(!1);
|
|
838
838
|
}), [a]);
|
|
@@ -844,14 +844,14 @@ function Or({ editor: e, controller: t }) {
|
|
|
844
844
|
let l = (n) => {
|
|
845
845
|
t.closeComposer(), n && e.commands.focus();
|
|
846
846
|
};
|
|
847
|
-
return /* @__PURE__ */ q(
|
|
847
|
+
return /* @__PURE__ */ q(zn, {
|
|
848
848
|
editor: e,
|
|
849
849
|
controller: c,
|
|
850
850
|
label: n("material.editor.comments.composer", "New comment"),
|
|
851
851
|
slot: "editor-comment-composer",
|
|
852
852
|
locked: i.pending,
|
|
853
853
|
onDismiss: (e) => l(e !== "outside"),
|
|
854
|
-
children: /* @__PURE__ */ q(
|
|
854
|
+
children: /* @__PURE__ */ q(vr, {
|
|
855
855
|
composer: i,
|
|
856
856
|
body: o,
|
|
857
857
|
onBody: s,
|
|
@@ -862,13 +862,13 @@ function Or({ editor: e, controller: t }) {
|
|
|
862
862
|
}
|
|
863
863
|
//#endregion
|
|
864
864
|
//#region lib/components/ui/widgets/editor/partials/editor-panel.tsx
|
|
865
|
-
function
|
|
865
|
+
function Ar(e, t) {
|
|
866
866
|
let n = e?.querySelector("[data-toolbar-more]");
|
|
867
867
|
return !n || !(t instanceof Element) ? !1 : n.contains(t) ? !0 : n.getAttribute("aria-expanded") === "true" && !!t.closest("[role=\"menu\"]");
|
|
868
868
|
}
|
|
869
|
-
function
|
|
869
|
+
function jr({ id: e, children: t, ...n }) {
|
|
870
870
|
let { chrome: r, toolbarRef: i } = k(), a = r.state.panel === e, [o, s] = G();
|
|
871
|
-
return
|
|
871
|
+
return bn(() => {
|
|
872
872
|
let e = i.current, t = e?.getAttribute("aria-orientation") === "vertical" ? getComputedStyle(e).direction === "rtl" ? "left" : "right" : void 0;
|
|
873
873
|
t !== o && s(t);
|
|
874
874
|
}), /* @__PURE__ */ J(Je, {
|
|
@@ -883,10 +883,10 @@ function Ar({ id: e, children: t, ...n }) {
|
|
|
883
883
|
},
|
|
884
884
|
...n,
|
|
885
885
|
onFocusOutside: (e) => {
|
|
886
|
-
n.onFocusOutside?.(e), (i.current?.contains(e.target) ||
|
|
886
|
+
n.onFocusOutside?.(e), (i.current?.contains(e.target) || Ar(i.current, e.target)) && e.preventDefault();
|
|
887
887
|
},
|
|
888
888
|
onPointerDownOutside: (e) => {
|
|
889
|
-
n.onPointerDownOutside?.(e),
|
|
889
|
+
n.onPointerDownOutside?.(e), Ar(i.current, e.target) && e.preventDefault();
|
|
890
890
|
},
|
|
891
891
|
children: t
|
|
892
892
|
})]
|
|
@@ -894,7 +894,7 @@ function Ar({ id: e, children: t, ...n }) {
|
|
|
894
894
|
}
|
|
895
895
|
//#endregion
|
|
896
896
|
//#region lib/components/ui/widgets/editor/extensions/comments/comments-status.tsx
|
|
897
|
-
function
|
|
897
|
+
function Mr({ state: e, controller: t, count: n }) {
|
|
898
898
|
let { t: r } = j();
|
|
899
899
|
return n === 0 && !e.showResolved ? null : /* @__PURE__ */ q(d, {
|
|
900
900
|
label: r("material.editor.comments.show-resolved", "Show resolved"),
|
|
@@ -902,7 +902,7 @@ function jr({ state: e, controller: t, count: n }) {
|
|
|
902
902
|
onCheckedChange: t.setShowResolved
|
|
903
903
|
});
|
|
904
904
|
}
|
|
905
|
-
function
|
|
905
|
+
function Nr({ state: e, empty: t }) {
|
|
906
906
|
let { t: n } = j(), r = null;
|
|
907
907
|
return e.phase === "loading" ? r = n("material.editor.comments.loading", "Loading comments…") : e.phase === "failed" ? r = n("material.editor.comments.load-failed", "Comments could not be loaded: {message}", { message: e.loadError ?? "" }) : t && (r = n("material.editor.comments.empty", "No comments yet")), r ? /* @__PURE__ */ q("p", {
|
|
908
908
|
role: e.phase === "failed" ? "alert" : void 0,
|
|
@@ -912,31 +912,30 @@ function Mr({ state: e, empty: t }) {
|
|
|
912
912
|
}
|
|
913
913
|
//#endregion
|
|
914
914
|
//#region lib/components/ui/widgets/editor/extensions/comments/comment-edit-form.tsx
|
|
915
|
-
function
|
|
915
|
+
function Pr({ draft: e, onChange: t, onSave: n, onCancel: r }) {
|
|
916
916
|
let { t: i } = j();
|
|
917
917
|
return /* @__PURE__ */ J("div", {
|
|
918
918
|
className: "grid grid-cols-[minmax(0,1fr)] gap-2",
|
|
919
919
|
children: [/* @__PURE__ */ q(C, {
|
|
920
|
-
className:
|
|
920
|
+
className: gr,
|
|
921
921
|
"aria-label": i("material.editor.comments.body-label", "Comment"),
|
|
922
922
|
value: e,
|
|
923
923
|
minRows: 2,
|
|
924
924
|
autoFocus: !0,
|
|
925
925
|
onChange: (e) => t(e.target.value),
|
|
926
926
|
onKeyDown: (e) => {
|
|
927
|
-
e.key === "Escape" ? (e.stopPropagation(), r()) :
|
|
927
|
+
e.key === "Escape" ? (e.stopPropagation(), r()) : _r(e) && (e.preventDefault(), n());
|
|
928
928
|
}
|
|
929
929
|
}), /* @__PURE__ */ J("div", {
|
|
930
930
|
className: "flex gap-2",
|
|
931
931
|
children: [/* @__PURE__ */ q(M, {
|
|
932
932
|
size: "sm",
|
|
933
|
-
variant: "tonal",
|
|
934
933
|
disabled: !e.trim(),
|
|
935
934
|
onClick: n,
|
|
936
935
|
children: i("material.editor.comments.save", "Save")
|
|
937
936
|
}), /* @__PURE__ */ q(M, {
|
|
938
937
|
size: "sm",
|
|
939
|
-
variant:
|
|
938
|
+
variant: Xe,
|
|
940
939
|
onClick: r,
|
|
941
940
|
children: i("material.editor.comments.cancel", "Cancel")
|
|
942
941
|
})]
|
|
@@ -945,14 +944,14 @@ function Nr({ draft: e, onChange: t, onSave: n, onCancel: r }) {
|
|
|
945
944
|
}
|
|
946
945
|
//#endregion
|
|
947
946
|
//#region lib/components/ui/widgets/editor/extensions/comments/comments-ops.ts
|
|
948
|
-
var
|
|
947
|
+
var Fr = "pending:", Ir = (e) => e.id.startsWith(Fr), Lr = (e, t, n) => e.map((e) => e.id === t ? n(e) : e), Rr = (e, t, n) => Lr(e, t, (e) => ({
|
|
949
948
|
...e,
|
|
950
949
|
comments: [...e.comments, {
|
|
951
950
|
...n,
|
|
952
|
-
id: `${
|
|
951
|
+
id: `${Fr}${n.id}`
|
|
953
952
|
}]
|
|
954
|
-
})),
|
|
955
|
-
let t = `${
|
|
953
|
+
})), zr = (e, t, n, r) => Lr(e, t, (e) => {
|
|
954
|
+
let t = `${Fr}${n}`, i = e.comments.some((e) => e.id === t), a = !!r && e.comments.some((e) => e.id === r?.id);
|
|
956
955
|
return i ? {
|
|
957
956
|
...e,
|
|
958
957
|
comments: e.comments.flatMap((e) => e.id === t ? r && !a ? [r] : [] : [e])
|
|
@@ -960,35 +959,35 @@ var Pr = "pending:", Fr = (e) => e.id.startsWith(Pr), Ir = (e, t, n) => e.map((e
|
|
|
960
959
|
...e,
|
|
961
960
|
comments: [...e.comments, r]
|
|
962
961
|
} : e;
|
|
963
|
-
}),
|
|
962
|
+
}), Br = (e, t, n) => Lr(e, t, (e) => ({
|
|
964
963
|
...e,
|
|
965
964
|
resolved: n
|
|
966
|
-
})),
|
|
965
|
+
})), Vr = (e, t, n) => e.map((e) => ({
|
|
967
966
|
...e,
|
|
968
967
|
comments: e.comments.map((e) => e.id === t ? {
|
|
969
968
|
...e,
|
|
970
969
|
body: n
|
|
971
970
|
} : e)
|
|
972
|
-
})),
|
|
971
|
+
})), Hr = (e, t) => e.filter((e) => e.id !== t), Ur = (e, t, n) => e.some((e) => e.id === t.id) ? e : [
|
|
973
972
|
...e.slice(0, n),
|
|
974
973
|
t,
|
|
975
974
|
...e.slice(n)
|
|
976
|
-
],
|
|
977
|
-
if (!
|
|
975
|
+
], Wr = (e, t) => e.some((e) => e.id === t.id) ? e.map((e) => e.id === t.id ? t : e) : [...e, t], Gr = (e) => typeof e == "object" && !!e, Kr = (e) => {
|
|
976
|
+
if (!Gr(e) || !Gr(e.author)) return null;
|
|
978
977
|
let { id: t, body: n, author: r } = e;
|
|
979
978
|
return typeof t != "string" || !t || typeof n != "string" || typeof r.name != "string" ? null : e;
|
|
980
|
-
},
|
|
979
|
+
}, qr = (e) => !Gr(e) || !Ct(e.id) || !Array.isArray(e.comments) ? null : {
|
|
981
980
|
...e,
|
|
982
981
|
quote: typeof e.quote == "string" ? e.quote : "",
|
|
983
982
|
resolved: e.resolved === !0,
|
|
984
983
|
comments: e.comments.flatMap((e) => {
|
|
985
|
-
let t =
|
|
984
|
+
let t = Kr(e);
|
|
986
985
|
return t ? [t] : [];
|
|
987
986
|
})
|
|
988
|
-
},
|
|
989
|
-
let t =
|
|
987
|
+
}, Jr = (e) => Array.isArray(e) ? e.flatMap((e) => {
|
|
988
|
+
let t = qr(e);
|
|
990
989
|
return t ? [t] : [];
|
|
991
|
-
}) : [],
|
|
990
|
+
}) : [], Yr = [
|
|
992
991
|
["year", 365 * 24 * 3600],
|
|
993
992
|
["month", 720 * 3600],
|
|
994
993
|
["week", 168 * 3600],
|
|
@@ -996,25 +995,25 @@ var Pr = "pending:", Fr = (e) => e.id.startsWith(Pr), Ir = (e, t, n) => e.map((e
|
|
|
996
995
|
["hour", 3600],
|
|
997
996
|
["minute", 60]
|
|
998
997
|
];
|
|
999
|
-
function
|
|
998
|
+
function Xr(e, t, n) {
|
|
1000
999
|
let r = Date.parse(e);
|
|
1001
1000
|
if (Number.isNaN(r)) return "";
|
|
1002
1001
|
let i = Math.min(0, Math.round((r - t) / 1e3)), a = new Intl.RelativeTimeFormat(n, { numeric: "auto" });
|
|
1003
|
-
for (let [e, t] of
|
|
1002
|
+
for (let [e, t] of Yr) if (-i >= t) return a.format(Math.round(i / t), e);
|
|
1004
1003
|
return a.format(0, "second");
|
|
1005
1004
|
}
|
|
1006
1005
|
//#endregion
|
|
1007
1006
|
//#region lib/components/ui/widgets/editor/extensions/comments/comment-entry.tsx
|
|
1008
|
-
var
|
|
1009
|
-
function
|
|
1007
|
+
var Zr = (e) => e.split(/\s+/).filter(Boolean).slice(0, 2).map((e) => e[0]?.toUpperCase()).join("");
|
|
1008
|
+
function Qr({ comment: e, pending: t, onEdit: n }) {
|
|
1010
1009
|
let { t: r, language: i } = j();
|
|
1011
1010
|
return /* @__PURE__ */ J("div", {
|
|
1012
1011
|
className: "flex items-center gap-2",
|
|
1013
1012
|
children: [
|
|
1014
1013
|
/* @__PURE__ */ q(he, {
|
|
1015
|
-
src:
|
|
1014
|
+
src: mt(e.author.avatarUrl),
|
|
1016
1015
|
alt: "",
|
|
1017
|
-
fallback:
|
|
1016
|
+
fallback: Zr(e.author.name),
|
|
1018
1017
|
className: "size-6 text-[0.625rem]"
|
|
1019
1018
|
}),
|
|
1020
1019
|
/* @__PURE__ */ q("b", {
|
|
@@ -1024,7 +1023,7 @@ function Zr({ comment: e, pending: t, onEdit: n }) {
|
|
|
1024
1023
|
/* @__PURE__ */ q("time", {
|
|
1025
1024
|
dateTime: e.createdAt,
|
|
1026
1025
|
className: "shrink-0 text-muted-foreground text-xs",
|
|
1027
|
-
children: t ? r("material.editor.comments.sending", "Sending…") :
|
|
1026
|
+
children: t ? r("material.editor.comments.sending", "Sending…") : Xr(e.createdAt, Date.now(), i)
|
|
1028
1027
|
}),
|
|
1029
1028
|
n && !t && /* @__PURE__ */ q(M, {
|
|
1030
1029
|
variant: "ghost",
|
|
@@ -1036,8 +1035,8 @@ function Zr({ comment: e, pending: t, onEdit: n }) {
|
|
|
1036
1035
|
]
|
|
1037
1036
|
});
|
|
1038
1037
|
}
|
|
1039
|
-
function
|
|
1040
|
-
let [i, a] = G(null), o =
|
|
1038
|
+
function $r({ comment: e, editable: n, onEdit: r }) {
|
|
1039
|
+
let [i, a] = G(null), o = Ir(e), s = async () => {
|
|
1041
1040
|
let t = i;
|
|
1042
1041
|
a(null), t !== null && t.trim() !== e.body && await r(t);
|
|
1043
1042
|
};
|
|
@@ -1045,14 +1044,14 @@ function Qr({ comment: e, editable: n, onEdit: r }) {
|
|
|
1045
1044
|
"data-slot": "comment-entry",
|
|
1046
1045
|
"aria-busy": o || void 0,
|
|
1047
1046
|
className: t("grid grid-cols-[minmax(0,1fr)] gap-1.5", o && "opacity-60"),
|
|
1048
|
-
children: [/* @__PURE__ */ q(
|
|
1047
|
+
children: [/* @__PURE__ */ q(Qr, {
|
|
1049
1048
|
comment: e,
|
|
1050
1049
|
pending: o,
|
|
1051
1050
|
onEdit: n && i === null ? () => a(e.body) : void 0
|
|
1052
1051
|
}), i === null ? /* @__PURE__ */ q("p", {
|
|
1053
1052
|
className: "whitespace-pre-wrap break-words text-sm leading-relaxed",
|
|
1054
1053
|
children: e.body
|
|
1055
|
-
}) : /* @__PURE__ */ q(
|
|
1054
|
+
}) : /* @__PURE__ */ q(Pr, {
|
|
1056
1055
|
draft: i,
|
|
1057
1056
|
onChange: a,
|
|
1058
1057
|
onSave: () => void s(),
|
|
@@ -1062,20 +1061,20 @@ function Qr({ comment: e, editable: n, onEdit: r }) {
|
|
|
1062
1061
|
}
|
|
1063
1062
|
//#endregion
|
|
1064
1063
|
//#region lib/components/ui/widgets/editor/extensions/comments/thread-reply.tsx
|
|
1065
|
-
function
|
|
1064
|
+
function ei({ thread: e, controller: t, canRemove: n }) {
|
|
1066
1065
|
let { t: r } = j(), [i, a] = G(""), o = async () => {
|
|
1067
1066
|
let n = i;
|
|
1068
1067
|
n.trim() && (a(""), await t.reply(e.id, n) || a(n));
|
|
1069
1068
|
};
|
|
1070
1069
|
return /* @__PURE__ */ J(K, { children: [/* @__PURE__ */ q(C, {
|
|
1071
|
-
className:
|
|
1070
|
+
className: gr,
|
|
1072
1071
|
"aria-label": r("material.editor.comments.reply-label", "Reply to this thread"),
|
|
1073
1072
|
placeholder: r("material.editor.comments.reply-placeholder", "Reply…"),
|
|
1074
1073
|
value: i,
|
|
1075
1074
|
minRows: 1,
|
|
1076
1075
|
onChange: (e) => a(e.target.value),
|
|
1077
1076
|
onKeyDown: (e) => {
|
|
1078
|
-
|
|
1077
|
+
_r(e) && (e.preventDefault(), o());
|
|
1079
1078
|
}
|
|
1080
1079
|
}), /* @__PURE__ */ J("div", {
|
|
1081
1080
|
className: "flex flex-wrap gap-2",
|
|
@@ -1107,7 +1106,7 @@ function $r({ thread: e, controller: t, canRemove: n }) {
|
|
|
1107
1106
|
}
|
|
1108
1107
|
//#endregion
|
|
1109
1108
|
//#region lib/components/ui/widgets/editor/extensions/comments/thread-card.tsx
|
|
1110
|
-
function
|
|
1109
|
+
function ti(e) {
|
|
1111
1110
|
let { thread: n, controller: r, active: i, detached: a, error: o, user: s } = e, { t: c } = j(), l = n.comments[0]?.author.id === s?.id && !!s;
|
|
1112
1111
|
return /* @__PURE__ */ J("section", {
|
|
1113
1112
|
ref: e.cardRef,
|
|
@@ -1130,7 +1129,7 @@ function ei(e) {
|
|
|
1130
1129
|
}),
|
|
1131
1130
|
/* @__PURE__ */ q("ul", {
|
|
1132
1131
|
className: "grid grid-cols-[minmax(0,1fr)] gap-3",
|
|
1133
|
-
children: n.comments.map((t) => /* @__PURE__ */ q(
|
|
1132
|
+
children: n.comments.map((t) => /* @__PURE__ */ q($r, {
|
|
1134
1133
|
comment: t,
|
|
1135
1134
|
editable: e.canEdit && t.author.id === s?.id,
|
|
1136
1135
|
onEdit: (e) => r.edit(n.id, t.id, e)
|
|
@@ -1141,7 +1140,7 @@ function ei(e) {
|
|
|
1141
1140
|
className: "text-error text-xs",
|
|
1142
1141
|
children: c("material.editor.comments.failed", "Not saved: {message}", { message: o })
|
|
1143
1142
|
}),
|
|
1144
|
-
/* @__PURE__ */ q(
|
|
1143
|
+
/* @__PURE__ */ q(ei, {
|
|
1145
1144
|
thread: n,
|
|
1146
1145
|
controller: r,
|
|
1147
1146
|
canRemove: e.canRemove && l
|
|
@@ -1151,7 +1150,7 @@ function ei(e) {
|
|
|
1151
1150
|
}
|
|
1152
1151
|
//#endregion
|
|
1153
1152
|
//#region lib/components/ui/widgets/editor/extensions/comments/detached-threads.tsx
|
|
1154
|
-
function
|
|
1153
|
+
function ni({ views: e }) {
|
|
1155
1154
|
let { t } = j(), { controller: n, state: r, detached: i } = e;
|
|
1156
1155
|
return !n || i.length === 0 ? null : /* @__PURE__ */ J("section", {
|
|
1157
1156
|
"data-slot": "comment-detached",
|
|
@@ -1159,14 +1158,14 @@ function ti({ views: e }) {
|
|
|
1159
1158
|
children: [/* @__PURE__ */ q("h3", {
|
|
1160
1159
|
className: "px-1 font-medium text-muted-foreground text-xs uppercase tracking-wide",
|
|
1161
1160
|
children: t("material.editor.comments.detached", "Detached")
|
|
1162
|
-
}), i.map((t) => /* @__PURE__ */ q(
|
|
1163
|
-
...
|
|
1161
|
+
}), i.map((t) => /* @__PURE__ */ q(ti, {
|
|
1162
|
+
...ri(e, t),
|
|
1164
1163
|
detached: !0,
|
|
1165
1164
|
active: r.activeId === t.id
|
|
1166
1165
|
}, t.id))]
|
|
1167
1166
|
});
|
|
1168
1167
|
}
|
|
1169
|
-
function
|
|
1168
|
+
function ri(e, t) {
|
|
1170
1169
|
return {
|
|
1171
1170
|
thread: t,
|
|
1172
1171
|
controller: e.controller,
|
|
@@ -1178,7 +1177,7 @@ function ni(e, t) {
|
|
|
1178
1177
|
}
|
|
1179
1178
|
//#endregion
|
|
1180
1179
|
//#region lib/components/ui/widgets/editor/extensions/comments/anchors.ts
|
|
1181
|
-
function
|
|
1180
|
+
function ii(e) {
|
|
1182
1181
|
let t = Object.create(null), n = /* @__PURE__ */ new Set();
|
|
1183
1182
|
return e.descendants((e, r) => {
|
|
1184
1183
|
if (!e.isText) return;
|
|
@@ -1197,16 +1196,16 @@ function ri(e) {
|
|
|
1197
1196
|
for (let e of n) i.has(e) || n.delete(e);
|
|
1198
1197
|
}), t;
|
|
1199
1198
|
}
|
|
1200
|
-
function
|
|
1199
|
+
function ai(e, t) {
|
|
1201
1200
|
let n = Object.keys(e);
|
|
1202
1201
|
return n.length === Object.keys(t).length && n.every((n) => t[n]?.from === e[n]?.from && t[n]?.to === e[n]?.to);
|
|
1203
1202
|
}
|
|
1204
|
-
var
|
|
1203
|
+
var oi = (e) => Object.keys(e).sort((t, n) => (e[t]?.from ?? 0) - (e[n]?.from ?? 0)), si = (e) => (e instanceof Error ? e.message : String(e)).slice(0, 300), ci = (e, t) => {
|
|
1205
1204
|
let { [t]: n, ...r } = e.get().errors;
|
|
1206
1205
|
e.set({ errors: r });
|
|
1207
1206
|
};
|
|
1208
|
-
async function
|
|
1209
|
-
|
|
1207
|
+
async function li(e, t, n, r) {
|
|
1208
|
+
ci(e, t);
|
|
1210
1209
|
try {
|
|
1211
1210
|
return e.set(r.done(await n)), !0;
|
|
1212
1211
|
} catch (n) {
|
|
@@ -1214,12 +1213,12 @@ async function ci(e, t, n, r) {
|
|
|
1214
1213
|
...r.undo(),
|
|
1215
1214
|
errors: {
|
|
1216
1215
|
...e.get().errors,
|
|
1217
|
-
[t]:
|
|
1216
|
+
[t]: si(n)
|
|
1218
1217
|
}
|
|
1219
1218
|
}), !1;
|
|
1220
1219
|
}
|
|
1221
1220
|
}
|
|
1222
|
-
async function
|
|
1221
|
+
async function ui(e, t) {
|
|
1223
1222
|
let { composer: n } = e.get(), r = e.host.adapter(), i = t.trim();
|
|
1224
1223
|
if (!(!n || n.pending || !r || !i)) {
|
|
1225
1224
|
e.set({ composer: {
|
|
@@ -1228,7 +1227,7 @@ async function li(e, t) {
|
|
|
1228
1227
|
error: null
|
|
1229
1228
|
} });
|
|
1230
1229
|
try {
|
|
1231
|
-
let t =
|
|
1230
|
+
let t = qr(await r.create({
|
|
1232
1231
|
threadId: n.threadId,
|
|
1233
1232
|
quote: n.quote,
|
|
1234
1233
|
body: i
|
|
@@ -1236,7 +1235,7 @@ async function li(e, t) {
|
|
|
1236
1235
|
if (!t) throw Error("invalid-id");
|
|
1237
1236
|
let a = e.get().composer?.range ?? n.range;
|
|
1238
1237
|
e.host.addMark(a, t.id), e.host.focus(), e.set({
|
|
1239
|
-
threads:
|
|
1238
|
+
threads: Wr(e.get().threads, t),
|
|
1240
1239
|
anchors: e.host.collect(),
|
|
1241
1240
|
composer: null,
|
|
1242
1241
|
activeId: t.id,
|
|
@@ -1247,16 +1246,16 @@ async function li(e, t) {
|
|
|
1247
1246
|
n && e.set({ composer: {
|
|
1248
1247
|
...n,
|
|
1249
1248
|
pending: !1,
|
|
1250
|
-
error:
|
|
1249
|
+
error: si(t)
|
|
1251
1250
|
} });
|
|
1252
1251
|
}
|
|
1253
1252
|
}
|
|
1254
1253
|
}
|
|
1255
|
-
function
|
|
1254
|
+
function di(e, t, n) {
|
|
1256
1255
|
let r = e.host.adapter(), i = n.trim();
|
|
1257
1256
|
if (!r || !i) return Promise.resolve(!1);
|
|
1258
1257
|
let a = e.temp();
|
|
1259
|
-
e.set({ threads:
|
|
1258
|
+
e.set({ threads: Rr(e.get().threads, t, {
|
|
1260
1259
|
id: a,
|
|
1261
1260
|
author: e.host.currentUser() ?? {
|
|
1262
1261
|
id: "",
|
|
@@ -1265,9 +1264,9 @@ function ui(e, t, n) {
|
|
|
1265
1264
|
body: i,
|
|
1266
1265
|
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
1267
1266
|
}) });
|
|
1268
|
-
let o = (n) =>
|
|
1269
|
-
return
|
|
1270
|
-
let e =
|
|
1267
|
+
let o = (n) => zr(e.get().threads, t, a, n);
|
|
1268
|
+
return li(e, t, (async () => {
|
|
1269
|
+
let e = Kr(await r.reply(t, i));
|
|
1271
1270
|
if (!e) throw Error("invalid-comment");
|
|
1272
1271
|
return e;
|
|
1273
1272
|
})(), {
|
|
@@ -1278,45 +1277,45 @@ function ui(e, t, n) {
|
|
|
1278
1277
|
undo: () => ({ threads: o(null) })
|
|
1279
1278
|
});
|
|
1280
1279
|
}
|
|
1281
|
-
function
|
|
1280
|
+
function fi(e, t, n) {
|
|
1282
1281
|
let r = e.host.adapter(), i = e.get().threads.find((e) => e.id === t);
|
|
1283
|
-
return !r || !i ? Promise.resolve(!1) : (e.set({ threads:
|
|
1282
|
+
return !r || !i ? Promise.resolve(!1) : (e.set({ threads: Br(e.get().threads, t, n) }), li(e, t, r.resolve(t, n), {
|
|
1284
1283
|
done: () => e.notify(n ? "resolved" : "reopened"),
|
|
1285
|
-
undo: () => ({ threads: e.get().threads.find((e) => e.id === t)?.resolved === n ?
|
|
1284
|
+
undo: () => ({ threads: e.get().threads.find((e) => e.id === t)?.resolved === n ? Br(e.get().threads, t, i.resolved) : e.get().threads })
|
|
1286
1285
|
}));
|
|
1287
1286
|
}
|
|
1288
|
-
function
|
|
1287
|
+
function pi(e, t) {
|
|
1289
1288
|
let n = e.host.adapter(), { threads: r, activeId: i } = e.get(), a = r.findIndex((e) => e.id === t), o = r[a];
|
|
1290
1289
|
return !n?.remove || !o ? Promise.resolve(!1) : (e.set({
|
|
1291
|
-
threads:
|
|
1290
|
+
threads: Hr(r, t),
|
|
1292
1291
|
activeId: i === t ? null : i
|
|
1293
|
-
}),
|
|
1292
|
+
}), li(e, t, n.remove(t), {
|
|
1294
1293
|
done: () => (e.host.removeMarks(t), {
|
|
1295
1294
|
anchors: e.host.collect(),
|
|
1296
1295
|
...e.notify("deleted")
|
|
1297
1296
|
}),
|
|
1298
|
-
undo: () => ({ threads:
|
|
1297
|
+
undo: () => ({ threads: Ur(e.get().threads, o, a) })
|
|
1299
1298
|
}));
|
|
1300
1299
|
}
|
|
1301
|
-
function
|
|
1300
|
+
function mi(e, t, n, r) {
|
|
1302
1301
|
let i = e.host.adapter(), a = r.trim(), o = e.get().threads.flatMap((e) => e.comments).find((e) => e.id === n);
|
|
1303
|
-
return !i?.edit || !o || !a ? Promise.resolve(!1) : (e.set({ threads:
|
|
1302
|
+
return !i?.edit || !o || !a ? Promise.resolve(!1) : (e.set({ threads: Vr(e.get().threads, n, a) }), li(e, t, i.edit(n, a), {
|
|
1304
1303
|
done: () => ({}),
|
|
1305
|
-
undo: () => ({ threads:
|
|
1304
|
+
undo: () => ({ threads: Vr(e.get().threads, n, o.body) })
|
|
1306
1305
|
}));
|
|
1307
1306
|
}
|
|
1308
1307
|
//#endregion
|
|
1309
1308
|
//#region lib/components/ui/widgets/editor/extensions/comments/comments-navigation.ts
|
|
1310
|
-
var
|
|
1311
|
-
function
|
|
1312
|
-
let n = new Set(
|
|
1309
|
+
var hi = (e) => e.threads.filter((t) => e.showResolved || !t.resolved);
|
|
1310
|
+
function gi(e, t) {
|
|
1311
|
+
let n = new Set(hi(e).map((e) => e.id)), r = oi(e.anchors).filter((e) => n.has(e));
|
|
1313
1312
|
if (!r.length) return null;
|
|
1314
1313
|
let i = e.activeId ? r.indexOf(e.activeId) : -1, a = t > 0 ? 0 : r.length - 1;
|
|
1315
1314
|
return r[i < 0 ? a : (i + t + r.length) % r.length] ?? null;
|
|
1316
1315
|
}
|
|
1317
1316
|
//#endregion
|
|
1318
1317
|
//#region lib/components/ui/widgets/editor/extensions/comments/comments-controller.ts
|
|
1319
|
-
var
|
|
1318
|
+
var _i = class {
|
|
1320
1319
|
host;
|
|
1321
1320
|
store;
|
|
1322
1321
|
stop;
|
|
@@ -1328,7 +1327,7 @@ var gi = class {
|
|
|
1328
1327
|
current;
|
|
1329
1328
|
core;
|
|
1330
1329
|
constructor(e, t = !1) {
|
|
1331
|
-
this.host = e, this.store =
|
|
1330
|
+
this.host = e, this.store = ft(br(t)), this.core = {
|
|
1332
1331
|
host: e,
|
|
1333
1332
|
get: () => this.state,
|
|
1334
1333
|
set: (e) => this.set(e),
|
|
@@ -1365,7 +1364,7 @@ var gi = class {
|
|
|
1365
1364
|
}
|
|
1366
1365
|
}), !e) return this.set({ phase: "ready" });
|
|
1367
1366
|
try {
|
|
1368
|
-
let t =
|
|
1367
|
+
let t = Jr(await e.list());
|
|
1369
1368
|
if (r()) return;
|
|
1370
1369
|
this.set({
|
|
1371
1370
|
phase: "ready",
|
|
@@ -1376,11 +1375,11 @@ var gi = class {
|
|
|
1376
1375
|
if (r()) return;
|
|
1377
1376
|
this.set({
|
|
1378
1377
|
phase: "failed",
|
|
1379
|
-
loadError:
|
|
1378
|
+
loadError: si(e)
|
|
1380
1379
|
});
|
|
1381
1380
|
}
|
|
1382
1381
|
let i = e.subscribe?.((e) => {
|
|
1383
|
-
r() || this.set({ threads:
|
|
1382
|
+
r() || this.set({ threads: Jr(e) });
|
|
1384
1383
|
});
|
|
1385
1384
|
r() ? i?.() : this.stop = i;
|
|
1386
1385
|
};
|
|
@@ -1392,7 +1391,7 @@ var gi = class {
|
|
|
1392
1391
|
};
|
|
1393
1392
|
sync = (e) => {
|
|
1394
1393
|
let { composer: t } = this.state, n = {}, r = this.host.collect();
|
|
1395
|
-
if (
|
|
1394
|
+
if (ai(r, this.state.anchors) || (n.anchors = r), t) {
|
|
1396
1395
|
let r = e(t.range.from, 1), i = Math.max(r, e(t.range.to, -1));
|
|
1397
1396
|
(r !== t.range.from || i !== t.range.to) && (n.composer = {
|
|
1398
1397
|
...t,
|
|
@@ -1415,7 +1414,7 @@ var gi = class {
|
|
|
1415
1414
|
this.set({ activeId: null }), this.rail || this.host.closePanel();
|
|
1416
1415
|
};
|
|
1417
1416
|
step = (e) => {
|
|
1418
|
-
let t =
|
|
1417
|
+
let t = gi(this.state, e);
|
|
1419
1418
|
return t ? (this.setActive(t), this.host.reveal(t), !0) : !1;
|
|
1420
1419
|
};
|
|
1421
1420
|
canComment = () => this.host.canComment() && !!this.host.adapter();
|
|
@@ -1434,11 +1433,11 @@ var gi = class {
|
|
|
1434
1433
|
closeComposer = () => {
|
|
1435
1434
|
this.state.composer?.pending || this.set({ composer: null });
|
|
1436
1435
|
};
|
|
1437
|
-
submitComposer = (e) =>
|
|
1438
|
-
reply = (e, t) =>
|
|
1439
|
-
resolve = (e, t) =>
|
|
1440
|
-
remove = (e) =>
|
|
1441
|
-
edit = (e, t, n) =>
|
|
1436
|
+
submitComposer = (e) => ui(this.core, e);
|
|
1437
|
+
reply = (e, t) => di(this.core, e, t);
|
|
1438
|
+
resolve = (e, t) => fi(this.core, e, t);
|
|
1439
|
+
remove = (e) => pi(this.core, e);
|
|
1440
|
+
edit = (e, t, n) => mi(this.core, e, t, n);
|
|
1442
1441
|
dismissError = (e) => {
|
|
1443
1442
|
let { [e]: t, ...n } = this.state.errors;
|
|
1444
1443
|
this.set({ errors: n });
|
|
@@ -1446,11 +1445,11 @@ var gi = class {
|
|
|
1446
1445
|
};
|
|
1447
1446
|
//#endregion
|
|
1448
1447
|
//#region lib/components/ui/widgets/editor/extensions/comments/use-thread-views.ts
|
|
1449
|
-
function
|
|
1450
|
-
let t =
|
|
1448
|
+
function vi(e) {
|
|
1449
|
+
let t = wr(e), n = Y(e), r = hi(t), { anchors: i } = t, a = U(() => {
|
|
1451
1450
|
let e = new Map(r.map((e) => [e.id, e]));
|
|
1452
1451
|
return {
|
|
1453
|
-
anchored:
|
|
1452
|
+
anchored: oi(i).flatMap((t) => e.get(t) ?? []),
|
|
1454
1453
|
detached: r.filter((e) => !i[e.id])
|
|
1455
1454
|
};
|
|
1456
1455
|
}, [r, i]), o = n?.options().adapter;
|
|
@@ -1466,17 +1465,17 @@ function _i(e) {
|
|
|
1466
1465
|
}
|
|
1467
1466
|
//#endregion
|
|
1468
1467
|
//#region lib/components/ui/widgets/editor/extensions/comments/comments-panel.tsx
|
|
1469
|
-
function
|
|
1468
|
+
function yi(e) {
|
|
1470
1469
|
let { handle: t, chrome: n } = k(), { editor: r } = t;
|
|
1471
|
-
return !r || !Y(r) ? null : /* @__PURE__ */ q(
|
|
1470
|
+
return !r || !Y(r) ? null : /* @__PURE__ */ q(jr, {
|
|
1472
1471
|
id: "comments",
|
|
1473
1472
|
className: "max-h-[min(36rem,80svh)] w-96 max-w-[92vw] overflow-y-auto p-3",
|
|
1474
1473
|
onEscapeKeyDown: () => r.commands.focus(),
|
|
1475
|
-
children: n.state.panel === "comments" && /* @__PURE__ */ q(
|
|
1474
|
+
children: n.state.panel === "comments" && /* @__PURE__ */ q(bi, { editor: r })
|
|
1476
1475
|
});
|
|
1477
1476
|
}
|
|
1478
|
-
function
|
|
1479
|
-
let { t } = j(), n =
|
|
1477
|
+
function bi({ editor: e }) {
|
|
1478
|
+
let { t } = j(), n = vi(e), { controller: r, state: i, anchored: a } = n, o = W(null);
|
|
1480
1479
|
if (H(() => {
|
|
1481
1480
|
o.current?.querySelector("[data-active]")?.scrollIntoView({ block: "nearest" });
|
|
1482
1481
|
}, [i.activeId]), !r) return null;
|
|
@@ -1485,7 +1484,7 @@ function yi({ editor: e }) {
|
|
|
1485
1484
|
"aria-label": t,
|
|
1486
1485
|
tooltip: t,
|
|
1487
1486
|
onClick: () => r.step(e),
|
|
1488
|
-
children: q(e > 0 ?
|
|
1487
|
+
children: q(e > 0 ? Mt : Ft, {})
|
|
1489
1488
|
});
|
|
1490
1489
|
return /* @__PURE__ */ J("div", {
|
|
1491
1490
|
ref: o,
|
|
@@ -1501,26 +1500,26 @@ function yi({ editor: e }) {
|
|
|
1501
1500
|
children: [s(-1, t("material.editor.comments.previous", "Previous comment")), s(1, t("material.editor.comments.next", "Next comment"))]
|
|
1502
1501
|
})]
|
|
1503
1502
|
}),
|
|
1504
|
-
/* @__PURE__ */ q(
|
|
1503
|
+
/* @__PURE__ */ q(Mr, {
|
|
1505
1504
|
state: i,
|
|
1506
1505
|
controller: r,
|
|
1507
1506
|
count: n.resolvedCount
|
|
1508
1507
|
}),
|
|
1509
|
-
/* @__PURE__ */ q(
|
|
1508
|
+
/* @__PURE__ */ q(Nr, {
|
|
1510
1509
|
state: i,
|
|
1511
1510
|
empty: i.threads.length === 0
|
|
1512
1511
|
}),
|
|
1513
|
-
a.map((e) => /* @__PURE__ */ q(
|
|
1514
|
-
...
|
|
1512
|
+
a.map((e) => /* @__PURE__ */ q(ti, {
|
|
1513
|
+
...ri(n, e),
|
|
1515
1514
|
active: i.activeId === e.id
|
|
1516
1515
|
}, e.id)),
|
|
1517
|
-
/* @__PURE__ */ q(
|
|
1516
|
+
/* @__PURE__ */ q(ni, { views: n })
|
|
1518
1517
|
]
|
|
1519
1518
|
});
|
|
1520
1519
|
}
|
|
1521
1520
|
//#endregion
|
|
1522
1521
|
//#region lib/components/ui/widgets/editor/extensions/comments/rail-layout.ts
|
|
1523
|
-
var
|
|
1522
|
+
var xi = (e, t, n, r) => {
|
|
1524
1523
|
let i = Object.create(null), a = n;
|
|
1525
1524
|
for (let n of e.slice(t)) {
|
|
1526
1525
|
let e = Math.max(n.top, a);
|
|
@@ -1528,18 +1527,18 @@ var bi = (e, t, n, r) => {
|
|
|
1528
1527
|
}
|
|
1529
1528
|
return i;
|
|
1530
1529
|
};
|
|
1531
|
-
function
|
|
1532
|
-
let r = [...e].sort((e, t) => e.top - t.top), i = r.findIndex((e) => e.id === n), a =
|
|
1530
|
+
function Si(e, t = 8, n) {
|
|
1531
|
+
let r = [...e].sort((e, t) => e.top - t.top), i = r.findIndex((e) => e.id === n), a = xi(r, 0, 0, t);
|
|
1533
1532
|
if (i <= 0) return a;
|
|
1534
1533
|
let o = r[i], s = Math.max(0, o.top), c = Object.create(null), l = s - t;
|
|
1535
1534
|
for (let e = i - 1; e >= 0; --e) {
|
|
1536
1535
|
let n = r[e], i = Math.min(n.top + n.height, l) - n.height;
|
|
1537
1536
|
c[n.id] = i, l = i - t;
|
|
1538
1537
|
}
|
|
1539
|
-
return l + t < 0 ? a : (c[o.id] = s, Object.assign(c,
|
|
1538
|
+
return l + t < 0 ? a : (c[o.id] = s, Object.assign(c, xi(r, i + 1, s + o.height + t, t)));
|
|
1540
1539
|
}
|
|
1541
|
-
var
|
|
1542
|
-
function
|
|
1540
|
+
var Ci = (e, t) => t.reduce((t, n) => Math.max(t, (e[n.id] ?? 0) + n.height), 0), wi = (e, t) => e.measured === t.measured && e.height === t.height && Object.keys(t.tops).length === Object.keys(e.tops).length && Object.entries(t.tops).every(([t, n]) => e.tops[t] === n);
|
|
1541
|
+
function Ti(e) {
|
|
1543
1542
|
let { editor: t, box: n, cards: r, items: i, activeId: a } = e;
|
|
1544
1543
|
if (!n || t.isDestroyed) return null;
|
|
1545
1544
|
let o = n.getBoundingClientRect().top, s = i.map((e) => {
|
|
@@ -1552,16 +1551,16 @@ function wi(e) {
|
|
|
1552
1551
|
top: n,
|
|
1553
1552
|
height: r.get(e.id)?.offsetHeight ?? 0
|
|
1554
1553
|
};
|
|
1555
|
-
}), c =
|
|
1554
|
+
}), c = Si(s, 8, a);
|
|
1556
1555
|
return {
|
|
1557
1556
|
tops: c,
|
|
1558
|
-
height:
|
|
1557
|
+
height: Ci(c, s),
|
|
1559
1558
|
measured: !0
|
|
1560
1559
|
};
|
|
1561
1560
|
}
|
|
1562
1561
|
//#endregion
|
|
1563
1562
|
//#region lib/components/ui/widgets/editor/extensions/comments/use-rail-observer.ts
|
|
1564
|
-
function
|
|
1563
|
+
function Ei(e, t, n) {
|
|
1565
1564
|
let r = W(null);
|
|
1566
1565
|
return H(() => {
|
|
1567
1566
|
if (typeof ResizeObserver > "u") return;
|
|
@@ -1582,7 +1581,7 @@ function Ti(e, t, n) {
|
|
|
1582
1581
|
}
|
|
1583
1582
|
//#endregion
|
|
1584
1583
|
//#region lib/components/ui/widgets/editor/extensions/comments/use-rail-layout.ts
|
|
1585
|
-
function
|
|
1584
|
+
function Di(e, t, n, r) {
|
|
1586
1585
|
let i = W(/* @__PURE__ */ new Map()), a = W(/* @__PURE__ */ new Map()), o = W(0), [s, c] = G({
|
|
1587
1586
|
tops: {},
|
|
1588
1587
|
height: 0,
|
|
@@ -1596,25 +1595,25 @@ function Ei(e, t, n, r) {
|
|
|
1596
1595
|
activeId: r
|
|
1597
1596
|
};
|
|
1598
1597
|
let u = n.map((e) => e.id).join(","), d = n.map((e) => e.from).join(","), f = V(() => {
|
|
1599
|
-
let { items: n, activeId: r } = l.current, a =
|
|
1598
|
+
let { items: n, activeId: r } = l.current, a = Ti({
|
|
1600
1599
|
editor: e,
|
|
1601
1600
|
box: t.current,
|
|
1602
1601
|
cards: i.current,
|
|
1603
1602
|
items: n,
|
|
1604
1603
|
activeId: r
|
|
1605
1604
|
});
|
|
1606
|
-
a && c((e) =>
|
|
1605
|
+
a && c((e) => wi(e, a) ? e : a);
|
|
1607
1606
|
}, [t, e]), p = V(() => {
|
|
1608
1607
|
o.current ||= requestAnimationFrame(() => {
|
|
1609
1608
|
o.current = 0, f();
|
|
1610
1609
|
});
|
|
1611
1610
|
}, [f]);
|
|
1612
|
-
|
|
1611
|
+
bn(f, [
|
|
1613
1612
|
u,
|
|
1614
1613
|
r,
|
|
1615
1614
|
f
|
|
1616
1615
|
]), H(p, [d, p]);
|
|
1617
|
-
let { observe: m, unobserve: h } =
|
|
1616
|
+
let { observe: m, unobserve: h } = Ei(e, i, p);
|
|
1618
1617
|
return H(() => () => {
|
|
1619
1618
|
cancelAnimationFrame(o.current), o.current = 0;
|
|
1620
1619
|
}, []), {
|
|
@@ -1630,12 +1629,12 @@ function Ei(e, t, n, r) {
|
|
|
1630
1629
|
}
|
|
1631
1630
|
//#endregion
|
|
1632
1631
|
//#region lib/components/ui/widgets/editor/extensions/comments/comments-rail.tsx
|
|
1633
|
-
function
|
|
1632
|
+
function Oi(e) {
|
|
1634
1633
|
let { handle: t } = k(), { editor: n } = t;
|
|
1635
|
-
return !n || !Y(n) ? null : /* @__PURE__ */ q(
|
|
1634
|
+
return !n || !Y(n) ? null : /* @__PURE__ */ q(ki, { editor: n });
|
|
1636
1635
|
}
|
|
1637
|
-
function
|
|
1638
|
-
let { t } = j(), n =
|
|
1636
|
+
function ki({ editor: e }) {
|
|
1637
|
+
let { t } = j(), n = vi(e), { controller: r, state: i, anchored: a } = n, o = W(null), { layout: s, cardRef: c } = Di(e, o, a.map((e) => ({
|
|
1639
1638
|
id: e.id,
|
|
1640
1639
|
from: i.anchors[e.id]?.from ?? 0
|
|
1641
1640
|
})), i.activeId);
|
|
@@ -1644,12 +1643,12 @@ function Oi({ editor: e }) {
|
|
|
1644
1643
|
"aria-label": t("material.editor.comments.threads", "Comment threads"),
|
|
1645
1644
|
className: "grid gap-3",
|
|
1646
1645
|
children: [
|
|
1647
|
-
/* @__PURE__ */ q(
|
|
1646
|
+
/* @__PURE__ */ q(Mr, {
|
|
1648
1647
|
state: i,
|
|
1649
1648
|
controller: r,
|
|
1650
1649
|
count: n.resolvedCount
|
|
1651
1650
|
}),
|
|
1652
|
-
/* @__PURE__ */ q(
|
|
1651
|
+
/* @__PURE__ */ q(Nr, {
|
|
1653
1652
|
state: i,
|
|
1654
1653
|
empty: i.threads.length === 0
|
|
1655
1654
|
}),
|
|
@@ -1657,8 +1656,8 @@ function Oi({ editor: e }) {
|
|
|
1657
1656
|
ref: o,
|
|
1658
1657
|
className: "relative",
|
|
1659
1658
|
style: { height: s.height },
|
|
1660
|
-
children: a.map((e) => /* @__PURE__ */ q(
|
|
1661
|
-
...
|
|
1659
|
+
children: a.map((e) => /* @__PURE__ */ q(ti, {
|
|
1660
|
+
...ri(n, e),
|
|
1662
1661
|
active: i.activeId === e.id,
|
|
1663
1662
|
cardRef: c(e.id),
|
|
1664
1663
|
className: "absolute inset-x-0",
|
|
@@ -1668,13 +1667,13 @@ function Oi({ editor: e }) {
|
|
|
1668
1667
|
}
|
|
1669
1668
|
}, e.id))
|
|
1670
1669
|
}),
|
|
1671
|
-
/* @__PURE__ */ q(
|
|
1670
|
+
/* @__PURE__ */ q(ni, { views: n })
|
|
1672
1671
|
]
|
|
1673
1672
|
}) : null;
|
|
1674
1673
|
}
|
|
1675
1674
|
//#endregion
|
|
1676
1675
|
//#region lib/components/ui/widgets/editor/extensions/block/block-add.ts
|
|
1677
|
-
function
|
|
1676
|
+
function Ai(e, t) {
|
|
1678
1677
|
let n = t.pos + t.node.nodeSize, r = e.extensionManager.extensions.some((e) => e.name === "slashCommand");
|
|
1679
1678
|
e.chain().insertContentAt(n, {
|
|
1680
1679
|
type: "paragraph",
|
|
@@ -1686,8 +1685,8 @@ function ki(e, t) {
|
|
|
1686
1685
|
}
|
|
1687
1686
|
//#endregion
|
|
1688
1687
|
//#region lib/components/ui/widgets/editor/extensions/block/block-drag.ts
|
|
1689
|
-
function
|
|
1690
|
-
let { view: r } = e, i =
|
|
1688
|
+
function ji(e, t, n) {
|
|
1689
|
+
let { view: r } = e, i = ut.create(r.state.doc, t.pos);
|
|
1691
1690
|
r.dispatch(r.state.tr.setSelection(i)), r.dragging = {
|
|
1692
1691
|
slice: i.content(),
|
|
1693
1692
|
move: !0
|
|
@@ -1700,12 +1699,12 @@ function Ai(e, t, n) {
|
|
|
1700
1699
|
}
|
|
1701
1700
|
//#endregion
|
|
1702
1701
|
//#region lib/components/ui/widgets/editor/extensions/block/block-menu-items.ts
|
|
1703
|
-
var
|
|
1702
|
+
var Mi = (e) => (t) => t.chain().focus().setHeading({ level: e }).run(), Ni = [
|
|
1704
1703
|
{
|
|
1705
1704
|
id: "paragraph",
|
|
1706
1705
|
label: "Paragraph",
|
|
1707
1706
|
key: "material.editor.block.paragraph",
|
|
1708
|
-
icon:
|
|
1707
|
+
icon: $t,
|
|
1709
1708
|
node: "paragraph",
|
|
1710
1709
|
run: (e) => e.chain().focus().setParagraph().run()
|
|
1711
1710
|
},
|
|
@@ -1713,31 +1712,31 @@ var ji = (e) => (t) => t.chain().focus().setHeading({ level: e }).run(), Mi = [
|
|
|
1713
1712
|
id: "h1",
|
|
1714
1713
|
label: "Heading 1",
|
|
1715
1714
|
key: "material.editor.block.heading-1",
|
|
1716
|
-
icon:
|
|
1715
|
+
icon: Ht,
|
|
1717
1716
|
node: "heading",
|
|
1718
|
-
run:
|
|
1717
|
+
run: Mi(1)
|
|
1719
1718
|
},
|
|
1720
1719
|
{
|
|
1721
1720
|
id: "h2",
|
|
1722
1721
|
label: "Heading 2",
|
|
1723
1722
|
key: "material.editor.block.heading-2",
|
|
1724
|
-
icon:
|
|
1723
|
+
icon: Ut,
|
|
1725
1724
|
node: "heading",
|
|
1726
|
-
run:
|
|
1725
|
+
run: Mi(2)
|
|
1727
1726
|
},
|
|
1728
1727
|
{
|
|
1729
1728
|
id: "h3",
|
|
1730
1729
|
label: "Heading 3",
|
|
1731
1730
|
key: "material.editor.block.heading-3",
|
|
1732
|
-
icon:
|
|
1731
|
+
icon: Wt,
|
|
1733
1732
|
node: "heading",
|
|
1734
|
-
run:
|
|
1733
|
+
run: Mi(3)
|
|
1735
1734
|
},
|
|
1736
1735
|
{
|
|
1737
1736
|
id: "bullet",
|
|
1738
1737
|
label: "Bulleted list",
|
|
1739
1738
|
key: "material.editor.block.bullet-list",
|
|
1740
|
-
icon:
|
|
1739
|
+
icon: Kt,
|
|
1741
1740
|
node: "bulletList",
|
|
1742
1741
|
run: (e) => e.chain().focus().toggleBulletList().run()
|
|
1743
1742
|
},
|
|
@@ -1745,7 +1744,7 @@ var ji = (e) => (t) => t.chain().focus().setHeading({ level: e }).run(), Mi = [
|
|
|
1745
1744
|
id: "ordered",
|
|
1746
1745
|
label: "Numbered list",
|
|
1747
1746
|
key: "material.editor.block.ordered-list",
|
|
1748
|
-
icon:
|
|
1747
|
+
icon: qt,
|
|
1749
1748
|
node: "orderedList",
|
|
1750
1749
|
run: (e) => e.chain().focus().toggleOrderedList().run()
|
|
1751
1750
|
},
|
|
@@ -1753,17 +1752,17 @@ var ji = (e) => (t) => t.chain().focus().setHeading({ level: e }).run(), Mi = [
|
|
|
1753
1752
|
id: "quote",
|
|
1754
1753
|
label: "Quote",
|
|
1755
1754
|
key: "material.editor.block.quote",
|
|
1756
|
-
icon:
|
|
1755
|
+
icon: tn,
|
|
1757
1756
|
node: "blockquote",
|
|
1758
1757
|
run: (e) => e.chain().focus().toggleBlockquote().run()
|
|
1759
1758
|
}
|
|
1760
|
-
],
|
|
1759
|
+
], Pi = (e) => {
|
|
1761
1760
|
let t = e.schema.nodes;
|
|
1762
|
-
return
|
|
1761
|
+
return Ni.filter((e) => e.node in t);
|
|
1763
1762
|
};
|
|
1764
1763
|
//#endregion
|
|
1765
1764
|
//#region lib/components/ui/widgets/editor/extensions/block/block-ops.ts
|
|
1766
|
-
function
|
|
1765
|
+
function Fi(e, t) {
|
|
1767
1766
|
if (t < 0 || t > e.content.size) return null;
|
|
1768
1767
|
let n = 0;
|
|
1769
1768
|
for (let r = 0; r < e.childCount; r++) {
|
|
@@ -1777,30 +1776,30 @@ function Pi(e, t) {
|
|
|
1777
1776
|
}
|
|
1778
1777
|
return null;
|
|
1779
1778
|
}
|
|
1780
|
-
var
|
|
1781
|
-
function
|
|
1782
|
-
let n = t.node.isAtom ?
|
|
1779
|
+
var Ii = (e) => Fi(e.doc, e.selection.head);
|
|
1780
|
+
function Li(e, t) {
|
|
1781
|
+
let n = t.node.isAtom ? ut.create(e.doc, t.pos) : z.near(e.doc.resolve(t.pos + 1));
|
|
1783
1782
|
return e.setSelection(n);
|
|
1784
1783
|
}
|
|
1785
|
-
function
|
|
1784
|
+
function Ri(e, t, n = Ii(e)) {
|
|
1786
1785
|
if (!n) return null;
|
|
1787
1786
|
let r = e.doc.maybeChild(n.index + t);
|
|
1788
1787
|
if (!r) return null;
|
|
1789
1788
|
let { tr: i } = e, a = e.selection.head, o = e.selection.anchor, s = t === 1 ? n.pos : n.pos - r.nodeSize, c = t === 1 ? n.pos + n.node.nodeSize + r.nodeSize : n.pos + n.node.nodeSize, l = t === 1 ? [r, n.node] : [n.node, r];
|
|
1790
1789
|
i.replaceWith(s, c, l);
|
|
1791
1790
|
let u = t === 1 ? r.nodeSize : -r.nodeSize;
|
|
1792
|
-
return a >= n.pos && a <= n.pos + n.node.nodeSize && e.selection instanceof z ? i.setSelection(z.create(i.doc, o + u, a + u)) : e.selection instanceof
|
|
1791
|
+
return a >= n.pos && a <= n.pos + n.node.nodeSize && e.selection instanceof z ? i.setSelection(z.create(i.doc, o + u, a + u)) : e.selection instanceof ut && i.setSelection(ut.create(i.doc, n.pos + u)), i.scrollIntoView();
|
|
1793
1792
|
}
|
|
1794
|
-
function
|
|
1793
|
+
function zi(e, t = Ii(e)) {
|
|
1795
1794
|
if (!t) return null;
|
|
1796
1795
|
let n = t.pos + t.node.nodeSize, { tr: r } = e;
|
|
1797
|
-
return r.insert(n, t.node.copy(t.node.content)),
|
|
1796
|
+
return r.insert(n, t.node.copy(t.node.content)), Li(r, {
|
|
1798
1797
|
...t,
|
|
1799
1798
|
index: t.index + 1,
|
|
1800
1799
|
pos: n
|
|
1801
1800
|
}).scrollIntoView();
|
|
1802
1801
|
}
|
|
1803
|
-
function
|
|
1802
|
+
function Bi(e, t = Ii(e)) {
|
|
1804
1803
|
if (!t) return null;
|
|
1805
1804
|
let { tr: n } = e, r = t.pos + t.node.nodeSize;
|
|
1806
1805
|
if (e.doc.childCount === 1) {
|
|
@@ -1813,40 +1812,40 @@ function zi(e, t = Fi(e)) {
|
|
|
1813
1812
|
}
|
|
1814
1813
|
//#endregion
|
|
1815
1814
|
//#region lib/components/ui/widgets/editor/extensions/block/block-menu.tsx
|
|
1816
|
-
function
|
|
1815
|
+
function Vi(e, t) {
|
|
1817
1816
|
let n = t();
|
|
1818
1817
|
n && e.view.dispatch(n), e.isDestroyed || e.commands.focus();
|
|
1819
1818
|
}
|
|
1820
|
-
function
|
|
1819
|
+
function Hi({ editor: e, block: t }) {
|
|
1821
1820
|
let { t: n } = j(), { doc: r } = e.state, i = () => ({
|
|
1822
1821
|
...t,
|
|
1823
1822
|
node: r.child(t.index)
|
|
1824
1823
|
});
|
|
1825
1824
|
return /* @__PURE__ */ J(K, { children: [
|
|
1826
|
-
/* @__PURE__ */ J(We, { children: [/* @__PURE__ */ q(Ve, { children: n("material.editor.block.turn-into", "Turn into") }),
|
|
1825
|
+
/* @__PURE__ */ J(We, { children: [/* @__PURE__ */ q(Ve, { children: n("material.editor.block.turn-into", "Turn into") }), Pi(e).map((t) => /* @__PURE__ */ J(A, {
|
|
1827
1826
|
onSelect: () => t.run(e),
|
|
1828
1827
|
children: [/* @__PURE__ */ q(t.icon, {}), n(t.key, t.label)]
|
|
1829
1828
|
}, t.id))] }),
|
|
1830
1829
|
/* @__PURE__ */ q(Ue, {}),
|
|
1831
1830
|
/* @__PURE__ */ J(We, { children: [
|
|
1832
1831
|
/* @__PURE__ */ J(A, {
|
|
1833
|
-
onSelect: () =>
|
|
1834
|
-
children: [/* @__PURE__ */ q(
|
|
1832
|
+
onSelect: () => Vi(e, () => zi(e.state, i())),
|
|
1833
|
+
children: [/* @__PURE__ */ q(Lt, {}), n("material.editor.block.duplicate", "Duplicate")]
|
|
1835
1834
|
}),
|
|
1836
1835
|
/* @__PURE__ */ J(A, {
|
|
1837
1836
|
disabled: t.index === 0,
|
|
1838
|
-
onSelect: () =>
|
|
1837
|
+
onSelect: () => Vi(e, () => Ri(e.state, -1, i())),
|
|
1839
1838
|
children: [
|
|
1840
|
-
/* @__PURE__ */ q(
|
|
1839
|
+
/* @__PURE__ */ q(Ot, {}),
|
|
1841
1840
|
n("material.editor.block.move-up", "Move up"),
|
|
1842
1841
|
/* @__PURE__ */ q(Ge, { children: "⌥⇧↑" })
|
|
1843
1842
|
]
|
|
1844
1843
|
}),
|
|
1845
1844
|
/* @__PURE__ */ J(A, {
|
|
1846
1845
|
disabled: t.index >= r.childCount - 1,
|
|
1847
|
-
onSelect: () =>
|
|
1846
|
+
onSelect: () => Vi(e, () => Ri(e.state, 1, i())),
|
|
1848
1847
|
children: [
|
|
1849
|
-
/* @__PURE__ */ q(
|
|
1848
|
+
/* @__PURE__ */ q(Dt, {}),
|
|
1850
1849
|
n("material.editor.block.move-down", "Move down"),
|
|
1851
1850
|
/* @__PURE__ */ q(Ge, { children: "⌥⇧↓" })
|
|
1852
1851
|
]
|
|
@@ -1855,18 +1854,18 @@ function Vi({ editor: e, block: t }) {
|
|
|
1855
1854
|
/* @__PURE__ */ q(Ue, {}),
|
|
1856
1855
|
/* @__PURE__ */ J(A, {
|
|
1857
1856
|
variant: "error",
|
|
1858
|
-
onSelect: () =>
|
|
1859
|
-
children: [/* @__PURE__ */ q(
|
|
1857
|
+
onSelect: () => Vi(e, () => Bi(e.state, i())),
|
|
1858
|
+
children: [/* @__PURE__ */ q(pn, {}), n("material.editor.block.delete", "Delete")]
|
|
1860
1859
|
})
|
|
1861
1860
|
] });
|
|
1862
1861
|
}
|
|
1863
1862
|
//#endregion
|
|
1864
1863
|
//#region lib/components/ui/widgets/editor/extensions/block/use-active-block.ts
|
|
1865
|
-
function
|
|
1864
|
+
function Ui(e, t, n) {
|
|
1866
1865
|
let [r, i] = G(null), [a, o] = G(null), s = V(() => {
|
|
1867
1866
|
let n = t.current;
|
|
1868
1867
|
if (!n) return;
|
|
1869
|
-
let { doc: i } = e.state, a = r === null ?
|
|
1868
|
+
let { doc: i } = e.state, a = r === null ? Ii(e.state) : Fi(i, Math.min(r, i.content.size)), s = a ? e.view.nodeDOM(a.pos) : null;
|
|
1870
1869
|
if (!a || !(s instanceof HTMLElement)) return o(null);
|
|
1871
1870
|
let c = s.getBoundingClientRect().top - n.getBoundingClientRect().top;
|
|
1872
1871
|
o((e) => e && e.pos === a.pos && e.top === c && e.node === a.node ? e : {
|
|
@@ -1914,36 +1913,36 @@ function Hi(e, t, n) {
|
|
|
1914
1913
|
}
|
|
1915
1914
|
//#endregion
|
|
1916
1915
|
//#region lib/components/ui/widgets/editor/partials/editor-block-handle.tsx
|
|
1917
|
-
function
|
|
1916
|
+
function Wi({ children: e, className: t }) {
|
|
1918
1917
|
let { handle: n } = k(), r = n.features.some((e) => e.key === "dragHandle");
|
|
1919
1918
|
return !n.editor || !r ? /* @__PURE__ */ q("div", {
|
|
1920
1919
|
className: t,
|
|
1921
1920
|
children: e
|
|
1922
|
-
}) : /* @__PURE__ */ q(
|
|
1921
|
+
}) : /* @__PURE__ */ q(Gi, {
|
|
1923
1922
|
editor: n.editor,
|
|
1924
1923
|
className: t,
|
|
1925
1924
|
children: e
|
|
1926
1925
|
});
|
|
1927
1926
|
}
|
|
1928
|
-
function
|
|
1927
|
+
function Gi({ editor: e, children: n, className: r }) {
|
|
1929
1928
|
let { chrome: i } = k(), a = W(null), o = P({
|
|
1930
1929
|
editor: e,
|
|
1931
1930
|
selector: (e) => e.editor.isEditable
|
|
1932
|
-
}), s = i.state.panel === "block" && o, { active: c, hover: l, unhover: u } =
|
|
1931
|
+
}), s = i.state.panel === "block" && o, { active: c, hover: l, unhover: u } = Ui(e, a, s);
|
|
1933
1932
|
return /* @__PURE__ */ J("div", {
|
|
1934
1933
|
ref: a,
|
|
1935
1934
|
"data-slot": "editor-block-area",
|
|
1936
1935
|
onPointerMove: (e) => l(e.clientX, e.clientY),
|
|
1937
1936
|
onPointerLeave: u,
|
|
1938
1937
|
className: t("group/blocks relative", r),
|
|
1939
|
-
children: [n, o && c && !i.state.focusMode && /* @__PURE__ */ q(
|
|
1938
|
+
children: [n, o && c && !i.state.focusMode && /* @__PURE__ */ q(Ki, {
|
|
1940
1939
|
editor: e,
|
|
1941
1940
|
active: c,
|
|
1942
1941
|
open: s
|
|
1943
1942
|
})]
|
|
1944
1943
|
});
|
|
1945
1944
|
}
|
|
1946
|
-
function
|
|
1945
|
+
function Ki({ editor: e, active: n, open: r }) {
|
|
1947
1946
|
let { t: i } = j(), { chrome: a } = k();
|
|
1948
1947
|
return /* @__PURE__ */ J("div", {
|
|
1949
1948
|
"data-slot": "editor-block-handle",
|
|
@@ -1954,8 +1953,8 @@ function Gi({ editor: e, active: n, open: r }) {
|
|
|
1954
1953
|
variant: "ghost",
|
|
1955
1954
|
className: "size-6 text-muted-foreground",
|
|
1956
1955
|
tooltip: i("material.editor.block.add", "Add a block below"),
|
|
1957
|
-
onClick: () =>
|
|
1958
|
-
children: /* @__PURE__ */ q(
|
|
1956
|
+
onClick: () => Ai(e, n),
|
|
1957
|
+
children: /* @__PURE__ */ q(en, {})
|
|
1959
1958
|
}), /* @__PURE__ */ J(Ke, {
|
|
1960
1959
|
open: r,
|
|
1961
1960
|
onOpenChange: (e) => e ? a.actions.openPanel("block") : a.actions.closePanel(),
|
|
@@ -1970,17 +1969,17 @@ function Gi({ editor: e, active: n, open: r }) {
|
|
|
1970
1969
|
onPointerDown: (e) => e.preventDefault(),
|
|
1971
1970
|
onClick: () => {
|
|
1972
1971
|
if (r) return a.actions.closePanel();
|
|
1973
|
-
|
|
1972
|
+
Ii(e.state)?.pos !== n.pos && e.view.dispatch(Li(e.state.tr, n)), a.actions.openPanel("block");
|
|
1974
1973
|
},
|
|
1975
|
-
onDragStart: (t) =>
|
|
1976
|
-
children: /* @__PURE__ */ q(
|
|
1974
|
+
onDragStart: (t) => ji(e, n, t.nativeEvent),
|
|
1975
|
+
children: /* @__PURE__ */ q(Vt, {})
|
|
1977
1976
|
})
|
|
1978
1977
|
}), /* @__PURE__ */ q(He, {
|
|
1979
1978
|
align: "start",
|
|
1980
1979
|
onCloseAutoFocus: (t) => {
|
|
1981
1980
|
t.preventDefault(), e.isDestroyed || e.commands.focus();
|
|
1982
1981
|
},
|
|
1983
|
-
children: /* @__PURE__ */ q(
|
|
1982
|
+
children: /* @__PURE__ */ q(Hi, {
|
|
1984
1983
|
editor: e,
|
|
1985
1984
|
block: n
|
|
1986
1985
|
})
|
|
@@ -1990,7 +1989,7 @@ function Gi({ editor: e, active: n, open: r }) {
|
|
|
1990
1989
|
}
|
|
1991
1990
|
//#endregion
|
|
1992
1991
|
//#region lib/components/ui/widgets/editor/extensions/find/find-fields.tsx
|
|
1993
|
-
function
|
|
1992
|
+
function qi({ find: e }) {
|
|
1994
1993
|
let { t } = j(), n = "";
|
|
1995
1994
|
return e.term && (n = e.total === 0 ? t("material.editor.find.none", "No results") : t("material.editor.find.count", "{current} of {total}", {
|
|
1996
1995
|
current: e.current + 1,
|
|
@@ -2002,23 +2001,23 @@ function Ki({ find: e }) {
|
|
|
2002
2001
|
children: n
|
|
2003
2002
|
});
|
|
2004
2003
|
}
|
|
2005
|
-
function
|
|
2004
|
+
function Ji({ find: e }) {
|
|
2006
2005
|
let { t } = j();
|
|
2007
2006
|
return /* @__PURE__ */ J(K, { children: [/* @__PURE__ */ q(me, {
|
|
2008
2007
|
size: "sm",
|
|
2009
2008
|
"aria-label": t("material.editor.find.match-case", "Match case"),
|
|
2010
2009
|
pressed: e.caseSensitive,
|
|
2011
2010
|
onPressedChange: e.setCaseSensitive,
|
|
2012
|
-
children: /* @__PURE__ */ q(
|
|
2011
|
+
children: /* @__PURE__ */ q(At, {})
|
|
2013
2012
|
}), /* @__PURE__ */ q(me, {
|
|
2014
2013
|
size: "sm",
|
|
2015
2014
|
"aria-label": t("material.editor.find.whole-word", "Whole word"),
|
|
2016
2015
|
pressed: e.wholeWord,
|
|
2017
2016
|
onPressedChange: e.setWholeWord,
|
|
2018
|
-
children: /* @__PURE__ */ q(
|
|
2017
|
+
children: /* @__PURE__ */ q(hn, {})
|
|
2019
2018
|
})] });
|
|
2020
2019
|
}
|
|
2021
|
-
function
|
|
2020
|
+
function Yi({ disabled: e, onStep: t }) {
|
|
2022
2021
|
let { t: n } = j();
|
|
2023
2022
|
return /* @__PURE__ */ J(K, { children: [/* @__PURE__ */ q(N, {
|
|
2024
2023
|
variant: "ghost",
|
|
@@ -2026,17 +2025,17 @@ function Ji({ disabled: e, onStep: t }) {
|
|
|
2026
2025
|
tooltip: n("material.editor.find.previous", "Previous match"),
|
|
2027
2026
|
disabled: e,
|
|
2028
2027
|
onClick: () => t(-1),
|
|
2029
|
-
children: /* @__PURE__ */ q(
|
|
2028
|
+
children: /* @__PURE__ */ q(Ft, {})
|
|
2030
2029
|
}), /* @__PURE__ */ q(N, {
|
|
2031
2030
|
variant: "ghost",
|
|
2032
2031
|
className: "size-8",
|
|
2033
2032
|
tooltip: n("material.editor.find.next", "Next match"),
|
|
2034
2033
|
disabled: e,
|
|
2035
2034
|
onClick: () => t(1),
|
|
2036
|
-
children: /* @__PURE__ */ q(
|
|
2035
|
+
children: /* @__PURE__ */ q(Mt, {})
|
|
2037
2036
|
})] });
|
|
2038
2037
|
}
|
|
2039
|
-
function
|
|
2038
|
+
function Xi({ find: e, inputRef: t, onStep: n, onClose: r, onKeyDown: i, replaceOpen: a, canReplace: o = !0, onToggleReplace: s }) {
|
|
2040
2039
|
let { t: c } = j();
|
|
2041
2040
|
return /* @__PURE__ */ J("div", {
|
|
2042
2041
|
className: "flex flex-wrap items-center gap-1.5",
|
|
@@ -2051,17 +2050,17 @@ function Yi({ find: e, inputRef: t, onStep: n, onClose: r, onKeyDown: i, replace
|
|
|
2051
2050
|
onKeyDown: i,
|
|
2052
2051
|
className: "h-8 min-w-0 flex-1 basis-40 sm:max-w-64"
|
|
2053
2052
|
}),
|
|
2054
|
-
/* @__PURE__ */ q(
|
|
2053
|
+
/* @__PURE__ */ q(Ji, { find: e }),
|
|
2055
2054
|
o && /* @__PURE__ */ q(N, {
|
|
2056
2055
|
variant: "ghost",
|
|
2057
2056
|
className: "size-8",
|
|
2058
2057
|
"aria-pressed": a,
|
|
2059
2058
|
tooltip: c("material.editor.find.show-replace", "Show replace"),
|
|
2060
2059
|
onClick: s,
|
|
2061
|
-
children: /* @__PURE__ */ q(
|
|
2060
|
+
children: /* @__PURE__ */ q(nn, {})
|
|
2062
2061
|
}),
|
|
2063
|
-
/* @__PURE__ */ q(
|
|
2064
|
-
/* @__PURE__ */ q(
|
|
2062
|
+
/* @__PURE__ */ q(qi, { find: e }),
|
|
2063
|
+
/* @__PURE__ */ q(Yi, {
|
|
2065
2064
|
disabled: e.total === 0,
|
|
2066
2065
|
onStep: n
|
|
2067
2066
|
}),
|
|
@@ -2070,78 +2069,78 @@ function Yi({ find: e, inputRef: t, onStep: n, onClose: r, onKeyDown: i, replace
|
|
|
2070
2069
|
className: "ms-auto size-8",
|
|
2071
2070
|
tooltip: c("material.editor.find.close", "Close"),
|
|
2072
2071
|
onClick: r,
|
|
2073
|
-
children: /* @__PURE__ */ q(
|
|
2072
|
+
children: /* @__PURE__ */ q(gn, {})
|
|
2074
2073
|
})
|
|
2075
2074
|
]
|
|
2076
2075
|
});
|
|
2077
2076
|
}
|
|
2078
2077
|
//#endregion
|
|
2079
2078
|
//#region lib/components/ui/widgets/editor/extensions/find/find-matches.ts
|
|
2080
|
-
var
|
|
2079
|
+
var Zi = {
|
|
2081
2080
|
caseSensitive: !1,
|
|
2082
2081
|
wholeWord: !1
|
|
2083
|
-
},
|
|
2082
|
+
}, Qi = /[\p{L}\p{N}_]/u, $i = (e) => e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), ea = (e, t) => {
|
|
2084
2083
|
let n = e.codePointAt(t);
|
|
2085
|
-
return n !== void 0 &&
|
|
2084
|
+
return n !== void 0 && Qi.test(String.fromCodePoint(n));
|
|
2086
2085
|
};
|
|
2087
|
-
function
|
|
2086
|
+
function ta(e, t, n) {
|
|
2088
2087
|
let r = [...t > 0 ? e.slice(Math.max(0, t - 2), t) : ""].pop();
|
|
2089
|
-
return !(r !== void 0 &&
|
|
2088
|
+
return !(r !== void 0 && Qi.test(r)) && !ea(e, n);
|
|
2090
2089
|
}
|
|
2091
|
-
function
|
|
2090
|
+
function na(e, t, n = Zi) {
|
|
2092
2091
|
if (!t) return [];
|
|
2093
|
-
let r = n.caseSensitive ? "gu" : "giu", i = new RegExp(
|
|
2092
|
+
let r = n.caseSensitive ? "gu" : "giu", i = new RegExp($i(t), r), a = [];
|
|
2094
2093
|
for (let t of e) for (let e of t.text.matchAll(i)) {
|
|
2095
2094
|
let r = e.index ?? 0, i = r + e[0].length;
|
|
2096
|
-
n.wholeWord && !
|
|
2095
|
+
n.wholeWord && !ta(t.text, r, i) || a.push({
|
|
2097
2096
|
from: t.pos + r,
|
|
2098
2097
|
to: t.pos + i
|
|
2099
2098
|
});
|
|
2100
2099
|
}
|
|
2101
2100
|
return a;
|
|
2102
2101
|
}
|
|
2103
|
-
function
|
|
2102
|
+
function ra(e, t) {
|
|
2104
2103
|
if (e.length === 0) return -1;
|
|
2105
2104
|
let n = e.findIndex((e) => e.from >= t);
|
|
2106
2105
|
return n === -1 ? 0 : n;
|
|
2107
2106
|
}
|
|
2108
|
-
function
|
|
2107
|
+
function ia(e, t, n) {
|
|
2109
2108
|
return e <= 0 ? -1 : t < 0 ? n === 1 ? 0 : e - 1 : (t + n + e) % e;
|
|
2110
2109
|
}
|
|
2111
2110
|
//#endregion
|
|
2112
2111
|
//#region lib/components/ui/widgets/editor/extensions/find/find-state.ts
|
|
2113
|
-
var X = new
|
|
2114
|
-
function
|
|
2112
|
+
var X = new lt("nxgtFind"), aa = "";
|
|
2113
|
+
function oa(e) {
|
|
2115
2114
|
let t = [];
|
|
2116
2115
|
return e.descendants((e, n) => e.isTextblock ? (t.push({
|
|
2117
2116
|
pos: n + 1,
|
|
2118
|
-
text: e.textBetween(0, e.content.size, void 0,
|
|
2117
|
+
text: e.textBetween(0, e.content.size, void 0, aa)
|
|
2119
2118
|
}), !1) : !0), t;
|
|
2120
2119
|
}
|
|
2121
|
-
function
|
|
2120
|
+
function sa(e, t) {
|
|
2122
2121
|
return I.create(e, t.map((e) => L.inline(e.from, e.to, { class: "nxgt-find-match" })));
|
|
2123
2122
|
}
|
|
2124
|
-
function
|
|
2123
|
+
function ca(e, t) {
|
|
2125
2124
|
let n = t.matches[t.current];
|
|
2126
2125
|
return n ? I.create(e, [L.inline(n.from, n.to, { class: "nxgt-find-current" })]) : I.empty;
|
|
2127
2126
|
}
|
|
2128
|
-
var
|
|
2129
|
-
...
|
|
2127
|
+
var la = () => ({
|
|
2128
|
+
...Zi,
|
|
2130
2129
|
term: "",
|
|
2131
2130
|
matches: [],
|
|
2132
2131
|
current: -1,
|
|
2133
2132
|
decorations: I.empty
|
|
2134
2133
|
});
|
|
2135
|
-
function
|
|
2136
|
-
let r =
|
|
2134
|
+
function ua(e, t, n) {
|
|
2135
|
+
let r = na(oa(e), t.term, t);
|
|
2137
2136
|
return {
|
|
2138
2137
|
...t,
|
|
2139
2138
|
matches: r,
|
|
2140
|
-
current:
|
|
2141
|
-
decorations:
|
|
2139
|
+
current: ra(r, n),
|
|
2140
|
+
decorations: sa(e, r)
|
|
2142
2141
|
};
|
|
2143
2142
|
}
|
|
2144
|
-
function
|
|
2143
|
+
function da(e) {
|
|
2145
2144
|
let t = [];
|
|
2146
2145
|
e.mapping.maps.forEach((n, r) => {
|
|
2147
2146
|
let i = e.mapping.slice(r + 1);
|
|
@@ -2168,8 +2167,8 @@ function ua(e) {
|
|
|
2168
2167
|
}
|
|
2169
2168
|
return r;
|
|
2170
2169
|
}
|
|
2171
|
-
function
|
|
2172
|
-
let r =
|
|
2170
|
+
function fa(e, t, n) {
|
|
2171
|
+
let r = da(e);
|
|
2173
2172
|
n && (n.blocks = 0);
|
|
2174
2173
|
let i = (e) => r.some((t) => e.from >= t.from && e.to <= t.to), a = [];
|
|
2175
2174
|
for (let n of t.matches) {
|
|
@@ -2188,12 +2187,12 @@ function da(e, t, n) {
|
|
|
2188
2187
|
let r = [];
|
|
2189
2188
|
e.doc.nodesBetween(i.from, i.to, (e, t) => !e.isTextblock || t < i.from || t >= i.to ? !0 : (r.push({
|
|
2190
2189
|
pos: t + 1,
|
|
2191
|
-
text: e.textBetween(0, e.content.size, void 0,
|
|
2192
|
-
}), !1)), n && (n.blocks += r.length), s.push(...
|
|
2190
|
+
text: e.textBetween(0, e.content.size, void 0, aa)
|
|
2191
|
+
}), !1)), n && (n.blocks += r.length), s.push(...na(r, t.term, t));
|
|
2193
2192
|
}
|
|
2194
2193
|
let c = [...a, ...s].sort((e, t) => e.from - t.from);
|
|
2195
2194
|
s.length > 0 && (o = o.add(e.doc, s.map((e) => L.inline(e.from, e.to, { class: "nxgt-find-match" }))));
|
|
2196
|
-
let l = t.current >= 0 && t.matches.length === c.length ? Math.min(t.current, c.length - 1) :
|
|
2195
|
+
let l = t.current >= 0 && t.matches.length === c.length ? Math.min(t.current, c.length - 1) : ra(c, e.selection.from);
|
|
2197
2196
|
return {
|
|
2198
2197
|
...t,
|
|
2199
2198
|
matches: c,
|
|
@@ -2201,20 +2200,20 @@ function da(e, t, n) {
|
|
|
2201
2200
|
decorations: o
|
|
2202
2201
|
};
|
|
2203
2202
|
}
|
|
2204
|
-
var
|
|
2203
|
+
var pa = (e) => X.getState(e) ?? la();
|
|
2205
2204
|
//#endregion
|
|
2206
2205
|
//#region lib/components/ui/widgets/editor/extensions/find/use-find.ts
|
|
2207
|
-
function
|
|
2206
|
+
function ma(e) {
|
|
2208
2207
|
let { from: t, to: n, empty: r } = e.state.selection;
|
|
2209
2208
|
if (r || n - t > 80) return "";
|
|
2210
2209
|
let i = e.state.doc.textBetween(t, n, " ");
|
|
2211
2210
|
return /\n/.test(i) ? "" : i;
|
|
2212
2211
|
}
|
|
2213
|
-
function
|
|
2214
|
-
let [t, n] = G(() =>
|
|
2212
|
+
function ha(e) {
|
|
2213
|
+
let [t, n] = G(() => ma(e)), [r, i] = G(!1), [a, o] = G(!1), s = P({
|
|
2215
2214
|
editor: e,
|
|
2216
2215
|
selector: ({ editor: e }) => {
|
|
2217
|
-
let { matches: t, current: n } =
|
|
2216
|
+
let { matches: t, current: n } = pa(e.state);
|
|
2218
2217
|
return {
|
|
2219
2218
|
total: t.length,
|
|
2220
2219
|
current: n
|
|
@@ -2247,12 +2246,12 @@ function ma(e) {
|
|
|
2247
2246
|
}
|
|
2248
2247
|
//#endregion
|
|
2249
2248
|
//#region lib/components/ui/widgets/editor/partials/editor-find-panel.tsx
|
|
2250
|
-
function
|
|
2249
|
+
function ga({ className: e }) {
|
|
2251
2250
|
let { handle: t, chrome: n } = k(), { editor: r } = t, i = n.state.panel === "find", a = t.features.some((e) => e.key === "find");
|
|
2252
|
-
return !r || !i || !a ? null : /* @__PURE__ */ q(
|
|
2251
|
+
return !r || !i || !a ? null : /* @__PURE__ */ q(_a, { className: e });
|
|
2253
2252
|
}
|
|
2254
|
-
function
|
|
2255
|
-
let { t } = j(), { handle: n, chrome: r } = k(), i = n.editor, a =
|
|
2253
|
+
function _a({ className: e }) {
|
|
2254
|
+
let { t } = j(), { handle: n, chrome: r } = k(), i = n.editor, a = ha(i), o = W(null), s = P({
|
|
2256
2255
|
editor: i,
|
|
2257
2256
|
selector: (e) => e.editor.isEditable
|
|
2258
2257
|
}), c = s && r.state.findReplace;
|
|
@@ -2269,7 +2268,7 @@ function ga({ className: e }) {
|
|
|
2269
2268
|
e.key === "Escape" && (e.preventDefault(), e.stopPropagation(), l());
|
|
2270
2269
|
},
|
|
2271
2270
|
className: e ?? "grid gap-1.5",
|
|
2272
|
-
children: [/* @__PURE__ */ q(
|
|
2271
|
+
children: [/* @__PURE__ */ q(Xi, {
|
|
2273
2272
|
find: a,
|
|
2274
2273
|
inputRef: o,
|
|
2275
2274
|
onStep: u,
|
|
@@ -2280,13 +2279,13 @@ function ga({ className: e }) {
|
|
|
2280
2279
|
replaceOpen: c,
|
|
2281
2280
|
canReplace: s,
|
|
2282
2281
|
onToggleReplace: () => r.actions.setFindReplace(!c)
|
|
2283
|
-
}), c && /* @__PURE__ */ q(
|
|
2282
|
+
}), c && /* @__PURE__ */ q(va, {
|
|
2284
2283
|
editor: i,
|
|
2285
2284
|
find: a
|
|
2286
2285
|
})]
|
|
2287
2286
|
});
|
|
2288
2287
|
}
|
|
2289
|
-
function
|
|
2288
|
+
function va({ editor: e, find: t }) {
|
|
2290
2289
|
let { t: n } = j(), [r, i] = G("");
|
|
2291
2290
|
return /* @__PURE__ */ J("div", {
|
|
2292
2291
|
className: "flex flex-wrap items-center gap-1.5",
|
|
@@ -2320,7 +2319,7 @@ function _a({ editor: e, find: t }) {
|
|
|
2320
2319
|
}
|
|
2321
2320
|
//#endregion
|
|
2322
2321
|
//#region lib/components/ui/widgets/editor/partials/editor-focus-exit.tsx
|
|
2323
|
-
function
|
|
2322
|
+
function ya({ className: e }) {
|
|
2324
2323
|
let { t: n } = j(), { chrome: r, handle: i } = k();
|
|
2325
2324
|
return r.state.focusMode ? /* @__PURE__ */ q(N, {
|
|
2326
2325
|
variant: "ghost",
|
|
@@ -2330,24 +2329,24 @@ function va({ className: e }) {
|
|
|
2330
2329
|
onClick: () => {
|
|
2331
2330
|
r.actions.setFocusMode(!1), i.focus();
|
|
2332
2331
|
},
|
|
2333
|
-
children: /* @__PURE__ */ q(
|
|
2332
|
+
children: /* @__PURE__ */ q(Zt, {})
|
|
2334
2333
|
}) : null;
|
|
2335
2334
|
}
|
|
2336
2335
|
//#endregion
|
|
2337
2336
|
//#region lib/components/ui/widgets/editor/core/editor-stats.ts
|
|
2338
|
-
var
|
|
2337
|
+
var ba = (e) => e.trim() ? e.trim().split(/\s+/).length : 0, xa = (e) => e <= 0 ? 0 : Math.max(1, Math.round(e / 230));
|
|
2339
2338
|
//#endregion
|
|
2340
2339
|
//#region lib/components/ui/widgets/editor/core/use-editor-stats.ts
|
|
2341
|
-
function
|
|
2340
|
+
function Sa(e) {
|
|
2342
2341
|
return P({
|
|
2343
2342
|
editor: e.editor,
|
|
2344
2343
|
selector: ({ editor: e }) => {
|
|
2345
|
-
let t = e?.storage.characterCount, n = t?.words?.() ??
|
|
2344
|
+
let t = e?.storage.characterCount, n = t?.words?.() ?? ba(e?.getText() ?? ""), r = e?.extensionManager.extensions.find((e) => e.name === "characterCount")?.options.limit;
|
|
2346
2345
|
return {
|
|
2347
2346
|
words: n,
|
|
2348
2347
|
characters: t?.characters?.(),
|
|
2349
2348
|
limit: r,
|
|
2350
|
-
readingMinutes:
|
|
2349
|
+
readingMinutes: xa(n)
|
|
2351
2350
|
};
|
|
2352
2351
|
}
|
|
2353
2352
|
}) ?? {
|
|
@@ -2359,8 +2358,8 @@ function xa(e) {
|
|
|
2359
2358
|
}
|
|
2360
2359
|
//#endregion
|
|
2361
2360
|
//#region lib/components/ui/widgets/editor/partials/editor-stats.tsx
|
|
2362
|
-
function
|
|
2363
|
-
let { t } = j(), { handle: n } = k(), r =
|
|
2361
|
+
function Ca({ readingTime: e = !0 }) {
|
|
2362
|
+
let { t } = j(), { handle: n } = k(), r = Sa(n), { words: i } = r;
|
|
2364
2363
|
return /* @__PURE__ */ J("p", {
|
|
2365
2364
|
"data-slot": "editor-stats",
|
|
2366
2365
|
className: "flex flex-wrap gap-x-2",
|
|
@@ -2379,18 +2378,18 @@ function Sa({ readingTime: e = !0 }) {
|
|
|
2379
2378
|
}
|
|
2380
2379
|
//#endregion
|
|
2381
2380
|
//#region lib/components/ui/widgets/editor/partials/editor-footer.tsx
|
|
2382
|
-
var
|
|
2381
|
+
var wa = {
|
|
2383
2382
|
saved: ["material.editor.footer.saved", "Saved"],
|
|
2384
2383
|
saving: ["material.editor.footer.saving", "Saving…"],
|
|
2385
2384
|
unsaved: ["material.editor.footer.unsaved", "Unsaved changes"]
|
|
2386
2385
|
};
|
|
2387
|
-
function
|
|
2388
|
-
let { t: o } = j(), s = typeof r == "string" && r in
|
|
2386
|
+
function Ta({ className: n, status: r, actions: i, readingTime: a = !0 }) {
|
|
2387
|
+
let { t: o } = j(), s = typeof r == "string" && r in wa, [c, l] = s ? wa[r] : [];
|
|
2389
2388
|
return /* @__PURE__ */ J("div", {
|
|
2390
2389
|
"data-slot": "editor-footer",
|
|
2391
2390
|
className: t("flex flex-wrap items-center gap-x-3 gap-y-2 text-muted-foreground text-sm", n),
|
|
2392
2391
|
children: [
|
|
2393
|
-
/* @__PURE__ */ q(
|
|
2392
|
+
/* @__PURE__ */ q(Ca, { readingTime: a }),
|
|
2394
2393
|
e(r) ? /* @__PURE__ */ J(K, { children: [/* @__PURE__ */ q("span", {
|
|
2395
2394
|
"aria-hidden": "true",
|
|
2396
2395
|
children: "·"
|
|
@@ -2411,7 +2410,7 @@ function wa({ className: n, status: r, actions: i, readingTime: a = !0 }) {
|
|
|
2411
2410
|
}
|
|
2412
2411
|
//#endregion
|
|
2413
2412
|
//#region lib/components/ui/widgets/editor/extensions/outline/outline-items.ts
|
|
2414
|
-
function
|
|
2413
|
+
function Ea(e, t = 3) {
|
|
2415
2414
|
let n = [];
|
|
2416
2415
|
return e.descendants((e, r) => {
|
|
2417
2416
|
if (e.type.name !== "heading") return e.isBlock && !e.isTextblock;
|
|
@@ -2423,7 +2422,7 @@ function Ta(e, t = 3) {
|
|
|
2423
2422
|
}), !1;
|
|
2424
2423
|
}), n;
|
|
2425
2424
|
}
|
|
2426
|
-
function
|
|
2425
|
+
function Da(e, t) {
|
|
2427
2426
|
if (e.length === 0) return -1;
|
|
2428
2427
|
let n = 0;
|
|
2429
2428
|
return e.forEach((e, r) => {
|
|
@@ -2432,11 +2431,11 @@ function Ea(e, t) {
|
|
|
2432
2431
|
}
|
|
2433
2432
|
//#endregion
|
|
2434
2433
|
//#region lib/components/ui/widgets/editor/extensions/outline/use-outline.ts
|
|
2435
|
-
var
|
|
2436
|
-
function
|
|
2434
|
+
var Oa = 120, ka = 700, Aa = () => window.matchMedia?.("(prefers-reduced-motion: reduce)").matches ?? !1;
|
|
2435
|
+
function ja(e) {
|
|
2437
2436
|
let t = P({
|
|
2438
2437
|
editor: e,
|
|
2439
|
-
selector: ({ editor: e }) =>
|
|
2438
|
+
selector: ({ editor: e }) => Ea(e.state.doc)
|
|
2440
2439
|
}), [n, r] = G(0), i = W(0);
|
|
2441
2440
|
H(() => {
|
|
2442
2441
|
let n = 0, a = () => {
|
|
@@ -2445,7 +2444,7 @@ function Aa(e) {
|
|
|
2445
2444
|
let n = e.view.nodeDOM(t.pos);
|
|
2446
2445
|
return n instanceof HTMLElement ? n.getBoundingClientRect().top : 0;
|
|
2447
2446
|
});
|
|
2448
|
-
r(
|
|
2447
|
+
r(Da(a, Oa));
|
|
2449
2448
|
}, o = () => {
|
|
2450
2449
|
n ||= requestAnimationFrame(a);
|
|
2451
2450
|
};
|
|
@@ -2459,11 +2458,11 @@ function Aa(e) {
|
|
|
2459
2458
|
let a = V((n) => {
|
|
2460
2459
|
let a = t[n];
|
|
2461
2460
|
if (!a) return;
|
|
2462
|
-
i.current = Date.now() +
|
|
2461
|
+
i.current = Date.now() + ka, r(n), e.chain().focus().setTextSelection(a.pos + 1).run();
|
|
2463
2462
|
let o = e.view.nodeDOM(a.pos);
|
|
2464
2463
|
o instanceof HTMLElement && o.scrollIntoView({
|
|
2465
2464
|
block: "start",
|
|
2466
|
-
behavior:
|
|
2465
|
+
behavior: Aa() ? "auto" : "smooth"
|
|
2467
2466
|
});
|
|
2468
2467
|
}, [e, t]);
|
|
2469
2468
|
return {
|
|
@@ -2474,21 +2473,21 @@ function Aa(e) {
|
|
|
2474
2473
|
}
|
|
2475
2474
|
//#endregion
|
|
2476
2475
|
//#region lib/components/ui/widgets/editor/partials/editor-outline.tsx
|
|
2477
|
-
var
|
|
2476
|
+
var Ma = {
|
|
2478
2477
|
1: "ps-2",
|
|
2479
2478
|
2: "ps-5",
|
|
2480
2479
|
3: "ps-8"
|
|
2481
2480
|
};
|
|
2482
|
-
function
|
|
2481
|
+
function Na({ className: e, onNavigate: t }) {
|
|
2483
2482
|
let { handle: n } = k();
|
|
2484
|
-
return n.editor ? /* @__PURE__ */ q(
|
|
2483
|
+
return n.editor ? /* @__PURE__ */ q(Pa, {
|
|
2485
2484
|
editor: n.editor,
|
|
2486
2485
|
className: e,
|
|
2487
2486
|
onNavigate: t
|
|
2488
2487
|
}) : null;
|
|
2489
2488
|
}
|
|
2490
|
-
function
|
|
2491
|
-
let { t: i } = j(), { items: a, active: o, goTo: s } =
|
|
2489
|
+
function Pa({ editor: e, className: n, onNavigate: r }) {
|
|
2490
|
+
let { t: i } = j(), { items: a, active: o, goTo: s } = ja(e);
|
|
2492
2491
|
return /* @__PURE__ */ J("nav", {
|
|
2493
2492
|
"aria-label": i("material.editor.outline", "Outline"),
|
|
2494
2493
|
"data-slot": "editor-outline",
|
|
@@ -2508,7 +2507,7 @@ function Na({ editor: e, className: n, onNavigate: r }) {
|
|
|
2508
2507
|
onClick: () => {
|
|
2509
2508
|
s(n), r?.();
|
|
2510
2509
|
},
|
|
2511
|
-
className: t("line-clamp-2 w-full break-words rounded-md py-1 pe-2 text-start text-muted-foreground outline-none transition-colors duration-(--nxgt-motion-effects-fast-duration) ease-effects-fast motion-reduce:transition-none", "hover:bg-accent hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50", "aria-[current=location]:bg-primary/10 aria-[current=location]:font-medium aria-[current=location]:text-primary-text aria-[current=location]:shadow-[inset_2px_0_0_0_var(--primary-text)]",
|
|
2510
|
+
className: t("line-clamp-2 w-full break-words rounded-md py-1 pe-2 text-start text-muted-foreground outline-none transition-colors duration-(--nxgt-motion-effects-fast-duration) ease-effects-fast motion-reduce:transition-none", "hover:bg-accent hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50", "aria-[current=location]:bg-primary/10 aria-[current=location]:font-medium aria-[current=location]:text-primary-text aria-[current=location]:shadow-[inset_2px_0_0_0_var(--primary-text)]", Ma[e.level] ?? "ps-2"),
|
|
2512
2511
|
children: e.text
|
|
2513
2512
|
}) }, `${e.pos}-${e.text}`))
|
|
2514
2513
|
})]
|
|
@@ -2516,31 +2515,31 @@ function Na({ editor: e, className: n, onNavigate: r }) {
|
|
|
2516
2515
|
}
|
|
2517
2516
|
//#endregion
|
|
2518
2517
|
//#region lib/components/ui/widgets/editor/partials/editor-outline-panel.tsx
|
|
2519
|
-
function
|
|
2518
|
+
function Fa(e) {
|
|
2520
2519
|
let { handle: t, chrome: n } = k();
|
|
2521
|
-
return t.features.some((e) => e.key === "outline") ? /* @__PURE__ */ q(
|
|
2520
|
+
return t.features.some((e) => e.key === "outline") ? /* @__PURE__ */ q(jr, {
|
|
2522
2521
|
id: "outline",
|
|
2523
2522
|
className: "w-72 max-w-[92vw] p-2",
|
|
2524
|
-
children: /* @__PURE__ */ q(
|
|
2523
|
+
children: /* @__PURE__ */ q(Na, { onNavigate: () => n.actions.closePanel() })
|
|
2525
2524
|
}) : null;
|
|
2526
2525
|
}
|
|
2527
2526
|
//#endregion
|
|
2528
2527
|
//#region lib/components/ui/widgets/editor/extensions/upload/use-editor-uploads.ts
|
|
2529
|
-
var
|
|
2530
|
-
function
|
|
2531
|
-
let t = c(e.editor)?.queue, n =
|
|
2532
|
-
if (!t) return
|
|
2528
|
+
var Ia = 0, La = 1e6;
|
|
2529
|
+
function Ra(e) {
|
|
2530
|
+
let t = c(e.editor)?.queue, n = xn(V((e) => t?.subscribe(e) ?? (() => {}), [t]), () => {
|
|
2531
|
+
if (!t) return Ia;
|
|
2533
2532
|
let e = t.list(), n = e.filter((e) => e.status === "error").length;
|
|
2534
|
-
return (e.length - n) *
|
|
2535
|
-
}, () =>
|
|
2533
|
+
return (e.length - n) * La + n;
|
|
2534
|
+
}, () => Ia);
|
|
2536
2535
|
return U(() => ({
|
|
2537
|
-
pending: Math.floor(n /
|
|
2538
|
-
failed: n %
|
|
2536
|
+
pending: Math.floor(n / La),
|
|
2537
|
+
failed: n % La
|
|
2539
2538
|
}), [n]);
|
|
2540
2539
|
}
|
|
2541
2540
|
//#endregion
|
|
2542
2541
|
//#region lib/components/ui/widgets/editor/format/looks-like-markdown.ts
|
|
2543
|
-
var
|
|
2542
|
+
var za = [
|
|
2544
2543
|
/^\s*[-*+]\s+\S/,
|
|
2545
2544
|
/^\s*\d{1,9}[.)]\s+\S/,
|
|
2546
2545
|
/^\s*>\s?\S/,
|
|
@@ -2549,7 +2548,7 @@ var Ra = [
|
|
|
2549
2548
|
/^:::[\w-]*/,
|
|
2550
2549
|
/^\s*\|.+\|\s*$/,
|
|
2551
2550
|
/^\s*[-*]\s+\[[ xX]\]\s/
|
|
2552
|
-
],
|
|
2551
|
+
], Ba = /^#{1,6}\s+\S/, Va = [
|
|
2553
2552
|
/\*\*[^*\s][^*]*\*\*/,
|
|
2554
2553
|
/(^|\s)__[^_\s][^_]*__(\s|$)/,
|
|
2555
2554
|
/\[[^\]\n]+\]\((https?:\/\/|\/|#|mailto:)[^)\s]+\)/,
|
|
@@ -2557,22 +2556,22 @@ var Ra = [
|
|
|
2557
2556
|
/(^|[^`])`[^`\n]+`([^`]|$)/,
|
|
2558
2557
|
/~~[^~\s][^~]*~~/
|
|
2559
2558
|
];
|
|
2560
|
-
function
|
|
2559
|
+
function Ha(e) {
|
|
2561
2560
|
let t = e.split("\n"), n = 0, r = 0, i = 0, a = !1;
|
|
2562
2561
|
for (let e of t) {
|
|
2563
2562
|
if (/^\s*(```|~~~)/.test(e)) {
|
|
2564
2563
|
a || (n += 2), a = !a;
|
|
2565
2564
|
continue;
|
|
2566
2565
|
}
|
|
2567
|
-
a || (
|
|
2566
|
+
a || (Ba.test(e) ? i++ : za.some((t) => t.test(e)) && n++, r += Va.filter((t) => t.test(e)).length);
|
|
2568
2567
|
}
|
|
2569
2568
|
let o = n + (n + r > 0 ? i : 0);
|
|
2570
2569
|
return o >= 2 || o >= 1 && r >= 1 || r >= 2;
|
|
2571
2570
|
}
|
|
2572
2571
|
//#endregion
|
|
2573
2572
|
//#region lib/components/ui/widgets/editor/extensions/assistant/assistant-button.tsx
|
|
2574
|
-
function
|
|
2575
|
-
let { t } = j(), { chrome: n } = k(), r =
|
|
2573
|
+
function Ua({ editor: e }) {
|
|
2574
|
+
let { t } = j(), { chrome: n } = k(), r = ar(e), i = n.state.panel === "assistant";
|
|
2576
2575
|
if (!r || !e.isEditable) return null;
|
|
2577
2576
|
let a = t("material.editor.assistant.title", "Assistant");
|
|
2578
2577
|
return /* @__PURE__ */ q(p, {
|
|
@@ -2584,18 +2583,18 @@ function Ha({ editor: e }) {
|
|
|
2584
2583
|
tooltip: a,
|
|
2585
2584
|
onMouseDown: (e) => e.preventDefault(),
|
|
2586
2585
|
onClick: () => i ? r.close() : r.open(),
|
|
2587
|
-
children: /* @__PURE__ */ q(
|
|
2586
|
+
children: /* @__PURE__ */ q(sn, {})
|
|
2588
2587
|
});
|
|
2589
2588
|
}
|
|
2590
2589
|
//#endregion
|
|
2591
2590
|
//#region lib/components/ui/widgets/editor/core/remote-change.ts
|
|
2592
|
-
var
|
|
2593
|
-
function
|
|
2591
|
+
var Wa = "y-sync$", Ga = (e) => !!e.getMeta(Wa)?.isChangeOrigin;
|
|
2592
|
+
function Ka(e, t) {
|
|
2594
2593
|
let n = e.state.doc.content.size;
|
|
2595
2594
|
return t.map((t) => e.utils.createMappablePosition(Math.max(0, Math.min(t, n))));
|
|
2596
2595
|
}
|
|
2597
|
-
var
|
|
2598
|
-
function
|
|
2596
|
+
var qa = (e, t, n) => e.utils.getUpdatedPosition(t, n).position.position;
|
|
2597
|
+
function Ja(e, t, n) {
|
|
2599
2598
|
let r = null;
|
|
2600
2599
|
return n(() => {
|
|
2601
2600
|
let n = t();
|
|
@@ -2604,21 +2603,21 @@ function qa(e, t, n) {
|
|
|
2604
2603
|
from: n.from,
|
|
2605
2604
|
to: n.to
|
|
2606
2605
|
},
|
|
2607
|
-
marks:
|
|
2606
|
+
marks: Ka(e, [
|
|
2608
2607
|
n.from,
|
|
2609
2608
|
Math.min(n.from + 1, n.to),
|
|
2610
2609
|
n.to
|
|
2611
2610
|
])
|
|
2612
2611
|
}) : r = null;
|
|
2613
2612
|
}), (t) => {
|
|
2614
|
-
let n = t.docChanged &&
|
|
2613
|
+
let n = t.docChanged && Ga(t) ? r : null, i = (e, n) => t.mapping.map(e, n);
|
|
2615
2614
|
if (!n) return i;
|
|
2616
2615
|
let { marks: a, at: o } = n, s = [
|
|
2617
2616
|
o.from,
|
|
2618
2617
|
Math.min(o.from + 1, o.to),
|
|
2619
2618
|
o.to
|
|
2620
2619
|
], c = (n) => {
|
|
2621
|
-
let r =
|
|
2620
|
+
let r = qa(e, a[n], t);
|
|
2622
2621
|
return r === 0 && s[n] > 0 ? null : r;
|
|
2623
2622
|
}, [l, u, d] = [
|
|
2624
2623
|
c(0),
|
|
@@ -2630,8 +2629,8 @@ function qa(e, t, n) {
|
|
|
2630
2629
|
}
|
|
2631
2630
|
//#endregion
|
|
2632
2631
|
//#region lib/components/ui/widgets/editor/extensions/assistant/accumulate.ts
|
|
2633
|
-
var
|
|
2634
|
-
async function
|
|
2632
|
+
var Ya = (e) => typeof e == "object" && !!e && Symbol.asyncIterator in e;
|
|
2633
|
+
async function Xa(e, t) {
|
|
2635
2634
|
let { signal: n, onText: r } = t, i = "", a = new Promise((e) => {
|
|
2636
2635
|
n.aborted ? e("aborted") : n.addEventListener("abort", () => e("aborted"), { once: !0 });
|
|
2637
2636
|
}), o = Promise.resolve(e);
|
|
@@ -2641,7 +2640,7 @@ async function Ya(e, t) {
|
|
|
2641
2640
|
text: i,
|
|
2642
2641
|
aborted: !0
|
|
2643
2642
|
};
|
|
2644
|
-
if (!
|
|
2643
|
+
if (!Ya(s)) return i = typeof s == "string" ? s : "", r?.(i), {
|
|
2645
2644
|
text: i,
|
|
2646
2645
|
aborted: !1
|
|
2647
2646
|
};
|
|
@@ -2667,18 +2666,18 @@ async function Ya(e, t) {
|
|
|
2667
2666
|
}
|
|
2668
2667
|
//#endregion
|
|
2669
2668
|
//#region lib/components/ui/widgets/editor/extensions/assistant/build-request.ts
|
|
2670
|
-
var
|
|
2671
|
-
function
|
|
2669
|
+
var Za = 2e3, Qa = (e) => e >= 56320 && e <= 57343, $a = (e) => e >= 55296 && e <= 56319;
|
|
2670
|
+
function eo(e, t) {
|
|
2672
2671
|
if (e.length <= t) return e;
|
|
2673
2672
|
let n = e.length - t;
|
|
2674
|
-
return
|
|
2673
|
+
return Qa(e.charCodeAt(n)) && (n += 1), e.slice(n);
|
|
2675
2674
|
}
|
|
2676
|
-
function
|
|
2675
|
+
function to(e, t) {
|
|
2677
2676
|
if (e.length <= t) return e;
|
|
2678
2677
|
let n = t;
|
|
2679
|
-
return
|
|
2678
|
+
return $a(e.charCodeAt(n - 1)) && --n, e.slice(0, n);
|
|
2680
2679
|
}
|
|
2681
|
-
function
|
|
2680
|
+
function no(e) {
|
|
2682
2681
|
let t = e.limit ?? 2e3, n = e.prompt?.trim();
|
|
2683
2682
|
return {
|
|
2684
2683
|
action: e.action,
|
|
@@ -2688,17 +2687,17 @@ function to(e) {
|
|
|
2688
2687
|
text: e.selectionText
|
|
2689
2688
|
},
|
|
2690
2689
|
context: {
|
|
2691
|
-
before:
|
|
2692
|
-
after:
|
|
2690
|
+
before: eo(e.before, t),
|
|
2691
|
+
after: to(e.after, t)
|
|
2693
2692
|
},
|
|
2694
2693
|
locale: e.locale
|
|
2695
2694
|
};
|
|
2696
2695
|
}
|
|
2697
2696
|
//#endregion
|
|
2698
2697
|
//#region lib/components/ui/widgets/editor/extensions/assistant/run-assist.ts
|
|
2699
|
-
async function
|
|
2698
|
+
async function ro(e) {
|
|
2700
2699
|
let { host: t, handler: n, input: r, range: i, signal: a, isCurrent: o, onText: s } = e, c = await t.capture(i);
|
|
2701
|
-
return o() ?
|
|
2700
|
+
return o() ? Xa(n(no({
|
|
2702
2701
|
action: r.action,
|
|
2703
2702
|
prompt: r.prompt,
|
|
2704
2703
|
selectionMarkdown: c.selection.markdown,
|
|
@@ -2713,9 +2712,9 @@ async function no(e) {
|
|
|
2713
2712
|
}
|
|
2714
2713
|
//#endregion
|
|
2715
2714
|
//#region lib/components/ui/widgets/editor/extensions/assistant/assistant-controller.ts
|
|
2716
|
-
var
|
|
2715
|
+
var io = class {
|
|
2717
2716
|
host;
|
|
2718
|
-
store =
|
|
2717
|
+
store = ft(rr);
|
|
2719
2718
|
abort = null;
|
|
2720
2719
|
token = 0;
|
|
2721
2720
|
panel = null;
|
|
@@ -2744,7 +2743,7 @@ var ro = class {
|
|
|
2744
2743
|
this.cancel();
|
|
2745
2744
|
let e = this.host.range();
|
|
2746
2745
|
this.store.replace({
|
|
2747
|
-
...
|
|
2746
|
+
...rr,
|
|
2748
2747
|
phase: "menu",
|
|
2749
2748
|
range: e,
|
|
2750
2749
|
hasSelection: e.from !== e.to
|
|
@@ -2767,7 +2766,7 @@ var ro = class {
|
|
|
2767
2766
|
note: null
|
|
2768
2767
|
});
|
|
2769
2768
|
try {
|
|
2770
|
-
let i = await
|
|
2769
|
+
let i = await ro({
|
|
2771
2770
|
host: this.host,
|
|
2772
2771
|
handler: t,
|
|
2773
2772
|
input: e,
|
|
@@ -2787,7 +2786,7 @@ var ro = class {
|
|
|
2787
2786
|
} catch (e) {
|
|
2788
2787
|
n === this.token && this.set({
|
|
2789
2788
|
phase: "error",
|
|
2790
|
-
error:
|
|
2789
|
+
error: si(e)
|
|
2791
2790
|
});
|
|
2792
2791
|
}
|
|
2793
2792
|
};
|
|
@@ -2832,31 +2831,31 @@ var ro = class {
|
|
|
2832
2831
|
}));
|
|
2833
2832
|
};
|
|
2834
2833
|
reset = () => {
|
|
2835
|
-
this.cancel(), this.store.replace(
|
|
2834
|
+
this.cancel(), this.store.replace(rr);
|
|
2836
2835
|
};
|
|
2837
2836
|
close = () => {
|
|
2838
2837
|
this.reset(), this.host.closePanel();
|
|
2839
2838
|
};
|
|
2840
2839
|
mapRange = (e) => {
|
|
2841
2840
|
if (this.state.phase === "idle") return;
|
|
2842
|
-
let t =
|
|
2841
|
+
let t = nr(this.state, e);
|
|
2843
2842
|
t && this.set(t);
|
|
2844
2843
|
};
|
|
2845
|
-
},
|
|
2846
|
-
async function
|
|
2844
|
+
}, ao = (e) => new io(e), oo = Za * 3;
|
|
2845
|
+
async function so(e, t, n) {
|
|
2847
2846
|
if (n <= t) return "";
|
|
2848
2847
|
let { doc: r } = e.state;
|
|
2849
2848
|
try {
|
|
2850
|
-
return (await
|
|
2849
|
+
return (await gt(r.cut(t, n).toJSON(), { extensions: Cn(e) })).replace(/\s+$/, "");
|
|
2851
2850
|
} catch {
|
|
2852
2851
|
return r.textBetween(t, n, "\n\n");
|
|
2853
2852
|
}
|
|
2854
2853
|
}
|
|
2855
|
-
async function
|
|
2854
|
+
async function co(e, t) {
|
|
2856
2855
|
let { doc: n } = e.state, r = n.content.size, i = Math.min(t.from, r), a = Math.min(t.to, r), [o, s, c] = await Promise.all([
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
|
|
2856
|
+
so(e, i, a),
|
|
2857
|
+
so(e, Math.max(0, i - oo), i),
|
|
2858
|
+
so(e, a, Math.min(r, a + oo))
|
|
2860
2859
|
]);
|
|
2861
2860
|
return {
|
|
2862
2861
|
selection: {
|
|
@@ -2869,12 +2868,12 @@ async function so(e, t) {
|
|
|
2869
2868
|
}
|
|
2870
2869
|
//#endregion
|
|
2871
2870
|
//#region lib/components/ui/widgets/editor/extensions/assistant/assistant-extension.ts
|
|
2872
|
-
var
|
|
2871
|
+
var lo = R.create({
|
|
2873
2872
|
name: "assistant",
|
|
2874
2873
|
addStorage: () => ({}),
|
|
2875
2874
|
onBeforeCreate() {
|
|
2876
2875
|
let { editor: e, options: t, storage: n } = this;
|
|
2877
|
-
n.actions = t.actions, n.allowMedia = t.allowMedia === !0, n.controller =
|
|
2876
|
+
n.actions = t.actions, n.allowMedia = t.allowMedia === !0, n.controller = ao({
|
|
2878
2877
|
range: () => {
|
|
2879
2878
|
let { from: t, to: n } = e.state.selection;
|
|
2880
2879
|
return {
|
|
@@ -2882,16 +2881,16 @@ var co = R.create({
|
|
|
2882
2881
|
to: n
|
|
2883
2882
|
};
|
|
2884
2883
|
},
|
|
2885
|
-
capture: (t) =>
|
|
2884
|
+
capture: (t) => co(e, t),
|
|
2886
2885
|
handler: () => e.isEditable ? t.handler() : void 0,
|
|
2887
2886
|
openPanel: () => t.panel.open(),
|
|
2888
2887
|
closePanel: () => t.panel.close()
|
|
2889
2888
|
});
|
|
2890
2889
|
let r = n.controller;
|
|
2891
|
-
n.follow =
|
|
2890
|
+
n.follow = Ja(e, () => r.getState().phase === "idle" ? null : r.getState().range, r.subscribe);
|
|
2892
2891
|
},
|
|
2893
2892
|
addProseMirrorPlugins() {
|
|
2894
|
-
let e = new
|
|
2893
|
+
let e = new lt("assistantRange"), t = () => this.storage.controller;
|
|
2895
2894
|
return [new F({
|
|
2896
2895
|
key: e,
|
|
2897
2896
|
props: { decorations: (e) => {
|
|
@@ -2919,10 +2918,10 @@ var co = R.create({
|
|
|
2919
2918
|
onDestroy() {
|
|
2920
2919
|
this.storage.controller?.reset();
|
|
2921
2920
|
}
|
|
2922
|
-
}),
|
|
2923
|
-
let n =
|
|
2921
|
+
}), uo = ({ editor: e, chrome: t }) => {
|
|
2922
|
+
let n = tr(e)?.controller;
|
|
2924
2923
|
return n ? t.state.panel === "assistant" ? (n.focusPanel(), !0) : (n.open(), !0) : !1;
|
|
2925
|
-
},
|
|
2924
|
+
}, fo = {
|
|
2926
2925
|
id: "assistant",
|
|
2927
2926
|
title: "Assistant",
|
|
2928
2927
|
description: "Ask the assistant to write or edit.",
|
|
@@ -2934,13 +2933,13 @@ var co = R.create({
|
|
|
2934
2933
|
"continue"
|
|
2935
2934
|
],
|
|
2936
2935
|
group: "Insert",
|
|
2937
|
-
icon:
|
|
2938
|
-
run: ({ editor: e, range: t }) => (e.chain().focus().deleteRange(t).run(),
|
|
2939
|
-
},
|
|
2936
|
+
icon: sn,
|
|
2937
|
+
run: ({ editor: e, range: t }) => (e.chain().focus().deleteRange(t).run(), tr(e)?.controller.open(), !0)
|
|
2938
|
+
}, po = (e = {}) => {
|
|
2940
2939
|
let { onAssist: t, actions: n, allowMedia: r } = e;
|
|
2941
2940
|
return B(t ? {
|
|
2942
2941
|
name: "assistant",
|
|
2943
|
-
extensions: (e) => [
|
|
2942
|
+
extensions: (e) => [lo.configure({
|
|
2944
2943
|
handler: () => t,
|
|
2945
2944
|
actions: n,
|
|
2946
2945
|
allowMedia: r,
|
|
@@ -2955,7 +2954,7 @@ var co = R.create({
|
|
|
2955
2954
|
priority: 90,
|
|
2956
2955
|
kind: "button",
|
|
2957
2956
|
when: (e) => e.isEditable,
|
|
2958
|
-
render:
|
|
2957
|
+
render: Ua
|
|
2959
2958
|
}],
|
|
2960
2959
|
bubble: [{
|
|
2961
2960
|
id: "assistant",
|
|
@@ -2963,12 +2962,12 @@ var co = R.create({
|
|
|
2963
2962
|
priority: 90,
|
|
2964
2963
|
kind: "button",
|
|
2965
2964
|
when: (e) => e.isEditable,
|
|
2966
|
-
render:
|
|
2965
|
+
render: Ua
|
|
2967
2966
|
}],
|
|
2968
|
-
slash: [
|
|
2967
|
+
slash: [fo],
|
|
2969
2968
|
shortcuts: [{
|
|
2970
2969
|
keys: "Mod-j",
|
|
2971
|
-
run:
|
|
2970
|
+
run: uo
|
|
2972
2971
|
}],
|
|
2973
2972
|
markdown: "native"
|
|
2974
2973
|
} : {
|
|
@@ -2979,13 +2978,13 @@ var co = R.create({
|
|
|
2979
2978
|
};
|
|
2980
2979
|
//#endregion
|
|
2981
2980
|
//#region lib/components/ui/widgets/editor/partials/panel-toggle-focus.ts
|
|
2982
|
-
function
|
|
2981
|
+
function mo(e, t) {
|
|
2983
2982
|
!e.currentTarget.closest("[hidden]") || t.isDestroyed || t.chain().focus().run();
|
|
2984
2983
|
}
|
|
2985
2984
|
//#endregion
|
|
2986
2985
|
//#region lib/components/ui/widgets/editor/extensions/comments/comments-buttons.tsx
|
|
2987
|
-
function
|
|
2988
|
-
let { t } = j(), n =
|
|
2986
|
+
function ho({ editor: e }) {
|
|
2987
|
+
let { t } = j(), n = Cr(e);
|
|
2989
2988
|
if (!n) return null;
|
|
2990
2989
|
let r = t("material.editor.comments.comment", "Comment");
|
|
2991
2990
|
return /* @__PURE__ */ q(p, {
|
|
@@ -2996,13 +2995,13 @@ function mo({ editor: e }) {
|
|
|
2996
2995
|
tooltip: r,
|
|
2997
2996
|
onMouseDown: (e) => e.preventDefault(),
|
|
2998
2997
|
onClick: () => n.startComposer(),
|
|
2999
|
-
children: /* @__PURE__ */ q(
|
|
2998
|
+
children: /* @__PURE__ */ q(Xt, {})
|
|
3000
2999
|
});
|
|
3001
3000
|
}
|
|
3002
|
-
function
|
|
3003
|
-
let { t } = j(), { chrome: n } = k(), r =
|
|
3001
|
+
function go({ editor: e }) {
|
|
3002
|
+
let { t } = j(), { chrome: n } = k(), r = wr(e);
|
|
3004
3003
|
if (!Y(e)) return null;
|
|
3005
|
-
let i = n.state.panel === "comments", a =
|
|
3004
|
+
let i = n.state.panel === "comments", a = hi(r).length, o = t("material.editor.comments.count", "Comments ({count})", { count: a });
|
|
3006
3005
|
return /* @__PURE__ */ q(p, {
|
|
3007
3006
|
"data-slot": "editor-comments-button",
|
|
3008
3007
|
variant: i ? "filled" : "ghost",
|
|
@@ -3011,12 +3010,12 @@ function ho({ editor: e }) {
|
|
|
3011
3010
|
"aria-expanded": i,
|
|
3012
3011
|
tooltip: o,
|
|
3013
3012
|
onClick: (t) => {
|
|
3014
|
-
n.actions.togglePanel("comments"), i &&
|
|
3013
|
+
n.actions.togglePanel("comments"), i && mo(t, e);
|
|
3015
3014
|
},
|
|
3016
|
-
children: /* @__PURE__ */ q(
|
|
3015
|
+
children: /* @__PURE__ */ q(Yt, {})
|
|
3017
3016
|
});
|
|
3018
3017
|
}
|
|
3019
|
-
function
|
|
3018
|
+
function _o(e) {
|
|
3020
3019
|
let { from: t, to: n, empty: r } = e.state.selection;
|
|
3021
3020
|
if (r) return null;
|
|
3022
3021
|
let i = e.state.doc.textBetween(t, n, " ").replace(/\s+/g, " ").trim();
|
|
@@ -3026,13 +3025,13 @@ function go(e) {
|
|
|
3026
3025
|
quote: i.slice(0, 500)
|
|
3027
3026
|
} : null;
|
|
3028
3027
|
}
|
|
3029
|
-
function
|
|
3028
|
+
function vo(e, t, n) {
|
|
3030
3029
|
let { doc: r, tr: i } = e.state, a = Math.max(0, t.from), o = Math.min(r.content.size, t.to);
|
|
3031
3030
|
if (a >= o || !r.textBetween(a, o).trim()) return !1;
|
|
3032
3031
|
let s = e.schema.marks.comment;
|
|
3033
3032
|
return s ? (e.view.dispatch(i.addMark(a, o, s.create({ threadId: n }))), !0) : !1;
|
|
3034
3033
|
}
|
|
3035
|
-
function
|
|
3034
|
+
function yo(e, t) {
|
|
3036
3035
|
let { doc: n, tr: r } = e.state;
|
|
3037
3036
|
n.descendants((e, n) => {
|
|
3038
3037
|
for (let i of e.marks) i.type.name === "comment" && i.attrs.threadId === t && r.removeMark(n, n + e.nodeSize, i);
|
|
@@ -3040,52 +3039,52 @@ function vo(e, t) {
|
|
|
3040
3039
|
}
|
|
3041
3040
|
//#endregion
|
|
3042
3041
|
//#region lib/components/ui/widgets/editor/extensions/comments/comments-decorations.ts
|
|
3043
|
-
var
|
|
3044
|
-
function
|
|
3042
|
+
var bo = "nxgt-comment", xo = (e) => `${e.activeId}|${e.showResolved}|${e.composer ? `${e.composer.range.from}-${e.composer.range.to}` : ""}|${e.threads.map((e) => `${e.id}:${+!!e.resolved}`).join(",")}`;
|
|
3043
|
+
function So(e, t) {
|
|
3045
3044
|
let n = new Map(t.threads.map((e) => [e.id, e.resolved])), r = [];
|
|
3046
3045
|
e.descendants((e, i) => {
|
|
3047
3046
|
if (e.isText) for (let a of e.marks) {
|
|
3048
3047
|
if (a.type.name !== "comment") continue;
|
|
3049
3048
|
let o = a.attrs.threadId, s = n.get(o);
|
|
3050
3049
|
if (s === void 0 || s && !t.showResolved) continue;
|
|
3051
|
-
let c = [
|
|
3052
|
-
s && c.push(`${
|
|
3050
|
+
let c = [bo];
|
|
3051
|
+
s && c.push(`${bo}-resolved`), o === t.activeId && c.push(`${bo}-active`), r.push(L.inline(i, i + e.nodeSize, { class: c.join(" ") }));
|
|
3053
3052
|
}
|
|
3054
3053
|
});
|
|
3055
3054
|
let i = t.composer?.range;
|
|
3056
|
-
return i && i.from < i.to && i.to <= e.content.size && r.push(L.inline(i.from, i.to, { class: `${
|
|
3055
|
+
return i && i.from < i.to && i.to <= e.content.size && r.push(L.inline(i.from, i.to, { class: `${bo} ${bo}-active` })), I.create(e, r);
|
|
3057
3056
|
}
|
|
3058
3057
|
//#endregion
|
|
3059
3058
|
//#region lib/components/ui/widgets/editor/extensions/comments/strip-comment-marks.ts
|
|
3060
|
-
var
|
|
3059
|
+
var Co = (e) => {
|
|
3061
3060
|
let t = [];
|
|
3062
3061
|
return e.forEach((e) => {
|
|
3063
3062
|
if (e.isText) {
|
|
3064
3063
|
let n = e.marks.filter((e) => e.type.name !== "comment");
|
|
3065
3064
|
t.push(n.length === e.marks.length ? e : e.mark(n));
|
|
3066
|
-
} else t.push(e.copy(
|
|
3067
|
-
}),
|
|
3068
|
-
},
|
|
3065
|
+
} else t.push(e.copy(Co(e.content)));
|
|
3066
|
+
}), it.fromArray(t);
|
|
3067
|
+
}, wo = (e) => new at(Co(e.content), e.openStart, e.openEnd), To = (e) => e?.dragging?.move === !0, Eo = (e, t) => To(t) ? e : wo(e), Do = new lt("comments"), Oo = (e, t) => {
|
|
3069
3068
|
let n = [];
|
|
3070
3069
|
for (let r = e; r && r !== t; r = r.parentElement) {
|
|
3071
3070
|
let e = r.getAttribute?.("data-comment-thread");
|
|
3072
3071
|
e && n.push(e);
|
|
3073
3072
|
}
|
|
3074
3073
|
return n;
|
|
3075
|
-
},
|
|
3074
|
+
}, ko = R.create({
|
|
3076
3075
|
name: "comments",
|
|
3077
|
-
addExtensions: () => [
|
|
3076
|
+
addExtensions: () => [xt],
|
|
3078
3077
|
addStorage: () => ({}),
|
|
3079
3078
|
onBeforeCreate() {
|
|
3080
3079
|
let { editor: e, options: t, storage: n } = this;
|
|
3081
|
-
n.options = t.current, n.controller = new
|
|
3080
|
+
n.options = t.current, n.controller = new _i({
|
|
3082
3081
|
adapter: () => t.current().adapter,
|
|
3083
3082
|
currentUser: () => t.current().currentUser,
|
|
3084
|
-
selection: () =>
|
|
3083
|
+
selection: () => _o(e),
|
|
3085
3084
|
canComment: () => e.isEditable || t.current().allowCommentsWhenReadOnly === !0,
|
|
3086
|
-
collect: () =>
|
|
3087
|
-
addMark: (t, n) =>
|
|
3088
|
-
removeMarks: (t) =>
|
|
3085
|
+
collect: () => ii(e.state.doc),
|
|
3086
|
+
addMark: (t, n) => vo(e, t, n),
|
|
3087
|
+
removeMarks: (t) => yo(e, t),
|
|
3089
3088
|
reveal: (t) => {
|
|
3090
3089
|
let r = n.controller?.getState().anchors[t]?.from;
|
|
3091
3090
|
r !== void 0 && e.chain().focus().setTextSelection(r).scrollIntoView().run();
|
|
@@ -3093,12 +3092,12 @@ var So = (e) => {
|
|
|
3093
3092
|
focus: () => {
|
|
3094
3093
|
e.commands.focus();
|
|
3095
3094
|
},
|
|
3096
|
-
newId:
|
|
3095
|
+
newId: bt,
|
|
3097
3096
|
openPanel: () => t.panel.open(),
|
|
3098
3097
|
closePanel: () => t.panel.close()
|
|
3099
3098
|
}, t.current().showResolved === !0);
|
|
3100
3099
|
let r = n.controller;
|
|
3101
|
-
n.follow =
|
|
3100
|
+
n.follow = Ja(e, () => r.getState().composer?.range ?? null, r.subscribe);
|
|
3102
3101
|
},
|
|
3103
3102
|
onCreate() {
|
|
3104
3103
|
this.storage.controller?.attach();
|
|
@@ -3112,48 +3111,48 @@ var So = (e) => {
|
|
|
3112
3111
|
addProseMirrorPlugins() {
|
|
3113
3112
|
let e = () => this.storage.controller, t = null;
|
|
3114
3113
|
return [new F({
|
|
3115
|
-
key:
|
|
3114
|
+
key: Do,
|
|
3116
3115
|
props: {
|
|
3117
|
-
transformPasted:
|
|
3116
|
+
transformPasted: Eo,
|
|
3118
3117
|
decorations: (n) => {
|
|
3119
3118
|
let r = e()?.getState();
|
|
3120
3119
|
if (!r) return null;
|
|
3121
|
-
let i =
|
|
3120
|
+
let i = xo(r);
|
|
3122
3121
|
return (t?.doc !== n.doc || t.key !== i) && (t = {
|
|
3123
3122
|
doc: n.doc,
|
|
3124
3123
|
key: i,
|
|
3125
|
-
set:
|
|
3124
|
+
set: So(n.doc, r)
|
|
3126
3125
|
}), t.set;
|
|
3127
3126
|
},
|
|
3128
3127
|
handleDOMEvents: { click: (t, n) => {
|
|
3129
3128
|
let r = e()?.getState();
|
|
3130
3129
|
if (!r) return !1;
|
|
3131
|
-
let i = new Set(
|
|
3130
|
+
let i = new Set(hi(r).map((e) => e.id)), a = Oo(n.target, t.dom).find((e) => i.has(e));
|
|
3132
3131
|
return a && e()?.openThread(a), !1;
|
|
3133
3132
|
} }
|
|
3134
3133
|
},
|
|
3135
3134
|
view: (t) => {
|
|
3136
3135
|
let n = "", r = !1, i = e()?.subscribe(() => {
|
|
3137
|
-
let i = e()?.getState(), a = i ?
|
|
3136
|
+
let i = e()?.getState(), a = i ? xo(i) : "";
|
|
3138
3137
|
a === n || r || (r = !0, queueMicrotask(() => {
|
|
3139
|
-
r = !1, n = a, t.isDestroyed || t.dispatch(t.state.tr.setMeta(
|
|
3138
|
+
r = !1, n = a, t.isDestroyed || t.dispatch(t.state.tr.setMeta(Do, 1));
|
|
3140
3139
|
}));
|
|
3141
3140
|
});
|
|
3142
3141
|
return { destroy: () => i?.() };
|
|
3143
3142
|
}
|
|
3144
3143
|
})];
|
|
3145
3144
|
}
|
|
3146
|
-
}),
|
|
3145
|
+
}), Ao = (e) => Y(e)?.controller, jo = {
|
|
3147
3146
|
keys: "Mod-Alt-m",
|
|
3148
3147
|
editable: !0,
|
|
3149
|
-
run: ({ editor: e }) =>
|
|
3150
|
-
},
|
|
3148
|
+
run: ({ editor: e }) => Ao(e)?.startComposer() ?? !1
|
|
3149
|
+
}, Mo = (e) => ({
|
|
3151
3150
|
keys: e > 0 ? "F8" : "Shift-F8",
|
|
3152
3151
|
editable: !0,
|
|
3153
|
-
run: ({ editor: t }) =>
|
|
3154
|
-
}),
|
|
3152
|
+
run: ({ editor: t }) => Ao(t)?.step(e) ?? !1
|
|
3153
|
+
}), No = (e = {}) => e.adapter ? B({
|
|
3155
3154
|
name: "comments",
|
|
3156
|
-
extensions: (t) => [
|
|
3155
|
+
extensions: (t) => [ko.configure({
|
|
3157
3156
|
current: () => e,
|
|
3158
3157
|
panel: {
|
|
3159
3158
|
open: () => t.suggestions.openPanel("comments"),
|
|
@@ -3165,7 +3164,7 @@ var So = (e) => {
|
|
|
3165
3164
|
order: 97,
|
|
3166
3165
|
priority: 85,
|
|
3167
3166
|
kind: "button",
|
|
3168
|
-
render:
|
|
3167
|
+
render: go
|
|
3169
3168
|
}],
|
|
3170
3169
|
bubble: [{
|
|
3171
3170
|
id: "comment",
|
|
@@ -3173,25 +3172,25 @@ var So = (e) => {
|
|
|
3173
3172
|
priority: 80,
|
|
3174
3173
|
kind: "button",
|
|
3175
3174
|
readOnly: !0,
|
|
3176
|
-
when: (e) =>
|
|
3177
|
-
render:
|
|
3175
|
+
when: (e) => Ao(e)?.canComment() ?? !1,
|
|
3176
|
+
render: ho
|
|
3178
3177
|
}],
|
|
3179
3178
|
shortcuts: [
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3179
|
+
jo,
|
|
3180
|
+
Mo(1),
|
|
3181
|
+
Mo(-1)
|
|
3183
3182
|
],
|
|
3184
3183
|
markdown: "native"
|
|
3185
3184
|
}) : B({
|
|
3186
3185
|
name: "comments",
|
|
3187
|
-
extensions: () => [
|
|
3186
|
+
extensions: () => [xt],
|
|
3188
3187
|
markdown: "native"
|
|
3189
|
-
}),
|
|
3188
|
+
}), Po = R.create({
|
|
3190
3189
|
name: "nxgtBlockKeys",
|
|
3191
3190
|
addKeyboardShortcuts() {
|
|
3192
3191
|
let e = (e) => () => {
|
|
3193
3192
|
if (!this.editor.isEditable) return !1;
|
|
3194
|
-
let t =
|
|
3193
|
+
let t = Ri(this.editor.state, e);
|
|
3195
3194
|
return t && this.editor.view.dispatch(t), !0;
|
|
3196
3195
|
};
|
|
3197
3196
|
return {
|
|
@@ -3199,9 +3198,9 @@ var So = (e) => {
|
|
|
3199
3198
|
"Alt-Shift-ArrowDown": e(1)
|
|
3200
3199
|
};
|
|
3201
3200
|
}
|
|
3202
|
-
}),
|
|
3201
|
+
}), Fo = () => B({
|
|
3203
3202
|
name: "dragHandle",
|
|
3204
|
-
extensions: () => [
|
|
3203
|
+
extensions: () => [Po],
|
|
3205
3204
|
shortcuts: [{
|
|
3206
3205
|
keys: "Mod-/",
|
|
3207
3206
|
run: ({ chrome: e }) => (e.actions.togglePanel("block"), !0)
|
|
@@ -3210,61 +3209,61 @@ var So = (e) => {
|
|
|
3210
3209
|
});
|
|
3211
3210
|
//#endregion
|
|
3212
3211
|
//#region lib/components/ui/widgets/editor/extensions/find/find-button.tsx
|
|
3213
|
-
function
|
|
3212
|
+
function Io({ editor: e }) {
|
|
3214
3213
|
let { t } = j(), { chrome: n } = k(), r = n.state.panel === "find";
|
|
3215
3214
|
return /* @__PURE__ */ q(p, {
|
|
3216
3215
|
variant: r ? "filled" : "ghost",
|
|
3217
3216
|
"aria-pressed": r,
|
|
3218
3217
|
tooltip: t("material.editor.find.title", "Find and replace"),
|
|
3219
3218
|
onClick: () => r ? n.actions.closePanel() : n.actions.openFind({ replace: !1 }),
|
|
3220
|
-
children: /* @__PURE__ */ q(
|
|
3219
|
+
children: /* @__PURE__ */ q(an, {})
|
|
3221
3220
|
});
|
|
3222
3221
|
}
|
|
3223
3222
|
//#endregion
|
|
3224
3223
|
//#region lib/components/ui/widgets/editor/extensions/find/find-plugin.ts
|
|
3225
|
-
var
|
|
3224
|
+
var Lo = () => new F({
|
|
3226
3225
|
key: X,
|
|
3227
3226
|
state: {
|
|
3228
|
-
init:
|
|
3227
|
+
init: la,
|
|
3229
3228
|
apply(e, t, n) {
|
|
3230
3229
|
let r = e.getMeta(X);
|
|
3231
|
-
return r && "clear" in r ?
|
|
3230
|
+
return r && "clear" in r ? la() : r && "query" in r ? ua(e.doc, r.query, e.selection.from) : r && "current" in r ? {
|
|
3232
3231
|
...t,
|
|
3233
3232
|
current: r.current
|
|
3234
|
-
} : !e.docChanged || !t.term ? t :
|
|
3233
|
+
} : !e.docChanged || !t.term ? t : fa(e, t);
|
|
3235
3234
|
}
|
|
3236
3235
|
},
|
|
3237
3236
|
props: { decorations: (e) => X.getState(e)?.decorations }
|
|
3238
|
-
}),
|
|
3237
|
+
}), Ro = () => {
|
|
3239
3238
|
let e;
|
|
3240
3239
|
return new F({ props: { decorations(t) {
|
|
3241
3240
|
let n = X.getState(t);
|
|
3242
3241
|
if (!n) return;
|
|
3243
3242
|
if (e?.state === n && e.doc === t.doc) return e.set;
|
|
3244
|
-
let r =
|
|
3243
|
+
let r = ca(t.doc, n);
|
|
3245
3244
|
return e = {
|
|
3246
3245
|
state: n,
|
|
3247
3246
|
doc: t.doc,
|
|
3248
3247
|
set: r
|
|
3249
3248
|
}, r;
|
|
3250
3249
|
} } });
|
|
3251
|
-
},
|
|
3250
|
+
}, zo = R.create({
|
|
3252
3251
|
name: "nxgtFind",
|
|
3253
3252
|
addProseMirrorPlugins() {
|
|
3254
|
-
return [
|
|
3253
|
+
return [Lo(), Ro()];
|
|
3255
3254
|
},
|
|
3256
3255
|
addCommands() {
|
|
3257
3256
|
return {
|
|
3258
3257
|
setFind: (e) => ({ tr: t, dispatch: n }) => (n?.(t.setMeta(X, { query: e })), !0),
|
|
3259
3258
|
findStep: (e) => ({ state: t, tr: n, dispatch: r }) => {
|
|
3260
|
-
let { matches: i, current: a } =
|
|
3259
|
+
let { matches: i, current: a } = pa(t), o = ia(i.length, a, e), s = i[o];
|
|
3261
3260
|
if (!s) return !1;
|
|
3262
3261
|
let c = z.create(n.doc, s.from, s.to);
|
|
3263
3262
|
return r?.(n.setSelection(c).scrollIntoView().setMeta(X, { current: o })), !0;
|
|
3264
3263
|
},
|
|
3265
3264
|
replaceCurrent: (e) => ({ editor: t, state: n, tr: r, dispatch: i }) => {
|
|
3266
3265
|
if (!t.isEditable) return !1;
|
|
3267
|
-
let { matches: a, current: o } =
|
|
3266
|
+
let { matches: a, current: o } = pa(n), s = a[o];
|
|
3268
3267
|
if (!s) return !1;
|
|
3269
3268
|
r.insertText(e, s.from, s.to);
|
|
3270
3269
|
let c = s.from + e.length;
|
|
@@ -3272,7 +3271,7 @@ var Io = () => new F({
|
|
|
3272
3271
|
},
|
|
3273
3272
|
replaceAll: (e) => ({ editor: t, state: n, tr: r, dispatch: i }) => {
|
|
3274
3273
|
if (!t.isEditable) return !1;
|
|
3275
|
-
let { matches: a } =
|
|
3274
|
+
let { matches: a } = pa(n);
|
|
3276
3275
|
if (a.length === 0) return !1;
|
|
3277
3276
|
for (let t of [...a].reverse()) r.insertText(e, t.from, t.to);
|
|
3278
3277
|
return i?.(r), !0;
|
|
@@ -3280,36 +3279,36 @@ var Io = () => new F({
|
|
|
3280
3279
|
clearFind: () => ({ tr: e, dispatch: t }) => (t?.(e.setMeta(X, { clear: !0 })), !0)
|
|
3281
3280
|
};
|
|
3282
3281
|
}
|
|
3283
|
-
}),
|
|
3282
|
+
}), Bo = (e) => ({ chrome: t, root: n }) => (t.actions.openFind({ replace: e }), n.querySelector("[data-slot=editor-find] input")?.focus(), !0), Vo = () => B({
|
|
3284
3283
|
name: "find",
|
|
3285
|
-
extensions: () => [
|
|
3284
|
+
extensions: () => [zo],
|
|
3286
3285
|
toolbar: [{
|
|
3287
3286
|
id: "find",
|
|
3288
3287
|
order: 95,
|
|
3289
3288
|
priority: 20,
|
|
3290
3289
|
kind: "button",
|
|
3291
|
-
render:
|
|
3290
|
+
render: Io
|
|
3292
3291
|
}],
|
|
3293
3292
|
shortcuts: [
|
|
3294
3293
|
{
|
|
3295
3294
|
keys: "Mod-f",
|
|
3296
|
-
run:
|
|
3295
|
+
run: Bo(!1),
|
|
3297
3296
|
editable: !0
|
|
3298
3297
|
},
|
|
3299
3298
|
{
|
|
3300
3299
|
keys: "Mod-h",
|
|
3301
|
-
run:
|
|
3300
|
+
run: Bo(!0)
|
|
3302
3301
|
},
|
|
3303
3302
|
{
|
|
3304
3303
|
keys: "Mod-Alt-f",
|
|
3305
|
-
run:
|
|
3304
|
+
run: Bo(!0)
|
|
3306
3305
|
}
|
|
3307
3306
|
],
|
|
3308
3307
|
markdown: "native"
|
|
3309
3308
|
});
|
|
3310
3309
|
//#endregion
|
|
3311
3310
|
//#region lib/components/ui/widgets/editor/extensions/focus-mode/focus-mode-button.tsx
|
|
3312
|
-
function
|
|
3311
|
+
function Ho({ editor: e }) {
|
|
3313
3312
|
let { t } = j(), { chrome: n } = k(), r = n.state.focusMode;
|
|
3314
3313
|
return /* @__PURE__ */ q(p, {
|
|
3315
3314
|
variant: r ? "filled" : "ghost",
|
|
@@ -3318,12 +3317,12 @@ function Vo({ editor: e }) {
|
|
|
3318
3317
|
onClick: () => {
|
|
3319
3318
|
n.actions.toggleFocusMode(), e.commands.focus();
|
|
3320
3319
|
},
|
|
3321
|
-
children: /* @__PURE__ */ q(
|
|
3320
|
+
children: /* @__PURE__ */ q(Bt, {})
|
|
3322
3321
|
});
|
|
3323
3322
|
}
|
|
3324
3323
|
//#endregion
|
|
3325
3324
|
//#region lib/components/ui/widgets/editor/kit/features/focus-mode.ts
|
|
3326
|
-
var
|
|
3325
|
+
var Uo = () => B({
|
|
3327
3326
|
name: "focusMode",
|
|
3328
3327
|
extensions: () => [],
|
|
3329
3328
|
requires: ["marks"],
|
|
@@ -3332,7 +3331,7 @@ var Ho = () => B({
|
|
|
3332
3331
|
order: 98,
|
|
3333
3332
|
priority: 10,
|
|
3334
3333
|
kind: "button",
|
|
3335
|
-
render:
|
|
3334
|
+
render: Ho
|
|
3336
3335
|
}],
|
|
3337
3336
|
shortcuts: [{
|
|
3338
3337
|
keys: "Mod-Shift-f",
|
|
@@ -3342,7 +3341,7 @@ var Ho = () => B({
|
|
|
3342
3341
|
});
|
|
3343
3342
|
//#endregion
|
|
3344
3343
|
//#region lib/components/ui/widgets/editor/extensions/marks/inline-code-button.tsx
|
|
3345
|
-
function
|
|
3344
|
+
function Wo({ editor: e }) {
|
|
3346
3345
|
let { t } = j(), n = P({
|
|
3347
3346
|
editor: e,
|
|
3348
3347
|
selector: (e) => ({
|
|
@@ -3356,12 +3355,12 @@ function Uo({ editor: e }) {
|
|
|
3356
3355
|
tooltip: t("material.editor.code", "Inline code"),
|
|
3357
3356
|
onClick: () => e.chain().focus().toggleCode().run(),
|
|
3358
3357
|
disabled: !n.canCode,
|
|
3359
|
-
children: /* @__PURE__ */ q(
|
|
3358
|
+
children: /* @__PURE__ */ q(It, {})
|
|
3360
3359
|
});
|
|
3361
3360
|
}
|
|
3362
3361
|
//#endregion
|
|
3363
3362
|
//#region lib/components/ui/widgets/editor/kit/features/inline-code.ts
|
|
3364
|
-
var
|
|
3363
|
+
var Go = () => B({
|
|
3365
3364
|
name: "inlineCode",
|
|
3366
3365
|
extensions: () => [],
|
|
3367
3366
|
toolbar: [{
|
|
@@ -3369,67 +3368,67 @@ var Wo = () => B({
|
|
|
3369
3368
|
order: 12,
|
|
3370
3369
|
priority: 60,
|
|
3371
3370
|
kind: "toggle",
|
|
3372
|
-
render:
|
|
3371
|
+
render: Wo
|
|
3373
3372
|
}],
|
|
3374
3373
|
bubble: [{
|
|
3375
3374
|
id: "inline-code",
|
|
3376
3375
|
order: 12,
|
|
3377
3376
|
priority: 60,
|
|
3378
3377
|
kind: "toggle",
|
|
3379
|
-
render:
|
|
3378
|
+
render: Wo
|
|
3380
3379
|
}],
|
|
3381
3380
|
requires: ["marks"],
|
|
3382
3381
|
markdown: "native"
|
|
3383
|
-
}),
|
|
3382
|
+
}), Ko = R.create({
|
|
3384
3383
|
name: "markdownPaste",
|
|
3385
3384
|
addProseMirrorPlugins() {
|
|
3386
3385
|
let { editor: e } = this, t = !1;
|
|
3387
3386
|
return [new F({
|
|
3388
|
-
key: new
|
|
3387
|
+
key: new lt("markdownPaste"),
|
|
3389
3388
|
props: {
|
|
3390
3389
|
handleKeyDown: (e, n) => (t = n.shiftKey && (n.metaKey || n.ctrlKey) && n.key.toLowerCase() === "v", !1),
|
|
3391
3390
|
handleDOMEvents: { keyup: () => (t = !1, !1) },
|
|
3392
3391
|
handlePaste: (n, r) => {
|
|
3393
3392
|
let i = r.clipboardData, a = i?.getData("text/plain") ?? "", o = t;
|
|
3394
|
-
return t = !1, o || !a || i?.getData("text/html") || n.state.selection.$from.parent.type.spec.code || !
|
|
3393
|
+
return t = !1, o || !a || i?.getData("text/html") || n.state.selection.$from.parent.type.spec.code || !Ha(a) ? !1 : (dt().then((t) => {
|
|
3395
3394
|
if (e.isDestroyed) return;
|
|
3396
|
-
let n = e.extensionManager.extensions, r =
|
|
3395
|
+
let n = e.extensionManager.extensions, r = St(t.parse(a, n), n);
|
|
3397
3396
|
e.commands.insertContent(r.content ?? []);
|
|
3398
3397
|
}).catch(() => {
|
|
3399
|
-
e.isDestroyed || e.commands.insertContent(
|
|
3398
|
+
e.isDestroyed || e.commands.insertContent(qo(a));
|
|
3400
3399
|
}), !0);
|
|
3401
3400
|
}
|
|
3402
3401
|
}
|
|
3403
3402
|
})];
|
|
3404
3403
|
}
|
|
3405
|
-
}),
|
|
3404
|
+
}), qo = (e) => e.split(/\r?\n\s*\r?\n/).filter((e) => e.length > 0).map((e) => ({
|
|
3406
3405
|
type: "paragraph",
|
|
3407
3406
|
content: [{
|
|
3408
3407
|
type: "text",
|
|
3409
3408
|
text: e
|
|
3410
3409
|
}]
|
|
3411
|
-
})),
|
|
3410
|
+
})), Jo = () => B({
|
|
3412
3411
|
name: "markdownPaste",
|
|
3413
|
-
extensions: () => [
|
|
3412
|
+
extensions: () => [Ko],
|
|
3414
3413
|
markdown: "native"
|
|
3415
3414
|
});
|
|
3416
3415
|
//#endregion
|
|
3417
3416
|
//#region lib/components/ui/widgets/editor/extensions/outline/outline-button.tsx
|
|
3418
|
-
function
|
|
3417
|
+
function Yo({ editor: e }) {
|
|
3419
3418
|
let { t } = j(), { chrome: n } = k(), r = n.state.panel === "outline";
|
|
3420
3419
|
return /* @__PURE__ */ q(p, {
|
|
3421
3420
|
variant: r ? "filled" : "ghost",
|
|
3422
3421
|
"aria-pressed": r,
|
|
3423
3422
|
tooltip: t("material.editor.outline", "Outline"),
|
|
3424
3423
|
onClick: (t) => {
|
|
3425
|
-
n.actions.togglePanel("outline"), r &&
|
|
3424
|
+
n.actions.togglePanel("outline"), r && mo(t, e);
|
|
3426
3425
|
},
|
|
3427
|
-
children: /* @__PURE__ */ q(
|
|
3426
|
+
children: /* @__PURE__ */ q(un, {})
|
|
3428
3427
|
});
|
|
3429
3428
|
}
|
|
3430
3429
|
//#endregion
|
|
3431
3430
|
//#region lib/components/ui/widgets/editor/kit/features/outline.ts
|
|
3432
|
-
var
|
|
3431
|
+
var Xo = () => B({
|
|
3433
3432
|
name: "outline",
|
|
3434
3433
|
extensions: () => [],
|
|
3435
3434
|
toolbar: [{
|
|
@@ -3437,13 +3436,13 @@ var Yo = () => B({
|
|
|
3437
3436
|
order: 96,
|
|
3438
3437
|
priority: 15,
|
|
3439
3438
|
kind: "panel",
|
|
3440
|
-
render:
|
|
3439
|
+
render: Yo
|
|
3441
3440
|
}],
|
|
3442
3441
|
markdown: "native"
|
|
3443
3442
|
});
|
|
3444
3443
|
//#endregion
|
|
3445
3444
|
//#region lib/components/ui/widgets/editor/extensions/upload/image-alt-button.tsx
|
|
3446
|
-
function
|
|
3445
|
+
function Zo({ editor: e }) {
|
|
3447
3446
|
let { t } = j(), n = P({
|
|
3448
3447
|
editor: e,
|
|
3449
3448
|
selector: (e) => e.editor.getAttributes("image").alt ?? ""
|
|
@@ -3462,12 +3461,12 @@ function Xo({ editor: e }) {
|
|
|
3462
3461
|
"aria-label": l,
|
|
3463
3462
|
className: "rounded size-7",
|
|
3464
3463
|
more: { kind: "dialog" },
|
|
3465
|
-
children: /* @__PURE__ */ q(
|
|
3464
|
+
children: /* @__PURE__ */ q(dn, {})
|
|
3466
3465
|
})
|
|
3467
3466
|
}), /* @__PURE__ */ J(je, {
|
|
3468
3467
|
className: "flex size-max flex-col gap-2 p-2",
|
|
3469
3468
|
onCloseAutoFocus: c,
|
|
3470
|
-
children: [/* @__PURE__ */ q(
|
|
3469
|
+
children: [/* @__PURE__ */ q(nt, {
|
|
3471
3470
|
value: r,
|
|
3472
3471
|
label: t("material.editor.upload.alt-label", "Describe the image"),
|
|
3473
3472
|
onChange: (e) => i(e.target.value)
|
|
@@ -3483,43 +3482,43 @@ function Xo({ editor: e }) {
|
|
|
3483
3482
|
}
|
|
3484
3483
|
//#endregion
|
|
3485
3484
|
//#region lib/components/ui/widgets/editor/extensions/upload/announce.ts
|
|
3486
|
-
var
|
|
3485
|
+
var Qo = 1200, Z = null, $o = 0, es = [], ts = !1, Q = [], ns = (e, t) => {
|
|
3487
3486
|
let n = setTimeout(() => {
|
|
3488
3487
|
Q = Q.filter((e) => e !== n), e();
|
|
3489
3488
|
}, t);
|
|
3490
3489
|
Q.push(n);
|
|
3491
3490
|
};
|
|
3492
|
-
function
|
|
3491
|
+
function rs() {
|
|
3493
3492
|
return typeof document > "u" ? null : (Z?.isConnected || (Z = document.createElement("div"), Z.setAttribute("role", "status"), Z.setAttribute("aria-live", "polite"), Z.setAttribute("data-slot", "editor-upload-status"), Z.className = "sr-only", document.body.append(Z)), Z);
|
|
3494
3493
|
}
|
|
3495
|
-
function
|
|
3496
|
-
let e =
|
|
3494
|
+
function is() {
|
|
3495
|
+
let e = es.shift(), t = e === void 0 ? null : rs();
|
|
3497
3496
|
if (e === void 0 || !t) {
|
|
3498
|
-
|
|
3497
|
+
ts = !1;
|
|
3499
3498
|
return;
|
|
3500
3499
|
}
|
|
3501
|
-
|
|
3500
|
+
ts = !0, t.textContent = "", ns(() => {
|
|
3502
3501
|
t.textContent = e;
|
|
3503
|
-
}, 30),
|
|
3502
|
+
}, 30), ns(is, Qo);
|
|
3504
3503
|
}
|
|
3505
|
-
function
|
|
3506
|
-
|
|
3504
|
+
function as(e) {
|
|
3505
|
+
$o === 0 || typeof document > "u" || (es.push(e), ts || is());
|
|
3507
3506
|
}
|
|
3508
|
-
function
|
|
3509
|
-
|
|
3507
|
+
function os() {
|
|
3508
|
+
$o += 1;
|
|
3510
3509
|
let e = !1;
|
|
3511
3510
|
return () => {
|
|
3512
|
-
if (!e && (e = !0,
|
|
3511
|
+
if (!e && (e = !0, --$o, !($o > 0))) {
|
|
3513
3512
|
for (let e of Q) clearTimeout(e);
|
|
3514
|
-
Q = [],
|
|
3513
|
+
Q = [], es = [], ts = !1, Z?.remove(), Z = null;
|
|
3515
3514
|
}
|
|
3516
3515
|
};
|
|
3517
3516
|
}
|
|
3518
3517
|
//#endregion
|
|
3519
3518
|
//#region lib/components/ui/widgets/editor/extensions/upload/upload-widgets.ts
|
|
3520
|
-
var
|
|
3519
|
+
var ss = /* @__PURE__ */ new WeakMap(), cs = (e, t) => L.widget(e, () => {
|
|
3521
3520
|
let { element: e, destroy: n } = t.build(t.id);
|
|
3522
|
-
return
|
|
3521
|
+
return ss.set(e, n), e;
|
|
3523
3522
|
}, {
|
|
3524
3523
|
id: t.id,
|
|
3525
3524
|
replaceEmpty: t.replaceEmpty,
|
|
@@ -3528,31 +3527,31 @@ var os = /* @__PURE__ */ new WeakMap(), ss = (e, t) => L.widget(e, () => {
|
|
|
3528
3527
|
key: t.id,
|
|
3529
3528
|
ignoreSelection: !0,
|
|
3530
3529
|
stopEvent: () => !0,
|
|
3531
|
-
destroy: (e) =>
|
|
3532
|
-
}),
|
|
3530
|
+
destroy: (e) => ss.get(e)?.()
|
|
3531
|
+
}), ls = {
|
|
3533
3532
|
cards: [],
|
|
3534
3533
|
decorations: I.empty,
|
|
3535
3534
|
orphaned: []
|
|
3536
|
-
},
|
|
3535
|
+
}, us = (e, t) => t.length ? I.create(e, t.map((e) => cs(e.pos, e))) : I.empty, ds = (e) => e.steps.some((t, n) => t instanceof st && t.from === 0 && t.to === e.docs[n].content.size), fs = (e) => {
|
|
3537
3536
|
let t = !1;
|
|
3538
3537
|
return e.content.descendants((e) => ((e.isText || e.isLeaf) && (t = !0), !t)), t;
|
|
3539
3538
|
};
|
|
3540
|
-
function
|
|
3539
|
+
function ps(e, t, n) {
|
|
3541
3540
|
let r = e.docs[t], i = !1;
|
|
3542
3541
|
return e.steps[t]?.getMap().forEach((e, t) => {
|
|
3543
|
-
n <= e || n >= t ||
|
|
3542
|
+
n <= e || n >= t || fs(r.slice(e, n)) && fs(r.slice(n, t)) && (i = !0);
|
|
3544
3543
|
}), i;
|
|
3545
3544
|
}
|
|
3546
|
-
function
|
|
3545
|
+
function ms(e, t) {
|
|
3547
3546
|
let n = e.resolve(Math.max(0, Math.min(t, e.content.size)));
|
|
3548
3547
|
return n.parent.inlineContent ? n.parentOffset === 0 ? n.before() : n.after() : n.pos;
|
|
3549
3548
|
}
|
|
3550
|
-
function
|
|
3549
|
+
function hs(e, t, n) {
|
|
3551
3550
|
if (!t.docChanged) return {
|
|
3552
3551
|
cards: e,
|
|
3553
3552
|
orphaned: []
|
|
3554
3553
|
};
|
|
3555
|
-
let r =
|
|
3554
|
+
let r = Ga(t), i = !n && !r && ds(t), a = [], o = [];
|
|
3556
3555
|
for (let s of e) {
|
|
3557
3556
|
if (n && s.pos === n.card.pos) {
|
|
3558
3557
|
let e = s.side > n.card.side;
|
|
@@ -3566,14 +3565,14 @@ function ms(e, t, n) {
|
|
|
3566
3565
|
if (r) {
|
|
3567
3566
|
a.push({
|
|
3568
3567
|
...s,
|
|
3569
|
-
pos:
|
|
3568
|
+
pos: ms(t.doc, s.pos)
|
|
3570
3569
|
});
|
|
3571
3570
|
continue;
|
|
3572
3571
|
}
|
|
3573
3572
|
let e = s.pos, c = i, l = !1;
|
|
3574
3573
|
for (let n = 0; n < t.steps.length && !c; n += 1) {
|
|
3575
3574
|
let r = t.steps[n].getMap();
|
|
3576
|
-
c =
|
|
3575
|
+
c = ps(t, n, e), r.forEach((t, n, r, i) => {
|
|
3577
3576
|
t === e && n > t && r === i && (l = !0);
|
|
3578
3577
|
}), e = r.map(e, -1);
|
|
3579
3578
|
}
|
|
@@ -3584,7 +3583,7 @@ function ms(e, t, n) {
|
|
|
3584
3583
|
a.push({
|
|
3585
3584
|
...s,
|
|
3586
3585
|
replaceEmpty: s.replaceEmpty && !l,
|
|
3587
|
-
pos:
|
|
3586
|
+
pos: ms(t.doc, e)
|
|
3588
3587
|
});
|
|
3589
3588
|
}
|
|
3590
3589
|
return {
|
|
@@ -3592,15 +3591,15 @@ function ms(e, t, n) {
|
|
|
3592
3591
|
orphaned: o
|
|
3593
3592
|
};
|
|
3594
3593
|
}
|
|
3595
|
-
function
|
|
3594
|
+
function gs(e, t, n) {
|
|
3596
3595
|
if (n && "place" in n) {
|
|
3597
3596
|
let r = e.cards.map((e) => e.id in n.place ? {
|
|
3598
3597
|
...e,
|
|
3599
|
-
pos:
|
|
3598
|
+
pos: ms(t.doc, n.place[e.id])
|
|
3600
3599
|
} : e);
|
|
3601
3600
|
return {
|
|
3602
3601
|
cards: r,
|
|
3603
|
-
decorations:
|
|
3602
|
+
decorations: us(t.doc, r),
|
|
3604
3603
|
orphaned: []
|
|
3605
3604
|
};
|
|
3606
3605
|
}
|
|
@@ -3608,30 +3607,30 @@ function hs(e, t, n) {
|
|
|
3608
3607
|
...e,
|
|
3609
3608
|
orphaned: []
|
|
3610
3609
|
} : e;
|
|
3611
|
-
let r = n && "land" in n ? n.land : void 0, i = r && e.cards.find((e) => e.id === r.id), a =
|
|
3610
|
+
let r = n && "land" in n ? n.land : void 0, i = r && e.cards.find((e) => e.id === r.id), a = hs(e.cards.filter((e) => e.id !== r?.id), t, i && r ? {
|
|
3612
3611
|
card: i,
|
|
3613
3612
|
end: r.end
|
|
3614
3613
|
} : void 0), o = a.cards;
|
|
3615
3614
|
return n && "add" in n && (o = [...o, n.add]), n && "remove" in n && (o = o.filter((e) => e.id !== n.remove)), {
|
|
3616
3615
|
cards: o,
|
|
3617
|
-
decorations:
|
|
3616
|
+
decorations: us(t.doc, o),
|
|
3618
3617
|
orphaned: a.orphaned
|
|
3619
3618
|
};
|
|
3620
3619
|
}
|
|
3621
3620
|
//#endregion
|
|
3622
3621
|
//#region lib/components/ui/widgets/editor/extensions/upload/upload-focus.ts
|
|
3623
|
-
function
|
|
3622
|
+
function _s(e, t) {
|
|
3624
3623
|
return e.isDestroyed || typeof document > "u" ? !1 : !!e.view.dom.querySelector(`[data-upload-id="${t}"]`)?.contains(document.activeElement);
|
|
3625
3624
|
}
|
|
3626
|
-
function
|
|
3625
|
+
function vs(e, t) {
|
|
3627
3626
|
if (e.isDestroyed) return;
|
|
3628
|
-
let { doc: n } = e.state, r = n.resolve(Math.max(0, Math.min(t, n.content.size))), i =
|
|
3627
|
+
let { doc: n } = e.state, r = n.resolve(Math.max(0, Math.min(t, n.content.size))), i = ct.findFrom(r, 1, !0) ?? ct.findFrom(r, -1, !0) ?? ct.near(r, -1);
|
|
3629
3628
|
e.view.dispatch(e.state.tr.setSelection(i)), e.commands.focus();
|
|
3630
3629
|
}
|
|
3631
3630
|
//#endregion
|
|
3632
3631
|
//#region lib/components/ui/widgets/editor/extensions/upload/upload-plugin.ts
|
|
3633
|
-
var $ = new
|
|
3634
|
-
function
|
|
3632
|
+
var $ = new lt("upload");
|
|
3633
|
+
function ys(e, t) {
|
|
3635
3634
|
let n = e.doc.resolve(Math.min(t ?? e.selection.to, e.doc.content.size)), r = n.parent;
|
|
3636
3635
|
return !r.isTextblock || n.depth === 0 ? {
|
|
3637
3636
|
pos: n.pos,
|
|
@@ -3644,22 +3643,22 @@ function vs(e, t) {
|
|
|
3644
3643
|
replaceEmpty: !1
|
|
3645
3644
|
};
|
|
3646
3645
|
}
|
|
3647
|
-
var
|
|
3646
|
+
var bs = (e, t) => {
|
|
3648
3647
|
let n = $.getState(e)?.cards.find((e) => e.id === t);
|
|
3649
3648
|
return n && {
|
|
3650
3649
|
from: n.pos,
|
|
3651
3650
|
spec: n
|
|
3652
3651
|
};
|
|
3653
|
-
},
|
|
3652
|
+
}, xs = (e) => ({ add: e }), Ss = (e) => ({ remove: e }), Cs = (e, t) => ({ land: {
|
|
3654
3653
|
id: e,
|
|
3655
3654
|
end: t
|
|
3656
3655
|
} });
|
|
3657
|
-
function
|
|
3656
|
+
function ws({ onFiles: e, onOrphans: t }) {
|
|
3658
3657
|
return new F({
|
|
3659
3658
|
key: $,
|
|
3660
3659
|
state: {
|
|
3661
|
-
init: () =>
|
|
3662
|
-
apply: (e, t) =>
|
|
3660
|
+
init: () => ls,
|
|
3661
|
+
apply: (e, t) => gs(t, e, e.getMeta($))
|
|
3663
3662
|
},
|
|
3664
3663
|
view: () => ({ update(e, n) {
|
|
3665
3664
|
let r = $.getState(e.state);
|
|
@@ -3683,22 +3682,22 @@ function Cs({ onFiles: e, onOrphans: t }) {
|
|
|
3683
3682
|
}
|
|
3684
3683
|
//#endregion
|
|
3685
3684
|
//#region lib/components/ui/widgets/editor/extensions/upload/validate-upload.ts
|
|
3686
|
-
var
|
|
3687
|
-
function
|
|
3688
|
-
let n =
|
|
3685
|
+
var Ts = (e) => (typeof e == "string" ? e.split(",") : [...e ?? []]).map((e) => e.trim().toLowerCase()).filter(Boolean);
|
|
3686
|
+
function Es(e, t) {
|
|
3687
|
+
let n = Ts(t);
|
|
3689
3688
|
if (!n.length) return !0;
|
|
3690
3689
|
let r = e.type.toLowerCase(), i = e.name.toLowerCase();
|
|
3691
3690
|
return n.some((e) => e === "*" || e === "*/*" ? !0 : e.startsWith(".") ? i.endsWith(e) : e.endsWith("/*") ? r.startsWith(e.slice(0, -1)) : r === e);
|
|
3692
3691
|
}
|
|
3693
|
-
function
|
|
3694
|
-
return
|
|
3692
|
+
function Ds(e, { accept: t = "image/*", maxSize: n }) {
|
|
3693
|
+
return Es(e, t) ? n !== void 0 && e.size > n ? "size" : null : "type";
|
|
3695
3694
|
}
|
|
3696
|
-
var
|
|
3697
|
-
function
|
|
3698
|
-
let t =
|
|
3695
|
+
var Os = /\.(avif|bmp|gif|jpe?g|png|svg|webp)$/i, ks = (e) => e.type ? e.type.startsWith("image/") : Os.test(e.name);
|
|
3696
|
+
function As(e) {
|
|
3697
|
+
let t = mt(e);
|
|
3699
3698
|
return t !== void 0 && !/^(mailto|tel):/i.test(t);
|
|
3700
3699
|
}
|
|
3701
|
-
function
|
|
3700
|
+
function js(e) {
|
|
3702
3701
|
let t = [
|
|
3703
3702
|
"B",
|
|
3704
3703
|
"KB",
|
|
@@ -3710,17 +3709,17 @@ function As(e) {
|
|
|
3710
3709
|
}
|
|
3711
3710
|
//#endregion
|
|
3712
3711
|
//#region lib/components/ui/widgets/editor/extensions/upload/insert-upload.ts
|
|
3713
|
-
var
|
|
3714
|
-
function
|
|
3715
|
-
if (
|
|
3712
|
+
var Ms = (e) => typeof e == "number" && Number.isFinite(e) && e > 0;
|
|
3713
|
+
function Ns(e, t, n) {
|
|
3714
|
+
if (ks(t) && e.schema.nodes.image) {
|
|
3716
3715
|
let { src: e, alt: t, width: r, height: i } = n;
|
|
3717
3716
|
return {
|
|
3718
3717
|
type: "image",
|
|
3719
3718
|
attrs: {
|
|
3720
3719
|
src: e,
|
|
3721
3720
|
...t !== void 0 && { alt: t },
|
|
3722
|
-
...
|
|
3723
|
-
...
|
|
3721
|
+
...Ms(r) && { width: r },
|
|
3722
|
+
...Ms(i) && { height: i }
|
|
3724
3723
|
}
|
|
3725
3724
|
};
|
|
3726
3725
|
}
|
|
@@ -3740,38 +3739,38 @@ function Ms(e, t, n) {
|
|
|
3740
3739
|
}]
|
|
3741
3740
|
};
|
|
3742
3741
|
}
|
|
3743
|
-
var
|
|
3744
|
-
function
|
|
3742
|
+
var Ps = (e) => !!(e?.isTextblock && e.content.size === 0);
|
|
3743
|
+
function Fs(e, t, n, r) {
|
|
3745
3744
|
if (e.isDestroyed) return;
|
|
3746
|
-
let { state: i } = e, a =
|
|
3745
|
+
let { state: i } = e, a = bs(i, t);
|
|
3747
3746
|
if (!a) return;
|
|
3748
|
-
let o =
|
|
3747
|
+
let o = _s(e, t), s = a.from;
|
|
3749
3748
|
try {
|
|
3750
|
-
let o = e.schema.nodeFromJSON(
|
|
3751
|
-
s = f.mapping.map(d, 1), e.view.dispatch(f.setMeta($,
|
|
3749
|
+
let o = e.schema.nodeFromJSON(Ns(e, n, r)), c = i.doc.nodeAt(a.from), l = a.spec.replaceEmpty && Ps(c), u = l ? a.from : ot(i.doc, a.from, o.type) ?? ms(i.doc, a.from), d = l ? u + (c?.nodeSize ?? 0) : u, f = i.tr.replaceWith(u, d, o);
|
|
3750
|
+
s = f.mapping.map(d, 1), e.view.dispatch(f.setMeta($, Cs(t, s)));
|
|
3752
3751
|
} catch {
|
|
3753
|
-
e.view.dispatch(i.tr.setMeta($,
|
|
3752
|
+
e.view.dispatch(i.tr.setMeta($, Ss(t)));
|
|
3754
3753
|
}
|
|
3755
|
-
o &&
|
|
3754
|
+
o && vs(e, s);
|
|
3756
3755
|
}
|
|
3757
3756
|
//#endregion
|
|
3758
3757
|
//#region lib/components/ui/widgets/editor/extensions/upload/pick-files.ts
|
|
3759
|
-
var
|
|
3760
|
-
function
|
|
3761
|
-
|
|
3758
|
+
var Is = null;
|
|
3759
|
+
function Ls({ accept: e, multiple: t, label: n }, r) {
|
|
3760
|
+
Is?.remove();
|
|
3762
3761
|
let i = document.createElement("input");
|
|
3763
3762
|
i.type = "file", i.hidden = !0, i.multiple = t, i.setAttribute("aria-label", n), i.setAttribute("data-slot", "editor-upload-input"), e && (i.accept = typeof e == "string" ? e : e.join(","));
|
|
3764
3763
|
let a = () => {
|
|
3765
|
-
i.remove(),
|
|
3764
|
+
i.remove(), Is === i && (Is = null);
|
|
3766
3765
|
};
|
|
3767
3766
|
i.addEventListener("change", () => {
|
|
3768
3767
|
let e = Array.from(i.files ?? []);
|
|
3769
3768
|
a(), e.length && r(e);
|
|
3770
|
-
}), i.addEventListener("cancel", a), document.body.append(i),
|
|
3769
|
+
}), i.addEventListener("cancel", a), document.body.append(i), Is = i, i.click();
|
|
3771
3770
|
}
|
|
3772
3771
|
//#endregion
|
|
3773
3772
|
//#region lib/components/ui/widgets/editor/extensions/upload/upload-actions.tsx
|
|
3774
|
-
function
|
|
3773
|
+
function Rs({ id: e, name: t, failed: n, retryable: r, storage: i }) {
|
|
3775
3774
|
let { t: a } = j(), o = n ? a("material.editor.upload.remove", "Remove {name}", { name: t }) : a("material.editor.upload.cancel", "Cancel upload of {name}", { name: t });
|
|
3776
3775
|
return /* @__PURE__ */ J("div", {
|
|
3777
3776
|
className: "ms-auto flex shrink-0 items-center gap-1",
|
|
@@ -3779,26 +3778,26 @@ function Ls({ id: e, name: t, failed: n, retryable: r, storage: i }) {
|
|
|
3779
3778
|
variant: "tonal",
|
|
3780
3779
|
size: "sm",
|
|
3781
3780
|
onClick: () => i.retry(e),
|
|
3782
|
-
children: [/* @__PURE__ */ q(
|
|
3781
|
+
children: [/* @__PURE__ */ q(rn, {}), a("material.editor.upload.retry", "Retry")]
|
|
3783
3782
|
}), /* @__PURE__ */ q(N, {
|
|
3784
3783
|
variant: "ghost",
|
|
3785
3784
|
tooltip: o,
|
|
3786
3785
|
"aria-label": o,
|
|
3787
3786
|
onClick: () => i.cancel(e),
|
|
3788
|
-
children: q(n ?
|
|
3787
|
+
children: q(n ? pn : gn, {})
|
|
3789
3788
|
})]
|
|
3790
3789
|
});
|
|
3791
3790
|
}
|
|
3792
3791
|
//#endregion
|
|
3793
3792
|
//#region lib/components/ui/widgets/editor/extensions/upload/upload-thumb.tsx
|
|
3794
|
-
function
|
|
3793
|
+
function zs({ previewUrl: e, busy: n }) {
|
|
3795
3794
|
return /* @__PURE__ */ J("div", {
|
|
3796
3795
|
className: "relative grid size-12 shrink-0 place-items-center overflow-hidden rounded-md bg-muted text-muted-foreground",
|
|
3797
3796
|
children: [e ? /* @__PURE__ */ q("img", {
|
|
3798
3797
|
src: e,
|
|
3799
3798
|
alt: "",
|
|
3800
3799
|
className: t("size-full object-cover", n && "opacity-50")
|
|
3801
|
-
}) : /* @__PURE__ */ q(
|
|
3800
|
+
}) : /* @__PURE__ */ q(zt, {
|
|
3802
3801
|
"aria-hidden": "true",
|
|
3803
3802
|
className: "size-5"
|
|
3804
3803
|
}), n && /* @__PURE__ */ q(we, {
|
|
@@ -3811,16 +3810,16 @@ function Rs({ previewUrl: e, busy: n }) {
|
|
|
3811
3810
|
}
|
|
3812
3811
|
//#endregion
|
|
3813
3812
|
//#region lib/components/ui/widgets/editor/extensions/upload/upload-card.tsx
|
|
3814
|
-
function
|
|
3813
|
+
function Bs(e, t, n) {
|
|
3815
3814
|
switch (t) {
|
|
3816
3815
|
case "type": return e("material.editor.upload.type-not-accepted", "This file type is not accepted.");
|
|
3817
|
-
case "size": return e("material.editor.upload.too-large", "The file is larger than {max}.", { max:
|
|
3816
|
+
case "size": return e("material.editor.upload.too-large", "The file is larger than {max}.", { max: js(n ?? 0) });
|
|
3818
3817
|
case "invalid": return e("material.editor.upload.invalid-address", "The server did not return a usable address.");
|
|
3819
3818
|
default: return e("material.editor.upload.failed", "Upload failed. Try again.");
|
|
3820
3819
|
}
|
|
3821
3820
|
}
|
|
3822
|
-
function
|
|
3823
|
-
let { t: i } = j(), { queue: a } = n, o =
|
|
3821
|
+
function Vs({ id: e, storage: n, maxSize: r }) {
|
|
3822
|
+
let { t: i } = j(), { queue: a } = n, o = xn(a.subscribe, () => a.get(e), () => void 0);
|
|
3824
3823
|
if (!o) return null;
|
|
3825
3824
|
let s = o.file.name, c = o.status === "error";
|
|
3826
3825
|
return /* @__PURE__ */ J("div", {
|
|
@@ -3832,7 +3831,7 @@ function Bs({ id: e, storage: n, maxSize: r }) {
|
|
|
3832
3831
|
contentEditable: !1,
|
|
3833
3832
|
className: t("not-prose my-3 flex flex-wrap items-center gap-x-3 gap-y-2 rounded-lg border bg-card p-2.5 text-card-foreground shadow-xs", c && "border-error/60 bg-error/5"),
|
|
3834
3833
|
children: [
|
|
3835
|
-
/* @__PURE__ */ q(
|
|
3834
|
+
/* @__PURE__ */ q(zs, {
|
|
3836
3835
|
previewUrl: o.previewUrl,
|
|
3837
3836
|
busy: !c
|
|
3838
3837
|
}),
|
|
@@ -3844,14 +3843,14 @@ function Bs({ id: e, storage: n, maxSize: r }) {
|
|
|
3844
3843
|
}), c ? /* @__PURE__ */ q("div", {
|
|
3845
3844
|
role: "alert",
|
|
3846
3845
|
className: "text-xs text-error-text",
|
|
3847
|
-
children:
|
|
3846
|
+
children: Bs(i, o.failure, r)
|
|
3848
3847
|
}) : /* @__PURE__ */ q(ee, {
|
|
3849
3848
|
value: o.progress === void 0 ? null : o.progress * 100,
|
|
3850
3849
|
"aria-label": i("material.editor.upload.uploading", "Uploading {name}", { name: s }),
|
|
3851
3850
|
className: "mt-1.5"
|
|
3852
3851
|
})]
|
|
3853
3852
|
}),
|
|
3854
|
-
/* @__PURE__ */ q(
|
|
3853
|
+
/* @__PURE__ */ q(Rs, {
|
|
3855
3854
|
id: e,
|
|
3856
3855
|
name: s,
|
|
3857
3856
|
failed: c,
|
|
@@ -3863,8 +3862,8 @@ function Bs({ id: e, storage: n, maxSize: r }) {
|
|
|
3863
3862
|
}
|
|
3864
3863
|
//#endregion
|
|
3865
3864
|
//#region lib/components/ui/widgets/editor/extensions/upload/upload-widget.tsx
|
|
3866
|
-
function
|
|
3867
|
-
let i = new
|
|
3865
|
+
function Hs(e, t, n, r) {
|
|
3866
|
+
let i = new $e(Vs, {
|
|
3868
3867
|
editor: e,
|
|
3869
3868
|
props: {
|
|
3870
3869
|
id: r,
|
|
@@ -3880,48 +3879,48 @@ function Vs(e, t, n, r) {
|
|
|
3880
3879
|
}
|
|
3881
3880
|
//#endregion
|
|
3882
3881
|
//#region lib/components/ui/widgets/editor/extensions/upload/upload-controls.ts
|
|
3883
|
-
var
|
|
3884
|
-
function
|
|
3882
|
+
var Us = 0;
|
|
3883
|
+
function Ws(e, t, n) {
|
|
3885
3884
|
let { editor: r, storage: i, queue: a, accept: o, maxSize: s, multiple: c } = e;
|
|
3886
3885
|
if (!r.isEditable || r.isDestroyed) return;
|
|
3887
|
-
let l =
|
|
3886
|
+
let l = ys(r.state, n);
|
|
3888
3887
|
for (let e of c ? t : t.slice(0, 1)) {
|
|
3889
|
-
let t = a.add(e,
|
|
3888
|
+
let t = a.add(e, Ds(e, {
|
|
3890
3889
|
accept: o,
|
|
3891
3890
|
maxSize: s
|
|
3892
3891
|
}) ?? void 0);
|
|
3893
|
-
|
|
3892
|
+
Us += 1, r.view.dispatch(r.state.tr.setMeta($, xs({
|
|
3894
3893
|
...l,
|
|
3895
3894
|
id: t.id,
|
|
3896
|
-
side:
|
|
3897
|
-
build: (e) =>
|
|
3895
|
+
side: Us,
|
|
3896
|
+
build: (e) => Hs(r, i, s, e)
|
|
3898
3897
|
})));
|
|
3899
3898
|
}
|
|
3900
3899
|
}
|
|
3901
|
-
function
|
|
3900
|
+
function Gs(e, t) {
|
|
3902
3901
|
let { editor: n, queue: r } = e;
|
|
3903
3902
|
if (n.isDestroyed) {
|
|
3904
3903
|
r.cancel(t);
|
|
3905
3904
|
return;
|
|
3906
3905
|
}
|
|
3907
|
-
let i =
|
|
3908
|
-
r.cancel(t), n.view.dispatch(n.state.tr.setMeta($,
|
|
3906
|
+
let i = bs(n.state, t)?.from, a = _s(n, t);
|
|
3907
|
+
r.cancel(t), n.view.dispatch(n.state.tr.setMeta($, Ss(t))), a && i !== void 0 && vs(n, i);
|
|
3909
3908
|
}
|
|
3910
|
-
function
|
|
3909
|
+
function Ks(e, t) {
|
|
3911
3910
|
let { accept: n, multiple: r, translate: i } = e;
|
|
3912
|
-
|
|
3911
|
+
Ls({
|
|
3913
3912
|
accept: n,
|
|
3914
3913
|
multiple: r,
|
|
3915
3914
|
label: i("material.editor.upload.upload-image", "Upload an image")
|
|
3916
|
-
}, (n) =>
|
|
3915
|
+
}, (n) => Ws(e, n, t));
|
|
3917
3916
|
}
|
|
3918
3917
|
//#endregion
|
|
3919
3918
|
//#region lib/components/ui/widgets/editor/extensions/upload/upload-run.ts
|
|
3920
|
-
var
|
|
3919
|
+
var qs = () => typeof URL < "u" && typeof URL.createObjectURL == "function" ? {
|
|
3921
3920
|
create: (e) => URL.createObjectURL(e),
|
|
3922
3921
|
revoke: (e) => URL.revokeObjectURL(e)
|
|
3923
3922
|
} : null;
|
|
3924
|
-
function
|
|
3923
|
+
function Js(e, t, n, r) {
|
|
3925
3924
|
let i = (e) => {
|
|
3926
3925
|
r.live() && Number.isFinite(e) && r.progress(Math.min(1, Math.max(0, e)));
|
|
3927
3926
|
};
|
|
@@ -3936,15 +3935,15 @@ function qs(e, t, n, r) {
|
|
|
3936
3935
|
}
|
|
3937
3936
|
//#endregion
|
|
3938
3937
|
//#region lib/components/ui/widgets/editor/extensions/upload/upload-queue.ts
|
|
3939
|
-
var
|
|
3938
|
+
var Ys = class {
|
|
3940
3939
|
options;
|
|
3941
3940
|
entries = /* @__PURE__ */ new Map();
|
|
3942
|
-
listeners =
|
|
3941
|
+
listeners = pt();
|
|
3943
3942
|
counter = 0;
|
|
3944
3943
|
preview;
|
|
3945
3944
|
limit;
|
|
3946
3945
|
constructor(e) {
|
|
3947
|
-
this.options = e, this.limit = e.limit ?? 3, this.preview = e.preview === void 0 ?
|
|
3946
|
+
this.options = e, this.limit = e.limit ?? 3, this.preview = e.preview === void 0 ? qs() : e.preview;
|
|
3948
3947
|
}
|
|
3949
3948
|
emit() {
|
|
3950
3949
|
this.listeners.emit();
|
|
@@ -3965,7 +3964,7 @@ var Js = class {
|
|
|
3965
3964
|
status: "error",
|
|
3966
3965
|
failure: t,
|
|
3967
3966
|
progress: void 0,
|
|
3968
|
-
message: n === void 0 ? void 0 :
|
|
3967
|
+
message: n === void 0 ? void 0 : si(n)
|
|
3969
3968
|
});
|
|
3970
3969
|
let r = this.entries.get(e);
|
|
3971
3970
|
r && this.options.onFailure?.(r.job);
|
|
@@ -3973,7 +3972,7 @@ var Js = class {
|
|
|
3973
3972
|
land(e, t) {
|
|
3974
3973
|
let n = this.entries.get(e);
|
|
3975
3974
|
if (n) {
|
|
3976
|
-
if (!
|
|
3975
|
+
if (!As(t?.src)) return this.fail(e, "invalid");
|
|
3977
3976
|
this.forget(e), this.options.onResult(n.job, t);
|
|
3978
3977
|
}
|
|
3979
3978
|
}
|
|
@@ -3986,7 +3985,7 @@ var Js = class {
|
|
|
3986
3985
|
failure: void 0,
|
|
3987
3986
|
message: void 0,
|
|
3988
3987
|
progress: void 0
|
|
3989
|
-
}),
|
|
3988
|
+
}), Js(this.options.upload, t.job.file, n.signal, {
|
|
3990
3989
|
live: () => this.entries.get(e)?.abort === n && !n.signal.aborted,
|
|
3991
3990
|
progress: (t) => this.patch(e, { progress: t }),
|
|
3992
3991
|
land: (t) => this.land(e, t),
|
|
@@ -4008,7 +4007,7 @@ var Js = class {
|
|
|
4008
4007
|
file: e,
|
|
4009
4008
|
status: t ? "error" : "queued",
|
|
4010
4009
|
failure: t,
|
|
4011
|
-
previewUrl:
|
|
4010
|
+
previewUrl: ks(e) ? this.preview?.create(e) : void 0,
|
|
4012
4011
|
retryable: !t
|
|
4013
4012
|
};
|
|
4014
4013
|
return this.entries.set(n, { job: r }), this.emit(), t ? this.options.onFailure?.(r) : this.pump(), this.entries.get(n)?.job ?? r;
|
|
@@ -4031,26 +4030,26 @@ var Js = class {
|
|
|
4031
4030
|
for (let e of [...this.entries.keys()]) this.forget(e);
|
|
4032
4031
|
this.listeners.clear();
|
|
4033
4032
|
};
|
|
4034
|
-
},
|
|
4033
|
+
}, Xs = (e) => new Ys(e);
|
|
4035
4034
|
//#endregion
|
|
4036
4035
|
//#region lib/components/ui/widgets/editor/extensions/upload/upload-remote.ts
|
|
4037
|
-
function
|
|
4036
|
+
function Zs(e) {
|
|
4038
4037
|
let t = null;
|
|
4039
4038
|
e.on("transaction", ({ transaction: n }) => {
|
|
4040
4039
|
let r = $.getState(e.state)?.cards ?? [], i = t;
|
|
4041
|
-
if (t = null, i && n.docChanged &&
|
|
4040
|
+
if (t = null, i && n.docChanged && Ga(n)) {
|
|
4042
4041
|
let t = {};
|
|
4043
4042
|
for (let a of r) {
|
|
4044
4043
|
let r = i.get(a.id);
|
|
4045
4044
|
if (!r) continue;
|
|
4046
|
-
let o =
|
|
4047
|
-
t[a.id] = r.shift && o === 0 ?
|
|
4045
|
+
let o = qa(e, r.mark, n);
|
|
4046
|
+
t[a.id] = r.shift && o === 0 ? qa(e, r.edge, n) : o + r.shift;
|
|
4048
4047
|
}
|
|
4049
4048
|
e.view.dispatch(e.state.tr.setMeta($, { place: t }));
|
|
4050
4049
|
return;
|
|
4051
4050
|
}
|
|
4052
4051
|
if (!r.length) return;
|
|
4053
|
-
let a = r.map((t) => t.pos > 0 && e.state.doc.resolve(t.pos).nodeBefore?.isTextblock ? 1 : 0), o =
|
|
4052
|
+
let a = r.map((t) => t.pos > 0 && e.state.doc.resolve(t.pos).nodeBefore?.isTextblock ? 1 : 0), o = Ka(e, r.map((e, t) => e.pos - a[t])), s = Ka(e, r.map((e) => e.pos));
|
|
4054
4053
|
t = new Map(r.map((e, t) => [e.id, {
|
|
4055
4054
|
mark: o[t],
|
|
4056
4055
|
edge: s[t],
|
|
@@ -4060,19 +4059,19 @@ function Xs(e) {
|
|
|
4060
4059
|
}
|
|
4061
4060
|
//#endregion
|
|
4062
4061
|
//#region lib/components/ui/widgets/editor/extensions/upload/upload-extension.ts
|
|
4063
|
-
var
|
|
4062
|
+
var Qs = /* @__PURE__ */ new WeakMap(), $s = R.create({
|
|
4064
4063
|
name: "upload",
|
|
4065
4064
|
addStorage: () => ({}),
|
|
4066
4065
|
onBeforeCreate() {
|
|
4067
4066
|
let { editor: e, options: t, storage: n } = this, { translate: r, maxSize: i } = t, a = t.accept ?? "image/*", o = t.multiple ?? !0;
|
|
4068
|
-
|
|
4069
|
-
let s =
|
|
4067
|
+
Qs.set(n, os());
|
|
4068
|
+
let s = Xs({
|
|
4070
4069
|
upload: t.onUpload,
|
|
4071
4070
|
onResult: (t, n) => {
|
|
4072
|
-
|
|
4071
|
+
Fs(e, t.id, t.file, n), as(r("material.editor.upload.uploaded", "Uploaded {name}", { name: t.file.name }));
|
|
4073
4072
|
}
|
|
4074
4073
|
});
|
|
4075
|
-
|
|
4074
|
+
Zs(e);
|
|
4076
4075
|
let c = {
|
|
4077
4076
|
editor: e,
|
|
4078
4077
|
storage: n,
|
|
@@ -4087,28 +4086,28 @@ var Zs = /* @__PURE__ */ new WeakMap(), Qs = R.create({
|
|
|
4087
4086
|
accept: a,
|
|
4088
4087
|
multiple: o,
|
|
4089
4088
|
ownsImage: t.ownsImage ?? !1,
|
|
4090
|
-
upload: (e, t) =>
|
|
4091
|
-
cancel: (e) =>
|
|
4089
|
+
upload: (e, t) => Ws(c, e, t),
|
|
4090
|
+
cancel: (e) => Gs(c, e),
|
|
4092
4091
|
retry: s.retry,
|
|
4093
|
-
pick: (e) =>
|
|
4092
|
+
pick: (e) => Ks(c, e)
|
|
4094
4093
|
});
|
|
4095
4094
|
},
|
|
4096
4095
|
onDestroy() {
|
|
4097
|
-
this.storage.queue?.dispose(),
|
|
4096
|
+
this.storage.queue?.dispose(), Qs.get(this.storage)?.();
|
|
4098
4097
|
},
|
|
4099
4098
|
addProseMirrorPlugins() {
|
|
4100
|
-
return [
|
|
4099
|
+
return [ws({
|
|
4101
4100
|
onOrphans: (e) => {
|
|
4102
4101
|
for (let t of e) this.storage.queue.cancel(t);
|
|
4103
4102
|
},
|
|
4104
4103
|
onFiles: (e, t) => (this.storage.upload(e, t), !0)
|
|
4105
4104
|
})];
|
|
4106
4105
|
}
|
|
4107
|
-
}),
|
|
4106
|
+
}), ec = (e = {}) => {
|
|
4108
4107
|
let { onUpload: t, ...n } = e;
|
|
4109
4108
|
return B(t ? {
|
|
4110
4109
|
name: "upload",
|
|
4111
|
-
extensions: (e) => [...e.has("image") ? [] : [
|
|
4110
|
+
extensions: (e) => [...e.has("image") ? [] : [ht], $s.configure({
|
|
4112
4111
|
...n,
|
|
4113
4112
|
onUpload: t,
|
|
4114
4113
|
translate: e.translate,
|
|
@@ -4128,7 +4127,7 @@ var Zs = /* @__PURE__ */ new WeakMap(), Qs = R.create({
|
|
|
4128
4127
|
priority: 60,
|
|
4129
4128
|
kind: "panel",
|
|
4130
4129
|
when: (e) => !!c(e) && e.isActive("image"),
|
|
4131
|
-
render:
|
|
4130
|
+
render: Zo
|
|
4132
4131
|
}],
|
|
4133
4132
|
slash: u("image"),
|
|
4134
4133
|
markdown: "native"
|
|
@@ -4137,33 +4136,33 @@ var Zs = /* @__PURE__ */ new WeakMap(), Qs = R.create({
|
|
|
4137
4136
|
extensions: () => [],
|
|
4138
4137
|
markdown: "native"
|
|
4139
4138
|
});
|
|
4140
|
-
},
|
|
4139
|
+
}, tc = {
|
|
4141
4140
|
accordion: o,
|
|
4142
4141
|
actionCard: Fe,
|
|
4143
|
-
assistant:
|
|
4142
|
+
assistant: po,
|
|
4144
4143
|
blocks: fe,
|
|
4145
4144
|
callout: Ie,
|
|
4146
4145
|
checkboxGroup: Ae,
|
|
4147
4146
|
codeBlock: le,
|
|
4148
4147
|
color: Ce,
|
|
4149
|
-
comments:
|
|
4148
|
+
comments: No,
|
|
4150
4149
|
count: Te,
|
|
4151
|
-
dragHandle:
|
|
4150
|
+
dragHandle: Fo,
|
|
4152
4151
|
emoji: ve,
|
|
4153
|
-
find:
|
|
4154
|
-
focusMode:
|
|
4152
|
+
find: Vo,
|
|
4153
|
+
focusMode: Uo,
|
|
4155
4154
|
fontFamily: De,
|
|
4156
4155
|
gallery: ae,
|
|
4157
4156
|
headings: se,
|
|
4158
4157
|
highlight: _,
|
|
4159
4158
|
image: m,
|
|
4160
|
-
inlineCode:
|
|
4159
|
+
inlineCode: Go,
|
|
4161
4160
|
link: ie,
|
|
4162
4161
|
lists: O,
|
|
4163
|
-
markdownPaste:
|
|
4162
|
+
markdownPaste: Jo,
|
|
4164
4163
|
marks: Le,
|
|
4165
4164
|
mention: f,
|
|
4166
|
-
outline:
|
|
4165
|
+
outline: Xo,
|
|
4167
4166
|
placeholder: w,
|
|
4168
4167
|
radioGroup: x,
|
|
4169
4168
|
selectCard: b,
|
|
@@ -4171,15 +4170,15 @@ var Zs = /* @__PURE__ */ new WeakMap(), Qs = R.create({
|
|
|
4171
4170
|
slash: r,
|
|
4172
4171
|
table: be,
|
|
4173
4172
|
textAlign: S,
|
|
4174
|
-
upload:
|
|
4173
|
+
upload: ec,
|
|
4175
4174
|
youtube: s
|
|
4176
|
-
},
|
|
4175
|
+
}, nc = (...e) => (t) => [...t, ...e], rc = (...e) => (t) => t.filter((t) => !e.includes(t.key ?? t.name)), ic = () => [
|
|
4177
4176
|
Fe(),
|
|
4178
4177
|
ye(),
|
|
4179
4178
|
b(),
|
|
4180
4179
|
Ae(),
|
|
4181
4180
|
x()
|
|
4182
|
-
],
|
|
4181
|
+
], ac = () => [
|
|
4183
4182
|
Ie(),
|
|
4184
4183
|
o(),
|
|
4185
4184
|
ae(),
|
|
@@ -4194,30 +4193,30 @@ var Zs = /* @__PURE__ */ new WeakMap(), Qs = R.create({
|
|
|
4194
4193
|
S(),
|
|
4195
4194
|
w(),
|
|
4196
4195
|
Te(),
|
|
4197
|
-
|
|
4196
|
+
Jo(),
|
|
4198
4197
|
O(),
|
|
4199
4198
|
m(),
|
|
4200
|
-
|
|
4199
|
+
ec(),
|
|
4201
4200
|
s(),
|
|
4202
4201
|
ve({ suggest: !0 }),
|
|
4203
4202
|
be(),
|
|
4204
4203
|
le(),
|
|
4205
|
-
|
|
4206
|
-
|
|
4207
|
-
|
|
4208
|
-
|
|
4209
|
-
],
|
|
4204
|
+
Vo(),
|
|
4205
|
+
Uo(),
|
|
4206
|
+
Fo(),
|
|
4207
|
+
No()
|
|
4208
|
+
], oc = () => [
|
|
4210
4209
|
Le({ compact: !0 }),
|
|
4211
|
-
|
|
4210
|
+
Go(),
|
|
4212
4211
|
ie(),
|
|
4213
4212
|
w(),
|
|
4214
4213
|
Te(),
|
|
4215
|
-
|
|
4214
|
+
Jo(),
|
|
4216
4215
|
O(),
|
|
4217
|
-
|
|
4218
|
-
],
|
|
4216
|
+
ec()
|
|
4217
|
+
], sc = () => [
|
|
4219
4218
|
Le({ compact: !0 }),
|
|
4220
|
-
|
|
4219
|
+
Go(),
|
|
4221
4220
|
ie(),
|
|
4222
4221
|
w(),
|
|
4223
4222
|
Te(),
|
|
@@ -4226,21 +4225,21 @@ var Zs = /* @__PURE__ */ new WeakMap(), Qs = R.create({
|
|
|
4226
4225
|
];
|
|
4227
4226
|
//#endregion
|
|
4228
4227
|
//#region lib/components/ui/widgets/editor/extensions/assistant/use-assistant-feature.ts
|
|
4229
|
-
function
|
|
4228
|
+
function cc(e, t) {
|
|
4230
4229
|
let n = W(e);
|
|
4231
4230
|
H(() => {
|
|
4232
4231
|
n.current = e;
|
|
4233
4232
|
}, [e]);
|
|
4234
4233
|
let r = V((e, t) => n.current(e, t), []), i = !!e;
|
|
4235
|
-
return U(() => i ?
|
|
4234
|
+
return U(() => i ? po({
|
|
4236
4235
|
...t,
|
|
4237
4236
|
onAssist: r
|
|
4238
4237
|
}) : void 0, [i, r]);
|
|
4239
4238
|
}
|
|
4240
4239
|
//#endregion
|
|
4241
4240
|
//#region lib/components/ui/widgets/editor/extensions/upload/upload-signal.tsx
|
|
4242
|
-
function
|
|
4243
|
-
let { handle: t } = k(), n =
|
|
4241
|
+
function lc({ onChange: e }) {
|
|
4242
|
+
let { handle: t } = k(), n = Ra(t).pending > 0, r = W(e), i = W(!1);
|
|
4244
4243
|
return H(() => {
|
|
4245
4244
|
r.current = e;
|
|
4246
4245
|
}, [e]), H(() => {
|
|
@@ -4251,20 +4250,20 @@ function cc({ onChange: e }) {
|
|
|
4251
4250
|
}
|
|
4252
4251
|
//#endregion
|
|
4253
4252
|
//#region lib/components/ui/widgets/editor/extensions/upload/use-upload-feature.ts
|
|
4254
|
-
function
|
|
4253
|
+
function uc(e, t) {
|
|
4255
4254
|
let n = W(e);
|
|
4256
4255
|
H(() => {
|
|
4257
4256
|
n.current = e;
|
|
4258
4257
|
}, [e]);
|
|
4259
4258
|
let r = V((e, t) => n.current(e, t), []), i = !!e;
|
|
4260
|
-
return U(() => i ?
|
|
4259
|
+
return U(() => i ? ec({
|
|
4261
4260
|
...t,
|
|
4262
4261
|
onUpload: r
|
|
4263
4262
|
}) : void 0, [i, r]);
|
|
4264
4263
|
}
|
|
4265
4264
|
//#endregion
|
|
4266
4265
|
//#region lib/components/ui/widgets/editor/core/character-count.ts
|
|
4267
|
-
function
|
|
4266
|
+
function dc(e, t) {
|
|
4268
4267
|
let n = Math.max(0, t - e);
|
|
4269
4268
|
return {
|
|
4270
4269
|
characters: e,
|
|
@@ -4276,12 +4275,12 @@ function uc(e, t) {
|
|
|
4276
4275
|
}
|
|
4277
4276
|
//#endregion
|
|
4278
4277
|
//#region lib/components/ui/widgets/editor/partials/editor-character-count.tsx
|
|
4279
|
-
function
|
|
4278
|
+
function fc({ className: e }) {
|
|
4280
4279
|
let { t: n } = j(), { handle: r } = k(), i = P({
|
|
4281
4280
|
editor: r.editor,
|
|
4282
4281
|
selector: ({ editor: e }) => {
|
|
4283
4282
|
let t = e?.extensionManager.extensions.find((e) => e.name === "characterCount")?.options.limit;
|
|
4284
|
-
return t ?
|
|
4283
|
+
return t ? dc(e?.storage.characterCount?.characters?.() ?? 0, t) : null;
|
|
4285
4284
|
}
|
|
4286
4285
|
});
|
|
4287
4286
|
return i ? /* @__PURE__ */ J("span", {
|
|
@@ -4303,7 +4302,7 @@ function dc({ className: e }) {
|
|
|
4303
4302
|
}
|
|
4304
4303
|
//#endregion
|
|
4305
4304
|
//#region lib/components/ui/widgets/editor/partials/use-room-for.ts
|
|
4306
|
-
function
|
|
4305
|
+
function pc(e, t) {
|
|
4307
4306
|
let [n, r] = G(!1);
|
|
4308
4307
|
return H(() => {
|
|
4309
4308
|
let n = e.current;
|
|
@@ -4321,8 +4320,8 @@ function fc(e, t) {
|
|
|
4321
4320
|
}
|
|
4322
4321
|
//#endregion
|
|
4323
4322
|
//#region lib/components/ui/widgets/editor/presets/toolbar-looks.ts
|
|
4324
|
-
var
|
|
4325
|
-
function
|
|
4323
|
+
var mc = t("[&_button[aria-pressed=true]]:rounded-full [&_button[data-variant=filled]]:rounded-full", "[&_button[aria-pressed=true]]:bg-(--tb-on) [&_button[data-variant=filled]]:bg-(--tb-on)", "[&_button[aria-pressed=true]]:text-(--tb-on-fg) [&_button[data-variant=filled]]:text-(--tb-on-fg)", "[&_button[aria-pressed=true]_svg]:stroke-(--tb-on-fg) [&_button[data-variant=filled]_svg]:stroke-(--tb-on-fg)", "[&_button[aria-pressed=true]_svg]:text-(--tb-on-fg) [&_button[data-variant=filled]_svg]:text-(--tb-on-fg)", "[&_button[aria-pressed=true]_svg]:stroke-[2.6] [&_button[data-variant=filled]_svg]:stroke-[2.6]"), hc = t("[&_button[data-toolbar-fit][data-variant=filled]:not([aria-pressed])]:bg-(--tb-on)", "[&_button[data-toolbar-fit][data-variant=filled]:not([aria-pressed])]:text-(--tb-on-fg)"), gc = t("gap-x-2 gap-y-1.5", "**:data-group-id:gap-0 **:data-group-id:rounded-xl", "**:data-group-id:bg-muted/60 **:data-group-id:p-0.5", "[&_button[data-variant]]:rounded-md", mc, hc), _c = t("items-center gap-1 **:data-group-id:gap-1", "[--tb-item:2.25rem] [&_button[data-variant]]:rounded-full [&_[data-toolbar-more]]:rounded-full", mc, hc, "**:data-[group=outline]:@6xl:hidden", "**:data-[group=comments]:@5xl:hidden"), vc = t(gc, "**:data-[group=outline]:@6xl:hidden", "**:data-[group=comments]:@5xl:hidden"), yc = t(gc, "**:data-[group=outline]:@4xl:hidden", "**:data-[group=comments]:@5xl:hidden"), bc = 56;
|
|
4324
|
+
function xc({ side: e, children: n }) {
|
|
4326
4325
|
let { t: r } = j();
|
|
4327
4326
|
return /* @__PURE__ */ q("aside", {
|
|
4328
4327
|
"aria-label": r("material.editor.outline-region", "Document outline"),
|
|
@@ -4335,8 +4334,8 @@ function bc({ side: e, children: n }) {
|
|
|
4335
4334
|
})
|
|
4336
4335
|
});
|
|
4337
4336
|
}
|
|
4338
|
-
function
|
|
4339
|
-
let { t: d } = j(), { chrome: f, handle: p, look: m } = k(), h = p.features.some((e) => e.key === "dragHandle"), g = f.state.focusMode, _ = W(null), v =
|
|
4337
|
+
function Sc({ toolbar: e, bar: n, panels: r, footer: i, outline: a, comments: o, presence: s, outlineSide: c = "start", className: l, children: u }) {
|
|
4338
|
+
let { t: d } = j(), { chrome: f, handle: p, look: m } = k(), h = p.features.some((e) => e.key === "dragHandle"), g = f.state.focusMode, _ = W(null), v = pc(_, bc), y = a && !g && v, b = pc(_, 64), x = o && !g && b;
|
|
4340
4339
|
return /* @__PURE__ */ J("div", {
|
|
4341
4340
|
ref: _,
|
|
4342
4341
|
"data-slot": "document-editor",
|
|
@@ -4356,12 +4355,12 @@ function xc({ toolbar: e, bar: n, panels: r, footer: i, outline: a, comments: o,
|
|
|
4356
4355
|
r
|
|
4357
4356
|
]
|
|
4358
4357
|
}),
|
|
4359
|
-
/* @__PURE__ */ q(
|
|
4358
|
+
/* @__PURE__ */ q(ya, { className: "absolute end-3 top-3 z-20" }),
|
|
4360
4359
|
!g && n,
|
|
4361
4360
|
/* @__PURE__ */ J("div", {
|
|
4362
4361
|
className: "flex",
|
|
4363
4362
|
children: [
|
|
4364
|
-
y && c === "start" && /* @__PURE__ */ q(
|
|
4363
|
+
y && c === "start" && /* @__PURE__ */ q(xc, {
|
|
4365
4364
|
side: "start",
|
|
4366
4365
|
children: a
|
|
4367
4366
|
}),
|
|
@@ -4372,7 +4371,7 @@ function xc({ toolbar: e, bar: n, panels: r, footer: i, outline: a, comments: o,
|
|
|
4372
4371
|
children: u
|
|
4373
4372
|
})
|
|
4374
4373
|
}),
|
|
4375
|
-
y && c === "end" && /* @__PURE__ */ q(
|
|
4374
|
+
y && c === "end" && /* @__PURE__ */ q(xc, {
|
|
4376
4375
|
side: "end",
|
|
4377
4376
|
children: a
|
|
4378
4377
|
}),
|
|
@@ -4393,10 +4392,10 @@ function xc({ toolbar: e, bar: n, panels: r, footer: i, outline: a, comments: o,
|
|
|
4393
4392
|
}
|
|
4394
4393
|
//#endregion
|
|
4395
4394
|
//#region lib/components/ui/widgets/editor/presets/preset-features.ts
|
|
4396
|
-
var
|
|
4395
|
+
var Cc = (e) => (t) => {
|
|
4397
4396
|
let { features: n, mentions: r, outline: i, extra: a } = e, o = (typeof n == "function" ? n(t) : n) ?? (r ? [...t, f()] : t);
|
|
4398
|
-
return [...i && !o.some((e) => e.key === "outline") ? [...o,
|
|
4399
|
-
},
|
|
4397
|
+
return [...i && !o.some((e) => e.key === "outline") ? [...o, Xo()] : o, ...a.filter((e) => !!e)];
|
|
4398
|
+
}, wc = [
|
|
4400
4399
|
"min-h-[1lh]",
|
|
4401
4400
|
"min-h-[2lh]",
|
|
4402
4401
|
"min-h-[3lh]",
|
|
@@ -4405,7 +4404,7 @@ var Sc = (e) => (t) => {
|
|
|
4405
4404
|
"min-h-[6lh]",
|
|
4406
4405
|
"min-h-[8lh]",
|
|
4407
4406
|
"min-h-[10lh]"
|
|
4408
|
-
],
|
|
4407
|
+
], Tc = [
|
|
4409
4408
|
"max-h-[1lh]",
|
|
4410
4409
|
"max-h-[2lh]",
|
|
4411
4410
|
"max-h-[3lh]",
|
|
@@ -4416,7 +4415,7 @@ var Sc = (e) => (t) => {
|
|
|
4416
4415
|
"max-h-[10lh]",
|
|
4417
4416
|
"max-h-[12lh]",
|
|
4418
4417
|
"max-h-[16lh]"
|
|
4419
|
-
],
|
|
4418
|
+
], Ec = [
|
|
4420
4419
|
1,
|
|
4421
4420
|
2,
|
|
4422
4421
|
3,
|
|
@@ -4425,7 +4424,7 @@ var Sc = (e) => (t) => {
|
|
|
4425
4424
|
6,
|
|
4426
4425
|
8,
|
|
4427
4426
|
10
|
|
4428
|
-
],
|
|
4427
|
+
], Dc = [
|
|
4429
4428
|
1,
|
|
4430
4429
|
2,
|
|
4431
4430
|
3,
|
|
@@ -4436,52 +4435,52 @@ var Sc = (e) => (t) => {
|
|
|
4436
4435
|
10,
|
|
4437
4436
|
12,
|
|
4438
4437
|
16
|
|
4439
|
-
],
|
|
4438
|
+
], Oc = (e, t) => {
|
|
4440
4439
|
let n = 0;
|
|
4441
4440
|
return e.forEach((e, r) => {
|
|
4442
4441
|
e <= t && (n = r);
|
|
4443
4442
|
}), n;
|
|
4444
4443
|
};
|
|
4445
|
-
function
|
|
4446
|
-
let n =
|
|
4447
|
-
return `${
|
|
4444
|
+
function kc(e = 2, t = 8) {
|
|
4445
|
+
let n = Oc(Ec, e), r = Ec[n] ?? 1, i = Oc(Dc, Math.max(t, r));
|
|
4446
|
+
return `${wc[n]} ${Tc[i]} overflow-y-auto`;
|
|
4448
4447
|
}
|
|
4449
4448
|
//#endregion
|
|
4450
4449
|
//#region lib/components/ui/widgets/editor/presets/toolbar-looks-expressive.ts
|
|
4451
|
-
var
|
|
4452
|
-
function
|
|
4453
|
-
return e === "expressive" ?
|
|
4450
|
+
var Ac = "**:data-[group=outline]:@4xl:hidden", jc = "**:data-[group=outline]:@6xl:hidden", Mc = "**:data-[group=comments]:@5xl:hidden", Nc = t(Ac, Mc), Pc = t(jc, Mc), Fc = t("items-center", jc, Mc);
|
|
4451
|
+
function Ic(e, t) {
|
|
4452
|
+
return e === "expressive" ? Nc : t;
|
|
4454
4453
|
}
|
|
4455
|
-
function
|
|
4454
|
+
function Lc(e) {
|
|
4456
4455
|
return e === "expressive" ? {
|
|
4457
|
-
docked:
|
|
4458
|
-
rail:
|
|
4456
|
+
docked: Pc,
|
|
4457
|
+
rail: Fc
|
|
4459
4458
|
} : {
|
|
4460
|
-
docked:
|
|
4461
|
-
rail:
|
|
4459
|
+
docked: vc,
|
|
4460
|
+
rail: _c
|
|
4462
4461
|
};
|
|
4463
4462
|
}
|
|
4464
|
-
function
|
|
4463
|
+
function Rc(e, n) {
|
|
4465
4464
|
return e === "expressive" ? "rounded-[20px]" : t("rounded-xl shadow-xs", "focus-within:border-primary/60 dark:focus-within:border-primary-indicator focus-within:ring-[3px] focus-within:ring-primary/15", n && "border-error");
|
|
4466
4465
|
}
|
|
4467
|
-
function
|
|
4466
|
+
function zc(e) {
|
|
4468
4467
|
return e === "expressive" ? "" : "border-b bg-muted/30 px-2 py-1.5";
|
|
4469
4468
|
}
|
|
4470
4469
|
//#endregion
|
|
4471
4470
|
//#region lib/components/ui/widgets/editor/presets/compact-editor.tsx
|
|
4472
|
-
function
|
|
4473
|
-
let { t: S } = j(), C = U(
|
|
4471
|
+
function Bc({ features: e, minRows: n = 2, maxRows: r = 8, toolbar: i = !0, look: o = "expressive", actions: s, onUpload: c, uploadOptions: u, onUploadingChange: d, onAssist: f, assistOptions: p, label: m, helperText: h, error: _, required: v, className: y, attributes: b, ...x }) {
|
|
4472
|
+
let { t: S } = j(), C = U(oc, []), w = uc(c, u), ee = cc(f, p), T = !!s || !!x.characterLimit;
|
|
4474
4473
|
return /* @__PURE__ */ J(g, {
|
|
4475
4474
|
...x,
|
|
4476
4475
|
look: o,
|
|
4477
|
-
features:
|
|
4476
|
+
features: Cc({
|
|
4478
4477
|
features: e,
|
|
4479
4478
|
mentions: x.mentions,
|
|
4480
4479
|
extra: [w, ee]
|
|
4481
4480
|
}),
|
|
4482
4481
|
defaults: C,
|
|
4483
4482
|
attributes: {
|
|
4484
|
-
class: t("nxgt-prose text-[0.9375rem] leading-relaxed focus:outline-none",
|
|
4483
|
+
class: t("nxgt-prose text-[0.9375rem] leading-relaxed focus:outline-none", kc(n, r)),
|
|
4485
4484
|
"aria-label": S("material.editor.comment", "Comment"),
|
|
4486
4485
|
...b
|
|
4487
4486
|
},
|
|
@@ -4496,35 +4495,35 @@ function zc({ features: e, minRows: n = 2, maxRows: r = 8, toolbar: i = !0, look
|
|
|
4496
4495
|
"data-slot": "compact-editor",
|
|
4497
4496
|
"data-invalid": _ || void 0,
|
|
4498
4497
|
"data-look": o,
|
|
4499
|
-
className: t("overflow-clip border bg-card text-card-foreground transition-colors duration-(--nxgt-motion-effects-fast-duration) ease-effects-fast motion-reduce:transition-none",
|
|
4498
|
+
className: t("overflow-clip border bg-card text-card-foreground transition-colors duration-(--nxgt-motion-effects-fast-duration) ease-effects-fast motion-reduce:transition-none", Rc(o, _)),
|
|
4500
4499
|
children: [
|
|
4501
4500
|
i && /* @__PURE__ */ q("div", {
|
|
4502
4501
|
"data-slot": "compact-editor-toolbar",
|
|
4503
4502
|
"data-look": o,
|
|
4504
|
-
className:
|
|
4503
|
+
className: zc(o),
|
|
4505
4504
|
children: /* @__PURE__ */ q(E, {
|
|
4506
4505
|
dividers: !1,
|
|
4507
4506
|
density: "compact",
|
|
4508
|
-
className:
|
|
4507
|
+
className: Ic(o, yc)
|
|
4509
4508
|
})
|
|
4510
4509
|
}),
|
|
4511
4510
|
/* @__PURE__ */ q(D, { className: "px-3 py-2.5" }),
|
|
4512
|
-
T && /* @__PURE__ */ q(
|
|
4511
|
+
T && /* @__PURE__ */ q(Vc, { actions: s })
|
|
4513
4512
|
]
|
|
4514
4513
|
})
|
|
4515
4514
|
}),
|
|
4516
|
-
c && /* @__PURE__ */ q(
|
|
4515
|
+
c && /* @__PURE__ */ q(lc, { onChange: d }),
|
|
4517
4516
|
/* @__PURE__ */ q(l, {}),
|
|
4518
4517
|
/* @__PURE__ */ q(a, {}),
|
|
4519
|
-
/* @__PURE__ */ q(
|
|
4518
|
+
/* @__PURE__ */ q(sr, {})
|
|
4520
4519
|
]
|
|
4521
4520
|
});
|
|
4522
4521
|
}
|
|
4523
|
-
function
|
|
4522
|
+
function Vc({ actions: e }) {
|
|
4524
4523
|
return /* @__PURE__ */ J("div", {
|
|
4525
4524
|
"data-slot": "compact-editor-footer",
|
|
4526
4525
|
className: "flex flex-wrap items-center gap-x-3 gap-y-2 border-t px-3 py-2",
|
|
4527
|
-
children: [/* @__PURE__ */ q(
|
|
4526
|
+
children: [/* @__PURE__ */ q(fc, {}), e && /* @__PURE__ */ q("div", {
|
|
4528
4527
|
"data-slot": "editor-actions",
|
|
4529
4528
|
className: "ms-auto flex items-center gap-2",
|
|
4530
4529
|
children: e
|
|
@@ -4533,14 +4532,14 @@ function Bc({ actions: e }) {
|
|
|
4533
4532
|
}
|
|
4534
4533
|
//#endregion
|
|
4535
4534
|
//#region lib/components/ui/widgets/editor/presets/compact-editor-form-field.tsx
|
|
4536
|
-
function
|
|
4537
|
-
return /* @__PURE__ */ q(
|
|
4535
|
+
function Hc({ control: e, name: n, ...r }) {
|
|
4536
|
+
return /* @__PURE__ */ q(Ze, {
|
|
4538
4537
|
control: e,
|
|
4539
4538
|
name: n,
|
|
4540
|
-
render: ({ field: e, fieldState: n }) => /* @__PURE__ */ q(
|
|
4539
|
+
render: ({ field: e, fieldState: n }) => /* @__PURE__ */ q(Qe, {
|
|
4541
4540
|
onBlur: e.onBlur,
|
|
4542
4541
|
focusRef: e.ref,
|
|
4543
|
-
children: /* @__PURE__ */ q(
|
|
4542
|
+
children: /* @__PURE__ */ q(Bc, {
|
|
4544
4543
|
...r,
|
|
4545
4544
|
className: t(r.className, e.disabled && "nxgt-editor-disabled"),
|
|
4546
4545
|
value: e.value ?? Re(r.format ?? "html"),
|
|
@@ -4554,20 +4553,20 @@ function Vc({ control: e, name: n, ...r }) {
|
|
|
4554
4553
|
}
|
|
4555
4554
|
//#endregion
|
|
4556
4555
|
//#region lib/components/ui/widgets/editor/extensions/comments/comments-adapter-sync.tsx
|
|
4557
|
-
function
|
|
4558
|
-
let { handle: t } = k(), n =
|
|
4556
|
+
function Uc({ adapter: e }) {
|
|
4557
|
+
let { handle: t } = k(), n = Cr(t.editor);
|
|
4559
4558
|
return H(() => n?.checkAdapter(), [n, e]), null;
|
|
4560
4559
|
}
|
|
4561
4560
|
//#endregion
|
|
4562
4561
|
//#region lib/components/ui/widgets/editor/extensions/comments/use-comments-feature.ts
|
|
4563
|
-
function
|
|
4562
|
+
function Wc(e) {
|
|
4564
4563
|
let t = W(e);
|
|
4565
|
-
|
|
4564
|
+
bn(() => {
|
|
4566
4565
|
t.current = e;
|
|
4567
4566
|
}, [e]);
|
|
4568
4567
|
let n = !!e?.adapter;
|
|
4569
4568
|
return U(() => {
|
|
4570
|
-
if (n) return
|
|
4569
|
+
if (n) return No({
|
|
4571
4570
|
get adapter() {
|
|
4572
4571
|
return t.current?.adapter;
|
|
4573
4572
|
},
|
|
@@ -4585,9 +4584,9 @@ function Uc(e) {
|
|
|
4585
4584
|
}
|
|
4586
4585
|
//#endregion
|
|
4587
4586
|
//#region lib/components/ui/widgets/editor/partials/page-mode-switch.tsx
|
|
4588
|
-
function
|
|
4587
|
+
function Gc({ value: e, onChange: t }) {
|
|
4589
4588
|
let { t: n } = j();
|
|
4590
|
-
return /* @__PURE__ */ J(
|
|
4589
|
+
return /* @__PURE__ */ J(tt, {
|
|
4591
4590
|
type: "single",
|
|
4592
4591
|
variant: "segmented",
|
|
4593
4592
|
size: "sm",
|
|
@@ -4596,15 +4595,15 @@ function Wc({ value: e, onChange: t }) {
|
|
|
4596
4595
|
"aria-label": n("material.editor.page.mode", "View"),
|
|
4597
4596
|
"data-slot": "editor-page-mode",
|
|
4598
4597
|
children: [
|
|
4599
|
-
/* @__PURE__ */ q(
|
|
4598
|
+
/* @__PURE__ */ q(et, {
|
|
4600
4599
|
value: "write",
|
|
4601
4600
|
children: n("material.editor.page.write", "Write")
|
|
4602
4601
|
}),
|
|
4603
|
-
/* @__PURE__ */ q(
|
|
4602
|
+
/* @__PURE__ */ q(et, {
|
|
4604
4603
|
value: "preview",
|
|
4605
4604
|
children: n("material.editor.page.preview", "Preview")
|
|
4606
4605
|
}),
|
|
4607
|
-
/* @__PURE__ */ q(
|
|
4606
|
+
/* @__PURE__ */ q(et, {
|
|
4608
4607
|
value: "markdown",
|
|
4609
4608
|
children: n("material.editor.page.markdown", "Markdown")
|
|
4610
4609
|
})
|
|
@@ -4613,8 +4612,8 @@ function Wc({ value: e, onChange: t }) {
|
|
|
4613
4612
|
}
|
|
4614
4613
|
//#endregion
|
|
4615
4614
|
//#region lib/components/ui/widgets/editor/partials/page-mode-views.tsx
|
|
4616
|
-
var
|
|
4617
|
-
function
|
|
4615
|
+
var Kc = vn(() => import("./rich-text-viewer-W15XIwah.js").then((e) => e.n).then((e) => ({ default: e.RichTextViewer })));
|
|
4616
|
+
function qc() {
|
|
4618
4617
|
let { handle: e } = k(), { editor: t } = e, n = P({
|
|
4619
4618
|
editor: t,
|
|
4620
4619
|
selector: (e) => e.editor?.state.doc ?? null,
|
|
@@ -4626,26 +4625,26 @@ function Kc() {
|
|
|
4626
4625
|
e.isEmpty
|
|
4627
4626
|
]);
|
|
4628
4627
|
}
|
|
4629
|
-
function
|
|
4628
|
+
function Jc({ children: e }) {
|
|
4630
4629
|
return /* @__PURE__ */ q("p", {
|
|
4631
4630
|
"data-slot": "editor-page-empty",
|
|
4632
4631
|
className: "text-muted-foreground text-sm",
|
|
4633
4632
|
children: e
|
|
4634
4633
|
});
|
|
4635
4634
|
}
|
|
4636
|
-
function
|
|
4635
|
+
function Yc({ json: e, components: t }) {
|
|
4637
4636
|
let { t: n } = j(), { look: r } = k(), i = n("material.editor.page.empty", "Nothing to show yet.");
|
|
4638
|
-
return e ? /* @__PURE__ */ q(
|
|
4639
|
-
fallback: /* @__PURE__ */ q(
|
|
4640
|
-
children: /* @__PURE__ */ q(
|
|
4637
|
+
return e ? /* @__PURE__ */ q(_n, {
|
|
4638
|
+
fallback: /* @__PURE__ */ q(Jc, { children: n("material.editor.page.loading", "Loading…") }),
|
|
4639
|
+
children: /* @__PURE__ */ q(Kc, {
|
|
4641
4640
|
value: e,
|
|
4642
4641
|
format: "json",
|
|
4643
4642
|
components: t,
|
|
4644
4643
|
look: r
|
|
4645
4644
|
})
|
|
4646
|
-
}) : /* @__PURE__ */ q(
|
|
4645
|
+
}) : /* @__PURE__ */ q(Jc, { children: i });
|
|
4647
4646
|
}
|
|
4648
|
-
function
|
|
4647
|
+
function Xc({ json: e }) {
|
|
4649
4648
|
let { t } = j(), { handle: n } = k(), [r, i] = G(null), a = n.editor?.extensionManager.extensions;
|
|
4650
4649
|
return H(() => {
|
|
4651
4650
|
let t = !0;
|
|
@@ -4656,31 +4655,31 @@ function Yc({ json: e }) {
|
|
|
4656
4655
|
return import("./convert-XAkWyO8-.js").then((e) => e.t).then((t) => t.toMarkdown(e, { extensions: a })).then((e) => t && i(e)).catch(() => t && i("")), () => {
|
|
4657
4656
|
t = !1;
|
|
4658
4657
|
};
|
|
4659
|
-
}, [e, a]), r === null ? /* @__PURE__ */ q(
|
|
4658
|
+
}, [e, a]), r === null ? /* @__PURE__ */ q(Jc, { children: t("material.editor.page.loading", "Loading…") }) : r.trim() ? /* @__PURE__ */ q("pre", {
|
|
4660
4659
|
"data-slot": "editor-page-markdown",
|
|
4661
4660
|
tabIndex: 0,
|
|
4662
4661
|
className: "m-0 overflow-x-auto whitespace-pre-wrap break-words font-mono text-sm leading-relaxed",
|
|
4663
4662
|
children: /* @__PURE__ */ q("code", { children: r })
|
|
4664
|
-
}) : /* @__PURE__ */ q(
|
|
4663
|
+
}) : /* @__PURE__ */ q(Jc, { children: t("material.editor.page.empty", "Nothing to show yet.") });
|
|
4665
4664
|
}
|
|
4666
|
-
function
|
|
4667
|
-
let n =
|
|
4668
|
-
return e === "preview" ? /* @__PURE__ */ q(
|
|
4665
|
+
function Zc({ mode: e, components: t }) {
|
|
4666
|
+
let n = qc();
|
|
4667
|
+
return e === "preview" ? /* @__PURE__ */ q(Yc, {
|
|
4669
4668
|
json: n,
|
|
4670
4669
|
components: t
|
|
4671
|
-
}) : /* @__PURE__ */ q(
|
|
4670
|
+
}) : /* @__PURE__ */ q(Xc, { json: n });
|
|
4672
4671
|
}
|
|
4673
4672
|
//#endregion
|
|
4674
4673
|
//#region lib/components/ui/widgets/editor/presets/page-classes.ts
|
|
4675
|
-
function
|
|
4674
|
+
function Qc(e, n) {
|
|
4676
4675
|
return t("@container relative isolate overflow-clip bg-(--page-tint) text-card-foreground", n && "flex flex-col", e ? "rounded-(--nxgt-shape-corner-xl) border-0 [--page-tint:color-mix(in_oklab,var(--primary)_9%,var(--background))]" : "rounded-[20px] border [--page-tint:color-mix(in_oklab,var(--primary)_7%,var(--background))]");
|
|
4677
4676
|
}
|
|
4678
|
-
function
|
|
4677
|
+
function $c(e, n) {
|
|
4679
4678
|
return t("mx-auto w-full max-w-[52rem] bg-card px-4 py-8 transition-colors duration-(--nxgt-motion-effects-fast-duration) ease-effects-fast motion-reduce:transition-none", e ? "rounded-(--nxgt-shape-corner-xl-plus) border-0 shadow-none focus-within:ring-[3px] focus-within:ring-primary/50 forced-colors:focus-within:outline-2 forced-colors:focus-within:outline-[Highlight]" : "rounded-3xl border shadow-xs", "@md:px-5", !e && "focus-within:border-primary/60 dark:focus-within:border-primary-indicator", "@2xl:px-10 @2xl:py-12 @6xl:px-14", n && "@xl:pointer-fine:ps-16 @6xl:pointer-fine:ps-20");
|
|
4680
4679
|
}
|
|
4681
4680
|
//#endregion
|
|
4682
4681
|
//#region lib/components/ui/widgets/editor/presets/page-rails.tsx
|
|
4683
|
-
function
|
|
4682
|
+
function el({ children: e, fab: t }) {
|
|
4684
4683
|
let { t: n } = j();
|
|
4685
4684
|
return t === void 0 ? /* @__PURE__ */ q("aside", {
|
|
4686
4685
|
"aria-label": n("material.editor.tools", "Tools"),
|
|
@@ -4700,7 +4699,7 @@ function $c({ children: e, fab: t }) {
|
|
|
4700
4699
|
}), t]
|
|
4701
4700
|
});
|
|
4702
4701
|
}
|
|
4703
|
-
function
|
|
4702
|
+
function tl({ side: e, children: t }) {
|
|
4704
4703
|
let { t: n } = j();
|
|
4705
4704
|
return /* @__PURE__ */ q("aside", {
|
|
4706
4705
|
"aria-label": n("material.editor.outline-region", "Document outline"),
|
|
@@ -4710,7 +4709,7 @@ function el({ side: e, children: t }) {
|
|
|
4710
4709
|
children: t
|
|
4711
4710
|
});
|
|
4712
4711
|
}
|
|
4713
|
-
function
|
|
4712
|
+
function nl({ children: e }) {
|
|
4714
4713
|
let { t } = j();
|
|
4715
4714
|
return /* @__PURE__ */ q("aside", {
|
|
4716
4715
|
"aria-label": t("material.editor.comments.title", "Comments"),
|
|
@@ -4719,15 +4718,15 @@ function tl({ children: e }) {
|
|
|
4719
4718
|
children: e
|
|
4720
4719
|
});
|
|
4721
4720
|
}
|
|
4722
|
-
function
|
|
4723
|
-
let { chrome: m, handle: h, look: g } = k(), _ = g === "expressive", v = h.features.some((e) => e.key === "dragHandle"), y = m.state.focusMode, b = W(null), [x, S] = G("write"), C = x === "write", w =
|
|
4721
|
+
function rl({ toolbar: e, bar: n, rail: r, railFab: i, previewComponents: a, panels: o, footer: s, outline: c, comments: l, presence: u, outlineSide: d = "start", className: f, children: p }) {
|
|
4722
|
+
let { chrome: m, handle: h, look: g } = k(), _ = g === "expressive", v = h.features.some((e) => e.key === "dragHandle"), y = m.state.focusMode, b = W(null), [x, S] = G("write"), C = x === "write", w = pc(b, 64), ee = pc(b, 72), T = C && !y, E = T && w && r, D = !!(n && T && !E), te = c && T && ee, ne = l && T && w;
|
|
4724
4723
|
return /* @__PURE__ */ J("div", {
|
|
4725
4724
|
ref: b,
|
|
4726
4725
|
"data-slot": "document-editor",
|
|
4727
4726
|
"data-look": g,
|
|
4728
4727
|
"data-layout": "page",
|
|
4729
4728
|
"data-mode": x,
|
|
4730
|
-
className: t(
|
|
4729
|
+
className: t(Qc(_, D), f),
|
|
4731
4730
|
children: [
|
|
4732
4731
|
/* @__PURE__ */ J("div", {
|
|
4733
4732
|
"data-slot": "document-editor-toolbar",
|
|
@@ -4735,7 +4734,7 @@ function nl({ toolbar: e, bar: n, rail: r, railFab: i, previewComponents: a, pan
|
|
|
4735
4734
|
children: [
|
|
4736
4735
|
!y && /* @__PURE__ */ J("div", {
|
|
4737
4736
|
className: "flex flex-wrap items-center justify-between gap-2",
|
|
4738
|
-
children: [/* @__PURE__ */ q(
|
|
4737
|
+
children: [/* @__PURE__ */ q(Gc, {
|
|
4739
4738
|
value: x,
|
|
4740
4739
|
onChange: S
|
|
4741
4740
|
}), u]
|
|
@@ -4744,16 +4743,16 @@ function nl({ toolbar: e, bar: n, rail: r, railFab: i, previewComponents: a, pan
|
|
|
4744
4743
|
C && o
|
|
4745
4744
|
]
|
|
4746
4745
|
}),
|
|
4747
|
-
/* @__PURE__ */ q(
|
|
4746
|
+
/* @__PURE__ */ q(ya, { className: "absolute end-3 top-3 z-20" }),
|
|
4748
4747
|
D && n,
|
|
4749
4748
|
/* @__PURE__ */ J("div", {
|
|
4750
4749
|
className: "flex items-start gap-4 px-2 pb-6 @2xl:gap-6 @2xl:px-6",
|
|
4751
4750
|
children: [
|
|
4752
|
-
E && /* @__PURE__ */ q(
|
|
4751
|
+
E && /* @__PURE__ */ q(el, {
|
|
4753
4752
|
fab: i,
|
|
4754
4753
|
children: r
|
|
4755
4754
|
}),
|
|
4756
|
-
te && d === "start" && /* @__PURE__ */ q(
|
|
4755
|
+
te && d === "start" && /* @__PURE__ */ q(tl, {
|
|
4757
4756
|
side: "start",
|
|
4758
4757
|
children: c
|
|
4759
4758
|
}),
|
|
@@ -4761,24 +4760,24 @@ function nl({ toolbar: e, bar: n, rail: r, railFab: i, previewComponents: a, pan
|
|
|
4761
4760
|
className: "min-w-0 flex-1",
|
|
4762
4761
|
children: /* @__PURE__ */ q("article", {
|
|
4763
4762
|
"data-slot": "document-editor-sheet",
|
|
4764
|
-
className:
|
|
4763
|
+
className: $c(_, v),
|
|
4765
4764
|
children: /* @__PURE__ */ J("div", {
|
|
4766
4765
|
className: "mx-auto w-full max-w-[680px]",
|
|
4767
4766
|
children: [/* @__PURE__ */ q("div", {
|
|
4768
4767
|
hidden: !C,
|
|
4769
4768
|
children: p
|
|
4770
|
-
}), !C && /* @__PURE__ */ q(
|
|
4769
|
+
}), !C && /* @__PURE__ */ q(Zc, {
|
|
4771
4770
|
mode: x,
|
|
4772
4771
|
components: a
|
|
4773
4772
|
})]
|
|
4774
4773
|
})
|
|
4775
4774
|
})
|
|
4776
4775
|
}),
|
|
4777
|
-
te && d === "end" && /* @__PURE__ */ q(
|
|
4776
|
+
te && d === "end" && /* @__PURE__ */ q(tl, {
|
|
4778
4777
|
side: "end",
|
|
4779
4778
|
children: c
|
|
4780
4779
|
}),
|
|
4781
|
-
ne && /* @__PURE__ */ q(
|
|
4780
|
+
ne && /* @__PURE__ */ q(nl, { children: l })
|
|
4782
4781
|
]
|
|
4783
4782
|
}),
|
|
4784
4783
|
s && /* @__PURE__ */ q("div", {
|
|
@@ -4790,7 +4789,7 @@ function nl({ toolbar: e, bar: n, rail: r, railFab: i, previewComponents: a, pan
|
|
|
4790
4789
|
}
|
|
4791
4790
|
//#endregion
|
|
4792
4791
|
//#region lib/components/ui/widgets/editor/partials/toolbar-floating-groups.ts
|
|
4793
|
-
var
|
|
4792
|
+
var il = {
|
|
4794
4793
|
"upload-image": "image",
|
|
4795
4794
|
gallery: "gallery",
|
|
4796
4795
|
table: "table",
|
|
@@ -4801,7 +4800,7 @@ var rl = {
|
|
|
4801
4800
|
"select-card": "select-card",
|
|
4802
4801
|
"checkbox-group": "checkbox-group",
|
|
4803
4802
|
"radio-group": "radio-group"
|
|
4804
|
-
},
|
|
4803
|
+
}, al = {
|
|
4805
4804
|
marks: 100,
|
|
4806
4805
|
link: 85,
|
|
4807
4806
|
lists: 80,
|
|
@@ -4811,18 +4810,18 @@ var rl = {
|
|
|
4811
4810
|
"marks-extra": 60,
|
|
4812
4811
|
history: 50
|
|
4813
4812
|
};
|
|
4814
|
-
function
|
|
4813
|
+
function ol(e) {
|
|
4815
4814
|
return e.some((e) => e.name === "slash") ? Ne(e.flatMap((e) => e.slash ?? [])) : [];
|
|
4816
4815
|
}
|
|
4817
|
-
function
|
|
4816
|
+
function sl(e, t) {
|
|
4818
4817
|
let n = new Set(t.map((e) => e.id));
|
|
4819
4818
|
return e.filter((e) => {
|
|
4820
|
-
let t =
|
|
4819
|
+
let t = il[e.id];
|
|
4821
4820
|
return !t || !n.has(t);
|
|
4822
4821
|
});
|
|
4823
4822
|
}
|
|
4824
|
-
function
|
|
4825
|
-
return
|
|
4823
|
+
function cl(e, t) {
|
|
4824
|
+
return sl(e, t).flatMap((e) => e.id === "marks" && e.render === i ? [{
|
|
4826
4825
|
...e,
|
|
4827
4826
|
render: h
|
|
4828
4827
|
}, {
|
|
@@ -4832,12 +4831,12 @@ function sl(e, t) {
|
|
|
4832
4831
|
render: re
|
|
4833
4832
|
}] : [e]).map((e) => ({
|
|
4834
4833
|
...e,
|
|
4835
|
-
priority:
|
|
4834
|
+
priority: al[e.id] ?? e.priority
|
|
4836
4835
|
}));
|
|
4837
4836
|
}
|
|
4838
4837
|
//#endregion
|
|
4839
4838
|
//#region lib/components/ui/widgets/editor/partials/use-toolbar-shown.ts
|
|
4840
|
-
function
|
|
4839
|
+
function ll() {
|
|
4841
4840
|
let { handle: e, chrome: t } = k();
|
|
4842
4841
|
return !!P({
|
|
4843
4842
|
editor: e.editor,
|
|
@@ -4846,8 +4845,8 @@ function cl() {
|
|
|
4846
4845
|
}
|
|
4847
4846
|
//#endregion
|
|
4848
4847
|
//#region lib/components/ui/widgets/editor/partials/editor-insert-fab.tsx
|
|
4849
|
-
function
|
|
4850
|
-
let { t: e } = j(), { handle: t } = k(), { editor: r, features: i } = t, a = W(!1), o = U(() => te(
|
|
4848
|
+
function ul() {
|
|
4849
|
+
let { t: e } = j(), { handle: t } = k(), { editor: r, features: i } = t, a = W(!1), o = U(() => te(ol(i), "", e), [i, e]), s = ll();
|
|
4851
4850
|
return !r || !s || o.length === 0 ? null : /* @__PURE__ */ q(n, {
|
|
4852
4851
|
"data-slot": "editor-insert-fab",
|
|
4853
4852
|
label: e("material.editor.insert", "Insert"),
|
|
@@ -4874,9 +4873,9 @@ function ll() {
|
|
|
4874
4873
|
}
|
|
4875
4874
|
//#endregion
|
|
4876
4875
|
//#region lib/components/ui/widgets/editor/partials/editor-floating-bar.tsx
|
|
4877
|
-
function
|
|
4878
|
-
let { handle: t } = k(), n = U(() =>
|
|
4879
|
-
return
|
|
4876
|
+
function dl({ className: e }) {
|
|
4877
|
+
let { handle: t } = k(), n = U(() => ol(t.features), [t.features]), r = V((e) => cl(e, n), [n]);
|
|
4878
|
+
return ll() ? /* @__PURE__ */ q("div", {
|
|
4880
4879
|
"data-slot": "editor-floating-bar",
|
|
4881
4880
|
className: "nxgt-editor-bar",
|
|
4882
4881
|
children: /* @__PURE__ */ J(oe, { children: [/* @__PURE__ */ q(E, {
|
|
@@ -4884,13 +4883,13 @@ function ul({ className: e }) {
|
|
|
4884
4883
|
dividers: !1,
|
|
4885
4884
|
className: e,
|
|
4886
4885
|
groupsFor: r
|
|
4887
|
-
}), /* @__PURE__ */ q(
|
|
4886
|
+
}), /* @__PURE__ */ q(ul, {})] })
|
|
4888
4887
|
}) : null;
|
|
4889
4888
|
}
|
|
4890
4889
|
//#endregion
|
|
4891
4890
|
//#region lib/components/ui/widgets/editor/partials/editor-rail-toolbar.tsx
|
|
4892
|
-
function
|
|
4893
|
-
let { handle: n } = k(), r = U(() => e ?
|
|
4891
|
+
function fl({ floating: e, className: t }) {
|
|
4892
|
+
let { handle: n } = k(), r = U(() => e ? ol(n.features) : [], [e, n.features]), i = V((e) => sl(e, r), [r]);
|
|
4894
4893
|
return /* @__PURE__ */ q(E, {
|
|
4895
4894
|
orientation: "vertical",
|
|
4896
4895
|
variant: e ? "floating" : void 0,
|
|
@@ -4900,26 +4899,26 @@ function dl({ floating: e, className: t }) {
|
|
|
4900
4899
|
}
|
|
4901
4900
|
//#endregion
|
|
4902
4901
|
//#region lib/components/ui/widgets/editor/presets/document-editor-slots.tsx
|
|
4903
|
-
function
|
|
4904
|
-
let u = t === "page", d =
|
|
4902
|
+
function pl({ look: e, layout: t, previewComponents: n, outline: r, comments: i, collaboration: a, collaborationStatus: o, footer: s, status: c, actions: l }) {
|
|
4903
|
+
let u = t === "page", d = Lc(e), f = e === "expressive";
|
|
4905
4904
|
return {
|
|
4906
4905
|
toolbar: f ? void 0 : /* @__PURE__ */ q(E, {
|
|
4907
4906
|
dividers: !1,
|
|
4908
|
-
className: u ? d.docked :
|
|
4907
|
+
className: u ? d.docked : Ic(e, yc)
|
|
4909
4908
|
}),
|
|
4910
|
-
bar: f ? /* @__PURE__ */ q(
|
|
4909
|
+
bar: f ? /* @__PURE__ */ q(dl, { className: u ? Pc : Nc }) : void 0,
|
|
4911
4910
|
previewComponents: n,
|
|
4912
|
-
rail: u ? /* @__PURE__ */ q(
|
|
4911
|
+
rail: u ? /* @__PURE__ */ q(fl, {
|
|
4913
4912
|
floating: f,
|
|
4914
4913
|
className: d.rail
|
|
4915
4914
|
}) : void 0,
|
|
4916
|
-
railFab: u && f ? /* @__PURE__ */ q(
|
|
4917
|
-
panels: /* @__PURE__ */ J(K, { children: [/* @__PURE__ */ q(
|
|
4918
|
-
outline: r ? /* @__PURE__ */ q(
|
|
4919
|
-
comments: i ? /* @__PURE__ */ q(
|
|
4920
|
-
presence: a && /* @__PURE__ */ q(
|
|
4915
|
+
railFab: u && f ? /* @__PURE__ */ q(ul, {}) : void 0,
|
|
4916
|
+
panels: /* @__PURE__ */ J(K, { children: [/* @__PURE__ */ q(ga, {}), /* @__PURE__ */ q(Fa, {})] }),
|
|
4917
|
+
outline: r ? /* @__PURE__ */ q(Na, {}) : void 0,
|
|
4918
|
+
comments: i ? /* @__PURE__ */ q(Oi, {}) : void 0,
|
|
4919
|
+
presence: a && /* @__PURE__ */ q(hr, { status: o }),
|
|
4921
4920
|
outlineSide: r || "start",
|
|
4922
|
-
footer: s && /* @__PURE__ */ q(
|
|
4921
|
+
footer: s && /* @__PURE__ */ q(Ta, {
|
|
4923
4922
|
status: c,
|
|
4924
4923
|
actions: l
|
|
4925
4924
|
})
|
|
@@ -4927,12 +4926,12 @@ function fl({ look: e, layout: t, previewComponents: n, outline: r, comments: i,
|
|
|
4927
4926
|
}
|
|
4928
4927
|
//#endregion
|
|
4929
4928
|
//#region lib/components/ui/widgets/editor/presets/document-editor.tsx
|
|
4930
|
-
function
|
|
4931
|
-
let E = U(
|
|
4929
|
+
function ml({ features: e, layout: n = "docked", look: r = "expressive", previewComponents: i, status: o, actions: s, footer: c = !0, outline: u = !1, onUpload: d, uploadOptions: f, onUploadingChange: p, onAssist: m, assistOptions: h, comments: _, collaboration: v, collaborationStatus: y, label: b, helperText: x, error: S, required: C, className: w, attributes: ee, ...T }) {
|
|
4930
|
+
let E = U(ac, []), te = uc(d, f), ne = cc(m, h), O = Wc(_), re = n === "page" ? rl : Sc;
|
|
4932
4931
|
return /* @__PURE__ */ J(g, {
|
|
4933
4932
|
...T,
|
|
4934
4933
|
look: r,
|
|
4935
|
-
features:
|
|
4934
|
+
features: Cc({
|
|
4936
4935
|
features: e,
|
|
4937
4936
|
mentions: T.mentions,
|
|
4938
4937
|
outline: u,
|
|
@@ -4956,7 +4955,7 @@ function pl({ features: e, layout: n = "docked", look: r = "expressive", preview
|
|
|
4956
4955
|
required: C,
|
|
4957
4956
|
className: w,
|
|
4958
4957
|
children: /* @__PURE__ */ q(re, {
|
|
4959
|
-
...
|
|
4958
|
+
...pl({
|
|
4960
4959
|
look: r,
|
|
4961
4960
|
layout: n,
|
|
4962
4961
|
previewComponents: i,
|
|
@@ -4968,29 +4967,29 @@ function pl({ features: e, layout: n = "docked", look: r = "expressive", preview
|
|
|
4968
4967
|
status: o,
|
|
4969
4968
|
actions: s
|
|
4970
4969
|
}),
|
|
4971
|
-
children: /* @__PURE__ */ q(
|
|
4970
|
+
children: /* @__PURE__ */ q(Wi, { children: /* @__PURE__ */ q(D, {}) })
|
|
4972
4971
|
})
|
|
4973
4972
|
}),
|
|
4974
|
-
d && /* @__PURE__ */ q(
|
|
4973
|
+
d && /* @__PURE__ */ q(lc, { onChange: p }),
|
|
4975
4974
|
/* @__PURE__ */ q(l, {}),
|
|
4976
4975
|
/* @__PURE__ */ q(a, {}),
|
|
4977
|
-
/* @__PURE__ */ q(
|
|
4978
|
-
/* @__PURE__ */ q(
|
|
4979
|
-
/* @__PURE__ */ q(
|
|
4980
|
-
O && /* @__PURE__ */ q(
|
|
4976
|
+
/* @__PURE__ */ q(sr, {}),
|
|
4977
|
+
/* @__PURE__ */ q(yi, {}),
|
|
4978
|
+
/* @__PURE__ */ q(Dr, {}),
|
|
4979
|
+
O && /* @__PURE__ */ q(Uc, { adapter: _?.adapter })
|
|
4981
4980
|
]
|
|
4982
4981
|
});
|
|
4983
4982
|
}
|
|
4984
4983
|
//#endregion
|
|
4985
4984
|
//#region lib/components/ui/widgets/editor/presets/document-editor-form-field.tsx
|
|
4986
|
-
function
|
|
4987
|
-
return /* @__PURE__ */ q(
|
|
4985
|
+
function hl({ control: e, name: n, ...r }) {
|
|
4986
|
+
return /* @__PURE__ */ q(Ze, {
|
|
4988
4987
|
control: e,
|
|
4989
4988
|
name: n,
|
|
4990
|
-
render: ({ field: e, fieldState: n }) => /* @__PURE__ */ q(
|
|
4989
|
+
render: ({ field: e, fieldState: n }) => /* @__PURE__ */ q(Qe, {
|
|
4991
4990
|
onBlur: e.onBlur,
|
|
4992
4991
|
focusRef: e.ref,
|
|
4993
|
-
children: /* @__PURE__ */ q(
|
|
4992
|
+
children: /* @__PURE__ */ q(ml, {
|
|
4994
4993
|
...r,
|
|
4995
4994
|
className: t(r.className, e.disabled && "nxgt-editor-disabled"),
|
|
4996
4995
|
value: e.value ?? Re(r.format ?? "html"),
|
|
@@ -5004,7 +5003,7 @@ function ml({ control: e, name: n, ...r }) {
|
|
|
5004
5003
|
}
|
|
5005
5004
|
//#endregion
|
|
5006
5005
|
//#region lib/components/ui/widgets/editor/presets/rich-chat-composer/partials/composer-notices.tsx
|
|
5007
|
-
function
|
|
5006
|
+
function gl({ error: e, replyTo: t, onCancelReply: n, attachments: r, isDisabled: i, onAttachmentsChange: a }) {
|
|
5008
5007
|
return /* @__PURE__ */ J(K, { children: [
|
|
5009
5008
|
e && /* @__PURE__ */ q("div", {
|
|
5010
5009
|
role: "alert",
|
|
@@ -5028,7 +5027,7 @@ function hl({ error: e, replyTo: t, onCancelReply: n, attachments: r, isDisabled
|
|
|
5028
5027
|
}
|
|
5029
5028
|
//#endregion
|
|
5030
5029
|
//#region lib/components/ui/widgets/editor/presets/rich-chat-composer/partials/send-control.tsx
|
|
5031
|
-
function
|
|
5030
|
+
function _l({ sendLabel: e, stopLabel: t, disabled: n, empty: r, onStop: i, onSchedule: a, squircle: o }) {
|
|
5032
5031
|
let { t: s } = j();
|
|
5033
5032
|
return !a || i ? /* @__PURE__ */ q(Oe, {
|
|
5034
5033
|
sendLabel: e,
|
|
@@ -5050,24 +5049,24 @@ function gl({ sendLabel: e, stopLabel: t, disabled: n, empty: r, onStop: i, onSc
|
|
|
5050
5049
|
}
|
|
5051
5050
|
//#endregion
|
|
5052
5051
|
//#region lib/components/ui/widgets/editor/presets/rich-chat-composer/partials/send-on-enter.tsx
|
|
5053
|
-
function
|
|
5052
|
+
function vl(e, t) {
|
|
5054
5053
|
return e.nativeEvent.keyCode !== 229 && ke(e, t);
|
|
5055
5054
|
}
|
|
5056
|
-
function
|
|
5055
|
+
function yl({ onSend: e, sendOnEnter: t, disabled: n, onFocus: r, className: i, children: a }) {
|
|
5057
5056
|
let { handle: o } = k();
|
|
5058
5057
|
return /* @__PURE__ */ q("div", {
|
|
5059
5058
|
"data-slot": "rich-chat-composer-input",
|
|
5060
5059
|
className: i,
|
|
5061
5060
|
onFocus: r,
|
|
5062
5061
|
onKeyDownCapture: (r) => {
|
|
5063
|
-
|
|
5062
|
+
vl(r, t) && (o.suggestions.getSnapshot()?.entries.length || (r.preventDefault(), r.stopPropagation(), n || e()));
|
|
5064
5063
|
},
|
|
5065
5064
|
children: a
|
|
5066
5065
|
});
|
|
5067
5066
|
}
|
|
5068
5067
|
//#endregion
|
|
5069
5068
|
//#region lib/components/ui/widgets/editor/presets/rich-chat-composer/partials/tools-row.tsx
|
|
5070
|
-
function
|
|
5069
|
+
function bl({ pill: e, formatOpen: n, toolbarId: r, onFormatToggle: i, mentionable: a, attach: o, actions: s }) {
|
|
5071
5070
|
let { t: c } = j(), { handle: l } = k(), { editor: u } = l, d = c("material.editor.formatting-toggle", "Text formatting"), f = c("material.editor.mention", "Mention someone");
|
|
5072
5071
|
return /* @__PURE__ */ J("div", {
|
|
5073
5072
|
"data-slot": "rich-chat-composer-tools",
|
|
@@ -5085,7 +5084,7 @@ function yl({ pill: e, formatOpen: n, toolbarId: r, onFormatToggle: i, mentionab
|
|
|
5085
5084
|
"aria-controls": n ? r : void 0,
|
|
5086
5085
|
onClick: i,
|
|
5087
5086
|
className: "size-8 shrink-0 rounded aria-pressed:bg-primary/10 aria-pressed:text-primary-text",
|
|
5088
|
-
children: /* @__PURE__ */ q(
|
|
5087
|
+
children: /* @__PURE__ */ q(At, {})
|
|
5089
5088
|
}),
|
|
5090
5089
|
a && /* @__PURE__ */ q(N, {
|
|
5091
5090
|
variant: "ghost",
|
|
@@ -5094,17 +5093,17 @@ function yl({ pill: e, formatOpen: n, toolbarId: r, onFormatToggle: i, mentionab
|
|
|
5094
5093
|
"aria-label": f,
|
|
5095
5094
|
onClick: () => u?.chain().focus().insertContent("@").run(),
|
|
5096
5095
|
className: "size-8 shrink-0 rounded",
|
|
5097
|
-
children: /* @__PURE__ */ q(
|
|
5096
|
+
children: /* @__PURE__ */ q(kt, {})
|
|
5098
5097
|
}),
|
|
5099
5098
|
s
|
|
5100
5099
|
] })] })
|
|
5101
|
-
}), !e && /* @__PURE__ */ q(
|
|
5100
|
+
}), !e && /* @__PURE__ */ q(fc, { className: "ms-auto self-center px-2" })]
|
|
5102
5101
|
});
|
|
5103
5102
|
}
|
|
5104
5103
|
//#endregion
|
|
5105
5104
|
//#region lib/components/ui/widgets/editor/presets/rich-chat-composer/use-composer-editor.ts
|
|
5106
|
-
function
|
|
5107
|
-
let { t: s } = j(), c = U(() =>
|
|
5105
|
+
function xl({ features: e, minRows: n = 1, maxRows: r = 8, placeholder: i, attributes: a, ...o }) {
|
|
5106
|
+
let { t: s } = j(), c = U(() => sc().map((e) => e.name === "emoji" ? {
|
|
5108
5107
|
...e,
|
|
5109
5108
|
toolbar: void 0
|
|
5110
5109
|
} : e), []);
|
|
@@ -5114,7 +5113,7 @@ function bl({ features: e, minRows: n = 1, maxRows: r = 8, placeholder: i, attri
|
|
|
5114
5113
|
defaults: c,
|
|
5115
5114
|
placeholder: i ?? s("material.chat.placeholder", "Type a message…"),
|
|
5116
5115
|
attributes: {
|
|
5117
|
-
class: t("nxgt-prose text-[0.9375rem] leading-normal focus:outline-none [&>*+*]:mt-2",
|
|
5116
|
+
class: t("nxgt-prose text-[0.9375rem] leading-normal focus:outline-none [&>*+*]:mt-2", kc(n, r)),
|
|
5118
5117
|
"aria-label": s("material.chat.message", "Message"),
|
|
5119
5118
|
...a
|
|
5120
5119
|
}
|
|
@@ -5122,9 +5121,9 @@ function bl({ features: e, minRows: n = 1, maxRows: r = 8, placeholder: i, attri
|
|
|
5122
5121
|
}
|
|
5123
5122
|
//#endregion
|
|
5124
5123
|
//#region lib/components/ui/widgets/editor/presets/rich-chat-composer/use-composer-pill.ts
|
|
5125
|
-
var
|
|
5126
|
-
function
|
|
5127
|
-
let [r, i] = G(!1), [a, o] = G(!1), s =
|
|
5124
|
+
var Sl = "[data-radix-popper-content-wrapper], [role=\"dialog\"]";
|
|
5125
|
+
function Cl({ collapsed: e, occupied: t, files: n }) {
|
|
5126
|
+
let [r, i] = G(!1), [a, o] = G(!1), s = yn();
|
|
5128
5127
|
return {
|
|
5129
5128
|
pill: e === "auto" && !a && !t && !r,
|
|
5130
5129
|
formatOpen: r,
|
|
@@ -5142,27 +5141,27 @@ function Sl({ collapsed: e, occupied: t, files: n }) {
|
|
|
5142
5141
|
},
|
|
5143
5142
|
onBlur: (e) => {
|
|
5144
5143
|
let t = e.relatedTarget;
|
|
5145
|
-
e.currentTarget.contains(t) || t?.closest(
|
|
5144
|
+
e.currentTarget.contains(t) || t?.closest(Sl) || o(!1);
|
|
5146
5145
|
}
|
|
5147
5146
|
}
|
|
5148
5147
|
};
|
|
5149
5148
|
}
|
|
5150
5149
|
//#endregion
|
|
5151
5150
|
//#region lib/components/ui/widgets/editor/presets/rich-chat-composer/build-message.ts
|
|
5152
|
-
async function
|
|
5151
|
+
async function wl(e, t) {
|
|
5153
5152
|
let n = e.getValue(), r = e.getJSON(), i = e.getExtensions?.();
|
|
5154
5153
|
return {
|
|
5155
5154
|
value: n,
|
|
5156
5155
|
json: r,
|
|
5157
|
-
markdown: await
|
|
5156
|
+
markdown: await gt(r, i && { extensions: i }),
|
|
5158
5157
|
attachments: t
|
|
5159
5158
|
};
|
|
5160
5159
|
}
|
|
5161
|
-
var
|
|
5160
|
+
var Tl = (e, t) => e.trim().length > 0 || t > 0;
|
|
5162
5161
|
//#endregion
|
|
5163
5162
|
//#region lib/components/ui/widgets/editor/presets/rich-chat-composer/use-composer-send.ts
|
|
5164
|
-
function
|
|
5165
|
-
let { t: s } = j(), [c, l] = G(!1), u = W(!1), d = () =>
|
|
5163
|
+
function El({ handle: e, attachments: t, blocked: n, clear: r, onSend: i, onSchedule: a, onError: o }) {
|
|
5164
|
+
let { t: s } = j(), [c, l] = G(!1), u = W(!1), d = () => wl({
|
|
5166
5165
|
getValue: () => e.getValue(),
|
|
5167
5166
|
getJSON: () => e.editor?.getJSON() ?? { type: "doc" },
|
|
5168
5167
|
getExtensions: () => e.editor?.extensionManager.extensions
|
|
@@ -5200,7 +5199,7 @@ function Tl({ handle: e, attachments: t, blocked: n, clear: r, onSend: i, onSche
|
|
|
5200
5199
|
}
|
|
5201
5200
|
//#endregion
|
|
5202
5201
|
//#region lib/components/ui/widgets/editor/presets/rich-chat-composer/use-rich-chat-composer.ts
|
|
5203
|
-
function
|
|
5202
|
+
function Dl({ handle: e, onSend: t, onSchedule: n, onError: r, disabled: i = !1, isLoading: a = !1, accept: o, maxFiles: s, attachments: c, onAttachmentsChange: l }) {
|
|
5204
5203
|
let [u, d] = G([]), f = c ?? u, p = (e) => {
|
|
5205
5204
|
c === void 0 && d(e), l?.(e);
|
|
5206
5205
|
}, m = W(null), h = _e({
|
|
@@ -5210,10 +5209,10 @@ function El({ handle: e, onSend: t, onSchedule: n, onError: r, disabled: i = !1,
|
|
|
5210
5209
|
disabled: i,
|
|
5211
5210
|
isLoading: a,
|
|
5212
5211
|
onAttachmentsChange: p
|
|
5213
|
-
}), g = !
|
|
5212
|
+
}), g = !Tl(P({
|
|
5214
5213
|
editor: e.editor,
|
|
5215
5214
|
selector: (e) => (e.editor?.getText().trim().length ?? 0) > 0
|
|
5216
|
-
}) ?? !1 ? "x" : "", f.length), _ =
|
|
5215
|
+
}) ?? !1 ? "x" : "", f.length), _ = El({
|
|
5217
5216
|
handle: e,
|
|
5218
5217
|
attachments: f,
|
|
5219
5218
|
blocked: g || h.isDisabled,
|
|
@@ -5238,11 +5237,11 @@ function El({ handle: e, onSend: t, onSchedule: n, onError: r, disabled: i = !1,
|
|
|
5238
5237
|
}
|
|
5239
5238
|
//#endregion
|
|
5240
5239
|
//#region lib/components/ui/widgets/editor/presets/rich-chat-composer/use-composer.ts
|
|
5241
|
-
function
|
|
5242
|
-
let { t } = j(), { disabled: n = !1, isLoading: r = !1, collapsed: i = "never" } = e, a = !n && !r, o =
|
|
5240
|
+
function Ol(e) {
|
|
5241
|
+
let { t } = j(), { disabled: n = !1, isLoading: r = !1, collapsed: i = "never" } = e, a = !n && !r, o = xl({
|
|
5243
5242
|
...e,
|
|
5244
5243
|
editable: a
|
|
5245
|
-
}), s =
|
|
5244
|
+
}), s = Dl({
|
|
5246
5245
|
...e,
|
|
5247
5246
|
handle: o
|
|
5248
5247
|
}), { files: c, attachments: l } = s;
|
|
@@ -5250,7 +5249,7 @@ function Dl(e) {
|
|
|
5250
5249
|
handle: o,
|
|
5251
5250
|
editable: a,
|
|
5252
5251
|
composer: s,
|
|
5253
|
-
ui:
|
|
5252
|
+
ui: Cl({
|
|
5254
5253
|
collapsed: i,
|
|
5255
5254
|
occupied: !o.isEmpty || !!e.replyTo || l.length > 0,
|
|
5256
5255
|
files: c
|
|
@@ -5269,8 +5268,8 @@ function Dl(e) {
|
|
|
5269
5268
|
}
|
|
5270
5269
|
//#endregion
|
|
5271
5270
|
//#region lib/components/ui/widgets/editor/presets/rich-chat-composer/rich-chat-composer.tsx
|
|
5272
|
-
function
|
|
5273
|
-
let { t: n } = j(), { mentions: r, replyTo: i, onCancelReply: o, actions: s, className: c } = e, { sendOnEnter: u = !0, sendLabel: d, isLoading: f = !1 } = e, { look: p = "expressive" } = e, { handle: m, editable: h, composer: _, ui: v, attach: y } =
|
|
5271
|
+
function kl(e) {
|
|
5272
|
+
let { t: n } = j(), { mentions: r, replyTo: i, onCancelReply: o, actions: s, className: c } = e, { sendOnEnter: u = !0, sendLabel: d, isLoading: f = !1 } = e, { look: p = "expressive" } = e, { handle: m, editable: h, composer: _, ui: v, attach: y } = Ol(e), { files: b, attachments: x } = _, { pill: S } = v;
|
|
5274
5273
|
return /* @__PURE__ */ q("form", {
|
|
5275
5274
|
"data-slot": "rich-chat-composer",
|
|
5276
5275
|
"data-look": p,
|
|
@@ -5283,7 +5282,7 @@ function Ol(e) {
|
|
|
5283
5282
|
className: "contents",
|
|
5284
5283
|
look: p,
|
|
5285
5284
|
children: [
|
|
5286
|
-
/* @__PURE__ */ q(
|
|
5285
|
+
/* @__PURE__ */ q(gl, {
|
|
5287
5286
|
error: b.errorMessage ?? _.sendError,
|
|
5288
5287
|
replyTo: i,
|
|
5289
5288
|
onCancelReply: o,
|
|
@@ -5291,7 +5290,7 @@ function Ol(e) {
|
|
|
5291
5290
|
isDisabled: b.isDisabled,
|
|
5292
5291
|
onAttachmentsChange: _.setAttachments
|
|
5293
5292
|
}),
|
|
5294
|
-
/* @__PURE__ */ q(
|
|
5293
|
+
/* @__PURE__ */ q(yl, {
|
|
5295
5294
|
className: t("min-w-0 px-2 py-1", S ? "order-2 flex-1" : "w-full"),
|
|
5296
5295
|
onFocus: v.activate,
|
|
5297
5296
|
onSend: () => void _.send(),
|
|
@@ -5306,10 +5305,10 @@ function Ol(e) {
|
|
|
5306
5305
|
children: /* @__PURE__ */ q(E, {
|
|
5307
5306
|
dividers: !1,
|
|
5308
5307
|
density: "compact",
|
|
5309
|
-
className:
|
|
5308
|
+
className: Ic(p, yc)
|
|
5310
5309
|
})
|
|
5311
5310
|
}),
|
|
5312
|
-
/* @__PURE__ */ q(
|
|
5311
|
+
/* @__PURE__ */ q(bl, {
|
|
5313
5312
|
pill: S,
|
|
5314
5313
|
formatOpen: v.formatOpen,
|
|
5315
5314
|
toolbarId: v.toolbarId,
|
|
@@ -5320,7 +5319,7 @@ function Ol(e) {
|
|
|
5320
5319
|
}),
|
|
5321
5320
|
/* @__PURE__ */ q("div", {
|
|
5322
5321
|
className: t("shrink-0", S && "order-3"),
|
|
5323
|
-
children: /* @__PURE__ */ q(
|
|
5322
|
+
children: /* @__PURE__ */ q(_l, {
|
|
5324
5323
|
sendLabel: d ?? n("material.chat.send", "Send"),
|
|
5325
5324
|
stopLabel: n("material.chat.composer.stop", "Stop generating"),
|
|
5326
5325
|
disabled: b.isDisabled,
|
|
@@ -5338,25 +5337,25 @@ function Ol(e) {
|
|
|
5338
5337
|
}
|
|
5339
5338
|
//#endregion
|
|
5340
5339
|
//#region lib/components/ui/widgets/editor/index.ts
|
|
5341
|
-
var
|
|
5340
|
+
var Al = {
|
|
5342
5341
|
Root: g,
|
|
5343
5342
|
Content: D,
|
|
5344
5343
|
Toolbar: E,
|
|
5345
|
-
Panel:
|
|
5346
|
-
AssistantPanel:
|
|
5344
|
+
Panel: jr,
|
|
5345
|
+
AssistantPanel: sr,
|
|
5347
5346
|
BubbleMenu: l,
|
|
5348
|
-
CommentsRail:
|
|
5349
|
-
CommentsPanel:
|
|
5350
|
-
CommentComposer:
|
|
5347
|
+
CommentsRail: Oi,
|
|
5348
|
+
CommentsPanel: yi,
|
|
5349
|
+
CommentComposer: Dr,
|
|
5351
5350
|
SuggestionList: a,
|
|
5352
|
-
Footer:
|
|
5353
|
-
Outline:
|
|
5354
|
-
OutlinePanel:
|
|
5355
|
-
FindPanel:
|
|
5356
|
-
BlockHandle:
|
|
5357
|
-
FocusExit:
|
|
5351
|
+
Footer: Ta,
|
|
5352
|
+
Outline: Na,
|
|
5353
|
+
OutlinePanel: Fa,
|
|
5354
|
+
FindPanel: ga,
|
|
5355
|
+
BlockHandle: Wi,
|
|
5356
|
+
FocusExit: ya,
|
|
5358
5357
|
Field: Me,
|
|
5359
|
-
Presence:
|
|
5358
|
+
Presence: hr
|
|
5360
5359
|
};
|
|
5361
5360
|
//#endregion
|
|
5362
|
-
export {
|
|
5361
|
+
export { Bc as CompactEditor, Hc as CompactEditorFormField, ml as DocumentEditor, hl as DocumentEditorFormField, Al as Editor, sr as EditorAssistantPanel, Wi as EditorBlockHandle, l as EditorBubbleMenu, Dr as EditorCommentComposer, yi as EditorCommentsPanel, Oi as EditorCommentsRail, D as EditorContent, Me as EditorField, ga as EditorFindPanel, ya as EditorFocusExit, Ta as EditorFooter, Na as EditorOutline, Fa as EditorOutlinePanel, jr as EditorPanel, hr as EditorPresence, g as EditorRoot, a as EditorSuggestionList, E as EditorToolbar, kl as RichChatComposer, sc as chatKit, oc as compactKit, B as defineFeature, ac as documentKit, tc as editorFeatures, ic as formNodesKit, vt as fromMarkdown, Ha as looksLikeMarkdown, yt as toHtml, _t as toJson, gt as toMarkdown, T as useEditor, k as useEditorContext, dr as useEditorPresence, Sa as useEditorStats, Ra as useEditorUploads, nc as withFeatures, rc as withoutFeatures };
|