@kition/kit-editor 0.2.0 → 0.3.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/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { KitRpcError as he, isHello as co, KIT_UI_PROTOCOL as Bt, isHandshake as uo, KitPeer as ho, parseCommentAnchor as zn, HOST_SERVICE_CAPABILITY_PREFIX as Bn, parseKitView as _n, parseWatermark as fo, parseDocumentPermissions as mo, matchesShortcut as Hr, INVALID_PARAMS_REASON as At, LEASE_HELD_REASON as fn, ORIGIN_LABEL as po, HOST_ORIGIN_LABEL as go, parsePeers as
|
|
1
|
+
import { KitRpcError as he, isHello as co, KIT_UI_PROTOCOL as Bt, isHandshake as uo, KitPeer as ho, parseCommentAnchor as zn, HOST_SERVICE_CAPABILITY_PREFIX as Bn, parseKitView as _n, parseWatermark as fo, parseDocumentPermissions as mo, matchesShortcut as Hr, INVALID_PARAMS_REASON as At, LEASE_HELD_REASON as fn, ORIGIN_LABEL as po, HOST_ORIGIN_LABEL as go, parsePeers as wo, parsePresence as bo } from "@kition/kit-ui-protocol";
|
|
2
2
|
import { fileErrorReason as th, isOpenableUrl as nh, openErrorReason as rh } from "@kition/kit-ui-protocol";
|
|
3
|
-
import { brandTokens as yo, validBrand as vo, Dialog as st, Button as me, ElementsProvider as ko, MenuItem as le, RibbonButton as
|
|
4
|
-
import { Badge as oh, BarChart as ah, BarSeparator as sh, Button as lh, Card as ch, CardContent as dh, CardHeader as uh, Checkbox as hh, Choice as fh, ColorGrid as mh, ColorPicker as ph, ColorWheel as gh, Command as
|
|
3
|
+
import { brandTokens as yo, validBrand as vo, Dialog as st, Button as me, ElementsProvider as ko, MenuItem as le, RibbonButton as we, ICON_STROKE as $e, RibbonGroup as Me, StringsProvider as So, RibbonPresentationContext as vt, RibbonFitContext as Yt, lineSize as Co, MenuButton as lt, FULL_RIBBON_FIT as mn, menuKeyDown as xo, toast as pt, IconButton as De, OverflowStrip as Et, StatusBar as $o, StatusSpacer as Io, ZoomControl as Mo, Toaster as To, RibbonStack as Fe, ColorGrid as Vt, MenuSeparator as Ae, Choice as gt, Checkbox as Xt, LineMoreLabelContext as Ao, DropPanel as Eo } from "@kition/tessera-ui";
|
|
4
|
+
import { Badge as oh, BarChart as ah, BarSeparator as sh, Button as lh, Card as ch, CardContent as dh, CardHeader as uh, Checkbox as hh, Choice as fh, ColorGrid as mh, ColorPicker as ph, ColorWheel as gh, Command as wh, CommandEmpty as bh, CommandGroup as yh, CommandInput as vh, CommandList as kh, CommandItem as Sh, CommandSeparator as Ch, CommandShortcut as xh, ConfirmProvider as $h, ContextMenu as Ih, CurveEditor as Mh, Dialog as Th, Disclosure as Ah, DockArea as Eh, EyeButton as Oh, Field as Rh, FloatingPanels as Dh, GradientSlider as Lh, Hint as Nh, Histogram as Ph, ICON_STROKE as Fh, IconButton as Wh, KeyframeLane as zh, LevelMeter as Bh, LineChart as _h, LineMoreLabelContext as Kh, MenuButton as Hh, MenuItem as Uh, MenuSeparator as qh, Modal as jh, ModalBody as Gh, ModalClose as Yh, ModalCloseButton as Vh, ModalContent as Xh, ModalDescription as Jh, ModalFooter as Zh, ModalHeader as Qh, ModalTitle as ef, ModalTrigger as tf, NumberField as nf, OverflowStrip as rf, PALETTE_COLORS as of, Panel as af, PanelFooter as sf, PasswordInput as lf, PieChart as cf, Popover as df, PopoverAnchor as uf, PopoverClose as hf, PopoverContent as ff, PopoverTrigger as mf, PreviewDialog as pf, RGB_IDENTITY as gf, RenameField as wf, RibbonButton as bf, RibbonGroup as yf, RibbonItem as vf, RibbonPresentationContext as kf, RibbonRow as Sf, RibbonStack as Cf, SLIDER_GRADIENTS as xf, STANDARD_COLORS as $f, Segmented as If, Select as Mf, Sheet as Tf, Spinner as Af, StatusBar as Ef, StatusSpacer as Of, Switch as Rf, TableSizePicker as Df, TextInput as Lf, Textarea as Nf, Thumbnail as Pf, TimecodeField as Ff, Toaster as Wf, Tooltip as zf, TooltipContent as Bf, TooltipProvider as _f, TooltipTrigger as Kf, TransportBar as Hf, WORKSPACE_ACTIONS as Uf, WorkspaceLayout as qf, ZoomControl as jf, addCurvePoint as Gf, automaticFloatingPosition as Yf, brandTokens as Vf, clampFloatingRect as Xf, contrast as Jf, deviceScale as Zf, dockHeights as Qf, formatTimecode as em, hitCurvePoint as tm, kitStoreKey as nm, lightnessAt as rm, lineSize as im, menuKeyDown as om, meterFraction as am, meterLayout as sm, moveCurvePoint as lm, overflowOf as cm, parseHex as dm, parseTimecode as um, rankScale as hm, readKitStore as fm, removeCurvePoint as mm, removeKitStore as pm, resizeFloatingRect as gm, rgbToHex as wm, sampleCurve as bm, sliderFraction as ym, sliderValueAt as vm, smoothHistogram as km, sortCurve as Sm, storedBytes as Cm, toast as xm, useAutoSize as $m, useConfirm as Im, useDialogFocus as Mm, useDismissableLayer as Tm, useKitStore as Am, useMediaQuery as Em, useWorkspaces as Om, wheelRadius as Rm, wheelValueAt as Dm, workspaceSlug as Lm, writeKitStore as Nm } from "@kition/tessera-ui";
|
|
5
5
|
import { useRef as R, useState as B, useCallback as H, useEffect as J, useMemo as pe, useImperativeHandle as Oo, createContext as Ot, useContext as Le, useSyncExternalStore as He, useLayoutEffect as Te, Fragment as Ro } from "react";
|
|
6
6
|
import { jsx as u, jsxs as M, Fragment as Ce } from "react/jsx-runtime";
|
|
7
|
-
import { CommandGenericIcon as Do, HeadingIcon as
|
|
7
|
+
import { CommandGenericIcon as Do, HeadingIcon as Ur, ListTreeIcon as Lo, CodeIcon as No, ArrowRightLeftIcon as Po, WaypointsIcon as qr, GaugeIcon as Fo, SlidersHorizontalIcon as _t, ClipboardIcon as Wo, DatabaseIcon as Kn, HashIcon as pn, ArrowDownToLineIcon as zo, ZapIcon as Bo, PaintbrushIcon as _o, TextCursorInputIcon as Ko, ListOrderedIcon as Hn, NetworkIcon as Ho, MousePointerClickIcon as jr, PenToolIcon as Gr, PencilIcon as tt, HighlighterIcon as Yr, WholeWordIcon as Uo, TextCursorIcon as qo, RulerIcon as Ve, ClapperboardIcon as Vr, BrushIcon as Xr, BlendIcon as Qe, PaletteIcon as Rt, TypeIcon as qe, PilcrowIcon as jo, SwatchBookIcon as Go, LayersIcon as kt, SplineIcon as gn, CameraIcon as Yo, Rows3Icon as Jr, FilmIcon as Un, BookmarkIcon as Zr, DiamondIcon as Qr, BoxIcon as ei, Grid3x3Icon as St, FrameIcon as Jt, FolderIcon as qn, ClockIcon as Vo, Volume2Icon as Xo, VideoIcon as ti, SettingsIcon as wn, ShapesIcon as _e, LightbulbIcon as Jo, SquareIcon as ct, CrosshairIcon as Zo, Grid2x2Icon as Qo, MoveUpRightIcon as ea, MessageSquareIcon as Dt, FileIcon as bn, TableIcon as yn, SquareFunctionIcon as ni, ComponentIcon as ta, WandSparklesIcon as vn, MousePointer2Icon as nt, BoldIcon as na, ItalicIcon as ri, UnderlineIcon as ra, StrikethroughIcon as ia, SubscriptIcon as oa, SuperscriptIcon as aa, SquareDashedIcon as jn, ContrastIcon as sa, HandIcon as ii, ChevronsDownUpIcon as la, ChevronsUpDownIcon as ca, LinkIcon as Ct, ShieldCheckIcon as da, LifeBuoyIcon as ua, TrashIcon as rt, BookOpenIcon as ha, ArrowLeftIcon as fa, ArrowRightIcon as Gn, ArrowUpIcon as Yn, ArrowDownIcon as Vn, ArrowLeftToLineIcon as ma, ArrowRightToLineIcon as pa, ClipLiftIcon as ga, ClipExtractIcon as wa, FastForwardIcon as ba, StepForwardIcon as Xn, EyeOffIcon as Jn, Undo2Icon as kn, Redo2Icon as oi, SaveIcon as ai, FileOutputIcon as ya, FileInputIcon as va, FolderOpenIcon as ka, XIcon as Zt, PrinterIcon as Sn, CopyIcon as Cn, ScissorsIcon as xn, ClipboardPasteIcon as si, PencilLineIcon as Sa, SearchIcon as li, ReplaceIcon as ci, AlignCenterHorizontalIcon as Ca, RotateCwIcon as $n, FlipHorizontalIcon as xa, MoveIcon as di, ScalingIcon as ui, MergeIcon as $a, SplitIcon as Ia, GroupIcon as In, UngroupIcon as Mn, LockIcon as Tn, LockOpenIcon as Ma, EyeIcon as An, ZoomInIcon as hi, PlayIcon as Ta, PauseIcon as Aa, DiscIcon as Ea, RotateCcwIcon as fi, CheckIcon as En, ToggleLeftIcon as Oa, ChevronRightIcon as On, ChevronLeftIcon as Ra, CropIcon as mi, PlusIcon as pi, ListIcon as Da, RepeatIcon as La, ArrowUpDownIcon as gi, FunnelIcon as wi, UnlinkIcon as Na, RefreshCwIcon as bi, BringToFrontIcon as Qt, MagnetIcon as Pa, PenLineIcon as it, PaintBucketIcon as xt, TablePropertiesIcon as Fa, ActivityIcon as Wa, ChartColumnIcon as je, ImageIcon as za, StickerIcon as Ba, PanelTopIcon as yi, PanelBottomIcon as _a, SigmaIcon as Ka, OmegaIcon as Ha, SquareCheckBigIcon as Ua, SignatureIcon as qa, CalendarIcon as ja, MusicIcon as Ga, QrCodeIcon as Ya, LayoutTemplateIcon as Va, FilePlusIcon as Xa, Columns2Icon as vi, SpellCheckIcon as Ja, LanguagesIcon as Za, TagIcon as ki, RulerDimensionLineIcon as Qa, RadiusIcon as es, DiameterIcon as ts, PackageIcon as ns, StickyNoteIcon as rs, MousePointerIcon as is, LassoIcon as os, MinusIcon as Si, RainbowIcon as as, ShellIcon as ss, CircleIcon as Ci, EraserIcon as xi, VectorPolygonIcon as ls, VectorSquareIcon as cs, WavesHorizontalIcon as ds, Move3dIcon as us, PipetteIcon as hs, CopyPlusIcon as fs, MoveHorizontalIcon as ms, CornerDownRightIcon as ps, UploadIcon as gs, StarIcon as $i, Share2Icon as ws, SendIcon as bs, MailIcon as ys, InfoIcon as vs, CircleQuestionMarkIcon as ks, FlagIcon as Ss, DownloadIcon as Cs, BellIcon as xs, ChevronDownIcon as Ii, ChevronsLeftIcon as $s, ChevronsRightIcon as Is, SparklesIcon as Lt, EllipsisIcon as Ms, RectangleHorizontalIcon as Mi, TriangleIcon as Ts, MoveRightIcon as As, SendToBackIcon as Es, CableIcon as Os, PenIcon as Ti, ChartColumnStackedIcon as Rs, ChartLineIcon as Zn, ChartAreaIcon as Ds, ChartPieIcon as Qn, ChartScatterIcon as Ls, RadarIcon as Ns, LayoutGridIcon as Ps, TrendingUpIcon as Fs, Table2Icon as Ws, Minimize2Icon as zs, FocusIcon as Ai, MenuIcon as Bs } from "@kition/tessera-icons/react";
|
|
8
8
|
import * as lu from "@kition/tessera-icons/react";
|
|
9
9
|
import { w as Fm } from "./chunks/workspaceTree-CpJ2i9hy.js";
|
|
10
10
|
const en = ["menus", "line", "classic", "focus"], _s = ["menus", "line", "classic"], Ks = 720;
|
|
@@ -24,7 +24,7 @@ function Hs(e) {
|
|
|
24
24
|
return null;
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
|
-
function
|
|
27
|
+
function Us(e, t) {
|
|
28
28
|
try {
|
|
29
29
|
localStorage.setItem(Oi(e), t);
|
|
30
30
|
} catch {
|
|
@@ -35,7 +35,7 @@ function Ri(e) {
|
|
|
35
35
|
const t = e.allowed;
|
|
36
36
|
return t?.length ? en.filter((n) => t.includes(n)) : en;
|
|
37
37
|
}
|
|
38
|
-
function
|
|
38
|
+
function qs({ stored: e, rules: t, kit: n, readOnly: r }) {
|
|
39
39
|
const i = Ri(t), o = t.default === "focus" ? null : t.default, a = [e, o, r ? "menus" : null, n, "line"];
|
|
40
40
|
for (const s of a) if (s && i.includes(s)) return s;
|
|
41
41
|
return i.find((s) => s !== "focus") ?? "menus";
|
|
@@ -270,10 +270,10 @@ function cu(e) {
|
|
|
270
270
|
(m) => a.notify("ui/action", m)
|
|
271
271
|
);
|
|
272
272
|
a.on("ui/configure", (m) => g.replace(tr(m?.ui))), document.documentElement.lang = s.locale;
|
|
273
|
-
const
|
|
274
|
-
|
|
273
|
+
const w = s.shortcuts, b = (m) => {
|
|
274
|
+
w.some((y) => Hr(y, m, Nt())) && (m.preventDefault(), m.stopPropagation(), a.notify("host/shortcut", { key: m.key, code: m.code, meta: m.metaKey, ctrl: m.ctrlKey, shift: m.shiftKey, alt: m.altKey }));
|
|
275
275
|
};
|
|
276
|
-
window.addEventListener("keydown",
|
|
276
|
+
window.addEventListener("keydown", b, !0), a.on("ui/theme", ({ theme: m }) => nr(m, f)), a.on("ui/locale", ({ locale: m }) => {
|
|
277
277
|
document.documentElement.lang = m;
|
|
278
278
|
}), t({
|
|
279
279
|
peer: a,
|
|
@@ -328,12 +328,12 @@ function cu(e) {
|
|
|
328
328
|
}),
|
|
329
329
|
activateComment: (m) => a.notify("comments/activated", { id: m }),
|
|
330
330
|
locateComments: (m) => a.handle("comments/locate", async (y) => {
|
|
331
|
-
const N = (Array.isArray(y?.anchors) ? y.anchors : []).map((
|
|
331
|
+
const N = (Array.isArray(y?.anchors) ? y.anchors : []).map((U) => zn(U)), E = await m(N.filter((U) => U !== null));
|
|
332
332
|
let Y = 0;
|
|
333
|
-
return { found: N.map((
|
|
333
|
+
return { found: N.map((U) => U ? E[Y++] === !0 : !1) };
|
|
334
334
|
}),
|
|
335
335
|
close: () => {
|
|
336
|
-
window.removeEventListener("keydown",
|
|
336
|
+
window.removeEventListener("keydown", b, !0), a.close();
|
|
337
337
|
}
|
|
338
338
|
});
|
|
339
339
|
})
|
|
@@ -467,7 +467,7 @@ class Wi extends Error {
|
|
|
467
467
|
super(n), this.reason = t, this.name = "KitEngineRefusal";
|
|
468
468
|
}
|
|
469
469
|
}
|
|
470
|
-
const
|
|
470
|
+
const Ut = { width: 0, height: 0, pinned: { left: 0, top: 0 }, revision: 0, dirty: !1, canUndo: !1, canRedo: !1, inspected: {} };
|
|
471
471
|
class ot {
|
|
472
472
|
constructor(t, n) {
|
|
473
473
|
this.worker = t, this.info = n;
|
|
@@ -487,9 +487,9 @@ class ot {
|
|
|
487
487
|
static async open(t, n, r, i = null, o = null, a = !1, s = !1) {
|
|
488
488
|
const d = new Worker(new URL(
|
|
489
489
|
/* @vite-ignore */
|
|
490
|
-
"" + new URL("assets/kitEngine.worker-
|
|
490
|
+
"" + new URL("assets/kitEngine.worker-D-kUyohc.js", import.meta.url).href,
|
|
491
491
|
import.meta.url
|
|
492
|
-
), { type: "module" }), c = new ot(d,
|
|
492
|
+
), { type: "module" }), c = new ot(d, Ut);
|
|
493
493
|
d.onmessage = (l) => c.settle(l.data), d.onerror = (l) => c.fail(new Error(l.message || "the kit engine stopped"));
|
|
494
494
|
try {
|
|
495
495
|
const l = o?.stored;
|
|
@@ -505,9 +505,9 @@ class ot {
|
|
|
505
505
|
static async create(t, n, r, i, o = null, a = !1) {
|
|
506
506
|
const s = new Worker(new URL(
|
|
507
507
|
/* @vite-ignore */
|
|
508
|
-
"" + new URL("assets/kitEngine.worker-
|
|
508
|
+
"" + new URL("assets/kitEngine.worker-D-kUyohc.js", import.meta.url).href,
|
|
509
509
|
import.meta.url
|
|
510
|
-
), { type: "module" }), d = new ot(s,
|
|
510
|
+
), { type: "module" }), d = new ot(s, Ut);
|
|
511
511
|
s.onmessage = (c) => d.settle(c.data), s.onerror = (c) => d.fail(new Error(c.message || "the kit engine stopped"));
|
|
512
512
|
try {
|
|
513
513
|
return d.info = await d.call({ method: "create", manifest: t, name: n, width: r, height: i, lent: o, readOnly: a }), d;
|
|
@@ -547,7 +547,7 @@ class ot {
|
|
|
547
547
|
*/
|
|
548
548
|
async execute(t, n = {}, r, i) {
|
|
549
549
|
const o = { method: "execute", command: t, params: n, ...r ? { origin: r } : {}, ...i ? { agent: { state: i.state.state, set: i.set } } : {} }, { result: a, info: s, state: d, closed: c } = await this.call(o);
|
|
550
|
-
return c && (this.closed = !0, this.info =
|
|
550
|
+
return c && (this.closed = !0, this.info = Ut), s && (this.info = s), i && d !== void 0 && (i.state.state = d), a;
|
|
551
551
|
}
|
|
552
552
|
/** RGBA8 of the area at (`x`, `y`) document pixels shown at `scale` screen pixels per pixel. */
|
|
553
553
|
async render(t, n, r, i, o) {
|
|
@@ -741,14 +741,14 @@ function gl() {
|
|
|
741
741
|
};
|
|
742
742
|
}
|
|
743
743
|
const on = /* @__PURE__ */ new WeakMap();
|
|
744
|
-
function
|
|
744
|
+
function wl(e, t) {
|
|
745
745
|
const n = on.get(e);
|
|
746
746
|
return n ? (n.current = t, () => {
|
|
747
747
|
n.current === t && (n.current = null);
|
|
748
748
|
}) : () => {
|
|
749
749
|
};
|
|
750
750
|
}
|
|
751
|
-
class
|
|
751
|
+
class bl extends Error {
|
|
752
752
|
constructor(t) {
|
|
753
753
|
super(`${t} changed on disk since it was opened; merge the change or keep yours before saving`), this.name = "FileChangedError";
|
|
754
754
|
}
|
|
@@ -765,11 +765,11 @@ function kl(e, t, n, r, i, o = {}) {
|
|
|
765
765
|
c.current = o.followFile;
|
|
766
766
|
const l = R(null), p = R(i);
|
|
767
767
|
p.current = i;
|
|
768
|
-
const h = R(null), f = R(!1), [g,
|
|
768
|
+
const h = R(null), f = R(!1), [g, w] = B(null), [b, m] = B(null), [y, I] = B(null), [N, E] = B({ revision: 0, damage: null }), [Y, U] = B(!1), [V, j] = B(null), [D, Z] = B(null), [Q, fe] = B(!1), [ce, k] = B(!1), [O, q] = B(0), x = R(null);
|
|
769
769
|
x.current ??= gl();
|
|
770
770
|
const C = x.current, W = H((S = null) => {
|
|
771
771
|
const $ = l.current;
|
|
772
|
-
$ && (m($.info), I(p.current($.info)),
|
|
772
|
+
$ && (m($.info), I(p.current($.info)), U($.info.dirty), E((F) => ({ revision: F.revision + 1, damage: S })));
|
|
773
773
|
}, []), _ = H(async (S) => {
|
|
774
774
|
f.current = !0;
|
|
775
775
|
try {
|
|
@@ -783,7 +783,7 @@ function kl(e, t, n, r, i, o = {}) {
|
|
|
783
783
|
return;
|
|
784
784
|
}
|
|
785
785
|
const ke = l.current;
|
|
786
|
-
l.current = oe, h.current = F,
|
|
786
|
+
l.current = oe, h.current = F, w(oe), k(!1), j(null), W(), ke?.dispose();
|
|
787
787
|
} finally {
|
|
788
788
|
f.current = !1;
|
|
789
789
|
}
|
|
@@ -852,7 +852,7 @@ function kl(e, t, n, r, i, o = {}) {
|
|
|
852
852
|
const de = X.skipUnchangedPaint ? { revision: ee.info.revision, inspected: JSON.stringify(ee.info.inspected) } : null, oe = await ee.execute(S, $, X.origin, X.agent);
|
|
853
853
|
if (l.current === ee) {
|
|
854
854
|
if (ee.closed)
|
|
855
|
-
return ee.dispose(), l.current = null,
|
|
855
|
+
return ee.dispose(), l.current = null, w(null), m(null), I(null), U(!1), k(!1), oe;
|
|
856
856
|
const ke = X.refresh ?? "all", dt = de != null && ee.info.revision === de.revision && JSON.stringify(ee.info.inspected) === de.inspected;
|
|
857
857
|
ke === "all" ? W(dt ? rr : F) : ke === "repaint" && C.bump(F);
|
|
858
858
|
}
|
|
@@ -877,7 +877,7 @@ function kl(e, t, n, r, i, o = {}) {
|
|
|
877
877
|
try {
|
|
878
878
|
const $ = h.current, F = $ ? await e.stamp(n).catch(() => null) : null;
|
|
879
879
|
if ($ && F && F !== $)
|
|
880
|
-
throw k(!0), new
|
|
880
|
+
throw k(!0), new bl(n);
|
|
881
881
|
const { bytes: X, replica: ee, revision: de } = await ue(async () => e.replicaWrite ? S.saveWithReplica() : { ...await S.serialize(), replica: null });
|
|
882
882
|
h.current = await ml(e, n, X, ee, $), l.current === S && await S.markSaved(de), k(!1), W();
|
|
883
883
|
} finally {
|
|
@@ -942,7 +942,7 @@ function kl(e, t, n, r, i, o = {}) {
|
|
|
942
942
|
}),
|
|
943
943
|
compare: ($, F) => S().replicaCompare($, F)
|
|
944
944
|
};
|
|
945
|
-
}, [e, t, ue, n, a, W]), se = H(() =>
|
|
945
|
+
}, [e, t, ue, n, a, W]), se = H(() => q((S) => S + 1), []), ge = H(
|
|
946
946
|
async (S) => {
|
|
947
947
|
if (!S) return;
|
|
948
948
|
h.current = S, await e.stamp(n).catch(() => null) === S && k(!1);
|
|
@@ -953,7 +953,7 @@ function kl(e, t, n, r, i, o = {}) {
|
|
|
953
953
|
const S = await e.stamp(n).catch(() => null);
|
|
954
954
|
S && (h.current = S);
|
|
955
955
|
}, [e, n]), z = pe(() => ({ get: C.get, subscribe: C.subscribe }), [C]);
|
|
956
|
-
return { path: n, manifest: t, doc: g, info:
|
|
956
|
+
return { path: n, manifest: t, doc: g, info: b, state: y, change: N, repaints: z, dirty: Y, failure: V, openMs: D, saving: Q, conflict: ce, run: Ie, tool: Ne, commands: We, disabledCommands: A, save: L, replica: re, model: ie, draft: ae, reopen: se, keepMine: v, checkFile: P, holdFile: ge };
|
|
957
957
|
}
|
|
958
958
|
async function an(e, t) {
|
|
959
959
|
const n = Math.min(1, t / Math.max(1, e.width, e.height)), r = Math.max(1, Math.round(e.width * n)), i = Math.max(1, Math.round(e.height * n)), o = await e.render(0, 0, n, r, i), a = document.createElement("canvas");
|
|
@@ -1063,7 +1063,7 @@ class Cl {
|
|
|
1063
1063
|
}
|
|
1064
1064
|
const xl = [
|
|
1065
1065
|
[/^tool-selection$/, nt],
|
|
1066
|
-
[/^tool-page$/,
|
|
1066
|
+
[/^tool-page$/, bn],
|
|
1067
1067
|
[/^tool-gap$/, vi],
|
|
1068
1068
|
[/^tool-(collector|placer)/, ns],
|
|
1069
1069
|
[/^tool-(rect-frame|ellipse-frame|polygon-frame)/, Jt],
|
|
@@ -1075,7 +1075,7 @@ const xl = [
|
|
|
1075
1075
|
[/^tool-lasso/, os],
|
|
1076
1076
|
[/^tool-(pen|anchor)/, Gr],
|
|
1077
1077
|
[/^tool-curvature/, gn],
|
|
1078
|
-
[/^tool-(type|touch-type)/,
|
|
1078
|
+
[/^tool-(type|touch-type)/, qe],
|
|
1079
1079
|
[/^tool-line$/, Si],
|
|
1080
1080
|
[/^tool-arc/, as],
|
|
1081
1081
|
[/^tool-spiral/, ss],
|
|
@@ -1091,7 +1091,7 @@ const xl = [
|
|
|
1091
1091
|
[/^tool-shear/, ri],
|
|
1092
1092
|
[/^tool-reshape/, ls],
|
|
1093
1093
|
[/^tool-free-transform/, cs],
|
|
1094
|
-
[/^tool-puppet/,
|
|
1094
|
+
[/^tool-puppet/, qr],
|
|
1095
1095
|
[/^tool-(width|warp|twirl|pucker|bloat|scallop|crystallize|wrinkle)/, ds],
|
|
1096
1096
|
[/^tool-shape-builder/, _e],
|
|
1097
1097
|
[/^tool-bucket/, xt],
|
|
@@ -1133,10 +1133,10 @@ const Il = [
|
|
|
1133
1133
|
[/equation|formula|function/, ni],
|
|
1134
1134
|
[/sum|sigma/, Ka],
|
|
1135
1135
|
[/symbol|special char/, Ha],
|
|
1136
|
-
[/check ?box|checkbox/,
|
|
1136
|
+
[/check ?box|checkbox/, Ua],
|
|
1137
1137
|
[/comment|note/, Dt],
|
|
1138
|
-
[/text|word ?art|caption/,
|
|
1139
|
-
[/signature/,
|
|
1138
|
+
[/text|word ?art|caption/, qe],
|
|
1139
|
+
[/signature/, qa],
|
|
1140
1140
|
[/date|time/, ja],
|
|
1141
1141
|
[/number|numbering/, pn],
|
|
1142
1142
|
[/video|movie|media/, ti],
|
|
@@ -1148,7 +1148,7 @@ const Il = [
|
|
|
1148
1148
|
[/page|section|break|sheet|slide/, Xa],
|
|
1149
1149
|
[/rows?\b/, Jr],
|
|
1150
1150
|
[/columns?\b/, vi],
|
|
1151
|
-
[/filter/,
|
|
1151
|
+
[/filter/, wi],
|
|
1152
1152
|
[/sort/, gi],
|
|
1153
1153
|
[/ungroup/, Mn],
|
|
1154
1154
|
[/group/, In],
|
|
@@ -1161,12 +1161,12 @@ const Il = [
|
|
|
1161
1161
|
[/copy|duplicate/, Cn],
|
|
1162
1162
|
[/cut\b/, xn],
|
|
1163
1163
|
[/delete|remove|clear/, rt],
|
|
1164
|
-
[/refresh|recalc/,
|
|
1164
|
+
[/refresh|recalc/, bi],
|
|
1165
1165
|
[/protect|lock/, Tn],
|
|
1166
1166
|
[/name|label|tag/, ki],
|
|
1167
1167
|
[/show|hide|view/, An],
|
|
1168
|
-
[/option|setting|propert/,
|
|
1169
|
-
[/\bfile\b|document/,
|
|
1168
|
+
[/option|setting|propert/, wn],
|
|
1169
|
+
[/\bfile\b|document/, bn]
|
|
1170
1170
|
], Ml = [
|
|
1171
1171
|
[/^(?:bold)$/, na],
|
|
1172
1172
|
[/^(?:italic)$/, ri],
|
|
@@ -1193,8 +1193,8 @@ const Il = [
|
|
|
1193
1193
|
[/^(?:home|start)$/, ma],
|
|
1194
1194
|
[/^(?:end)$/, pa],
|
|
1195
1195
|
[/^(?:lift)$/, ga],
|
|
1196
|
-
[/^(?:extract)$/,
|
|
1197
|
-
[/^(?:shuttle)$/,
|
|
1196
|
+
[/^(?:extract)$/, wa],
|
|
1197
|
+
[/^(?:shuttle)$/, ba],
|
|
1198
1198
|
[/^(?:tick|advance)$/, Xn],
|
|
1199
1199
|
[/^(?:batch)$/, kt],
|
|
1200
1200
|
[/^(?:redact)$/, Jn],
|
|
@@ -1248,12 +1248,12 @@ const Il = [
|
|
|
1248
1248
|
[/^(?:list|inspect|info|get|query|state)$/, Da],
|
|
1249
1249
|
[/^(?:convert|change)$/, La],
|
|
1250
1250
|
[/^(?:sort)$/, gi],
|
|
1251
|
-
[/^(?:filter)$/,
|
|
1251
|
+
[/^(?:filter)$/, wi],
|
|
1252
1252
|
[/^(?:link)$/, Ct],
|
|
1253
1253
|
[/^(?:unlink)$/, Na],
|
|
1254
1254
|
[/^(?:increase|grow|raise)$/, Yn],
|
|
1255
1255
|
[/^(?:decrease|shrink|lower)$/, Vn],
|
|
1256
|
-
[/^(?:refresh|reload|update|sync)$/,
|
|
1256
|
+
[/^(?:refresh|reload|update|sync)$/, bi],
|
|
1257
1257
|
[/^(?:define|edit|modify|configure)$/, tt],
|
|
1258
1258
|
[/^(?:arrange|order|bring|send)$/, Qt],
|
|
1259
1259
|
[/^(?:snap)$/, Pa],
|
|
@@ -1262,11 +1262,11 @@ const Il = [
|
|
|
1262
1262
|
[/^(?:fill)$/, xt],
|
|
1263
1263
|
[/^(?:mask)$/, jn]
|
|
1264
1264
|
], or = [
|
|
1265
|
-
[/\b(?:heading|title)\b/,
|
|
1265
|
+
[/\b(?:heading|title)\b/, Ur],
|
|
1266
1266
|
[/\b(?:level|outline|tree)\b/, Lo],
|
|
1267
1267
|
[/\b(?:code)\b/, No],
|
|
1268
1268
|
[/\b(?:direction)\b/, Po],
|
|
1269
|
-
[/\b(?:waypoints?|bends?)\b/,
|
|
1269
|
+
[/\b(?:waypoints?|bends?)\b/, qr],
|
|
1270
1270
|
[/\b(?:stats|statistics|performance)\b/, Fo],
|
|
1271
1271
|
[/\b(?:mixer)\b/, _t],
|
|
1272
1272
|
[/\b(?:clipboard)\b/, Wo],
|
|
@@ -1282,22 +1282,22 @@ const Il = [
|
|
|
1282
1282
|
[/\b(?:pen)\b/, Gr],
|
|
1283
1283
|
[/\b(?:pencil)\b/, tt],
|
|
1284
1284
|
[/\b(?:highlighter)\b/, Yr],
|
|
1285
|
-
[/\b(?:word)\b/,
|
|
1286
|
-
[/\b(?:caret|cursor)\b/,
|
|
1285
|
+
[/\b(?:word)\b/, Uo],
|
|
1286
|
+
[/\b(?:caret|cursor)\b/, qo],
|
|
1287
1287
|
[/\b(?:distance|perimeter|area)\b/, Ve],
|
|
1288
1288
|
[/\b(?:work area)\b/, Vr],
|
|
1289
1289
|
[/\b(?:brush|paint)\b/, Xr],
|
|
1290
1290
|
[/\b(?:gradient)\b/, Qe],
|
|
1291
1291
|
[/\b(?:transparen|opacity|blend)\b/, Qe],
|
|
1292
1292
|
[/\b(?:colou?rs?|swatch|palette)\b/, Rt],
|
|
1293
|
-
[/\b(?:font|character|typograph|text|type)\b/,
|
|
1293
|
+
[/\b(?:font|character|typograph|text|type)\b/, qe],
|
|
1294
1294
|
[/\b(?:para(graph)?)\b/, jo],
|
|
1295
1295
|
[/\b(?:presets?|styles?)\b/, Go],
|
|
1296
1296
|
[/\b(?:layers?)\b/, kt],
|
|
1297
1297
|
[/\b(?:paths?|anchor|point|bezier|curve)\b/, gn],
|
|
1298
1298
|
[/\b(?:camera)\b/, Yo],
|
|
1299
1299
|
[/\b(?:track)\b/, Jr],
|
|
1300
|
-
[/\b(?:clip|footage|sequence|timeline|multicam)\b/,
|
|
1300
|
+
[/\b(?:clip|footage|sequence|timeline|multicam)\b/, Un],
|
|
1301
1301
|
[/\b(?:markers?|bookmark)\b/, Zr],
|
|
1302
1302
|
[/\b(?:keys?|keyframe)\b/, Qr],
|
|
1303
1303
|
[/\b(?:channel)\b/, _t],
|
|
@@ -1306,24 +1306,24 @@ const Il = [
|
|
|
1306
1306
|
[/\b(?:frame|artboard)\b/, Jt],
|
|
1307
1307
|
[/\b(?:data|database|source)\b/, Kn],
|
|
1308
1308
|
[/\b(?:queue)\b/, Hn],
|
|
1309
|
-
[/\b(?:project)\b/,
|
|
1309
|
+
[/\b(?:project)\b/, qn],
|
|
1310
1310
|
[/\b(?:comp(osition)?)\b/, kt],
|
|
1311
1311
|
[/\b(?:playhead|time|duration)\b/, Vo],
|
|
1312
1312
|
[/\b(?:audio|sound|volume)\b/, Xo],
|
|
1313
1313
|
[/\b(?:video)\b/, ti],
|
|
1314
|
-
[/\b(?:preferences|settings|options)\b/,
|
|
1314
|
+
[/\b(?:preferences|settings|options)\b/, wn],
|
|
1315
1315
|
[/\b(?:shape|rectangle|ellipse|polygon)\b/, _e],
|
|
1316
1316
|
[/\b(?:light|lamp)\b/, Jo],
|
|
1317
1317
|
[/\b(?:solid)\b/, ct],
|
|
1318
1318
|
[/\b(?:null)\b/, Zo],
|
|
1319
1319
|
[/\b(?:adjustment)\b/, _t],
|
|
1320
|
-
[/\b(?:footage|media)\b/,
|
|
1321
|
-
[/\b(?:folder)\b/,
|
|
1320
|
+
[/\b(?:footage|media)\b/, Un],
|
|
1321
|
+
[/\b(?:folder)\b/, qn],
|
|
1322
1322
|
[/\b(?:mosaic)\b/, Qo],
|
|
1323
1323
|
[/\b(?:gradient mesh|mesh)\b/, St],
|
|
1324
1324
|
[/\b(?:line|arrow)\b/, ea],
|
|
1325
1325
|
[/\b(?:comment|note)\b/, Dt],
|
|
1326
|
-
[/\b(?:page)\b/,
|
|
1326
|
+
[/\b(?:page)\b/, bn],
|
|
1327
1327
|
[/\b(?:cell|row|column)\b/, yn],
|
|
1328
1328
|
[/\b(?:formula|function)\b/, ni],
|
|
1329
1329
|
[/\b(?:symbol)\b/, ta],
|
|
@@ -1400,7 +1400,7 @@ function Ol({
|
|
|
1400
1400
|
m
|
|
1401
1401
|
)
|
|
1402
1402
|
];
|
|
1403
|
-
},
|
|
1403
|
+
}, w = Object.entries(a).some(([m, y]) => y.required && (s[m] ?? "").trim() === ""), b = () => {
|
|
1404
1404
|
const m = {};
|
|
1405
1405
|
for (const [y, I] of Object.entries(a)) {
|
|
1406
1406
|
const N = El(I, s[y] ?? "");
|
|
@@ -1415,13 +1415,13 @@ function Ol({
|
|
|
1415
1415
|
onClose: n,
|
|
1416
1416
|
actions: /* @__PURE__ */ M(Ce, { children: [
|
|
1417
1417
|
/* @__PURE__ */ u(me, { onClick: n, children: r.cancel }),
|
|
1418
|
-
/* @__PURE__ */ u(me, { variant: "primary", disabled:
|
|
1418
|
+
/* @__PURE__ */ u(me, { variant: "primary", disabled: w, onClick: b, "data-testid": "command-dialog-run", children: r.run })
|
|
1419
1419
|
] }),
|
|
1420
1420
|
children: /* @__PURE__ */ M(
|
|
1421
1421
|
"form",
|
|
1422
1422
|
{
|
|
1423
1423
|
onSubmit: (m) => {
|
|
1424
|
-
m.preventDefault(),
|
|
1424
|
+
m.preventDefault(), w || b();
|
|
1425
1425
|
},
|
|
1426
1426
|
children: [
|
|
1427
1427
|
/* @__PURE__ */ u("div", { className: "kui-param-grid", children: h.map(g) }),
|
|
@@ -1556,7 +1556,7 @@ function fu(e, t, n = !1) {
|
|
|
1556
1556
|
const o = Math.round(Math.min(e.x, e.x + r)), a = Math.round(Math.min(e.y, e.y + i)), s = Math.round(Math.max(e.x, e.x + r)), d = Math.round(Math.max(e.y, e.y + i));
|
|
1557
1557
|
return { x: o, y: a, width: s - o, height: d - a };
|
|
1558
1558
|
}
|
|
1559
|
-
const
|
|
1559
|
+
const qt = 8e6, zl = 33554432, dr = 8192, Bl = [0.5, 0.25, 0], ur = 32, _l = 0.01, Kl = 64, Ee = 8;
|
|
1560
1560
|
function hr(e, t, n, r) {
|
|
1561
1561
|
const i = (a, s) => ({ pinned: !1, off: t, s0: a, s1: n, d0: s, d1: t + n / r });
|
|
1562
1562
|
if (e <= 0) return [i(0, t)];
|
|
@@ -1592,7 +1592,7 @@ function Hl(e) {
|
|
|
1592
1592
|
const n = t.getContext("2d");
|
|
1593
1593
|
return n ? (n.fillStyle = "#ffffff", n.fillRect(0, 0, Ee * 2, Ee * 2), n.fillStyle = "#e8e8ec", n.fillRect(0, 0, Ee, Ee), n.fillRect(Ee, Ee, Ee, Ee), e.createPattern(t, "repeat")) : null;
|
|
1594
1594
|
}
|
|
1595
|
-
class
|
|
1595
|
+
class Ul {
|
|
1596
1596
|
constructor(t, n, r, i, o = !0, a = () => {
|
|
1597
1597
|
}) {
|
|
1598
1598
|
this.canvas = t, this.doc = n, this.backdrop = r, this.onChange = i, this.framed = o, this.onRender = a;
|
|
@@ -1805,25 +1805,25 @@ class ql {
|
|
|
1805
1805
|
}
|
|
1806
1806
|
/** Renders the document area a pane shows, at the zoom; null when it shows none of it. */
|
|
1807
1807
|
async renderPane(t, n) {
|
|
1808
|
-
const r = this.view.zoom * n, i = (
|
|
1809
|
-
const
|
|
1808
|
+
const r = this.view.zoom * n, i = (w) => {
|
|
1809
|
+
const b = t.pinX ? 0 : (t.area.x1 - t.area.x0) * w, m = t.pinY ? 0 : (t.area.y1 - t.area.y0) * w;
|
|
1810
1810
|
return {
|
|
1811
|
-
x0: Math.max(0, Math.floor(t.area.x0 -
|
|
1811
|
+
x0: Math.max(0, Math.floor(t.area.x0 - b)),
|
|
1812
1812
|
y0: Math.max(0, Math.floor(t.area.y0 - m)),
|
|
1813
|
-
x1: Math.min(this.doc.width, Math.ceil(t.area.x1 +
|
|
1813
|
+
x1: Math.min(this.doc.width, Math.ceil(t.area.x1 + b)),
|
|
1814
1814
|
y1: Math.min(this.doc.height, Math.ceil(t.area.y1 + m))
|
|
1815
1815
|
};
|
|
1816
|
-
}, o = (
|
|
1816
|
+
}, o = (w) => (w.x1 - w.x0) * (w.y1 - w.y0) * Math.min(1, r) ** 2 * Math.max(1, r) ** 2 <= qt, { x0: a, y0: s, x1: d, y1: c } = Bl.map(i).find((w) => o(w)) ?? i(0);
|
|
1817
1817
|
if (d <= a || c <= s) return null;
|
|
1818
1818
|
let l, p, h, f;
|
|
1819
1819
|
if (r < 1) {
|
|
1820
|
-
let
|
|
1821
|
-
for (; (d - a) /
|
|
1822
|
-
h = Math.ceil((d - a) /
|
|
1820
|
+
let w = Math.max(1, Math.floor(1 / r));
|
|
1821
|
+
for (; (d - a) / w * ((c - s) / w) > qt; ) w += 1;
|
|
1822
|
+
h = Math.ceil((d - a) / w), f = Math.ceil((c - s) / w), p = await this.doc.renderArea(a, s, a + h * w, s + f * w, h, f), l = { x: a, y: s, width: h * w, height: f * w, scale: 1 / w };
|
|
1823
1823
|
} else {
|
|
1824
|
-
let
|
|
1825
|
-
const
|
|
1826
|
-
|
|
1824
|
+
let w = r;
|
|
1825
|
+
const b = (d - a) * (c - s) * w * w, m = i(0), y = Math.max(qt, Math.min(zl, (m.x1 - m.x0) * (m.y1 - m.y0) * r * r));
|
|
1826
|
+
b > y && (w = Math.max(1, w * Math.sqrt(y / b))), w = Math.max(1, Math.min(w, dr / (d - a), dr / (c - s))), h = Math.max(1, Math.ceil((d - a) * w)), f = Math.max(1, Math.ceil((c - s) * w)), p = await this.doc.render(a, s, w, h, f), l = { x: a, y: s, width: h / w, height: f / w, scale: w };
|
|
1827
1827
|
}
|
|
1828
1828
|
const g = document.createElement("canvas");
|
|
1829
1829
|
return g.width = h, g.height = f, g.getContext("2d")?.putImageData(fr(p, h, f), 0, 0), { bitmap: g, ...l, pinX: t.pinX, pinY: t.pinY };
|
|
@@ -1838,15 +1838,15 @@ class ql {
|
|
|
1838
1838
|
if (!n.length || this.rendering || this.failed)
|
|
1839
1839
|
return this.render();
|
|
1840
1840
|
const r = n.flatMap((c) => {
|
|
1841
|
-
const l = c.bitmap.width / c.width, p = c.bitmap.height / c.height, h = ft(Math.floor((t.x0 - c.x) * l), 0, c.bitmap.width), f = ft(Math.floor((t.y0 - c.y) * p), 0, c.bitmap.height), g = ft(Math.ceil((t.x1 - c.x) * l), 0, c.bitmap.width),
|
|
1842
|
-
return g > h &&
|
|
1841
|
+
const l = c.bitmap.width / c.width, p = c.bitmap.height / c.height, h = ft(Math.floor((t.x0 - c.x) * l), 0, c.bitmap.width), f = ft(Math.floor((t.y0 - c.y) * p), 0, c.bitmap.height), g = ft(Math.ceil((t.x1 - c.x) * l), 0, c.bitmap.width), w = ft(Math.ceil((t.y1 - c.y) * p), 0, c.bitmap.height);
|
|
1842
|
+
return g > h && w > f ? [{ frame: c, sx: l, sy: p, px0: h, py0: f, width: g - h, height: w - f }] : [];
|
|
1843
1843
|
});
|
|
1844
1844
|
if (!r.length) return !1;
|
|
1845
1845
|
const i = performance.now(), o = this.generation, a = [];
|
|
1846
1846
|
try {
|
|
1847
|
-
for (const { frame: c, sx: l, sy: p, px0: h, py0: f, width: g, height:
|
|
1848
|
-
const
|
|
1849
|
-
a.push(c.scale < 1 ? await this.doc.renderArea(c.x + h *
|
|
1847
|
+
for (const { frame: c, sx: l, sy: p, px0: h, py0: f, width: g, height: w } of r) {
|
|
1848
|
+
const b = Math.round(1 / c.scale);
|
|
1849
|
+
a.push(c.scale < 1 ? await this.doc.renderArea(c.x + h * b, c.y + f * b, c.x + (h + g) * b, c.y + (f + w) * b, g, w) : await this.doc.render(c.x + h / l, c.y + f / p, c.scale, g, w));
|
|
1850
1850
|
}
|
|
1851
1851
|
} catch (c) {
|
|
1852
1852
|
return !this.disposed && o === this.generation && this.frames === n && (this.failed = !0, this.onRender(c)), !1;
|
|
@@ -1875,7 +1875,7 @@ class ql {
|
|
|
1875
1875
|
const c = jt(s, this.pins, t, n);
|
|
1876
1876
|
for (const l of c) {
|
|
1877
1877
|
a.save(), c.length > 1 && (a.beginPath(), a.rect(l.clip.x0, l.clip.y0, l.clip.x1 - l.clip.x0, l.clip.y1 - l.clip.y0), a.clip());
|
|
1878
|
-
const p = (g,
|
|
1878
|
+
const p = (g, w) => ({ x: (g - l.offX) * d, y: (w - l.offY) * d }), h = p(0, 0);
|
|
1879
1879
|
this.framed && (a.shadowColor = "rgba(15, 15, 30, 0.12)", a.shadowBlur = 12, this.pattern ??= Hl(a), a.fillStyle = this.pattern ?? "#ffffff", a.fillRect(h.x, h.y, this.doc.width * d, this.doc.height * d), a.shadowBlur = 0);
|
|
1880
1880
|
const f = this.frames.find((g) => g.pinX === l.pinX && g.pinY === l.pinY);
|
|
1881
1881
|
if (f) {
|
|
@@ -1896,15 +1896,15 @@ class ql {
|
|
|
1896
1896
|
return c ? [c[0], c[1], c[2]] : null;
|
|
1897
1897
|
}
|
|
1898
1898
|
}
|
|
1899
|
-
const
|
|
1899
|
+
const ql = "#f3f3f6";
|
|
1900
1900
|
function pr() {
|
|
1901
|
-
return getComputedStyle(document.documentElement).getPropertyValue("--kit-canvas").trim() ||
|
|
1901
|
+
return getComputedStyle(document.documentElement).getPropertyValue("--kit-canvas").trim() || ql;
|
|
1902
1902
|
}
|
|
1903
1903
|
const jl = 0.01, Gl = 100;
|
|
1904
1904
|
function Yl(e, t = 1) {
|
|
1905
1905
|
return e.pointerType !== "pen" ? 1 : e.pressure > 0 ? e.pressure : t;
|
|
1906
1906
|
}
|
|
1907
|
-
function
|
|
1907
|
+
function Ue(e, t, n = 1) {
|
|
1908
1908
|
const r = t.toImage(e.clientX, e.clientY), i = t.toScreen(r.x, r.y);
|
|
1909
1909
|
return {
|
|
1910
1910
|
x: r.x,
|
|
@@ -1936,35 +1936,35 @@ function Vl(e, t) {
|
|
|
1936
1936
|
};
|
|
1937
1937
|
}
|
|
1938
1938
|
function Xl({ doc: e, change: t, repaint: n, tool: r, onView: i, onRender: o, viewMemory: a, initialArea: s = null, panBounds: d = null, decorate: c = null, animated: l = !1, spacePans: p = !0, framed: h = !0, children: f, ref: g }) {
|
|
1939
|
-
const
|
|
1939
|
+
const w = R(null), b = R(null), m = R(null), y = R(null), [I, N] = B(!1), E = R({ doc: e, onView: i, onRender: o, initialArea: s, panBounds: d });
|
|
1940
1940
|
E.current = { doc: e, onView: i, onRender: o, initialArea: s, panBounds: d };
|
|
1941
|
-
const Y = Vl(
|
|
1941
|
+
const Y = Vl(b, m);
|
|
1942
1942
|
J(() => {
|
|
1943
|
-
const k =
|
|
1943
|
+
const k = w.current;
|
|
1944
1944
|
if (!k) return;
|
|
1945
1945
|
let O = a.current != null;
|
|
1946
|
-
const
|
|
1946
|
+
const q = new Ul(k, e, pr(), (_, T) => {
|
|
1947
1947
|
O && (a.current = _), E.current.onView({ ..._, width: k.clientWidth, height: k.clientHeight }, T);
|
|
1948
1948
|
}, h, (_) => {
|
|
1949
1949
|
E.current.doc === e && E.current.onRender?.(_);
|
|
1950
1950
|
});
|
|
1951
|
-
m.current =
|
|
1951
|
+
m.current = q, a.current && (q.view = { ...a.current }), q.setPanBounds(E.current.panBounds);
|
|
1952
1952
|
const x = new ResizeObserver(() => {
|
|
1953
1953
|
if (!O && k.clientWidth > 0 && k.clientHeight > 0) {
|
|
1954
1954
|
O = !0;
|
|
1955
1955
|
const _ = E.current.initialArea;
|
|
1956
|
-
_ ?
|
|
1956
|
+
_ ? q.fitArea(_) : q.fit();
|
|
1957
1957
|
}
|
|
1958
|
-
O &&
|
|
1958
|
+
O && q.resized(), q.render();
|
|
1959
1959
|
});
|
|
1960
1960
|
x.observe(k);
|
|
1961
1961
|
const C = (_) => {
|
|
1962
|
-
_.preventDefault(), _.ctrlKey || _.metaKey ?
|
|
1962
|
+
_.preventDefault(), _.ctrlKey || _.metaKey ? q.zoomTo(q.view.zoom * Math.exp(-_.deltaY * jl), _.clientX, _.clientY) : q.panBy(-_.deltaX, -_.deltaY);
|
|
1963
1963
|
};
|
|
1964
1964
|
k.addEventListener("wheel", C, { passive: !1 });
|
|
1965
|
-
const W = typeof MutationObserver > "u" ? null : new MutationObserver(() =>
|
|
1965
|
+
const W = typeof MutationObserver > "u" ? null : new MutationObserver(() => q.setBackdrop(pr()));
|
|
1966
1966
|
return W?.observe(document.documentElement, { attributes: !0, attributeFilter: ["style", "data-color-scheme", "data-brand", "class"] }), () => {
|
|
1967
|
-
W?.disconnect(), x.disconnect(), k.removeEventListener("wheel", C),
|
|
1967
|
+
W?.disconnect(), x.disconnect(), k.removeEventListener("wheel", C), q.dispose(), m.current = null;
|
|
1968
1968
|
};
|
|
1969
1969
|
}, [e, h, a]), J(() => m.current?.setPanBounds(d), [e, d]), J(() => {
|
|
1970
1970
|
const k = m.current;
|
|
@@ -1972,10 +1972,10 @@ function Xl({ doc: e, change: t, repaint: n, tool: r, onView: i, onRender: o, vi
|
|
|
1972
1972
|
O && Y.clear();
|
|
1973
1973
|
}));
|
|
1974
1974
|
}, [t]);
|
|
1975
|
-
const
|
|
1975
|
+
const U = R(n?.tick ?? 0);
|
|
1976
1976
|
J(() => {
|
|
1977
1977
|
const k = m.current;
|
|
1978
|
-
!k || !n || n.tick ===
|
|
1978
|
+
!k || !n || n.tick === U.current || (U.current = n.tick, k.invalidate(), n.damage ? k.renderArea(n.damage) : k.render());
|
|
1979
1979
|
}, [n]), J(() => {
|
|
1980
1980
|
const k = m.current;
|
|
1981
1981
|
if (!k || (k.decorate = c, k.draw(), !l || !c)) return;
|
|
@@ -1985,15 +1985,15 @@ function Xl({ doc: e, change: t, repaint: n, tool: r, onView: i, onRender: o, vi
|
|
|
1985
1985
|
if (!p) return;
|
|
1986
1986
|
const k = (x) => x instanceof HTMLInputElement || x instanceof HTMLTextAreaElement, O = (x) => {
|
|
1987
1987
|
x.code === "Space" && !k(x.target) && N(!0);
|
|
1988
|
-
},
|
|
1988
|
+
}, q = (x) => {
|
|
1989
1989
|
x.code === "Space" && N(!1);
|
|
1990
1990
|
};
|
|
1991
|
-
return window.addEventListener("keydown", O), window.addEventListener("keyup",
|
|
1992
|
-
window.removeEventListener("keydown", O), window.removeEventListener("keyup",
|
|
1991
|
+
return window.addEventListener("keydown", O), window.addEventListener("keyup", q), () => {
|
|
1992
|
+
window.removeEventListener("keydown", O), window.removeEventListener("keyup", q);
|
|
1993
1993
|
};
|
|
1994
1994
|
}, [p]), Oo(g, () => ({
|
|
1995
1995
|
view: () => {
|
|
1996
|
-
const k = m.current, O =
|
|
1996
|
+
const k = m.current, O = w.current;
|
|
1997
1997
|
return k && O ? { ...k.view, width: O.clientWidth, height: O.clientHeight } : null;
|
|
1998
1998
|
},
|
|
1999
1999
|
fit: () => m.current?.fit(),
|
|
@@ -2013,28 +2013,28 @@ function Xl({ doc: e, change: t, repaint: n, tool: r, onView: i, onRender: o, vi
|
|
|
2013
2013
|
const O = V();
|
|
2014
2014
|
if (!O || k.button === 2) return;
|
|
2015
2015
|
k.preventDefault();
|
|
2016
|
-
const
|
|
2017
|
-
|
|
2018
|
-
const x = I || k.button === 1 ? Re : r, C =
|
|
2016
|
+
const q = k.currentTarget.closest("[tabindex]");
|
|
2017
|
+
q && document.activeElement !== q && q.focus({ preventScroll: !0 }), k.currentTarget.setPointerCapture(k.pointerId);
|
|
2018
|
+
const x = I || k.button === 1 ? Re : r, C = Ue(k, O.viewport);
|
|
2019
2019
|
j.current = C.pressure, y.current = x.begin(C, O) || null;
|
|
2020
2020
|
}, Z = (k) => {
|
|
2021
|
-
const O = V(),
|
|
2022
|
-
if (O && r.track?.(
|
|
2021
|
+
const O = V(), q = y.current;
|
|
2022
|
+
if (O && r.track?.(Ue(k, O.viewport), O), O && !q && !I && k.buttons === 0 && r.hover?.(Ue(k, O.viewport), O), !(!O || !q?.move))
|
|
2023
2023
|
for (const x of k.nativeEvent.getCoalescedEvents?.() ?? [k.nativeEvent]) {
|
|
2024
|
-
const C =
|
|
2025
|
-
j.current = C.pressure,
|
|
2024
|
+
const C = Ue(x, O.viewport, j.current);
|
|
2025
|
+
j.current = C.pressure, q.move(C, O);
|
|
2026
2026
|
}
|
|
2027
2027
|
}, Q = (k) => {
|
|
2028
|
-
const O = V(),
|
|
2029
|
-
y.current = null, O &&
|
|
2028
|
+
const O = V(), q = y.current;
|
|
2029
|
+
y.current = null, O && q && q.end?.(Ue(k, O.viewport, j.current), O);
|
|
2030
2030
|
}, fe = R(() => {
|
|
2031
2031
|
});
|
|
2032
2032
|
fe.current = (k) => {
|
|
2033
2033
|
const O = y.current;
|
|
2034
2034
|
if (!O || k.key !== "Escape" || k.isComposing || k.metaKey || k.ctrlKey || k.altKey || k.shiftKey) return;
|
|
2035
2035
|
y.current = null;
|
|
2036
|
-
const
|
|
2037
|
-
|
|
2036
|
+
const q = V();
|
|
2037
|
+
q && O.cancel?.(q), Y.clear(), k.preventDefault(), k.stopPropagation();
|
|
2038
2038
|
}, J(() => {
|
|
2039
2039
|
const k = (O) => fe.current(O);
|
|
2040
2040
|
return window.addEventListener("keydown", k, !0), () => window.removeEventListener("keydown", k, !0);
|
|
@@ -2047,7 +2047,7 @@ function Xl({ doc: e, change: t, repaint: n, tool: r, onView: i, onRender: o, vi
|
|
|
2047
2047
|
/* @__PURE__ */ u(
|
|
2048
2048
|
"canvas",
|
|
2049
2049
|
{
|
|
2050
|
-
ref:
|
|
2050
|
+
ref: w,
|
|
2051
2051
|
className: "kui-canvas-surface",
|
|
2052
2052
|
style: { cursor: I ? Re.cursor : r.cursor },
|
|
2053
2053
|
onPointerDown: D,
|
|
@@ -2061,26 +2061,26 @@ function Xl({ doc: e, change: t, repaint: n, tool: r, onView: i, onRender: o, vi
|
|
|
2061
2061
|
},
|
|
2062
2062
|
onDoubleClick: (k) => {
|
|
2063
2063
|
const O = V();
|
|
2064
|
-
O && r.doubleClick?.(
|
|
2064
|
+
O && r.doubleClick?.(Ue({ ...k, clientX: k.clientX, clientY: k.clientY, pressure: 1 }, O.viewport), O);
|
|
2065
2065
|
},
|
|
2066
2066
|
onContextMenu: (k) => k.preventDefault(),
|
|
2067
2067
|
"data-testid": "kit-canvas-surface"
|
|
2068
2068
|
}
|
|
2069
2069
|
),
|
|
2070
|
-
/* @__PURE__ */ u("canvas", { ref:
|
|
2070
|
+
/* @__PURE__ */ u("canvas", { ref: b, className: "kui-canvas-overlay", "aria-hidden": "true" }),
|
|
2071
2071
|
f
|
|
2072
2072
|
] });
|
|
2073
2073
|
}
|
|
2074
|
-
const
|
|
2074
|
+
const wt = /* @__PURE__ */ new Set();
|
|
2075
2075
|
function Jl(e) {
|
|
2076
2076
|
const t = (n, r, i) => {
|
|
2077
|
-
|
|
2077
|
+
wt.has(t) || e(n, r, i);
|
|
2078
2078
|
};
|
|
2079
2079
|
return t;
|
|
2080
2080
|
}
|
|
2081
2081
|
const Hi = /* @__PURE__ */ new WeakMap();
|
|
2082
|
-
function
|
|
2083
|
-
return [e, ...(Hi.get(e) ?? []).flatMap(
|
|
2082
|
+
function Ui(e) {
|
|
2083
|
+
return [e, ...(Hi.get(e) ?? []).flatMap(Ui)];
|
|
2084
2084
|
}
|
|
2085
2085
|
function gr(e, t) {
|
|
2086
2086
|
if (!e || !t) return e ?? t ?? null;
|
|
@@ -2091,14 +2091,14 @@ function gr(e, t) {
|
|
|
2091
2091
|
} finally {
|
|
2092
2092
|
r.restore();
|
|
2093
2093
|
}
|
|
2094
|
-
const a =
|
|
2095
|
-
for (const s of a)
|
|
2094
|
+
const a = Ui(e).filter((s) => !wt.has(s));
|
|
2095
|
+
for (const s of a) wt.add(s);
|
|
2096
2096
|
r.save();
|
|
2097
2097
|
try {
|
|
2098
2098
|
t(r, i, o);
|
|
2099
2099
|
} finally {
|
|
2100
2100
|
r.restore();
|
|
2101
|
-
for (const s of a)
|
|
2101
|
+
for (const s of a) wt.delete(s);
|
|
2102
2102
|
}
|
|
2103
2103
|
};
|
|
2104
2104
|
return Hi.set(n, [e, t]), n;
|
|
@@ -2107,7 +2107,7 @@ const Ke = "kit:";
|
|
|
2107
2107
|
function Ft(e) {
|
|
2108
2108
|
return e.startsWith(Ke) ? `control:${e.slice(Ke.length)}` : `command:${e}`;
|
|
2109
2109
|
}
|
|
2110
|
-
function
|
|
2110
|
+
function qi(e) {
|
|
2111
2111
|
const t = [], n = /* @__PURE__ */ new Set();
|
|
2112
2112
|
for (const r of e) {
|
|
2113
2113
|
for (let o = 1; o <= r.path.length; o += 1) {
|
|
@@ -2134,16 +2134,16 @@ const ji = [
|
|
|
2134
2134
|
function Zl(e) {
|
|
2135
2135
|
if (!e) return null;
|
|
2136
2136
|
const t = Object.keys(sn).flatMap((n) => (e[n] ?? []).map((r) => r.id));
|
|
2137
|
-
return /* @__PURE__ */ new Set([...
|
|
2137
|
+
return /* @__PURE__ */ new Set([...qi(e.menus ?? []).map((n) => n.id), ...t, ...ji.map((n) => n.id)]);
|
|
2138
2138
|
}
|
|
2139
2139
|
function Gi({ commands: e, declaration: t, engineTools: n, agent: r, t: i, phrase: o, config: a }) {
|
|
2140
2140
|
const s = [], d = /* @__PURE__ */ new Set(), c = (l, p, h, f, g = []) => {
|
|
2141
2141
|
if (d.has(l)) return;
|
|
2142
2142
|
d.add(l);
|
|
2143
|
-
const
|
|
2144
|
-
s.push({ id: l, kind: p, label: h, parent: f, hidden:
|
|
2143
|
+
const w = Se(a, l, g);
|
|
2144
|
+
s.push({ id: l, kind: p, label: h, parent: f, hidden: w.hidden, disabled: w.disabled });
|
|
2145
2145
|
};
|
|
2146
|
-
for (const l of
|
|
2146
|
+
for (const l of qi(t?.menus ?? [])) c(l.id, l.kind, o(l.label), l.parent, l.menu);
|
|
2147
2147
|
for (const l of e) {
|
|
2148
2148
|
for (let p = 1; p <= l.menu.length; p += 1) {
|
|
2149
2149
|
const h = p > 1 ? `menu:${l.menu.slice(0, p - 1).join("/")}` : null;
|
|
@@ -2159,7 +2159,7 @@ function Gi({ commands: e, declaration: t, engineTools: n, agent: r, t: i, phras
|
|
|
2159
2159
|
}
|
|
2160
2160
|
const Ql = () => !1, Wt = Ot(null), ec = Ni(nn, null, () => {
|
|
2161
2161
|
});
|
|
2162
|
-
function
|
|
2162
|
+
function be() {
|
|
2163
2163
|
const e = Le(Wt), t = e?.store ?? ec, n = He(t.subscribe, t.get);
|
|
2164
2164
|
return {
|
|
2165
2165
|
config: n,
|
|
@@ -2184,7 +2184,7 @@ function Yi({ value: e, children: t }) {
|
|
|
2184
2184
|
return /* @__PURE__ */ u(Wt.Provider, { value: e, children: /* @__PURE__ */ u(tc, { children: t }) });
|
|
2185
2185
|
}
|
|
2186
2186
|
function tc({ children: e }) {
|
|
2187
|
-
const t = Le(Wt), n =
|
|
2187
|
+
const t = Le(Wt), n = be(), { config: r } = n, i = pe(
|
|
2188
2188
|
() => ({
|
|
2189
2189
|
state: (o) => n.state(o),
|
|
2190
2190
|
renderExtras: (o, a) => n.renderButtons(o, a),
|
|
@@ -2198,12 +2198,12 @@ function tc({ children: e }) {
|
|
|
2198
2198
|
return /* @__PURE__ */ u(ko, { elements: i, children: e });
|
|
2199
2199
|
}
|
|
2200
2200
|
function pu({ id: e, children: t }) {
|
|
2201
|
-
const n =
|
|
2201
|
+
const n = be();
|
|
2202
2202
|
n.declared;
|
|
2203
2203
|
const r = n.state(e);
|
|
2204
2204
|
return r.hidden ? null : /* @__PURE__ */ u("fieldset", { className: "kui-element", "data-kit-ui-id": e, disabled: r.disabled, role: "presentation", children: t });
|
|
2205
2205
|
}
|
|
2206
|
-
const
|
|
2206
|
+
const wr = {
|
|
2207
2207
|
bell: xs,
|
|
2208
2208
|
check: En,
|
|
2209
2209
|
download: Cs,
|
|
@@ -2217,16 +2217,16 @@ const br = {
|
|
|
2217
2217
|
message: Dt,
|
|
2218
2218
|
plus: pi,
|
|
2219
2219
|
printer: Sn,
|
|
2220
|
-
send:
|
|
2221
|
-
settings:
|
|
2222
|
-
share:
|
|
2220
|
+
send: bs,
|
|
2221
|
+
settings: wn,
|
|
2222
|
+
share: ws,
|
|
2223
2223
|
star: $i,
|
|
2224
2224
|
upload: gs,
|
|
2225
2225
|
x: Zt
|
|
2226
2226
|
}, ze = /* @__PURE__ */ new Map(), nc = 32;
|
|
2227
2227
|
function rc(e) {
|
|
2228
2228
|
if (!e) return;
|
|
2229
|
-
if (!e.startsWith("data:image/")) return Object.hasOwn(
|
|
2229
|
+
if (!e.startsWith("data:image/")) return Object.hasOwn(wr, e) ? wr[e] : ct;
|
|
2230
2230
|
const t = ze.get(e);
|
|
2231
2231
|
if (t)
|
|
2232
2232
|
return ze.delete(e), ze.set(e, t), t;
|
|
@@ -2238,25 +2238,25 @@ function rc(e) {
|
|
|
2238
2238
|
return ze.set(e, n), n;
|
|
2239
2239
|
}
|
|
2240
2240
|
function zt({ place: e, as: t }) {
|
|
2241
|
-
const n =
|
|
2241
|
+
const n = be();
|
|
2242
2242
|
return /* @__PURE__ */ u(Ce, { children: n.buttons(e).map((r) => {
|
|
2243
2243
|
const i = il(r, n.locale), o = rc(r.icon), a = `host:${r.id}`;
|
|
2244
|
-
return t === "menu" ? /* @__PURE__ */ u(le, { icon: o, label: i, shortcut: r.shortcut, disabled: r.disabled, onSelect: () => n.press(r.id), uiId: a }, r.id) : t === "ribbon" ? /* @__PURE__ */ u(
|
|
2244
|
+
return t === "menu" ? /* @__PURE__ */ u(le, { icon: o, label: i, shortcut: r.shortcut, disabled: r.disabled, onSelect: () => n.press(r.id), uiId: a }, r.id) : t === "ribbon" ? /* @__PURE__ */ u(we, { icon: o, label: i, pressed: r.pressed, disabled: r.disabled, onClick: () => n.press(r.id), "data-kit-ui-id": a }, r.id) : /* @__PURE__ */ M(me, { variant: "ghost", "aria-pressed": r.pressed, disabled: r.disabled, onClick: () => n.press(r.id), "data-kit-ui-id": a, children: [
|
|
2245
2245
|
o ? /* @__PURE__ */ u(o, { size: 15, strokeWidth: $e, "aria-hidden": "true" }) : null,
|
|
2246
2246
|
i
|
|
2247
2247
|
] }, r.id);
|
|
2248
2248
|
}) });
|
|
2249
2249
|
}
|
|
2250
|
-
const
|
|
2250
|
+
const br = /* @__PURE__ */ new Set();
|
|
2251
2251
|
function ic(e, t) {
|
|
2252
2252
|
const n = new Map(e.map((h) => [h.id, h])), r = (h) => {
|
|
2253
2253
|
const f = /* @__PURE__ */ new Set();
|
|
2254
2254
|
for (let g = h.parent; g !== null && !f.has(g); ) {
|
|
2255
2255
|
f.add(g);
|
|
2256
|
-
const
|
|
2257
|
-
if (!
|
|
2258
|
-
if (
|
|
2259
|
-
g =
|
|
2256
|
+
const w = n.get(g);
|
|
2257
|
+
if (!w) return !1;
|
|
2258
|
+
if (w.hidden) return !0;
|
|
2259
|
+
g = w.parent;
|
|
2260
2260
|
}
|
|
2261
2261
|
return !1;
|
|
2262
2262
|
}, i = e.filter((h) => !h.hidden && h.id !== Di && !(h.kind === "command" && h.parent === null) && !r(h)), o = new Map(i.map((h) => [h.id, h])), a = /* @__PURE__ */ new Map();
|
|
@@ -2268,29 +2268,29 @@ function ic(e, t) {
|
|
|
2268
2268
|
const s = (h, f) => {
|
|
2269
2269
|
const g = new Set(f);
|
|
2270
2270
|
g.add(h.id);
|
|
2271
|
-
const
|
|
2272
|
-
return { element: h, children:
|
|
2271
|
+
const w = (a.get(h.id) ?? []).filter((b) => g.has(b.id) ? (br.has(b.id) || (br.add(b.id), console.warn(`[kit-editor] ${b.id} is its own ancestor in the declared elements`)), !1) : !0).map((b) => s(b, g));
|
|
2272
|
+
return { element: h, children: w };
|
|
2273
2273
|
}, d = [], c = /* @__PURE__ */ new Set();
|
|
2274
2274
|
for (const h of i) {
|
|
2275
2275
|
if (c.has(h.id)) continue;
|
|
2276
2276
|
const f = [];
|
|
2277
2277
|
let g = h;
|
|
2278
2278
|
for (; g !== void 0; ) {
|
|
2279
|
-
const
|
|
2280
|
-
if (c.has(
|
|
2279
|
+
const w = g;
|
|
2280
|
+
if (c.has(w.id)) {
|
|
2281
2281
|
for (const y of f) c.add(y);
|
|
2282
2282
|
break;
|
|
2283
2283
|
}
|
|
2284
|
-
const
|
|
2285
|
-
if (
|
|
2286
|
-
d.push(o.get(f[
|
|
2284
|
+
const b = f.indexOf(w.id);
|
|
2285
|
+
if (b !== -1) {
|
|
2286
|
+
d.push(o.get(f[b]));
|
|
2287
2287
|
for (const y of f) c.add(y);
|
|
2288
2288
|
break;
|
|
2289
2289
|
}
|
|
2290
|
-
f.push(
|
|
2291
|
-
const m =
|
|
2290
|
+
f.push(w.id);
|
|
2291
|
+
const m = w.parent !== null ? o.get(w.parent) : void 0;
|
|
2292
2292
|
if (m === void 0) {
|
|
2293
|
-
d.push(
|
|
2293
|
+
d.push(w);
|
|
2294
2294
|
for (const y of f) c.add(y);
|
|
2295
2295
|
break;
|
|
2296
2296
|
}
|
|
@@ -2311,7 +2311,7 @@ function oc({ catalog: e, personal: t, labels: n, onSave: r, onClose: i }) {
|
|
|
2311
2311
|
/* @__PURE__ */ u("input", { type: "checkbox", checked: !g, disabled: f, onChange: () => l(h.element.id), "data-element": h.element.id }),
|
|
2312
2312
|
/* @__PURE__ */ u("span", { children: h.element.label })
|
|
2313
2313
|
] }),
|
|
2314
|
-
h.children.length ? /* @__PURE__ */ u("ul", { children: h.children.map((
|
|
2314
|
+
h.children.length ? /* @__PURE__ */ u("ul", { children: h.children.map((w) => p(w, f || g)) }) : null
|
|
2315
2315
|
] }, h.element.id);
|
|
2316
2316
|
};
|
|
2317
2317
|
return /* @__PURE__ */ M(
|
|
@@ -2843,20 +2843,20 @@ function ln(e, t, n) {
|
|
|
2843
2843
|
e.report ? e.report(t, n) : pt("error", t, Dn(n));
|
|
2844
2844
|
}
|
|
2845
2845
|
const yr = { "edit.undo": "undo", "edit.redo": "redo" };
|
|
2846
|
-
function
|
|
2846
|
+
function wu(e, t, n, r, i = (s) => s, o, a = {}) {
|
|
2847
2847
|
const s = R(a.report);
|
|
2848
2848
|
s.current = a.report;
|
|
2849
|
-
const d = H((T, K) => s.current ? s.current(T, K) : pt("error", T, Dn(K)), []), { doc: c, change: l } = e, [p, h] = B([]), [f, g] = B(/* @__PURE__ */ new Set()), [
|
|
2849
|
+
const d = H((T, K) => s.current ? s.current(T, K) : pt("error", T, Dn(K)), []), { doc: c, change: l } = e, [p, h] = B([]), [f, g] = B(/* @__PURE__ */ new Set()), [w, b] = B(null), m = R(o);
|
|
2850
2850
|
m.current = o;
|
|
2851
2851
|
const y = H(
|
|
2852
|
-
(T, K = {}) =>
|
|
2852
|
+
(T, K = {}) => b(T ? { command: T, values: { ...m.current?.(T), ...K } } : null),
|
|
2853
2853
|
[]
|
|
2854
2854
|
), I = R(e);
|
|
2855
2855
|
I.current = e;
|
|
2856
2856
|
const N = He(t.ui.subscribe, t.ui.get), E = a.history ?? null, [, Y] = B(0);
|
|
2857
2857
|
J(() => E?.subscribe(() => Y((T) => T + 1)), [E]);
|
|
2858
|
-
const
|
|
2859
|
-
|
|
2858
|
+
const U = R(E);
|
|
2859
|
+
U.current = E;
|
|
2860
2860
|
const V = t.readOnly === !0, j = e.comments ?? Xi, D = H((T) => V && It(T, j), [j, V]);
|
|
2861
2861
|
J(() => {
|
|
2862
2862
|
c && c.commands().then(h);
|
|
@@ -2883,7 +2883,7 @@ function bu(e, t, n, r, i = (s) => s, o, a = {}) {
|
|
|
2883
2883
|
fe.current = Q;
|
|
2884
2884
|
const ce = H(
|
|
2885
2885
|
async (T, K) => {
|
|
2886
|
-
const ne = Q.get(T), P =
|
|
2886
|
+
const ne = Q.get(T), P = U.current, G = P ? yr[T] : void 0;
|
|
2887
2887
|
if (P && G) {
|
|
2888
2888
|
if (Se(t.ui.get(), `command:${T}`, ne?.menu).denied || Se(t.ui.get(), `action:${G}`).denied) return null;
|
|
2889
2889
|
try {
|
|
@@ -2901,7 +2901,7 @@ function bu(e, t, n, r, i = (s) => s, o, a = {}) {
|
|
|
2901
2901
|
}
|
|
2902
2902
|
},
|
|
2903
2903
|
[Q, j, t, V, D, d, y, n]
|
|
2904
|
-
), k = E ? E.canUndo() : c?.info?.canUndo ?? !1, O = E ? E.canRedo() : c?.info?.canRedo ?? !1,
|
|
2904
|
+
), k = E ? E.canUndo() : c?.info?.canUndo ?? !1, O = E ? E.canRedo() : c?.info?.canRedo ?? !1, q = H(
|
|
2905
2905
|
(T, K) => {
|
|
2906
2906
|
const ne = Q.get(T);
|
|
2907
2907
|
if (!ne || Se(N, `command:${T}`, ne.menu).denied) return !1;
|
|
@@ -2912,14 +2912,14 @@ function bu(e, t, n, r, i = (s) => s, o, a = {}) {
|
|
|
2912
2912
|
return G === null || (G === "undo" ? k : O);
|
|
2913
2913
|
},
|
|
2914
2914
|
[Q, O, k, j, E, V, D, N]
|
|
2915
|
-
), x = H((T) =>
|
|
2915
|
+
), x = H((T) => q(T, f), [f, q]), C = H(
|
|
2916
2916
|
async (T) => {
|
|
2917
2917
|
const K = I.current.doc;
|
|
2918
2918
|
if (!K) return !1;
|
|
2919
2919
|
const ne = await I.current.disabledCommands().catch(() => null);
|
|
2920
|
-
return ne != null && I.current.doc === K &&
|
|
2920
|
+
return ne != null && I.current.doc === K && q(T, new Set(ne));
|
|
2921
2921
|
},
|
|
2922
|
-
[
|
|
2922
|
+
[q]
|
|
2923
2923
|
), W = H(async () => {
|
|
2924
2924
|
try {
|
|
2925
2925
|
await I.current.save(), pt("success", n("saved"));
|
|
@@ -2932,13 +2932,13 @@ function bu(e, t, n, r, i = (s) => s, o, a = {}) {
|
|
|
2932
2932
|
},
|
|
2933
2933
|
[Q, t, ce, y]
|
|
2934
2934
|
);
|
|
2935
|
-
return { session: e, host: t, t: n, phrase: i, testId: r, commands: p, byId: Q, enabled: x, enabledNow: C, run: ce, ask: _, query: Z, save: W, report: d, dialog:
|
|
2935
|
+
return { session: e, host: t, t: n, phrase: i, testId: r, commands: p, byId: Q, enabled: x, enabledNow: C, run: ce, ask: _, query: Z, save: W, report: d, dialog: w, setDialog: y, comments: j, canUndo: k, canRedo: O };
|
|
2936
2936
|
}
|
|
2937
2937
|
const Ln = Ot(null);
|
|
2938
|
-
function
|
|
2938
|
+
function bu({ editor: e, tools: t = null, children: n }) {
|
|
2939
2939
|
const r = pe(() => ({ editor: e, tools: t }), [e, t]), { host: i, byId: o, session: a } = e, s = He(i.ui.subscribe, i.ui.get), d = t?.setDenied, c = i.readOnly === !0;
|
|
2940
2940
|
Te(() => {
|
|
2941
|
-
d?.((
|
|
2941
|
+
d?.((w) => c || Se(s, `tool:${w}`).denied);
|
|
2942
2942
|
}, [s, c, d]);
|
|
2943
2943
|
const l = pe(() => Zl(i.declaration), [i]), p = R(a.doc);
|
|
2944
2944
|
p.current = a.doc;
|
|
@@ -2947,21 +2947,21 @@ function wu({ editor: e, tools: t = null, children: n }) {
|
|
|
2947
2947
|
store: i.ui,
|
|
2948
2948
|
locale: i.init.locale,
|
|
2949
2949
|
// O(1): `useUi().state` calls it for every command on every render.
|
|
2950
|
-
menuOf: (
|
|
2950
|
+
menuOf: (w) => o.get(w)?.menu ?? [],
|
|
2951
2951
|
declared: l,
|
|
2952
|
-
press: (
|
|
2952
|
+
press: (w) => i.ui.action({ id: w, document: { path: i.init.document.path, dirty: p.current?.info.dirty ?? !1, revision: p.current?.info.revision ?? 0 } }),
|
|
2953
2953
|
offerHide: null,
|
|
2954
2954
|
openCustomize: null,
|
|
2955
2955
|
hide: null,
|
|
2956
|
-
renderButtons: (
|
|
2956
|
+
renderButtons: (w, b) => /* @__PURE__ */ u(zt, { place: w, as: b }),
|
|
2957
2957
|
// A commenter sees what they can run, not a document of disabled edits.
|
|
2958
|
-
sessionHidden: h.size ? (
|
|
2958
|
+
sessionHidden: h.size ? (w) => hl(o.get(w) ?? { id: w }, h) : void 0
|
|
2959
2959
|
}),
|
|
2960
2960
|
[o, h, l, i]
|
|
2961
2961
|
), g = R(async () => []);
|
|
2962
2962
|
return g.current = async () => {
|
|
2963
|
-
const
|
|
2964
|
-
return Gi({ commands:
|
|
2963
|
+
const w = await a.commands(), b = t && !t.tools.length ? await a.tool("tools") ?? [] : t?.tools ?? [];
|
|
2964
|
+
return Gi({ commands: w, declaration: i.declaration, engineTools: b, agent: i.init.capabilities.includes("agent"), t: e.t, phrase: e.phrase, config: i.ui.get() });
|
|
2965
2965
|
}, J(() => {
|
|
2966
2966
|
i.declaration && i.peer.handle("ui/elements", () => g.current());
|
|
2967
2967
|
}, [i]), /* @__PURE__ */ u(Ln.Provider, { value: r, children: /* @__PURE__ */ u(So, { strings: e.t, children: /* @__PURE__ */ u(Yi, { value: f, children: n }) }) });
|
|
@@ -2978,17 +2978,17 @@ function Xe() {
|
|
|
2978
2978
|
return Le(Ln)?.tools ?? null;
|
|
2979
2979
|
}
|
|
2980
2980
|
function Ji(e) {
|
|
2981
|
-
const { offerHide: t } =
|
|
2981
|
+
const { offerHide: t } = be();
|
|
2982
2982
|
return t ? (n) => {
|
|
2983
2983
|
n.preventDefault(), t(e, n.clientX, n.clientY);
|
|
2984
2984
|
} : void 0;
|
|
2985
2985
|
}
|
|
2986
2986
|
function lc({ command: e, params: t, ask: n, onRun: r, ...i }) {
|
|
2987
|
-
const o = te(), { enabled: a, byId: s, testId: d, phrase: c } = o, l =
|
|
2987
|
+
const o = te(), { enabled: a, byId: s, testId: d, phrase: c } = o, l = be(), p = Ji(`command:${e}`);
|
|
2988
2988
|
if (l.state(`command:${e}`).hidden) return null;
|
|
2989
2989
|
const h = s.get(e);
|
|
2990
2990
|
return /* @__PURE__ */ u(
|
|
2991
|
-
|
|
2991
|
+
we,
|
|
2992
2992
|
{
|
|
2993
2993
|
...i,
|
|
2994
2994
|
label: i.label ?? c(h?.title ?? e),
|
|
@@ -3003,9 +3003,9 @@ function lc({ command: e, params: t, ask: n, onRun: r, ...i }) {
|
|
|
3003
3003
|
);
|
|
3004
3004
|
}
|
|
3005
3005
|
function vu({ tool: e, testId: t, ...n }) {
|
|
3006
|
-
const r = Xe(), { testId: i } = te(), a =
|
|
3006
|
+
const r = Xe(), { testId: i } = te(), a = be().state(`tool:${e}`);
|
|
3007
3007
|
return a.hidden ? null : /* @__PURE__ */ u(
|
|
3008
|
-
|
|
3008
|
+
we,
|
|
3009
3009
|
{
|
|
3010
3010
|
...n,
|
|
3011
3011
|
pressed: r?.active === e,
|
|
@@ -3026,7 +3026,7 @@ function xe({ icon: e, label: t, size: n = "small", children: r, disabled: i, sw
|
|
|
3026
3026
|
lt,
|
|
3027
3027
|
{
|
|
3028
3028
|
trigger: ({ toggle: h, open: f }) => /* @__PURE__ */ M("span", { style: { display: "inline-flex", alignItems: "center" }, "data-primary": s || void 0, children: [
|
|
3029
|
-
/* @__PURE__ */ u(
|
|
3029
|
+
/* @__PURE__ */ u(we, { icon: e, label: t, size: p, disabled: i, pressed: f, swatch: o, onClick: h, "data-testid": a, primary: s, lineLabel: d }),
|
|
3030
3030
|
p !== "large" ? /* @__PURE__ */ u(Ii, { size: 11, strokeWidth: $e, "aria-hidden": "true", style: { marginLeft: -4, opacity: 0.6 }, onClick: h }) : null
|
|
3031
3031
|
] }),
|
|
3032
3032
|
children: /* @__PURE__ */ u(vt.Provider, { value: "full", children: /* @__PURE__ */ u(Yt.Provider, { value: mn, children: r }) })
|
|
@@ -3044,16 +3044,16 @@ function cc({
|
|
|
3044
3044
|
path: s,
|
|
3045
3045
|
onRun: d
|
|
3046
3046
|
}) {
|
|
3047
|
-
const c = te(), { enabled: l, byId: p, testId: h, phrase: f } = c, g =
|
|
3048
|
-
if (g.state(`command:${e}`).hidden ||
|
|
3047
|
+
const c = te(), { enabled: l, byId: p, testId: h, phrase: f } = c, g = be(), w = Ji(`command:${e}`), b = s ? g.state(`command:${e}`, s) : null;
|
|
3048
|
+
if (g.state(`command:${e}`).hidden || b?.hidden) return null;
|
|
3049
3049
|
const m = p.get(e);
|
|
3050
|
-
return /* @__PURE__ */ u("div", { onContextMenu:
|
|
3050
|
+
return /* @__PURE__ */ u("div", { onContextMenu: w, style: { display: "contents" }, children: /* @__PURE__ */ u(
|
|
3051
3051
|
le,
|
|
3052
3052
|
{
|
|
3053
3053
|
icon: r,
|
|
3054
3054
|
label: n ?? f(m?.title ?? e),
|
|
3055
3055
|
shortcut: o === void 0 ? m?.shortcut : o,
|
|
3056
|
-
disabled: !l(e) || !!
|
|
3056
|
+
disabled: !l(e) || !!b?.disabled,
|
|
3057
3057
|
checked: a,
|
|
3058
3058
|
onSelect: () => {
|
|
3059
3059
|
i ? c.ask(e) : d && t === void 0 && !(m && Pt(m)) ? d(e) : c.run(e, t);
|
|
@@ -3120,18 +3120,18 @@ function Cu({
|
|
|
3120
3120
|
decorateUnder: l,
|
|
3121
3121
|
children: p
|
|
3122
3122
|
}) {
|
|
3123
|
-
const h = te(), f = Xe(), g = R(null), { doc:
|
|
3123
|
+
const h = te(), f = Xe(), g = R(null), { doc: w, change: b, failure: m, repaints: y } = h.session, [I, N] = B(null), E = He(y.subscribe, y.get), { t: Y } = h, U = f?.decorate ?? null, V = pe(() => gr(gr(l, U), c), [c, l, U]);
|
|
3124
3124
|
return /* @__PURE__ */ M("div", { className: "kui-canvas-region", "data-testid": s ?? `${h.testId}-canvas-region`, children: [
|
|
3125
3125
|
m ? /* @__PURE__ */ M("div", { className: "kui-message", role: "alert", children: [
|
|
3126
3126
|
/* @__PURE__ */ u("strong", { children: Y("openFailed") }),
|
|
3127
3127
|
/* @__PURE__ */ u("span", { className: "kui-muted", children: m })
|
|
3128
|
-
] }) :
|
|
3128
|
+
] }) : w ? /* @__PURE__ */ M(
|
|
3129
3129
|
Xl,
|
|
3130
3130
|
{
|
|
3131
3131
|
ref: e,
|
|
3132
3132
|
viewMemory: t ?? g,
|
|
3133
|
-
doc:
|
|
3134
|
-
change:
|
|
3133
|
+
doc: w,
|
|
3134
|
+
change: b,
|
|
3135
3135
|
repaint: E,
|
|
3136
3136
|
tool: d ?? f?.canvasTool ?? Re,
|
|
3137
3137
|
decorate: V,
|
|
@@ -3143,10 +3143,10 @@ function Cu({
|
|
|
3143
3143
|
onView: (j, D) => {
|
|
3144
3144
|
f?.viewZoom?.(j.zoom), a?.(j, D);
|
|
3145
3145
|
},
|
|
3146
|
-
onRender: (j) => N(j === null ? null : { doc:
|
|
3146
|
+
onRender: (j) => N(j === null ? null : { doc: w, message: Dn(j) }),
|
|
3147
3147
|
children: [
|
|
3148
3148
|
p,
|
|
3149
|
-
I?.doc ===
|
|
3149
|
+
I?.doc === w ? /* @__PURE__ */ u(ac, { message: I.message, title: Y("renderFailed"), retryLabel: Y("retryRender"), onRetry: () => {
|
|
3150
3150
|
e.current?.retryRender();
|
|
3151
3151
|
} }) : null
|
|
3152
3152
|
]
|
|
@@ -3160,14 +3160,14 @@ function kr(e) {
|
|
|
3160
3160
|
return e instanceof HTMLInputElement ? !hc.has(e.type) : e instanceof HTMLSelectElement || e instanceof HTMLTextAreaElement && !e.classList.contains("kui-text-sink");
|
|
3161
3161
|
}
|
|
3162
3162
|
function Nn() {
|
|
3163
|
-
const e = te(), t =
|
|
3163
|
+
const e = te(), t = be(), n = e.host.readOnly === !0, r = n && (e.comments?.size ?? 0) > 0, i = (o, a, s) => {
|
|
3164
3164
|
const d = t.state(`action:${o}`), c = t.state(`command:${a}`);
|
|
3165
3165
|
return { hidden: d.hidden || c.hostHidden || n && !r, disabled: !s || d.disabled || c.denied };
|
|
3166
3166
|
};
|
|
3167
3167
|
return { undo: i("undo", "edit.undo", e.canUndo), redo: i("redo", "edit.redo", e.canRedo), readOnly: n, commenting: r };
|
|
3168
3168
|
}
|
|
3169
3169
|
function fc({ before: e, mode: t }) {
|
|
3170
|
-
const n = te(), r =
|
|
3170
|
+
const n = te(), r = be(), { session: i, host: o, t: a, testId: s } = n, { dirty: d } = i, c = (g) => r.state(`action:${g}`), { undo: l, redo: p, readOnly: h, commenting: f } = Nn();
|
|
3171
3171
|
return /* @__PURE__ */ M(Ce, { children: [
|
|
3172
3172
|
e,
|
|
3173
3173
|
/* @__PURE__ */ u(zt, { place: "action", as: "action" }),
|
|
@@ -3183,7 +3183,7 @@ function fc({ before: e, mode: t }) {
|
|
|
3183
3183
|
/* @__PURE__ */ u(ai, { size: 15, strokeWidth: $e, "aria-hidden": "true" }),
|
|
3184
3184
|
a("save")
|
|
3185
3185
|
] }),
|
|
3186
|
-
r.openCustomize && !c("more").hidden ? /* @__PURE__ */ u(lt, { align: "end", trigger: ({ toggle: g, open:
|
|
3186
|
+
r.openCustomize && !c("more").hidden ? /* @__PURE__ */ u(lt, { align: "end", trigger: ({ toggle: g, open: w }) => /* @__PURE__ */ u(De, { icon: Ms, label: a("more"), pressed: w, disabled: c("more").disabled, onClick: g, "data-testid": `${s}-more`, "data-kit-ui-id": "action:more" }), children: /* @__PURE__ */ u(le, { label: a("customize"), onSelect: () => r.openCustomize?.(), testId: `${s}-customize`, uiId: "action:more" }) }) : null
|
|
3187
3187
|
] });
|
|
3188
3188
|
}
|
|
3189
3189
|
function mc({ x: e, y: t, label: n, testId: r, onHide: i, onClose: o }) {
|
|
@@ -3199,21 +3199,21 @@ function mc({ x: e, y: t, label: n, testId: r, onHide: i, onClose: o }) {
|
|
|
3199
3199
|
}, [o]), /* @__PURE__ */ u("div", { className: "kui-dialog-backdrop kui-hide-menu-backdrop", onPointerDown: o, children: /* @__PURE__ */ u("div", { ref: a, className: "kui-popover kui-hide-menu", role: "menu", style: s ?? { left: e, top: t, visibility: "hidden" }, onPointerDown: (c) => c.stopPropagation(), children: /* @__PURE__ */ u(le, { label: n, onSelect: i, testId: r }) }) });
|
|
3200
3200
|
}
|
|
3201
3201
|
function pc({ top: e, status: t, statusEnd: n, onStatusClick: r, canvas: i, zoom: o, onKeyDown: a, statusBar: s = !0, hiddenCommands: d, fileChangedBar: c = !0, frame: l, children: p }) {
|
|
3202
|
-
const h = te(), f = Xe(), { session: g, t:
|
|
3202
|
+
const h = te(), f = Xe(), { session: g, t: w, testId: b } = h, { dirty: m } = g, y = Le(Wt), I = be(), [N, E] = B(null), [Y, U] = B(null), V = H(() => U(null), []), j = R(async () => {
|
|
3203
3203
|
});
|
|
3204
3204
|
j.current = async (x) => {
|
|
3205
3205
|
try {
|
|
3206
3206
|
await I.store.setPersonal(x);
|
|
3207
3207
|
} catch (C) {
|
|
3208
|
-
ln(h,
|
|
3208
|
+
ln(h, w("customizeFailed"), C);
|
|
3209
3209
|
}
|
|
3210
3210
|
};
|
|
3211
3211
|
const D = R(() => []);
|
|
3212
|
-
D.current = () => Gi({ commands: h.commands, declaration: h.host.declaration, engineTools: f?.tools ?? [], agent: h.host.init.capabilities.includes("agent"), t:
|
|
3212
|
+
D.current = () => Gi({ commands: h.commands, declaration: h.host.declaration, engineTools: f?.tools ?? [], agent: h.host.init.capabilities.includes("agent"), t: w, phrase: h.phrase, config: { ...I.store.get(), personal: [] } });
|
|
3213
3213
|
const { store: Z } = I, Q = Z.customizable && h.host.declaration !== null, fe = pe(
|
|
3214
3214
|
() => y && Q ? {
|
|
3215
3215
|
...y,
|
|
3216
|
-
offerHide: (x, C, W) =>
|
|
3216
|
+
offerHide: (x, C, W) => U({ id: x, x: C, y: W }),
|
|
3217
3217
|
openCustomize: () => E(D.current()),
|
|
3218
3218
|
hide: (x) => void j.current([...Z.get().personal, x])
|
|
3219
3219
|
} : y,
|
|
@@ -3221,10 +3221,10 @@ function pc({ top: e, status: t, statusEnd: n, onStatusClick: r, canvas: i, zoom
|
|
|
3221
3221
|
), ce = (x) => x.currentTarget.ownerDocument.querySelector(".kui-dialog-backdrop") != null || x.target instanceof Element && x.target.closest(".kui-dialog") != null, k = (x) => {
|
|
3222
3222
|
!l || x.nativeEvent.isComposing || ce(x) || l.keyDown(x) && (x.preventDefault(), x.stopPropagation());
|
|
3223
3223
|
}, O = (x) => {
|
|
3224
|
-
|
|
3224
|
+
q(x);
|
|
3225
3225
|
const C = !x.metaKey && !x.ctrlKey && !x.altKey && !x.shiftKey;
|
|
3226
3226
|
l && C && x.key === "Escape" && !x.defaultPrevented && !x.nativeEvent.isComposing && !ce(x) && !kr(x.target) && l.escape() && x.preventDefault();
|
|
3227
|
-
},
|
|
3227
|
+
}, q = (x) => {
|
|
3228
3228
|
if (ce(x)) return;
|
|
3229
3229
|
const C = x.target, W = kr(C);
|
|
3230
3230
|
if (W && !((x.metaKey || x.ctrlKey) && !x.altKey && x.key.toLowerCase() === "s")) return;
|
|
@@ -3280,25 +3280,25 @@ function pc({ top: e, status: t, statusEnd: n, onStatusClick: r, canvas: i, zoom
|
|
|
3280
3280
|
tabIndex: -1,
|
|
3281
3281
|
children: [
|
|
3282
3282
|
e,
|
|
3283
|
-
c && g.conflict && g.doc ? /* @__PURE__ */ M("div", { className: "kui-file-changed", role: "alert", "data-testid": `${
|
|
3284
|
-
/* @__PURE__ */ u("span", { children:
|
|
3285
|
-
/* @__PURE__ */ u(me, { variant: "ghost", size: "sm", onClick: () => void g.keepMine().catch((x) => ln(h,
|
|
3286
|
-
/* @__PURE__ */ u(me, { variant: "primary", size: "sm", onClick: () => g.reopen(), "data-testid": `${
|
|
3283
|
+
c && g.conflict && g.doc ? /* @__PURE__ */ M("div", { className: "kui-file-changed", role: "alert", "data-testid": `${b}-file-changed`, children: [
|
|
3284
|
+
/* @__PURE__ */ u("span", { children: w("fileChanged") }),
|
|
3285
|
+
/* @__PURE__ */ u(me, { variant: "ghost", size: "sm", onClick: () => void g.keepMine().catch((x) => ln(h, w("saveFailed"), x)), "data-testid": `${b}-keep-mine`, children: w("keepMine") }),
|
|
3286
|
+
/* @__PURE__ */ u(me, { variant: "primary", size: "sm", onClick: () => g.reopen(), "data-testid": `${b}-reload`, children: w("reloadFile") })
|
|
3287
3287
|
] }) : null,
|
|
3288
3288
|
p,
|
|
3289
3289
|
s ? /* @__PURE__ */ M($o, { onClick: r ? (x) => !(x.target instanceof Element && x.target.closest('button, input, select, [role="menuitem"]')) && r() : void 0, children: [
|
|
3290
3290
|
t,
|
|
3291
|
-
m ? /* @__PURE__ */ u("span", { "data-testid": `${
|
|
3292
|
-
g.editedBy?.by === "agent" ? /* @__PURE__ */ M("span", { className: "kui-agent-edited", "data-testid": `${
|
|
3291
|
+
m ? /* @__PURE__ */ u("span", { "data-testid": `${b}-unsaved`, children: w("unsaved") }) : null,
|
|
3292
|
+
g.editedBy?.by === "agent" ? /* @__PURE__ */ M("span", { className: "kui-agent-edited", "data-testid": `${b}-agent-edited`, children: [
|
|
3293
3293
|
/* @__PURE__ */ u(Lt, { size: 12, strokeWidth: $e, "aria-hidden": "true" }),
|
|
3294
|
-
|
|
3294
|
+
w("agentEdited")
|
|
3295
3295
|
] }) : g.editedBy?.by === "system" ? (
|
|
3296
3296
|
// The host's own change (Kit UI protocol 2.7): the app, named by its feature on hover.
|
|
3297
|
-
/* @__PURE__ */ u("span", { className: "kui-host-edited", "data-testid": `${
|
|
3297
|
+
/* @__PURE__ */ u("span", { className: "kui-host-edited", "data-testid": `${b}-host-edited`, title: g.editedBy.originLabel, children: w("hostEdited") })
|
|
3298
3298
|
) : null,
|
|
3299
3299
|
/* @__PURE__ */ u(Io, {}),
|
|
3300
3300
|
n,
|
|
3301
|
-
i && o != null ? /* @__PURE__ */ u(Mo, { zoom: o, onZoom: (x) => i.current?.zoomTo(x), onFit: () => i.current?.fit(), labels: { out:
|
|
3301
|
+
i && o != null ? /* @__PURE__ */ u(Mo, { zoom: o, onZoom: (x) => i.current?.zoomTo(x), onFit: () => i.current?.fit(), labels: { out: w("zoomOut"), in: w("zoomIn"), fit: w("fit") } }) : null
|
|
3302
3302
|
] }) : null,
|
|
3303
3303
|
h.dialog ? /* @__PURE__ */ u(
|
|
3304
3304
|
Ol,
|
|
@@ -3306,7 +3306,7 @@ function pc({ top: e, status: t, statusEnd: n, onStatusClick: r, canvas: i, zoom
|
|
|
3306
3306
|
command: h.dialog.command,
|
|
3307
3307
|
values: h.dialog.values,
|
|
3308
3308
|
title: h.phrase(h.dialog.command.title),
|
|
3309
|
-
labels: { run:
|
|
3309
|
+
labels: { run: w("run"), cancel: w("cancel"), required: w("required"), more: w("moreOptions") },
|
|
3310
3310
|
onClose: () => h.setDialog(null),
|
|
3311
3311
|
onRun: (x) => {
|
|
3312
3312
|
const C = h.dialog.command.id;
|
|
@@ -3320,7 +3320,7 @@ function pc({ top: e, status: t, statusEnd: n, onStatusClick: r, canvas: i, zoom
|
|
|
3320
3320
|
{
|
|
3321
3321
|
catalog: N,
|
|
3322
3322
|
personal: I.config.personal,
|
|
3323
|
-
labels: { title:
|
|
3323
|
+
labels: { title: w("customizeTitle"), search: w("customizeSearch"), restore: w("customizeRestore"), cancel: w("cancel"), save: w("customizeSave") },
|
|
3324
3324
|
onSave: (x) => {
|
|
3325
3325
|
E(null), j.current(x);
|
|
3326
3326
|
},
|
|
@@ -3332,10 +3332,10 @@ function pc({ top: e, status: t, statusEnd: n, onStatusClick: r, canvas: i, zoom
|
|
|
3332
3332
|
{
|
|
3333
3333
|
x: Y.x,
|
|
3334
3334
|
y: Y.y,
|
|
3335
|
-
label:
|
|
3336
|
-
testId: `${
|
|
3335
|
+
label: w("hideElement"),
|
|
3336
|
+
testId: `${b}-hide-element`,
|
|
3337
3337
|
onHide: () => {
|
|
3338
|
-
|
|
3338
|
+
U(null), j.current([...I.store.get().personal, Y.id]);
|
|
3339
3339
|
},
|
|
3340
3340
|
onClose: V
|
|
3341
3341
|
}
|
|
@@ -3356,28 +3356,28 @@ function gc(e, t, n, r = () => !0) {
|
|
|
3356
3356
|
const o = (a) => t.includes(a) ? t.indexOf(a) : t.length;
|
|
3357
3357
|
return [...i.values()].sort((a, s) => o(a.label) - o(s.label));
|
|
3358
3358
|
}
|
|
3359
|
-
function
|
|
3359
|
+
function wc({ label: e, path: t, children: n, uiId: r, testId: i }) {
|
|
3360
3360
|
const o = r ?? `menu:${t}`, { phrase: a } = te(), s = R(null), d = R(null), c = R(null), [l, p] = B(null), h = R(!1), f = () => {
|
|
3361
3361
|
const m = s.current?.getBoundingClientRect();
|
|
3362
3362
|
m && p({ left: m.right - 2, top: m.top - 4, maxHeight: Math.max(0, window.innerHeight - 16) });
|
|
3363
3363
|
}, g = () => {
|
|
3364
3364
|
c.current?.contains(document.activeElement) && d.current?.focus(), p(null);
|
|
3365
|
-
},
|
|
3365
|
+
}, w = H(() => {
|
|
3366
3366
|
const m = s.current?.getBoundingClientRect(), y = c.current;
|
|
3367
3367
|
if (!m || !y) return;
|
|
3368
|
-
const I = Math.max(0, window.innerHeight - 16), N = Math.min(y.scrollHeight, I), E = y.offsetWidth, Y = m.right - 2,
|
|
3368
|
+
const I = Math.max(0, window.innerHeight - 16), N = Math.min(y.scrollHeight, I), E = y.offsetWidth, Y = m.right - 2, U = Y + E <= window.innerWidth - 4 ? Y : m.left + 2 - E >= 4 ? m.left + 2 - E : Y, V = Math.max(4, Math.min(U, window.innerWidth - E - 4)), j = Math.max(8, Math.min(m.top - 4, window.innerHeight - 8 - N));
|
|
3369
3369
|
p((D) => !D || D.left === V && D.top === j && D.maxHeight === I ? D : { left: V, top: j, maxHeight: I });
|
|
3370
|
-
}, []),
|
|
3370
|
+
}, []), b = l != null;
|
|
3371
3371
|
return Te(() => {
|
|
3372
|
-
if (!
|
|
3373
|
-
|
|
3372
|
+
if (!b) return;
|
|
3373
|
+
w();
|
|
3374
3374
|
const m = c.current;
|
|
3375
3375
|
if (!m || typeof ResizeObserver > "u") return;
|
|
3376
|
-
const y = new ResizeObserver(() =>
|
|
3376
|
+
const y = new ResizeObserver(() => w());
|
|
3377
3377
|
y.observe(m);
|
|
3378
3378
|
for (const I of m.children) y.observe(I);
|
|
3379
3379
|
return () => y.disconnect();
|
|
3380
|
-
}, [
|
|
3380
|
+
}, [b, w]), Te(() => {
|
|
3381
3381
|
!l || !h.current || !c.current || (h.current = !1, c.current.querySelector('[role^="menuitem"]:not(:disabled)')?.focus());
|
|
3382
3382
|
}, [l]), /* @__PURE__ */ M("div", { ref: s, className: "kui-submenu", onPointerEnter: f, onPointerLeave: g, children: [
|
|
3383
3383
|
/* @__PURE__ */ M(
|
|
@@ -3419,42 +3419,42 @@ function bc({ label: e, path: t, children: n, uiId: r, testId: i }) {
|
|
|
3419
3419
|
) : null
|
|
3420
3420
|
] });
|
|
3421
3421
|
}
|
|
3422
|
-
function
|
|
3422
|
+
function bc({ children: e }) {
|
|
3423
3423
|
const { t } = te();
|
|
3424
3424
|
return /* @__PURE__ */ u(Et, { className: "kui-options-strip", panelClassName: "kui-options-bar", labels: { start: t("optionsScrollStart"), end: t("optionsScrollEnd") }, testId: "options-scroll", children: e });
|
|
3425
3425
|
}
|
|
3426
3426
|
const yc = 400;
|
|
3427
3427
|
function vc({ tools: e, shown: t, active: n, onSelect: r, rail: i, pressMs: o }) {
|
|
3428
|
-
const { testId: a, t: s } = te(), d =
|
|
3428
|
+
const { testId: a, t: s } = te(), d = be(), [c, l] = B(null), p = R(null), h = R(null), f = R(!1);
|
|
3429
3429
|
J(() => {
|
|
3430
|
-
const
|
|
3430
|
+
const b = () => {
|
|
3431
3431
|
f.current = !1;
|
|
3432
3432
|
};
|
|
3433
|
-
return window.addEventListener("pointerdown",
|
|
3433
|
+
return window.addEventListener("pointerdown", b, !0), () => window.removeEventListener("pointerdown", b, !0);
|
|
3434
3434
|
}, []);
|
|
3435
3435
|
const g = () => {
|
|
3436
|
-
const
|
|
3437
|
-
|
|
3436
|
+
const b = p.current?.getBoundingClientRect(), m = i.current?.getBoundingClientRect().right ?? b?.right;
|
|
3437
|
+
b && m != null && e.length > 1 && l({ left: m + 4, top: Math.min(b.top, window.innerHeight - e.length * 30 - 16) });
|
|
3438
3438
|
};
|
|
3439
3439
|
J(() => {
|
|
3440
3440
|
if (!c) return;
|
|
3441
|
-
const
|
|
3441
|
+
const b = (m) => {
|
|
3442
3442
|
(!(m.target instanceof Node) || !document.querySelector(".kui-tool-flyout")?.contains(m.target)) && l(null);
|
|
3443
3443
|
};
|
|
3444
|
-
return window.addEventListener("pointerdown",
|
|
3444
|
+
return window.addEventListener("pointerdown", b, !0), () => window.removeEventListener("pointerdown", b, !0);
|
|
3445
3445
|
}, [c]);
|
|
3446
|
-
const
|
|
3446
|
+
const w = t.shortcut ? `${t.label} (${t.shortcut})` : t.label;
|
|
3447
3447
|
return /* @__PURE__ */ M(
|
|
3448
3448
|
"span",
|
|
3449
3449
|
{
|
|
3450
3450
|
ref: p,
|
|
3451
3451
|
className: "kui-tool-slot",
|
|
3452
3452
|
"data-grouped": e.length > 1,
|
|
3453
|
-
onContextMenu: (
|
|
3454
|
-
|
|
3453
|
+
onContextMenu: (b) => {
|
|
3454
|
+
b.preventDefault(), e.length > 1 ? g() : d.offerHide?.(`tool:${t.id}`, b.clientX, b.clientY);
|
|
3455
3455
|
},
|
|
3456
|
-
onPointerDown: (
|
|
3457
|
-
f.current = !1,
|
|
3456
|
+
onPointerDown: (b) => {
|
|
3457
|
+
f.current = !1, b.button === 0 && (h.current = window.setTimeout(() => {
|
|
3458
3458
|
f.current = e.length > 1, g();
|
|
3459
3459
|
}, o));
|
|
3460
3460
|
},
|
|
@@ -3467,8 +3467,8 @@ function vc({ tools: e, shown: t, active: n, onSelect: r, rail: i, pressMs: o })
|
|
|
3467
3467
|
De,
|
|
3468
3468
|
{
|
|
3469
3469
|
icon: t.icon,
|
|
3470
|
-
label:
|
|
3471
|
-
pressed: e.some((
|
|
3470
|
+
label: w,
|
|
3471
|
+
pressed: e.some((b) => b.id === n),
|
|
3472
3472
|
disabled: d.state(`tool:${t.id}`).disabled,
|
|
3473
3473
|
onClick: () => {
|
|
3474
3474
|
f.current ? f.current = !1 : r(t.id);
|
|
@@ -3478,26 +3478,26 @@ function vc({ tools: e, shown: t, active: n, onSelect: r, rail: i, pressMs: o })
|
|
|
3478
3478
|
}
|
|
3479
3479
|
),
|
|
3480
3480
|
c ? /* @__PURE__ */ M("div", { className: "kui-popover kui-tool-flyout", role: "menu", style: { left: c.left, top: c.top }, children: [
|
|
3481
|
-
e.map((
|
|
3481
|
+
e.map((b) => /* @__PURE__ */ M(
|
|
3482
3482
|
"button",
|
|
3483
3483
|
{
|
|
3484
3484
|
type: "button",
|
|
3485
3485
|
role: "menuitemradio",
|
|
3486
|
-
"aria-checked":
|
|
3486
|
+
"aria-checked": b.id === n,
|
|
3487
3487
|
className: "kui-menu-item",
|
|
3488
|
-
disabled: d.state(`tool:${
|
|
3488
|
+
disabled: d.state(`tool:${b.id}`).disabled,
|
|
3489
3489
|
onClick: () => {
|
|
3490
|
-
l(null), r(
|
|
3490
|
+
l(null), r(b.id);
|
|
3491
3491
|
},
|
|
3492
|
-
"data-testid": `${a}-tool-${
|
|
3493
|
-
"data-kit-ui-id": `tool:${
|
|
3492
|
+
"data-testid": `${a}-tool-${b.id}`,
|
|
3493
|
+
"data-kit-ui-id": `tool:${b.id}`,
|
|
3494
3494
|
children: [
|
|
3495
|
-
/* @__PURE__ */ u(
|
|
3496
|
-
/* @__PURE__ */ u("span", { children:
|
|
3497
|
-
|
|
3495
|
+
/* @__PURE__ */ u(b.icon, { size: 15, strokeWidth: $e, "aria-hidden": "true" }),
|
|
3496
|
+
/* @__PURE__ */ u("span", { children: b.label }),
|
|
3497
|
+
b.shortcut ? /* @__PURE__ */ u("kbd", { children: b.shortcut }) : null
|
|
3498
3498
|
]
|
|
3499
3499
|
},
|
|
3500
|
-
|
|
3500
|
+
b.id
|
|
3501
3501
|
)),
|
|
3502
3502
|
d.hide ? /* @__PURE__ */ M(
|
|
3503
3503
|
"button",
|
|
@@ -3535,7 +3535,7 @@ function Ic({ tools: e, active: t, onSelect: n, columns: r = 1, onColumns: i, co
|
|
|
3535
3535
|
J(() => {
|
|
3536
3536
|
h != null && p((D) => D.get(h) === t ? D : new Map(D).set(h, t));
|
|
3537
3537
|
}, [t, h]);
|
|
3538
|
-
const [f, g] = B(!1),
|
|
3538
|
+
const [f, g] = B(!1), w = R(null), b = be(), m = e.filter((D) => !b.state(`tool:${D.id}`).hidden), y = b.state(`tool:${t}`).denied ? m.find((D) => !b.state(`tool:${D.id}`).denied)?.id : void 0, I = R(n);
|
|
3539
3539
|
I.current = n, Te(() => {
|
|
3540
3540
|
y && I.current(y);
|
|
3541
3541
|
}, [y]);
|
|
@@ -3551,26 +3551,26 @@ function Ic({ tools: e, active: t, onSelect: n, columns: r = 1, onColumns: i, co
|
|
|
3551
3551
|
}
|
|
3552
3552
|
J(() => {
|
|
3553
3553
|
if (r !== "auto" || typeof ResizeObserver > "u") return;
|
|
3554
|
-
const D =
|
|
3554
|
+
const D = w.current, Z = D?.parentElement;
|
|
3555
3555
|
if (!D || !Z) return;
|
|
3556
3556
|
const Q = () => g(xc(N.length, E.length, Z.getBoundingClientRect().bottom - D.getBoundingClientRect().top)), fe = new ResizeObserver(Q);
|
|
3557
3557
|
return fe.observe(Z), () => fe.disconnect();
|
|
3558
3558
|
}, [r, N.length, E.length]);
|
|
3559
|
-
const Y = r === 2 || r === "auto" && f ? 2 : 1,
|
|
3560
|
-
|
|
3559
|
+
const Y = r === 2 || r === "auto" && f ? 2 : 1, U = o ? b.state(o) : { hidden: !1, disabled: !1 }, V = (D) => {
|
|
3560
|
+
b.state(`tool:${D}`).denied || n(D);
|
|
3561
3561
|
}, j = (D) => {
|
|
3562
|
-
const Z = (ce) => !
|
|
3563
|
-
return /* @__PURE__ */ u(vc, { tools: D, shown: fe, active: t, onSelect: V, rail:
|
|
3562
|
+
const Z = (ce) => !b.state(`tool:${ce.id}`).denied, Q = D[0].group == null || !a ? void 0 : l.get(D[0].group), fe = D.find((ce) => ce.id === t) ?? D.find((ce) => ce.id === Q && Z(ce)) ?? D.find(Z) ?? D[0];
|
|
3563
|
+
return /* @__PURE__ */ u(vc, { tools: D, shown: fe, active: t, onSelect: V, rail: w, pressMs: s }, D[0].id);
|
|
3564
3564
|
};
|
|
3565
|
-
return /* @__PURE__ */ M("div", { className: "kui-tool-rail", role: "toolbar", "aria-orientation": "vertical", "data-testid": `${d}-tool-rail`, "data-columns": Y, ref:
|
|
3566
|
-
i && r !== "auto" && !
|
|
3565
|
+
return /* @__PURE__ */ M("div", { className: "kui-tool-rail", role: "toolbar", "aria-orientation": "vertical", "data-testid": `${d}-tool-rail`, "data-columns": Y, ref: w, children: [
|
|
3566
|
+
i && r !== "auto" && !U.hidden ? /* @__PURE__ */ u(
|
|
3567
3567
|
"button",
|
|
3568
3568
|
{
|
|
3569
3569
|
type: "button",
|
|
3570
3570
|
className: "kui-tool-rail-columns",
|
|
3571
3571
|
"aria-label": c(r === 2 ? "railOneColumn" : "railTwoColumns"),
|
|
3572
3572
|
title: c(r === 2 ? "railOneColumn" : "railTwoColumns"),
|
|
3573
|
-
disabled:
|
|
3573
|
+
disabled: U.disabled,
|
|
3574
3574
|
onClick: () => i(r === 2 ? 1 : 2),
|
|
3575
3575
|
"data-testid": `${d}-tool-rail-columns`,
|
|
3576
3576
|
"data-kit-ui-id": o,
|
|
@@ -3590,7 +3590,7 @@ function xu({ hidden: e = [] }) {
|
|
|
3590
3590
|
return /* @__PURE__ */ u(Ic, { tools: i, active: t.active, onSelect: t.select });
|
|
3591
3591
|
}
|
|
3592
3592
|
function $u({ id: e, title: t, children: n, defaultOpen: r = !0, actions: i, testId: o }) {
|
|
3593
|
-
const [a, s] = B(r), d =
|
|
3593
|
+
const [a, s] = B(r), d = be();
|
|
3594
3594
|
e && (d.declared, void 0);
|
|
3595
3595
|
const c = e ? d.state(e) : null;
|
|
3596
3596
|
return c?.hidden ? null : /* @__PURE__ */ M("section", { className: "kui-panel-section", "data-open": a, "data-testid": o, "data-kit-ui-id": e, children: [
|
|
@@ -3775,24 +3775,24 @@ async function Pc(e, t, n, r, i, o) {
|
|
|
3775
3775
|
function Ou(e, t, n, r = {}) {
|
|
3776
3776
|
const i = e.init.document.path, o = e.readOnly === !0, a = o && e.init.document.comments?.canComment === !0, s = t.commentCommands, d = pe(() => ul(s, a), [a, s]), c = kl(e.files, t, i, !0, n, { readOnly: o, canComment: a, replicaMergesFile: r.replicaMergesFile, followFile: r.followFile }), { doc: l, failure: p } = c, h = l?.info.revision ?? null, f = l?.info.dirty ?? !1, g = R(c);
|
|
3777
3777
|
g.current = c;
|
|
3778
|
-
const
|
|
3779
|
-
const W =
|
|
3778
|
+
const w = R({ doc: null, map: null, commands: null, loading: null }), b = H((C) => {
|
|
3779
|
+
const W = w.current;
|
|
3780
3780
|
if (W.doc === C && W.loading) return W.loading;
|
|
3781
3781
|
const _ = C.commands().then((T) => {
|
|
3782
3782
|
const K = new Map(T.map((ne) => [ne.id, ne.menu]));
|
|
3783
|
-
return
|
|
3783
|
+
return w.current.loading === _ && (w.current = { doc: C, map: K, commands: new Map(T.map((ne) => [ne.id, ne])), loading: _ }), K;
|
|
3784
3784
|
});
|
|
3785
3785
|
return _.catch(() => {
|
|
3786
|
-
|
|
3787
|
-
}),
|
|
3786
|
+
w.current.loading === _ && (w.current = { doc: null, map: null, commands: null, loading: null });
|
|
3787
|
+
}), w.current = { doc: C, map: null, commands: null, loading: _ }, _;
|
|
3788
3788
|
}, []);
|
|
3789
3789
|
J(() => {
|
|
3790
|
-
l &&
|
|
3790
|
+
l && b(l).catch(() => {
|
|
3791
3791
|
});
|
|
3792
|
-
}, [l,
|
|
3792
|
+
}, [l, b]);
|
|
3793
3793
|
const m = H(
|
|
3794
3794
|
(C) => {
|
|
3795
|
-
const W =
|
|
3795
|
+
const W = w.current.commands?.get(C);
|
|
3796
3796
|
return It(W ?? { id: C }, d);
|
|
3797
3797
|
},
|
|
3798
3798
|
[d]
|
|
@@ -3800,7 +3800,7 @@ function Ou(e, t, n, r = {}) {
|
|
|
3800
3800
|
async (C, W = {}, _ = null, T = {}) => {
|
|
3801
3801
|
const K = g.current.doc;
|
|
3802
3802
|
if (!K) return null;
|
|
3803
|
-
const ne =
|
|
3803
|
+
const ne = w.current, P = ne.doc === K && ne.map ? ne.map : await b(K);
|
|
3804
3804
|
if (Se(e.ui.get(), `command:${C}`, P.get(C) ?? []).denied) throw ht(C);
|
|
3805
3805
|
if (o && m(C)) throw mt(C);
|
|
3806
3806
|
try {
|
|
@@ -3809,14 +3809,14 @@ function Ou(e, t, n, r = {}) {
|
|
|
3809
3809
|
throw Fi(G) ? mt(C) : G;
|
|
3810
3810
|
}
|
|
3811
3811
|
},
|
|
3812
|
-
[m, e,
|
|
3812
|
+
[m, e, b, o, c.run]
|
|
3813
3813
|
), I = r.agentSkipsUnchangedPaint === !0, N = R(r);
|
|
3814
3814
|
N.current = r;
|
|
3815
3815
|
const E = pe(() => _i(Vi, e.init.locale), [e]), Y = r.agentLeaseScope != null;
|
|
3816
3816
|
J(() => {
|
|
3817
3817
|
Y && dn(e);
|
|
3818
3818
|
}, [e, Y]);
|
|
3819
|
-
const
|
|
3819
|
+
const U = R(Promise.resolve()), V = R(null), j = R(null), [D, Z] = B(null), Q = H((C, W) => {
|
|
3820
3820
|
j.current = { edit: C, revision: W }, Z(C);
|
|
3821
3821
|
}, []), fe = R(!1), ce = R({ doc: null, version: null }), k = R(null);
|
|
3822
3822
|
k.current ??= new Cl({
|
|
@@ -3838,12 +3838,12 @@ function Ou(e, t, n, r = {}) {
|
|
|
3838
3838
|
const C = V.current ?? (j.current?.revision === l.info.revision ? j.current.edit : { by: "person" });
|
|
3839
3839
|
C.by === "person" && j.current && (j.current = null, Z(null)), e.changed({ dirty: l.info.dirty, revision: l.info.revision, title: e.init.document.name, ...C });
|
|
3840
3840
|
}, [l, e, h, f]);
|
|
3841
|
-
const O = l?.info.schema?.reads ?? null,
|
|
3841
|
+
const O = l?.info.schema?.reads ?? null, q = l?.info.schema?.newestAuthor ?? null, x = R(null);
|
|
3842
3842
|
return J(() => {
|
|
3843
|
-
if (O === null ||
|
|
3844
|
-
const C = `${O}:${
|
|
3845
|
-
x.current !== C && (x.current = C, e.peer.notify("document/schema", { reads: O, newestAuthor:
|
|
3846
|
-
}, [e,
|
|
3843
|
+
if (O === null || q === null || q <= O) return;
|
|
3844
|
+
const C = `${O}:${q}`;
|
|
3845
|
+
x.current !== C && (x.current = C, e.peer.notify("document/schema", { reads: O, newestAuthor: q }));
|
|
3846
|
+
}, [e, q, O]), J(() => {
|
|
3847
3847
|
if (!e.replica || !l) return;
|
|
3848
3848
|
const C = l.info.replica ?? null, W = C ? C.join(",") : null, _ = ce.current;
|
|
3849
3849
|
ce.current = { doc: l, version: W }, !(_.doc !== l || !C || W === _.version) && e.peer.notify("replica/changed", { version: C.slice().buffer });
|
|
@@ -3874,7 +3874,7 @@ function Ou(e, t, n, r = {}) {
|
|
|
3874
3874
|
const L = al(e.ui.get(), await W().commands());
|
|
3875
3875
|
return Lc(o ? L.map((re) => It(re, d) ? { ...re, enabled: !1 } : re) : L, A);
|
|
3876
3876
|
}), C.handle("ai/run", async (A) => {
|
|
3877
|
-
const { steps: L, save: re, draft: ie } = A, ae = Ec(A), se = W(), ge = await
|
|
3877
|
+
const { steps: L, save: re, draft: ie } = A, ae = Ec(A), se = W(), ge = await b(se), v = ol(e.ui.get(), L, ($) => ge.get($) ?? []);
|
|
3878
3878
|
if (v >= 0) throw ht(L[v].command, v);
|
|
3879
3879
|
const z = o ? L.findIndex(($) => m($.command)) : -1;
|
|
3880
3880
|
if (z >= 0) throw mt(L[z].command, z);
|
|
@@ -3947,8 +3947,8 @@ function Ou(e, t, n, r = {}) {
|
|
|
3947
3947
|
L
|
|
3948
3948
|
) : $(` The ${L.length} step(s) before it were rolled back: the document is as it was before the run.`, [], L);
|
|
3949
3949
|
}, P = (A) => {
|
|
3950
|
-
const L =
|
|
3951
|
-
return
|
|
3950
|
+
const L = U.current.then(A, A);
|
|
3951
|
+
return U.current = L.then(
|
|
3952
3952
|
() => {
|
|
3953
3953
|
},
|
|
3954
3954
|
() => {
|
|
@@ -3963,7 +3963,7 @@ function Ou(e, t, n, r = {}) {
|
|
|
3963
3963
|
} catch {
|
|
3964
3964
|
z = "";
|
|
3965
3965
|
}
|
|
3966
|
-
const S =
|
|
3966
|
+
const S = w.current.commands?.get(L)?.mutates ?? !0;
|
|
3967
3967
|
return Pc(v, z, S, N.current.agentLeaseTtl, ae, ($, F) => (se.by === "agent" && e.notify({ level: "warning", title: E("agentLeaseHeld", { name: F?.name || E("someone") }) }), Nc(L, ie, $, F)));
|
|
3968
3968
|
};
|
|
3969
3969
|
C.handle("ai/preview", async ({ maxSize: A, draft: L }) => ({ png: await an(L === !0 ? await T(!1) : W(), A) }));
|
|
@@ -4023,7 +4023,7 @@ function Ou(e, t, n, r = {}) {
|
|
|
4023
4023
|
(A) => ye(async () => {
|
|
4024
4024
|
const { schema: L = null, draft: re, ...ie } = A ?? {}, ae = Array.isArray(ie.ops) ? ie.ops : [];
|
|
4025
4025
|
if (o && ae.length) throw new Je({ code: Oe, index: null, message: "the document is read-only" });
|
|
4026
|
-
const se = await
|
|
4026
|
+
const se = await b(W());
|
|
4027
4027
|
if (ae.forEach((z, S) => {
|
|
4028
4028
|
if (z?.op === "command" && typeof z.id == "string" && Se(e.ui.get(), `command:${z.id}`, se.get(z.id) ?? []).denied)
|
|
4029
4029
|
throw new Je({ code: "command-failed", index: S, message: ht(z.id).message });
|
|
@@ -4038,7 +4038,7 @@ function Ou(e, t, n, r = {}) {
|
|
|
4038
4038
|
return e.replica && (C.handle("replica/version", async () => ({ version: await g.current.replica.version() })), C.handle("replica/export", ({ since: A }) => g.current.replica.exportChanges(A)), C.handle("replica/import", async ({ changes: A, blobs: L }) => ({ damage: await g.current.replica.importChanges(A, L) })), C.handle("replica/info", async () => ({ docId: await g.current.replica.docId() }))), () => {
|
|
4039
4039
|
Ne(), We();
|
|
4040
4040
|
};
|
|
4041
|
-
}, [d, Q, m, e, t.kitId,
|
|
4041
|
+
}, [d, Q, m, e, t.kitId, b, i, o, y, I, E]), { ...c, run: y, editedBy: D, comments: d };
|
|
4042
4042
|
}
|
|
4043
4043
|
const to = [
|
|
4044
4044
|
{ preset: "rect", icon: ct, label: "drawingRect" },
|
|
@@ -4054,7 +4054,7 @@ function Ru({ testId: e = "drawing", label: t, merge: n, exclude: r, primary: i
|
|
|
4054
4054
|
const o = te(), { t: a } = o, s = !o.enabled("drawing.insert"), d = (p) => void o.run("drawing.insert", p), c = o.byId.has("draw.shape"), l = (p) => c ? void o.run("draw.shape", { preset: p }) : d({ geometry: { preset: p } });
|
|
4055
4055
|
return /* @__PURE__ */ M(Me, { label: t ?? a("drawingIllustrations"), icon: _e, children: [
|
|
4056
4056
|
/* @__PURE__ */ u(xe, { icon: _e, label: a("drawingShapes"), size: "large", disabled: s, testId: `${e}-shapes`, primary: !0, children: to.map((p) => /* @__PURE__ */ u(le, { icon: p.icon, label: a(p.label), testId: `${e}-shape-${p.preset}`, onSelect: () => l(p.preset) }, p.preset)) }),
|
|
4057
|
-
/* @__PURE__ */ u(
|
|
4057
|
+
/* @__PURE__ */ u(we, { icon: qe, label: a("drawingTextBox"), size: "large", disabled: s, onClick: () => d({ kind: "textBox", text: "" }), "data-testid": `${e}-text-box`, primary: !0 }),
|
|
4058
4058
|
n ? /* @__PURE__ */ u(uc, { path: n, titles: Fc, exclude: r, primary: i?.length ? i : void 0 }) : null
|
|
4059
4059
|
] });
|
|
4060
4060
|
}
|
|
@@ -4102,11 +4102,11 @@ function Hc(e) {
|
|
|
4102
4102
|
};
|
|
4103
4103
|
}, [t, o, n]), r;
|
|
4104
4104
|
}
|
|
4105
|
-
const
|
|
4105
|
+
const Uc = [
|
|
4106
4106
|
{ id: "bottomRight", label: "drawingShadowBottomRight", shadow: { blur: 4, distance: 3, angle: 45 } },
|
|
4107
4107
|
{ id: "bottom", label: "drawingShadowBottom", shadow: { blur: 4, distance: 3, angle: 90 } },
|
|
4108
4108
|
{ id: "around", label: "drawingShadowAround", shadow: { blur: 8, distance: 0, angle: 0 } }
|
|
4109
|
-
],
|
|
4109
|
+
], qc = [
|
|
4110
4110
|
{ preset: "textArchUp", label: "drawingWarpArchUp" },
|
|
4111
4111
|
{ preset: "textArchDown", label: "drawingWarpArchDown" },
|
|
4112
4112
|
{ preset: "textCircle", label: "drawingWarpCircle" },
|
|
@@ -4125,7 +4125,7 @@ const qc = [
|
|
|
4125
4125
|
function jc({ disabled: e, testId: t = "drawing", onPick: n }) {
|
|
4126
4126
|
const { t: r } = te();
|
|
4127
4127
|
return /* @__PURE__ */ M(xe, { icon: vn, label: r("drawingTransform"), disabled: e, testId: `${t}-transform`, children: [
|
|
4128
|
-
|
|
4128
|
+
qc.map((i) => /* @__PURE__ */ u(le, { label: r(i.label), testId: `${t}-warp-${i.preset}`, onSelect: () => n(i.preset) }, i.preset)),
|
|
4129
4129
|
/* @__PURE__ */ u(Ae, {}),
|
|
4130
4130
|
/* @__PURE__ */ u(le, { label: r("drawingNoTransform"), testId: `${t}-no-warp`, onSelect: () => n(null) })
|
|
4131
4131
|
] });
|
|
@@ -4144,7 +4144,7 @@ function Du({ ids: e, testId: t = "drawing", effects: n = !0 }) {
|
|
|
4144
4144
|
/* @__PURE__ */ u(le, { label: i("drawingNoFill"), testId: `${t}-no-fill`, onSelect: () => a({ fill: { none: !0 } }) })
|
|
4145
4145
|
] }),
|
|
4146
4146
|
n ? /* @__PURE__ */ M(xe, { icon: Lt, label: i("drawingEffects"), disabled: o, testId: `${t}-effects`, children: [
|
|
4147
|
-
|
|
4147
|
+
Uc.map((f) => /* @__PURE__ */ u(le, { label: i(f.label), testId: `${t}-shadow-${f.id}`, onSelect: () => a({ effects: { shadow: { color: { rgb: "#000000", alpha: 0.4 }, ...f.shadow } } }) }, f.id)),
|
|
4148
4148
|
/* @__PURE__ */ u(le, { label: i("drawingNoShadow"), testId: `${t}-no-shadow`, onSelect: () => a({ effects: { shadow: null } }) }),
|
|
4149
4149
|
/* @__PURE__ */ u(Ae, {}),
|
|
4150
4150
|
/* @__PURE__ */ u(le, { label: i("drawingGlow"), testId: `${t}-glow`, onSelect: () => a({ effects: { glow: { color: { rgb: h, alpha: 0.6 }, size: 5 } } }) }),
|
|
@@ -4173,7 +4173,7 @@ function Du({ ids: e, testId: t = "drawing", effects: n = !0 }) {
|
|
|
4173
4173
|
] }),
|
|
4174
4174
|
/* @__PURE__ */ M(Fe, { children: [
|
|
4175
4175
|
/* @__PURE__ */ u(
|
|
4176
|
-
|
|
4176
|
+
we,
|
|
4177
4177
|
{
|
|
4178
4178
|
icon: In,
|
|
4179
4179
|
label: i("drawingGroup"),
|
|
@@ -4184,7 +4184,7 @@ function Du({ ids: e, testId: t = "drawing", effects: n = !0 }) {
|
|
|
4184
4184
|
}
|
|
4185
4185
|
),
|
|
4186
4186
|
/* @__PURE__ */ u(
|
|
4187
|
-
|
|
4187
|
+
we,
|
|
4188
4188
|
{
|
|
4189
4189
|
icon: Os,
|
|
4190
4190
|
label: i("drawingConnect"),
|
|
@@ -4194,7 +4194,7 @@ function Du({ ids: e, testId: t = "drawing", effects: n = !0 }) {
|
|
|
4194
4194
|
}
|
|
4195
4195
|
),
|
|
4196
4196
|
/* @__PURE__ */ u(
|
|
4197
|
-
|
|
4197
|
+
we,
|
|
4198
4198
|
{
|
|
4199
4199
|
icon: Mn,
|
|
4200
4200
|
label: i("drawingUngroup"),
|
|
@@ -4204,7 +4204,7 @@ function Du({ ids: e, testId: t = "drawing", effects: n = !0 }) {
|
|
|
4204
4204
|
}
|
|
4205
4205
|
),
|
|
4206
4206
|
/* @__PURE__ */ u(
|
|
4207
|
-
|
|
4207
|
+
we,
|
|
4208
4208
|
{
|
|
4209
4209
|
icon: $n,
|
|
4210
4210
|
label: i("drawingRotateRight"),
|
|
@@ -4214,7 +4214,7 @@ function Du({ ids: e, testId: t = "drawing", effects: n = !0 }) {
|
|
|
4214
4214
|
}
|
|
4215
4215
|
),
|
|
4216
4216
|
/* @__PURE__ */ u(
|
|
4217
|
-
|
|
4217
|
+
we,
|
|
4218
4218
|
{
|
|
4219
4219
|
icon: rt,
|
|
4220
4220
|
label: i("drawingDelete"),
|
|
@@ -4245,14 +4245,14 @@ function Lu({ testId: e = "ink" }) {
|
|
|
4245
4245
|
const g = setTimeout(s, 60);
|
|
4246
4246
|
return () => clearTimeout(g);
|
|
4247
4247
|
}, [s, i, n?.active]);
|
|
4248
|
-
const d = (g) => n?.tools.some((
|
|
4248
|
+
const d = (g) => n?.tools.some((w) => w.id === g) ?? !1, c = async (g) => {
|
|
4249
4249
|
d(g) ? n?.select(g) : await t.run(`draw.${g}`, {}), s();
|
|
4250
4250
|
}, l = n && d(o?.tool ?? "select") && n.tools.some((g) => g.id === n.active) ? n.active : o?.tool, p = o && Vc.includes(o.tool) ? o.tool : null, h = async (g) => {
|
|
4251
4251
|
p && (await t.run(`draw.${p}`, g), s());
|
|
4252
4252
|
}, f = !t.enabled("draw.pen");
|
|
4253
4253
|
return /* @__PURE__ */ M(Ce, { children: [
|
|
4254
4254
|
/* @__PURE__ */ u(Me, { label: r("inkTools"), icon: Ti, children: Gc.map((g) => /* @__PURE__ */ u(
|
|
4255
|
-
|
|
4255
|
+
we,
|
|
4256
4256
|
{
|
|
4257
4257
|
icon: g.icon,
|
|
4258
4258
|
label: r(g.label),
|
|
@@ -4433,7 +4433,7 @@ function Pu({
|
|
|
4433
4433
|
dataEditable: n = !0,
|
|
4434
4434
|
formats: r = no
|
|
4435
4435
|
}) {
|
|
4436
|
-
const i = te(), { t: o } = i, a = nd(e), [s, d] = B(!1), [c, l] = B(null), p = !a || !i.enabled("drawing.chart"), h = (m) => void i.run("drawing.chart", { id: e, ...m }), f = typeof a?.kind == "object", g = a?.kind === "pie" || a?.kind === "doughnut",
|
|
4436
|
+
const i = te(), { t: o } = i, a = nd(e), [s, d] = B(!1), [c, l] = B(null), p = !a || !i.enabled("drawing.chart"), h = (m) => void i.run("drawing.chart", { id: e, ...m }), f = typeof a?.kind == "object", g = a?.kind === "pie" || a?.kind === "doughnut", w = g || a?.kind === "radar" || f, b = (m) => h({ seriesFormat: (a?.series ?? []).map((y, I) => ({ index: I, ...m })) });
|
|
4437
4437
|
return /* @__PURE__ */ M(Ce, { children: [
|
|
4438
4438
|
/* @__PURE__ */ u(Me, { label: o("chartType"), icon: je, children: /* @__PURE__ */ u(
|
|
4439
4439
|
xe,
|
|
@@ -4462,9 +4462,9 @@ function Pu({
|
|
|
4462
4462
|
/* @__PURE__ */ M(Me, { label: o("chartElements"), icon: Ps, children: [
|
|
4463
4463
|
/* @__PURE__ */ M(Fe, { children: [
|
|
4464
4464
|
/* @__PURE__ */ u(
|
|
4465
|
-
|
|
4465
|
+
we,
|
|
4466
4466
|
{
|
|
4467
|
-
icon:
|
|
4467
|
+
icon: Ur,
|
|
4468
4468
|
label: o("chartTitle"),
|
|
4469
4469
|
pressed: a?.title != null,
|
|
4470
4470
|
disabled: p,
|
|
@@ -4478,7 +4478,7 @@ function Pu({
|
|
|
4478
4478
|
/* @__PURE__ */ M(
|
|
4479
4479
|
xe,
|
|
4480
4480
|
{
|
|
4481
|
-
icon:
|
|
4481
|
+
icon: qe,
|
|
4482
4482
|
label: o("chartLegend"),
|
|
4483
4483
|
disabled: p,
|
|
4484
4484
|
testId: `${t}-legend`,
|
|
@@ -4508,7 +4508,7 @@ function Pu({
|
|
|
4508
4508
|
}
|
|
4509
4509
|
),
|
|
4510
4510
|
/* @__PURE__ */ u(
|
|
4511
|
-
|
|
4511
|
+
we,
|
|
4512
4512
|
{
|
|
4513
4513
|
icon: pn,
|
|
4514
4514
|
label: o("chartDataLabels"),
|
|
@@ -4522,7 +4522,7 @@ function Pu({
|
|
|
4522
4522
|
] }),
|
|
4523
4523
|
/* @__PURE__ */ M(Fe, { children: [
|
|
4524
4524
|
/* @__PURE__ */ u(
|
|
4525
|
-
|
|
4525
|
+
we,
|
|
4526
4526
|
{
|
|
4527
4527
|
icon: St,
|
|
4528
4528
|
label: o("chartGridlines"),
|
|
@@ -4533,21 +4533,21 @@ function Pu({
|
|
|
4533
4533
|
}
|
|
4534
4534
|
),
|
|
4535
4535
|
r.includes("trends") ? /* @__PURE__ */ M(Ce, { children: [
|
|
4536
|
-
/* @__PURE__ */ M(xe, { icon: Fs, label: o("chartTrendline"), disabled: p ||
|
|
4537
|
-
Jc.map((m) => /* @__PURE__ */ u(le, { label: o(m.label), testId: `${t}-trendline-${m.id}`, onSelect: () =>
|
|
4536
|
+
/* @__PURE__ */ M(xe, { icon: Fs, label: o("chartTrendline"), disabled: p || w, testId: `${t}-trendline`, children: [
|
|
4537
|
+
Jc.map((m) => /* @__PURE__ */ u(le, { label: o(m.label), testId: `${t}-trendline-${m.id}`, onSelect: () => b({ trendline: m.trendline }) }, m.id)),
|
|
4538
4538
|
/* @__PURE__ */ u(Ae, {}),
|
|
4539
|
-
/* @__PURE__ */ u(le, { label: o("chartNone"), testId: `${t}-trendline-none`, onSelect: () =>
|
|
4539
|
+
/* @__PURE__ */ u(le, { label: o("chartNone"), testId: `${t}-trendline-none`, onSelect: () => b({ trendline: null }) })
|
|
4540
4540
|
] }),
|
|
4541
|
-
/* @__PURE__ */ M(xe, { icon: Ve, label: o("chartErrorBars"), disabled: p ||
|
|
4542
|
-
Zc.map((m) => /* @__PURE__ */ u(le, { label: o(m.label), testId: `${t}-error-bars-${m.id}`, onSelect: () =>
|
|
4541
|
+
/* @__PURE__ */ M(xe, { icon: Ve, label: o("chartErrorBars"), disabled: p || w, testId: `${t}-error-bars`, children: [
|
|
4542
|
+
Zc.map((m) => /* @__PURE__ */ u(le, { label: o(m.label), testId: `${t}-error-bars-${m.id}`, onSelect: () => b({ errorBars: m.errorBars }) }, m.id)),
|
|
4543
4543
|
/* @__PURE__ */ u(Ae, {}),
|
|
4544
|
-
/* @__PURE__ */ u(le, { label: o("chartNone"), testId: `${t}-error-bars-none`, onSelect: () =>
|
|
4544
|
+
/* @__PURE__ */ u(le, { label: o("chartNone"), testId: `${t}-error-bars-none`, onSelect: () => b({ errorBars: null }) })
|
|
4545
4545
|
] })
|
|
4546
4546
|
] }) : null,
|
|
4547
4547
|
/* @__PURE__ */ u(
|
|
4548
|
-
|
|
4548
|
+
we,
|
|
4549
4549
|
{
|
|
4550
|
-
icon:
|
|
4550
|
+
icon: qe,
|
|
4551
4551
|
label: o("chartAxisTitles"),
|
|
4552
4552
|
pressed: a?.xTitle != null || a?.yTitle != null,
|
|
4553
4553
|
disabled: p || g,
|
|
@@ -4572,7 +4572,7 @@ function Pu({
|
|
|
4572
4572
|
}
|
|
4573
4573
|
),
|
|
4574
4574
|
n ? /* @__PURE__ */ u(Me, { label: o("chartData"), icon: yn, children: /* @__PURE__ */ u(
|
|
4575
|
-
|
|
4575
|
+
we,
|
|
4576
4576
|
{
|
|
4577
4577
|
icon: Ws,
|
|
4578
4578
|
label: o("chartEditData"),
|
|
@@ -4626,7 +4626,7 @@ function rd({
|
|
|
4626
4626
|
), p = l.includes("lineWidth") || ro(e?.kind) && l.length > 0 || l.includes("combo") && typeof e?.kind == "string" && !["pie", "doughnut", "radar", "scatter"].includes(e.kind);
|
|
4627
4627
|
return !n.includes("axes") && !n.includes("labelPosition") && l.length === 0 ? null : /* @__PURE__ */ u(Me, { label: a("chartFormat"), icon: Rt, children: /* @__PURE__ */ M(Fe, { children: [
|
|
4628
4628
|
n.includes("axes") ? /* @__PURE__ */ u(
|
|
4629
|
-
|
|
4629
|
+
we,
|
|
4630
4630
|
{
|
|
4631
4631
|
icon: Ve,
|
|
4632
4632
|
label: a("chartFormatAxis"),
|
|
@@ -4655,7 +4655,7 @@ function rd({
|
|
|
4655
4655
|
}
|
|
4656
4656
|
) : null,
|
|
4657
4657
|
l.length > 0 ? /* @__PURE__ */ u(
|
|
4658
|
-
|
|
4658
|
+
we,
|
|
4659
4659
|
{
|
|
4660
4660
|
icon: it,
|
|
4661
4661
|
label: a("chartFormatSeries"),
|
|
@@ -4666,7 +4666,7 @@ function rd({
|
|
|
4666
4666
|
) : null
|
|
4667
4667
|
] }) });
|
|
4668
4668
|
}
|
|
4669
|
-
function
|
|
4669
|
+
function bt(e) {
|
|
4670
4670
|
if (e.trim() === "") return null;
|
|
4671
4671
|
const t = Number(e);
|
|
4672
4672
|
return Number.isFinite(t) ? t : void 0;
|
|
@@ -4678,9 +4678,9 @@ function id({
|
|
|
4678
4678
|
onClose: n,
|
|
4679
4679
|
testId: r = "chart"
|
|
4680
4680
|
}) {
|
|
4681
|
-
const { t: i } = te(), [o, a] = B("yAxis"), s = (y) => e[y] ?? {}, [d, c] = B(() => Ir(s("yAxis"))), l = o === "yAxis" || e.kind === "scatter", p =
|
|
4681
|
+
const { t: i } = te(), [o, a] = B("yAxis"), s = (y) => e[y] ?? {}, [d, c] = B(() => Ir(s("yAxis"))), l = o === "yAxis" || e.kind === "scatter", p = bt(d.min), h = bt(d.max), f = bt(d.major), g = l && (p === void 0 || h === void 0 || f === void 0 || f != null && f <= 0 || p != null && h != null && p >= h) || d.numberFormat.length > 255, w = (y) => {
|
|
4682
4682
|
a(y), c(Ir(s(y)));
|
|
4683
|
-
},
|
|
4683
|
+
}, b = () => {
|
|
4684
4684
|
const y = {
|
|
4685
4685
|
numberFormat: d.numberFormat.trim() || null,
|
|
4686
4686
|
hidden: !d.shown
|
|
@@ -4699,7 +4699,7 @@ function id({
|
|
|
4699
4699
|
placeholder: i("chartAxisAuto"),
|
|
4700
4700
|
"aria-invalid": Y,
|
|
4701
4701
|
value: E,
|
|
4702
|
-
onChange: (
|
|
4702
|
+
onChange: (U) => c((V) => ({ ...V, [y]: U.target.value })),
|
|
4703
4703
|
"data-testid": `${r}-axis-${y}`
|
|
4704
4704
|
},
|
|
4705
4705
|
y
|
|
@@ -4719,7 +4719,7 @@ function id({
|
|
|
4719
4719
|
{
|
|
4720
4720
|
variant: "primary",
|
|
4721
4721
|
disabled: g,
|
|
4722
|
-
onClick:
|
|
4722
|
+
onClick: b,
|
|
4723
4723
|
"data-testid": `${r}-axis-ok`,
|
|
4724
4724
|
children: i("chartOk")
|
|
4725
4725
|
}
|
|
@@ -4737,7 +4737,7 @@ function id({
|
|
|
4737
4737
|
["yAxis", i("chartAxisValue")],
|
|
4738
4738
|
["xAxis", i("chartAxisCategory")]
|
|
4739
4739
|
],
|
|
4740
|
-
onChange:
|
|
4740
|
+
onChange: w,
|
|
4741
4741
|
testId: `${r}-axis-which`
|
|
4742
4742
|
}
|
|
4743
4743
|
),
|
|
@@ -4777,8 +4777,8 @@ function od({
|
|
|
4777
4777
|
onClose: r,
|
|
4778
4778
|
testId: i = "chart"
|
|
4779
4779
|
}) {
|
|
4780
|
-
const { t: o } = te(), a = ro(e.kind), s = t.includes("combo") && typeof e.kind == "string" && !["pie", "doughnut", "radar", "scatter"].includes(e.kind), [d, c] = B(0), l = (
|
|
4781
|
-
const m = e.series[
|
|
4780
|
+
const { t: o } = te(), a = ro(e.kind), s = t.includes("combo") && typeof e.kind == "string" && !["pie", "doughnut", "radar", "scatter"].includes(e.kind), [d, c] = B(0), l = (b) => {
|
|
4781
|
+
const m = e.series[b];
|
|
4782
4782
|
return {
|
|
4783
4783
|
lineWidth: yt(m?.lineWidth),
|
|
4784
4784
|
marker: m?.marker ?? "",
|
|
@@ -4786,9 +4786,9 @@ function od({
|
|
|
4786
4786
|
kind: typeof m?.kind == "string" ? m.kind : "",
|
|
4787
4787
|
secondary: m?.secondary ?? !1
|
|
4788
4788
|
};
|
|
4789
|
-
}, [p, h] = B(() => l(0)), f =
|
|
4790
|
-
const
|
|
4791
|
-
t.includes("lineWidth") && (
|
|
4789
|
+
}, [p, h] = B(() => l(0)), f = bt(p.lineWidth), g = f === void 0 || f != null && (f < 0 || f > 100), w = () => {
|
|
4790
|
+
const b = { index: d };
|
|
4791
|
+
t.includes("lineWidth") && (b.lineWidth = f), a && t.includes("marker") && (b.marker = p.marker === "" ? null : p.marker), a && t.includes("smooth") && (b.smooth = p.smooth), s && (b.kind = p.kind === "" ? null : p.kind, b.secondary = p.secondary), n({ seriesFormat: [b] }), r();
|
|
4792
4792
|
};
|
|
4793
4793
|
return /* @__PURE__ */ u(
|
|
4794
4794
|
st,
|
|
@@ -4803,7 +4803,7 @@ function od({
|
|
|
4803
4803
|
{
|
|
4804
4804
|
variant: "primary",
|
|
4805
4805
|
disabled: g,
|
|
4806
|
-
onClick:
|
|
4806
|
+
onClick: w,
|
|
4807
4807
|
"data-testid": `${i}-series-ok`,
|
|
4808
4808
|
children: o("chartOk")
|
|
4809
4809
|
}
|
|
@@ -4817,9 +4817,9 @@ function od({
|
|
|
4817
4817
|
label: o("chartSeries"),
|
|
4818
4818
|
quiet: !0,
|
|
4819
4819
|
value: String(d),
|
|
4820
|
-
choices: e.series.map((
|
|
4821
|
-
onChange: (
|
|
4822
|
-
c(Number(
|
|
4820
|
+
choices: e.series.map((b, m) => [String(m), b.name]),
|
|
4821
|
+
onChange: (b) => {
|
|
4822
|
+
c(Number(b)), h(l(Number(b)));
|
|
4823
4823
|
},
|
|
4824
4824
|
testId: `${i}-series-which`
|
|
4825
4825
|
}
|
|
@@ -4835,7 +4835,7 @@ function od({
|
|
|
4835
4835
|
placeholder: o("chartAxisAuto"),
|
|
4836
4836
|
"aria-invalid": g,
|
|
4837
4837
|
value: p.lineWidth,
|
|
4838
|
-
onChange: (
|
|
4838
|
+
onChange: (b) => h((m) => ({ ...m, lineWidth: b.target.value })),
|
|
4839
4839
|
"data-testid": `${i}-series-width`
|
|
4840
4840
|
},
|
|
4841
4841
|
"w"
|
|
@@ -4851,11 +4851,11 @@ function od({
|
|
|
4851
4851
|
value: p.marker,
|
|
4852
4852
|
choices: [
|
|
4853
4853
|
["", o("chartMarker_auto")],
|
|
4854
|
-
...Qc.filter((
|
|
4855
|
-
(
|
|
4854
|
+
...Qc.filter((b) => b !== "auto").map(
|
|
4855
|
+
(b) => [b, o(`chartMarker_${b}`)]
|
|
4856
4856
|
)
|
|
4857
4857
|
],
|
|
4858
|
-
onChange: (
|
|
4858
|
+
onChange: (b) => h((m) => ({ ...m, marker: b })),
|
|
4859
4859
|
testId: `${i}-series-marker`
|
|
4860
4860
|
},
|
|
4861
4861
|
"m"
|
|
@@ -4871,9 +4871,9 @@ function od({
|
|
|
4871
4871
|
value: p.kind,
|
|
4872
4872
|
choices: [
|
|
4873
4873
|
["", o("chartSeriesTypeChart")],
|
|
4874
|
-
...Xc.map((
|
|
4874
|
+
...Xc.map((b) => [b, o(Pn.find((m) => m.kind === b)?.label ?? b)])
|
|
4875
4875
|
],
|
|
4876
|
-
onChange: (
|
|
4876
|
+
onChange: (b) => h((m) => ({ ...m, kind: b })),
|
|
4877
4877
|
testId: `${i}-series-kind`
|
|
4878
4878
|
},
|
|
4879
4879
|
"k"
|
|
@@ -4884,7 +4884,7 @@ function od({
|
|
|
4884
4884
|
{
|
|
4885
4885
|
label: o("chartSecondaryAxis"),
|
|
4886
4886
|
checked: p.secondary,
|
|
4887
|
-
onChange: (
|
|
4887
|
+
onChange: (b) => h((m) => ({ ...m, secondary: b })),
|
|
4888
4888
|
testId: `${i}-series-secondary`
|
|
4889
4889
|
},
|
|
4890
4890
|
"x"
|
|
@@ -4897,7 +4897,7 @@ function od({
|
|
|
4897
4897
|
{
|
|
4898
4898
|
label: o("chartSmooth"),
|
|
4899
4899
|
checked: p.smooth,
|
|
4900
|
-
onChange: (
|
|
4900
|
+
onChange: (b) => h((m) => ({ ...m, smooth: b })),
|
|
4901
4901
|
testId: `${i}-series-smooth`
|
|
4902
4902
|
},
|
|
4903
4903
|
"s"
|
|
@@ -4919,25 +4919,25 @@ function sd({
|
|
|
4919
4919
|
onClose: n,
|
|
4920
4920
|
testId: r = "chart"
|
|
4921
4921
|
}) {
|
|
4922
|
-
const { t: i } = te(), [o, a] = B(e.categories), [s, d] = B(e.series.map((
|
|
4922
|
+
const { t: i } = te(), [o, a] = B(e.categories), [s, d] = B(e.series.map((w) => w.name)), [c, l] = B(
|
|
4923
4923
|
() => e.series.map(
|
|
4924
|
-
(
|
|
4925
|
-
(
|
|
4924
|
+
(w) => e.categories.map(
|
|
4925
|
+
(b, m) => w.values[m] == null ? "" : String(w.values[m])
|
|
4926
4926
|
)
|
|
4927
4927
|
)
|
|
4928
4928
|
), p = e.kind === "pie" || e.kind === "doughnut", h = c.some(
|
|
4929
|
-
(
|
|
4929
|
+
(w) => w.some((b) => b.trim() !== "" && !Number.isFinite(Number(b)))
|
|
4930
4930
|
), f = () => {
|
|
4931
4931
|
t({
|
|
4932
4932
|
categories: o,
|
|
4933
|
-
series: s.map((
|
|
4934
|
-
name:
|
|
4935
|
-
values: c[
|
|
4933
|
+
series: s.map((w, b) => ({
|
|
4934
|
+
name: w,
|
|
4935
|
+
values: c[b].map((m) => m.trim() === "" ? null : Number(m))
|
|
4936
4936
|
}))
|
|
4937
4937
|
}), n();
|
|
4938
|
-
}, g = (
|
|
4938
|
+
}, g = (w, b, m) => l(
|
|
4939
4939
|
(y) => y.map(
|
|
4940
|
-
(I, N) => N ===
|
|
4940
|
+
(I, N) => N === w ? I.map((E, Y) => Y === b ? m : E) : I
|
|
4941
4941
|
)
|
|
4942
4942
|
);
|
|
4943
4943
|
return /* @__PURE__ */ M(
|
|
@@ -4963,28 +4963,28 @@ function sd({
|
|
|
4963
4963
|
/* @__PURE__ */ u("div", { style: { maxHeight: 360, overflow: "auto" }, children: /* @__PURE__ */ M("table", { className: "kui-chart-data", children: [
|
|
4964
4964
|
/* @__PURE__ */ u("thead", { children: /* @__PURE__ */ M("tr", { children: [
|
|
4965
4965
|
/* @__PURE__ */ u("th", {}),
|
|
4966
|
-
s.map((
|
|
4966
|
+
s.map((w, b) => /* @__PURE__ */ u("th", { children: /* @__PURE__ */ u(
|
|
4967
4967
|
"input",
|
|
4968
4968
|
{
|
|
4969
|
-
"aria-label": i("chartSeriesName", { n:
|
|
4970
|
-
value:
|
|
4969
|
+
"aria-label": i("chartSeriesName", { n: b + 1 }),
|
|
4970
|
+
value: w,
|
|
4971
4971
|
onChange: (m) => d(
|
|
4972
|
-
(y) => y.map((I, N) => N ===
|
|
4972
|
+
(y) => y.map((I, N) => N === b ? m.target.value : I)
|
|
4973
4973
|
),
|
|
4974
|
-
"data-testid": `${r}-data-series-${
|
|
4974
|
+
"data-testid": `${r}-data-series-${b}`
|
|
4975
4975
|
}
|
|
4976
|
-
) },
|
|
4976
|
+
) }, b))
|
|
4977
4977
|
] }) }),
|
|
4978
|
-
/* @__PURE__ */ u("tbody", { children: o.map((
|
|
4978
|
+
/* @__PURE__ */ u("tbody", { children: o.map((w, b) => /* @__PURE__ */ M("tr", { children: [
|
|
4979
4979
|
/* @__PURE__ */ u("th", { children: /* @__PURE__ */ u(
|
|
4980
4980
|
"input",
|
|
4981
4981
|
{
|
|
4982
|
-
"aria-label": i("chartCategoryName", { n:
|
|
4983
|
-
value:
|
|
4982
|
+
"aria-label": i("chartCategoryName", { n: b + 1 }),
|
|
4983
|
+
value: w,
|
|
4984
4984
|
onChange: (m) => a(
|
|
4985
|
-
(y) => y.map((I, N) => N ===
|
|
4985
|
+
(y) => y.map((I, N) => N === b ? m.target.value : I)
|
|
4986
4986
|
),
|
|
4987
|
-
"data-testid": `${r}-data-category-${
|
|
4987
|
+
"data-testid": `${r}-data-category-${b}`
|
|
4988
4988
|
}
|
|
4989
4989
|
) }),
|
|
4990
4990
|
s.map((m, y) => /* @__PURE__ */ u("td", { children: /* @__PURE__ */ u(
|
|
@@ -4993,25 +4993,25 @@ function sd({
|
|
|
4993
4993
|
inputMode: "decimal",
|
|
4994
4994
|
"aria-label": i("chartValue", {
|
|
4995
4995
|
series: s[y],
|
|
4996
|
-
category:
|
|
4996
|
+
category: w
|
|
4997
4997
|
}),
|
|
4998
|
-
"aria-invalid": c[y][
|
|
4999
|
-
value: c[y][
|
|
5000
|
-
onChange: (I) => g(y,
|
|
5001
|
-
"data-testid": `${r}-data-cell-${y}-${
|
|
4998
|
+
"aria-invalid": c[y][b].trim() !== "" && !Number.isFinite(Number(c[y][b])),
|
|
4999
|
+
value: c[y][b],
|
|
5000
|
+
onChange: (I) => g(y, b, I.target.value),
|
|
5001
|
+
"data-testid": `${r}-data-cell-${y}-${b}`
|
|
5002
5002
|
}
|
|
5003
5003
|
) }, y))
|
|
5004
|
-
] },
|
|
5004
|
+
] }, b)) })
|
|
5005
5005
|
] }) }),
|
|
5006
5006
|
/* @__PURE__ */ M("div", { style: { display: "flex", gap: 8, marginTop: 8 }, children: [
|
|
5007
5007
|
/* @__PURE__ */ u(
|
|
5008
5008
|
me,
|
|
5009
5009
|
{
|
|
5010
5010
|
onClick: () => {
|
|
5011
|
-
a((
|
|
5012
|
-
...
|
|
5013
|
-
i("chartCategoryText", { n:
|
|
5014
|
-
]), l((
|
|
5011
|
+
a((w) => [
|
|
5012
|
+
...w,
|
|
5013
|
+
i("chartCategoryText", { n: w.length + 1 })
|
|
5014
|
+
]), l((w) => w.map((b) => [...b, ""]));
|
|
5015
5015
|
},
|
|
5016
5016
|
"data-testid": `${r}-data-add-category`,
|
|
5017
5017
|
children: i("chartAddCategory")
|
|
@@ -5022,10 +5022,10 @@ function sd({
|
|
|
5022
5022
|
{
|
|
5023
5023
|
disabled: p,
|
|
5024
5024
|
onClick: () => {
|
|
5025
|
-
d((
|
|
5026
|
-
...
|
|
5027
|
-
i("chartSeriesText", { n:
|
|
5028
|
-
]), l((
|
|
5025
|
+
d((w) => [
|
|
5026
|
+
...w,
|
|
5027
|
+
i("chartSeriesText", { n: w.length + 1 })
|
|
5028
|
+
]), l((w) => [...w, o.map(() => "")]);
|
|
5029
5029
|
},
|
|
5030
5030
|
"data-testid": `${r}-data-add-series`,
|
|
5031
5031
|
children: i("chartAddSeries")
|
|
@@ -5036,7 +5036,7 @@ function sd({
|
|
|
5036
5036
|
{
|
|
5037
5037
|
disabled: o.length <= 1,
|
|
5038
5038
|
onClick: () => {
|
|
5039
|
-
a((
|
|
5039
|
+
a((w) => w.slice(0, -1)), l((w) => w.map((b) => b.slice(0, -1)));
|
|
5040
5040
|
},
|
|
5041
5041
|
"data-testid": `${r}-data-remove-category`,
|
|
5042
5042
|
children: i("chartRemoveCategory")
|
|
@@ -5047,7 +5047,7 @@ function sd({
|
|
|
5047
5047
|
{
|
|
5048
5048
|
disabled: s.length <= 1,
|
|
5049
5049
|
onClick: () => {
|
|
5050
|
-
d((
|
|
5050
|
+
d((w) => w.slice(0, -1)), l((w) => w.slice(0, -1));
|
|
5051
5051
|
},
|
|
5052
5052
|
"data-testid": `${r}-data-remove-series`,
|
|
5053
5053
|
children: i("chartRemoveSeries")
|
|
@@ -5060,10 +5060,10 @@ function sd({
|
|
|
5060
5060
|
}
|
|
5061
5061
|
const ld = 4e3;
|
|
5062
5062
|
function cd({ tool: e, onExit: t }) {
|
|
5063
|
-
const n = te(), r = Xe(), i =
|
|
5063
|
+
const n = te(), r = Xe(), i = be(), { undo: o } = Nn(), { host: a, t: s, testId: d, phrase: c } = n, l = r?.tools.find((b) => b.id === r.active), p = e ?? (l ? { label: c(l.label), icon: zi(l.icon, l.id) } : null), h = i.state("action:agent"), f = p?.icon, [g, w] = B(!0);
|
|
5064
5064
|
return J(() => {
|
|
5065
|
-
const
|
|
5066
|
-
return () => clearTimeout(
|
|
5065
|
+
const b = setTimeout(() => w(!1), ld);
|
|
5066
|
+
return () => clearTimeout(b);
|
|
5067
5067
|
}, []), /* @__PURE__ */ M("div", { className: "kui-focus-bar", role: "toolbar", "aria-label": s("focusBar"), "data-fresh": g || void 0, "data-testid": `${d}-focus-bar`, children: [
|
|
5068
5068
|
/* @__PURE__ */ M(me, { variant: "ghost", className: "kui-focus-exit", title: `${s("exitFocus")} (Esc)`, onClick: t, "data-testid": `${d}-focus-exit`, "data-kit-ui-id": "action:mode", children: [
|
|
5069
5069
|
/* @__PURE__ */ u(zs, { size: 16, strokeWidth: $e, "aria-hidden": "true" }),
|
|
@@ -5114,7 +5114,7 @@ function hd(e, t, n = () => !1) {
|
|
|
5114
5114
|
return r.map((i) => ({ label: i, children: io(e.filter((o) => o.path[0] === i), 1, t, n) })).filter((i) => i.children.length > 0 || n(i.label));
|
|
5115
5115
|
}
|
|
5116
5116
|
function fd({ row: e, checked: t, onKitCommand: n }) {
|
|
5117
|
-
const { phrase: r, testId: i } = te(), o =
|
|
5117
|
+
const { phrase: r, testId: i } = te(), o = be(), a = Ft(e.command);
|
|
5118
5118
|
o.declared;
|
|
5119
5119
|
const s = o.state(a, e.path);
|
|
5120
5120
|
return /* @__PURE__ */ u(le, { label: r(e.label), shortcut: e.shortcut, disabled: s.disabled, checked: t, onSelect: () => !s.denied && n?.(e.command), testId: `${i}-${a.replace(":", "-")}`, uiId: a });
|
|
@@ -5124,7 +5124,7 @@ function oo({ nodes: e, checked: t, onKitCommand: n, onCommand: r }) {
|
|
|
5124
5124
|
return /* @__PURE__ */ u(Ce, { children: e.map((o, a) => {
|
|
5125
5125
|
if (o.kind === "separator") return /* @__PURE__ */ u(Ae, {}, `---${a}`);
|
|
5126
5126
|
if (o.kind === "submenu")
|
|
5127
|
-
return /* @__PURE__ */ u(
|
|
5127
|
+
return /* @__PURE__ */ u(wc, { label: o.label, path: o.path, children: /* @__PURE__ */ u(oo, { nodes: o.children, checked: t, onKitCommand: n, onCommand: r }) }, `menu:${o.path}`);
|
|
5128
5128
|
const { row: s } = o, d = `${s.command}@${a}`;
|
|
5129
5129
|
return s.command.startsWith(Ke) ? /* @__PURE__ */ u(fd, { row: s, checked: t?.(s.command), onKitCommand: n }, d) : /* @__PURE__ */ u(cc, { command: s.command, path: s.path, label: i(s.label), shortcut: s.shortcut ?? void 0, checked: t?.(s.command), onRun: r }, d);
|
|
5130
5130
|
}) });
|
|
@@ -5137,7 +5137,7 @@ function md({ tree: e, nodes: t }) {
|
|
|
5137
5137
|
] });
|
|
5138
5138
|
}
|
|
5139
5139
|
function pd(e) {
|
|
5140
|
-
const { byId: t } = te(), { config: n, sessionHidden: r } =
|
|
5140
|
+
const { byId: t } = te(), { config: n, sessionHidden: r } = be(), i = R(/* @__PURE__ */ new WeakMap());
|
|
5141
5141
|
return pe(() => {
|
|
5142
5142
|
const o = /* @__PURE__ */ new Map(), a = (s) => Li(n, `menu:${s}`).length > 0 && !Se(n, `menu:${s}`).hidden;
|
|
5143
5143
|
for (const s of e) {
|
|
@@ -5159,11 +5159,11 @@ function pd(e) {
|
|
|
5159
5159
|
}
|
|
5160
5160
|
const Ze = (e) => e.flatMap((t) => t.kind === "row" ? [t.row] : t.kind === "submenu" ? Ze(t.children) : []), gd = 5;
|
|
5161
5161
|
function Mr({ row: e, tree: t, primary: n }) {
|
|
5162
|
-
const r = te(), i =
|
|
5162
|
+
const r = te(), i = be(), { byId: o, phrase: a, testId: s } = r, d = a(e.label);
|
|
5163
5163
|
if (e.command.startsWith(Ke)) {
|
|
5164
5164
|
const h = Ft(e.command), f = i.state(h, e.path), g = Ge({ id: e.command.slice(Ke.length), title: e.label });
|
|
5165
5165
|
return /* @__PURE__ */ u(
|
|
5166
|
-
|
|
5166
|
+
we,
|
|
5167
5167
|
{
|
|
5168
5168
|
icon: g,
|
|
5169
5169
|
lineLabel: g === at,
|
|
@@ -5179,7 +5179,7 @@ function Mr({ row: e, tree: t, primary: n }) {
|
|
|
5179
5179
|
}
|
|
5180
5180
|
const c = o.get(e.command), l = i.state(`command:${e.command}`, e.path), p = Ge(c ?? { id: e.command, title: e.label });
|
|
5181
5181
|
return /* @__PURE__ */ u(
|
|
5182
|
-
|
|
5182
|
+
we,
|
|
5183
5183
|
{
|
|
5184
5184
|
icon: p,
|
|
5185
5185
|
lineLabel: p === at,
|
|
@@ -5195,9 +5195,9 @@ function Mr({ row: e, tree: t, primary: n }) {
|
|
|
5195
5195
|
}
|
|
5196
5196
|
);
|
|
5197
5197
|
}
|
|
5198
|
-
function
|
|
5198
|
+
function wd({ tab: e, nodes: t }) {
|
|
5199
5199
|
const { byId: n, phrase: r } = te(), i = Nn(), o = /* @__PURE__ */ new Set([...i.undo.hidden ? [] : ["edit.undo"], ...i.redo.hidden ? [] : ["edit.redo"]]), a = (f) => f.filter((g) => !o.has(g.command)), s = (f) => {
|
|
5200
|
-
const g = f.find((
|
|
5200
|
+
const g = f.find((w) => w.command !== "---");
|
|
5201
5201
|
return g ? Ge(n.get(g.command) ?? { id: g.command.replace(Ke, ""), title: g.label }) : void 0;
|
|
5202
5202
|
}, d = e.menu;
|
|
5203
5203
|
if (!d) return null;
|
|
@@ -5206,16 +5206,16 @@ function bd({ tab: e, nodes: t }) {
|
|
|
5206
5206
|
c.length || d.before?.length ? /* @__PURE__ */ u(Me, { id: `menu:${e.id}`, label: e.label, icon: s(c), children: /* @__PURE__ */ M("div", { className: "kui-command-grid", children: [
|
|
5207
5207
|
d.before?.map((f) => {
|
|
5208
5208
|
const g = f.icon ?? Ge({ id: f.testId ?? f.label, title: f.label });
|
|
5209
|
-
return /* @__PURE__ */ u(
|
|
5209
|
+
return /* @__PURE__ */ u(we, { icon: g, lineLabel: !f.icon && g === at, primary: f.primary, label: f.label, onClick: f.onSelect, "data-testid": f.testId }, f.label);
|
|
5210
5210
|
}),
|
|
5211
5211
|
c.map((f, g) => /* @__PURE__ */ u(Mr, { row: f, tree: d, primary: h(f) }, `${f.command}@${g}`))
|
|
5212
5212
|
] }) }) : null,
|
|
5213
|
-
l.map((f) => /* @__PURE__ */ u(Me, { id: `menu:${f.path}`, label: r(f.label), icon: s(a(Ze(f.children))), children: /* @__PURE__ */ u("div", { className: "kui-command-grid", children: a(Ze(f.children)).map((g,
|
|
5213
|
+
l.map((f) => /* @__PURE__ */ u(Me, { id: `menu:${f.path}`, label: r(f.label), icon: s(a(Ze(f.children))), children: /* @__PURE__ */ u("div", { className: "kui-command-grid", children: a(Ze(f.children)).map((g, w) => /* @__PURE__ */ u(Mr, { row: g, tree: d, primary: h(g) }, `${g.command}@${w}`)) }) }, f.path))
|
|
5214
5214
|
] });
|
|
5215
5215
|
}
|
|
5216
5216
|
const Tr = { menus: Bs, line: Mi, classic: yi, focus: Ai }, Ar = () => Nt() ? "Cmd+\\" : "Ctrl+\\";
|
|
5217
|
-
function
|
|
5218
|
-
const { t: r, testId: i } = te(), a =
|
|
5217
|
+
function bd({ display: e, shown: t, areas: n = !0 }) {
|
|
5218
|
+
const { t: r, testId: i } = te(), a = be().state("action:mode");
|
|
5219
5219
|
if (a.hidden || e.allowed.length < 2) return null;
|
|
5220
5220
|
if (!n) {
|
|
5221
5221
|
const l = `${r("mode_focus")} (${Ar()})`;
|
|
@@ -5273,13 +5273,13 @@ function Fu(e, { order: t, exclude: n = [], ...r }) {
|
|
|
5273
5273
|
return vd(kd(e, t, n), r);
|
|
5274
5274
|
}
|
|
5275
5275
|
function Sd(e, t = !0) {
|
|
5276
|
-
const { modes: n } = He(e.ui.subscribe, e.ui.get), r = e.kit.id, [i, o] = B(() => Hs(r)), [a, s] = B(() => n.default === "focus"), d = Ri(n), c = t ? d : d.filter((g) => g === "menus" || g === "focus"), l = t ?
|
|
5276
|
+
const { modes: n } = He(e.ui.subscribe, e.ui.get), r = e.kit.id, [i, o] = B(() => Hs(r)), [a, s] = B(() => n.default === "focus"), d = Ri(n), c = t ? d : d.filter((g) => g === "menus" || g === "focus"), l = t ? qs({ stored: i, rules: n, kit: e.display, readOnly: e.readOnly === !0 }) : "menus", p = H(
|
|
5277
5277
|
(g) => {
|
|
5278
5278
|
if (g === "focus") {
|
|
5279
5279
|
s(!0);
|
|
5280
5280
|
return;
|
|
5281
5281
|
}
|
|
5282
|
-
|
|
5282
|
+
Us(r, g), o(g), s(!1);
|
|
5283
5283
|
},
|
|
5284
5284
|
[r]
|
|
5285
5285
|
), h = H(() => s((g) => !g), []), f = H(() => s(!1), []);
|
|
@@ -5300,14 +5300,14 @@ function Cd(e, t, n, r) {
|
|
|
5300
5300
|
(l, p) => {
|
|
5301
5301
|
const h = e.current;
|
|
5302
5302
|
if (!p || !h || typeof ResizeObserver > "u") return;
|
|
5303
|
-
const f = h.getBoundingClientRect().width, g = p.scrollWidth - p.clientWidth,
|
|
5304
|
-
s((
|
|
5305
|
-
const m =
|
|
5303
|
+
const f = h.getBoundingClientRect().width, g = p.scrollWidth - p.clientWidth, w = `${l}:${n}`;
|
|
5304
|
+
s((b) => {
|
|
5305
|
+
const m = b.get(w);
|
|
5306
5306
|
if (g > 1) {
|
|
5307
5307
|
const y = Math.ceil(f + g);
|
|
5308
|
-
return m !== void 0 && Math.abs(m - y) <= 1 ?
|
|
5308
|
+
return m !== void 0 && Math.abs(m - y) <= 1 ? b : new Map(b).set(w, y);
|
|
5309
5309
|
}
|
|
5310
|
-
return m === void 0 || m <= f ?
|
|
5310
|
+
return m === void 0 || m <= f ? b : new Map(b).set(w, Math.floor(f));
|
|
5311
5311
|
});
|
|
5312
5312
|
},
|
|
5313
5313
|
[e, n]
|
|
@@ -5356,7 +5356,7 @@ function Td({ tabs: e, active: t, onTab: n }) {
|
|
|
5356
5356
|
const p = (f) => `${f.id}
|
|
5357
5357
|
${f.label}`;
|
|
5358
5358
|
for (const f of l.querySelectorAll(".kui-ribbon-tab")) {
|
|
5359
|
-
const g = e.find((
|
|
5359
|
+
const g = e.find((w) => w.id === f.dataset.tab);
|
|
5360
5360
|
g && !f.hidden && o.current.set(p(g), f.offsetWidth);
|
|
5361
5361
|
}
|
|
5362
5362
|
const h = e.every((f) => o.current.has(p(f))) ? Md(
|
|
@@ -5389,7 +5389,7 @@ function Ad(e, t) {
|
|
|
5389
5389
|
return e === null || t === null ? e === t : e.size === t.size && [...e].every((n) => t.has(n));
|
|
5390
5390
|
}
|
|
5391
5391
|
function Ed({ tab: e }) {
|
|
5392
|
-
const [t, n] = B(!1), r = R(null), i =
|
|
5392
|
+
const [t, n] = B(!1), r = R(null), i = be(), { t: o } = te(), a = i.state(Ye(e));
|
|
5393
5393
|
return /* @__PURE__ */ M("span", { ref: r, style: { display: "inline-flex" }, children: [
|
|
5394
5394
|
/* @__PURE__ */ u("button", { type: "button", className: "kui-menu-bar-item", "aria-expanded": t, "aria-haspopup": "dialog", onClick: () => n((s) => !s), "data-testid": `ribbon-tab-${e.id}`, "data-kit-ui-id": Ye(e), children: e.label }),
|
|
5395
5395
|
/* @__PURE__ */ u(Eo, { open: t, anchor: r, onClose: () => n(!1), label: e.label, className: "kui-drop-ribbon", testId: `ribbon-drop-${e.id}`, children: /* @__PURE__ */ u(Et, { className: "kui-drop-ribbon-strip", panelClassName: "kui-ribbon-panel", resetKey: e.id, labels: { start: o("ribbonScrollStart"), end: o("ribbonScrollEnd") }, testId: `ribbon-drop-${e.id}-scroll`, children: /* @__PURE__ */ u("fieldset", { className: "kui-element", disabled: a.disabled, children: /* @__PURE__ */ u(vt.Provider, { value: "full", children: e.ribbon }) }) }) })
|
|
@@ -5429,7 +5429,7 @@ function Lr(e) {
|
|
|
5429
5429
|
return Fn(e).reduce((t, n) => t + n.offsetWidth, 0);
|
|
5430
5430
|
}
|
|
5431
5431
|
function Nd({ mode: e, tab: t, nodes: n, panel: r, measure: i }) {
|
|
5432
|
-
const { t: o } = te(), a =
|
|
5432
|
+
const { t: o } = te(), a = be(), s = t.ribbon ?? (t.menu ? /* @__PURE__ */ u(wd, { tab: t, nodes: n }) : null), d = H((y) => o("lineMore", { group: y }), [o]), c = e === "line", l = `${e}:${t.id}`, [p, h] = B({ key: l, level: 0, groups: [], fresh: 0 }), f = p.key === l ? p.level : 0, g = p.key === l ? p.groups : [], w = pe(() => c ? mn : Rd(f, g), [g, f, c]), b = R({ width: 0, content: 0 }), m = R(null);
|
|
5433
5433
|
return Te(() => {
|
|
5434
5434
|
const y = r.current;
|
|
5435
5435
|
if (!c && y) {
|
|
@@ -5438,7 +5438,7 @@ function Nd({ mode: e, tab: t, nodes: n, panel: r, measure: i }) {
|
|
|
5438
5438
|
h((Y) => ({ key: l, level: f + 1, groups: I, fresh: Y.fresh }));
|
|
5439
5439
|
return;
|
|
5440
5440
|
}
|
|
5441
|
-
|
|
5441
|
+
b.current = { width: y.clientWidth, content: Lr(y) };
|
|
5442
5442
|
const E = m.current;
|
|
5443
5443
|
if (E) {
|
|
5444
5444
|
E.disconnect(), E.observe(y);
|
|
@@ -5450,20 +5450,20 @@ function Nd({ mode: e, tab: t, nodes: n, panel: r, measure: i }) {
|
|
|
5450
5450
|
const y = r.current;
|
|
5451
5451
|
if (c || !y || typeof ResizeObserver > "u") return;
|
|
5452
5452
|
const I = new ResizeObserver(() => {
|
|
5453
|
-
const N =
|
|
5453
|
+
const N = b.current;
|
|
5454
5454
|
(y.clientWidth > N.width + 1 || Math.abs(Lr(y) - N.content) > 1) && h((E) => ({ key: l, level: 0, groups: E.groups, fresh: E.fresh + 1 }));
|
|
5455
5455
|
});
|
|
5456
5456
|
return m.current = I, I.observe(y), () => {
|
|
5457
5457
|
I.disconnect(), m.current = null;
|
|
5458
5458
|
};
|
|
5459
|
-
}, [l, c, r]), s ? /* @__PURE__ */ u(Et, { className: c ? "kui-line" : "kui-ribbon-body", panelClassName: c ? "kui-line-panel" : "kui-ribbon-panel", role: "tabpanel", resetKey: t.id, labels: { start: o("ribbonScrollStart"), end: o("ribbonScrollEnd") }, testId: "ribbon-scroll", panelRef: r, children: /* @__PURE__ */ u("fieldset", { className: "kui-element", disabled: a.state(Ye(t)).disabled, children: /* @__PURE__ */ u(Ao.Provider, { value: d, children: /* @__PURE__ */ u(vt.Provider, { value: c ? "line" : "full", children: /* @__PURE__ */ u(Yt.Provider, { value:
|
|
5459
|
+
}, [l, c, r]), s ? /* @__PURE__ */ u(Et, { className: c ? "kui-line" : "kui-ribbon-body", panelClassName: c ? "kui-line-panel" : "kui-ribbon-panel", role: "tabpanel", resetKey: t.id, labels: { start: o("ribbonScrollStart"), end: o("ribbonScrollEnd") }, testId: "ribbon-scroll", panelRef: r, children: /* @__PURE__ */ u("fieldset", { className: "kui-element", disabled: a.state(Ye(t)).disabled, children: /* @__PURE__ */ u(Ao.Provider, { value: d, children: /* @__PURE__ */ u(vt.Provider, { value: c ? "line" : "full", children: /* @__PURE__ */ u(Yt.Provider, { value: w, children: s }) }) }) }) }) : null;
|
|
5460
5460
|
}
|
|
5461
5461
|
function Bu({ tabs: e, tab: t, onTab: n, defaultTab: r, title: i, actions: o, options: a, rail: s, sidebar: d, panels: c, focusTool: l, statusBar: p = !0, children: h, ...f }) {
|
|
5462
|
-
const g = te(), { host:
|
|
5462
|
+
const g = te(), { host: w, phrase: b, testId: m } = g, y = be(), I = R(null), N = R(null), E = w.readOnly === !0, Y = xd(), U = y.config.add, V = pe(() => {
|
|
5463
5463
|
if (!e.some((G) => G.menu)) return e;
|
|
5464
|
-
const P =
|
|
5465
|
-
return P.length ? [...e, ...P.map((G) => ({ id: G, label:
|
|
5466
|
-
}, [
|
|
5464
|
+
const P = U.map((G) => G.place).filter((G) => G.startsWith("menu:") && !G.includes("/")).map((G) => G.slice(5)).filter((G, ue, ye) => ye.indexOf(G) === ue && !e.some((Ie) => Ie.id === G));
|
|
5465
|
+
return P.length ? [...e, ...P.map((G) => ({ id: G, label: b(G), menu: { rows: [] } }))] : e;
|
|
5466
|
+
}, [U, b, e]), j = pd(V), D = V.filter((P) => y.state(Ye(P)).hidden || E && !P.view ? !1 : !P.menu || P.ribbon ? !0 : (j.get(P.id)?.length ?? 0) > 0 || (P.menu.before?.length ?? 0) > 0 || y.buttons(`menu:${P.id}`).length > 0), Z = Sd(w, D.length > 0), [Q, fe] = B(r ?? null), ce = t ?? Q, k = D.find((P) => P.id === ce) ?? D.find((P) => P.id === r) ?? D.find((P) => P.id.toLowerCase() !== "file") ?? D[0] ?? null, O = k?.id ?? null, q = H(
|
|
5467
5467
|
(P) => {
|
|
5468
5468
|
fe(P), n?.(P);
|
|
5469
5469
|
},
|
|
@@ -5483,11 +5483,11 @@ function Bu({ tabs: e, tab: t, onTab: n, defaultTab: r, title: i, actions: o, op
|
|
|
5483
5483
|
const ne = T ? /* @__PURE__ */ u(cd, { tool: l, onExit: Z.exitFocus }) : /* @__PURE__ */ M(Ce, { children: [
|
|
5484
5484
|
/* @__PURE__ */ M("div", { className: "kui-frame-top", "data-testid": `${m}-top-bar`, children: [
|
|
5485
5485
|
i ? /* @__PURE__ */ u("div", { className: "kui-frame-title", children: i }) : null,
|
|
5486
|
-
C === "menus" ? /* @__PURE__ */ u(Od, { tabs: D, menus: j }) : /* @__PURE__ */ u(Td, { tabs: D, active: O, onTab:
|
|
5487
|
-
/* @__PURE__ */ u("div", { className: "kui-ribbon-end", children: /* @__PURE__ */ u(fc, { before: o, mode: /* @__PURE__ */ u(
|
|
5486
|
+
C === "menus" ? /* @__PURE__ */ u(Od, { tabs: D, menus: j }) : /* @__PURE__ */ u(Td, { tabs: D, active: O, onTab: q }),
|
|
5487
|
+
/* @__PURE__ */ u("div", { className: "kui-ribbon-end", children: /* @__PURE__ */ u(fc, { before: o, mode: /* @__PURE__ */ u(bd, { display: Z, shown: C, areas: D.length > 0 }) }) })
|
|
5488
5488
|
] }),
|
|
5489
5489
|
(C === "line" || C === "classic") && k ? /* @__PURE__ */ u(Nd, { mode: C, tab: k, nodes: j.get(k.id) ?? [], panel: N, measure: x.measure }) : null,
|
|
5490
|
-
a ? /* @__PURE__ */ u(
|
|
5490
|
+
a ? /* @__PURE__ */ u(bc, { children: a }) : null
|
|
5491
5491
|
] });
|
|
5492
5492
|
return /* @__PURE__ */ u(ao.Provider, { value: C, children: /* @__PURE__ */ u(so.Provider, { value: Z, children: /* @__PURE__ */ u(pc, { ...f, statusBar: p && !T, top: ne, frame: { ref: I, mode: C, chosen: Z.chosen, touch: Y, viewOnly: E, keyDown: W, escape: _ }, children: /* @__PURE__ */ M("div", { className: "kui-frame-body", children: [
|
|
5493
5493
|
s && !E && !T ? s : null,
|
|
@@ -5682,31 +5682,31 @@ const Hd = /* @__PURE__ */ new Set(["Delete", "Backspace"]), Fr = /* @__PURE__ *
|
|
|
5682
5682
|
function Ku(e, t, n, r) {
|
|
5683
5683
|
const [i, o] = B([]), [a, s] = B(r.initial), [d, c] = B(() => Kd), [l, p] = B(null), [h, f] = B(null), g = R(r);
|
|
5684
5684
|
g.current = r;
|
|
5685
|
-
const
|
|
5686
|
-
|
|
5687
|
-
const
|
|
5688
|
-
let
|
|
5689
|
-
d(a) && (
|
|
5690
|
-
const V = r.hostTools?.[
|
|
5691
|
-
N.current =
|
|
5685
|
+
const w = R(d);
|
|
5686
|
+
w.current = d;
|
|
5687
|
+
const b = R(0), m = R(null), [y, I] = B(0), N = R(r.initial), E = R(null), Y = Object.keys(r.hostTools ?? {}).find((v) => r.hostTools?.[v] === Re) ?? Re.id;
|
|
5688
|
+
let U = a;
|
|
5689
|
+
d(a) && (U = i.find((v) => !r.hidden?.has(v.id) && !d(v.id))?.id ?? Y, i.length && U !== a && s(U));
|
|
5690
|
+
const V = r.hostTools?.[U] ?? (U === Re.id && !i.some((v) => v.id === U) ? Re : void 0);
|
|
5691
|
+
N.current = U;
|
|
5692
5692
|
const j = R(/* @__PURE__ */ new Set());
|
|
5693
5693
|
j.current = new Set(Object.keys(r.hostTools ?? {})), i.some((v) => v.id === Re.id) || j.current.add(Re.id);
|
|
5694
5694
|
const D = H((v) => {
|
|
5695
|
-
if (
|
|
5696
|
-
const z = ++
|
|
5695
|
+
if (w.current(v)) return;
|
|
5696
|
+
const z = ++b.current;
|
|
5697
5697
|
m.current = z, N.current = v, I(z), s(v);
|
|
5698
|
-
}, []), Z = H((v) => c(() => v), []), Q = R(1), fe = R(null), ce = R(!1), k = R([]), O = R(null),
|
|
5698
|
+
}, []), Z = H((v) => c(() => v), []), Q = R(1), fe = R(null), ce = R(!1), k = R([]), O = R(null), q = H((v, z) => {
|
|
5699
5699
|
if (!v) return;
|
|
5700
5700
|
O.current = v, p(v);
|
|
5701
5701
|
let S = null;
|
|
5702
5702
|
for (const $ of v.requests)
|
|
5703
|
-
$.kind === "switchTool" ? (m.current === null || z === m.current) && !
|
|
5704
|
-
S !== null && S !== N.current && (N.current = S, E.current = { id: S, serial:
|
|
5703
|
+
$.kind === "switchTool" ? (m.current === null || z === m.current) && !w.current($.id) && (S = $.id) : $.kind === "status" ? f($.text) : g.current.onDialog?.($.name, $.params);
|
|
5704
|
+
S !== null && S !== N.current && (N.current = S, E.current = { id: S, serial: b.current }, j.current.has(S) || k.current.unshift({ name: "selectTool", args: [S, Q.current], settled: !0, coalesce: !1, selection: z }), s(S));
|
|
5705
5705
|
}, []), x = R(!1), C = R(null), W = H((v, z) => {
|
|
5706
5706
|
const S = document.activeElement ?? document.body;
|
|
5707
5707
|
x.current = !0, C.current = 0;
|
|
5708
5708
|
try {
|
|
5709
|
-
S.dispatchEvent(new KeyboardEvent("keydown", { key: v, code:
|
|
5709
|
+
S.dispatchEvent(new KeyboardEvent("keydown", { key: v, code: Ud(v), shiftKey: z, bubbles: !0, cancelable: !0 }));
|
|
5710
5710
|
} finally {
|
|
5711
5711
|
x.current = !1, C.current = null;
|
|
5712
5712
|
}
|
|
@@ -5722,22 +5722,22 @@ function Ku(e, t, n, r) {
|
|
|
5722
5722
|
continue;
|
|
5723
5723
|
}
|
|
5724
5724
|
if ("key" in v) {
|
|
5725
|
-
v.key.length > 1 ? W(v.key, v.shift) : O.current?.wantsText ?
|
|
5725
|
+
v.key.length > 1 ? W(v.key, v.shift) : O.current?.wantsText ? q(await e("toolText", [v.key, Q.current], !0).catch(() => null)) : g.current.onDeferredKey ? g.current.onDeferredKey(v.key, v.shift) : W(v.key, v.shift);
|
|
5726
5726
|
continue;
|
|
5727
5727
|
}
|
|
5728
|
-
|
|
5728
|
+
q(await e(v.name, v.args, v.settled).catch(() => null), v.selection), v.selection === m.current && (m.current = null);
|
|
5729
5729
|
}
|
|
5730
5730
|
} finally {
|
|
5731
5731
|
ce.current = !1;
|
|
5732
5732
|
}
|
|
5733
5733
|
}
|
|
5734
|
-
}, [
|
|
5734
|
+
}, [q, W, e]), K = H((v, z, S, $ = !1, F) => {
|
|
5735
5735
|
const X = k.current[k.current.length - 1];
|
|
5736
5736
|
$ && C.current === null && X && "name" in X && X.coalesce && X.name === v ? k.current[k.current.length - 1] = { name: v, args: z, settled: S, coalesce: $, selection: F } : _({ name: v, args: z, settled: S, coalesce: $, selection: F }), T();
|
|
5737
5737
|
}, [_, T]), ne = H((v) => !ce.current && !k.current.length ? v() : new Promise((z, S) => {
|
|
5738
5738
|
_({ work: () => v().then(z, S) }), T();
|
|
5739
5739
|
}), [_, T]);
|
|
5740
|
-
J(() =>
|
|
5740
|
+
J(() => wl(e, ne), [ne, e]), J(() => {
|
|
5741
5741
|
t && e("tools").then((v) => o(v ?? []));
|
|
5742
5742
|
}, [t, e]);
|
|
5743
5743
|
const P = !!V;
|
|
@@ -5748,8 +5748,8 @@ function Ku(e, t, n, r) {
|
|
|
5748
5748
|
}
|
|
5749
5749
|
if (P) return;
|
|
5750
5750
|
const v = E.current;
|
|
5751
|
-
E.current = null, !(v?.id ===
|
|
5752
|
-
}, [
|
|
5751
|
+
E.current = null, !(v?.id === U && v.serial === y) && K("selectTool", [U, Q.current], !0, !1, y);
|
|
5752
|
+
}, [U, P, t, y, K]), J(() => {
|
|
5753
5753
|
if (!t || P) return;
|
|
5754
5754
|
const v = fe.current ?? { x: 0, y: 0 };
|
|
5755
5755
|
K("toolState", [v.x, v.y, "{}", Q.current], !1, !0);
|
|
@@ -5757,7 +5757,7 @@ function Ku(e, t, n, r) {
|
|
|
5757
5757
|
const G = H((v, z, S, $, F = !1) => {
|
|
5758
5758
|
Q.current = S, fe.current = { x: z.x, y: z.y }, K("pointer", [JSON.stringify({ action: v, x: z.x, y: z.y, mods: Gt(z), pressure: z.pressure, zoom: S })], $, F);
|
|
5759
5759
|
}, [K]), ue = pe(() => V ?? {
|
|
5760
|
-
id:
|
|
5760
|
+
id: U,
|
|
5761
5761
|
cursor: l?.cursor || "default",
|
|
5762
5762
|
begin: (v, { viewport: z }) => (G("down", v, z.view.zoom, !1), {
|
|
5763
5763
|
move: (S, $) => G("drag", S, $.viewport.view.zoom, !1, !0),
|
|
@@ -5768,7 +5768,7 @@ function Ku(e, t, n, r) {
|
|
|
5768
5768
|
}),
|
|
5769
5769
|
hover: (v, { viewport: z }) => G("move", v, z.view.zoom, !1, !0),
|
|
5770
5770
|
doubleClick: (v, { viewport: z }) => G("doubleClick", v, z.view.zoom, !0)
|
|
5771
|
-
}, [
|
|
5771
|
+
}, [U, V, G, l?.cursor, K]), ye = l?.overlays, { overlayStyle: Ie, drawOverlay: Ne } = r, We = qd(), A = pe(() => {
|
|
5772
5772
|
const v = Wd(Ie);
|
|
5773
5773
|
return We && !Ie?.accent ? { ...v, accent: We } : v;
|
|
5774
5774
|
}, [We, Ie]), L = pe(
|
|
@@ -5791,9 +5791,9 @@ function Ku(e, t, n, r) {
|
|
|
5791
5791
|
}, [V, T, K]), ie = H((v, z) => {
|
|
5792
5792
|
const S = (z ? `Shift+${v}` : v).toLowerCase(), F = i.filter((ee) => !g.current.hidden?.has(ee.id)).filter((ee) => ee.shortcut?.toLowerCase() === S);
|
|
5793
5793
|
if (!F.length) return null;
|
|
5794
|
-
const X = F.findIndex((ee) => ee.id ===
|
|
5794
|
+
const X = F.findIndex((ee) => ee.id === U);
|
|
5795
5795
|
return F[(X + 1) % F.length].id;
|
|
5796
|
-
}, [
|
|
5796
|
+
}, [U, i]), ae = H(() => {
|
|
5797
5797
|
if (P) return;
|
|
5798
5798
|
const v = fe.current ?? { x: 0, y: 0 };
|
|
5799
5799
|
K("toolState", [v.x, v.y, "{}", Q.current], !1, !0);
|
|
@@ -5806,7 +5806,7 @@ function Ku(e, t, n, r) {
|
|
|
5806
5806
|
}, [K]);
|
|
5807
5807
|
return {
|
|
5808
5808
|
tools: i,
|
|
5809
|
-
active:
|
|
5809
|
+
active: U,
|
|
5810
5810
|
select: D,
|
|
5811
5811
|
setDenied: Z,
|
|
5812
5812
|
refresh: ae,
|
|
@@ -5820,13 +5820,13 @@ function Ku(e, t, n, r) {
|
|
|
5820
5820
|
toolForKey: ie
|
|
5821
5821
|
};
|
|
5822
5822
|
}
|
|
5823
|
-
function
|
|
5823
|
+
function Ud(e) {
|
|
5824
5824
|
if (/^[a-z]$/i.test(e)) return `Key${e.toUpperCase()}`;
|
|
5825
5825
|
if (/^[0-9]$/.test(e)) return `Digit${e}`;
|
|
5826
5826
|
const t = { ".": "Period", ",": "Comma", "/": "Slash", ";": "Semicolon", "'": "Quote", "[": "BracketLeft", "]": "BracketRight", "-": "Minus", "=": "Equal", "`": "Backquote", "\\": "Backslash", " ": "Space" };
|
|
5827
5827
|
return e === "Delete" || e === "Backspace" ? e : t[e] ?? "";
|
|
5828
5828
|
}
|
|
5829
|
-
function
|
|
5829
|
+
function qd() {
|
|
5830
5830
|
const e = () => typeof document > "u" ? null : getComputedStyle(document.documentElement).getPropertyValue("--kit-primary").trim() || null, [t, n] = B(e);
|
|
5831
5831
|
return J(() => {
|
|
5832
5832
|
if (typeof MutationObserver > "u") return;
|
|
@@ -5866,7 +5866,7 @@ function Gd(e, t) {
|
|
|
5866
5866
|
const n = JSON.stringify(t.map((r) => r.id));
|
|
5867
5867
|
(Wr.get(e) ?? "[]") !== n && (Wr.set(e, n), e.peer.notify("document/conflicts", { conflicts: t }));
|
|
5868
5868
|
}
|
|
5869
|
-
function
|
|
5869
|
+
function Uu(e, t, n) {
|
|
5870
5870
|
J(() => {
|
|
5871
5871
|
if (!t) return;
|
|
5872
5872
|
let r = !1;
|
|
@@ -5887,7 +5887,7 @@ function Vd(e) {
|
|
|
5887
5887
|
let n = zr;
|
|
5888
5888
|
const r = /* @__PURE__ */ new Set();
|
|
5889
5889
|
t && e.peer.on("presence/peers", (c) => {
|
|
5890
|
-
const l =
|
|
5890
|
+
const l = wo(c?.peers);
|
|
5891
5891
|
n = l.length ? l : zr;
|
|
5892
5892
|
for (const p of [...r]) p();
|
|
5893
5893
|
});
|
|
@@ -5902,7 +5902,7 @@ function Vd(e) {
|
|
|
5902
5902
|
subscribe: (c) => (r.add(c), () => r.delete(c)),
|
|
5903
5903
|
set: (c) => {
|
|
5904
5904
|
if (!t) return;
|
|
5905
|
-
const l =
|
|
5905
|
+
const l = bo(c);
|
|
5906
5906
|
if (!l) return;
|
|
5907
5907
|
const p = o + Yd - Date.now();
|
|
5908
5908
|
if (p <= 0 && !s) {
|
|
@@ -5924,7 +5924,7 @@ function Xd(e) {
|
|
|
5924
5924
|
let t = Br.get(e);
|
|
5925
5925
|
return t || Br.set(e, t = Vd(e)), t;
|
|
5926
5926
|
}
|
|
5927
|
-
function
|
|
5927
|
+
function qu(e, t) {
|
|
5928
5928
|
const n = Xd(e), r = He(n.subscribe, n.peers, n.peers), i = t ? JSON.stringify(t) : null;
|
|
5929
5929
|
return J(() => {
|
|
5930
5930
|
i !== null && n.set(JSON.parse(i));
|
|
@@ -6087,8 +6087,8 @@ function Vu(e) {
|
|
|
6087
6087
|
/* @__PURE__ */ u("span", { style: ve.author, children: d(g.author, g.name) }),
|
|
6088
6088
|
/* @__PURE__ */ u("span", { style: ve.muted, children: s(g.created) }),
|
|
6089
6089
|
/* @__PURE__ */ u("span", { style: { flex: 1 } }),
|
|
6090
|
-
h && g.author === r ? /* @__PURE__ */ u(De, { icon: rt, label: t.delete, "data-testid": `${n}-delete`, onClick: (
|
|
6091
|
-
|
|
6090
|
+
h && g.author === r ? /* @__PURE__ */ u(De, { icon: rt, label: t.delete, "data-testid": `${n}-delete`, onClick: (w) => {
|
|
6091
|
+
w.stopPropagation(), e.onDelete(c.id, g.id);
|
|
6092
6092
|
} }) : null
|
|
6093
6093
|
] }),
|
|
6094
6094
|
/* @__PURE__ */ u("div", { style: ve.body, children: g.body })
|
|
@@ -6183,10 +6183,10 @@ export {
|
|
|
6183
6183
|
mh as ColorGrid,
|
|
6184
6184
|
ph as ColorPicker,
|
|
6185
6185
|
gh as ColorWheel,
|
|
6186
|
-
|
|
6186
|
+
wh as Command,
|
|
6187
6187
|
lc as CommandButton,
|
|
6188
6188
|
Ol as CommandDialog,
|
|
6189
|
-
|
|
6189
|
+
bh as CommandEmpty,
|
|
6190
6190
|
yh as CommandGroup,
|
|
6191
6191
|
uc as CommandGroupButtons,
|
|
6192
6192
|
vh as CommandInput,
|
|
@@ -6203,7 +6203,7 @@ export {
|
|
|
6203
6203
|
hn as DEFAULT_OVERLAY_STYLE,
|
|
6204
6204
|
en as DISPLAY_MODES,
|
|
6205
6205
|
to as DRAWING_SHAPES,
|
|
6206
|
-
|
|
6206
|
+
qc as DRAWING_WARPS,
|
|
6207
6207
|
Wc as DRAWING_WEIGHTS,
|
|
6208
6208
|
Th as Dialog,
|
|
6209
6209
|
Ah as Disclosure,
|
|
@@ -6216,12 +6216,12 @@ export {
|
|
|
6216
6216
|
Oh as EyeButton,
|
|
6217
6217
|
Gs as FILE_CHUNK_BYTES,
|
|
6218
6218
|
Rh as Field,
|
|
6219
|
-
|
|
6219
|
+
bl as FileChangedError,
|
|
6220
6220
|
Dh as FloatingPanels,
|
|
6221
6221
|
zu as FrameChrome,
|
|
6222
6222
|
Lh as GradientSlider,
|
|
6223
6223
|
Re as HAND_TOOL,
|
|
6224
|
-
|
|
6224
|
+
wr as HOST_ICONS,
|
|
6225
6225
|
Nh as Hint,
|
|
6226
6226
|
Ph as Histogram,
|
|
6227
6227
|
zt as HostButtons,
|
|
@@ -6234,7 +6234,7 @@ export {
|
|
|
6234
6234
|
zh as KeyframeLane,
|
|
6235
6235
|
Xl as KitCanvas,
|
|
6236
6236
|
Cu as KitDocumentCanvas,
|
|
6237
|
-
|
|
6237
|
+
bu as KitEditorProvider,
|
|
6238
6238
|
pu as KitElement,
|
|
6239
6239
|
ot as KitEngine,
|
|
6240
6240
|
Ks as LINE_MIN_WIDTH,
|
|
@@ -6242,8 +6242,8 @@ export {
|
|
|
6242
6242
|
_h as LineChart,
|
|
6243
6243
|
Kh as LineMoreLabelContext,
|
|
6244
6244
|
Hh as MenuButton,
|
|
6245
|
-
|
|
6246
|
-
|
|
6245
|
+
Uh as MenuItem,
|
|
6246
|
+
qh as MenuSeparator,
|
|
6247
6247
|
jh as Modal,
|
|
6248
6248
|
Gh as ModalBody,
|
|
6249
6249
|
Yh as ModalClose,
|
|
@@ -6275,8 +6275,8 @@ export {
|
|
|
6275
6275
|
Ll as RESERVED_SHORTCUTS,
|
|
6276
6276
|
gf as RGB_IDENTITY,
|
|
6277
6277
|
Mt as ReadOnlyError,
|
|
6278
|
-
|
|
6279
|
-
|
|
6278
|
+
wf as RenameField,
|
|
6279
|
+
bf as RibbonButton,
|
|
6280
6280
|
yf as RibbonGroup,
|
|
6281
6281
|
vf as RibbonItem,
|
|
6282
6282
|
xe as RibbonMenu,
|
|
@@ -6291,7 +6291,7 @@ export {
|
|
|
6291
6291
|
Af as Spinner,
|
|
6292
6292
|
Ef as StatusBar,
|
|
6293
6293
|
Of as StatusSpacer,
|
|
6294
|
-
|
|
6294
|
+
wc as SubMenu,
|
|
6295
6295
|
Rf as Switch,
|
|
6296
6296
|
Df as TableSizePicker,
|
|
6297
6297
|
lu as TesseraIcons,
|
|
@@ -6308,9 +6308,9 @@ export {
|
|
|
6308
6308
|
_f as TooltipProvider,
|
|
6309
6309
|
Kf as TooltipTrigger,
|
|
6310
6310
|
Hf as TransportBar,
|
|
6311
|
-
|
|
6311
|
+
Uf as WORKSPACE_ACTIONS,
|
|
6312
6312
|
_u as WorkerRelay,
|
|
6313
|
-
|
|
6313
|
+
qf as WorkspaceLayout,
|
|
6314
6314
|
hu as ZOOM_TOOL,
|
|
6315
6315
|
jf as ZoomControl,
|
|
6316
6316
|
Gf as addCurvePoint,
|
|
@@ -6385,8 +6385,8 @@ export {
|
|
|
6385
6385
|
pm as removeKitStore,
|
|
6386
6386
|
Gd as reportConflicts,
|
|
6387
6387
|
gm as resizeFloatingRect,
|
|
6388
|
-
|
|
6389
|
-
|
|
6388
|
+
wm as rgbToHex,
|
|
6389
|
+
bm as sampleCurve,
|
|
6390
6390
|
Mc as scopesCollide,
|
|
6391
6391
|
cr as shortcutMatches,
|
|
6392
6392
|
ym as sliderFraction,
|
|
@@ -6402,7 +6402,7 @@ export {
|
|
|
6402
6402
|
nd as useChartSpec,
|
|
6403
6403
|
Xu as useCommentAnchors,
|
|
6404
6404
|
Im as useConfirm,
|
|
6405
|
-
|
|
6405
|
+
Uu as useConflictReport,
|
|
6406
6406
|
Mm as useDialogFocus,
|
|
6407
6407
|
Tm as useDismissableLayer,
|
|
6408
6408
|
Au as useEngineQuery,
|
|
@@ -6411,18 +6411,18 @@ export {
|
|
|
6411
6411
|
$d as useFrameMode,
|
|
6412
6412
|
Tu as useHostPick,
|
|
6413
6413
|
te as useKitEditor,
|
|
6414
|
-
|
|
6414
|
+
wu as useKitEditorState,
|
|
6415
6415
|
Ou as useKitSession,
|
|
6416
6416
|
Am as useKitStore,
|
|
6417
6417
|
Xe as useKitTools,
|
|
6418
6418
|
Eu as useLease,
|
|
6419
6419
|
Ac as useLeases,
|
|
6420
6420
|
Em as useMediaQuery,
|
|
6421
|
-
|
|
6421
|
+
qu as usePresence,
|
|
6422
6422
|
yu as useReadOnly,
|
|
6423
6423
|
Gu as useRemoteCarets,
|
|
6424
6424
|
ju as useRemoteSelections,
|
|
6425
|
-
|
|
6425
|
+
be as useUi,
|
|
6426
6426
|
Om as useWorkspaces,
|
|
6427
6427
|
jt as viewPanes,
|
|
6428
6428
|
Rm as wheelRadius,
|