@vespercms/admin 0.1.0-next.0 → 0.1.0-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/{BodyEditor-CAGNfofv.js → BodyEditor-_mkh0BSQ.js} +735 -735
- package/dist/{markdown-KUkv11EB.js → markdown-4fVeej3c.js} +14 -14
- package/dist/schedule/times.d.ts +1 -3
- package/dist/screens/EntryList.d.ts +0 -2
- package/dist/screens/status.d.ts +36 -0
- package/dist/{shortcuts-B_JMAvF9.js → shortcuts-CarKeDqp.js} +534 -498
- package/dist/studio.css +1 -1
- package/dist/studio.js +1873 -1736
- package/dist/widgets/blank-date.d.ts +8 -0
- package/package.json +2 -2
- package/src/github/GitHubGate.tsx +47 -10
- package/src/schedule/ScheduleDialog.tsx +3 -0
- package/src/schedule/times.ts +0 -11
- package/src/screens/EntryEditor.tsx +23 -9
- package/src/screens/EntryList.tsx +24 -26
- package/src/screens/ListPane.tsx +48 -30
- package/src/screens/PageTree.tsx +45 -25
- package/src/screens/status.tsx +104 -0
- package/src/studio.css +5 -0
- package/src/widgets/basic.tsx +5 -1
- package/src/widgets/blank-date.ts +32 -0
- package/src/widgets/special.tsx +5 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Component as e, Suspense as t, createContext as n, createElement as r, lazy as i, useCallback as a, useContext as o, useEffect as s, useLayoutEffect as c, useMemo as l, useRef as u, useState as d } from "react";
|
|
2
|
-
import { Button as f, Cell as p, CheckboxButton as m, CheckboxField as h, Collection as g, Column as _, ComboBox as v, Dialog as y, Disclosure as b, DisclosurePanel as x, FieldError as S, FileTrigger as C, Header as w, Heading as T, Input as E, Label as
|
|
2
|
+
import { Button as f, Cell as p, CheckboxButton as m, CheckboxField as h, Collection as g, Column as _, ComboBox as v, Dialog as y, Disclosure as b, DisclosurePanel as x, FieldError as S, FileTrigger as C, Header as w, Heading as T, Input as E, Label as ee, Link as te, ListBox as D, ListBoxItem as O, Menu as ne, MenuItem as k, MenuSection as A, MenuTrigger as re, Modal as j, ModalOverlay as M, Popover as N, RadioButton as P, RadioField as ie, RadioGroup as F, Row as ae, Select as oe, SelectValue as se, Separator as ce, SubmenuTrigger as le, SwitchButton as ue, SwitchField as I, Tab as de, TabList as fe, TabPanel as pe, Table as me, TableBody as he, TableHeader as ge, Tabs as _e, Tag as ve, TagGroup as ye, TagList as be, Text as xe, TextArea as Se, TextField as Ce, ToggleButton as we, Toolbar as Te, Tooltip as Ee, TooltipTrigger as De, Tree as Oe, TreeItem as ke, TreeItemContent as Ae, useDrag as je, useDragAndDrop as Me, useDrop as Ne } from "react-aria-components";
|
|
3
3
|
import { Fragment as L, jsx as R, jsxs as z } from "react/jsx-runtime";
|
|
4
4
|
import { CENTER as Pe, UPLOAD_MAX_BYTES as Fe, UPLOAD_WARN_BYTES as Ie, cropForRatio as Le, dirOf as Re, dragCorner as ze, extensionOf as Be, formatYamlSnippet as Ve, fromWallTime as He, gitBlobSha as Ue, humanize as We, imageValueOf as Ge, isImagePath as Ke, isPlainObject as B, isoWithOffset as qe, mediaReference as Je, moveRect as Ye, offsetOf as Xe, parseYamlSnippet as Ze, ratioLabel as Qe, resizeRect as $e, resolveMediaPath as et, resolveTimeZone as tt, roundFocus as nt, roundRect as rt, siteRatios as it, slugify as at, variantFor as ot, wallTime as st, zoneName as ct } from "@vespercms/core";
|
|
5
5
|
import lt from "dompurify";
|
|
@@ -324,7 +324,7 @@ function V(...e) {
|
|
|
324
324
|
}
|
|
325
325
|
var H = V("outline-none data-[focus-visible]:outline-2 data-[focus-visible]:outline-solid data-[focus-visible]:outline-offset-2 data-[focus-visible]:outline-focus", "data-[focus-visible]:ring-6 data-[focus-visible]:ring-(color:--glow-focus)"), U = "transition-[color,background-color,border-color] duration-120 ease-out", an = V("min-h-10 w-full rounded-md border border-border-strong bg-surface-sunken px-3 py-2 text-body text-content", "outline-none data-[focused]:outline-2 data-[focused]:outline-solid data-[focused]:outline-offset-2 data-[focused]:outline-focus", "data-[focused]:ring-6 data-[focused]:ring-(color:--glow-focus)", "data-[invalid]:border-danger data-[disabled]:opacity-60");
|
|
326
326
|
function on({ label: e, isOptional: t }) {
|
|
327
|
-
return e ? /* @__PURE__ */ z(
|
|
327
|
+
return e ? /* @__PURE__ */ z(ee, {
|
|
328
328
|
className: "block text-label text-content",
|
|
329
329
|
children: [e, t && /* @__PURE__ */ R(sn, {})]
|
|
330
330
|
}) : null;
|
|
@@ -475,7 +475,7 @@ function K({ variant: e = "secondary", className: t, children: n, pulse: r = 0,
|
|
|
475
475
|
});
|
|
476
476
|
}
|
|
477
477
|
function pn({ variant: e = "secondary", className: t, children: n, icon: r, ...i }) {
|
|
478
|
-
return /* @__PURE__ */ z(
|
|
478
|
+
return /* @__PURE__ */ z(te, {
|
|
479
479
|
...i,
|
|
480
480
|
className: V(fn, "no-underline", dn[e], t),
|
|
481
481
|
children: [r && /* @__PURE__ */ R(G, {
|
|
@@ -493,7 +493,7 @@ function mn({ icon: e, label: t, className: n, ...r }) {
|
|
|
493
493
|
});
|
|
494
494
|
}
|
|
495
495
|
function hn({ className: e, variant: t = "inline", icon: n, children: r, ...i }) {
|
|
496
|
-
return /* @__PURE__ */ R(
|
|
496
|
+
return /* @__PURE__ */ R(te, {
|
|
497
497
|
...i,
|
|
498
498
|
className: V("cursor-pointer rounded-sm underline-offset-2", n && "inline-flex items-center gap-1", t === "inline" ? "text-accent underline data-[hovered]:text-accent-hover" : "font-semibold text-content no-underline data-[hovered]:text-accent data-[hovered]:underline", U, H, e),
|
|
499
499
|
children: (e) => /* @__PURE__ */ z(L, { children: [n && /* @__PURE__ */ R(G, {
|
|
@@ -565,12 +565,12 @@ function vn({ label: e, description: t, errorMessage: n, placeholder: r, rows: i
|
|
|
565
565
|
//#region ../ui/src/components/overlays.tsx
|
|
566
566
|
var yn = "scrim fixed inset-0 z-50 data-[entering]:animate-none", bn = "glass-raised shadow-glass-overlay", xn = V("rounded-lg p-1", bn);
|
|
567
567
|
function Sn({ title: e, isOpen: t, onOpenChange: n, children: r, isDismissable: i = !0, role: a = "dialog", size: o = "default" }) {
|
|
568
|
-
return /* @__PURE__ */ R(
|
|
568
|
+
return /* @__PURE__ */ R(M, {
|
|
569
569
|
isOpen: t,
|
|
570
570
|
onOpenChange: n,
|
|
571
571
|
isDismissable: i,
|
|
572
572
|
className: V(yn, "flex items-center justify-center p-4"),
|
|
573
|
-
children: /* @__PURE__ */ R(
|
|
573
|
+
children: /* @__PURE__ */ R(j, {
|
|
574
574
|
className: V("max-h-full w-full overflow-y-auto rounded-lg", bn, o === "wide" ? "max-w-3xl" : "max-w-lg"),
|
|
575
575
|
children: /* @__PURE__ */ R(y, {
|
|
576
576
|
role: a,
|
|
@@ -593,12 +593,12 @@ function Sn({ title: e, isOpen: t, onOpenChange: n, children: r, isDismissable:
|
|
|
593
593
|
});
|
|
594
594
|
}
|
|
595
595
|
function Cn({ title: e, isOpen: t, onOpenChange: n, children: r }) {
|
|
596
|
-
return /* @__PURE__ */ R(
|
|
596
|
+
return /* @__PURE__ */ R(M, {
|
|
597
597
|
isOpen: t,
|
|
598
598
|
onOpenChange: n,
|
|
599
599
|
isDismissable: !0,
|
|
600
600
|
className: yn,
|
|
601
|
-
children: /* @__PURE__ */ R(
|
|
601
|
+
children: /* @__PURE__ */ R(j, {
|
|
602
602
|
className: V("fixed inset-y-0 right-0 flex w-full max-w-drawer flex-col rounded-l-lg", bn),
|
|
603
603
|
children: /* @__PURE__ */ R(y, {
|
|
604
604
|
className: "flex h-full flex-col outline-none",
|
|
@@ -642,7 +642,7 @@ function wn({ text: e, children: t }) {
|
|
|
642
642
|
}
|
|
643
643
|
var Tn = V("flex min-h-9 cursor-default items-center rounded-md px-3 text-body outline-none", "data-[focused]:bg-accent-subtle data-[disabled]:opacity-50", "data-[focus-visible]:outline-2 data-[focus-visible]:outline-solid data-[focus-visible]:-outline-offset-2 data-[focus-visible]:outline-focus"), En = "relative mt-2 before:pointer-events-none before:absolute before:inset-x-2 before:-top-1 before:border-t before:border-border before:content-['']";
|
|
644
644
|
function Dn(e, t, n, r) {
|
|
645
|
-
let i = e.indexOf(t), a = t.isDanger === !0 && i > 0 && !e[i - 1]?.isDanger || n && i === 0, o = t.items, s = /* @__PURE__ */ z(
|
|
645
|
+
let i = e.indexOf(t), a = t.isDanger === !0 && i > 0 && !e[i - 1]?.isDanger || n && i === 0, o = t.items, s = /* @__PURE__ */ z(k, {
|
|
646
646
|
...o ? {} : { id: t.id },
|
|
647
647
|
textValue: t.label,
|
|
648
648
|
className: V(Tn, t.isDanger ? "text-danger" : "text-content", t.isCurrent && "bg-accent-subtle shadow-glow-selected", a && En),
|
|
@@ -666,10 +666,10 @@ function Dn(e, t, n, r) {
|
|
|
666
666
|
t.items && /* @__PURE__ */ R(q, { className: "ml-auto -rotate-90 pl-2" })
|
|
667
667
|
]
|
|
668
668
|
});
|
|
669
|
-
return o ? /* @__PURE__ */ z(
|
|
669
|
+
return o ? /* @__PURE__ */ z(le, { children: [s, /* @__PURE__ */ R(N, {
|
|
670
670
|
offset: -4,
|
|
671
671
|
className: V("max-w-sm min-w-56", xn),
|
|
672
|
-
children: /* @__PURE__ */ R(
|
|
672
|
+
children: /* @__PURE__ */ R(ne, {
|
|
673
673
|
"aria-label": t.label,
|
|
674
674
|
onAction: (e) => {
|
|
675
675
|
r(String(e));
|
|
@@ -696,7 +696,7 @@ function On({ label: e, items: t, onAction: n, triggerText: r, triggerIcon: i, t
|
|
|
696
696
|
id: "items",
|
|
697
697
|
items: t
|
|
698
698
|
}] : []] : [];
|
|
699
|
-
return /* @__PURE__ */ z(
|
|
699
|
+
return /* @__PURE__ */ z(re, {
|
|
700
700
|
...p === void 0 ? {} : { isOpen: p },
|
|
701
701
|
onOpenChange: (e) => {
|
|
702
702
|
y(e), m?.(e);
|
|
@@ -723,14 +723,14 @@ function On({ label: e, items: t, onAction: n, triggerText: r, triggerIcon: i, t
|
|
|
723
723
|
icon: "more",
|
|
724
724
|
label: e
|
|
725
725
|
}))
|
|
726
|
-
}), /* @__PURE__ */ z(
|
|
726
|
+
}), /* @__PURE__ */ z(N, {
|
|
727
727
|
placement: o ? "bottom start" : "bottom end",
|
|
728
728
|
className: V("min-w-56", xn),
|
|
729
729
|
children: [c && /* @__PURE__ */ R("div", {
|
|
730
730
|
"aria-hidden": "true",
|
|
731
731
|
className: "mb-1 border-b border-border px-3 pt-2 pb-3",
|
|
732
732
|
children: c
|
|
733
|
-
}), l ? /* @__PURE__ */ R(
|
|
733
|
+
}), l ? /* @__PURE__ */ R(ne, {
|
|
734
734
|
"aria-label": e,
|
|
735
735
|
onAction: (e) => {
|
|
736
736
|
x(String(e));
|
|
@@ -738,7 +738,7 @@ function On({ label: e, items: t, onAction: n, triggerText: r, triggerIcon: i, t
|
|
|
738
738
|
items: S,
|
|
739
739
|
disabledKeys: t.filter((e) => e.isDisabled).map((e) => e.id),
|
|
740
740
|
className: "outline-none",
|
|
741
|
-
children: (t) => t.id === "choice" ? /* @__PURE__ */ z(
|
|
741
|
+
children: (t) => t.id === "choice" ? /* @__PURE__ */ z(A, {
|
|
742
742
|
id: "choice",
|
|
743
743
|
selectionMode: "single",
|
|
744
744
|
disallowEmptySelection: !0,
|
|
@@ -753,7 +753,7 @@ function On({ label: e, items: t, onAction: n, triggerText: r, triggerIcon: i, t
|
|
|
753
753
|
children: t.choice.title
|
|
754
754
|
}), /* @__PURE__ */ R(g, {
|
|
755
755
|
items: t.choice.options,
|
|
756
|
-
children: (e) => /* @__PURE__ */ R(
|
|
756
|
+
children: (e) => /* @__PURE__ */ R(k, {
|
|
757
757
|
id: e.id,
|
|
758
758
|
textValue: e.label,
|
|
759
759
|
className: V(Tn, "gap-2 text-content"),
|
|
@@ -764,13 +764,13 @@ function On({ label: e, items: t, onAction: n, triggerText: r, triggerIcon: i, t
|
|
|
764
764
|
}), e.label] })
|
|
765
765
|
})
|
|
766
766
|
})]
|
|
767
|
-
}) : /* @__PURE__ */ R(
|
|
767
|
+
}) : /* @__PURE__ */ R(A, {
|
|
768
768
|
id: "items",
|
|
769
769
|
"aria-label": e,
|
|
770
770
|
items: t.items,
|
|
771
771
|
children: (e) => Dn(t.items, e, !0, x)
|
|
772
772
|
})
|
|
773
|
-
}) : /* @__PURE__ */ R(
|
|
773
|
+
}) : /* @__PURE__ */ R(ne, {
|
|
774
774
|
"aria-label": e,
|
|
775
775
|
onAction: (e) => {
|
|
776
776
|
x(String(e));
|
|
@@ -812,7 +812,7 @@ function Mn() {
|
|
|
812
812
|
});
|
|
813
813
|
}
|
|
814
814
|
function Nn({ label: e, description: t, errorMessage: n, options: r, value: i, onChange: a, placeholder: o, className: s, ...c }) {
|
|
815
|
-
return /* @__PURE__ */ z(
|
|
815
|
+
return /* @__PURE__ */ z(oe, {
|
|
816
816
|
...c,
|
|
817
817
|
value: i,
|
|
818
818
|
onChange: (e) => {
|
|
@@ -824,7 +824,7 @@ function Nn({ label: e, description: t, errorMessage: n, options: r, value: i, o
|
|
|
824
824
|
/* @__PURE__ */ R(on, { label: e }),
|
|
825
825
|
/* @__PURE__ */ z(f, {
|
|
826
826
|
className: V(an, "flex items-center justify-between text-left", H),
|
|
827
|
-
children: [/* @__PURE__ */ R(
|
|
827
|
+
children: [/* @__PURE__ */ R(se, {
|
|
828
828
|
className: "truncate data-[placeholder]:text-content-muted",
|
|
829
829
|
children: ({ isPlaceholder: e, selectedText: t, defaultChildren: n }) => e ? n : t
|
|
830
830
|
}), /* @__PURE__ */ R(q, {})]
|
|
@@ -833,12 +833,12 @@ function Nn({ label: e, description: t, errorMessage: n, options: r, value: i, o
|
|
|
833
833
|
description: t,
|
|
834
834
|
errorMessage: n
|
|
835
835
|
}),
|
|
836
|
-
/* @__PURE__ */ R(
|
|
836
|
+
/* @__PURE__ */ R(N, {
|
|
837
837
|
className: jn,
|
|
838
|
-
children: /* @__PURE__ */ R(
|
|
838
|
+
children: /* @__PURE__ */ R(D, {
|
|
839
839
|
className: "max-h-72 overflow-auto outline-none",
|
|
840
840
|
items: r,
|
|
841
|
-
children: (e) => /* @__PURE__ */ z(
|
|
841
|
+
children: (e) => /* @__PURE__ */ z(O, {
|
|
842
842
|
id: e.value,
|
|
843
843
|
textValue: e.label,
|
|
844
844
|
className: An,
|
|
@@ -886,11 +886,11 @@ function Pn({ label: e, description: t, errorMessage: n, options: r, value: i, o
|
|
|
886
886
|
description: t,
|
|
887
887
|
errorMessage: n
|
|
888
888
|
}),
|
|
889
|
-
/* @__PURE__ */ R(
|
|
889
|
+
/* @__PURE__ */ R(N, {
|
|
890
890
|
className: jn,
|
|
891
|
-
children: /* @__PURE__ */ R(
|
|
891
|
+
children: /* @__PURE__ */ R(D, {
|
|
892
892
|
className: "max-h-72 overflow-auto outline-none",
|
|
893
|
-
children: (e) => /* @__PURE__ */ z(
|
|
893
|
+
children: (e) => /* @__PURE__ */ z(O, {
|
|
894
894
|
id: e.value,
|
|
895
895
|
textValue: e.label,
|
|
896
896
|
className: An,
|
|
@@ -942,15 +942,15 @@ function Fn({ label: e, description: t, errorMessage: n, options: r, values: i,
|
|
|
942
942
|
description: t,
|
|
943
943
|
errorMessage: n
|
|
944
944
|
}),
|
|
945
|
-
/* @__PURE__ */ R(
|
|
945
|
+
/* @__PURE__ */ R(N, {
|
|
946
946
|
className: jn,
|
|
947
|
-
children: /* @__PURE__ */ R(
|
|
947
|
+
children: /* @__PURE__ */ R(D, {
|
|
948
948
|
className: "max-h-72 overflow-auto outline-none",
|
|
949
949
|
renderEmptyState: () => /* @__PURE__ */ R("p", {
|
|
950
950
|
className: "px-3 py-2 text-small text-content-muted",
|
|
951
951
|
children: o ? "Press Enter to add it" : "No matches"
|
|
952
952
|
}),
|
|
953
|
-
children: (e) => /* @__PURE__ */ R(
|
|
953
|
+
children: (e) => /* @__PURE__ */ R(O, {
|
|
954
954
|
id: e.value,
|
|
955
955
|
textValue: e.label,
|
|
956
956
|
className: An,
|
|
@@ -1007,10 +1007,10 @@ function Ln({ children: e, className: t, ...n }) {
|
|
|
1007
1007
|
});
|
|
1008
1008
|
}
|
|
1009
1009
|
function Rn({ children: e, className: t, ...n }) {
|
|
1010
|
-
return /* @__PURE__ */ R(
|
|
1010
|
+
return /* @__PURE__ */ R(I, {
|
|
1011
1011
|
...n,
|
|
1012
1012
|
className: t,
|
|
1013
|
-
children: /* @__PURE__ */ z(
|
|
1013
|
+
children: /* @__PURE__ */ z(ue, {
|
|
1014
1014
|
className: "group inline-flex items-center gap-3 text-body text-content",
|
|
1015
1015
|
children: [
|
|
1016
1016
|
/* @__PURE__ */ R("span", {
|
|
@@ -1035,22 +1035,22 @@ function Rn({ children: e, className: t, ...n }) {
|
|
|
1035
1035
|
});
|
|
1036
1036
|
}
|
|
1037
1037
|
function zn({ label: e, description: t, errorMessage: n, options: r, value: i, onChange: a, className: o, orientation: s = "vertical", ...c }) {
|
|
1038
|
-
return /* @__PURE__ */ z(
|
|
1038
|
+
return /* @__PURE__ */ z(F, {
|
|
1039
1039
|
...c,
|
|
1040
1040
|
value: i,
|
|
1041
1041
|
onChange: a,
|
|
1042
1042
|
orientation: s,
|
|
1043
1043
|
className: V("flex flex-col gap-2", o),
|
|
1044
1044
|
children: [
|
|
1045
|
-
e && /* @__PURE__ */ R(
|
|
1045
|
+
e && /* @__PURE__ */ R(ee, {
|
|
1046
1046
|
className: "text-label text-content",
|
|
1047
1047
|
children: e
|
|
1048
1048
|
}),
|
|
1049
1049
|
/* @__PURE__ */ R("div", {
|
|
1050
1050
|
className: V("flex gap-x-6 gap-y-2", s === "vertical" ? "flex-col" : "flex-row flex-wrap"),
|
|
1051
|
-
children: r.map((e) => /* @__PURE__ */ R(
|
|
1051
|
+
children: r.map((e) => /* @__PURE__ */ R(ie, {
|
|
1052
1052
|
value: e.value,
|
|
1053
|
-
children: /* @__PURE__ */ z(
|
|
1053
|
+
children: /* @__PURE__ */ z(P, {
|
|
1054
1054
|
className: "group inline-flex items-center gap-2 text-body text-content",
|
|
1055
1055
|
children: [
|
|
1056
1056
|
/* @__PURE__ */ R("span", {
|
|
@@ -1096,11 +1096,11 @@ function Bn({ label: e, description: t, errorMessage: n, value: r, onChange: i,
|
|
|
1096
1096
|
description: t,
|
|
1097
1097
|
errorMessage: n
|
|
1098
1098
|
}),
|
|
1099
|
-
/* @__PURE__ */ R(
|
|
1099
|
+
/* @__PURE__ */ R(N, {
|
|
1100
1100
|
className: jn,
|
|
1101
|
-
children: /* @__PURE__ */ R(
|
|
1101
|
+
children: /* @__PURE__ */ R(D, {
|
|
1102
1102
|
className: "max-h-72 overflow-auto outline-none",
|
|
1103
|
-
children: (e) => /* @__PURE__ */ z(
|
|
1103
|
+
children: (e) => /* @__PURE__ */ z(O, {
|
|
1104
1104
|
id: e.value,
|
|
1105
1105
|
textValue: e.value,
|
|
1106
1106
|
className: V(An, "flex-col items-start gap-0"),
|
|
@@ -1145,7 +1145,7 @@ function Vn({ label: e, columns: t, rows: n, renderCell: r, sort: i, onSortChang
|
|
|
1145
1145
|
className: "px-3 py-6 text-content-muted",
|
|
1146
1146
|
children: o ?? "Nothing here yet."
|
|
1147
1147
|
}),
|
|
1148
|
-
children: (e) => /* @__PURE__ */ R(
|
|
1148
|
+
children: (e) => /* @__PURE__ */ R(ae, {
|
|
1149
1149
|
id: e.id,
|
|
1150
1150
|
...s ? { href: s(e) } : {},
|
|
1151
1151
|
className: V("data-[hovered]:bg-accent-subtle data-[href]:cursor-pointer", U, "outline-none data-[focus-visible]:outline-2 data-[focus-visible]:outline-solid data-[focus-visible]:-outline-offset-2 data-[focus-visible]:outline-focus"),
|
|
@@ -1158,17 +1158,24 @@ function Vn({ label: e, columns: t, rows: n, renderCell: r, sort: i, onSortChang
|
|
|
1158
1158
|
})
|
|
1159
1159
|
});
|
|
1160
1160
|
}
|
|
1161
|
-
function Hn({ children: e, dot: t = !1,
|
|
1161
|
+
function Hn({ children: e, dot: t = !1, busy: n = !1, live: r = !0, tone: i = "neutral", className: a }) {
|
|
1162
1162
|
return /* @__PURE__ */ z("p", {
|
|
1163
|
-
role:
|
|
1164
|
-
className: V("inline-flex items-center gap-2 text-small",
|
|
1163
|
+
role: r ? "status" : void 0,
|
|
1164
|
+
className: V("inline-flex items-center gap-2 text-small", i === "error" ? "text-danger" : "text-content-muted", a),
|
|
1165
1165
|
children: [t && /* @__PURE__ */ R("span", {
|
|
1166
1166
|
"aria-hidden": "true",
|
|
1167
|
-
|
|
1167
|
+
"data-busy": n || void 0,
|
|
1168
|
+
className: V("size-2 shrink-0 rounded-full", i === "error" ? "bg-danger" : n ? "animate-status-pulse bg-accent" : "bg-content-muted")
|
|
1168
1169
|
}), e]
|
|
1169
1170
|
});
|
|
1170
1171
|
}
|
|
1171
|
-
function Un({
|
|
1172
|
+
function Un({ children: e, tone: t, className: n }) {
|
|
1173
|
+
return /* @__PURE__ */ R("span", {
|
|
1174
|
+
className: V("inline-flex shrink-0 items-center rounded-full px-2 align-top text-caption font-semibold", "outline -outline-offset-1", t === "live" ? "bg-live-subtle text-live outline-transparent" : t === "scheduled" ? "bg-scheduled-subtle text-scheduled outline-transparent" : "bg-surface-sunken text-content-muted outline-border", n),
|
|
1175
|
+
children: e
|
|
1176
|
+
});
|
|
1177
|
+
}
|
|
1178
|
+
function Wn({ title: e = "There is a problem", errors: t, focusOnMount: n = !0, focusKey: r, onGo: i }) {
|
|
1172
1179
|
let a = u(null), o = r ?? t.length, c = t.length > 0;
|
|
1173
1180
|
return s(() => {
|
|
1174
1181
|
n && c && a.current?.focus();
|
|
@@ -1205,7 +1212,7 @@ function Un({ title: e = "There is a problem", errors: t, focusOnMount: n = !0,
|
|
|
1205
1212
|
}
|
|
1206
1213
|
//#endregion
|
|
1207
1214
|
//#region ../ui/src/components/Mark.tsx
|
|
1208
|
-
function
|
|
1215
|
+
function Gn({ size: e = 20, className: t }) {
|
|
1209
1216
|
let n = e <= 24;
|
|
1210
1217
|
return /* @__PURE__ */ z("svg", {
|
|
1211
1218
|
viewBox: "0 0 64 64",
|
|
@@ -1240,10 +1247,10 @@ function Wn({ size: e = 20, className: t }) {
|
|
|
1240
1247
|
}
|
|
1241
1248
|
//#endregion
|
|
1242
1249
|
//#region ../ui/src/components/Avatar.tsx
|
|
1243
|
-
function
|
|
1250
|
+
function Kn(e) {
|
|
1244
1251
|
return e.replace(/^@/, "").trim().split(/\s+/).filter(Boolean).slice(0, 2).map((e) => Array.from(e)[0] ?? "").join("").toLocaleUpperCase();
|
|
1245
1252
|
}
|
|
1246
|
-
function
|
|
1253
|
+
function qn({ name: e, src: t, size: n = 24, className: r }) {
|
|
1247
1254
|
let [i, a] = d(null), o = t !== void 0 && t !== "" && i !== t;
|
|
1248
1255
|
return /* @__PURE__ */ R("span", {
|
|
1249
1256
|
"aria-hidden": "true",
|
|
@@ -1258,12 +1265,12 @@ function Kn({ name: e, src: t, size: n = 24, className: r }) {
|
|
|
1258
1265
|
onError: () => {
|
|
1259
1266
|
a(t);
|
|
1260
1267
|
}
|
|
1261
|
-
}) :
|
|
1268
|
+
}) : Kn(e)
|
|
1262
1269
|
});
|
|
1263
1270
|
}
|
|
1264
1271
|
//#endregion
|
|
1265
1272
|
//#region ../ui/src/components/Tabs.tsx
|
|
1266
|
-
function
|
|
1273
|
+
function Jn({ label: e, tabs: t, selected: n, onSelectedChange: r }) {
|
|
1267
1274
|
return /* @__PURE__ */ z(_e, {
|
|
1268
1275
|
selectedKey: n,
|
|
1269
1276
|
onSelectionChange: (e) => {
|
|
@@ -1293,21 +1300,21 @@ function qn({ label: e, tabs: t, selected: n, onSelectedChange: r }) {
|
|
|
1293
1300
|
}
|
|
1294
1301
|
//#endregion
|
|
1295
1302
|
//#region ../ui/src/components/Toolbar.tsx
|
|
1296
|
-
function
|
|
1303
|
+
function Yn({ label: e, children: t, className: n }) {
|
|
1297
1304
|
return /* @__PURE__ */ R(Te, {
|
|
1298
1305
|
"aria-label": e,
|
|
1299
1306
|
className: V("flex flex-wrap items-center gap-1", n),
|
|
1300
1307
|
children: t
|
|
1301
1308
|
});
|
|
1302
1309
|
}
|
|
1303
|
-
var
|
|
1304
|
-
function
|
|
1305
|
-
return /* @__PURE__ */ R(
|
|
1310
|
+
var Xn = V("inline-flex min-h-8 min-w-8 items-center justify-center rounded-sm border border-transparent px-2 text-small font-semibold text-content", "data-[hovered]:bg-surface-sunken data-[disabled]:opacity-50", U, H);
|
|
1311
|
+
function Zn() {
|
|
1312
|
+
return /* @__PURE__ */ R(ce, {
|
|
1306
1313
|
orientation: "vertical",
|
|
1307
1314
|
className: "mx-1 h-5 self-center border-l border-border"
|
|
1308
1315
|
});
|
|
1309
1316
|
}
|
|
1310
|
-
function
|
|
1317
|
+
function Qn(e) {
|
|
1311
1318
|
return e.icon ? {
|
|
1312
1319
|
inside: /* @__PURE__ */ R(G, {
|
|
1313
1320
|
name: e.icon,
|
|
@@ -1321,24 +1328,24 @@ function Zn(e) {
|
|
|
1321
1328
|
tooltip: null
|
|
1322
1329
|
};
|
|
1323
1330
|
}
|
|
1324
|
-
var
|
|
1325
|
-
function
|
|
1331
|
+
var $n = "size-8 px-0";
|
|
1332
|
+
function er(e) {
|
|
1326
1333
|
let t = u(null), n = e?.aria;
|
|
1327
1334
|
return s(() => {
|
|
1328
1335
|
n ? t.current?.setAttribute("aria-keyshortcuts", n) : t.current?.removeAttribute("aria-keyshortcuts");
|
|
1329
1336
|
}, [n]), t;
|
|
1330
1337
|
}
|
|
1331
|
-
function
|
|
1332
|
-
let { inside: o, named: s, tooltip: c } =
|
|
1338
|
+
function tr({ children: e, icon: t, label: n, shortcut: r, className: i, ...a }) {
|
|
1339
|
+
let { inside: o, named: s, tooltip: c } = Qn({
|
|
1333
1340
|
children: e,
|
|
1334
1341
|
icon: t,
|
|
1335
1342
|
label: n,
|
|
1336
1343
|
shortcut: r
|
|
1337
|
-
}), l =
|
|
1344
|
+
}), l = er(r), u = /* @__PURE__ */ R(we, {
|
|
1338
1345
|
...a,
|
|
1339
1346
|
...s,
|
|
1340
1347
|
ref: l,
|
|
1341
|
-
className: V(
|
|
1348
|
+
className: V(Xn, c !== null && $n, "data-[selected]:bg-accent-subtle data-[selected]:text-accent", i),
|
|
1342
1349
|
children: o
|
|
1343
1350
|
});
|
|
1344
1351
|
return c === null ? u : /* @__PURE__ */ R(wn, {
|
|
@@ -1346,17 +1353,17 @@ function er({ children: e, icon: t, label: n, shortcut: r, className: i, ...a })
|
|
|
1346
1353
|
children: u
|
|
1347
1354
|
});
|
|
1348
1355
|
}
|
|
1349
|
-
function
|
|
1350
|
-
let { inside: o, named: s, tooltip: c } =
|
|
1356
|
+
function nr({ children: e, icon: t, label: n, shortcut: r, className: i, ...a }) {
|
|
1357
|
+
let { inside: o, named: s, tooltip: c } = Qn({
|
|
1351
1358
|
children: e,
|
|
1352
1359
|
icon: t,
|
|
1353
1360
|
label: n,
|
|
1354
1361
|
shortcut: r
|
|
1355
|
-
}), l =
|
|
1362
|
+
}), l = er(r), u = /* @__PURE__ */ R(f, {
|
|
1356
1363
|
...a,
|
|
1357
1364
|
...s,
|
|
1358
1365
|
ref: l,
|
|
1359
|
-
className: V(
|
|
1366
|
+
className: V(Xn, c !== null && $n, i),
|
|
1360
1367
|
children: o
|
|
1361
1368
|
});
|
|
1362
1369
|
return c === null ? u : /* @__PURE__ */ R(wn, {
|
|
@@ -1366,7 +1373,7 @@ function tr({ children: e, icon: t, label: n, shortcut: r, className: i, ...a })
|
|
|
1366
1373
|
}
|
|
1367
1374
|
//#endregion
|
|
1368
1375
|
//#region ../ui/src/components/Tree.tsx
|
|
1369
|
-
function
|
|
1376
|
+
function rr({ label: e, items: t, textValue: n, renderRow: r, onAction: i, expandedKeys: a, onExpandedChange: o, dragAndDropHooks: s, onRowKeyDown: c, emptyState: l, currentKey: u, inset: d = 1 }) {
|
|
1370
1377
|
let p = /* @__PURE__ */ new Map(), m = (e) => {
|
|
1371
1378
|
for (let t of e) p.set(t.id, t), m(t.children);
|
|
1372
1379
|
};
|
|
@@ -1435,15 +1442,15 @@ function nr({ label: e, items: t, textValue: n, renderRow: r, onAction: i, expan
|
|
|
1435
1442
|
}
|
|
1436
1443
|
//#endregion
|
|
1437
1444
|
//#region src/app/context.tsx
|
|
1438
|
-
var
|
|
1445
|
+
var ir = "Vesper", ar = n(null);
|
|
1439
1446
|
function J() {
|
|
1440
|
-
let e = o(
|
|
1447
|
+
let e = o(ar);
|
|
1441
1448
|
if (!e) throw Error("useStudio() must be used inside <App>.");
|
|
1442
1449
|
return e;
|
|
1443
1450
|
}
|
|
1444
1451
|
//#endregion
|
|
1445
1452
|
//#region src/app/format.ts
|
|
1446
|
-
var
|
|
1453
|
+
var or = [
|
|
1447
1454
|
["year", 31536e3],
|
|
1448
1455
|
["month", 2592e3],
|
|
1449
1456
|
["week", 604800],
|
|
@@ -1451,20 +1458,20 @@ var ar = [
|
|
|
1451
1458
|
["hour", 3600],
|
|
1452
1459
|
["minute", 60]
|
|
1453
1460
|
];
|
|
1454
|
-
function
|
|
1461
|
+
function sr(e, t = /* @__PURE__ */ new Date(), n) {
|
|
1455
1462
|
let r = new Date(e), i = Math.round((r.getTime() - t.getTime()) / 1e3);
|
|
1456
1463
|
if (Number.isNaN(i)) return "";
|
|
1457
1464
|
if (Math.abs(i) < 45) return "just now";
|
|
1458
1465
|
let a = new Intl.RelativeTimeFormat(n, { numeric: "auto" });
|
|
1459
|
-
for (let [e, t] of
|
|
1466
|
+
for (let [e, t] of or) if (Math.abs(i) >= t || e === "minute") return a.format(Math.round(i / t), e);
|
|
1460
1467
|
return "just now";
|
|
1461
1468
|
}
|
|
1462
|
-
function
|
|
1469
|
+
function cr(e, t, n, r) {
|
|
1463
1470
|
return `${new Intl.NumberFormat(r).format(e)} ${e === 1 ? t : n}`;
|
|
1464
1471
|
}
|
|
1465
1472
|
//#endregion
|
|
1466
1473
|
//#region src/app/load.ts
|
|
1467
|
-
function
|
|
1474
|
+
function lr(e, t = "") {
|
|
1468
1475
|
let [n, r] = d(null), [i, o] = d(0), c = u(e);
|
|
1469
1476
|
s(() => {
|
|
1470
1477
|
c.current = e;
|
|
@@ -1498,59 +1505,85 @@ function cr(e, t = "") {
|
|
|
1498
1505
|
}
|
|
1499
1506
|
//#endregion
|
|
1500
1507
|
//#region src/editor/values.ts
|
|
1501
|
-
function
|
|
1508
|
+
function ur(e, t) {
|
|
1502
1509
|
let n = e;
|
|
1503
1510
|
for (let e of t) if (n = typeof e == "number" ? Array.isArray(n) ? n[e] : void 0 : B(n) ? n[e] : void 0, n === void 0) return;
|
|
1504
1511
|
return n;
|
|
1505
1512
|
}
|
|
1506
|
-
function
|
|
1507
|
-
return
|
|
1513
|
+
function dr(e, t, n) {
|
|
1514
|
+
return fr(e, t, 0, n);
|
|
1508
1515
|
}
|
|
1509
|
-
function
|
|
1516
|
+
function fr(e, t, n, r) {
|
|
1510
1517
|
if (n === t.length) return r;
|
|
1511
1518
|
let i = t[n];
|
|
1512
1519
|
if (typeof i == "number") {
|
|
1513
1520
|
let a = Array.isArray(e) ? [...e] : [];
|
|
1514
|
-
return a[i] =
|
|
1521
|
+
return a[i] = fr(a[i], t, n + 1, r), a;
|
|
1515
1522
|
}
|
|
1516
|
-
let a = B(e) ? { ...e } : {}, o =
|
|
1523
|
+
let a = B(e) ? { ...e } : {}, o = fr(a[i], t, n + 1, r);
|
|
1517
1524
|
return o === void 0 ? Reflect.deleteProperty(a, i) : a[i] = o, a;
|
|
1518
1525
|
}
|
|
1519
|
-
function
|
|
1526
|
+
function pr(e, t = "field") {
|
|
1520
1527
|
return `${t}.${e.map((e) => String(e).replace(/[^A-Za-z0-9_]/g, "_")).join(".")}`;
|
|
1521
1528
|
}
|
|
1522
|
-
function
|
|
1529
|
+
function mr(e) {
|
|
1523
1530
|
return e.map(String).join(".");
|
|
1524
1531
|
}
|
|
1525
1532
|
function Y(e) {
|
|
1526
1533
|
return e.path.at(-1) ?? "";
|
|
1527
1534
|
}
|
|
1528
|
-
function
|
|
1535
|
+
function hr(e) {
|
|
1529
1536
|
let t = {};
|
|
1530
1537
|
for (let n of e ?? []) n.default !== void 0 && !n.defaultDynamic && (t[Y(n)] = structuredClone(n.default));
|
|
1531
1538
|
return t;
|
|
1532
1539
|
}
|
|
1533
1540
|
//#endregion
|
|
1534
1541
|
//#region src/editor/context.tsx
|
|
1535
|
-
var
|
|
1542
|
+
var gr = n(null);
|
|
1536
1543
|
function X() {
|
|
1537
|
-
let e = o(
|
|
1544
|
+
let e = o(gr);
|
|
1538
1545
|
if (!e) throw Error("useEditor() must be used inside an entry editor.");
|
|
1539
1546
|
return e;
|
|
1540
1547
|
}
|
|
1541
1548
|
//#endregion
|
|
1549
|
+
//#region src/widgets/blank-date.ts
|
|
1550
|
+
var _r = /* @__PURE__ */ new Set([
|
|
1551
|
+
"Tab",
|
|
1552
|
+
"Shift",
|
|
1553
|
+
"Escape",
|
|
1554
|
+
"Enter",
|
|
1555
|
+
"Meta",
|
|
1556
|
+
"Control",
|
|
1557
|
+
"Alt"
|
|
1558
|
+
]);
|
|
1559
|
+
function vr(e) {
|
|
1560
|
+
let [t, n] = d(!1);
|
|
1561
|
+
return {
|
|
1562
|
+
"data-blank": e === "" && !t ? "" : void 0,
|
|
1563
|
+
onPointerDown: () => {
|
|
1564
|
+
n(!0);
|
|
1565
|
+
},
|
|
1566
|
+
onKeyDown: (e) => {
|
|
1567
|
+
_r.has(e.key) || n(!0);
|
|
1568
|
+
},
|
|
1569
|
+
onBlur: (e) => {
|
|
1570
|
+
e.currentTarget.validity.badInput || n(!1);
|
|
1571
|
+
}
|
|
1572
|
+
};
|
|
1573
|
+
}
|
|
1574
|
+
//#endregion
|
|
1542
1575
|
//#region src/widgets/basic.tsx
|
|
1543
1576
|
var Z = V("min-h-10 w-full rounded-md border border-border-strong bg-surface-sunken px-3 py-2 text-body text-content", "outline-none focus-visible:outline-2 focus-visible:outline-solid focus-visible:outline-offset-2 focus-visible:outline-focus", "focus-visible:ring-6 focus-visible:ring-(color:--glow-focus)", "aria-[invalid=true]:border-danger disabled:opacity-60");
|
|
1544
|
-
function
|
|
1577
|
+
function yr(e) {
|
|
1545
1578
|
return e.required ? "" : void 0;
|
|
1546
1579
|
}
|
|
1547
|
-
function
|
|
1580
|
+
function br(e) {
|
|
1548
1581
|
let { onChange: t, field: n, id: r, describedBy: i, invalid: a, disabled: o } = e, s = e.value;
|
|
1549
1582
|
return {
|
|
1550
1583
|
id: r,
|
|
1551
1584
|
value: typeof s == "string" ? s : typeof s == "number" || typeof s == "boolean" ? String(s) : "",
|
|
1552
1585
|
onChange: (e) => {
|
|
1553
|
-
t(e.target.value === "" ?
|
|
1586
|
+
t(e.target.value === "" ? yr(n) : e.target.value);
|
|
1554
1587
|
},
|
|
1555
1588
|
"aria-describedby": i,
|
|
1556
1589
|
"aria-invalid": a || void 0,
|
|
@@ -1561,14 +1594,14 @@ function _r(e) {
|
|
|
1561
1594
|
className: Z
|
|
1562
1595
|
};
|
|
1563
1596
|
}
|
|
1564
|
-
function
|
|
1597
|
+
function xr(e) {
|
|
1565
1598
|
return /* @__PURE__ */ R("input", {
|
|
1566
1599
|
type: "text",
|
|
1567
|
-
...
|
|
1600
|
+
...br(e)
|
|
1568
1601
|
});
|
|
1569
1602
|
}
|
|
1570
|
-
function
|
|
1571
|
-
let t =
|
|
1603
|
+
function Sr(e) {
|
|
1604
|
+
let t = br(e);
|
|
1572
1605
|
return /* @__PURE__ */ R("input", {
|
|
1573
1606
|
type: "email",
|
|
1574
1607
|
inputMode: "email",
|
|
@@ -1576,15 +1609,15 @@ function yr(e) {
|
|
|
1576
1609
|
autoComplete: t.autoComplete ?? "email"
|
|
1577
1610
|
});
|
|
1578
1611
|
}
|
|
1579
|
-
function
|
|
1612
|
+
function Cr(e) {
|
|
1580
1613
|
let t = e.field.widget === "markdown" ? 8 : 3;
|
|
1581
1614
|
return /* @__PURE__ */ R("textarea", {
|
|
1582
1615
|
rows: t,
|
|
1583
|
-
...
|
|
1616
|
+
...br(e),
|
|
1584
1617
|
className: V(Z, "resize-y")
|
|
1585
1618
|
});
|
|
1586
1619
|
}
|
|
1587
|
-
function
|
|
1620
|
+
function wr({ value: e, onChange: t, field: n, id: r, describedBy: i, invalid: a, disabled: o }) {
|
|
1588
1621
|
let [s, c] = d(e === void 0 ? "" : String(e)), l = n.constraints;
|
|
1589
1622
|
return /* @__PURE__ */ R("input", {
|
|
1590
1623
|
id: r,
|
|
@@ -1604,7 +1637,7 @@ function xr({ value: e, onChange: t, field: n, id: r, describedBy: i, invalid: a
|
|
|
1604
1637
|
className: V(Z, "max-w-48")
|
|
1605
1638
|
});
|
|
1606
1639
|
}
|
|
1607
|
-
function
|
|
1640
|
+
function Tr({ value: e, onChange: t, id: n, describedBy: r, invalid: i, disabled: a }) {
|
|
1608
1641
|
return /* @__PURE__ */ R(Rn, {
|
|
1609
1642
|
id: n,
|
|
1610
1643
|
isSelected: e === !0,
|
|
@@ -1616,17 +1649,19 @@ function Sr({ value: e, onChange: t, id: n, describedBy: r, invalid: i, disabled
|
|
|
1616
1649
|
children: null
|
|
1617
1650
|
});
|
|
1618
1651
|
}
|
|
1619
|
-
function
|
|
1652
|
+
function Er(e) {
|
|
1620
1653
|
return e instanceof Date && !Number.isNaN(e.getTime()) ? e.toISOString().slice(0, 10) : typeof e == "string" ? e.slice(0, 10) : "";
|
|
1621
1654
|
}
|
|
1622
|
-
function
|
|
1655
|
+
function Dr({ value: e, onChange: t, field: n, id: r, describedBy: i, invalid: a, disabled: o }) {
|
|
1656
|
+
let s = Er(e), c = vr(s);
|
|
1623
1657
|
return /* @__PURE__ */ R("input", {
|
|
1624
1658
|
id: r,
|
|
1625
1659
|
type: "date",
|
|
1626
|
-
value:
|
|
1660
|
+
value: s,
|
|
1661
|
+
...c,
|
|
1627
1662
|
onChange: (r) => {
|
|
1628
1663
|
let i = r.target.value;
|
|
1629
|
-
t(i === "" ?
|
|
1664
|
+
t(i === "" ? yr(n) === "" && typeof e == "string" ? "" : void 0 : typeof e == "string" ? i : /* @__PURE__ */ new Date(`${i}T00:00:00.000Z`));
|
|
1630
1665
|
},
|
|
1631
1666
|
"aria-describedby": i,
|
|
1632
1667
|
"aria-invalid": a || void 0,
|
|
@@ -1635,15 +1670,15 @@ function wr({ value: e, onChange: t, field: n, id: r, describedBy: i, invalid: a
|
|
|
1635
1670
|
className: V(Z, "max-w-56")
|
|
1636
1671
|
});
|
|
1637
1672
|
}
|
|
1638
|
-
function
|
|
1673
|
+
function Or(e) {
|
|
1639
1674
|
return e.constraints?.options ?? e.children?.[0]?.constraints?.options ?? [];
|
|
1640
1675
|
}
|
|
1641
|
-
function
|
|
1676
|
+
function kr({ value: e, onChange: t, field: n, id: r, describedBy: i, invalid: a, disabled: o }) {
|
|
1642
1677
|
return /* @__PURE__ */ R(Nn, {
|
|
1643
1678
|
id: r,
|
|
1644
1679
|
"aria-labelledby": `${r}-label`,
|
|
1645
1680
|
"aria-describedby": i,
|
|
1646
|
-
options:
|
|
1681
|
+
options: Or(n),
|
|
1647
1682
|
value: e ?? null,
|
|
1648
1683
|
onChange: (e) => {
|
|
1649
1684
|
t(e ?? void 0);
|
|
@@ -1652,21 +1687,21 @@ function Er({ value: e, onChange: t, field: n, id: r, describedBy: i, invalid: a
|
|
|
1652
1687
|
isDisabled: o
|
|
1653
1688
|
});
|
|
1654
1689
|
}
|
|
1655
|
-
function
|
|
1690
|
+
function Ar({ value: e, onChange: t, field: n, id: r, describedBy: i, invalid: a, disabled: o }) {
|
|
1656
1691
|
return /* @__PURE__ */ R(zn, {
|
|
1657
1692
|
id: r,
|
|
1658
1693
|
"aria-labelledby": `${r}-label`,
|
|
1659
1694
|
"aria-describedby": i,
|
|
1660
|
-
options:
|
|
1695
|
+
options: Or(n),
|
|
1661
1696
|
value: e ?? null,
|
|
1662
1697
|
onChange: t,
|
|
1663
1698
|
isInvalid: a,
|
|
1664
1699
|
isDisabled: o,
|
|
1665
|
-
orientation:
|
|
1700
|
+
orientation: Or(n).length <= 3 ? "horizontal" : "vertical"
|
|
1666
1701
|
});
|
|
1667
1702
|
}
|
|
1668
|
-
function
|
|
1669
|
-
let s = Array.isArray(e) ? e.filter((e) => typeof e == "string") : [], c =
|
|
1703
|
+
function jr({ value: e, onChange: t, field: n, id: r, describedBy: i, invalid: a, disabled: o }) {
|
|
1704
|
+
let s = Array.isArray(e) ? e.filter((e) => typeof e == "string") : [], c = Or(n), l = n.children?.[0]?.kind === "enum";
|
|
1670
1705
|
return /* @__PURE__ */ R(Fn, {
|
|
1671
1706
|
id: r,
|
|
1672
1707
|
"aria-labelledby": `${r}-label`,
|
|
@@ -1685,7 +1720,7 @@ function Or({ value: e, onChange: t, field: n, id: r, describedBy: i, invalid: a
|
|
|
1685
1720
|
isDisabled: o
|
|
1686
1721
|
});
|
|
1687
1722
|
}
|
|
1688
|
-
function
|
|
1723
|
+
function Mr({ value: e, onChange: t, field: n, id: r, describedBy: i, invalid: a, disabled: o }) {
|
|
1689
1724
|
let [s, c] = d(() => Ve(e)), [l, u] = d(null), f = `${r}-yaml`;
|
|
1690
1725
|
return /* @__PURE__ */ z(L, { children: [
|
|
1691
1726
|
/* @__PURE__ */ R("textarea", {
|
|
@@ -1722,8 +1757,8 @@ function kr({ value: e, onChange: t, field: n, id: r, describedBy: i, invalid: a
|
|
|
1722
1757
|
}
|
|
1723
1758
|
//#endregion
|
|
1724
1759
|
//#region src/widgets/geo.tsx
|
|
1725
|
-
var
|
|
1726
|
-
function
|
|
1760
|
+
var Nr = i(() => import("./geo-map-CT3OGD7O.js"));
|
|
1761
|
+
function Pr(e) {
|
|
1727
1762
|
if (!B(e)) return {};
|
|
1728
1763
|
let { lat: t, lng: n } = e;
|
|
1729
1764
|
return {
|
|
@@ -1731,8 +1766,8 @@ function jr(e) {
|
|
|
1731
1766
|
...typeof n == "number" ? { lng: n } : {}
|
|
1732
1767
|
};
|
|
1733
1768
|
}
|
|
1734
|
-
function
|
|
1735
|
-
let c =
|
|
1769
|
+
function Fr({ value: e, onChange: n, field: r, id: i, disabled: a, invalid: o, describedBy: s }) {
|
|
1770
|
+
let c = Pr(e), [l, u] = d(!1), f = (t, i) => {
|
|
1736
1771
|
let a = {
|
|
1737
1772
|
...B(e) ? e : {},
|
|
1738
1773
|
[t]: i
|
|
@@ -1743,7 +1778,7 @@ function Mr({ value: e, onChange: n, field: r, id: i, disabled: a, invalid: o, d
|
|
|
1743
1778
|
className: "flex flex-col gap-3",
|
|
1744
1779
|
children: [/* @__PURE__ */ z("div", {
|
|
1745
1780
|
className: "flex flex-wrap gap-4",
|
|
1746
|
-
children: [/* @__PURE__ */ R(
|
|
1781
|
+
children: [/* @__PURE__ */ R(Ir, {
|
|
1747
1782
|
id: i,
|
|
1748
1783
|
label: "Latitude",
|
|
1749
1784
|
hint: "−90 to 90, north is positive",
|
|
@@ -1756,7 +1791,7 @@ function Mr({ value: e, onChange: n, field: r, id: i, disabled: a, invalid: o, d
|
|
|
1756
1791
|
disabled: a,
|
|
1757
1792
|
invalid: o,
|
|
1758
1793
|
describedBy: s
|
|
1759
|
-
}), /* @__PURE__ */ R(
|
|
1794
|
+
}), /* @__PURE__ */ R(Ir, {
|
|
1760
1795
|
id: `${i}-lng`,
|
|
1761
1796
|
label: "Longitude",
|
|
1762
1797
|
hint: "−180 to 180, east is positive",
|
|
@@ -1775,7 +1810,7 @@ function Mr({ value: e, onChange: n, field: r, id: i, disabled: a, invalid: o, d
|
|
|
1775
1810
|
className: "text-small text-content-muted",
|
|
1776
1811
|
children: "Loading the map…"
|
|
1777
1812
|
}),
|
|
1778
|
-
children: /* @__PURE__ */ R(
|
|
1813
|
+
children: /* @__PURE__ */ R(Nr, {
|
|
1779
1814
|
label: r.label,
|
|
1780
1815
|
point: c.lat !== void 0 && c.lng !== void 0 ? c : null,
|
|
1781
1816
|
center: p?.defaultCenter,
|
|
@@ -1798,7 +1833,7 @@ function Mr({ value: e, onChange: n, field: r, id: i, disabled: a, invalid: o, d
|
|
|
1798
1833
|
}) })]
|
|
1799
1834
|
});
|
|
1800
1835
|
}
|
|
1801
|
-
function
|
|
1836
|
+
function Ir({ id: e, label: t, hint: n, value: r, min: i, max: a, onChange: o, disabled: s, invalid: c, describedBy: l }) {
|
|
1802
1837
|
let [u, f] = d(r === void 0 ? "" : String(r)), [p, m] = d(r);
|
|
1803
1838
|
return r !== p && (m(r), f(r === void 0 ? "" : String(r))), /* @__PURE__ */ z("div", {
|
|
1804
1839
|
className: "flex flex-col gap-1",
|
|
@@ -1836,7 +1871,7 @@ function Nr({ id: e, label: t, hint: n, value: r, min: i, max: a, onChange: o, d
|
|
|
1836
1871
|
}
|
|
1837
1872
|
//#endregion
|
|
1838
1873
|
//#region src/app/file-url.tsx
|
|
1839
|
-
function
|
|
1874
|
+
function Lr(e) {
|
|
1840
1875
|
let { api: t } = J(), [n, r] = d(null);
|
|
1841
1876
|
return s(() => {
|
|
1842
1877
|
if (!e) return;
|
|
@@ -1851,8 +1886,8 @@ function Pr(e) {
|
|
|
1851
1886
|
};
|
|
1852
1887
|
}, [t, e]), e && n?.path === e ? n.url : "";
|
|
1853
1888
|
}
|
|
1854
|
-
function
|
|
1855
|
-
let r =
|
|
1889
|
+
function Rr({ path: e, className: t, loading: n }) {
|
|
1890
|
+
let r = Lr(e);
|
|
1856
1891
|
return r ? /* @__PURE__ */ R("img", {
|
|
1857
1892
|
src: r,
|
|
1858
1893
|
alt: "",
|
|
@@ -1865,51 +1900,51 @@ function Fr({ path: e, className: t, loading: n }) {
|
|
|
1865
1900
|
}
|
|
1866
1901
|
//#endregion
|
|
1867
1902
|
//#region src/editor/reveal.ts
|
|
1868
|
-
var
|
|
1869
|
-
function
|
|
1903
|
+
var zr = "vesper:reveal";
|
|
1904
|
+
function Br(e) {
|
|
1870
1905
|
return e.closest("[hidden], [inert]") !== null;
|
|
1871
1906
|
}
|
|
1872
|
-
function
|
|
1907
|
+
function Vr(e, t = 20, n = !1) {
|
|
1873
1908
|
let r = document.getElementById(e);
|
|
1874
|
-
r && !
|
|
1875
|
-
|
|
1909
|
+
r && !Br(r) ? (r.scrollIntoView({ block: "center" }), r.focus()) : (r && !n && (r.dispatchEvent(new CustomEvent(zr, { bubbles: !0 })), n = !0), t > 0 && setTimeout(() => {
|
|
1910
|
+
Vr(e, t - 1, n);
|
|
1876
1911
|
}, 25));
|
|
1877
1912
|
}
|
|
1878
1913
|
//#endregion
|
|
1879
1914
|
//#region src/widgets/union.tsx
|
|
1880
|
-
function
|
|
1915
|
+
function Hr(e, t) {
|
|
1881
1916
|
return {
|
|
1882
1917
|
[e.discriminator ?? ""]: t.value,
|
|
1883
|
-
...
|
|
1918
|
+
...hr(t.children)
|
|
1884
1919
|
};
|
|
1885
1920
|
}
|
|
1886
|
-
function
|
|
1887
|
-
return e == null || e === "" ? !0 : Array.isArray(e) ? e.length === 0 : B(e) && Object.values(e).every(
|
|
1921
|
+
function Ur(e) {
|
|
1922
|
+
return e == null || e === "" ? !0 : Array.isArray(e) ? e.length === 0 : B(e) && Object.values(e).every(Ur);
|
|
1888
1923
|
}
|
|
1889
|
-
function
|
|
1890
|
-
let i = e.discriminator ?? "", a = ot(e, t), o = B(t) ? t : {}, s =
|
|
1924
|
+
function Wr(e, t, n, r) {
|
|
1925
|
+
let i = e.discriminator ?? "", a = ot(e, t), o = B(t) ? t : {}, s = hr(n.children), c = { [i]: n.value }, l = [];
|
|
1891
1926
|
for (let e of n.children) {
|
|
1892
1927
|
let t = Y(e), n = a?.children.find((e) => Y(e) === t), i = !a || n?.kind === e.kind ? o[t] : void 0;
|
|
1893
|
-
i === void 0 ? r?.[t] === void 0 ? s[t] !== void 0 && (c[t] = s[t]) : c[t] = r[t] : (c[t] = i,
|
|
1928
|
+
i === void 0 ? r?.[t] === void 0 ? s[t] !== void 0 && (c[t] = s[t]) : c[t] = r[t] : (c[t] = i, Ur(i) || l.push(e.label));
|
|
1894
1929
|
}
|
|
1895
1930
|
return {
|
|
1896
1931
|
value: c,
|
|
1897
1932
|
kept: l,
|
|
1898
|
-
dropped: Object.keys(o).filter((e) => e !== i && !(e in c) && !
|
|
1933
|
+
dropped: Object.keys(o).filter((e) => e !== i && !(e in c) && !Ur(o[e])).map((e) => a?.children.find((t) => Y(t) === e)?.label ?? We(e))
|
|
1899
1934
|
};
|
|
1900
1935
|
}
|
|
1901
|
-
function
|
|
1936
|
+
function Gr(e) {
|
|
1902
1937
|
let t = (e) => e.length <= 1 ? e[0] ?? "" : `${e.slice(0, -1).join(", ")} and ${e.at(-1) ?? ""}`;
|
|
1903
1938
|
return [e.kept.length > 0 ? `${t(e.kept)} kept.` : "", e.dropped.length > 0 ? `${t(e.dropped)} removed.` : ""].filter(Boolean).join(" ");
|
|
1904
1939
|
}
|
|
1905
|
-
var
|
|
1940
|
+
var Kr = [
|
|
1906
1941
|
"title",
|
|
1907
1942
|
"name",
|
|
1908
1943
|
"label",
|
|
1909
1944
|
"heading",
|
|
1910
1945
|
"text"
|
|
1911
|
-
],
|
|
1912
|
-
function
|
|
1946
|
+
], qr = (e) => e.replace(/[*_`]/g, "").trim();
|
|
1947
|
+
function Jr(e, t) {
|
|
1913
1948
|
let n = ot(t, e);
|
|
1914
1949
|
if (!n) {
|
|
1915
1950
|
let n = B(e) ? e[t.discriminator ?? ""] : void 0;
|
|
@@ -1925,13 +1960,13 @@ function Gr(e, t) {
|
|
|
1925
1960
|
let r = n.children.filter((e) => !e.hidden);
|
|
1926
1961
|
for (let t of [
|
|
1927
1962
|
n.summary,
|
|
1928
|
-
...
|
|
1963
|
+
...Kr,
|
|
1929
1964
|
...r.map(Y)
|
|
1930
1965
|
]) {
|
|
1931
1966
|
let r = t ? e[t] : void 0;
|
|
1932
|
-
if (typeof r == "string" &&
|
|
1967
|
+
if (typeof r == "string" && qr(r)) return {
|
|
1933
1968
|
name: n.label,
|
|
1934
|
-
detail:
|
|
1969
|
+
detail: qr(r)
|
|
1935
1970
|
};
|
|
1936
1971
|
}
|
|
1937
1972
|
let i = r.find((e) => e.kind === "array");
|
|
@@ -1939,7 +1974,7 @@ function Gr(e, t) {
|
|
|
1939
1974
|
let t = e[Y(i)], r = i.label.toLowerCase(), a = /[^s]s$/.test(r) ? r.slice(0, -1) : r;
|
|
1940
1975
|
return {
|
|
1941
1976
|
name: n.label,
|
|
1942
|
-
detail:
|
|
1977
|
+
detail: cr(Array.isArray(t) ? t.length : 0, a, r)
|
|
1943
1978
|
};
|
|
1944
1979
|
}
|
|
1945
1980
|
return {
|
|
@@ -1947,18 +1982,18 @@ function Gr(e, t) {
|
|
|
1947
1982
|
detail: ""
|
|
1948
1983
|
};
|
|
1949
1984
|
}
|
|
1950
|
-
function
|
|
1985
|
+
function Yr({ kind: e, path: t }) {
|
|
1951
1986
|
return /* @__PURE__ */ R("div", {
|
|
1952
1987
|
className: "flex flex-col gap-4",
|
|
1953
|
-
children: e.children.filter((e) => !e.hidden).map((e) => /* @__PURE__ */ R(
|
|
1988
|
+
children: e.children.filter((e) => !e.hidden).map((e) => /* @__PURE__ */ R(Wa, {
|
|
1954
1989
|
field: e,
|
|
1955
1990
|
path: [...t, Y(e)]
|
|
1956
1991
|
}, Y(e)))
|
|
1957
1992
|
});
|
|
1958
1993
|
}
|
|
1959
|
-
var
|
|
1960
|
-
function
|
|
1961
|
-
let { value: t, onChange: n, field: r, path: i, id: a, describedBy: o, invalid: s, disabled: c, inRow: l } = e, d = u(/* @__PURE__ */ new Map()), f = ot(r, t), p = r.variants ?? [], m = f ? f.children.length > 0 ? /* @__PURE__ */ R(
|
|
1994
|
+
var Xr = "";
|
|
1995
|
+
function Zr(e) {
|
|
1996
|
+
let { value: t, onChange: n, field: r, path: i, id: a, describedBy: o, invalid: s, disabled: c, inRow: l } = e, d = u(/* @__PURE__ */ new Map()), f = ot(r, t), p = r.variants ?? [], m = f ? f.children.length > 0 ? /* @__PURE__ */ R(Yr, {
|
|
1962
1997
|
kind: f,
|
|
1963
1998
|
path: i
|
|
1964
1999
|
}) : l ? /* @__PURE__ */ R("p", {
|
|
@@ -1970,14 +2005,14 @@ function Jr(e) {
|
|
|
1970
2005
|
/* @__PURE__ */ R("label", {
|
|
1971
2006
|
htmlFor: `${a}-yaml`,
|
|
1972
2007
|
className: "text-label text-content",
|
|
1973
|
-
children:
|
|
2008
|
+
children: Jr(t, r).name
|
|
1974
2009
|
}),
|
|
1975
2010
|
/* @__PURE__ */ R("p", {
|
|
1976
2011
|
id: `${a}-unknown`,
|
|
1977
2012
|
className: "text-small text-content-muted",
|
|
1978
2013
|
children: "The site has no kind by this name. Change it to one it has, or edit it here."
|
|
1979
2014
|
}),
|
|
1980
|
-
/* @__PURE__ */ R(
|
|
2015
|
+
/* @__PURE__ */ R(Mr, {
|
|
1981
2016
|
value: t,
|
|
1982
2017
|
onChange: n,
|
|
1983
2018
|
field: {
|
|
@@ -1995,14 +2030,14 @@ function Jr(e) {
|
|
|
1995
2030
|
let h = (e) => {
|
|
1996
2031
|
f && d.current.set(f.value, B(t) ? t : {});
|
|
1997
2032
|
let i = p.find((t) => t.value === e);
|
|
1998
|
-
n(i ?
|
|
2033
|
+
n(i ? Wr(r, t, i, d.current.get(i.value)).value : void 0);
|
|
1999
2034
|
}, g = [...r.required ? [] : [{
|
|
2000
|
-
value:
|
|
2035
|
+
value: Xr,
|
|
2001
2036
|
label: "None"
|
|
2002
2037
|
}], ...p.map((e) => ({
|
|
2003
2038
|
value: e.value,
|
|
2004
2039
|
label: e.label
|
|
2005
|
-
}))], _ = f ? f.value : t === void 0 ?
|
|
2040
|
+
}))], _ = f ? f.value : t === void 0 ? Xr : null, v = g.length <= 4 ? /* @__PURE__ */ R(zn, {
|
|
2006
2041
|
id: `${a}-kind`,
|
|
2007
2042
|
label: "Kind",
|
|
2008
2043
|
options: g,
|
|
@@ -2016,7 +2051,7 @@ function Jr(e) {
|
|
|
2016
2051
|
options: g,
|
|
2017
2052
|
value: _,
|
|
2018
2053
|
onChange: (e) => {
|
|
2019
|
-
h(e ??
|
|
2054
|
+
h(e ?? Xr);
|
|
2020
2055
|
},
|
|
2021
2056
|
isDisabled: c
|
|
2022
2057
|
});
|
|
@@ -2034,57 +2069,57 @@ function Jr(e) {
|
|
|
2034
2069
|
}
|
|
2035
2070
|
//#endregion
|
|
2036
2071
|
//#region src/widgets/group.tsx
|
|
2037
|
-
function
|
|
2072
|
+
function Qr({ field: e, path: t }) {
|
|
2038
2073
|
let n = (e.children ?? []).filter((e) => !e.hidden);
|
|
2039
2074
|
return /* @__PURE__ */ R("div", {
|
|
2040
2075
|
className: "flex flex-col gap-4",
|
|
2041
|
-
children: n.map((e) => /* @__PURE__ */ R(
|
|
2076
|
+
children: n.map((e) => /* @__PURE__ */ R(Wa, {
|
|
2042
2077
|
field: e,
|
|
2043
2078
|
path: [...t, Y(e)]
|
|
2044
2079
|
}, Y(e)))
|
|
2045
2080
|
});
|
|
2046
2081
|
}
|
|
2047
|
-
function
|
|
2082
|
+
function $r(e) {
|
|
2048
2083
|
let t = e.children?.[0], n = e.label.toLowerCase(), r = t?.label && t.label !== "[]" && t.label !== "Item" ? t.label : "";
|
|
2049
2084
|
return {
|
|
2050
2085
|
one: r ? r.toLowerCase() : /[^s]s$/.test(n) ? n.slice(0, -1) : n,
|
|
2051
2086
|
many: n
|
|
2052
2087
|
};
|
|
2053
2088
|
}
|
|
2054
|
-
var
|
|
2089
|
+
var ei = (e) => e.charAt(0).toLocaleUpperCase() + e.slice(1), ti = [
|
|
2055
2090
|
"title",
|
|
2056
2091
|
"name",
|
|
2057
2092
|
"label",
|
|
2058
2093
|
"heading",
|
|
2059
2094
|
"text"
|
|
2060
2095
|
];
|
|
2061
|
-
function
|
|
2096
|
+
function ni(e) {
|
|
2062
2097
|
return e?.kind === "image" || e?.widget === "image" || e?.inferredWidget === "image";
|
|
2063
2098
|
}
|
|
2064
|
-
function
|
|
2099
|
+
function ri(e) {
|
|
2065
2100
|
return e.slice(e.lastIndexOf("/") + 1);
|
|
2066
2101
|
}
|
|
2067
|
-
function
|
|
2102
|
+
function ii(e) {
|
|
2068
2103
|
let t = B(e) ? e.src : e;
|
|
2069
2104
|
return typeof t == "string" ? t : "";
|
|
2070
2105
|
}
|
|
2071
|
-
var
|
|
2072
|
-
function
|
|
2106
|
+
var ai = (e) => e.replace(/[*_`]/g, "").trim();
|
|
2107
|
+
function oi(e, t, n) {
|
|
2073
2108
|
let r = {
|
|
2074
|
-
name: `${
|
|
2109
|
+
name: `${ei($r(n).one)} ${String(t + 1)}`,
|
|
2075
2110
|
key: void 0
|
|
2076
2111
|
};
|
|
2077
2112
|
if (typeof e == "string") return e.trim() ? {
|
|
2078
|
-
name:
|
|
2113
|
+
name: ai(e),
|
|
2079
2114
|
key: void 0
|
|
2080
2115
|
} : r;
|
|
2081
|
-
if (
|
|
2082
|
-
let t = B(e) && typeof e.alt == "string" ? e.alt.trim() : "", n =
|
|
2116
|
+
if (ni(n.children?.[0])) {
|
|
2117
|
+
let t = B(e) && typeof e.alt == "string" ? e.alt.trim() : "", n = ii(e);
|
|
2083
2118
|
return t ? {
|
|
2084
2119
|
name: t,
|
|
2085
2120
|
key: "alt"
|
|
2086
2121
|
} : n ? {
|
|
2087
|
-
name:
|
|
2122
|
+
name: ri(n),
|
|
2088
2123
|
key: "src"
|
|
2089
2124
|
} : r;
|
|
2090
2125
|
}
|
|
@@ -2092,57 +2127,57 @@ function ri(e, t, n) {
|
|
|
2092
2127
|
let i = (n.children?.[0]?.children ?? []).filter((e) => !e.hidden).map(Y);
|
|
2093
2128
|
for (let t of [
|
|
2094
2129
|
n.summary,
|
|
2095
|
-
...
|
|
2130
|
+
...ti,
|
|
2096
2131
|
...i
|
|
2097
2132
|
]) {
|
|
2098
2133
|
if (!t) continue;
|
|
2099
2134
|
let n = e[t];
|
|
2100
2135
|
if (typeof n == "string" && n.trim()) return {
|
|
2101
|
-
name:
|
|
2136
|
+
name: ai(n),
|
|
2102
2137
|
key: t
|
|
2103
2138
|
};
|
|
2104
2139
|
}
|
|
2105
2140
|
return r;
|
|
2106
2141
|
}
|
|
2107
|
-
function
|
|
2142
|
+
function si(e, t, n) {
|
|
2108
2143
|
if (!B(e)) return "";
|
|
2109
2144
|
let r = t.children ?? [], i = r.find((e) => e.kind === "array" && !e.hidden);
|
|
2110
2145
|
if (i) {
|
|
2111
|
-
let t = e[Y(i)], { one: n, many: r } =
|
|
2112
|
-
return
|
|
2146
|
+
let t = e[Y(i)], { one: n, many: r } = $r(i);
|
|
2147
|
+
return cr(Array.isArray(t) ? t.length : 0, n, r);
|
|
2113
2148
|
}
|
|
2114
2149
|
for (let t of r) {
|
|
2115
2150
|
let r = Y(t), i = e[r];
|
|
2116
|
-
if (r !== n && !t.hidden && typeof i == "string" && i.trim()) return
|
|
2151
|
+
if (r !== n && !t.hidden && typeof i == "string" && i.trim()) return ai(i);
|
|
2117
2152
|
}
|
|
2118
2153
|
return "";
|
|
2119
2154
|
}
|
|
2120
|
-
function
|
|
2155
|
+
function ci(e, t) {
|
|
2121
2156
|
if (!e) return 0;
|
|
2122
2157
|
let n = 0;
|
|
2123
2158
|
for (let [r, i] of e) (r === t || r.startsWith(`${t}.`)) && i.length > 0 && (n += i.length);
|
|
2124
2159
|
return n;
|
|
2125
2160
|
}
|
|
2126
|
-
function
|
|
2161
|
+
function li(e) {
|
|
2127
2162
|
return e ? e.default !== void 0 && !e.defaultDynamic ? structuredClone(e.default) : e.kind === "object" ? {} : e.kind === "boolean" ? !1 : e.kind === "array" ? [] : e.kind === "number" ? 0 : "" : null;
|
|
2128
2163
|
}
|
|
2129
|
-
var
|
|
2130
|
-
function
|
|
2164
|
+
var ui = 0, di = () => `item${String(++ui)}`, fi = "application/x-vesper-list-item";
|
|
2165
|
+
function pi(e) {
|
|
2131
2166
|
return e.length <= 1 ? e[0] ?? "" : `${e.slice(0, -1).join(", ")} and ${e.at(-1) ?? ""}`;
|
|
2132
2167
|
}
|
|
2133
|
-
function
|
|
2134
|
-
let o = X(), c = Array.isArray(e) ? e : [], l = n.children?.[0], f =
|
|
2135
|
-
S.length !== c.length && (w = c.map((e, t) => S[t] ??
|
|
2136
|
-
let [T, E] = d(() => /* @__PURE__ */ new Set()), [
|
|
2168
|
+
function mi({ value: e, onChange: t, field: n, path: r, disabled: i, id: a }) {
|
|
2169
|
+
let o = X(), c = Array.isArray(e) ? e : [], l = n.children?.[0], f = $r(n), p = l?.kind === "union" ? l.variants ?? [] : null, m = l?.kind === "object" || p !== null || ni(l), h = n.constraints?.max, g = h !== void 0 && c.length >= h, _ = u(null), v = u(null), y = u(/* @__PURE__ */ new Map()), [b, x] = d(null), [S, C] = d(() => c.map(() => di())), w = S;
|
|
2170
|
+
S.length !== c.length && (w = c.map((e, t) => S[t] ?? di()), C(w));
|
|
2171
|
+
let [T, E] = d(() => /* @__PURE__ */ new Set()), [ee, te] = d(null), D = (e, t) => {
|
|
2137
2172
|
E((n) => {
|
|
2138
2173
|
if (n.has(e) === t) return n;
|
|
2139
2174
|
let r = new Set(n);
|
|
2140
2175
|
return t ? r.add(e) : r.delete(e), r;
|
|
2141
2176
|
});
|
|
2142
|
-
}, [
|
|
2143
|
-
if (
|
|
2144
|
-
|
|
2145
|
-
let e = w.filter((e, t) =>
|
|
2177
|
+
}, [O, ne] = d(o.issues);
|
|
2178
|
+
if (O !== o.issues) {
|
|
2179
|
+
ne(o.issues);
|
|
2180
|
+
let e = w.filter((e, t) => ci(o.issues, mr([...r, t])) > 0);
|
|
2146
2181
|
e.length > 0 && E((t) => /* @__PURE__ */ new Set([...t, ...e]));
|
|
2147
2182
|
}
|
|
2148
2183
|
s(() => {
|
|
@@ -2152,66 +2187,66 @@ function di({ value: e, onChange: t, field: n, path: r, disabled: i, id: a }) {
|
|
|
2152
2187
|
let n = t.target, r = [...e.children].findIndex((e) => e.contains(n)), i = w[r];
|
|
2153
2188
|
i && E((e) => e.has(i) ? e : /* @__PURE__ */ new Set([...e, i]));
|
|
2154
2189
|
};
|
|
2155
|
-
return e.addEventListener(
|
|
2156
|
-
e.removeEventListener(
|
|
2190
|
+
return e.addEventListener(zr, t), () => {
|
|
2191
|
+
e.removeEventListener(zr, t);
|
|
2157
2192
|
};
|
|
2158
2193
|
}, [w]);
|
|
2159
|
-
let
|
|
2194
|
+
let k = (e) => {
|
|
2160
2195
|
_.current && (_.current.textContent = e);
|
|
2161
|
-
},
|
|
2196
|
+
}, A = (e) => {
|
|
2162
2197
|
setTimeout(() => {
|
|
2163
2198
|
e()?.focus();
|
|
2164
2199
|
}, 0);
|
|
2165
|
-
},
|
|
2200
|
+
}, re = (e) => document.getElementById(`${a}-more-${e}`)?.querySelector("button") ?? null, j = (e) => () => m ? document.getElementById(`${a}-row-${e}`) : re(e), M = (e) => {
|
|
2166
2201
|
t(e.length === 0 && !n.required ? void 0 : e);
|
|
2167
|
-
},
|
|
2168
|
-
if (p && l) return
|
|
2169
|
-
let { name: r, key: i } =
|
|
2202
|
+
}, N = (e, t) => {
|
|
2203
|
+
if (p && l) return Jr(e, l);
|
|
2204
|
+
let { name: r, key: i } = oi(e, t, n);
|
|
2170
2205
|
return {
|
|
2171
2206
|
name: r,
|
|
2172
|
-
detail: l && m ?
|
|
2207
|
+
detail: l && m ? si(e, l, i) : ""
|
|
2173
2208
|
};
|
|
2174
|
-
},
|
|
2209
|
+
}, P = (e) => N(c[e] ?? null, e).name, ie = (e) => p?.find((t) => t.value === e), F = (e, t) => {
|
|
2175
2210
|
if (t < 0 || t >= c.length || i) return;
|
|
2176
|
-
let n =
|
|
2211
|
+
let n = P(e), r = [...c], [a] = r.splice(e, 1);
|
|
2177
2212
|
r.splice(t, 0, a ?? null);
|
|
2178
|
-
let o = [...w], [s =
|
|
2179
|
-
o.splice(t, 0, s), C(o),
|
|
2180
|
-
},
|
|
2213
|
+
let o = [...w], [s = di()] = o.splice(e, 1);
|
|
2214
|
+
o.splice(t, 0, s), C(o), M(r), k(`Moved ${n} to position ${String(t + 1)} of ${String(r.length)}.`), A(j(s));
|
|
2215
|
+
}, ae = (e) => {
|
|
2181
2216
|
if (g) return;
|
|
2182
|
-
let t = structuredClone(c[e] ?? null), n =
|
|
2217
|
+
let t = structuredClone(c[e] ?? null), n = di();
|
|
2183
2218
|
C([
|
|
2184
2219
|
...w.slice(0, e + 1),
|
|
2185
2220
|
n,
|
|
2186
2221
|
...w.slice(e + 1)
|
|
2187
|
-
]),
|
|
2222
|
+
]), M([
|
|
2188
2223
|
...c.slice(0, e + 1),
|
|
2189
2224
|
t,
|
|
2190
2225
|
...c.slice(e + 1)
|
|
2191
|
-
]),
|
|
2192
|
-
},
|
|
2193
|
-
let t =
|
|
2194
|
-
C(n),
|
|
2226
|
+
]), k(`Duplicated ${P(e)} as ${f.one} ${String(e + 2)}.`), A(j(n));
|
|
2227
|
+
}, oe = (e) => {
|
|
2228
|
+
let t = P(e), n = w.filter((t, n) => n !== e), r = c.filter((t, n) => n !== e);
|
|
2229
|
+
C(n), M(r), k(`Removed ${t}.`);
|
|
2195
2230
|
let i = n[Math.min(e, r.length - 1)];
|
|
2196
|
-
|
|
2197
|
-
},
|
|
2231
|
+
A(i ? j(i) : () => document.getElementById(`${a}-add`));
|
|
2232
|
+
}, se = (e, t) => {
|
|
2198
2233
|
if (g || i) return;
|
|
2199
|
-
let n =
|
|
2234
|
+
let n = di();
|
|
2200
2235
|
C([
|
|
2201
2236
|
...w.slice(0, e),
|
|
2202
2237
|
n,
|
|
2203
2238
|
...w.slice(e)
|
|
2204
|
-
]), m &&
|
|
2205
|
-
let r = t && l ?
|
|
2206
|
-
|
|
2239
|
+
]), m && D(n, !0);
|
|
2240
|
+
let r = t && l ? Hr(l, t) : li(l);
|
|
2241
|
+
M([
|
|
2207
2242
|
...c.slice(0, e),
|
|
2208
2243
|
r,
|
|
2209
2244
|
...c.slice(e)
|
|
2210
2245
|
]);
|
|
2211
2246
|
let o = `${f.one} ${String(e + 1)}`;
|
|
2212
|
-
|
|
2213
|
-
}, [
|
|
2214
|
-
let t = v.current, n =
|
|
2247
|
+
k(t ? `Added ${t.label}, ${o} of ${String(c.length + 1)}.` : `Added ${o}.`), A(() => document.getElementById(`${a}-panel-${n}`)?.querySelector("input, textarea, [contenteditable=\"true\"], button") ?? j(n)());
|
|
2248
|
+
}, [ce, le] = d(null), [ue, I] = d(null), de = (e) => {
|
|
2249
|
+
let t = v.current, n = ce === null ? -1 : w.indexOf(ce);
|
|
2215
2250
|
if (!t || n === -1) return null;
|
|
2216
2251
|
let r = t.getBoundingClientRect(), i = [...t.children].map((e) => e.getBoundingClientRect()), a = i.findIndex((t) => r.top + e < t.top + t.height / 2), o = a === -1 ? i.length : a, s = i[o - 1], c = i[o];
|
|
2217
2252
|
if (o === n || o === n + 1 || !s && !c) return null;
|
|
@@ -2222,46 +2257,46 @@ function di({ value: e, onChange: t, field: n, path: r, disabled: i, id: a }) {
|
|
|
2222
2257
|
};
|
|
2223
2258
|
}, { dropProps: fe } = Ne({
|
|
2224
2259
|
ref: v,
|
|
2225
|
-
isDisabled:
|
|
2260
|
+
isDisabled: ce === null,
|
|
2226
2261
|
hasDropButton: !0,
|
|
2227
|
-
getDropOperation: (e) => e.has(
|
|
2262
|
+
getDropOperation: (e) => e.has(fi) ? "move" : "cancel",
|
|
2228
2263
|
onDropEnter: ({ y: e }) => {
|
|
2229
|
-
|
|
2264
|
+
I(de(e));
|
|
2230
2265
|
},
|
|
2231
2266
|
onDropMove: ({ y: e }) => {
|
|
2232
2267
|
let t = de(e);
|
|
2233
|
-
|
|
2268
|
+
I((e) => e?.slot === t?.slot ? e : t);
|
|
2234
2269
|
},
|
|
2235
2270
|
onDropExit: () => {
|
|
2236
|
-
|
|
2271
|
+
I(null);
|
|
2237
2272
|
},
|
|
2238
2273
|
onDrop: ({ y: e }) => {
|
|
2239
|
-
let t = de(e), n =
|
|
2240
|
-
|
|
2274
|
+
let t = de(e), n = ce === null ? -1 : w.indexOf(ce);
|
|
2275
|
+
I(null), t && n !== -1 && F(n, t.slot > n ? t.slot - 1 : t.slot);
|
|
2241
2276
|
}
|
|
2242
2277
|
}), pe = i ? void 0 : (e) => ({
|
|
2243
2278
|
onStart: () => {
|
|
2244
|
-
|
|
2279
|
+
le(e);
|
|
2245
2280
|
},
|
|
2246
2281
|
onEnd: () => {
|
|
2247
|
-
|
|
2282
|
+
le(null), I(null);
|
|
2248
2283
|
}
|
|
2249
2284
|
}), me = (e, t, n = !1) => {
|
|
2250
2285
|
let r = w[e];
|
|
2251
2286
|
if (!l || !r || i) return;
|
|
2252
|
-
let a = c[e] ?? null, o = y.current.get(r) ?? /* @__PURE__ */ new Map(), s =
|
|
2287
|
+
let a = c[e] ?? null, o = y.current.get(r) ?? /* @__PURE__ */ new Map(), s = Wr(l, a, t, o.get(t.value));
|
|
2253
2288
|
if (s.dropped.length > 0 && !n) {
|
|
2254
2289
|
x({
|
|
2255
2290
|
index: e,
|
|
2256
2291
|
itemId: r,
|
|
2257
|
-
from:
|
|
2292
|
+
from: P(e),
|
|
2258
2293
|
to: t,
|
|
2259
2294
|
dropped: s.dropped
|
|
2260
2295
|
});
|
|
2261
2296
|
return;
|
|
2262
2297
|
}
|
|
2263
2298
|
let u = ot(l, a);
|
|
2264
|
-
u && B(a) && o.set(u.value, a), y.current.set(r, o),
|
|
2299
|
+
u && B(a) && o.set(u.value, a), y.current.set(r, o), M(c.map((t, n) => n === e ? s.value : t)), k(`Changed to ${t.label}. ${Gr(s)}`.trim()), A(j(r));
|
|
2265
2300
|
}, he = (e, t) => (p ?? []).filter((e) => e.value !== t).map((t) => ({
|
|
2266
2301
|
id: `${e}:${t.value}`,
|
|
2267
2302
|
label: t.label,
|
|
@@ -2316,19 +2351,19 @@ function di({ value: e, onChange: t, field: n, path: r, disabled: i, id: a }) {
|
|
|
2316
2351
|
...n
|
|
2317
2352
|
];
|
|
2318
2353
|
}, _e = (e) => (t) => {
|
|
2319
|
-
t === "up" &&
|
|
2320
|
-
let n = t.startsWith("below:") ?
|
|
2321
|
-
n &&
|
|
2322
|
-
let r = t.startsWith("change:") ?
|
|
2354
|
+
t === "up" && F(e, e - 1), t === "down" && F(e, e + 1), t === "duplicate" && ae(e), t === "remove" && oe(e);
|
|
2355
|
+
let n = t.startsWith("below:") ? ie(t.slice(6)) : void 0;
|
|
2356
|
+
n && se(e + 1, n);
|
|
2357
|
+
let r = t.startsWith("change:") ? ie(t.slice(7)) : void 0;
|
|
2323
2358
|
r && me(e, r);
|
|
2324
|
-
}, ve = (e, t, n) => /* @__PURE__ */ R(
|
|
2359
|
+
}, ve = (e, t, n) => /* @__PURE__ */ R(hi, {
|
|
2325
2360
|
id: `${a}-more-${t}`,
|
|
2326
2361
|
label: `Actions for ${n}`,
|
|
2327
2362
|
items: ge(e),
|
|
2328
2363
|
onAction: _e(e),
|
|
2329
|
-
isOpen:
|
|
2364
|
+
isOpen: ee === t,
|
|
2330
2365
|
onOpenChange: (e) => {
|
|
2331
|
-
|
|
2366
|
+
te(e ? t : null);
|
|
2332
2367
|
}
|
|
2333
2368
|
}), ye = `Add ${f.one}`, be = c.length > 0 && w.every((e) => T.has(e));
|
|
2334
2369
|
return /* @__PURE__ */ z("div", {
|
|
@@ -2353,41 +2388,41 @@ function di({ value: e, onChange: t, field: n, path: r, disabled: i, id: a }) {
|
|
|
2353
2388
|
ref: v,
|
|
2354
2389
|
className: V("flex flex-col", m ? "gap-2" : "gap-3"),
|
|
2355
2390
|
children: c.map((e, t) => {
|
|
2356
|
-
let n = w[t] ?? String(t), { name: i, detail: s } =
|
|
2391
|
+
let n = w[t] ?? String(t), { name: i, detail: s } = N(e, t), c = p && s ? `${i}, ${s}` : i;
|
|
2357
2392
|
if (!l) return null;
|
|
2358
2393
|
if (!m) return /* @__PURE__ */ z("li", {
|
|
2359
2394
|
className: "flex items-end gap-2",
|
|
2360
2395
|
children: [/* @__PURE__ */ R("div", {
|
|
2361
2396
|
className: "min-w-0 flex-1",
|
|
2362
|
-
children: /* @__PURE__ */ R(
|
|
2397
|
+
children: /* @__PURE__ */ R(Wa, {
|
|
2363
2398
|
field: l,
|
|
2364
2399
|
path: [...r, t],
|
|
2365
|
-
label: `${
|
|
2400
|
+
label: `${ei(f.one)} ${String(t + 1)}`,
|
|
2366
2401
|
item: "inline"
|
|
2367
2402
|
})
|
|
2368
2403
|
}), ve(t, n, c)]
|
|
2369
2404
|
}, n);
|
|
2370
|
-
let u =
|
|
2371
|
-
return /* @__PURE__ */ R("li", { children: /* @__PURE__ */ R(
|
|
2405
|
+
let u = mr([...r, t]);
|
|
2406
|
+
return /* @__PURE__ */ R("li", { children: /* @__PURE__ */ R(vi, {
|
|
2372
2407
|
id: a,
|
|
2373
2408
|
itemId: n,
|
|
2374
2409
|
name: i,
|
|
2375
2410
|
detail: s,
|
|
2376
|
-
problems:
|
|
2377
|
-
notes:
|
|
2378
|
-
image:
|
|
2411
|
+
problems: ci(o.issues, u),
|
|
2412
|
+
notes: ci(o.notes, u),
|
|
2413
|
+
image: ni(l) ? ii(e) : null,
|
|
2379
2414
|
headingLevel: r.length === 1 ? 3 : null,
|
|
2380
2415
|
isOpen: T.has(n),
|
|
2381
2416
|
onOpenChange: (e) => {
|
|
2382
|
-
|
|
2417
|
+
D(n, e);
|
|
2383
2418
|
},
|
|
2384
2419
|
onKeyDown: (e) => {
|
|
2385
|
-
e.altKey && e.key === "ArrowUp" ? (e.preventDefault(),
|
|
2420
|
+
e.altKey && e.key === "ArrowUp" ? (e.preventDefault(), F(t, t - 1)) : e.altKey && e.key === "ArrowDown" ? (e.preventDefault(), F(t, t + 1)) : e.shiftKey && e.key === "F10" || e.key === "ContextMenu" ? (e.preventDefault(), te(n)) : e.continuePropagation();
|
|
2386
2421
|
},
|
|
2387
2422
|
menu: ve(t, n, c),
|
|
2388
2423
|
drag: pe?.(n),
|
|
2389
2424
|
editor: o,
|
|
2390
|
-
children: /* @__PURE__ */ R(
|
|
2425
|
+
children: /* @__PURE__ */ R(Wa, {
|
|
2391
2426
|
field: l,
|
|
2392
2427
|
path: [...r, t],
|
|
2393
2428
|
label: i,
|
|
@@ -2396,10 +2431,10 @@ function di({ value: e, onChange: t, field: n, path: r, disabled: i, id: a }) {
|
|
|
2396
2431
|
}) }, n);
|
|
2397
2432
|
})
|
|
2398
2433
|
}),
|
|
2399
|
-
|
|
2434
|
+
ue && /* @__PURE__ */ R("span", {
|
|
2400
2435
|
"aria-hidden": "true",
|
|
2401
2436
|
className: "pointer-events-none absolute inset-x-0 h-0.5 -translate-y-1/2 rounded-full bg-accent",
|
|
2402
|
-
style: { top:
|
|
2437
|
+
style: { top: ue.top }
|
|
2403
2438
|
}),
|
|
2404
2439
|
/* @__PURE__ */ z("div", {
|
|
2405
2440
|
className: "flex flex-col items-start gap-1",
|
|
@@ -2413,22 +2448,22 @@ function di({ value: e, onChange: t, field: n, path: r, disabled: i, id: a }) {
|
|
|
2413
2448
|
}),
|
|
2414
2449
|
items: he("add"),
|
|
2415
2450
|
onAction: (e) => {
|
|
2416
|
-
let t =
|
|
2417
|
-
t &&
|
|
2451
|
+
let t = ie(e.slice(4));
|
|
2452
|
+
t && se(c.length, t);
|
|
2418
2453
|
}
|
|
2419
2454
|
}) : /* @__PURE__ */ R(K, {
|
|
2420
2455
|
id: `${a}-add`,
|
|
2421
2456
|
icon: "add",
|
|
2422
2457
|
isDisabled: i || g,
|
|
2423
2458
|
onPress: () => {
|
|
2424
|
-
|
|
2459
|
+
se(c.length, p?.[0]);
|
|
2425
2460
|
},
|
|
2426
2461
|
children: ye
|
|
2427
2462
|
}), g && /* @__PURE__ */ z("p", {
|
|
2428
2463
|
className: "text-small text-content-muted",
|
|
2429
2464
|
children: [
|
|
2430
2465
|
"At most ",
|
|
2431
|
-
|
|
2466
|
+
cr(h, f.one, f.many),
|
|
2432
2467
|
"."
|
|
2433
2468
|
]
|
|
2434
2469
|
})]
|
|
@@ -2448,7 +2483,7 @@ function di({ value: e, onChange: t, field: n, path: r, disabled: i, id: a }) {
|
|
|
2448
2483
|
children: b && /* @__PURE__ */ z(L, { children: [/* @__PURE__ */ z("p", {
|
|
2449
2484
|
className: "mb-6",
|
|
2450
2485
|
children: [
|
|
2451
|
-
|
|
2486
|
+
pi(b.dropped),
|
|
2452
2487
|
" ",
|
|
2453
2488
|
b.dropped.length === 1 ? "has" : "have",
|
|
2454
2489
|
" no place in",
|
|
@@ -2465,7 +2500,7 @@ function di({ value: e, onChange: t, field: n, path: r, disabled: i, id: a }) {
|
|
|
2465
2500
|
className: "flex flex-wrap justify-end gap-3",
|
|
2466
2501
|
children: [/* @__PURE__ */ R(K, {
|
|
2467
2502
|
onPress: () => {
|
|
2468
|
-
x(null), j(
|
|
2503
|
+
x(null), A(j(b.itemId));
|
|
2469
2504
|
},
|
|
2470
2505
|
children: "Cancel"
|
|
2471
2506
|
}), /* @__PURE__ */ z(K, {
|
|
@@ -2480,7 +2515,7 @@ function di({ value: e, onChange: t, field: n, path: r, disabled: i, id: a }) {
|
|
|
2480
2515
|
]
|
|
2481
2516
|
});
|
|
2482
2517
|
}
|
|
2483
|
-
function
|
|
2518
|
+
function hi(e) {
|
|
2484
2519
|
let { id: t, ...n } = e;
|
|
2485
2520
|
return /* @__PURE__ */ R("span", {
|
|
2486
2521
|
id: t,
|
|
@@ -2488,8 +2523,8 @@ function fi(e) {
|
|
|
2488
2523
|
children: /* @__PURE__ */ R(On, { ...n })
|
|
2489
2524
|
});
|
|
2490
2525
|
}
|
|
2491
|
-
function
|
|
2492
|
-
let n =
|
|
2526
|
+
function gi({ src: e, entryPath: t }) {
|
|
2527
|
+
let n = Lr(e ? et(e, t) : null);
|
|
2493
2528
|
return n ? /* @__PURE__ */ R("img", {
|
|
2494
2529
|
src: n,
|
|
2495
2530
|
alt: "",
|
|
@@ -2499,7 +2534,7 @@ function pi({ src: e, entryPath: t }) {
|
|
|
2499
2534
|
className: "size-10 shrink-0 rounded-sm bg-surface-sunken"
|
|
2500
2535
|
});
|
|
2501
2536
|
}
|
|
2502
|
-
function
|
|
2537
|
+
function _i({ dragProps: e, header: t }) {
|
|
2503
2538
|
return /* @__PURE__ */ R("span", {
|
|
2504
2539
|
...e,
|
|
2505
2540
|
"aria-hidden": "true",
|
|
@@ -2514,11 +2549,11 @@ function mi({ dragProps: e, header: t }) {
|
|
|
2514
2549
|
children: /* @__PURE__ */ R(G, { name: "drag" })
|
|
2515
2550
|
});
|
|
2516
2551
|
}
|
|
2517
|
-
function
|
|
2552
|
+
function vi({ id: e, itemId: t, name: n, detail: r, problems: i, notes: a, image: o, headingLevel: s, isOpen: c, onOpenChange: l, onKeyDown: d, menu: p, drag: m, editor: h, children: g }) {
|
|
2518
2553
|
let _ = u(null), { dragProps: v, isDragging: y } = je({
|
|
2519
2554
|
isDisabled: !m,
|
|
2520
2555
|
hasDragButton: !0,
|
|
2521
|
-
getItems: () => [{ [
|
|
2556
|
+
getItems: () => [{ [fi]: t }],
|
|
2522
2557
|
getAllowedDropOperations: () => ["move"],
|
|
2523
2558
|
onDragStart: () => m?.onStart(),
|
|
2524
2559
|
onDragEnd: () => m?.onEnd()
|
|
@@ -2529,7 +2564,7 @@ function hi({ id: e, itemId: t, name: n, detail: r, problems: i, notes: a, image
|
|
|
2529
2564
|
className: V("flex min-h-11 w-full min-w-0 items-center gap-2 rounded-md py-1 pl-2 text-left text-body text-content", H),
|
|
2530
2565
|
children: [
|
|
2531
2566
|
/* @__PURE__ */ R(q, { className: "shrink-0 -rotate-90 group-data-[expanded]:rotate-0" }),
|
|
2532
|
-
o !== null && /* @__PURE__ */ R(
|
|
2567
|
+
o !== null && /* @__PURE__ */ R(gi, {
|
|
2533
2568
|
src: o,
|
|
2534
2569
|
entryPath: h.entryPath
|
|
2535
2570
|
}),
|
|
@@ -2556,7 +2591,7 @@ function hi({ id: e, itemId: t, name: n, detail: r, problems: i, notes: a, image
|
|
|
2556
2591
|
children: ","
|
|
2557
2592
|
}),
|
|
2558
2593
|
" ",
|
|
2559
|
-
|
|
2594
|
+
cr(i, "problem", "problems")
|
|
2560
2595
|
]
|
|
2561
2596
|
}),
|
|
2562
2597
|
a > 0 && /* @__PURE__ */ z("span", {
|
|
@@ -2567,7 +2602,7 @@ function hi({ id: e, itemId: t, name: n, detail: r, problems: i, notes: a, image
|
|
|
2567
2602
|
children: ","
|
|
2568
2603
|
}),
|
|
2569
2604
|
" ",
|
|
2570
|
-
|
|
2605
|
+
cr(a, "note", "notes")
|
|
2571
2606
|
]
|
|
2572
2607
|
})
|
|
2573
2608
|
]
|
|
@@ -2581,7 +2616,7 @@ function hi({ id: e, itemId: t, name: n, detail: r, problems: i, notes: a, image
|
|
|
2581
2616
|
ref: _,
|
|
2582
2617
|
className: V("flex items-center gap-1 rounded-md bg-surface-raised pr-1", !c && "hover:bg-surface-sunken"),
|
|
2583
2618
|
children: [
|
|
2584
|
-
m && /* @__PURE__ */ R(
|
|
2619
|
+
m && /* @__PURE__ */ R(_i, {
|
|
2585
2620
|
dragProps: v,
|
|
2586
2621
|
header: _
|
|
2587
2622
|
}),
|
|
@@ -2604,7 +2639,7 @@ function hi({ id: e, itemId: t, name: n, detail: r, problems: i, notes: a, image
|
|
|
2604
2639
|
}
|
|
2605
2640
|
//#endregion
|
|
2606
2641
|
//#region src/widgets/icon.tsx
|
|
2607
|
-
function
|
|
2642
|
+
function yi({ value: e, onChange: t, field: n, id: r, describedBy: i, invalid: a, disabled: o }) {
|
|
2608
2643
|
let { manifest: s } = J(), c = l(() => {
|
|
2609
2644
|
let e = s.icons ?? {};
|
|
2610
2645
|
return (n.constraints?.options ?? []).map((t) => {
|
|
@@ -2632,7 +2667,7 @@ function gi({ value: e, onChange: t, field: n, id: r, describedBy: i, invalid: a
|
|
|
2632
2667
|
}
|
|
2633
2668
|
//#endregion
|
|
2634
2669
|
//#region src/a11y/FieldNotes.tsx
|
|
2635
|
-
function
|
|
2670
|
+
function bi({ note: e }) {
|
|
2636
2671
|
return /* @__PURE__ */ z(L, { children: [
|
|
2637
2672
|
e.subject ? `${e.subject}: ` : "",
|
|
2638
2673
|
e.message,
|
|
@@ -2643,24 +2678,24 @@ function _i({ note: e }) {
|
|
|
2643
2678
|
})
|
|
2644
2679
|
] });
|
|
2645
2680
|
}
|
|
2646
|
-
function
|
|
2681
|
+
function xi({ id: e, notes: t }) {
|
|
2647
2682
|
return /* @__PURE__ */ R("ul", {
|
|
2648
2683
|
id: e,
|
|
2649
2684
|
className: "m-0 flex list-none flex-col gap-1 p-0",
|
|
2650
2685
|
children: t.map((e, t) => /* @__PURE__ */ R("li", {
|
|
2651
2686
|
className: "flex gap-2 text-small text-content",
|
|
2652
|
-
children: /* @__PURE__ */ R(
|
|
2687
|
+
children: /* @__PURE__ */ R(Ci, { children: /* @__PURE__ */ R(bi, { note: e }) })
|
|
2653
2688
|
}, `${e.rule}:${String(t)}`))
|
|
2654
2689
|
});
|
|
2655
2690
|
}
|
|
2656
|
-
function
|
|
2691
|
+
function Si({ id: e, children: t }) {
|
|
2657
2692
|
return /* @__PURE__ */ R("p", {
|
|
2658
2693
|
id: e,
|
|
2659
2694
|
className: "flex gap-2 text-small text-content",
|
|
2660
|
-
children: /* @__PURE__ */ R(
|
|
2695
|
+
children: /* @__PURE__ */ R(Ci, { children: t })
|
|
2661
2696
|
});
|
|
2662
2697
|
}
|
|
2663
|
-
function
|
|
2698
|
+
function Ci({ children: e }) {
|
|
2664
2699
|
return /* @__PURE__ */ z(L, { children: [/* @__PURE__ */ R(G, {
|
|
2665
2700
|
name: "warning",
|
|
2666
2701
|
size: 16,
|
|
@@ -2673,7 +2708,7 @@ function bi({ children: e }) {
|
|
|
2673
2708
|
//#endregion
|
|
2674
2709
|
//#region src/media/formats.ts
|
|
2675
2710
|
var Q = (e, t, n) => String.fromCharCode(...e.subarray(t, t + n));
|
|
2676
|
-
function
|
|
2711
|
+
function wi(e) {
|
|
2677
2712
|
if (e[0] === 255 && e[1] === 216 && e[2] === 255) return "jpeg";
|
|
2678
2713
|
if (Q(e, 0, 8) === "PNG\r\n\n") return "png";
|
|
2679
2714
|
if (Q(e, 0, 4) === "GIF8") return "gif";
|
|
@@ -2700,7 +2735,7 @@ function xi(e) {
|
|
|
2700
2735
|
function $(e) {
|
|
2701
2736
|
return new DataView(e.buffer, e.byteOffset, e.byteLength);
|
|
2702
2737
|
}
|
|
2703
|
-
function
|
|
2738
|
+
function Ti(e) {
|
|
2704
2739
|
let t = [], n = 2;
|
|
2705
2740
|
for (; n + 4 <= e.length && e[n] === 255;) {
|
|
2706
2741
|
let r = e[n + 1] ?? 0;
|
|
@@ -2724,7 +2759,7 @@ function Si(e) {
|
|
|
2724
2759
|
dataStart: n
|
|
2725
2760
|
};
|
|
2726
2761
|
}
|
|
2727
|
-
function
|
|
2762
|
+
function Ei(e) {
|
|
2728
2763
|
if (e.length < 8) return { hasLocation: !1 };
|
|
2729
2764
|
let t = Q(e, 0, 2) === "II", n = $(e), r = (e) => n.getUint16(e, t), i = ((e) => n.getUint32(e, t))(4);
|
|
2730
2765
|
if (i + 2 > e.length) return { hasLocation: !1 };
|
|
@@ -2740,19 +2775,19 @@ function Ci(e) {
|
|
|
2740
2775
|
hasLocation: o
|
|
2741
2776
|
};
|
|
2742
2777
|
}
|
|
2743
|
-
var
|
|
2778
|
+
var Di = /* @__PURE__ */ new Set([
|
|
2744
2779
|
224,
|
|
2745
2780
|
226,
|
|
2746
2781
|
238
|
|
2747
2782
|
]);
|
|
2748
|
-
function
|
|
2783
|
+
function Oi(e) {
|
|
2749
2784
|
let t = {
|
|
2750
2785
|
hasLocation: !1,
|
|
2751
2786
|
hasMetadata: !1
|
|
2752
2787
|
};
|
|
2753
|
-
for (let n of
|
|
2788
|
+
for (let n of Ti(e).segments) {
|
|
2754
2789
|
let r = e.subarray(n.start + 4, n.end);
|
|
2755
|
-
n.marker === 225 && Q(r, 0, 6) === "Exif\0\0" && Object.assign(t,
|
|
2790
|
+
n.marker === 225 && Q(r, 0, 6) === "Exif\0\0" && Object.assign(t, Ei(r.subarray(6))), (n.marker >= 225 && n.marker <= 239 && !Di.has(n.marker) || n.marker === 254) && (t.hasMetadata = !0), n.marker >= 192 && n.marker <= 207 && ![
|
|
2756
2791
|
196,
|
|
2757
2792
|
200,
|
|
2758
2793
|
204
|
|
@@ -2760,19 +2795,19 @@ function Ti(e) {
|
|
|
2760
2795
|
}
|
|
2761
2796
|
return t;
|
|
2762
2797
|
}
|
|
2763
|
-
function
|
|
2764
|
-
let { segments: t, dataStart: n } =
|
|
2765
|
-
for (let n of t) n.marker >= 225 && n.marker <= 239 && !
|
|
2766
|
-
return r.push(e.subarray(n)),
|
|
2798
|
+
function ki(e) {
|
|
2799
|
+
let { segments: t, dataStart: n } = Ti(e), r = [e.subarray(0, 2)];
|
|
2800
|
+
for (let n of t) n.marker >= 225 && n.marker <= 239 && !Di.has(n.marker) || n.marker === 254 || r.push(e.subarray(n.start, n.end));
|
|
2801
|
+
return r.push(e.subarray(n)), Ri(r);
|
|
2767
2802
|
}
|
|
2768
|
-
var
|
|
2803
|
+
var Ai = /* @__PURE__ */ new Set([
|
|
2769
2804
|
"eXIf",
|
|
2770
2805
|
"tEXt",
|
|
2771
2806
|
"iTXt",
|
|
2772
2807
|
"zTXt",
|
|
2773
2808
|
"tIME"
|
|
2774
2809
|
]);
|
|
2775
|
-
function
|
|
2810
|
+
function ji(e) {
|
|
2776
2811
|
let t = [], n = 8;
|
|
2777
2812
|
for (; n + 12 <= e.length;) {
|
|
2778
2813
|
let r = $(e).getUint32(n), i = Q(e, n + 4, 4), a = n + 12 + r;
|
|
@@ -2784,23 +2819,23 @@ function Oi(e) {
|
|
|
2784
2819
|
}
|
|
2785
2820
|
return t;
|
|
2786
2821
|
}
|
|
2787
|
-
function
|
|
2788
|
-
let t =
|
|
2822
|
+
function Mi(e) {
|
|
2823
|
+
let t = ji(e), n = t.find((e) => e.type === "IHDR"), r = t.find((e) => e.type === "eXIf");
|
|
2789
2824
|
return {
|
|
2790
2825
|
...n ? {
|
|
2791
2826
|
width: $(e).getUint32(n.start + 8),
|
|
2792
2827
|
height: $(e).getUint32(n.start + 12)
|
|
2793
2828
|
} : {},
|
|
2794
|
-
...r ?
|
|
2795
|
-
hasMetadata: t.some((e) =>
|
|
2829
|
+
...r ? Ei(e.subarray(r.start + 8, r.end - 4)) : { hasLocation: !1 },
|
|
2830
|
+
hasMetadata: t.some((e) => Ai.has(e.type))
|
|
2796
2831
|
};
|
|
2797
2832
|
}
|
|
2798
|
-
function
|
|
2833
|
+
function Ni(e) {
|
|
2799
2834
|
let t = [e.subarray(0, 8)];
|
|
2800
|
-
for (let n of
|
|
2801
|
-
return
|
|
2835
|
+
for (let n of ji(e)) Ai.has(n.type) || t.push(e.subarray(n.start, n.end));
|
|
2836
|
+
return Ri(t);
|
|
2802
2837
|
}
|
|
2803
|
-
function
|
|
2838
|
+
function Pi(e) {
|
|
2804
2839
|
let t = [], n = 12;
|
|
2805
2840
|
for (; n + 8 <= e.length;) {
|
|
2806
2841
|
let r = $(e).getUint32(n + 4, !0), i = n + 8 + r + r % 2;
|
|
@@ -2812,14 +2847,14 @@ function ji(e) {
|
|
|
2812
2847
|
}
|
|
2813
2848
|
return t;
|
|
2814
2849
|
}
|
|
2815
|
-
function
|
|
2816
|
-
let t =
|
|
2850
|
+
function Fi(e) {
|
|
2851
|
+
let t = Pi(e), n = $(e), r = {
|
|
2817
2852
|
hasLocation: !1,
|
|
2818
2853
|
hasMetadata: t.some((e) => e.type === "EXIF" || e.type === "XMP ")
|
|
2819
2854
|
}, i = t.find((e) => e.type === "EXIF");
|
|
2820
2855
|
if (i) {
|
|
2821
2856
|
let t = e.subarray(i.start + 8, i.end);
|
|
2822
|
-
Q(t, 0, 6) === "Exif\0\0" && (t = t.subarray(6)), Object.assign(r,
|
|
2857
|
+
Q(t, 0, 6) === "Exif\0\0" && (t = t.subarray(6)), Object.assign(r, Ei(t));
|
|
2823
2858
|
}
|
|
2824
2859
|
for (let e of t) {
|
|
2825
2860
|
let t = e.start + 8;
|
|
@@ -2839,30 +2874,30 @@ function Mi(e) {
|
|
|
2839
2874
|
}
|
|
2840
2875
|
return r;
|
|
2841
2876
|
}
|
|
2842
|
-
function
|
|
2877
|
+
function Ii(e) {
|
|
2843
2878
|
let t = [];
|
|
2844
|
-
for (let n of
|
|
2879
|
+
for (let n of Pi(e)) {
|
|
2845
2880
|
if (n.type === "EXIF" || n.type === "XMP ") continue;
|
|
2846
2881
|
let r = e.slice(n.start, n.end);
|
|
2847
2882
|
n.type === "VP8X" && (r[8] = (r[8] ?? 0) & -13), t.push(r);
|
|
2848
2883
|
}
|
|
2849
|
-
let n =
|
|
2884
|
+
let n = Ri(t), r = new Uint8Array(12 + n.length);
|
|
2850
2885
|
return r.set(e.subarray(0, 12)), r.set(n, 12), new DataView(r.buffer).setUint32(4, r.length - 8, !0), r;
|
|
2851
2886
|
}
|
|
2852
|
-
function
|
|
2853
|
-
return e === "jpeg" ?
|
|
2887
|
+
function Li(e, t) {
|
|
2888
|
+
return e === "jpeg" ? Oi(t) : e === "png" ? Mi(t) : e === "webp" ? Fi(t) : {
|
|
2854
2889
|
hasLocation: !1,
|
|
2855
2890
|
hasMetadata: !1
|
|
2856
2891
|
};
|
|
2857
2892
|
}
|
|
2858
|
-
function
|
|
2893
|
+
function Ri(e) {
|
|
2859
2894
|
let t = new Uint8Array(e.reduce((e, t) => e + t.length, 0)), n = 0;
|
|
2860
2895
|
for (let r of e) t.set(r, n), n += r.length;
|
|
2861
2896
|
return t;
|
|
2862
2897
|
}
|
|
2863
2898
|
//#endregion
|
|
2864
2899
|
//#region src/media/hygiene.ts
|
|
2865
|
-
var
|
|
2900
|
+
var zi = /* @__PURE__ */ new Set([
|
|
2866
2901
|
"jpeg",
|
|
2867
2902
|
"png",
|
|
2868
2903
|
"gif",
|
|
@@ -2871,36 +2906,36 @@ var Ii = /* @__PURE__ */ new Set([
|
|
|
2871
2906
|
"heic",
|
|
2872
2907
|
"svg"
|
|
2873
2908
|
]);
|
|
2874
|
-
async function
|
|
2875
|
-
let n = t.maxEdge ?? 3e3, r = new Uint8Array(await e.arrayBuffer()), i =
|
|
2876
|
-
if (t.accept === "image" && !
|
|
2909
|
+
async function Bi(e, t = {}) {
|
|
2910
|
+
let n = t.maxEdge ?? 3e3, r = new Uint8Array(await e.arrayBuffer()), i = wi(r);
|
|
2911
|
+
if (t.accept === "image" && !zi.has(i)) return {
|
|
2877
2912
|
ok: !1,
|
|
2878
2913
|
message: `${e.name} isn’t an image this site can use (JPEG, PNG, WebP, AVIF, GIF or SVG).`
|
|
2879
2914
|
};
|
|
2880
2915
|
let a = [], o = r, s = e.name, c, l;
|
|
2881
2916
|
if (i === "svg") {
|
|
2882
|
-
let e =
|
|
2917
|
+
let e = Gi(new TextDecoder().decode(r));
|
|
2883
2918
|
e.removed && a.push("Removed scripts and unsafe links from the SVG"), o = new TextEncoder().encode(e.svg);
|
|
2884
2919
|
} else if (i === "heic") {
|
|
2885
|
-
let e = await
|
|
2920
|
+
let e = await Wi(new Blob([r]), "image/jpeg", n);
|
|
2886
2921
|
if (!e) return {
|
|
2887
2922
|
ok: !1,
|
|
2888
2923
|
message: "This browser can’t convert iPhone (HEIC) photos. Export the photo as JPEG first, or upload it from Safari."
|
|
2889
2924
|
};
|
|
2890
2925
|
o = e.bytes, {width: c, height: l} = e, s = s.replace(/\.(heic|heif)$/i, "") + ".jpg", a.push("Converted from HEIC to JPEG", "Removed location and camera data");
|
|
2891
2926
|
} else if (i === "jpeg" || i === "png" || i === "webp") {
|
|
2892
|
-
let e =
|
|
2927
|
+
let e = Li(i, r);
|
|
2893
2928
|
({width: c, height: l} = e);
|
|
2894
2929
|
let t = (e.orientation ?? 1) !== 1, s = Math.max(e.width ?? 0, e.height ?? 0) > n;
|
|
2895
2930
|
if (t || s) {
|
|
2896
|
-
let u = i === "jpeg" ? "image/jpeg" : i === "png" ? "image/png" : "image/webp", d = await
|
|
2897
|
-
d ? (o = d.bytes, s && a.push(`Resized from ${String(e.width)}×${String(e.height)} to ${String(d.width)}×${String(d.height)}`), t && a.push("Turned the photo upright"), {width: c, height: l} = d) : (o =
|
|
2898
|
-
} else o =
|
|
2931
|
+
let u = i === "jpeg" ? "image/jpeg" : i === "png" ? "image/png" : "image/webp", d = await Wi(new Blob([r], { type: u }), u, n);
|
|
2932
|
+
d ? (o = d.bytes, s && a.push(`Resized from ${String(e.width)}×${String(e.height)} to ${String(d.width)}×${String(d.height)}`), t && a.push("Turned the photo upright"), {width: c, height: l} = d) : (o = Vi(i, r), a.push("Couldn’t resize this image in this browser, so it was kept at full size"));
|
|
2933
|
+
} else o = Vi(i, r);
|
|
2899
2934
|
e.hasLocation ? a.push("Removed location data") : e.hasMetadata && a.push("Removed camera and editing metadata");
|
|
2900
2935
|
}
|
|
2901
2936
|
return o.length > Fe ? {
|
|
2902
2937
|
ok: !1,
|
|
2903
|
-
message: `${s} is ${
|
|
2938
|
+
message: `${s} is ${Hi(o.length)} even after processing. The limit is ${Hi(Fe)}.`
|
|
2904
2939
|
} : {
|
|
2905
2940
|
ok: !0,
|
|
2906
2941
|
upload: {
|
|
@@ -2914,16 +2949,16 @@ async function Li(e, t = {}) {
|
|
|
2914
2949
|
}
|
|
2915
2950
|
};
|
|
2916
2951
|
}
|
|
2917
|
-
function
|
|
2918
|
-
return e === "jpeg" ?
|
|
2952
|
+
function Vi(e, t) {
|
|
2953
|
+
return e === "jpeg" ? ki(t) : e === "png" ? Ni(t) : Ii(t);
|
|
2919
2954
|
}
|
|
2920
|
-
function
|
|
2955
|
+
function Hi(e) {
|
|
2921
2956
|
return `${(e / 1024 / 1024).toFixed(1)} MB`;
|
|
2922
2957
|
}
|
|
2923
|
-
function
|
|
2924
|
-
return e < 1024 ? `${String(e)} bytes` : e < 1048576 ? `${String(Math.round(e / 1024))} KB` :
|
|
2958
|
+
function Ui(e) {
|
|
2959
|
+
return e < 1024 ? `${String(e)} bytes` : e < 1048576 ? `${String(Math.round(e / 1024))} KB` : Hi(e);
|
|
2925
2960
|
}
|
|
2926
|
-
async function
|
|
2961
|
+
async function Wi(e, t, n) {
|
|
2927
2962
|
if (typeof createImageBitmap != "function") return null;
|
|
2928
2963
|
let r;
|
|
2929
2964
|
try {
|
|
@@ -2945,7 +2980,7 @@ async function Vi(e, t, n) {
|
|
|
2945
2980
|
height: o
|
|
2946
2981
|
};
|
|
2947
2982
|
}
|
|
2948
|
-
function
|
|
2983
|
+
function Gi(e) {
|
|
2949
2984
|
let t = lt(window), n = !1;
|
|
2950
2985
|
t.addHook("uponSanitizeElement", (e, t) => {
|
|
2951
2986
|
if (t.tagName === "set" || /^animate/i.test(t.tagName)) {
|
|
@@ -2975,7 +3010,7 @@ function Hi(e) {
|
|
|
2975
3010
|
}
|
|
2976
3011
|
//#endregion
|
|
2977
3012
|
//#region src/media/file-icon.ts
|
|
2978
|
-
var
|
|
3013
|
+
var Ki = [
|
|
2979
3014
|
["file-text", [
|
|
2980
3015
|
"pdf",
|
|
2981
3016
|
"doc",
|
|
@@ -3023,13 +3058,13 @@ var Ui = [
|
|
|
3023
3058
|
"aac"
|
|
3024
3059
|
]]
|
|
3025
3060
|
];
|
|
3026
|
-
function
|
|
3027
|
-
return
|
|
3061
|
+
function qi(e) {
|
|
3062
|
+
return Ki.find(([, t]) => t.includes(e))?.[0] ?? "file";
|
|
3028
3063
|
}
|
|
3029
3064
|
//#endregion
|
|
3030
3065
|
//#region src/media/upload.ts
|
|
3031
|
-
async function
|
|
3032
|
-
let r = await
|
|
3066
|
+
async function Ji(e, t, n) {
|
|
3067
|
+
let r = await Bi(e, n);
|
|
3033
3068
|
if (!r.ok) return {
|
|
3034
3069
|
step: "refused",
|
|
3035
3070
|
message: r.message
|
|
@@ -3047,7 +3082,7 @@ async function Gi(e, t, n) {
|
|
|
3047
3082
|
upload: r.upload
|
|
3048
3083
|
};
|
|
3049
3084
|
}
|
|
3050
|
-
async function
|
|
3085
|
+
async function Yi(e, t, n, r = {}) {
|
|
3051
3086
|
let i = await e.upload(new Blob([t.bytes]), t.name, n, r);
|
|
3052
3087
|
return i.ok ? {
|
|
3053
3088
|
ok: !0,
|
|
@@ -3056,12 +3091,12 @@ async function Ki(e, t, n, r = {}) {
|
|
|
3056
3091
|
}
|
|
3057
3092
|
//#endregion
|
|
3058
3093
|
//#region src/media/MediaPicker.tsx
|
|
3059
|
-
function
|
|
3094
|
+
function Xi({ isOpen: e, onOpenChange: t, kind: n, extensions: r = [], folder: i, onChoose: a }) {
|
|
3060
3095
|
return /* @__PURE__ */ R(Sn, {
|
|
3061
3096
|
title: n === "image" ? "Choose an image" : "Choose a file",
|
|
3062
3097
|
isOpen: e,
|
|
3063
3098
|
onOpenChange: t,
|
|
3064
|
-
children: e && /* @__PURE__ */ R(
|
|
3099
|
+
children: e && /* @__PURE__ */ R(Zi, {
|
|
3065
3100
|
kind: n,
|
|
3066
3101
|
extensions: r,
|
|
3067
3102
|
folder: i,
|
|
@@ -3071,8 +3106,8 @@ function qi({ isOpen: e, onOpenChange: t, kind: n, extensions: r = [], folder: i
|
|
|
3071
3106
|
})
|
|
3072
3107
|
});
|
|
3073
3108
|
}
|
|
3074
|
-
function
|
|
3075
|
-
let { api: i, siteName: a, manifest: o } = J(), s = o.site.images?.maxUploadEdge, [c, f] =
|
|
3109
|
+
function Zi({ kind: e, extensions: t = [], folder: n, onChoose: r }) {
|
|
3110
|
+
let { api: i, siteName: a, manifest: o } = J(), s = o.site.images?.maxUploadEdge, [c, f] = lr(() => i.listMedia(), "media"), [p, m] = d(null), [h, g] = d(""), _ = u(null), v = (n) => e === "image" ? Ke(n) : t.length === 0 || t.includes(Be(n)), y = l(() => {
|
|
3076
3111
|
let e = h.trim().toLowerCase();
|
|
3077
3112
|
return (c.state === "ready" ? c.value : []).filter((e) => v(e.path)).filter((t) => e === "" || t.path.toLowerCase().includes(e));
|
|
3078
3113
|
}, [c, h]), b = async (e) => {
|
|
@@ -3080,7 +3115,7 @@ function Ji({ kind: e, extensions: t = [], folder: n, onChoose: r }) {
|
|
|
3080
3115
|
step: "working",
|
|
3081
3116
|
text: "Uploading…"
|
|
3082
3117
|
});
|
|
3083
|
-
let t = await
|
|
3118
|
+
let t = await Yi(i, e.upload, n, { withNextSave: !0 });
|
|
3084
3119
|
t.ok ? (f(), r(t.path, e.upload.notes)) : m({
|
|
3085
3120
|
step: "refused",
|
|
3086
3121
|
message: t.message
|
|
@@ -3113,7 +3148,7 @@ function Ji({ kind: e, extensions: t = [], folder: n, onChoose: r }) {
|
|
|
3113
3148
|
t.target.value = "", n && (m({
|
|
3114
3149
|
step: "working",
|
|
3115
3150
|
text: `Preparing ${n.name}…`
|
|
3116
|
-
}),
|
|
3151
|
+
}), Ji(n, c.state === "ready" ? c.value : [], {
|
|
3117
3152
|
accept: e === "image" ? "image" : "any",
|
|
3118
3153
|
...s ? { maxEdge: s } : {}
|
|
3119
3154
|
}).then((e) => {
|
|
@@ -3128,7 +3163,7 @@ function Ji({ kind: e, extensions: t = [], folder: n, onChoose: r }) {
|
|
|
3128
3163
|
},
|
|
3129
3164
|
children: e === "image" ? "Upload an image" : "Upload a file"
|
|
3130
3165
|
}) }),
|
|
3131
|
-
/* @__PURE__ */ R(
|
|
3166
|
+
/* @__PURE__ */ R($i, {
|
|
3132
3167
|
step: p,
|
|
3133
3168
|
onUpload: (e) => void b(e),
|
|
3134
3169
|
onReuse: r,
|
|
@@ -3172,7 +3207,7 @@ function Ji({ kind: e, extensions: t = [], folder: n, onChoose: r }) {
|
|
|
3172
3207
|
}),
|
|
3173
3208
|
/* @__PURE__ */ R("ul", {
|
|
3174
3209
|
className: "grid max-h-80 grid-cols-1 gap-2 overflow-y-auto sm:grid-cols-2",
|
|
3175
|
-
children: y.map((e) => /* @__PURE__ */ R("li", { children: /* @__PURE__ */ R(
|
|
3210
|
+
children: y.map((e) => /* @__PURE__ */ R("li", { children: /* @__PURE__ */ R(Qi, {
|
|
3176
3211
|
item: e,
|
|
3177
3212
|
onChoose: r
|
|
3178
3213
|
}) }, e.path))
|
|
@@ -3181,7 +3216,7 @@ function Ji({ kind: e, extensions: t = [], folder: n, onChoose: r }) {
|
|
|
3181
3216
|
})]
|
|
3182
3217
|
});
|
|
3183
3218
|
}
|
|
3184
|
-
function
|
|
3219
|
+
function Qi({ item: e, onChoose: t }) {
|
|
3185
3220
|
let n = e.path.slice(e.path.lastIndexOf("/") + 1);
|
|
3186
3221
|
return /* @__PURE__ */ z("button", {
|
|
3187
3222
|
type: "button",
|
|
@@ -3189,7 +3224,7 @@ function Yi({ item: e, onChoose: t }) {
|
|
|
3189
3224
|
t(e.path);
|
|
3190
3225
|
},
|
|
3191
3226
|
className: "flex w-full items-center gap-3 rounded-md border border-border p-2 text-left hover:bg-surface-sunken focus-visible:outline-2 focus-visible:outline-solid focus-visible:outline-offset-2 focus-visible:outline-focus focus-visible:ring-6 focus-visible:ring-(color:--glow-focus)",
|
|
3192
|
-
children: [Ke(e.path) ? /* @__PURE__ */ R(
|
|
3227
|
+
children: [Ke(e.path) ? /* @__PURE__ */ R(Rr, {
|
|
3193
3228
|
path: e.path,
|
|
3194
3229
|
loading: "lazy",
|
|
3195
3230
|
className: "size-12 shrink-0 rounded-md object-cover"
|
|
@@ -3197,7 +3232,7 @@ function Yi({ item: e, onChoose: t }) {
|
|
|
3197
3232
|
"aria-hidden": "true",
|
|
3198
3233
|
className: "flex size-12 shrink-0 items-center justify-center rounded-md bg-surface-sunken text-content-muted",
|
|
3199
3234
|
children: /* @__PURE__ */ R(G, {
|
|
3200
|
-
name:
|
|
3235
|
+
name: qi(Be(e.path)),
|
|
3201
3236
|
size: 24
|
|
3202
3237
|
})
|
|
3203
3238
|
}), /* @__PURE__ */ z("span", {
|
|
@@ -3210,13 +3245,13 @@ function Yi({ item: e, onChoose: t }) {
|
|
|
3210
3245
|
children: [
|
|
3211
3246
|
e.path.slice(0, e.path.lastIndexOf("/")),
|
|
3212
3247
|
" · ",
|
|
3213
|
-
|
|
3248
|
+
Ui(e.size)
|
|
3214
3249
|
]
|
|
3215
3250
|
})]
|
|
3216
3251
|
})]
|
|
3217
3252
|
});
|
|
3218
3253
|
}
|
|
3219
|
-
function
|
|
3254
|
+
function $i({ step: e, onUpload: t, onReuse: n, onCancel: r }) {
|
|
3220
3255
|
if (!e) return null;
|
|
3221
3256
|
if (e.step === "working") return /* @__PURE__ */ R("p", {
|
|
3222
3257
|
role: "status",
|
|
@@ -3260,7 +3295,7 @@ function Xi({ step: e, onUpload: t, onReuse: n, onCancel: r }) {
|
|
|
3260
3295
|
/* @__PURE__ */ z("p", { children: [
|
|
3261
3296
|
e.upload.name,
|
|
3262
3297
|
" is ",
|
|
3263
|
-
|
|
3298
|
+
Hi(e.upload.bytes.length),
|
|
3264
3299
|
". Large files make the site’s repository and pages heavier. Upload it anyway?"
|
|
3265
3300
|
] }),
|
|
3266
3301
|
i,
|
|
@@ -3282,11 +3317,11 @@ function Xi({ step: e, onUpload: t, onReuse: n, onCancel: r }) {
|
|
|
3282
3317
|
}
|
|
3283
3318
|
//#endregion
|
|
3284
3319
|
//#region src/widgets/crops.tsx
|
|
3285
|
-
function
|
|
3320
|
+
function ea(e) {
|
|
3286
3321
|
return e === "og" ? "Social image" : We(e);
|
|
3287
3322
|
}
|
|
3288
|
-
var
|
|
3289
|
-
function
|
|
3323
|
+
var ta = (e) => Math.round(e * 100);
|
|
3324
|
+
function na(e) {
|
|
3290
3325
|
return {
|
|
3291
3326
|
width: `${String(100 / e.w)}%`,
|
|
3292
3327
|
height: `${String(100 / e.h)}%`,
|
|
@@ -3294,7 +3329,7 @@ function $i(e) {
|
|
|
3294
3329
|
top: `${String(-e.y / e.h * 100)}%`
|
|
3295
3330
|
};
|
|
3296
3331
|
}
|
|
3297
|
-
function
|
|
3332
|
+
function ra({ id: e, src: t, size: n, value: r, ratios: i, onChange: a, disabled: o }) {
|
|
3298
3333
|
let [s, c] = d(null), [l, u] = d("");
|
|
3299
3334
|
if (!n) return /* @__PURE__ */ R("p", {
|
|
3300
3335
|
className: "text-small text-content-muted",
|
|
@@ -3312,7 +3347,7 @@ function ea({ id: e, src: t, size: n, value: r, ratios: i, onChange: a, disabled
|
|
|
3312
3347
|
"aria-label": "Crops",
|
|
3313
3348
|
className: "flex flex-wrap items-end gap-4",
|
|
3314
3349
|
children: i.map(({ name: e, ratio: i }) => {
|
|
3315
|
-
let { rect: a, custom: s } = Le(r, e, i, n), l =
|
|
3350
|
+
let { rect: a, custom: s } = Le(r, e, i, n), l = ea(e);
|
|
3316
3351
|
return /* @__PURE__ */ z("li", { children: [/* @__PURE__ */ z("figure", {
|
|
3317
3352
|
className: "flex flex-col gap-1",
|
|
3318
3353
|
children: [/* @__PURE__ */ R("div", {
|
|
@@ -3323,7 +3358,7 @@ function ea({ id: e, src: t, size: n, value: r, ratios: i, onChange: a, disabled
|
|
|
3323
3358
|
alt: "",
|
|
3324
3359
|
draggable: !1,
|
|
3325
3360
|
className: "absolute max-w-none",
|
|
3326
|
-
style:
|
|
3361
|
+
style: na(a)
|
|
3327
3362
|
})
|
|
3328
3363
|
}), /* @__PURE__ */ z("figcaption", {
|
|
3329
3364
|
className: "text-small text-content",
|
|
@@ -3360,7 +3395,7 @@ function ea({ id: e, src: t, size: n, value: r, ratios: i, onChange: a, disabled
|
|
|
3360
3395
|
className: "sr-only",
|
|
3361
3396
|
children: l
|
|
3362
3397
|
}),
|
|
3363
|
-
s && /* @__PURE__ */ R(
|
|
3398
|
+
s && /* @__PURE__ */ R(ca, {
|
|
3364
3399
|
src: t,
|
|
3365
3400
|
size: n,
|
|
3366
3401
|
name: s.name,
|
|
@@ -3373,30 +3408,30 @@ function ea({ id: e, src: t, size: n, value: r, ratios: i, onChange: a, disabled
|
|
|
3373
3408
|
a({
|
|
3374
3409
|
...r.crops,
|
|
3375
3410
|
[s.name]: rt(e)
|
|
3376
|
-
}), u(`Custom crop applied to ${
|
|
3411
|
+
}), u(`Custom crop applied to ${ea(s.name)}.`);
|
|
3377
3412
|
},
|
|
3378
3413
|
onReset: () => {
|
|
3379
3414
|
let { [s.name]: e, ...t } = r.crops;
|
|
3380
|
-
a(t), u(`${
|
|
3415
|
+
a(t), u(`${ea(s.name)} crop reset to the focal point.`);
|
|
3381
3416
|
}
|
|
3382
3417
|
})
|
|
3383
3418
|
]
|
|
3384
3419
|
});
|
|
3385
3420
|
}
|
|
3386
|
-
function
|
|
3387
|
-
return `${String(
|
|
3421
|
+
function ia(e) {
|
|
3422
|
+
return `${String(ta(e.x))}% from the left, ${String(ta(e.y))}% from the top, ${String(ta(e.w))}% of the width`;
|
|
3388
3423
|
}
|
|
3389
|
-
var
|
|
3424
|
+
var aa = {
|
|
3390
3425
|
ArrowLeft: [-1, 0],
|
|
3391
3426
|
ArrowRight: [1, 0],
|
|
3392
3427
|
ArrowUp: [0, -1],
|
|
3393
3428
|
ArrowDown: [0, 1]
|
|
3394
|
-
},
|
|
3429
|
+
}, oa = {
|
|
3395
3430
|
ArrowRight: 1,
|
|
3396
3431
|
ArrowDown: 1,
|
|
3397
3432
|
ArrowLeft: -1,
|
|
3398
3433
|
ArrowUp: -1
|
|
3399
|
-
},
|
|
3434
|
+
}, sa = [
|
|
3400
3435
|
{
|
|
3401
3436
|
corner: "top-left",
|
|
3402
3437
|
className: "-left-1.5 -top-1.5 cursor-nwse-resize"
|
|
@@ -3414,13 +3449,13 @@ var na = {
|
|
|
3414
3449
|
className: "-bottom-1.5 -right-1.5 cursor-nwse-resize"
|
|
3415
3450
|
}
|
|
3416
3451
|
];
|
|
3417
|
-
function
|
|
3418
|
-
let [l, f] = d(i.rect), [p, m] = d(!1), [h, g] = d(""), _ = u(null), v = u(null), y = u(null), b = `${
|
|
3452
|
+
function ca({ src: e, size: t, name: n, ratio: r, start: i, onClose: a, onApply: o, onReset: s }) {
|
|
3453
|
+
let [l, f] = d(i.rect), [p, m] = d(!1), [h, g] = d(""), _ = u(null), v = u(null), y = u(null), b = `${ea(n)} (${Qe(r)})`;
|
|
3419
3454
|
c(() => {
|
|
3420
3455
|
v.current?.focus();
|
|
3421
3456
|
}, []);
|
|
3422
3457
|
let x = (e, t) => {
|
|
3423
|
-
f(e), m(!0), t && g(`Crop ${
|
|
3458
|
+
f(e), m(!0), t && g(`Crop ${ia(e)}.`);
|
|
3424
3459
|
}, S = (e) => {
|
|
3425
3460
|
(p || i.custom) && o(l), e();
|
|
3426
3461
|
}, C = (e) => {
|
|
@@ -3445,10 +3480,10 @@ function aa({ src: e, size: t, name: n, ratio: r, start: i, onClose: a, onApply:
|
|
|
3445
3480
|
let n = y.current, i = n ? C(e) : null;
|
|
3446
3481
|
n && i && x(n.kind === "move" ? Ye(n.start, i.x - n.from.x, i.y - n.from.y) : ze(n.start, n.corner, i, r, t), !1);
|
|
3447
3482
|
}, E = () => {
|
|
3448
|
-
y.current && (y.current = null, g(`Crop ${
|
|
3483
|
+
y.current && (y.current = null, g(`Crop ${ia(l)}.`));
|
|
3449
3484
|
};
|
|
3450
3485
|
return /* @__PURE__ */ R(Sn, {
|
|
3451
|
-
title: `Adjust the ${
|
|
3486
|
+
title: `Adjust the ${ea(n)} crop`,
|
|
3452
3487
|
size: "wide",
|
|
3453
3488
|
isOpen: !0,
|
|
3454
3489
|
onOpenChange: (e) => {
|
|
@@ -3510,8 +3545,8 @@ function aa({ src: e, size: t, name: n, ratio: r, start: i, onClose: a, onApply:
|
|
|
3510
3545
|
e.preventDefault(), S(n);
|
|
3511
3546
|
return;
|
|
3512
3547
|
}
|
|
3513
|
-
let i =
|
|
3514
|
-
!i || e.altKey || e.ctrlKey || e.metaKey || (e.preventDefault(), x(e.shiftKey ? $e(l, l.w + (
|
|
3548
|
+
let i = aa[e.key];
|
|
3549
|
+
!i || e.altKey || e.ctrlKey || e.metaKey || (e.preventDefault(), x(e.shiftKey ? $e(l, l.w + (oa[e.key] ?? 0) * .01, r, t) : Ye(l, i[0] * .01, i[1] * .01), !0));
|
|
3515
3550
|
},
|
|
3516
3551
|
onPointerDown: w,
|
|
3517
3552
|
onPointerMove: T,
|
|
@@ -3526,7 +3561,7 @@ function aa({ src: e, size: t, name: n, ratio: r, start: i, onClose: a, onApply:
|
|
|
3526
3561
|
children: [/* @__PURE__ */ R("span", {
|
|
3527
3562
|
"aria-hidden": "true",
|
|
3528
3563
|
className: "absolute inset-0 border border-content/60"
|
|
3529
|
-
}),
|
|
3564
|
+
}), sa.map(({ corner: e, className: t }) => /* @__PURE__ */ R("span", {
|
|
3530
3565
|
"aria-hidden": "true",
|
|
3531
3566
|
"data-corner": e,
|
|
3532
3567
|
className: V("absolute size-3 border border-content bg-on-accent", t)
|
|
@@ -3537,7 +3572,7 @@ function aa({ src: e, size: t, name: n, ratio: r, start: i, onClose: a, onApply:
|
|
|
3537
3572
|
/* @__PURE__ */ R("p", {
|
|
3538
3573
|
id: "vesper-crop-position",
|
|
3539
3574
|
className: "sr-only",
|
|
3540
|
-
children:
|
|
3575
|
+
children: ia(l)
|
|
3541
3576
|
}),
|
|
3542
3577
|
/* @__PURE__ */ R("p", {
|
|
3543
3578
|
role: "status",
|
|
@@ -3572,21 +3607,21 @@ function aa({ src: e, size: t, name: n, ratio: r, start: i, onClose: a, onApply:
|
|
|
3572
3607
|
}
|
|
3573
3608
|
//#endregion
|
|
3574
3609
|
//#region src/widgets/focal-point.tsx
|
|
3575
|
-
var
|
|
3576
|
-
function
|
|
3610
|
+
var la = (e) => Math.round(e * 100);
|
|
3611
|
+
function ua(e) {
|
|
3577
3612
|
let t = e ?? Pe;
|
|
3578
|
-
return `${String(
|
|
3613
|
+
return `${String(la(t.x))}% across, ${String(la(t.y))}% down`;
|
|
3579
3614
|
}
|
|
3580
|
-
var
|
|
3615
|
+
var da = {
|
|
3581
3616
|
ArrowLeft: [-1, 0],
|
|
3582
3617
|
ArrowRight: [1, 0],
|
|
3583
3618
|
ArrowUp: [0, -1],
|
|
3584
3619
|
ArrowDown: [0, 1]
|
|
3585
3620
|
};
|
|
3586
|
-
function
|
|
3621
|
+
function fa({ id: e, src: t, focus: n, onChange: r, onImageSize: i, disabled: a }) {
|
|
3587
3622
|
let o = u(null), s = u(!1), [c, l] = d(""), f = n ?? Pe, p = (e, t) => {
|
|
3588
3623
|
let n = nt(e);
|
|
3589
|
-
r(n), t && l(`Focal point ${
|
|
3624
|
+
r(n), t && l(`Focal point ${ua(n)}.`);
|
|
3590
3625
|
}, m = (e, t) => {
|
|
3591
3626
|
let n = o.current?.getBoundingClientRect();
|
|
3592
3627
|
return !n || n.width === 0 || n.height === 0 ? null : {
|
|
@@ -3627,7 +3662,7 @@ function la({ id: e, src: t, focus: n, onChange: r, onImageSize: i, disabled: a
|
|
|
3627
3662
|
t && p(t, !0);
|
|
3628
3663
|
},
|
|
3629
3664
|
onKeyDown: (e) => {
|
|
3630
|
-
let t =
|
|
3665
|
+
let t = da[e.key];
|
|
3631
3666
|
if (!t || a || e.altKey || e.ctrlKey || e.metaKey) return;
|
|
3632
3667
|
e.preventDefault();
|
|
3633
3668
|
let n = e.shiftKey ? .1 : .01;
|
|
@@ -3662,12 +3697,12 @@ function la({ id: e, src: t, focus: n, onChange: r, onImageSize: i, disabled: a
|
|
|
3662
3697
|
}), /* @__PURE__ */ z("div", {
|
|
3663
3698
|
className: "flex flex-col gap-3",
|
|
3664
3699
|
children: [
|
|
3665
|
-
/* @__PURE__ */ R(
|
|
3700
|
+
/* @__PURE__ */ R(pa, {
|
|
3666
3701
|
id: `${e}-focus-x`,
|
|
3667
3702
|
label: "Across (%)",
|
|
3668
3703
|
hint: "0 is the left edge, 100 the right",
|
|
3669
|
-
value: n ?
|
|
3670
|
-
placeholder:
|
|
3704
|
+
value: n ? la(n.x) : void 0,
|
|
3705
|
+
placeholder: la(Pe.x),
|
|
3671
3706
|
disabled: a,
|
|
3672
3707
|
onChange: (e) => {
|
|
3673
3708
|
p({
|
|
@@ -3676,12 +3711,12 @@ function la({ id: e, src: t, focus: n, onChange: r, onImageSize: i, disabled: a
|
|
|
3676
3711
|
}, !1);
|
|
3677
3712
|
}
|
|
3678
3713
|
}),
|
|
3679
|
-
/* @__PURE__ */ R(
|
|
3714
|
+
/* @__PURE__ */ R(pa, {
|
|
3680
3715
|
id: `${e}-focus-y`,
|
|
3681
3716
|
label: "Down (%)",
|
|
3682
3717
|
hint: "0 is the top, 100 the bottom",
|
|
3683
|
-
value: n ?
|
|
3684
|
-
placeholder:
|
|
3718
|
+
value: n ? la(n.y) : void 0,
|
|
3719
|
+
placeholder: la(Pe.y),
|
|
3685
3720
|
disabled: a,
|
|
3686
3721
|
onChange: (e) => {
|
|
3687
3722
|
p({
|
|
@@ -3704,7 +3739,7 @@ function la({ id: e, src: t, focus: n, onChange: r, onImageSize: i, disabled: a
|
|
|
3704
3739
|
/* @__PURE__ */ R("p", {
|
|
3705
3740
|
id: `${e}-focus-position`,
|
|
3706
3741
|
className: "sr-only",
|
|
3707
|
-
children: n ?
|
|
3742
|
+
children: n ? ua(n) : `Not set: the center, ${ua(void 0)}`
|
|
3708
3743
|
}),
|
|
3709
3744
|
/* @__PURE__ */ R("p", {
|
|
3710
3745
|
role: "status",
|
|
@@ -3714,7 +3749,7 @@ function la({ id: e, src: t, focus: n, onChange: r, onImageSize: i, disabled: a
|
|
|
3714
3749
|
]
|
|
3715
3750
|
});
|
|
3716
3751
|
}
|
|
3717
|
-
function
|
|
3752
|
+
function pa({ id: e, label: t, hint: n, value: r, placeholder: i, disabled: a, onChange: o }) {
|
|
3718
3753
|
let [s, c] = d(r === void 0 ? "" : String(r)), [l, u] = d(r);
|
|
3719
3754
|
return r !== l && (u(r), c(r === void 0 ? "" : String(r))), /* @__PURE__ */ z("div", {
|
|
3720
3755
|
className: "flex flex-col gap-1",
|
|
@@ -3752,23 +3787,23 @@ function ua({ id: e, label: t, hint: n, value: r, placeholder: i, disabled: a, o
|
|
|
3752
3787
|
}
|
|
3753
3788
|
//#endregion
|
|
3754
3789
|
//#region src/widgets/image.tsx
|
|
3755
|
-
function
|
|
3790
|
+
function ma(e, t, n) {
|
|
3756
3791
|
return e ? Re(e) : `${t}/assets/${n}`;
|
|
3757
3792
|
}
|
|
3758
|
-
function
|
|
3793
|
+
function ha(e) {
|
|
3759
3794
|
return e.slice(e.lastIndexOf("/") + 1);
|
|
3760
3795
|
}
|
|
3761
|
-
function
|
|
3796
|
+
function ga(e, t) {
|
|
3762
3797
|
let n = e.widgetOptions?.ratios;
|
|
3763
3798
|
return (Array.isArray(n) ? n.filter((e) => typeof e == "string" && e in t) : Object.keys(t)).map((e) => ({
|
|
3764
3799
|
name: e,
|
|
3765
3800
|
ratio: t[e] ?? 1
|
|
3766
3801
|
}));
|
|
3767
3802
|
}
|
|
3768
|
-
function
|
|
3769
|
-
let { manifest: c } = J(), l = X(), [u, f] = d(!1), [p, m] = d([]), [h, g] = d(null), _ = n.kind === "object", v = B(e) ? e : {}, y = _ ? v.src : e, b = typeof y == "string" ? y : "", x = b ? et(b, l.entryPath) : null, S =
|
|
3770
|
-
|
|
3771
|
-
let
|
|
3803
|
+
function _a({ value: e, onChange: t, field: n, id: r, describedBy: i, invalid: a, disabled: o, path: s }) {
|
|
3804
|
+
let { manifest: c } = J(), l = X(), [u, f] = d(!1), [p, m] = d([]), [h, g] = d(null), _ = n.kind === "object", v = B(e) ? e : {}, y = _ ? v.src : e, b = typeof y == "string" ? y : "", x = b ? et(b, l.entryPath) : null, S = Lr(x), C = _ && (n.children ?? []).some((e) => e.path.at(-1) === "alt"), w = _ && (n.children ?? []).some((e) => e.path.at(-1) === "decorative"), T = v.decorative === !0, E = typeof v.alt == "string" ? v.alt : "", ee = (l.notes?.get(mr(s)) ?? []).filter((e) => e.target.kind === "field" && e.target.path[s.length] === "alt"), te = (e) => _ && (n.children ?? []).some((t) => t.path.at(-1) === e), D = te("focus"), O = te("crops"), [ne, k] = d(null), [A, re] = d(b);
|
|
3805
|
+
A !== b && (re(b), k(null));
|
|
3806
|
+
let j = h === b, M = T ? "You replaced the image. Check that it’s still decorative." : "You replaced the image. Check that the alt text still describes it.", N = (e) => {
|
|
3772
3807
|
if (e === x) return;
|
|
3773
3808
|
let n = Je(e, l.entryPath);
|
|
3774
3809
|
if (!_) {
|
|
@@ -3780,7 +3815,7 @@ function ma({ value: e, onChange: t, field: n, id: r, describedBy: i, invalid: a
|
|
|
3780
3815
|
...a,
|
|
3781
3816
|
src: n
|
|
3782
3817
|
}), b && (E !== "" || T) && g(n);
|
|
3783
|
-
},
|
|
3818
|
+
}, P = (e) => {
|
|
3784
3819
|
t(e);
|
|
3785
3820
|
};
|
|
3786
3821
|
return /* @__PURE__ */ z("div", {
|
|
@@ -3804,7 +3839,7 @@ function ma({ value: e, onChange: t, field: n, id: r, describedBy: i, invalid: a
|
|
|
3804
3839
|
children: [/* @__PURE__ */ R("p", {
|
|
3805
3840
|
id: `${r}-file`,
|
|
3806
3841
|
className: "font-mono text-small break-all",
|
|
3807
|
-
children:
|
|
3842
|
+
children: ha(b)
|
|
3808
3843
|
}), /* @__PURE__ */ z("div", {
|
|
3809
3844
|
className: "flex flex-wrap gap-2",
|
|
3810
3845
|
children: [/* @__PURE__ */ R(K, {
|
|
@@ -3860,15 +3895,15 @@ function ma({ value: e, onChange: t, field: n, id: r, describedBy: i, invalid: a
|
|
|
3860
3895
|
rows: 2,
|
|
3861
3896
|
value: E,
|
|
3862
3897
|
onChange: (e) => {
|
|
3863
|
-
g(null),
|
|
3898
|
+
g(null), P({
|
|
3864
3899
|
...v,
|
|
3865
3900
|
alt: e.target.value
|
|
3866
3901
|
});
|
|
3867
3902
|
},
|
|
3868
3903
|
"aria-describedby": [
|
|
3869
3904
|
`${r}-alt-help`,
|
|
3870
|
-
|
|
3871
|
-
|
|
3905
|
+
ee.length > 0 ? `${r}-alt-a11y` : "",
|
|
3906
|
+
j ? `${r}-replaced` : "",
|
|
3872
3907
|
i
|
|
3873
3908
|
].filter(Boolean).join(" "),
|
|
3874
3909
|
"aria-invalid": a || void 0,
|
|
@@ -3881,78 +3916,78 @@ function ma({ value: e, onChange: t, field: n, id: r, describedBy: i, invalid: a
|
|
|
3881
3916
|
className: "text-small text-content-muted",
|
|
3882
3917
|
children: "Describe what this image communicates on this page."
|
|
3883
3918
|
}),
|
|
3884
|
-
|
|
3919
|
+
ee.length > 0 && /* @__PURE__ */ R(xi, {
|
|
3885
3920
|
id: `${r}-alt-a11y`,
|
|
3886
|
-
notes:
|
|
3921
|
+
notes: ee
|
|
3887
3922
|
}),
|
|
3888
|
-
|
|
3923
|
+
j && /* @__PURE__ */ R(Si, {
|
|
3889
3924
|
id: `${r}-replaced`,
|
|
3890
|
-
children:
|
|
3925
|
+
children: M
|
|
3891
3926
|
})
|
|
3892
3927
|
]
|
|
3893
3928
|
}),
|
|
3894
3929
|
w && /* @__PURE__ */ R(Ln, {
|
|
3895
3930
|
isSelected: T,
|
|
3896
3931
|
isDisabled: o,
|
|
3897
|
-
"aria-describedby": T &&
|
|
3932
|
+
"aria-describedby": T && j ? `${r}-replaced` : void 0,
|
|
3898
3933
|
onChange: (e) => {
|
|
3899
|
-
if (g(null), e)
|
|
3934
|
+
if (g(null), e) P({
|
|
3900
3935
|
...v,
|
|
3901
3936
|
alt: "",
|
|
3902
3937
|
decorative: !0
|
|
3903
3938
|
});
|
|
3904
3939
|
else {
|
|
3905
3940
|
let { decorative: e, ...t } = v;
|
|
3906
|
-
|
|
3941
|
+
P(t);
|
|
3907
3942
|
}
|
|
3908
3943
|
},
|
|
3909
3944
|
children: "Decorative image (it adds nothing a reader needs)"
|
|
3910
3945
|
}),
|
|
3911
|
-
w && T &&
|
|
3946
|
+
w && T && j && /* @__PURE__ */ R(Si, {
|
|
3912
3947
|
id: `${r}-replaced`,
|
|
3913
|
-
children:
|
|
3948
|
+
children: M
|
|
3914
3949
|
}),
|
|
3915
|
-
x && (
|
|
3950
|
+
x && (D || O) && /* @__PURE__ */ R(kn, {
|
|
3916
3951
|
title: "Focal point & crops",
|
|
3917
3952
|
children: /* @__PURE__ */ z("div", {
|
|
3918
3953
|
className: "flex flex-col gap-6",
|
|
3919
3954
|
children: [
|
|
3920
|
-
|
|
3955
|
+
D && S && /* @__PURE__ */ R(fa, {
|
|
3921
3956
|
id: r,
|
|
3922
3957
|
src: S,
|
|
3923
3958
|
focus: Ge(v).focus,
|
|
3924
3959
|
disabled: o,
|
|
3925
|
-
onImageSize:
|
|
3960
|
+
onImageSize: k,
|
|
3926
3961
|
onChange: (e) => {
|
|
3927
3962
|
let { focus: t, ...n } = v;
|
|
3928
|
-
|
|
3963
|
+
P(e ? {
|
|
3929
3964
|
...n,
|
|
3930
3965
|
focus: e
|
|
3931
3966
|
} : n);
|
|
3932
3967
|
}
|
|
3933
3968
|
}),
|
|
3934
|
-
|
|
3969
|
+
O && S && /* @__PURE__ */ R(ra, {
|
|
3935
3970
|
id: r,
|
|
3936
3971
|
src: S,
|
|
3937
|
-
size:
|
|
3972
|
+
size: ne,
|
|
3938
3973
|
value: Ge(v),
|
|
3939
|
-
ratios:
|
|
3974
|
+
ratios: ga(n, it(c.site.images?.ratios)),
|
|
3940
3975
|
disabled: o,
|
|
3941
3976
|
onChange: (e) => {
|
|
3942
3977
|
let { crops: t, ...n } = v;
|
|
3943
|
-
|
|
3978
|
+
P(Object.keys(e).length > 0 ? {
|
|
3944
3979
|
...n,
|
|
3945
3980
|
crops: e
|
|
3946
3981
|
} : n);
|
|
3947
3982
|
}
|
|
3948
3983
|
}),
|
|
3949
|
-
|
|
3984
|
+
O && !D && S && /* @__PURE__ */ R("img", {
|
|
3950
3985
|
src: S,
|
|
3951
3986
|
alt: "",
|
|
3952
3987
|
hidden: !0,
|
|
3953
3988
|
onLoad: (e) => {
|
|
3954
3989
|
let { naturalWidth: t, naturalHeight: n } = e.currentTarget;
|
|
3955
|
-
t > 0 && n > 0 &&
|
|
3990
|
+
t > 0 && n > 0 && k({
|
|
3956
3991
|
width: t,
|
|
3957
3992
|
height: n
|
|
3958
3993
|
});
|
|
@@ -3961,13 +3996,13 @@ function ma({ value: e, onChange: t, field: n, id: r, describedBy: i, invalid: a
|
|
|
3961
3996
|
]
|
|
3962
3997
|
})
|
|
3963
3998
|
}),
|
|
3964
|
-
/* @__PURE__ */ R(
|
|
3999
|
+
/* @__PURE__ */ R(Xi, {
|
|
3965
4000
|
isOpen: u,
|
|
3966
4001
|
onOpenChange: f,
|
|
3967
4002
|
kind: "image",
|
|
3968
|
-
folder:
|
|
4003
|
+
folder: ma(x, c.site.srcDir, l.collection.name),
|
|
3969
4004
|
onChoose: (e, t) => {
|
|
3970
|
-
m(t ?? []),
|
|
4005
|
+
m(t ?? []), N(e), requestAnimationFrame(() => {
|
|
3971
4006
|
document.getElementById(r)?.focus();
|
|
3972
4007
|
});
|
|
3973
4008
|
}
|
|
@@ -3975,7 +4010,7 @@ function ma({ value: e, onChange: t, field: n, id: r, describedBy: i, invalid: a
|
|
|
3975
4010
|
]
|
|
3976
4011
|
});
|
|
3977
4012
|
}
|
|
3978
|
-
function
|
|
4013
|
+
function va(e) {
|
|
3979
4014
|
let t = typeof e == "string" ? e.split(",") : Array.isArray(e) ? e : [], n = {
|
|
3980
4015
|
"application/pdf": ["pdf"],
|
|
3981
4016
|
"video/mp4": ["mp4"],
|
|
@@ -3987,8 +4022,8 @@ function ha(e) {
|
|
|
3987
4022
|
return t.startsWith(".") ? [t.slice(1)] : n[t] ?? [];
|
|
3988
4023
|
});
|
|
3989
4024
|
}
|
|
3990
|
-
function
|
|
3991
|
-
let o = X(), [s, c] = d(!1), l = typeof e == "string" ? e : "", u = l ? et(l, o.entryPath) : null, f =
|
|
4025
|
+
function ya({ value: e, onChange: t, field: n, id: r, describedBy: i, disabled: a }) {
|
|
4026
|
+
let o = X(), [s, c] = d(!1), l = typeof e == "string" ? e : "", u = l ? et(l, o.entryPath) : null, f = Lr(u), p = va(n.widgetOptions?.accept);
|
|
3992
4027
|
return /* @__PURE__ */ z("div", {
|
|
3993
4028
|
className: "flex flex-col gap-2",
|
|
3994
4029
|
children: [
|
|
@@ -4001,8 +4036,8 @@ function ga({ value: e, onChange: t, field: n, id: r, describedBy: i, disabled:
|
|
|
4001
4036
|
target: "_blank",
|
|
4002
4037
|
rel: "noopener noreferrer",
|
|
4003
4038
|
className: "text-accent underline underline-offset-2",
|
|
4004
|
-
children:
|
|
4005
|
-
}) :
|
|
4039
|
+
children: ha(l)
|
|
4040
|
+
}) : ha(l),
|
|
4006
4041
|
" ",
|
|
4007
4042
|
/* @__PURE__ */ z("span", {
|
|
4008
4043
|
className: "text-content-muted",
|
|
@@ -4033,7 +4068,7 @@ function ga({ value: e, onChange: t, field: n, id: r, describedBy: i, disabled:
|
|
|
4033
4068
|
children: "Remove file"
|
|
4034
4069
|
})]
|
|
4035
4070
|
}),
|
|
4036
|
-
/* @__PURE__ */ R(
|
|
4071
|
+
/* @__PURE__ */ R(Xi, {
|
|
4037
4072
|
isOpen: s,
|
|
4038
4073
|
onOpenChange: c,
|
|
4039
4074
|
kind: "file",
|
|
@@ -4050,21 +4085,21 @@ function ga({ value: e, onChange: t, field: n, id: r, describedBy: i, disabled:
|
|
|
4050
4085
|
}
|
|
4051
4086
|
//#endregion
|
|
4052
4087
|
//#region src/widgets/reference.tsx
|
|
4053
|
-
function
|
|
4088
|
+
function ba(e) {
|
|
4054
4089
|
if (typeof e == "string") return e;
|
|
4055
4090
|
if (B(e)) {
|
|
4056
4091
|
let t = e.id ?? e.slug;
|
|
4057
4092
|
if (typeof t == "string") return t;
|
|
4058
4093
|
}
|
|
4059
4094
|
}
|
|
4060
|
-
function
|
|
4095
|
+
function xa(e, t) {
|
|
4061
4096
|
return B(e) ? {
|
|
4062
4097
|
...e,
|
|
4063
4098
|
id: t
|
|
4064
4099
|
} : t;
|
|
4065
4100
|
}
|
|
4066
|
-
function
|
|
4067
|
-
let { api: t, collection: n } = J(), r = X(), [i] =
|
|
4101
|
+
function Sa(e) {
|
|
4102
|
+
let { api: t, collection: n } = J(), r = X(), [i] = lr(() => e ? t.listEntries(e) : Promise.resolve([]), e ?? ""), a = l(() => i.state === "ready" ? i.value : [], [i]);
|
|
4068
4103
|
return {
|
|
4069
4104
|
options: l(() => {
|
|
4070
4105
|
let t = a.filter((t) => e !== r.collection.name || t.id !== r.entryId), n = /* @__PURE__ */ new Map();
|
|
@@ -4083,16 +4118,16 @@ function ya(e) {
|
|
|
4083
4118
|
label: (e ? n(e)?.label : void 0) ?? e ?? "entries"
|
|
4084
4119
|
};
|
|
4085
4120
|
}
|
|
4086
|
-
function
|
|
4121
|
+
function Ca(e, t) {
|
|
4087
4122
|
return e.find((e) => e.value === t)?.label ?? `${t} (not found)`;
|
|
4088
4123
|
}
|
|
4089
|
-
function
|
|
4124
|
+
function wa(e) {
|
|
4090
4125
|
return e.reference?.collection ?? e.children?.[0]?.reference?.collection;
|
|
4091
4126
|
}
|
|
4092
|
-
function
|
|
4093
|
-
let { options: s, load: c, label: l } =
|
|
4127
|
+
function Ta({ value: e, onChange: t, field: n, id: r, describedBy: i, invalid: a, disabled: o }) {
|
|
4128
|
+
let { options: s, load: c, label: l } = Sa(wa(n)), u = ba(e), d = u && !s.some((e) => e.value === u) ? [...s, {
|
|
4094
4129
|
value: u,
|
|
4095
|
-
label:
|
|
4130
|
+
label: Ca(s, u)
|
|
4096
4131
|
}] : s;
|
|
4097
4132
|
return /* @__PURE__ */ R(Pn, {
|
|
4098
4133
|
id: r,
|
|
@@ -4101,21 +4136,21 @@ function Sa({ value: e, onChange: t, field: n, id: r, describedBy: i, invalid: a
|
|
|
4101
4136
|
options: d,
|
|
4102
4137
|
value: u ?? null,
|
|
4103
4138
|
onChange: (n) => {
|
|
4104
|
-
t(n === null ? void 0 :
|
|
4139
|
+
t(n === null ? void 0 : xa(e, n));
|
|
4105
4140
|
},
|
|
4106
4141
|
placeholder: c.state === "loading" ? "Loading…" : `Search ${l.toLowerCase()}`,
|
|
4107
4142
|
isInvalid: a,
|
|
4108
4143
|
isDisabled: o
|
|
4109
4144
|
});
|
|
4110
4145
|
}
|
|
4111
|
-
function
|
|
4112
|
-
let { options: s, load: c, label: l } =
|
|
4146
|
+
function Ea({ value: e, onChange: t, field: n, id: r, describedBy: i, invalid: a, disabled: o }) {
|
|
4147
|
+
let { options: s, load: c, label: l } = Sa(wa(n)), d = Array.isArray(e) ? e : [], f = d.map(ba), p = u(null), m = (e) => {
|
|
4113
4148
|
p.current && (p.current.textContent = e);
|
|
4114
4149
|
}, h = (e) => {
|
|
4115
4150
|
t(e.length === 0 && !n.required ? void 0 : e);
|
|
4116
4151
|
}, g = (e, t) => {
|
|
4117
4152
|
let n = [...d], [r] = n.splice(e, 1);
|
|
4118
|
-
n.splice(t, 0, r), h(n), m(`Moved ${
|
|
4153
|
+
n.splice(t, 0, r), h(n), m(`Moved ${Ca(s, ba(r) ?? "")} to position ${String(t + 1)}.`);
|
|
4119
4154
|
}, _ = s.filter((e) => !f.includes(e.value));
|
|
4120
4155
|
return /* @__PURE__ */ z("div", {
|
|
4121
4156
|
className: "flex flex-col gap-3",
|
|
@@ -4123,7 +4158,7 @@ function Ca({ value: e, onChange: t, field: n, id: r, describedBy: i, invalid: a
|
|
|
4123
4158
|
d.length > 0 && /* @__PURE__ */ R("ol", {
|
|
4124
4159
|
className: "flex flex-col divide-y divide-border border-y border-border",
|
|
4125
4160
|
children: d.map((e, t) => {
|
|
4126
|
-
let n =
|
|
4161
|
+
let n = Ca(s, ba(e) ?? "");
|
|
4127
4162
|
return /* @__PURE__ */ z("li", {
|
|
4128
4163
|
className: "flex flex-wrap items-center gap-2 py-2",
|
|
4129
4164
|
children: [
|
|
@@ -4159,7 +4194,7 @@ function Ca({ value: e, onChange: t, field: n, id: r, describedBy: i, invalid: a
|
|
|
4159
4194
|
children: "Remove"
|
|
4160
4195
|
})
|
|
4161
4196
|
]
|
|
4162
|
-
}, `${String(
|
|
4197
|
+
}, `${String(ba(e))}-${String(t)}`);
|
|
4163
4198
|
})
|
|
4164
4199
|
}),
|
|
4165
4200
|
/* @__PURE__ */ R(Pn, {
|
|
@@ -4169,7 +4204,7 @@ function Ca({ value: e, onChange: t, field: n, id: r, describedBy: i, invalid: a
|
|
|
4169
4204
|
options: _,
|
|
4170
4205
|
value: null,
|
|
4171
4206
|
onChange: (e) => {
|
|
4172
|
-
e !== null && (h([...d, e]), m(`Added ${
|
|
4207
|
+
e !== null && (h([...d, e]), m(`Added ${Ca(s, e)}.`));
|
|
4173
4208
|
},
|
|
4174
4209
|
placeholder: c.state === "loading" ? "Loading…" : `Add from ${l.toLowerCase()}`,
|
|
4175
4210
|
isInvalid: a,
|
|
@@ -4185,42 +4220,42 @@ function Ca({ value: e, onChange: t, field: n, id: r, describedBy: i, invalid: a
|
|
|
4185
4220
|
}
|
|
4186
4221
|
//#endregion
|
|
4187
4222
|
//#region src/widgets/markdown-lazy.tsx
|
|
4188
|
-
var
|
|
4189
|
-
function
|
|
4223
|
+
var Da = i(() => import("./markdown-4fVeej3c.js").then((e) => ({ default: e.MarkdownWidget })));
|
|
4224
|
+
function Oa(e) {
|
|
4190
4225
|
return /* @__PURE__ */ R(t, {
|
|
4191
4226
|
fallback: /* @__PURE__ */ R("p", {
|
|
4192
4227
|
role: "status",
|
|
4193
4228
|
className: "text-small text-content-muted",
|
|
4194
4229
|
children: "Loading the editor…"
|
|
4195
4230
|
}),
|
|
4196
|
-
children: /* @__PURE__ */ R(
|
|
4231
|
+
children: /* @__PURE__ */ R(Da, { ...e })
|
|
4197
4232
|
});
|
|
4198
4233
|
}
|
|
4199
4234
|
//#endregion
|
|
4200
4235
|
//#region src/editor/PagePicker.tsx
|
|
4201
|
-
var
|
|
4202
|
-
function
|
|
4236
|
+
var ka = /* @__PURE__ */ new WeakMap();
|
|
4237
|
+
function Aa() {
|
|
4203
4238
|
let { api: e } = J(), [t, n] = d([]);
|
|
4204
4239
|
return s(() => {
|
|
4205
|
-
let t = !0, r =
|
|
4206
|
-
return r || (r = e.listPages(),
|
|
4240
|
+
let t = !0, r = ka.get(e);
|
|
4241
|
+
return r || (r = e.listPages(), ka.set(e, r)), r.then((e) => {
|
|
4207
4242
|
t && n(e);
|
|
4208
4243
|
}, () => {
|
|
4209
|
-
|
|
4244
|
+
ka.delete(e);
|
|
4210
4245
|
}), () => {
|
|
4211
4246
|
t = !1;
|
|
4212
4247
|
};
|
|
4213
4248
|
}, [e]), t;
|
|
4214
4249
|
}
|
|
4215
|
-
function
|
|
4250
|
+
function ja(e) {
|
|
4216
4251
|
return e.map((e) => ({
|
|
4217
4252
|
value: e.url,
|
|
4218
4253
|
label: e.title,
|
|
4219
4254
|
detail: e.url
|
|
4220
4255
|
}));
|
|
4221
4256
|
}
|
|
4222
|
-
function
|
|
4223
|
-
let i =
|
|
4257
|
+
function Ma({ onPick: e, absolute: t, fieldLabel: n, isDisabled: r }) {
|
|
4258
|
+
let i = Aa(), [a, o] = d(!1), s = l(() => i.map((e) => ({
|
|
4224
4259
|
value: t ? new URL(e.url, t).href : e.url,
|
|
4225
4260
|
label: `${e.title} (${e.url})`
|
|
4226
4261
|
})), [i, t]);
|
|
@@ -4249,28 +4284,28 @@ function ka({ onPick: e, absolute: t, fieldLabel: n, isDisabled: r }) {
|
|
|
4249
4284
|
}
|
|
4250
4285
|
//#endregion
|
|
4251
4286
|
//#region src/widgets/special.tsx
|
|
4252
|
-
var
|
|
4253
|
-
function
|
|
4287
|
+
var Na = /^#[0-9a-f]{6}$/i;
|
|
4288
|
+
function Pa(e, ...t) {
|
|
4254
4289
|
return [e, ...t].filter(Boolean).join(" ");
|
|
4255
4290
|
}
|
|
4256
|
-
function
|
|
4291
|
+
function Fa({ color: e }) {
|
|
4257
4292
|
return /* @__PURE__ */ R("span", {
|
|
4258
4293
|
className: "inline-block size-6 shrink-0 rounded-sm border border-border-strong",
|
|
4259
4294
|
style: { backgroundColor: e }
|
|
4260
4295
|
});
|
|
4261
4296
|
}
|
|
4262
|
-
function
|
|
4297
|
+
function Ia({ value: e, onChange: t, field: n, id: r, describedBy: i, invalid: a, disabled: o }) {
|
|
4263
4298
|
let s = n.widgetOptions?.palette, c = typeof e == "string" ? e : "";
|
|
4264
4299
|
if (s && Object.keys(s).length > 0) {
|
|
4265
4300
|
let e = Object.entries(s).map(([e, t]) => ({
|
|
4266
4301
|
value: t,
|
|
4267
4302
|
label: `${e} (${t})`,
|
|
4268
|
-
prefix: /* @__PURE__ */ R(
|
|
4303
|
+
prefix: /* @__PURE__ */ R(Fa, { color: t })
|
|
4269
4304
|
}));
|
|
4270
4305
|
return c && !e.some((e) => e.value.toLowerCase() === c.toLowerCase()) && e.push({
|
|
4271
4306
|
value: c,
|
|
4272
4307
|
label: `Current colour (${c})`,
|
|
4273
|
-
prefix: /* @__PURE__ */ R(
|
|
4308
|
+
prefix: /* @__PURE__ */ R(Fa, { color: c })
|
|
4274
4309
|
}), /* @__PURE__ */ R(zn, {
|
|
4275
4310
|
id: r,
|
|
4276
4311
|
"aria-labelledby": `${r}-label`,
|
|
@@ -4302,7 +4337,7 @@ function Na({ value: e, onChange: t, field: n, id: r, describedBy: i, invalid: a
|
|
|
4302
4337
|
}), n.widgetOptions?.alpha !== !0 && /* @__PURE__ */ R("input", {
|
|
4303
4338
|
type: "color",
|
|
4304
4339
|
"aria-label": `Pick ${n.label.toLowerCase()} from a colour picker`,
|
|
4305
|
-
value:
|
|
4340
|
+
value: Na.test(c) ? c.toLowerCase() : "#000000",
|
|
4306
4341
|
onChange: (e) => {
|
|
4307
4342
|
t(e.target.value);
|
|
4308
4343
|
},
|
|
@@ -4311,11 +4346,11 @@ function Na({ value: e, onChange: t, field: n, id: r, describedBy: i, invalid: a
|
|
|
4311
4346
|
})]
|
|
4312
4347
|
});
|
|
4313
4348
|
}
|
|
4314
|
-
function
|
|
4315
|
-
let c = X(), l = typeof n.widgetOptions?.from == "string" ? n.widgetOptions.from : void 0, u = l ? c.values[l] : void 0, f = typeof u == "string" ? u : "", p = typeof e == "string" ? e : "", [m, h] = d(() => c.isNew && l !== void 0 && (p === "" || p ===
|
|
4349
|
+
function La({ value: e, onChange: t, field: n, id: r, describedBy: i, invalid: a, disabled: o }) {
|
|
4350
|
+
let c = X(), l = typeof n.widgetOptions?.from == "string" ? n.widgetOptions.from : void 0, u = l ? c.values[l] : void 0, f = typeof u == "string" ? u : "", p = typeof e == "string" ? e : "", [m, h] = d(() => c.isNew && l !== void 0 && (p === "" || p === Ra(f)));
|
|
4316
4351
|
s(() => {
|
|
4317
4352
|
if (!m) return;
|
|
4318
|
-
let e =
|
|
4353
|
+
let e = Ra(f);
|
|
4319
4354
|
e !== p && t(e === "" && !n.required ? void 0 : e);
|
|
4320
4355
|
}, [
|
|
4321
4356
|
m,
|
|
@@ -4334,7 +4369,7 @@ function Pa({ value: e, onChange: t, field: n, id: r, describedBy: i, invalid: a
|
|
|
4334
4369
|
onChange: (e) => {
|
|
4335
4370
|
h(!1), t(e.target.value === "" && !n.required ? void 0 : e.target.value);
|
|
4336
4371
|
},
|
|
4337
|
-
"aria-describedby":
|
|
4372
|
+
"aria-describedby": Pa(i, m && `${r}-follows`),
|
|
4338
4373
|
"aria-invalid": a || void 0,
|
|
4339
4374
|
"aria-required": n.required || void 0,
|
|
4340
4375
|
disabled: o,
|
|
@@ -4349,10 +4384,10 @@ function Pa({ value: e, onChange: t, field: n, id: r, describedBy: i, invalid: a
|
|
|
4349
4384
|
]
|
|
4350
4385
|
})] });
|
|
4351
4386
|
}
|
|
4352
|
-
function
|
|
4387
|
+
function Ra(e) {
|
|
4353
4388
|
return at(e).replaceAll("/", "-");
|
|
4354
4389
|
}
|
|
4355
|
-
function
|
|
4390
|
+
function za({ value: e, onChange: t, field: n, id: r, describedBy: i, invalid: a, disabled: o }) {
|
|
4356
4391
|
let { manifest: s } = J(), c = typeof e == "string" ? e : "", l = /^https?:\/\/\S+$/i.test(c), u = s.site.urls?.site, d = n.format !== "url" || u !== void 0;
|
|
4357
4392
|
return /* @__PURE__ */ z("div", {
|
|
4358
4393
|
className: "flex flex-wrap items-center gap-3",
|
|
@@ -4382,7 +4417,7 @@ function Ia({ value: e, onChange: t, field: n, id: r, describedBy: i, invalid: a
|
|
|
4382
4417
|
children: [c, " in a new tab"]
|
|
4383
4418
|
})]
|
|
4384
4419
|
}),
|
|
4385
|
-
d && /* @__PURE__ */ R(
|
|
4420
|
+
d && /* @__PURE__ */ R(Ma, {
|
|
4386
4421
|
fieldLabel: n.label,
|
|
4387
4422
|
...n.format === "url" && u ? { absolute: u } : {},
|
|
4388
4423
|
...o ? { isDisabled: !0 } : {},
|
|
@@ -4393,12 +4428,13 @@ function Ia({ value: e, onChange: t, field: n, id: r, describedBy: i, invalid: a
|
|
|
4393
4428
|
]
|
|
4394
4429
|
});
|
|
4395
4430
|
}
|
|
4396
|
-
function
|
|
4397
|
-
let { manifest: s } = J(), { zone: c, isSite: l } = tt(s.site.timeZone), u = e instanceof Date ? e : typeof e == "string" && e ? new Date(e) : null, d = u !== null && !Number.isNaN(u.getTime()), f = ct(c, d ? u : /* @__PURE__ */ new Date());
|
|
4431
|
+
function Ba({ value: e, onChange: t, field: n, id: r, describedBy: i, invalid: a, disabled: o }) {
|
|
4432
|
+
let { manifest: s } = J(), { zone: c, isSite: l } = tt(s.site.timeZone), u = e instanceof Date ? e : typeof e == "string" && e ? new Date(e) : null, d = u !== null && !Number.isNaN(u.getTime()), f = ct(c, d ? u : /* @__PURE__ */ new Date()), p = d ? st(u, c) : "", m = vr(p);
|
|
4398
4433
|
return /* @__PURE__ */ z(L, { children: [/* @__PURE__ */ R("input", {
|
|
4399
4434
|
id: r,
|
|
4400
4435
|
type: "datetime-local",
|
|
4401
|
-
value:
|
|
4436
|
+
value: p,
|
|
4437
|
+
...m,
|
|
4402
4438
|
onChange: (n) => {
|
|
4403
4439
|
if (n.target.value === "") {
|
|
4404
4440
|
t(void 0);
|
|
@@ -4407,7 +4443,7 @@ function La({ value: e, onChange: t, field: n, id: r, describedBy: i, invalid: a
|
|
|
4407
4443
|
let r = He(n.target.value, c);
|
|
4408
4444
|
r && t(typeof e == "string" ? qe(r, Xe(r) ?? 0) : r);
|
|
4409
4445
|
},
|
|
4410
|
-
"aria-describedby":
|
|
4446
|
+
"aria-describedby": Pa(i, `${r}-zone`),
|
|
4411
4447
|
"aria-invalid": a || void 0,
|
|
4412
4448
|
"aria-required": n.required || void 0,
|
|
4413
4449
|
disabled: o,
|
|
@@ -4421,64 +4457,64 @@ function La({ value: e, onChange: t, field: n, id: r, describedBy: i, invalid: a
|
|
|
4421
4457
|
}
|
|
4422
4458
|
//#endregion
|
|
4423
4459
|
//#region src/widgets/registry.ts
|
|
4424
|
-
var
|
|
4425
|
-
text: { component:
|
|
4426
|
-
textarea: { component:
|
|
4427
|
-
email: { component:
|
|
4428
|
-
url: { component:
|
|
4429
|
-
number: { component:
|
|
4430
|
-
switch: { component:
|
|
4431
|
-
date: { component:
|
|
4432
|
-
datetime: { component:
|
|
4433
|
-
select: { component:
|
|
4460
|
+
var Va = {
|
|
4461
|
+
text: { component: xr },
|
|
4462
|
+
textarea: { component: Cr },
|
|
4463
|
+
email: { component: Sr },
|
|
4464
|
+
url: { component: za },
|
|
4465
|
+
number: { component: wr },
|
|
4466
|
+
switch: { component: Tr },
|
|
4467
|
+
date: { component: Dr },
|
|
4468
|
+
datetime: { component: Ba },
|
|
4469
|
+
select: { component: kr },
|
|
4434
4470
|
radio: {
|
|
4435
|
-
component:
|
|
4471
|
+
component: Ar,
|
|
4436
4472
|
group: !0
|
|
4437
4473
|
},
|
|
4438
|
-
icon: { component:
|
|
4439
|
-
tags: { component:
|
|
4440
|
-
multiselect: { component:
|
|
4474
|
+
icon: { component: yi },
|
|
4475
|
+
tags: { component: jr },
|
|
4476
|
+
multiselect: { component: jr },
|
|
4441
4477
|
group: {
|
|
4442
|
-
component:
|
|
4478
|
+
component: Qr,
|
|
4443
4479
|
group: !0,
|
|
4444
4480
|
rendersChildren: !0,
|
|
4445
4481
|
section: !0
|
|
4446
4482
|
},
|
|
4447
4483
|
union: {
|
|
4448
|
-
component:
|
|
4484
|
+
component: Zr,
|
|
4449
4485
|
group: !0,
|
|
4450
4486
|
rendersChildren: !0,
|
|
4451
4487
|
section: !0
|
|
4452
4488
|
},
|
|
4453
4489
|
repeater: {
|
|
4454
|
-
component:
|
|
4490
|
+
component: mi,
|
|
4455
4491
|
group: !0,
|
|
4456
4492
|
rendersChildren: !0,
|
|
4457
4493
|
section: !0
|
|
4458
4494
|
},
|
|
4459
|
-
raw: { component:
|
|
4460
|
-
markdown: { component:
|
|
4461
|
-
slug: { component:
|
|
4462
|
-
color: { component:
|
|
4495
|
+
raw: { component: Mr },
|
|
4496
|
+
markdown: { component: Oa },
|
|
4497
|
+
slug: { component: La },
|
|
4498
|
+
color: { component: Ia },
|
|
4463
4499
|
geo: {
|
|
4464
|
-
component:
|
|
4500
|
+
component: Fr,
|
|
4465
4501
|
group: "boxed"
|
|
4466
4502
|
},
|
|
4467
|
-
reference: { component:
|
|
4503
|
+
reference: { component: Ta },
|
|
4468
4504
|
references: {
|
|
4469
|
-
component:
|
|
4505
|
+
component: Ea,
|
|
4470
4506
|
group: !0
|
|
4471
4507
|
},
|
|
4472
4508
|
image: {
|
|
4473
|
-
component:
|
|
4509
|
+
component: _a,
|
|
4474
4510
|
group: "boxed",
|
|
4475
4511
|
childControls: { alt: "-alt" }
|
|
4476
4512
|
},
|
|
4477
4513
|
file: {
|
|
4478
|
-
component:
|
|
4514
|
+
component: ya,
|
|
4479
4515
|
group: !0
|
|
4480
4516
|
}
|
|
4481
|
-
},
|
|
4517
|
+
}, Ha = {
|
|
4482
4518
|
string: "text",
|
|
4483
4519
|
number: "number",
|
|
4484
4520
|
boolean: "switch",
|
|
@@ -4490,21 +4526,21 @@ var Ra = {
|
|
|
4490
4526
|
reference: "reference",
|
|
4491
4527
|
image: "image"
|
|
4492
4528
|
};
|
|
4493
|
-
function
|
|
4529
|
+
function Ua(e) {
|
|
4494
4530
|
for (let t of [
|
|
4495
4531
|
e.widget,
|
|
4496
4532
|
e.inferredWidget,
|
|
4497
|
-
|
|
4533
|
+
Ha[e.kind]
|
|
4498
4534
|
]) {
|
|
4499
|
-
let e = t ?
|
|
4535
|
+
let e = t ? Va[t] : void 0;
|
|
4500
4536
|
if (e) return e;
|
|
4501
4537
|
}
|
|
4502
|
-
return
|
|
4538
|
+
return Va.raw;
|
|
4503
4539
|
}
|
|
4504
4540
|
//#endregion
|
|
4505
4541
|
//#region src/editor/Field.tsx
|
|
4506
|
-
function
|
|
4507
|
-
let o = X(), { widgets: s } = J(), c =
|
|
4542
|
+
function Wa({ field: e, path: n, label: r, item: i, asSection: a = !0 }) {
|
|
4543
|
+
let o = X(), { widgets: s } = J(), c = pr(n, o.idPrefix), l = o.issues.get(mr(n)) ?? [], u = e.widget ? s[e.widget] : void 0, d = Ua(e), f = u ? void 0 : d.childControls, p = (o.notes?.get(mr(n)) ?? []).filter((e) => {
|
|
4508
4544
|
let t = e.target.kind === "field" ? e.target.path[n.length] : void 0;
|
|
4509
4545
|
return !(typeof t == "string" && f && t in f);
|
|
4510
4546
|
}), m = e.description ? `${c}-help` : void 0, h = l.length > 0 ? `${c}-error` : void 0, g = p.length > 0 ? `${c}-a11y` : void 0, _ = [
|
|
@@ -4512,7 +4548,7 @@ function Va({ field: e, path: n, label: r, item: i, asSection: a = !0 }) {
|
|
|
4512
4548
|
h,
|
|
4513
4549
|
g
|
|
4514
4550
|
].filter(Boolean).join(" ") || void 0, v = {
|
|
4515
|
-
value:
|
|
4551
|
+
value: ur(o.values, n),
|
|
4516
4552
|
onChange: (e) => {
|
|
4517
4553
|
o.setValue(n, e);
|
|
4518
4554
|
},
|
|
@@ -4525,7 +4561,7 @@ function Va({ field: e, path: n, label: r, item: i, asSection: a = !0 }) {
|
|
|
4525
4561
|
}, y = i === "row" ? {
|
|
4526
4562
|
...v,
|
|
4527
4563
|
inRow: !0
|
|
4528
|
-
} : v, b = u ? /* @__PURE__ */ R(
|
|
4564
|
+
} : v, b = u ? /* @__PURE__ */ R(Ga, {
|
|
4529
4565
|
fallback: /* @__PURE__ */ R(d.component, { ...y }),
|
|
4530
4566
|
name: e.widget ?? "",
|
|
4531
4567
|
children: /* @__PURE__ */ R(t, {
|
|
@@ -4543,7 +4579,7 @@ function Va({ field: e, path: n, label: r, item: i, asSection: a = !0 }) {
|
|
|
4543
4579
|
id: h,
|
|
4544
4580
|
className: "text-small text-danger",
|
|
4545
4581
|
children: l.join(" ")
|
|
4546
|
-
}) : null, T = g ? /* @__PURE__ */ R(
|
|
4582
|
+
}) : null, T = g ? /* @__PURE__ */ R(xi, {
|
|
4547
4583
|
id: g,
|
|
4548
4584
|
notes: p
|
|
4549
4585
|
}) : null;
|
|
@@ -4588,7 +4624,7 @@ function Va({ field: e, path: n, label: r, item: i, asSection: a = !0 }) {
|
|
|
4588
4624
|
]
|
|
4589
4625
|
});
|
|
4590
4626
|
}
|
|
4591
|
-
var
|
|
4627
|
+
var Ga = class extends e {
|
|
4592
4628
|
state = { failed: !1 };
|
|
4593
4629
|
static getDerivedStateFromError() {
|
|
4594
4630
|
return { failed: !0 };
|
|
@@ -4603,10 +4639,10 @@ var Ha = class extends e {
|
|
|
4603
4639
|
]
|
|
4604
4640
|
}), this.props.fallback] }) : this.props.children;
|
|
4605
4641
|
}
|
|
4606
|
-
},
|
|
4607
|
-
function
|
|
4642
|
+
}, Ka = typeof navigator < "u" && /Mac|iPhone|iPad/.test(navigator.platform || navigator.userAgent);
|
|
4643
|
+
function qa(...e) {
|
|
4608
4644
|
let t = e.at(-1) ?? "", n = e.slice(0, -1);
|
|
4609
|
-
if (
|
|
4645
|
+
if (Ka) {
|
|
4610
4646
|
let e = {
|
|
4611
4647
|
Alt: "⌥",
|
|
4612
4648
|
Shift: "⇧",
|
|
@@ -4627,4 +4663,4 @@ function Wa(...e) {
|
|
|
4627
4663
|
};
|
|
4628
4664
|
}
|
|
4629
4665
|
//#endregion
|
|
4630
|
-
export {
|
|
4666
|
+
export { Nn as $, dr as A, nr as B, gr as C, hr as D, ur as E, ir as F, Gn as G, Zn as H, J as I, Un as J, Wn as K, rr as L, cr as M, sr as N, Y as O, ar as P, zn as Q, Me as R, vr as S, pr as T, Jn as U, Yn as V, qn as W, Ln as X, Vn as Y, Pn as Z, zr as _, Ma as a, wn as at, Lr as b, Xi as c, _n as ct, Yi as d, gn as dt, Bn as et, qi as f, mn as ft, Jr as g, H as gt, $r as h, V as ht, Ua as i, On as it, lr as j, mr as k, $i as l, K as lt, bi as m, G as mt, qa as n, Sn as nt, ja as o, xn as ot, Ui as p, hn as pt, Hn as q, Wa as r, Cn as rt, Aa as s, vn as st, Ka as t, q as tt, Ji as u, pn as ut, Vr as v, X as w, Z as x, Rr as y, tr as z };
|