@bettercms-ai/kit 4.0.0 → 4.2.0-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/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 +91 -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 +406 -24
- package/dist/controls/rich-text/blocks.js.map +1 -1
- package/dist/controls/rich-text/catalog.d.ts +45 -7
- package/dist/controls/rich-text/catalog.js +507 -37
- 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 +4 -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 +77 -7
- package/dist/controls/rich-text/dom.js.map +1 -1
- package/dist/controls/rich-text/editor.js +243 -55
- 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/rewriteSelection.d.ts +25 -0
- package/dist/controls/rich-text/rewriteSelection.js +28 -0
- package/dist/controls/rich-text/rewriteSelection.js.map +1 -0
- package/dist/controls/rich-text/slash-preview.d.ts +8 -0
- package/dist/controls/rich-text/slash-preview.js +300 -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 +1057 -0
- package/dist/controls/rich-text/table-grid.js.map +1 -0
- package/dist/controls/rich-text/toolbar.js +61 -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 +222 -64
- package/dist/engine/field-shell.js.map +1 -1
- package/dist/engine/frame.js +42 -4
- package/dist/engine/frame.js.map +1 -1
- package/dist/engine/grouping.d.ts +71 -10
- package/dist/engine/grouping.js +227 -29
- package/dist/engine/grouping.js.map +1 -1
- package/dist/engine/item-list.js +2 -2
- package/dist/engine/item-list.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.d.ts +2 -0
- package/dist/engine/schema-form.js +9 -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 +59 -0
- package/dist/lib/reduced-motion.d.ts +1 -0
- package/dist/lib/reduced-motion.js +19 -0
- package/dist/lib/reduced-motion.js.map +1 -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 +215 -0
- package/dist/tokens.css +274 -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 +279 -0
- package/dist/ui/content-fields.js.map +1 -0
- package/dist/ui/controls.js +3 -2
- package/dist/ui/controls.js.map +1 -1
- package/dist/ui/floating-panel.js +3 -2
- package/dist/ui/floating-panel.js.map +1 -1
- package/dist/ui/foundations.d.ts +118 -0
- package/dist/ui/foundations.js +565 -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 +412 -0
- package/dist/ui/inspector.js +1218 -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/tab.js +3 -2
- package/dist/ui/tab.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,17 @@ 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
|
-
|
|
627
|
+
"data-rt-imgtool": v16 ? "" : void 0,
|
|
628
|
+
"data-open": v16 && busy ? "" : void 0,
|
|
629
|
+
className: cn(v16 ? "absolute right-2 top-2 z-[6] flex origin-top-right items-center gap-px rounded-[8px] bg-kit-insp-btool-bg p-[3px] 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)] [&>[aria-hidden].w-px]:hidden" : 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")),
|
|
604
630
|
children: [
|
|
605
631
|
MediaPicker ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Tooltip, {
|
|
606
632
|
content: "Replace image",
|
|
@@ -612,7 +638,7 @@ function ImageBlock({ m, set, el, ctx }) {
|
|
|
612
638
|
children: [/* @__PURE__ */ jsx(IconReplace, {
|
|
613
639
|
stroke: 1.5,
|
|
614
640
|
"aria-hidden": true
|
|
615
|
-
}), ctx.dense ? null : "Replace"]
|
|
641
|
+
}), ctx.dense || v16 ? null : "Replace"]
|
|
616
642
|
})
|
|
617
643
|
}), /* @__PURE__ */ jsx(Sep, {})] }) : null,
|
|
618
644
|
/* @__PURE__ */ jsxs(Menu, {
|
|
@@ -645,7 +671,26 @@ function ImageBlock({ m, set, el, ctx }) {
|
|
|
645
671
|
}, a.v))
|
|
646
672
|
})]
|
|
647
673
|
}),
|
|
648
|
-
/* @__PURE__ */ jsx(
|
|
674
|
+
v16 ? /* @__PURE__ */ jsx(Tooltip, {
|
|
675
|
+
content: "Content width",
|
|
676
|
+
children: /* @__PURE__ */ jsx("button", {
|
|
677
|
+
type: "button",
|
|
678
|
+
"aria-label": "Content width",
|
|
679
|
+
"aria-pressed": contentWidth,
|
|
680
|
+
className: cn(toolBtn, contentWidth && "bg-kit-insp-btool-hover"),
|
|
681
|
+
onClick: () => set(contentWidth ? {
|
|
682
|
+
size: "l",
|
|
683
|
+
align: "center"
|
|
684
|
+
} : {
|
|
685
|
+
size: "full",
|
|
686
|
+
align: "full"
|
|
687
|
+
}, "Resize image"),
|
|
688
|
+
children: /* @__PURE__ */ jsx(IconArrowsHorizontal, {
|
|
689
|
+
stroke: 1.5,
|
|
690
|
+
"aria-hidden": true
|
|
691
|
+
})
|
|
692
|
+
})
|
|
693
|
+
}) : /* @__PURE__ */ jsx("div", {
|
|
649
694
|
role: "group",
|
|
650
695
|
"aria-label": "Size",
|
|
651
696
|
className: "flex items-center",
|
|
@@ -776,7 +821,7 @@ function ImageBlock({ m, set, el, ctx }) {
|
|
|
776
821
|
src: m.src,
|
|
777
822
|
alt: m.alt ?? "",
|
|
778
823
|
style: { width },
|
|
779
|
-
className: "block h-auto max-w-full rounded-kit-lg border border-kit-line",
|
|
824
|
+
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
825
|
draggable: false
|
|
781
826
|
})
|
|
782
827
|
}),
|
|
@@ -787,7 +832,7 @@ function ImageBlock({ m, set, el, ctx }) {
|
|
|
787
832
|
placeholder: ro ? "" : "Add a caption…",
|
|
788
833
|
onChange: (caption) => set({ caption }, "Edit caption"),
|
|
789
834
|
onEnter: () => ctx.exit(el),
|
|
790
|
-
className: "mt-1.5 text-center text-kit-sm text-kit-fg-3 empty:before:text-kit-fg-4"
|
|
835
|
+
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
836
|
}),
|
|
792
837
|
pickerEl
|
|
793
838
|
]
|
|
@@ -960,16 +1005,242 @@ function CalloutBlock({ m, set, el, ctx, autoFocus }) {
|
|
|
960
1005
|
]
|
|
961
1006
|
});
|
|
962
1007
|
}
|
|
1008
|
+
var V16_CALLOUT_LOOK = {
|
|
1009
|
+
note: {
|
|
1010
|
+
box: "bg-kit-insp-callout-note shadow-[inset_0_0_0_1px_var(--kit-insp-callout-note-line)]",
|
|
1011
|
+
icon: "text-kit-insp-callout-note-icon"
|
|
1012
|
+
},
|
|
1013
|
+
info: {
|
|
1014
|
+
box: "bg-kit-insp-callout-info shadow-[inset_0_0_0_1px_var(--kit-insp-callout-info-line)]",
|
|
1015
|
+
icon: "text-kit-insp-callout-info-icon"
|
|
1016
|
+
},
|
|
1017
|
+
tip: {
|
|
1018
|
+
box: "bg-kit-insp-callout-tip shadow-[inset_0_0_0_1px_var(--kit-insp-callout-tip-line)]",
|
|
1019
|
+
icon: "text-kit-insp-callout-tip-icon"
|
|
1020
|
+
},
|
|
1021
|
+
warning: {
|
|
1022
|
+
box: "bg-kit-insp-callout-warn shadow-[inset_0_0_0_1px_var(--kit-insp-callout-warn-line)]",
|
|
1023
|
+
icon: "text-kit-insp-callout-warn-icon"
|
|
1024
|
+
}
|
|
1025
|
+
};
|
|
1026
|
+
function CalloutBlockV16({ m, set, el, ctx, autoFocus }) {
|
|
1027
|
+
const ro = ctx.readOnly;
|
|
1028
|
+
const tone = V16_CALLOUT_TONES.find((t) => t.tone === (m.tone ?? "info")) ?? V16_CALLOUT_TONES[1];
|
|
1029
|
+
const look = V16_CALLOUT_LOOK[tone.tone];
|
|
1030
|
+
const [menuOpen, setMenuOpen] = React.useState(false);
|
|
1031
|
+
const styled = ctx.allows?.("calloutStyle") ?? false;
|
|
1032
|
+
const turnInto = (tag) => {
|
|
1033
|
+
const text = [m.title, m.body].filter((x) => x && x.trim()).join("\n\n");
|
|
1034
|
+
const html = textToParas(text) || "<p><br></p>";
|
|
1035
|
+
if (tag === "blockquote") {
|
|
1036
|
+
const q = document.createElement("blockquote");
|
|
1037
|
+
q.innerHTML = html;
|
|
1038
|
+
return ctx.replace?.(el, [q], "Turned into quote");
|
|
1039
|
+
}
|
|
1040
|
+
const t = document.createElement("template");
|
|
1041
|
+
t.innerHTML = html;
|
|
1042
|
+
ctx.replace?.(el, Array.from(t.content.children), "Turned into text");
|
|
1043
|
+
};
|
|
1044
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
1045
|
+
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),
|
|
1046
|
+
"data-rt-isolate": "",
|
|
1047
|
+
children: [
|
|
1048
|
+
ro ? null : /* @__PURE__ */ jsxs(BlockTool, {
|
|
1049
|
+
label: "Callout",
|
|
1050
|
+
open: menuOpen,
|
|
1051
|
+
children: [
|
|
1052
|
+
/* @__PURE__ */ jsx(BlockToolMenu, {
|
|
1053
|
+
label: tone.label,
|
|
1054
|
+
aria: `Callout tone: ${tone.label}`,
|
|
1055
|
+
onOpenChange: setMenuOpen,
|
|
1056
|
+
choices: V16_CALLOUT_TONES.filter((t) => styled || t.tone !== "note" || tone.tone === "note").map((t) => ({
|
|
1057
|
+
label: t.label,
|
|
1058
|
+
on: t.tone === tone.tone,
|
|
1059
|
+
run: () => set({ tone: t.tone }, "Change callout tone")
|
|
1060
|
+
}))
|
|
1061
|
+
}),
|
|
1062
|
+
styled ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(BlockToolSep, {}), /* @__PURE__ */ jsx(BlockToolMenu, {
|
|
1063
|
+
label: "Icon",
|
|
1064
|
+
onOpenChange: setMenuOpen,
|
|
1065
|
+
choices: [{
|
|
1066
|
+
label: "Show icon",
|
|
1067
|
+
on: m.icon !== "none",
|
|
1068
|
+
run: () => set((p) => ({
|
|
1069
|
+
...p,
|
|
1070
|
+
icon: void 0
|
|
1071
|
+
}), "Show callout icon")
|
|
1072
|
+
}, {
|
|
1073
|
+
label: "No icon",
|
|
1074
|
+
on: m.icon === "none",
|
|
1075
|
+
run: () => set({ icon: "none" }, "Hide callout icon")
|
|
1076
|
+
}]
|
|
1077
|
+
})] }) : null,
|
|
1078
|
+
ctx.replace ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(BlockToolSep, {}), /* @__PURE__ */ jsx(BlockToolMenu, {
|
|
1079
|
+
label: "Turn into",
|
|
1080
|
+
onOpenChange: setMenuOpen,
|
|
1081
|
+
choices: [{
|
|
1082
|
+
label: "Text",
|
|
1083
|
+
run: () => turnInto("p")
|
|
1084
|
+
}, ...ctx.allows?.("blockquote") === false ? [] : [{
|
|
1085
|
+
label: "Quote",
|
|
1086
|
+
run: () => turnInto("blockquote")
|
|
1087
|
+
}]]
|
|
1088
|
+
})] }) : null
|
|
1089
|
+
]
|
|
1090
|
+
}),
|
|
1091
|
+
m.icon === "none" ? null : /* @__PURE__ */ jsx(IconInfoCircle, {
|
|
1092
|
+
"aria-hidden": true,
|
|
1093
|
+
stroke: 2,
|
|
1094
|
+
className: cn("mt-[3px] size-4 shrink-0", look.icon)
|
|
1095
|
+
}),
|
|
1096
|
+
/* @__PURE__ */ jsxs("div", {
|
|
1097
|
+
className: "min-w-0 flex-1",
|
|
1098
|
+
children: [m.title ? /* @__PURE__ */ jsx(PlainEditable, {
|
|
1099
|
+
value: m.title,
|
|
1100
|
+
label: "Callout title",
|
|
1101
|
+
readOnly: ro,
|
|
1102
|
+
onChange: (title) => set({ title }, "Edit callout title"),
|
|
1103
|
+
className: "font-medium"
|
|
1104
|
+
}) : null, /* @__PURE__ */ jsx(PlainEditable, {
|
|
1105
|
+
multiline: true,
|
|
1106
|
+
value: m.body ?? "",
|
|
1107
|
+
label: "Callout message",
|
|
1108
|
+
readOnly: ro,
|
|
1109
|
+
autoFocus,
|
|
1110
|
+
placeholder: "Write a note for readers.",
|
|
1111
|
+
onChange: (b) => set({ body: b }, "Edit callout message")
|
|
1112
|
+
})]
|
|
1113
|
+
})
|
|
1114
|
+
]
|
|
1115
|
+
});
|
|
1116
|
+
}
|
|
1117
|
+
var STAT_COLS = [
|
|
1118
|
+
2,
|
|
1119
|
+
3,
|
|
1120
|
+
4
|
|
1121
|
+
];
|
|
1122
|
+
function StatsBlock({ m, set, el, ctx, autoFocus }) {
|
|
1123
|
+
const ro = ctx.readOnly;
|
|
1124
|
+
const cols = m.cols ?? 3;
|
|
1125
|
+
const filled = m.style === "filled";
|
|
1126
|
+
const [menuOpen, setMenuOpen] = React.useState(false);
|
|
1127
|
+
const grid = React.useRef(null);
|
|
1128
|
+
const edit = (i, k, v) => set((p) => ({
|
|
1129
|
+
...p,
|
|
1130
|
+
items: p.items.map((c, j) => j === i ? {
|
|
1131
|
+
...c,
|
|
1132
|
+
[k]: v
|
|
1133
|
+
} : c)
|
|
1134
|
+
}), "Edit stat");
|
|
1135
|
+
const focusCard = (i, part = 0) => {
|
|
1136
|
+
requestAnimationFrame(() => {
|
|
1137
|
+
const b = grid.current?.children[i]?.querySelectorAll("[role=textbox]")[part];
|
|
1138
|
+
b?.focus();
|
|
1139
|
+
if (b) placeCaret(b, false);
|
|
1140
|
+
});
|
|
1141
|
+
};
|
|
1142
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
1143
|
+
className: "group/blk relative my-5",
|
|
1144
|
+
"data-rt-isolate": "",
|
|
1145
|
+
children: [ro ? null : /* @__PURE__ */ jsxs(BlockTool, {
|
|
1146
|
+
label: "Stats",
|
|
1147
|
+
open: menuOpen,
|
|
1148
|
+
children: [
|
|
1149
|
+
/* @__PURE__ */ jsx(BlockToolMenu, {
|
|
1150
|
+
label: `${cols} columns`,
|
|
1151
|
+
onOpenChange: setMenuOpen,
|
|
1152
|
+
choices: STAT_COLS.map((n) => ({
|
|
1153
|
+
label: `${n} columns`,
|
|
1154
|
+
on: cols === n,
|
|
1155
|
+
run: () => set({ cols: n }, "Change stats columns")
|
|
1156
|
+
}))
|
|
1157
|
+
}),
|
|
1158
|
+
/* @__PURE__ */ jsx(BlockToolSep, {}),
|
|
1159
|
+
/* @__PURE__ */ jsxs("button", {
|
|
1160
|
+
type: "button",
|
|
1161
|
+
className: BLOCK_TOOL_BTN,
|
|
1162
|
+
onClick: () => {
|
|
1163
|
+
set((p) => ({
|
|
1164
|
+
...p,
|
|
1165
|
+
items: [...p.items, newStat()]
|
|
1166
|
+
}), "Add stat");
|
|
1167
|
+
focusCard(m.items.length);
|
|
1168
|
+
},
|
|
1169
|
+
children: [/* @__PURE__ */ jsx(IconPlus, {
|
|
1170
|
+
stroke: 1.75,
|
|
1171
|
+
"aria-hidden": true
|
|
1172
|
+
}), "Add stat"]
|
|
1173
|
+
}),
|
|
1174
|
+
/* @__PURE__ */ jsx(BlockToolSep, {}),
|
|
1175
|
+
/* @__PURE__ */ jsx(BlockToolMenu, {
|
|
1176
|
+
label: "Card style",
|
|
1177
|
+
onOpenChange: setMenuOpen,
|
|
1178
|
+
choices: [{
|
|
1179
|
+
label: "Outlined",
|
|
1180
|
+
on: !filled,
|
|
1181
|
+
run: () => set({ style: "outlined" }, "Change card style")
|
|
1182
|
+
}, {
|
|
1183
|
+
label: "Filled",
|
|
1184
|
+
on: filled,
|
|
1185
|
+
run: () => set({ style: "filled" }, "Change card style")
|
|
1186
|
+
}]
|
|
1187
|
+
})
|
|
1188
|
+
]
|
|
1189
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
1190
|
+
ref: grid,
|
|
1191
|
+
className: "grid gap-3",
|
|
1192
|
+
style: { gridTemplateColumns: `repeat(${cols}, minmax(0, 1fr))` },
|
|
1193
|
+
children: m.items.map((c, i) => /* @__PURE__ */ jsxs("div", {
|
|
1194
|
+
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)]"),
|
|
1195
|
+
children: [
|
|
1196
|
+
/* @__PURE__ */ jsx(PlainEditable, {
|
|
1197
|
+
value: c.label,
|
|
1198
|
+
label: "Stat label",
|
|
1199
|
+
readOnly: ro,
|
|
1200
|
+
autoFocus: autoFocus && i === 0,
|
|
1201
|
+
onChange: (v) => edit(i, "label", v),
|
|
1202
|
+
onEnter: () => focusCard(i, 1),
|
|
1203
|
+
onBackspaceEmpty: m.items.length > 1 && !c.value && !c.note ? () => {
|
|
1204
|
+
set((p) => ({
|
|
1205
|
+
...p,
|
|
1206
|
+
items: p.items.filter((_, j) => j !== i)
|
|
1207
|
+
}), "Remove stat");
|
|
1208
|
+
if (i > 0) focusCard(i - 1, 2);
|
|
1209
|
+
} : void 0,
|
|
1210
|
+
className: "text-[13px] font-medium leading-[18px] text-kit-insp-stat-label"
|
|
1211
|
+
}),
|
|
1212
|
+
/* @__PURE__ */ jsx(PlainEditable, {
|
|
1213
|
+
value: c.value,
|
|
1214
|
+
label: "Stat value",
|
|
1215
|
+
readOnly: ro,
|
|
1216
|
+
onChange: (v) => edit(i, "value", v),
|
|
1217
|
+
onEnter: () => focusCard(i, 2),
|
|
1218
|
+
className: "text-[28px] font-semibold leading-9 tracking-[-0.4px] text-kit-insp-stat-value"
|
|
1219
|
+
}),
|
|
1220
|
+
/* @__PURE__ */ jsx(PlainEditable, {
|
|
1221
|
+
value: c.note,
|
|
1222
|
+
label: "Stat note",
|
|
1223
|
+
readOnly: ro,
|
|
1224
|
+
onChange: (v) => edit(i, "note", v),
|
|
1225
|
+
onEnter: () => i + 1 < m.items.length ? focusCard(i + 1) : ctx.exit(el),
|
|
1226
|
+
className: "text-[12px] leading-4 text-kit-insp-stat-note"
|
|
1227
|
+
})
|
|
1228
|
+
]
|
|
1229
|
+
}, c._key))
|
|
1230
|
+
})]
|
|
1231
|
+
});
|
|
1232
|
+
}
|
|
963
1233
|
function ToggleBlock({ m, set, el, ctx, autoFocus }) {
|
|
964
|
-
const
|
|
1234
|
+
const v16 = useKitLook() === "v16";
|
|
1235
|
+
const [open, setOpen] = React.useState(!!autoFocus || v16);
|
|
965
1236
|
const body = React.useRef(null);
|
|
966
1237
|
const bodyId = React.useId();
|
|
967
1238
|
const ro = ctx.readOnly;
|
|
968
1239
|
return /* @__PURE__ */ jsxs("div", {
|
|
969
|
-
className: "group/blk relative rounded-kit-md",
|
|
1240
|
+
className: cn("group/blk relative rounded-kit-md", v16 && "my-3"),
|
|
970
1241
|
"data-rt-isolate": "",
|
|
971
1242
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
972
|
-
className: "flex items-start gap-1",
|
|
1243
|
+
className: cn("flex items-start gap-1", v16 && "items-center gap-1.5"),
|
|
973
1244
|
children: [
|
|
974
1245
|
/* @__PURE__ */ jsx("button", {
|
|
975
1246
|
type: "button",
|
|
@@ -977,10 +1248,10 @@ function ToggleBlock({ m, set, el, ctx, autoFocus }) {
|
|
|
977
1248
|
"aria-controls": bodyId,
|
|
978
1249
|
"aria-label": open ? "Collapse toggle" : "Expand toggle",
|
|
979
1250
|
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",
|
|
1251
|
+
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
1252
|
children: /* @__PURE__ */ jsx(IconChevronRight, {
|
|
982
1253
|
className: cn("size-4 transition-transform duration-150", open && "rotate-90"),
|
|
983
|
-
stroke: 1.5,
|
|
1254
|
+
stroke: v16 ? 2.2 : 1.5,
|
|
984
1255
|
"aria-hidden": true
|
|
985
1256
|
})
|
|
986
1257
|
}),
|
|
@@ -999,7 +1270,7 @@ function ToggleBlock({ m, set, el, ctx, autoFocus }) {
|
|
|
999
1270
|
if (b) placeCaret(b, false);
|
|
1000
1271
|
});
|
|
1001
1272
|
},
|
|
1002
|
-
className: "flex-1 py-0.5 font-medium text-kit-fg"
|
|
1273
|
+
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
1274
|
}),
|
|
1004
1275
|
ro ? null : /* @__PURE__ */ jsx("div", {
|
|
1005
1276
|
className: "opacity-0 transition-opacity group-hover/blk:opacity-100 group-focus-within/blk:opacity-100 pointer-coarse:opacity-100",
|
|
@@ -1013,15 +1284,15 @@ function ToggleBlock({ m, set, el, ctx, autoFocus }) {
|
|
|
1013
1284
|
ref: body,
|
|
1014
1285
|
id: bodyId,
|
|
1015
1286
|
hidden: !open,
|
|
1016
|
-
className: "ml-3 mt-1 border-l border-kit-line pl-4",
|
|
1287
|
+
className: cn("ml-3 mt-1 border-l border-kit-line pl-4", v16 && "ml-0 mt-0 border-l-0 pl-[22px]"),
|
|
1017
1288
|
children: /* @__PURE__ */ jsx(PlainEditable, {
|
|
1018
1289
|
multiline: true,
|
|
1019
1290
|
value: m.body ?? "",
|
|
1020
1291
|
label: "Toggle body",
|
|
1021
1292
|
readOnly: ro,
|
|
1022
|
-
placeholder: "Hidden content. Click to write…",
|
|
1293
|
+
placeholder: v16 ? "Content that stays hidden until the reader opens it." : "Hidden content. Click to write…",
|
|
1023
1294
|
onChange: (b) => set({ body: b }, "Edit toggle body"),
|
|
1024
|
-
className: "py-0.5 text-kit-fg-2 [&_p+p]:mt-2"
|
|
1295
|
+
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
1296
|
})
|
|
1026
1297
|
})]
|
|
1027
1298
|
});
|
|
@@ -1040,8 +1311,9 @@ function VideoBlock({ m, set, el, ctx, autoFocus }) {
|
|
|
1040
1311
|
set({ url: u }, "Set video link");
|
|
1041
1312
|
};
|
|
1042
1313
|
const ro = ctx.readOnly;
|
|
1314
|
+
const v16 = useKitLook() === "v16";
|
|
1043
1315
|
return /* @__PURE__ */ jsxs("div", {
|
|
1044
|
-
className: "group/blk rounded-kit-lg border border-kit-line bg-kit-subtle p-2.5",
|
|
1316
|
+
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
1317
|
"data-rt-isolate": "",
|
|
1046
1318
|
children: [
|
|
1047
1319
|
ro ? null : /* @__PURE__ */ jsxs("div", {
|
|
@@ -1077,7 +1349,23 @@ function VideoBlock({ m, set, el, ctx, autoFocus }) {
|
|
|
1077
1349
|
className: "mb-2 px-1 text-kit-xs text-kit-danger-fg",
|
|
1078
1350
|
children: error
|
|
1079
1351
|
}) : null,
|
|
1080
|
-
|
|
1352
|
+
v16 ? /* @__PURE__ */ jsxs("figure", {
|
|
1353
|
+
className: "m-0",
|
|
1354
|
+
children: [m.url ? /* @__PURE__ */ jsx("div", {
|
|
1355
|
+
className: "overflow-hidden rounded-[10px]",
|
|
1356
|
+
children: /* @__PURE__ */ jsx(VideoPreview, {
|
|
1357
|
+
url: m.url,
|
|
1358
|
+
title: "Video"
|
|
1359
|
+
})
|
|
1360
|
+
}) : /* @__PURE__ */ jsx("div", {
|
|
1361
|
+
"aria-hidden": true,
|
|
1362
|
+
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))]",
|
|
1363
|
+
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-['']" })
|
|
1364
|
+
}), /* @__PURE__ */ jsx("figcaption", {
|
|
1365
|
+
className: "mt-2 text-center text-[13px] leading-[18px] text-kit-group-sub",
|
|
1366
|
+
children: m.title || (m.url ? "Video" : "Paste a YouTube, Vimeo or Loom link")
|
|
1367
|
+
})]
|
|
1368
|
+
}) : m.url ? /* @__PURE__ */ jsx(VideoPreview, {
|
|
1081
1369
|
url: m.url,
|
|
1082
1370
|
title: "Video"
|
|
1083
1371
|
}) : /* @__PURE__ */ jsx("p", {
|
|
@@ -1105,6 +1393,39 @@ function FileBlock({ m, set, el, ctx, autoFocus }) {
|
|
|
1105
1393
|
...a[0].size ? { size: a[0].size } : {}
|
|
1106
1394
|
}, "Choose file")
|
|
1107
1395
|
}) : null;
|
|
1396
|
+
const v16 = useKitLook() === "v16";
|
|
1397
|
+
const type = (m.name?.includes(".") ? m.name.split(".").pop() : "file").toUpperCase();
|
|
1398
|
+
if (has && v16) return /* @__PURE__ */ jsxs("div", {
|
|
1399
|
+
className: "group/blk my-4",
|
|
1400
|
+
"data-rt-isolate": "",
|
|
1401
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
1402
|
+
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)]",
|
|
1403
|
+
children: [
|
|
1404
|
+
/* @__PURE__ */ jsx(IconFileText, {
|
|
1405
|
+
className: "size-3.5 shrink-0",
|
|
1406
|
+
stroke: 1.8,
|
|
1407
|
+
"aria-hidden": true
|
|
1408
|
+
}),
|
|
1409
|
+
/* @__PURE__ */ jsx("b", {
|
|
1410
|
+
className: "min-w-0 truncate text-[14px] font-medium leading-[26px] text-kit-insp-tip-title",
|
|
1411
|
+
children: m.name
|
|
1412
|
+
}),
|
|
1413
|
+
/* @__PURE__ */ jsxs("small", {
|
|
1414
|
+
className: "min-w-0 flex-1 truncate text-[12px] leading-[26px] text-kit-group-sub",
|
|
1415
|
+
children: [type, m.size ? ` · ${formatBytes(m.size)}` : ""]
|
|
1416
|
+
}),
|
|
1417
|
+
ro ? null : /* @__PURE__ */ jsxs(Fragment, { children: [MediaPicker ? /* @__PURE__ */ jsx(Button, {
|
|
1418
|
+
size: "xs",
|
|
1419
|
+
variant: "ghost",
|
|
1420
|
+
onClick: () => setPicker(true),
|
|
1421
|
+
children: "Replace"
|
|
1422
|
+
}) : null, /* @__PURE__ */ jsx(RemoveBtn, {
|
|
1423
|
+
onClick: () => ctx.remove(el),
|
|
1424
|
+
label: "Remove file"
|
|
1425
|
+
})] })
|
|
1426
|
+
]
|
|
1427
|
+
}), pickerEl]
|
|
1428
|
+
});
|
|
1108
1429
|
if (has) return /* @__PURE__ */ jsxs("div", {
|
|
1109
1430
|
className: "group/blk",
|
|
1110
1431
|
"data-rt-isolate": "",
|
|
@@ -1126,7 +1447,7 @@ function FileBlock({ m, set, el, ctx, autoFocus }) {
|
|
|
1126
1447
|
children: m.name
|
|
1127
1448
|
}), /* @__PURE__ */ jsxs("div", {
|
|
1128
1449
|
className: "truncate text-kit-xs text-kit-fg-3",
|
|
1129
|
-
children: [m.size ? `${formatBytes(m.size)} · ` : "",
|
|
1450
|
+
children: [m.size ? `${formatBytes(m.size)} · ` : "", type]
|
|
1130
1451
|
})]
|
|
1131
1452
|
}),
|
|
1132
1453
|
ro ? null : /* @__PURE__ */ jsxs(Fragment, { children: [MediaPicker ? /* @__PURE__ */ jsx(Button, {
|
|
@@ -1225,6 +1546,7 @@ function FileBlock({ m, set, el, ctx, autoFocus }) {
|
|
|
1225
1546
|
}
|
|
1226
1547
|
function ComponentBlock({ m, el, ctx, set }) {
|
|
1227
1548
|
const { useComponentInfo } = useKitServices();
|
|
1549
|
+
const v16 = useKitLook() === "v16";
|
|
1228
1550
|
const overrides = React.useMemo(() => {
|
|
1229
1551
|
try {
|
|
1230
1552
|
const v = m.overrides ? JSON.parse(m.overrides) : {};
|
|
@@ -1243,6 +1565,38 @@ function ComponentBlock({ m, el, ctx, set }) {
|
|
|
1243
1565
|
});
|
|
1244
1566
|
const count = Object.keys(overrides).length;
|
|
1245
1567
|
const name = m.name || "Block";
|
|
1568
|
+
if (v16) return /* @__PURE__ */ jsxs("aside", {
|
|
1569
|
+
role: "group",
|
|
1570
|
+
"aria-label": `${name}, ${m.detached ? "separate copy" : "linked block"}`,
|
|
1571
|
+
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)]",
|
|
1572
|
+
"data-rt-isolate": "",
|
|
1573
|
+
children: [
|
|
1574
|
+
/* @__PURE__ */ jsxs("small", {
|
|
1575
|
+
className: "text-[12px] font-medium text-kit-insp-faint",
|
|
1576
|
+
children: ["Site block · ", name]
|
|
1577
|
+
}),
|
|
1578
|
+
/* @__PURE__ */ jsx("b", {
|
|
1579
|
+
className: "text-[20px] font-semibold leading-7 text-kit-insp-tip-title",
|
|
1580
|
+
children: name
|
|
1581
|
+
}),
|
|
1582
|
+
/* @__PURE__ */ jsxs("span", {
|
|
1583
|
+
className: "text-[14px] leading-[22px]",
|
|
1584
|
+
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"}` : ""]
|
|
1585
|
+
}),
|
|
1586
|
+
ctx.readOnly ? null : /* @__PURE__ */ jsxs("div", {
|
|
1587
|
+
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",
|
|
1588
|
+
children: [ctx.duplicate ? /* @__PURE__ */ jsx(IconButton, {
|
|
1589
|
+
size: "xs",
|
|
1590
|
+
label: `Duplicate ${name}`,
|
|
1591
|
+
onClick: () => ctx.duplicate?.(el),
|
|
1592
|
+
children: /* @__PURE__ */ jsx(IconCopy, { stroke: 1.5 })
|
|
1593
|
+
}) : null, /* @__PURE__ */ jsx(RemoveBtn, {
|
|
1594
|
+
onClick: () => ctx.remove(el),
|
|
1595
|
+
label: `Remove ${name}`
|
|
1596
|
+
})]
|
|
1597
|
+
})
|
|
1598
|
+
]
|
|
1599
|
+
});
|
|
1246
1600
|
return /* @__PURE__ */ jsxs("div", {
|
|
1247
1601
|
role: "group",
|
|
1248
1602
|
"aria-label": `${name}, ${m.detached ? "separate copy" : "linked block"}`,
|
|
@@ -1523,7 +1877,35 @@ function TakeawaysBlock({ m, set, el, ctx, autoFocus }) {
|
|
|
1523
1877
|
})]
|
|
1524
1878
|
});
|
|
1525
1879
|
}
|
|
1880
|
+
/** "Crystal Nolen" → "CN" (the byline avatar's initials) */
|
|
1881
|
+
var bylineInitials = (name) => name.trim().split(/\s+/).filter(Boolean).slice(0, 2).map((w) => w[0].toUpperCase()).join("");
|
|
1526
1882
|
function PullQuotePreview({ m }) {
|
|
1883
|
+
if (useKitLook() === "v16") return /* @__PURE__ */ jsxs("blockquote", {
|
|
1884
|
+
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",
|
|
1885
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
1886
|
+
"data-field": "quote",
|
|
1887
|
+
className: cn("m-0", !m.quote && "text-kit-insp-faint"),
|
|
1888
|
+
children: m.quote || "Write the quote"
|
|
1889
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
1890
|
+
className: "mt-3 flex items-center gap-2 text-[13px] not-italic leading-[18px] text-kit-group-sub",
|
|
1891
|
+
children: m.name ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("span", {
|
|
1892
|
+
"aria-hidden": true,
|
|
1893
|
+
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",
|
|
1894
|
+
children: bylineInitials(m.name)
|
|
1895
|
+
}), /* @__PURE__ */ jsxs("span", { children: [/* @__PURE__ */ jsx("b", {
|
|
1896
|
+
"data-field": "name",
|
|
1897
|
+
className: cn("font-medium text-kit-insp-tip-title", m.link && "underline decoration-kit-line-strong underline-offset-2"),
|
|
1898
|
+
children: m.name
|
|
1899
|
+
}), m.role ? /* @__PURE__ */ jsx("span", {
|
|
1900
|
+
"data-field": "role",
|
|
1901
|
+
children: ` · ${m.role}`
|
|
1902
|
+
}) : null] })] }) : /* @__PURE__ */ jsx("span", {
|
|
1903
|
+
"data-field": "name",
|
|
1904
|
+
className: "text-kit-insp-faint",
|
|
1905
|
+
children: "Who said it"
|
|
1906
|
+
})
|
|
1907
|
+
})]
|
|
1908
|
+
});
|
|
1527
1909
|
return /* @__PURE__ */ jsxs("figure", {
|
|
1528
1910
|
className: "m-0 py-2 pl-5 pr-10",
|
|
1529
1911
|
children: [
|
|
@@ -1560,6 +1942,6 @@ function PullQuotePreview({ m }) {
|
|
|
1560
1942
|
});
|
|
1561
1943
|
}
|
|
1562
1944
|
//#endregion
|
|
1563
|
-
export { Island };
|
|
1945
|
+
export { Island, bylineInitials };
|
|
1564
1946
|
|
|
1565
1947
|
//# sourceMappingURL=blocks.js.map
|