@bettercms-ai/kit 4.0.0 → 4.1.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/dist/adapters/lossy.d.ts +4 -0
- package/dist/adapters/lossy.js +4 -0
- package/dist/adapters/lossy.js.map +1 -1
- package/dist/adapters/prod-types.d.ts +4 -0
- package/dist/adapters/prod-types.js +4 -1
- package/dist/adapters/prod-types.js.map +1 -1
- package/dist/adapters/schema.js +7 -0
- package/dist/adapters/schema.js.map +1 -1
- package/dist/context.d.ts +83 -0
- package/dist/context.js +58 -1
- package/dist/context.js.map +1 -1
- package/dist/controls/choice.d.ts +1 -1
- package/dist/controls/choice.js +21 -2
- package/dist/controls/choice.js.map +1 -1
- package/dist/controls/index.d.ts +1 -0
- package/dist/controls/index.js +3 -2
- package/dist/controls/index.js.map +1 -1
- package/dist/controls/link.d.ts +23 -2
- package/dist/controls/link.js +456 -4
- package/dist/controls/link.js.map +1 -1
- package/dist/controls/media-v16.d.ts +27 -0
- package/dist/controls/media-v16.js +261 -0
- package/dist/controls/media-v16.js.map +1 -0
- package/dist/controls/media.js +63 -1
- package/dist/controls/media.js.map +1 -1
- package/dist/controls/reference-services.d.ts +8 -0
- package/dist/controls/reference.js +78 -2
- package/dist/controls/reference.js.map +1 -1
- package/dist/controls/rich-text/ai-runs.d.ts +13 -0
- package/dist/controls/rich-text/ai-runs.js +71 -0
- package/dist/controls/rich-text/ai-runs.js.map +1 -0
- package/dist/controls/rich-text/block-tool.d.ts +31 -0
- package/dist/controls/rich-text/block-tool.js +62 -0
- package/dist/controls/rich-text/block-tool.js.map +1 -0
- package/dist/controls/rich-text/blocks.d.ts +6 -1
- package/dist/controls/rich-text/blocks.js +404 -24
- package/dist/controls/rich-text/blocks.js.map +1 -1
- package/dist/controls/rich-text/catalog.d.ts +21 -6
- package/dist/controls/rich-text/catalog.js +312 -23
- package/dist/controls/rich-text/catalog.js.map +1 -1
- package/dist/controls/rich-text/code-head.d.ts +30 -0
- package/dist/controls/rich-text/code-head.js +230 -0
- package/dist/controls/rich-text/code-head.js.map +1 -0
- package/dist/controls/rich-text/codec.d.ts +1 -1
- package/dist/controls/rich-text/codec.js +3 -1
- package/dist/controls/rich-text/codec.js.map +1 -1
- package/dist/controls/rich-text/dom.d.ts +27 -0
- package/dist/controls/rich-text/dom.js +69 -4
- package/dist/controls/rich-text/dom.js.map +1 -1
- package/dist/controls/rich-text/editor.js +212 -50
- package/dist/controls/rich-text/editor.js.map +1 -1
- package/dist/controls/rich-text/ops.js +1 -0
- package/dist/controls/rich-text/ops.js.map +1 -1
- package/dist/controls/rich-text/slash-preview.d.ts +8 -0
- package/dist/controls/rich-text/slash-preview.js +287 -0
- package/dist/controls/rich-text/slash-preview.js.map +1 -0
- package/dist/controls/rich-text/table-grid.d.ts +22 -0
- package/dist/controls/rich-text/table-grid.js +1052 -0
- package/dist/controls/rich-text/table-grid.js.map +1 -0
- package/dist/controls/rich-text/toolbar.js +60 -18
- package/dist/controls/rich-text/toolbar.js.map +1 -1
- package/dist/controls/text.d.ts +6 -0
- package/dist/controls/text.js +95 -5
- package/dist/controls/text.js.map +1 -1
- package/dist/core/facets.d.ts +1 -0
- package/dist/core/facets.js +1 -0
- package/dist/core/facets.js.map +1 -1
- package/dist/engine/array.d.ts +7 -0
- package/dist/engine/array.js +164 -45
- package/dist/engine/array.js.map +1 -1
- package/dist/engine/field-shell.d.ts +12 -0
- package/dist/engine/field-shell.js +217 -63
- package/dist/engine/field-shell.js.map +1 -1
- package/dist/engine/frame.js +39 -2
- package/dist/engine/frame.js.map +1 -1
- package/dist/engine/grouping.d.ts +71 -10
- package/dist/engine/grouping.js +223 -26
- package/dist/engine/grouping.js.map +1 -1
- package/dist/engine/kit-field.js +38 -4
- package/dist/engine/kit-field.js.map +1 -1
- package/dist/engine/schema-form.js +7 -2
- package/dist/engine/schema-form.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +13 -6
- package/dist/index.js.map +1 -1
- package/dist/kit.css +85 -0
- package/dist/schema/table.d.ts +2 -1
- package/dist/schema/table.js +5 -0
- package/dist/schema/table.js.map +1 -1
- package/dist/schema/types.d.ts +6 -0
- package/dist/schema/types.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/theme.css +115 -0
- package/dist/tokens.css +268 -0
- package/dist/ui/block-icon-picker.d.ts +38 -0
- package/dist/ui/block-icon-picker.js +141 -0
- package/dist/ui/block-icon-picker.js.map +1 -0
- package/dist/ui/button.js +1 -0
- package/dist/ui/button.js.map +1 -1
- package/dist/ui/code-language-menu.d.ts +24 -0
- package/dist/ui/code-language-menu.js +123 -0
- package/dist/ui/code-language-menu.js.map +1 -0
- package/dist/ui/content-fields.d.ts +47 -0
- package/dist/ui/content-fields.js +278 -0
- package/dist/ui/content-fields.js.map +1 -0
- package/dist/ui/foundations.d.ts +118 -0
- package/dist/ui/foundations.js +564 -0
- package/dist/ui/foundations.js.map +1 -0
- package/dist/ui/index.d.ts +6 -0
- package/dist/ui/index.js +7 -1
- package/dist/ui/inspector.d.ts +394 -0
- package/dist/ui/inspector.js +1173 -0
- package/dist/ui/inspector.js.map +1 -0
- package/dist/ui/overlay.d.ts +7 -2
- package/dist/ui/overlay.js +55 -20
- package/dist/ui/overlay.js.map +1 -1
- package/dist/ui/shortcut-hint.js +1 -1
- package/dist/ui/shortcut-hint.js.map +1 -1
- package/dist/ui/toast.d.ts +5 -3
- package/dist/ui/toast.js +83 -11
- package/dist/ui/toast.js.map +1 -1
- package/dist/ui/tooltip-card.d.ts +45 -0
- package/dist/ui/tooltip-card.js +135 -0
- package/dist/ui/tooltip-card.js.map +1 -0
- package/package.json +1 -1
|
@@ -24,7 +24,8 @@ export interface IslandCtx {
|
|
|
24
24
|
readOnly?: boolean;
|
|
25
25
|
dense?: boolean;
|
|
26
26
|
emit: () => void;
|
|
27
|
-
|
|
27
|
+
/** `label` names the Undo toast (look v16 "Table deleted"); default "Block deleted" */
|
|
28
|
+
remove: (el: IslandEl, label?: string) => void;
|
|
28
29
|
/** Leave the block: caret to the start of the next line. */
|
|
29
30
|
exit: (el: IslandEl) => void;
|
|
30
31
|
/** CPO D54: an island write joins the body field's ONE undo history (`before` = the model it replaces) */
|
|
@@ -50,6 +51,8 @@ export interface IslandCtx {
|
|
|
50
51
|
outline?: OutlineStore;
|
|
51
52
|
/** where an author bio and related posts point (the field's config, from the host codec) */
|
|
52
53
|
references?: RichTextRead["references"];
|
|
54
|
+
/** look v16 "Turn into": the block becomes `nodes` (top-level blocks), with an Undo toast named `label` */
|
|
55
|
+
replace?: (el: IslandEl, nodes: HTMLElement[], label: string) => void;
|
|
53
56
|
}
|
|
54
57
|
/** `label` names the step in the editor's one undo history ("Edit alt text"). */
|
|
55
58
|
export type Setter<K extends IslandKind> = (patch: Partial<IslandModels[K]> | ((m: IslandModels[K]) => IslandModels[K]), label?: string, record?: boolean) => void;
|
|
@@ -64,3 +67,5 @@ export declare function Island({ el, ctx }: {
|
|
|
64
67
|
el: IslandEl;
|
|
65
68
|
ctx: IslandCtx;
|
|
66
69
|
}): import("react/jsx-runtime").JSX.Element;
|
|
70
|
+
/** "Crystal Nolen" → "CN" (the byline avatar's initials) */
|
|
71
|
+
export declare const bylineInitials: (name: string) => string;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { isCropRect } from "../../adapters/values.js";
|
|
2
2
|
import { cn } from "../../lib/cn.js";
|
|
3
|
-
import { useKitServices } from "../../context.js";
|
|
3
|
+
import { useKitLook, useKitServices } from "../../context.js";
|
|
4
4
|
import { Button, IconButton } from "../../ui/button.js";
|
|
5
5
|
import { Menu, MenuContent, MenuItem, MenuTrigger, Popover, PopoverContent, PopoverTrigger, Tooltip } from "../../ui/overlay.js";
|
|
6
6
|
import { Input, Textarea } from "../../ui/input.js";
|
|
7
7
|
import { LinkPopoverBody } from "../link.js";
|
|
8
8
|
import { TableEditor } from "../table/table-editor.js";
|
|
9
|
-
import { CALLOUT_TONES, placeCaret } from "./dom.js";
|
|
9
|
+
import { CALLOUT_TONES, V16_CALLOUT_TONES, newStat, placeCaret, textToParas } from "./dom.js";
|
|
10
10
|
import { ImageDetails, VideoPreview } from "../media.js";
|
|
11
11
|
import { ArticleActions, ArticleCard, ArticleForm, ArticlePanel, articleCardKeyDown, useArticleOpen } from "./article-shell.js";
|
|
12
12
|
import { EmbedBlock } from "./embed.js";
|
|
@@ -16,9 +16,11 @@ import { ColumnsBlock } from "./columns.js";
|
|
|
16
16
|
import { AuthorBlock } from "./author.js";
|
|
17
17
|
import { RelatedBlock } from "./related.js";
|
|
18
18
|
import { ComponentCard } from "./component-card.js";
|
|
19
|
+
import { BLOCK_TOOL_BTN, BlockTool, BlockToolMenu, BlockToolSep } from "./block-tool.js";
|
|
20
|
+
import { TableGridV16 } from "./table-grid.js";
|
|
19
21
|
import * as React from "react";
|
|
20
22
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
21
|
-
import { IconAlertTriangle, IconAlt, IconArrowsHorizontal, IconBulb, IconCheck, IconChevronDown, IconChevronRight, IconComponents, IconCopy, IconCrop, IconFileText, IconFileUpload, IconInfoCircle, IconLayoutAlignCenter, IconLayoutAlignLeft, IconLayoutAlignRight, IconLibraryPhoto, IconLink, IconPhoto, IconQuote, IconReplace, IconTrash, IconWorld } from "@tabler/icons-react";
|
|
23
|
+
import { IconAlertTriangle, IconAlt, IconArrowsHorizontal, IconBulb, IconCheck, IconChevronDown, IconChevronRight, IconComponents, IconCopy, IconCrop, IconFileText, IconFileUpload, IconInfoCircle, IconLayoutAlignCenter, IconLayoutAlignLeft, IconLayoutAlignRight, IconLibraryPhoto, IconLink, IconPhoto, IconPlus, IconQuote, IconReplace, IconTrash, IconWorld } from "@tabler/icons-react";
|
|
22
24
|
//#region src/controls/rich-text/blocks.tsx
|
|
23
25
|
/**
|
|
24
26
|
* RICH TEXT · rich blocks ("islands", V2 HEAD controls/rich-text/blocks.tsx). Each renders through a portal into a
|
|
@@ -39,6 +41,7 @@ import { IconAlertTriangle, IconAlt, IconArrowsHorizontal, IconBulb, IconCheck,
|
|
|
39
41
|
*/
|
|
40
42
|
function Island({ el, ctx }) {
|
|
41
43
|
const kind = el.getAttribute("data-rt-island");
|
|
44
|
+
const v16 = useKitLook() === "v16";
|
|
42
45
|
const [model, setModel] = React.useState(() => el.__rt);
|
|
43
46
|
const [autoFocus] = React.useState(() => !!el.__rtFocus);
|
|
44
47
|
React.useEffect(() => {
|
|
@@ -83,7 +86,14 @@ function Island({ el, ctx }) {
|
|
|
83
86
|
autoFocus,
|
|
84
87
|
m: model,
|
|
85
88
|
set
|
|
86
|
-
}) : kind === "table" ? /* @__PURE__ */ jsx(
|
|
89
|
+
}) : kind === "table" ? v16 ? /* @__PURE__ */ jsx(TableGridV16, {
|
|
90
|
+
el,
|
|
91
|
+
ctx,
|
|
92
|
+
autoFocus,
|
|
93
|
+
m: model,
|
|
94
|
+
set,
|
|
95
|
+
options: STORED_TABLE
|
|
96
|
+
}) : /* @__PURE__ */ jsx(TableBlock, {
|
|
87
97
|
el,
|
|
88
98
|
ctx,
|
|
89
99
|
autoFocus,
|
|
@@ -101,7 +111,19 @@ function Island({ el, ctx }) {
|
|
|
101
111
|
autoFocus,
|
|
102
112
|
m: model,
|
|
103
113
|
set
|
|
104
|
-
}) : kind === "callout" ? /* @__PURE__ */ jsx(
|
|
114
|
+
}) : kind === "callout" ? v16 ? /* @__PURE__ */ jsx(CalloutBlockV16, {
|
|
115
|
+
el,
|
|
116
|
+
ctx,
|
|
117
|
+
autoFocus,
|
|
118
|
+
m: model,
|
|
119
|
+
set
|
|
120
|
+
}) : /* @__PURE__ */ jsx(CalloutBlock, {
|
|
121
|
+
el,
|
|
122
|
+
ctx,
|
|
123
|
+
autoFocus,
|
|
124
|
+
m: model,
|
|
125
|
+
set
|
|
126
|
+
}) : kind === "stats" ? /* @__PURE__ */ jsx(StatsBlock, {
|
|
105
127
|
el,
|
|
106
128
|
ctx,
|
|
107
129
|
autoFocus,
|
|
@@ -477,6 +499,7 @@ var frameValue = (m) => ({
|
|
|
477
499
|
});
|
|
478
500
|
function ImageBlock({ m, set, el, ctx }) {
|
|
479
501
|
const { MediaPicker, canCrop } = useKitServices();
|
|
502
|
+
const v16 = useKitLook() === "v16";
|
|
480
503
|
const [picker, setPicker] = React.useState(false);
|
|
481
504
|
const [urlMode, setUrlMode] = React.useState(false);
|
|
482
505
|
const [url, setUrl] = React.useState("");
|
|
@@ -593,14 +616,15 @@ function ImageBlock({ m, set, el, ctx }) {
|
|
|
593
616
|
const width = size ? SIZES.find((x) => x.v === size)?.w ?? "100%" : ALIGN_WIDTH[align];
|
|
594
617
|
const justify = align === "left" ? "justify-start" : align === "right" ? "justify-end" : "justify-center";
|
|
595
618
|
const alignItem = ALIGNS.find((a) => a.v === align);
|
|
596
|
-
const toolBtn = "flex h-7 shrink-0 items-center gap-1 rounded-kit-md px-1.5 text-kit-xs text-kit-fg-2 hover:bg-kit-hover hover:text-kit-fg data-[popup-open]:bg-kit-hover data-[popup-open]:text-kit-fg [&_svg]:size-3.5";
|
|
619
|
+
const toolBtn = v16 ? "grid size-6 shrink-0 place-items-center rounded-[5px] text-kit-insp-btool-icon hover:bg-kit-insp-btool-hover data-[popup-open]:bg-kit-insp-btool-hover [&_svg]:size-3.5 [&>svg+svg]:hidden" : "flex h-7 shrink-0 items-center gap-1 rounded-kit-md px-1.5 text-kit-xs text-kit-fg-2 hover:bg-kit-hover hover:text-kit-fg data-[popup-open]:bg-kit-hover data-[popup-open]:text-kit-fg [&_svg]:size-3.5";
|
|
620
|
+
const contentWidth = (size ?? (align === "full" ? "full" : null)) === "full";
|
|
597
621
|
return /* @__PURE__ */ jsxs("figure", {
|
|
598
622
|
className: "group/blk relative m-0",
|
|
599
623
|
children: [
|
|
600
624
|
ro ? null : /* @__PURE__ */ jsxs("div", {
|
|
601
625
|
role: "toolbar",
|
|
602
626
|
"aria-label": "Image tools",
|
|
603
|
-
className: cn("glass-strong absolute left-1/2 top-2 z-[3] flex h-8 -translate-x-1/2 items-center gap-0.5 rounded-kit-lg border border-kit-line px-1 opacity-0 transition-opacity duration-150", "group-hover/blk:opacity-100 group-focus-within/blk:opacity-100 pointer-coarse:opacity-100", busy && "opacity-100"),
|
|
627
|
+
className: cn(v16 ? "absolute right-2 top-2 z-[6] flex items-center gap-px rounded-[8px] bg-kit-insp-btool-bg p-[3px] opacity-0 shadow-[0_0_0_1px_var(--kit-insp-btool-line),0_1px_2px_rgb(0_0_0/0.05),0_8px_24px_-4px_rgb(0_0_0/0.1)] transition-opacity duration-150 [&>[aria-hidden].w-px]:hidden" : "glass-strong absolute left-1/2 top-2 z-[3] flex h-8 -translate-x-1/2 items-center gap-0.5 rounded-kit-lg border border-kit-line px-1 opacity-0 transition-opacity duration-150", "group-hover/blk:opacity-100 group-focus-within/blk:opacity-100 pointer-coarse:opacity-100", busy && "opacity-100"),
|
|
604
628
|
children: [
|
|
605
629
|
MediaPicker ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Tooltip, {
|
|
606
630
|
content: "Replace image",
|
|
@@ -612,7 +636,7 @@ function ImageBlock({ m, set, el, ctx }) {
|
|
|
612
636
|
children: [/* @__PURE__ */ jsx(IconReplace, {
|
|
613
637
|
stroke: 1.5,
|
|
614
638
|
"aria-hidden": true
|
|
615
|
-
}), ctx.dense ? null : "Replace"]
|
|
639
|
+
}), ctx.dense || v16 ? null : "Replace"]
|
|
616
640
|
})
|
|
617
641
|
}), /* @__PURE__ */ jsx(Sep, {})] }) : null,
|
|
618
642
|
/* @__PURE__ */ jsxs(Menu, {
|
|
@@ -645,7 +669,26 @@ function ImageBlock({ m, set, el, ctx }) {
|
|
|
645
669
|
}, a.v))
|
|
646
670
|
})]
|
|
647
671
|
}),
|
|
648
|
-
/* @__PURE__ */ jsx(
|
|
672
|
+
v16 ? /* @__PURE__ */ jsx(Tooltip, {
|
|
673
|
+
content: "Content width",
|
|
674
|
+
children: /* @__PURE__ */ jsx("button", {
|
|
675
|
+
type: "button",
|
|
676
|
+
"aria-label": "Content width",
|
|
677
|
+
"aria-pressed": contentWidth,
|
|
678
|
+
className: cn(toolBtn, contentWidth && "bg-kit-insp-btool-hover"),
|
|
679
|
+
onClick: () => set(contentWidth ? {
|
|
680
|
+
size: "l",
|
|
681
|
+
align: "center"
|
|
682
|
+
} : {
|
|
683
|
+
size: "full",
|
|
684
|
+
align: "full"
|
|
685
|
+
}, "Resize image"),
|
|
686
|
+
children: /* @__PURE__ */ jsx(IconArrowsHorizontal, {
|
|
687
|
+
stroke: 1.5,
|
|
688
|
+
"aria-hidden": true
|
|
689
|
+
})
|
|
690
|
+
})
|
|
691
|
+
}) : /* @__PURE__ */ jsx("div", {
|
|
649
692
|
role: "group",
|
|
650
693
|
"aria-label": "Size",
|
|
651
694
|
className: "flex items-center",
|
|
@@ -776,7 +819,7 @@ function ImageBlock({ m, set, el, ctx }) {
|
|
|
776
819
|
src: m.src,
|
|
777
820
|
alt: m.alt ?? "",
|
|
778
821
|
style: { width },
|
|
779
|
-
className: "block h-auto max-w-full rounded-kit-lg border border-kit-line",
|
|
822
|
+
className: cn("block h-auto max-w-full rounded-kit-lg border border-kit-line", v16 && "rounded-[10px] border-0 bg-kit-insp-card"),
|
|
780
823
|
draggable: false
|
|
781
824
|
})
|
|
782
825
|
}),
|
|
@@ -787,7 +830,7 @@ function ImageBlock({ m, set, el, ctx }) {
|
|
|
787
830
|
placeholder: ro ? "" : "Add a caption…",
|
|
788
831
|
onChange: (caption) => set({ caption }, "Edit caption"),
|
|
789
832
|
onEnter: () => ctx.exit(el),
|
|
790
|
-
className: "mt-1.5 text-center text-kit-sm text-kit-fg-3 empty:before:text-kit-fg-4"
|
|
833
|
+
className: cn("mt-1.5 text-center text-kit-sm text-kit-fg-3 empty:before:text-kit-fg-4", v16 && "mt-2 text-[13px] leading-[18px] text-kit-group-sub")
|
|
791
834
|
}),
|
|
792
835
|
pickerEl
|
|
793
836
|
]
|
|
@@ -960,16 +1003,242 @@ function CalloutBlock({ m, set, el, ctx, autoFocus }) {
|
|
|
960
1003
|
]
|
|
961
1004
|
});
|
|
962
1005
|
}
|
|
1006
|
+
var V16_CALLOUT_LOOK = {
|
|
1007
|
+
note: {
|
|
1008
|
+
box: "bg-kit-insp-callout-note shadow-[inset_0_0_0_1px_var(--kit-insp-callout-note-line)]",
|
|
1009
|
+
icon: "text-kit-insp-callout-note-icon"
|
|
1010
|
+
},
|
|
1011
|
+
info: {
|
|
1012
|
+
box: "bg-kit-insp-callout-info shadow-[inset_0_0_0_1px_var(--kit-insp-callout-info-line)]",
|
|
1013
|
+
icon: "text-kit-insp-callout-info-icon"
|
|
1014
|
+
},
|
|
1015
|
+
tip: {
|
|
1016
|
+
box: "bg-kit-insp-callout-tip shadow-[inset_0_0_0_1px_var(--kit-insp-callout-tip-line)]",
|
|
1017
|
+
icon: "text-kit-insp-callout-tip-icon"
|
|
1018
|
+
},
|
|
1019
|
+
warning: {
|
|
1020
|
+
box: "bg-kit-insp-callout-warn shadow-[inset_0_0_0_1px_var(--kit-insp-callout-warn-line)]",
|
|
1021
|
+
icon: "text-kit-insp-callout-warn-icon"
|
|
1022
|
+
}
|
|
1023
|
+
};
|
|
1024
|
+
function CalloutBlockV16({ m, set, el, ctx, autoFocus }) {
|
|
1025
|
+
const ro = ctx.readOnly;
|
|
1026
|
+
const tone = V16_CALLOUT_TONES.find((t) => t.tone === (m.tone ?? "info")) ?? V16_CALLOUT_TONES[1];
|
|
1027
|
+
const look = V16_CALLOUT_LOOK[tone.tone];
|
|
1028
|
+
const [menuOpen, setMenuOpen] = React.useState(false);
|
|
1029
|
+
const styled = ctx.allows?.("calloutStyle") ?? false;
|
|
1030
|
+
const turnInto = (tag) => {
|
|
1031
|
+
const text = [m.title, m.body].filter((x) => x && x.trim()).join("\n\n");
|
|
1032
|
+
const html = textToParas(text) || "<p><br></p>";
|
|
1033
|
+
if (tag === "blockquote") {
|
|
1034
|
+
const q = document.createElement("blockquote");
|
|
1035
|
+
q.innerHTML = html;
|
|
1036
|
+
return ctx.replace?.(el, [q], "Turned into quote");
|
|
1037
|
+
}
|
|
1038
|
+
const t = document.createElement("template");
|
|
1039
|
+
t.innerHTML = html;
|
|
1040
|
+
ctx.replace?.(el, Array.from(t.content.children), "Turned into text");
|
|
1041
|
+
};
|
|
1042
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
1043
|
+
className: cn("group/blk relative my-4 flex gap-3 rounded-[12px] px-4 py-[14px] text-[14px] leading-[22px] text-kit-fg", look.box),
|
|
1044
|
+
"data-rt-isolate": "",
|
|
1045
|
+
children: [
|
|
1046
|
+
ro ? null : /* @__PURE__ */ jsxs(BlockTool, {
|
|
1047
|
+
label: "Callout",
|
|
1048
|
+
open: menuOpen,
|
|
1049
|
+
children: [
|
|
1050
|
+
/* @__PURE__ */ jsx(BlockToolMenu, {
|
|
1051
|
+
label: tone.label,
|
|
1052
|
+
aria: `Callout tone: ${tone.label}`,
|
|
1053
|
+
onOpenChange: setMenuOpen,
|
|
1054
|
+
choices: V16_CALLOUT_TONES.filter((t) => styled || t.tone !== "note" || tone.tone === "note").map((t) => ({
|
|
1055
|
+
label: t.label,
|
|
1056
|
+
on: t.tone === tone.tone,
|
|
1057
|
+
run: () => set({ tone: t.tone }, "Change callout tone")
|
|
1058
|
+
}))
|
|
1059
|
+
}),
|
|
1060
|
+
styled ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(BlockToolSep, {}), /* @__PURE__ */ jsx(BlockToolMenu, {
|
|
1061
|
+
label: "Icon",
|
|
1062
|
+
onOpenChange: setMenuOpen,
|
|
1063
|
+
choices: [{
|
|
1064
|
+
label: "Show icon",
|
|
1065
|
+
on: m.icon !== "none",
|
|
1066
|
+
run: () => set((p) => ({
|
|
1067
|
+
...p,
|
|
1068
|
+
icon: void 0
|
|
1069
|
+
}), "Show callout icon")
|
|
1070
|
+
}, {
|
|
1071
|
+
label: "No icon",
|
|
1072
|
+
on: m.icon === "none",
|
|
1073
|
+
run: () => set({ icon: "none" }, "Hide callout icon")
|
|
1074
|
+
}]
|
|
1075
|
+
})] }) : null,
|
|
1076
|
+
ctx.replace ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(BlockToolSep, {}), /* @__PURE__ */ jsx(BlockToolMenu, {
|
|
1077
|
+
label: "Turn into",
|
|
1078
|
+
onOpenChange: setMenuOpen,
|
|
1079
|
+
choices: [{
|
|
1080
|
+
label: "Text",
|
|
1081
|
+
run: () => turnInto("p")
|
|
1082
|
+
}, ...ctx.allows?.("blockquote") === false ? [] : [{
|
|
1083
|
+
label: "Quote",
|
|
1084
|
+
run: () => turnInto("blockquote")
|
|
1085
|
+
}]]
|
|
1086
|
+
})] }) : null
|
|
1087
|
+
]
|
|
1088
|
+
}),
|
|
1089
|
+
m.icon === "none" ? null : /* @__PURE__ */ jsx(IconInfoCircle, {
|
|
1090
|
+
"aria-hidden": true,
|
|
1091
|
+
stroke: 2,
|
|
1092
|
+
className: cn("mt-[3px] size-4 shrink-0", look.icon)
|
|
1093
|
+
}),
|
|
1094
|
+
/* @__PURE__ */ jsxs("div", {
|
|
1095
|
+
className: "min-w-0 flex-1",
|
|
1096
|
+
children: [m.title ? /* @__PURE__ */ jsx(PlainEditable, {
|
|
1097
|
+
value: m.title,
|
|
1098
|
+
label: "Callout title",
|
|
1099
|
+
readOnly: ro,
|
|
1100
|
+
onChange: (title) => set({ title }, "Edit callout title"),
|
|
1101
|
+
className: "font-medium"
|
|
1102
|
+
}) : null, /* @__PURE__ */ jsx(PlainEditable, {
|
|
1103
|
+
multiline: true,
|
|
1104
|
+
value: m.body ?? "",
|
|
1105
|
+
label: "Callout message",
|
|
1106
|
+
readOnly: ro,
|
|
1107
|
+
autoFocus,
|
|
1108
|
+
placeholder: "Write a note for readers.",
|
|
1109
|
+
onChange: (b) => set({ body: b }, "Edit callout message")
|
|
1110
|
+
})]
|
|
1111
|
+
})
|
|
1112
|
+
]
|
|
1113
|
+
});
|
|
1114
|
+
}
|
|
1115
|
+
var STAT_COLS = [
|
|
1116
|
+
2,
|
|
1117
|
+
3,
|
|
1118
|
+
4
|
|
1119
|
+
];
|
|
1120
|
+
function StatsBlock({ m, set, el, ctx, autoFocus }) {
|
|
1121
|
+
const ro = ctx.readOnly;
|
|
1122
|
+
const cols = m.cols ?? 3;
|
|
1123
|
+
const filled = m.style === "filled";
|
|
1124
|
+
const [menuOpen, setMenuOpen] = React.useState(false);
|
|
1125
|
+
const grid = React.useRef(null);
|
|
1126
|
+
const edit = (i, k, v) => set((p) => ({
|
|
1127
|
+
...p,
|
|
1128
|
+
items: p.items.map((c, j) => j === i ? {
|
|
1129
|
+
...c,
|
|
1130
|
+
[k]: v
|
|
1131
|
+
} : c)
|
|
1132
|
+
}), "Edit stat");
|
|
1133
|
+
const focusCard = (i, part = 0) => {
|
|
1134
|
+
requestAnimationFrame(() => {
|
|
1135
|
+
const b = grid.current?.children[i]?.querySelectorAll("[role=textbox]")[part];
|
|
1136
|
+
b?.focus();
|
|
1137
|
+
if (b) placeCaret(b, false);
|
|
1138
|
+
});
|
|
1139
|
+
};
|
|
1140
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
1141
|
+
className: "group/blk relative my-5",
|
|
1142
|
+
"data-rt-isolate": "",
|
|
1143
|
+
children: [ro ? null : /* @__PURE__ */ jsxs(BlockTool, {
|
|
1144
|
+
label: "Stats",
|
|
1145
|
+
open: menuOpen,
|
|
1146
|
+
children: [
|
|
1147
|
+
/* @__PURE__ */ jsx(BlockToolMenu, {
|
|
1148
|
+
label: `${cols} columns`,
|
|
1149
|
+
onOpenChange: setMenuOpen,
|
|
1150
|
+
choices: STAT_COLS.map((n) => ({
|
|
1151
|
+
label: `${n} columns`,
|
|
1152
|
+
on: cols === n,
|
|
1153
|
+
run: () => set({ cols: n }, "Change stats columns")
|
|
1154
|
+
}))
|
|
1155
|
+
}),
|
|
1156
|
+
/* @__PURE__ */ jsx(BlockToolSep, {}),
|
|
1157
|
+
/* @__PURE__ */ jsxs("button", {
|
|
1158
|
+
type: "button",
|
|
1159
|
+
className: BLOCK_TOOL_BTN,
|
|
1160
|
+
onClick: () => {
|
|
1161
|
+
set((p) => ({
|
|
1162
|
+
...p,
|
|
1163
|
+
items: [...p.items, newStat()]
|
|
1164
|
+
}), "Add stat");
|
|
1165
|
+
focusCard(m.items.length);
|
|
1166
|
+
},
|
|
1167
|
+
children: [/* @__PURE__ */ jsx(IconPlus, {
|
|
1168
|
+
stroke: 1.75,
|
|
1169
|
+
"aria-hidden": true
|
|
1170
|
+
}), "Add stat"]
|
|
1171
|
+
}),
|
|
1172
|
+
/* @__PURE__ */ jsx(BlockToolSep, {}),
|
|
1173
|
+
/* @__PURE__ */ jsx(BlockToolMenu, {
|
|
1174
|
+
label: "Card style",
|
|
1175
|
+
onOpenChange: setMenuOpen,
|
|
1176
|
+
choices: [{
|
|
1177
|
+
label: "Outlined",
|
|
1178
|
+
on: !filled,
|
|
1179
|
+
run: () => set({ style: "outlined" }, "Change card style")
|
|
1180
|
+
}, {
|
|
1181
|
+
label: "Filled",
|
|
1182
|
+
on: filled,
|
|
1183
|
+
run: () => set({ style: "filled" }, "Change card style")
|
|
1184
|
+
}]
|
|
1185
|
+
})
|
|
1186
|
+
]
|
|
1187
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
1188
|
+
ref: grid,
|
|
1189
|
+
className: "grid gap-3",
|
|
1190
|
+
style: { gridTemplateColumns: `repeat(${cols}, minmax(0, 1fr))` },
|
|
1191
|
+
children: m.items.map((c, i) => /* @__PURE__ */ jsxs("div", {
|
|
1192
|
+
className: cn("flex min-w-0 flex-col gap-1 rounded-[12px] p-4", filled ? "bg-kit-insp-stat-filled" : "bg-kit-insp-stat-card shadow-[inset_0_0_0_1px_var(--kit-insp-stat-card-line)]"),
|
|
1193
|
+
children: [
|
|
1194
|
+
/* @__PURE__ */ jsx(PlainEditable, {
|
|
1195
|
+
value: c.label,
|
|
1196
|
+
label: "Stat label",
|
|
1197
|
+
readOnly: ro,
|
|
1198
|
+
autoFocus: autoFocus && i === 0,
|
|
1199
|
+
onChange: (v) => edit(i, "label", v),
|
|
1200
|
+
onEnter: () => focusCard(i, 1),
|
|
1201
|
+
onBackspaceEmpty: m.items.length > 1 && !c.value && !c.note ? () => {
|
|
1202
|
+
set((p) => ({
|
|
1203
|
+
...p,
|
|
1204
|
+
items: p.items.filter((_, j) => j !== i)
|
|
1205
|
+
}), "Remove stat");
|
|
1206
|
+
if (i > 0) focusCard(i - 1, 2);
|
|
1207
|
+
} : void 0,
|
|
1208
|
+
className: "text-[13px] font-medium leading-[18px] text-kit-insp-stat-label"
|
|
1209
|
+
}),
|
|
1210
|
+
/* @__PURE__ */ jsx(PlainEditable, {
|
|
1211
|
+
value: c.value,
|
|
1212
|
+
label: "Stat value",
|
|
1213
|
+
readOnly: ro,
|
|
1214
|
+
onChange: (v) => edit(i, "value", v),
|
|
1215
|
+
onEnter: () => focusCard(i, 2),
|
|
1216
|
+
className: "text-[28px] font-semibold leading-9 tracking-[-0.4px] text-kit-insp-stat-value"
|
|
1217
|
+
}),
|
|
1218
|
+
/* @__PURE__ */ jsx(PlainEditable, {
|
|
1219
|
+
value: c.note,
|
|
1220
|
+
label: "Stat note",
|
|
1221
|
+
readOnly: ro,
|
|
1222
|
+
onChange: (v) => edit(i, "note", v),
|
|
1223
|
+
onEnter: () => i + 1 < m.items.length ? focusCard(i + 1) : ctx.exit(el),
|
|
1224
|
+
className: "text-[12px] leading-4 text-kit-insp-stat-note"
|
|
1225
|
+
})
|
|
1226
|
+
]
|
|
1227
|
+
}, c._key))
|
|
1228
|
+
})]
|
|
1229
|
+
});
|
|
1230
|
+
}
|
|
963
1231
|
function ToggleBlock({ m, set, el, ctx, autoFocus }) {
|
|
964
|
-
const
|
|
1232
|
+
const v16 = useKitLook() === "v16";
|
|
1233
|
+
const [open, setOpen] = React.useState(!!autoFocus || v16);
|
|
965
1234
|
const body = React.useRef(null);
|
|
966
1235
|
const bodyId = React.useId();
|
|
967
1236
|
const ro = ctx.readOnly;
|
|
968
1237
|
return /* @__PURE__ */ jsxs("div", {
|
|
969
|
-
className: "group/blk relative rounded-kit-md",
|
|
1238
|
+
className: cn("group/blk relative rounded-kit-md", v16 && "my-3"),
|
|
970
1239
|
"data-rt-isolate": "",
|
|
971
1240
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
972
|
-
className: "flex items-start gap-1",
|
|
1241
|
+
className: cn("flex items-start gap-1", v16 && "items-center gap-1.5"),
|
|
973
1242
|
children: [
|
|
974
1243
|
/* @__PURE__ */ jsx("button", {
|
|
975
1244
|
type: "button",
|
|
@@ -977,10 +1246,10 @@ function ToggleBlock({ m, set, el, ctx, autoFocus }) {
|
|
|
977
1246
|
"aria-controls": bodyId,
|
|
978
1247
|
"aria-label": open ? "Collapse toggle" : "Expand toggle",
|
|
979
1248
|
onClick: () => setOpen((o) => !o),
|
|
980
|
-
className: "mt-0.5 flex size-6 shrink-0 items-center justify-center rounded-kit-md text-kit-fg-2 hover:bg-kit-hover hover:text-kit-fg",
|
|
1249
|
+
className: cn("mt-0.5 flex size-6 shrink-0 items-center justify-center rounded-kit-md text-kit-fg-2 hover:bg-kit-hover hover:text-kit-fg", v16 && "mt-0 size-4 rounded-[4px] text-kit-insp-tip-title hover:bg-kit-insp-card hover:text-kit-insp-tip-title"),
|
|
981
1250
|
children: /* @__PURE__ */ jsx(IconChevronRight, {
|
|
982
1251
|
className: cn("size-4 transition-transform duration-150", open && "rotate-90"),
|
|
983
|
-
stroke: 1.5,
|
|
1252
|
+
stroke: v16 ? 2.2 : 1.5,
|
|
984
1253
|
"aria-hidden": true
|
|
985
1254
|
})
|
|
986
1255
|
}),
|
|
@@ -999,7 +1268,7 @@ function ToggleBlock({ m, set, el, ctx, autoFocus }) {
|
|
|
999
1268
|
if (b) placeCaret(b, false);
|
|
1000
1269
|
});
|
|
1001
1270
|
},
|
|
1002
|
-
className: "flex-1 py-0.5 font-medium text-kit-fg"
|
|
1271
|
+
className: cn("flex-1 py-0.5 font-medium text-kit-fg", v16 && "py-0 text-[16px] leading-[26px] text-kit-insp-tip-title")
|
|
1003
1272
|
}),
|
|
1004
1273
|
ro ? null : /* @__PURE__ */ jsx("div", {
|
|
1005
1274
|
className: "opacity-0 transition-opacity group-hover/blk:opacity-100 group-focus-within/blk:opacity-100 pointer-coarse:opacity-100",
|
|
@@ -1013,15 +1282,15 @@ function ToggleBlock({ m, set, el, ctx, autoFocus }) {
|
|
|
1013
1282
|
ref: body,
|
|
1014
1283
|
id: bodyId,
|
|
1015
1284
|
hidden: !open,
|
|
1016
|
-
className: "ml-3 mt-1 border-l border-kit-line pl-4",
|
|
1285
|
+
className: cn("ml-3 mt-1 border-l border-kit-line pl-4", v16 && "ml-0 mt-0 border-l-0 pl-[22px]"),
|
|
1017
1286
|
children: /* @__PURE__ */ jsx(PlainEditable, {
|
|
1018
1287
|
multiline: true,
|
|
1019
1288
|
value: m.body ?? "",
|
|
1020
1289
|
label: "Toggle body",
|
|
1021
1290
|
readOnly: ro,
|
|
1022
|
-
placeholder: "Hidden content. Click to write…",
|
|
1291
|
+
placeholder: v16 ? "Content that stays hidden until the reader opens it." : "Hidden content. Click to write…",
|
|
1023
1292
|
onChange: (b) => set({ body: b }, "Edit toggle body"),
|
|
1024
|
-
className: "py-0.5 text-kit-fg-2 [&_p+p]:mt-2"
|
|
1293
|
+
className: cn("py-0.5 text-kit-fg-2 [&_p+p]:mt-2", v16 && "py-0 text-[16px] leading-[26px] text-kit-insp-tip-body")
|
|
1025
1294
|
})
|
|
1026
1295
|
})]
|
|
1027
1296
|
});
|
|
@@ -1040,8 +1309,9 @@ function VideoBlock({ m, set, el, ctx, autoFocus }) {
|
|
|
1040
1309
|
set({ url: u }, "Set video link");
|
|
1041
1310
|
};
|
|
1042
1311
|
const ro = ctx.readOnly;
|
|
1312
|
+
const v16 = useKitLook() === "v16";
|
|
1043
1313
|
return /* @__PURE__ */ jsxs("div", {
|
|
1044
|
-
className: "group/blk rounded-kit-lg border border-kit-line bg-kit-subtle p-2.5",
|
|
1314
|
+
className: cn("group/blk rounded-kit-lg border border-kit-line bg-kit-subtle p-2.5", v16 && "my-5 rounded-none border-0 bg-transparent p-0"),
|
|
1045
1315
|
"data-rt-isolate": "",
|
|
1046
1316
|
children: [
|
|
1047
1317
|
ro ? null : /* @__PURE__ */ jsxs("div", {
|
|
@@ -1077,7 +1347,23 @@ function VideoBlock({ m, set, el, ctx, autoFocus }) {
|
|
|
1077
1347
|
className: "mb-2 px-1 text-kit-xs text-kit-danger-fg",
|
|
1078
1348
|
children: error
|
|
1079
1349
|
}) : null,
|
|
1080
|
-
|
|
1350
|
+
v16 ? /* @__PURE__ */ jsxs("figure", {
|
|
1351
|
+
className: "m-0",
|
|
1352
|
+
children: [m.url ? /* @__PURE__ */ jsx("div", {
|
|
1353
|
+
className: "overflow-hidden rounded-[10px]",
|
|
1354
|
+
children: /* @__PURE__ */ jsx(VideoPreview, {
|
|
1355
|
+
url: m.url,
|
|
1356
|
+
title: "Video"
|
|
1357
|
+
})
|
|
1358
|
+
}) : /* @__PURE__ */ jsx("div", {
|
|
1359
|
+
"aria-hidden": true,
|
|
1360
|
+
className: "grid h-[300px] place-items-center rounded-[10px] bg-kit-insp-code-bg bg-[linear-gradient(rgb(23_23_23/0.55),rgb(23_23_23/0.55))]",
|
|
1361
|
+
children: /* @__PURE__ */ jsx("span", { className: "relative size-14 rounded-full bg-kit-insp-tip-bg shadow-[0_4px_14px_rgb(0_0_0/0.18)] after:absolute after:left-[22px] after:top-[18px] after:border-y-[10px] after:border-l-[15px] after:border-y-transparent after:border-l-kit-insp-tip-title after:content-['']" })
|
|
1362
|
+
}), /* @__PURE__ */ jsx("figcaption", {
|
|
1363
|
+
className: "mt-2 text-center text-[13px] leading-[18px] text-kit-group-sub",
|
|
1364
|
+
children: m.title || (m.url ? "Video" : "Paste a YouTube, Vimeo or Loom link")
|
|
1365
|
+
})]
|
|
1366
|
+
}) : m.url ? /* @__PURE__ */ jsx(VideoPreview, {
|
|
1081
1367
|
url: m.url,
|
|
1082
1368
|
title: "Video"
|
|
1083
1369
|
}) : /* @__PURE__ */ jsx("p", {
|
|
@@ -1105,6 +1391,39 @@ function FileBlock({ m, set, el, ctx, autoFocus }) {
|
|
|
1105
1391
|
...a[0].size ? { size: a[0].size } : {}
|
|
1106
1392
|
}, "Choose file")
|
|
1107
1393
|
}) : null;
|
|
1394
|
+
const v16 = useKitLook() === "v16";
|
|
1395
|
+
const type = (m.name?.includes(".") ? m.name.split(".").pop() : "file").toUpperCase();
|
|
1396
|
+
if (has && v16) return /* @__PURE__ */ jsxs("div", {
|
|
1397
|
+
className: "group/blk my-4",
|
|
1398
|
+
"data-rt-isolate": "",
|
|
1399
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
1400
|
+
className: "flex items-center gap-2.5 rounded-[10px] px-3 py-2.5 text-kit-insp-tip-body shadow-[inset_0_0_0_1px_var(--kit-insp-divider)]",
|
|
1401
|
+
children: [
|
|
1402
|
+
/* @__PURE__ */ jsx(IconFileText, {
|
|
1403
|
+
className: "size-3.5 shrink-0",
|
|
1404
|
+
stroke: 1.8,
|
|
1405
|
+
"aria-hidden": true
|
|
1406
|
+
}),
|
|
1407
|
+
/* @__PURE__ */ jsx("b", {
|
|
1408
|
+
className: "min-w-0 truncate text-[14px] font-medium leading-[26px] text-kit-insp-tip-title",
|
|
1409
|
+
children: m.name
|
|
1410
|
+
}),
|
|
1411
|
+
/* @__PURE__ */ jsxs("small", {
|
|
1412
|
+
className: "min-w-0 flex-1 truncate text-[12px] leading-[26px] text-kit-group-sub",
|
|
1413
|
+
children: [type, m.size ? ` · ${formatBytes(m.size)}` : ""]
|
|
1414
|
+
}),
|
|
1415
|
+
ro ? null : /* @__PURE__ */ jsxs(Fragment, { children: [MediaPicker ? /* @__PURE__ */ jsx(Button, {
|
|
1416
|
+
size: "xs",
|
|
1417
|
+
variant: "ghost",
|
|
1418
|
+
onClick: () => setPicker(true),
|
|
1419
|
+
children: "Replace"
|
|
1420
|
+
}) : null, /* @__PURE__ */ jsx(RemoveBtn, {
|
|
1421
|
+
onClick: () => ctx.remove(el),
|
|
1422
|
+
label: "Remove file"
|
|
1423
|
+
})] })
|
|
1424
|
+
]
|
|
1425
|
+
}), pickerEl]
|
|
1426
|
+
});
|
|
1108
1427
|
if (has) return /* @__PURE__ */ jsxs("div", {
|
|
1109
1428
|
className: "group/blk",
|
|
1110
1429
|
"data-rt-isolate": "",
|
|
@@ -1126,7 +1445,7 @@ function FileBlock({ m, set, el, ctx, autoFocus }) {
|
|
|
1126
1445
|
children: m.name
|
|
1127
1446
|
}), /* @__PURE__ */ jsxs("div", {
|
|
1128
1447
|
className: "truncate text-kit-xs text-kit-fg-3",
|
|
1129
|
-
children: [m.size ? `${formatBytes(m.size)} · ` : "",
|
|
1448
|
+
children: [m.size ? `${formatBytes(m.size)} · ` : "", type]
|
|
1130
1449
|
})]
|
|
1131
1450
|
}),
|
|
1132
1451
|
ro ? null : /* @__PURE__ */ jsxs(Fragment, { children: [MediaPicker ? /* @__PURE__ */ jsx(Button, {
|
|
@@ -1225,6 +1544,7 @@ function FileBlock({ m, set, el, ctx, autoFocus }) {
|
|
|
1225
1544
|
}
|
|
1226
1545
|
function ComponentBlock({ m, el, ctx, set }) {
|
|
1227
1546
|
const { useComponentInfo } = useKitServices();
|
|
1547
|
+
const v16 = useKitLook() === "v16";
|
|
1228
1548
|
const overrides = React.useMemo(() => {
|
|
1229
1549
|
try {
|
|
1230
1550
|
const v = m.overrides ? JSON.parse(m.overrides) : {};
|
|
@@ -1243,6 +1563,38 @@ function ComponentBlock({ m, el, ctx, set }) {
|
|
|
1243
1563
|
});
|
|
1244
1564
|
const count = Object.keys(overrides).length;
|
|
1245
1565
|
const name = m.name || "Block";
|
|
1566
|
+
if (v16) return /* @__PURE__ */ jsxs("aside", {
|
|
1567
|
+
role: "group",
|
|
1568
|
+
"aria-label": `${name}, ${m.detached ? "separate copy" : "linked block"}`,
|
|
1569
|
+
className: "group/blk relative my-4 flex flex-col gap-1.5 rounded-[12px] bg-kit-insp-tip-bg p-5 text-[13px] leading-[26px] text-kit-group-sub shadow-[inset_0_0_0_1px_var(--kit-insp-divider)]",
|
|
1570
|
+
"data-rt-isolate": "",
|
|
1571
|
+
children: [
|
|
1572
|
+
/* @__PURE__ */ jsxs("small", {
|
|
1573
|
+
className: "text-[12px] font-medium text-kit-insp-faint",
|
|
1574
|
+
children: ["Site block · ", name]
|
|
1575
|
+
}),
|
|
1576
|
+
/* @__PURE__ */ jsx("b", {
|
|
1577
|
+
className: "text-[20px] font-semibold leading-7 text-kit-insp-tip-title",
|
|
1578
|
+
children: name
|
|
1579
|
+
}),
|
|
1580
|
+
/* @__PURE__ */ jsxs("span", {
|
|
1581
|
+
className: "text-[14px] leading-[22px]",
|
|
1582
|
+
children: [m.detached ? "Separate copy · edits to the block don't reach it" : "Edit its content in the Visual editor", !m.detached && count ? ` · ${count} ${count === 1 ? "override" : "overrides"}` : ""]
|
|
1583
|
+
}),
|
|
1584
|
+
ctx.readOnly ? null : /* @__PURE__ */ jsxs("div", {
|
|
1585
|
+
className: "absolute right-3 top-3 flex items-center gap-0.5 opacity-0 transition-opacity motion-reduce:transition-none group-hover/blk:opacity-100 group-focus-within/blk:opacity-100 pointer-coarse:opacity-100",
|
|
1586
|
+
children: [ctx.duplicate ? /* @__PURE__ */ jsx(IconButton, {
|
|
1587
|
+
size: "xs",
|
|
1588
|
+
label: `Duplicate ${name}`,
|
|
1589
|
+
onClick: () => ctx.duplicate?.(el),
|
|
1590
|
+
children: /* @__PURE__ */ jsx(IconCopy, { stroke: 1.5 })
|
|
1591
|
+
}) : null, /* @__PURE__ */ jsx(RemoveBtn, {
|
|
1592
|
+
onClick: () => ctx.remove(el),
|
|
1593
|
+
label: `Remove ${name}`
|
|
1594
|
+
})]
|
|
1595
|
+
})
|
|
1596
|
+
]
|
|
1597
|
+
});
|
|
1246
1598
|
return /* @__PURE__ */ jsxs("div", {
|
|
1247
1599
|
role: "group",
|
|
1248
1600
|
"aria-label": `${name}, ${m.detached ? "separate copy" : "linked block"}`,
|
|
@@ -1523,7 +1875,35 @@ function TakeawaysBlock({ m, set, el, ctx, autoFocus }) {
|
|
|
1523
1875
|
})]
|
|
1524
1876
|
});
|
|
1525
1877
|
}
|
|
1878
|
+
/** "Crystal Nolen" → "CN" (the byline avatar's initials) */
|
|
1879
|
+
var bylineInitials = (name) => name.trim().split(/\s+/).filter(Boolean).slice(0, 2).map((w) => w[0].toUpperCase()).join("");
|
|
1526
1880
|
function PullQuotePreview({ m }) {
|
|
1881
|
+
if (useKitLook() === "v16") return /* @__PURE__ */ jsxs("blockquote", {
|
|
1882
|
+
className: "m-0 border-l-2 border-kit-insp-accent py-0.5 pl-4 text-[17px] italic leading-7 text-kit-insp-tip-body",
|
|
1883
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
1884
|
+
"data-field": "quote",
|
|
1885
|
+
className: cn("m-0", !m.quote && "text-kit-insp-faint"),
|
|
1886
|
+
children: m.quote || "Write the quote"
|
|
1887
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
1888
|
+
className: "mt-3 flex items-center gap-2 text-[13px] not-italic leading-[18px] text-kit-group-sub",
|
|
1889
|
+
children: m.name ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("span", {
|
|
1890
|
+
"aria-hidden": true,
|
|
1891
|
+
className: "grid size-5 shrink-0 select-none place-items-center rounded-full border border-kit-insp-card-focus bg-kit-insp-opt-on font-sans text-[8.5px] font-semibold leading-none tracking-[0.2px] text-kit-insp-zone-link",
|
|
1892
|
+
children: bylineInitials(m.name)
|
|
1893
|
+
}), /* @__PURE__ */ jsxs("span", { children: [/* @__PURE__ */ jsx("b", {
|
|
1894
|
+
"data-field": "name",
|
|
1895
|
+
className: cn("font-medium text-kit-insp-tip-title", m.link && "underline decoration-kit-line-strong underline-offset-2"),
|
|
1896
|
+
children: m.name
|
|
1897
|
+
}), m.role ? /* @__PURE__ */ jsx("span", {
|
|
1898
|
+
"data-field": "role",
|
|
1899
|
+
children: ` · ${m.role}`
|
|
1900
|
+
}) : null] })] }) : /* @__PURE__ */ jsx("span", {
|
|
1901
|
+
"data-field": "name",
|
|
1902
|
+
className: "text-kit-insp-faint",
|
|
1903
|
+
children: "Who said it"
|
|
1904
|
+
})
|
|
1905
|
+
})]
|
|
1906
|
+
});
|
|
1527
1907
|
return /* @__PURE__ */ jsxs("figure", {
|
|
1528
1908
|
className: "m-0 py-2 pl-5 pr-10",
|
|
1529
1909
|
children: [
|
|
@@ -1560,6 +1940,6 @@ function PullQuotePreview({ m }) {
|
|
|
1560
1940
|
});
|
|
1561
1941
|
}
|
|
1562
1942
|
//#endregion
|
|
1563
|
-
export { Island };
|
|
1943
|
+
export { Island, bylineInitials };
|
|
1564
1944
|
|
|
1565
1945
|
//# sourceMappingURL=blocks.js.map
|