@kidecms/core 0.29.0 → 0.29.2
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/admin/components/BlockEditor.tsx +35 -16
- package/admin/components/ContentEditor.tsx +30 -14
- package/admin/components/DocumentCombobox.tsx +6 -1
- package/admin/components/SharedSectionEditSheet.tsx +61 -0
- package/admin/components/TreeItemsEditor.tsx +33 -20
- package/admin/lib/use-shared-section.ts +32 -0
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { useState, useCallback, useEffect, useRef } from "react";
|
|
4
|
-
import {
|
|
4
|
+
import { GripVertical, ChevronRight, Link2, Pencil, Plus, Save, Trash2, Unlink } from "lucide-react";
|
|
5
5
|
import { cn } from "../lib/utils";
|
|
6
6
|
import { openPreviewChannel } from "../lib/preview-channel";
|
|
7
7
|
import {
|
|
@@ -16,7 +16,6 @@ import {
|
|
|
16
16
|
import { SortableContext, useSortable, verticalListSortingStrategy, arrayMove } from "@dnd-kit/sortable";
|
|
17
17
|
import { CSS } from "@dnd-kit/utilities";
|
|
18
18
|
import { Button } from "./ui/button";
|
|
19
|
-
import { buttonVariants } from "./ui/button";
|
|
20
19
|
import { Popover, PopoverContent, PopoverTrigger } from "./ui/popover";
|
|
21
20
|
import { Command, CommandEmpty, CommandInput, CommandItem, CommandList } from "./ui/command";
|
|
22
21
|
import {
|
|
@@ -29,6 +28,8 @@ import {
|
|
|
29
28
|
type SubFieldMeta,
|
|
30
29
|
} from "./block-fields";
|
|
31
30
|
import type { LinkableCollection } from "./InternalLinkPicker";
|
|
31
|
+
import SharedSectionEditSheet from "./SharedSectionEditSheet";
|
|
32
|
+
import { useSharedSection } from "../lib/use-shared-section";
|
|
32
33
|
|
|
33
34
|
type Block = {
|
|
34
35
|
_key: string;
|
|
@@ -109,6 +110,7 @@ function SortableBlock({
|
|
|
109
110
|
sharedSection?: SharedSectionOption;
|
|
110
111
|
}) {
|
|
111
112
|
const contentRef = useRef<HTMLDivElement>(null);
|
|
113
|
+
const [sourceOpen, setSourceOpen] = useState(false);
|
|
112
114
|
const { attributes, listeners, setNodeRef, setActivatorNodeRef, transform, transition, isDragging } = useSortable({
|
|
113
115
|
id: block._key,
|
|
114
116
|
});
|
|
@@ -129,6 +131,9 @@ function SortableBlock({
|
|
|
129
131
|
};
|
|
130
132
|
|
|
131
133
|
const shared = isSharedBlock(block);
|
|
134
|
+
const sharedRef = shared ? String(block.ref) : null;
|
|
135
|
+
const sharedState = useSharedSection(sharedRef, !!sharedSection);
|
|
136
|
+
const sharedMissing = sharedState === "missing";
|
|
132
137
|
const preview = shared
|
|
133
138
|
? String(sharedSection?.title ?? block.title ?? "Shared section")
|
|
134
139
|
: getPreviewText(block, fieldsMeta);
|
|
@@ -182,7 +187,7 @@ function SortableBlock({
|
|
|
182
187
|
)}
|
|
183
188
|
|
|
184
189
|
<div className="ml-auto flex shrink-0 items-center">
|
|
185
|
-
{(shared
|
|
190
|
+
{(shared ? !sharedMissing : sharedEnabled) && (
|
|
186
191
|
<Button
|
|
187
192
|
type="button"
|
|
188
193
|
variant="ghost"
|
|
@@ -222,22 +227,29 @@ function SortableBlock({
|
|
|
222
227
|
<div>
|
|
223
228
|
<p className="font-medium">{preview}</p>
|
|
224
229
|
<p className="text-muted-foreground text-sm">
|
|
225
|
-
|
|
230
|
+
{sharedMissing
|
|
231
|
+
? "This shared section has been deleted. There is nothing left to detach — remove the block to clear the reference."
|
|
232
|
+
: "Editing the source updates every page that uses this shared section."}
|
|
226
233
|
</p>
|
|
227
234
|
</div>
|
|
228
235
|
<div className="flex flex-wrap gap-2">
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
236
|
+
{sharedMissing ? (
|
|
237
|
+
<Button type="button" variant="outline" size="sm" onClick={onRemove}>
|
|
238
|
+
<Trash2 className="size-3.5" />
|
|
239
|
+
Remove block
|
|
240
|
+
</Button>
|
|
241
|
+
) : (
|
|
242
|
+
<>
|
|
243
|
+
<Button type="button" variant="outline" size="sm" onClick={() => setSourceOpen(true)}>
|
|
244
|
+
<Pencil className="size-3.5" />
|
|
245
|
+
Edit source
|
|
246
|
+
</Button>
|
|
247
|
+
<Button type="button" variant="outline" size="sm" onClick={onDetach}>
|
|
248
|
+
<Unlink className="size-3.5" />
|
|
249
|
+
Detach
|
|
250
|
+
</Button>
|
|
251
|
+
</>
|
|
252
|
+
)}
|
|
241
253
|
</div>
|
|
242
254
|
</div>
|
|
243
255
|
) : (
|
|
@@ -256,6 +268,13 @@ function SortableBlock({
|
|
|
256
268
|
)}
|
|
257
269
|
</div>
|
|
258
270
|
)}
|
|
271
|
+
|
|
272
|
+
<SharedSectionEditSheet
|
|
273
|
+
sectionId={shared ? String(block.ref) : null}
|
|
274
|
+
open={sourceOpen}
|
|
275
|
+
onOpenChange={setSourceOpen}
|
|
276
|
+
onSaved={(section) => onUpdateField("title", String(section.title ?? ""))}
|
|
277
|
+
/>
|
|
259
278
|
</div>
|
|
260
279
|
);
|
|
261
280
|
}
|
|
@@ -8,7 +8,6 @@ import Link from "@tiptap/extension-link";
|
|
|
8
8
|
import Placeholder from "@tiptap/extension-placeholder";
|
|
9
9
|
import { useCallback, useEffect, useId, useRef, useState } from "react";
|
|
10
10
|
import {
|
|
11
|
-
ArrowUpRight,
|
|
12
11
|
Bold,
|
|
13
12
|
ChevronRight,
|
|
14
13
|
GripVertical,
|
|
@@ -18,16 +17,19 @@ import {
|
|
|
18
17
|
Link as LinkIcon,
|
|
19
18
|
Maximize2,
|
|
20
19
|
Minimize2,
|
|
20
|
+
Pencil,
|
|
21
21
|
Save,
|
|
22
22
|
Trash2,
|
|
23
23
|
Unlink,
|
|
24
24
|
} from "lucide-react";
|
|
25
|
-
import { Button
|
|
25
|
+
import { Button } from "./ui/button";
|
|
26
26
|
import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from "./ui/dialog";
|
|
27
27
|
import { Input } from "./ui/input";
|
|
28
28
|
import { cn } from "../lib/utils";
|
|
29
29
|
import { toggleHeading } from "../lib/editor-commands";
|
|
30
30
|
import { openPreviewChannel } from "../lib/preview-channel";
|
|
31
|
+
import SharedSectionEditSheet from "./SharedSectionEditSheet";
|
|
32
|
+
import { useSharedSection } from "../lib/use-shared-section";
|
|
31
33
|
import {
|
|
32
34
|
LinkDialog,
|
|
33
35
|
fetchLinkGroups,
|
|
@@ -107,6 +109,7 @@ function BlockNodeView(props: NodeViewProps) {
|
|
|
107
109
|
// would otherwise wrongly start the block collapsed.
|
|
108
110
|
const [expanded, setExpanded] = useState(() => Object.values(fields).every(isBlankFieldValue));
|
|
109
111
|
const [saveDialogOpen, setSaveDialogOpen] = useState(false);
|
|
112
|
+
const [sourceOpen, setSourceOpen] = useState(false);
|
|
110
113
|
const [sharedName, setSharedName] = useState("");
|
|
111
114
|
// Stable per-node id so sub-field DOM ids/names stay unique across repeated blocks of
|
|
112
115
|
// the same type (two FAQ blocks must not share input ids/labels).
|
|
@@ -120,6 +123,8 @@ function BlockNodeView(props: NodeViewProps) {
|
|
|
120
123
|
const sharedTitle = String(fields.title ?? "Shared section");
|
|
121
124
|
const sharedRef = String(fields.ref ?? "");
|
|
122
125
|
const sharedType = String(fields.blockType ?? "");
|
|
126
|
+
// A node view has no section list to consult, so every reference resolves once.
|
|
127
|
+
const sharedMissing = useSharedSection(isShared && sharedRef ? sharedRef : null, false) === "missing";
|
|
123
128
|
|
|
124
129
|
// Save this block as a reusable shared section, then turn it into a reference.
|
|
125
130
|
const openSaveDialog = () => {
|
|
@@ -222,7 +227,7 @@ function BlockNodeView(props: NodeViewProps) {
|
|
|
222
227
|
)}
|
|
223
228
|
|
|
224
229
|
<div className="ml-auto flex shrink-0 items-center">
|
|
225
|
-
{(isShared
|
|
230
|
+
{(isShared ? !sharedMissing : options.sharedEnabled) && (
|
|
226
231
|
<Button
|
|
227
232
|
type="button"
|
|
228
233
|
variant="ghost"
|
|
@@ -261,19 +266,23 @@ function BlockNodeView(props: NodeViewProps) {
|
|
|
261
266
|
<div>
|
|
262
267
|
<p className="font-medium">{sharedTitle}</p>
|
|
263
268
|
<p className="text-muted-foreground text-sm">
|
|
264
|
-
|
|
269
|
+
{sharedMissing
|
|
270
|
+
? "This shared section has been deleted. There is nothing left to detach — remove the block to clear the reference."
|
|
271
|
+
: "Editing the source updates every place that uses this shared section."}
|
|
265
272
|
</p>
|
|
266
273
|
</div>
|
|
267
|
-
{sharedRef &&
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
274
|
+
{sharedRef &&
|
|
275
|
+
(sharedMissing ? (
|
|
276
|
+
<Button type="button" variant="outline" size="sm" onClick={deleteNode}>
|
|
277
|
+
<Trash2 className="size-3.5" />
|
|
278
|
+
Remove block
|
|
279
|
+
</Button>
|
|
280
|
+
) : (
|
|
281
|
+
<Button type="button" variant="outline" size="sm" onClick={() => setSourceOpen(true)}>
|
|
282
|
+
<Pencil className="size-3.5" />
|
|
283
|
+
Edit source
|
|
284
|
+
</Button>
|
|
285
|
+
))}
|
|
277
286
|
</div>
|
|
278
287
|
) : (
|
|
279
288
|
<>
|
|
@@ -326,6 +335,13 @@ function BlockNodeView(props: NodeViewProps) {
|
|
|
326
335
|
</form>
|
|
327
336
|
</DialogContent>
|
|
328
337
|
</Dialog>
|
|
338
|
+
|
|
339
|
+
<SharedSectionEditSheet
|
|
340
|
+
sectionId={sharedRef || null}
|
|
341
|
+
open={sourceOpen}
|
|
342
|
+
onOpenChange={setSourceOpen}
|
|
343
|
+
onSaved={(section) => updateAttributes({ fields: { ...fields, title: String(section.title ?? sharedTitle) } })}
|
|
344
|
+
/>
|
|
329
345
|
</NodeViewWrapper>
|
|
330
346
|
);
|
|
331
347
|
}
|
|
@@ -106,6 +106,7 @@ export default function DocumentCombobox({
|
|
|
106
106
|
key={hit.docId}
|
|
107
107
|
value={`${hit.collection}:${hit.docId}`}
|
|
108
108
|
onSelect={() => pick(hit)}
|
|
109
|
+
title={hit.title}
|
|
109
110
|
className={cn("px-1", dimUnselected && !isSelected(hit) && "opacity-40")}
|
|
110
111
|
>
|
|
111
112
|
<Check className={cn("size-4", isSelected(hit) ? "opacity-100" : "opacity-0")} />
|
|
@@ -127,13 +128,17 @@ export default function DocumentCombobox({
|
|
|
127
128
|
role="combobox"
|
|
128
129
|
aria-expanded={open}
|
|
129
130
|
size={size}
|
|
131
|
+
title={display || undefined}
|
|
130
132
|
className={cn("w-full justify-between text-sm font-normal", triggerClassName)}
|
|
131
133
|
>
|
|
132
134
|
<span className={cn("truncate", !display && "text-muted-foreground")}>{display || placeholder}</span>
|
|
133
135
|
<ChevronsUpDown className="ml-2 size-4 shrink-0 opacity-50" />
|
|
134
136
|
</Button>
|
|
135
137
|
</PopoverTrigger>
|
|
136
|
-
<PopoverContent
|
|
138
|
+
<PopoverContent
|
|
139
|
+
className="w-auto max-w-[min(28rem,var(--radix-popover-content-available-width))] min-w-(--radix-popover-trigger-width) p-0"
|
|
140
|
+
align="start"
|
|
141
|
+
>
|
|
137
142
|
<Command shouldFilter={false}>
|
|
138
143
|
<CommandInput value={query} onValueChange={setQuery} placeholder={placeholder} />
|
|
139
144
|
<CommandList>
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { useEffect } from "react";
|
|
4
|
+
import { Sheet, SheetContent, SheetHeader, SheetTitle } from "./ui/sheet";
|
|
5
|
+
|
|
6
|
+
export type SavedSharedSection = { _id: string; title?: string; blockType?: string };
|
|
7
|
+
|
|
8
|
+
type Props = {
|
|
9
|
+
sectionId: string | null;
|
|
10
|
+
open: boolean;
|
|
11
|
+
onOpenChange: (open: boolean) => void;
|
|
12
|
+
onSaved?: (section: SavedSharedSection) => void;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* The shared section's own edit page in a side panel. The embedded form posts
|
|
17
|
+
* `cms:created` on a successful save (see EditScripts), which closes the panel
|
|
18
|
+
* and hands back the refreshed document so the referencing block can update the
|
|
19
|
+
* title it caches.
|
|
20
|
+
*/
|
|
21
|
+
export default function SharedSectionEditSheet({ sectionId, open, onOpenChange, onSaved }: Props) {
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
if (!open || !sectionId) return;
|
|
24
|
+
|
|
25
|
+
const handleMessage = (e: MessageEvent) => {
|
|
26
|
+
if (e.data?.type !== "cms:created" || String(e.data.id) !== sectionId) return;
|
|
27
|
+
onOpenChange(false);
|
|
28
|
+
fetch(`/api/cms/shared-sections/${sectionId}?status=any`, { credentials: "same-origin" })
|
|
29
|
+
.then((res) => (res.ok ? res.json() : null))
|
|
30
|
+
.then((section) => {
|
|
31
|
+
if (section) onSaved?.(section as SavedSharedSection);
|
|
32
|
+
})
|
|
33
|
+
.catch(() => {});
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
window.addEventListener("message", handleMessage);
|
|
37
|
+
return () => window.removeEventListener("message", handleMessage);
|
|
38
|
+
}, [open, sectionId, onOpenChange, onSaved]);
|
|
39
|
+
|
|
40
|
+
return (
|
|
41
|
+
<Sheet open={open} onOpenChange={onOpenChange}>
|
|
42
|
+
<SheetContent
|
|
43
|
+
side="right"
|
|
44
|
+
className="data-[side=right]:w-[90vw] data-[side=right]:sm:max-w-[90vw] data-[side=right]:lg:w-[50vw] data-[side=right]:lg:max-w-[50vw]"
|
|
45
|
+
>
|
|
46
|
+
<SheetHeader className="sr-only">
|
|
47
|
+
<SheetTitle>Edit shared section</SheetTitle>
|
|
48
|
+
</SheetHeader>
|
|
49
|
+
<div className="flex-1 overflow-hidden">
|
|
50
|
+
{open && sectionId && (
|
|
51
|
+
<iframe
|
|
52
|
+
src={`/admin/shared-sections/${sectionId}?_embed=1`}
|
|
53
|
+
title="Edit shared section"
|
|
54
|
+
className="size-full"
|
|
55
|
+
/>
|
|
56
|
+
)}
|
|
57
|
+
</div>
|
|
58
|
+
</SheetContent>
|
|
59
|
+
</Sheet>
|
|
60
|
+
);
|
|
61
|
+
}
|
|
@@ -469,7 +469,7 @@ export default function TreeItemsEditor({ name, value, variant, label, linkOptio
|
|
|
469
469
|
updateEditing({ linkType: newType, ...(newType === "reference" ? { href: "" } : {}) });
|
|
470
470
|
}}
|
|
471
471
|
>
|
|
472
|
-
<SelectTrigger className="bg-background h-7!
|
|
472
|
+
<SelectTrigger className="bg-background h-7! w-36 shrink-0 text-sm">
|
|
473
473
|
<SelectValue placeholder="Link type" />
|
|
474
474
|
</SelectTrigger>
|
|
475
475
|
<SelectContent>
|
|
@@ -584,7 +584,12 @@ export default function TreeItemsEditor({ name, value, variant, label, linkOptio
|
|
|
584
584
|
</div>
|
|
585
585
|
) : (
|
|
586
586
|
<>
|
|
587
|
-
<div
|
|
587
|
+
<div
|
|
588
|
+
className="flex min-w-0 flex-1 items-center gap-3"
|
|
589
|
+
title={[getItemLabel(item, variant), variant === "menu" && getItemSublabel(item, variant)]
|
|
590
|
+
.filter(Boolean)
|
|
591
|
+
.join(" ")}
|
|
592
|
+
>
|
|
588
593
|
<span className="truncate font-medium">{getItemLabel(item, variant)}</span>
|
|
589
594
|
{variant === "menu" && (
|
|
590
595
|
<span className="text-muted-foreground truncate text-xs">{getItemSublabel(item, variant)}</span>
|
|
@@ -707,7 +712,7 @@ export default function TreeItemsEditor({ name, value, variant, label, linkOptio
|
|
|
707
712
|
|
|
708
713
|
// --- Render ---
|
|
709
714
|
|
|
710
|
-
const emptyLabel = variant === "menu" ? "No menu items." : "No terms.";
|
|
715
|
+
const emptyLabel = variant === "menu" ? "No menu items." : "No terms yet — add one above.";
|
|
711
716
|
const addLabel = variant === "menu" ? "Add menu item" : "Add term";
|
|
712
717
|
|
|
713
718
|
return (
|
|
@@ -739,26 +744,32 @@ export default function TreeItemsEditor({ name, value, variant, label, linkOptio
|
|
|
739
744
|
</div>
|
|
740
745
|
)}
|
|
741
746
|
|
|
747
|
+
{/* The only way to add a term: a plus-prefixed input that names the action in
|
|
748
|
+
its placeholder, so it never reads as the filter box its position suggests. */}
|
|
742
749
|
{variant === "taxonomy" && (
|
|
743
750
|
<div className="flex items-center gap-2">
|
|
744
|
-
<
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
751
|
+
<div className="relative min-w-0 flex-1">
|
|
752
|
+
<Plus className="text-muted-foreground pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2" />
|
|
753
|
+
<Input
|
|
754
|
+
value={bulkInput}
|
|
755
|
+
onChange={(e) => setBulkInput(e.target.value)}
|
|
756
|
+
onKeyDown={(e) => {
|
|
757
|
+
if (e.key === "Enter") {
|
|
758
|
+
e.preventDefault();
|
|
759
|
+
handleBulkAdd();
|
|
760
|
+
}
|
|
761
|
+
}}
|
|
762
|
+
placeholder="e.g., Electronics, Clothing, Books"
|
|
763
|
+
className="w-full pl-9 text-sm"
|
|
764
|
+
/>
|
|
765
|
+
</div>
|
|
756
766
|
<Select
|
|
757
767
|
items={parentOptions.map((opt) => ({ value: opt.id, label: opt.label }))}
|
|
758
768
|
value={bulkParent}
|
|
759
769
|
onValueChange={(v) => setBulkParent(v ?? "")}
|
|
760
770
|
>
|
|
761
|
-
<SelectTrigger className="w-
|
|
771
|
+
<SelectTrigger className="w-40 shrink-0 text-sm">
|
|
772
|
+
<span className="text-muted-foreground">Under</span>
|
|
762
773
|
<SelectValue placeholder="Root" />
|
|
763
774
|
</SelectTrigger>
|
|
764
775
|
<SelectContent>
|
|
@@ -815,10 +826,12 @@ export default function TreeItemsEditor({ name, value, variant, label, linkOptio
|
|
|
815
826
|
)}
|
|
816
827
|
</DragOverlay>
|
|
817
828
|
</DndContext>
|
|
818
|
-
|
|
819
|
-
<
|
|
820
|
-
|
|
821
|
-
|
|
829
|
+
{variant === "menu" && (
|
|
830
|
+
<Button type="button" variant="outline" size="sm" onClick={addRootItem}>
|
|
831
|
+
<Plus className="size-4" />
|
|
832
|
+
{addLabel}
|
|
833
|
+
</Button>
|
|
834
|
+
)}
|
|
822
835
|
</div>
|
|
823
836
|
);
|
|
824
837
|
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
|
+
|
|
3
|
+
export type SharedSectionState = "loading" | "ok" | "missing";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Resolves a shared-section reference so a block can tell "the source exists" from
|
|
7
|
+
* "the source was deleted". A dangling reference has nothing to detach to, so the
|
|
8
|
+
* editors offer removing the block instead of failing at detach time.
|
|
9
|
+
*
|
|
10
|
+
* `known` short-circuits the lookup: the edit view already ships the section list,
|
|
11
|
+
* so only references missing from it (deleted, or past the list's 500-row cap) cost
|
|
12
|
+
* a request. A non-404 failure resolves as `ok` — a flaky request is not evidence
|
|
13
|
+
* that the section is gone.
|
|
14
|
+
*/
|
|
15
|
+
export function useSharedSection(ref: string | null, known: boolean): SharedSectionState {
|
|
16
|
+
// Keyed by ref so a resolved answer is never read against a different reference.
|
|
17
|
+
const [resolved, setResolved] = useState<{ ref: string; state: SharedSectionState } | null>(null);
|
|
18
|
+
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
if (!ref || known) return;
|
|
21
|
+
const controller = new AbortController();
|
|
22
|
+
fetch(`/api/cms/shared-sections/${ref}?status=any`, { credentials: "same-origin", signal: controller.signal })
|
|
23
|
+
.then((res) => setResolved({ ref, state: res.status === 404 ? "missing" : "ok" }))
|
|
24
|
+
.catch(() => {
|
|
25
|
+
if (!controller.signal.aborted) setResolved({ ref, state: "ok" });
|
|
26
|
+
});
|
|
27
|
+
return () => controller.abort();
|
|
28
|
+
}, [ref, known]);
|
|
29
|
+
|
|
30
|
+
if (!ref || known) return "ok";
|
|
31
|
+
return resolved?.ref === ref ? resolved.state : "loading";
|
|
32
|
+
}
|