docblocks-react-ui 0.15.1 → 0.16.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/CHANGELOG.md +24 -0
- package/README.md +5 -1
- package/dist/{Editor-xRjCnKad.mjs → Editor-BrENM2MV.mjs} +833 -69
- package/dist/index.d.mts +16 -1
- package/dist/index.mjs +86 -39
- package/dist/mermaid/index.mjs +1 -1
- package/dist/styles.css +10 -0
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -150,6 +150,17 @@ declare const SHAPE_FONT_OPTIONS: readonly [{
|
|
|
150
150
|
* the raw name — a consumer's own loaded font is addressable by name). */
|
|
151
151
|
declare const SHAPE_FONT_STACKS: Record<string, string>;
|
|
152
152
|
//#endregion
|
|
153
|
+
//#region src/DocHeaderAvatar.d.ts
|
|
154
|
+
/** The content replacement's context: the standing avatar (`null` — none)
|
|
155
|
+
* and the interaction's stand (`false` over the read-only modes — the
|
|
156
|
+
* picker is off and the content is the consumer's display-only view). */
|
|
157
|
+
interface DocHeaderAvatarContentContext {
|
|
158
|
+
/** The avatar to stand (`meta.avatar`); `null` — the document has none. */
|
|
159
|
+
avatar: string | null;
|
|
160
|
+
/** `false` over the read-only modes: the slot's content is display-only. */
|
|
161
|
+
editable: boolean;
|
|
162
|
+
}
|
|
163
|
+
//#endregion
|
|
153
164
|
//#region src/DocHeader.d.ts
|
|
154
165
|
/** The header's props (the consumer's state: the doc's stand, the view and
|
|
155
166
|
* the mode's switchers — the consumer owns the view / the mode's state). */
|
|
@@ -166,6 +177,10 @@ interface DocHeaderProps {
|
|
|
166
177
|
onModeChange?: (mode: EditorMode) => void;
|
|
167
178
|
/** The published snapshot (the meta's source over the published's stand; the "Published"'s option stands disabled over its absence). */
|
|
168
179
|
publishedDoc?: Doc | null;
|
|
180
|
+
/** Replaces the avatar slot's CONTENT in both states (the emoji / the empty stand). The library owns the wrapper (the edit's button, the read-only's span), the picker, and the accessible names, and a click on the content opens the picker over the edit's mode; the decorative mark-up inside the content is the consumer's (the accessible name stands on the library's wrapper). The absent prop stands the built-in render (the emoji, or the "+" affordance). */
|
|
181
|
+
renderAvatarContent?: (context: DocHeaderAvatarContentContext) => ReactNode;
|
|
182
|
+
/** Hides the avatar slot entirely — no wrapper, no focus stop — for consumers that stand the document avatar elsewhere. */
|
|
183
|
+
hideAvatar?: boolean;
|
|
169
184
|
}
|
|
170
185
|
/** The header's i18n scope: the package's instance stands the provider's seat
|
|
171
186
|
* over the panel (the consumer places the header outside the editor — the
|
|
@@ -503,4 +518,4 @@ declare function TooltipContent({ className, sideOffset, children, ...props }: R
|
|
|
503
518
|
//#region src/shared/ui/cn.d.ts
|
|
504
519
|
declare function cn(...inputs: ClassValue[]): string;
|
|
505
520
|
//#endregion
|
|
506
|
-
export { type AccessLevel, Alert, AlertDescription, AlertTitle, type AttributeType, type AttributeTypePicker, type AttributeTypePickerProps, BASELINE_CAPABILITIES, BRIDGE_ERROR_CODES, Badge, BareSelect, type BatchOp, type BlobMeta, type BlobRef, type BlobStore, type BlockRenderer, type BlockRendererMap, type BlockRendererProps, type BridgeColumn, type BridgeColumnAnnotation, BridgeError, type BridgeErrorCode, type BridgeTableDescription, type BridgeValueInput, Button, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, type CellMap, type CellValueParse, Checkbox, type Column, type CoverPresetSets, DEFAULT_EMBED_SANDBOX, type DatabaseBridge, DatabaseTable, type DatabaseTablePhase, type DatabaseTableProps, type DatabaseTableRow, type DatabaseTableView, type DocDescription, DocHeader, type DocTag, type DocTags, DocblocksI18nProvider, type DocblocksI18nProviderProps, type DomainEvent, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Editor, type EditorContextValue, type EditorMode, EditorProvider, type EditorProviderProps, type EditorView, type EmbedSandboxPolicy, FORMAT_PALETTE, FilterBuilder, type FilterConditionInput, type FilterInput, type FormatMark, type Id, ImportDocumentError, Input, type IsoInstant, Label, MONO_FONT_STACK, type MentionEntry, type MentionInteractions, type MentionMark, type MentionProvider, type MutationContext, type MutationReceipt, type OperationStatus, PROTOCOL_VERSION, type PageQuery, type PageSnapshot, type PdfPreview, type PdfPreviewProps, Popover, PopoverAnchor, PopoverContent, PopoverDescription, PopoverHeader, PopoverTitle, PopoverTrigger, type PresenceConfig, type PresenceCrypto, type PresenceIdentity, type PresencePeer, type PresenceSharing, type PresenceSharingMode, type ProtocolCapability, type ProtocolDescriptor, type ProtocolLimits, type QueryOperator, type QuerySemantics, type RenderAttribute, type RenderAttributeProps, type Revision, type RowPage, type RowWire, SHAPE_FONT_OPTIONS, SHAPE_FONT_STACKS, ScrollArea, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, type SelectionRef, Separator, Skeleton, type SortInput, type SubscriptionHandle, type SubscriptionObserver, type SubscriptionStatus, type SyncEmbedRef, type SyncEmbedResolver, TEXT_TYPES, type TableDescription, type TableEnvelopeBase, type TableEvent, type TableRef, type TableSnapshot, Tabs, TabsContent, TabsList, TabsTrigger, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, type TypedAttributeValue, UI_FONT_ID, UI_FONT_STACK, type UseDatabaseTable, type UseTableList, badgeVariants, buttonVariants, cellValueEqual, cn, columnAnnotation, conditionMatches, createMemoryBlobStore, emptyFilter, filterIsComplete, importDocument, isBridgeError, isBridgeErrorCode, isDatabaseBridge, markToggleAction, newMutationContext, parseCellValue, renderRuns, toBridgeError, useBlock, useCoverAverageColor, useDatabaseTable, useDoc, useEditorContext, useMeta, usePresence, usePresenceSharing, useSelection, useSelectionView, useTableList, useText, validateProtocolDescriptor };
|
|
521
|
+
export { type AccessLevel, Alert, AlertDescription, AlertTitle, type AttributeType, type AttributeTypePicker, type AttributeTypePickerProps, BASELINE_CAPABILITIES, BRIDGE_ERROR_CODES, Badge, BareSelect, type BatchOp, type BlobMeta, type BlobRef, type BlobStore, type BlockRenderer, type BlockRendererMap, type BlockRendererProps, type BridgeColumn, type BridgeColumnAnnotation, BridgeError, type BridgeErrorCode, type BridgeTableDescription, type BridgeValueInput, Button, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, type CellMap, type CellValueParse, Checkbox, type Column, type CoverPresetSets, DEFAULT_EMBED_SANDBOX, type DatabaseBridge, DatabaseTable, type DatabaseTablePhase, type DatabaseTableProps, type DatabaseTableRow, type DatabaseTableView, type DocDescription, DocHeader, type DocHeaderAvatarContentContext, type DocTag, type DocTags, DocblocksI18nProvider, type DocblocksI18nProviderProps, type DomainEvent, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Editor, type EditorContextValue, type EditorMode, EditorProvider, type EditorProviderProps, type EditorView, type EmbedSandboxPolicy, FORMAT_PALETTE, FilterBuilder, type FilterConditionInput, type FilterInput, type FormatMark, type Id, ImportDocumentError, Input, type IsoInstant, Label, MONO_FONT_STACK, type MentionEntry, type MentionInteractions, type MentionMark, type MentionProvider, type MutationContext, type MutationReceipt, type OperationStatus, PROTOCOL_VERSION, type PageQuery, type PageSnapshot, type PdfPreview, type PdfPreviewProps, Popover, PopoverAnchor, PopoverContent, PopoverDescription, PopoverHeader, PopoverTitle, PopoverTrigger, type PresenceConfig, type PresenceCrypto, type PresenceIdentity, type PresencePeer, type PresenceSharing, type PresenceSharingMode, type ProtocolCapability, type ProtocolDescriptor, type ProtocolLimits, type QueryOperator, type QuerySemantics, type RenderAttribute, type RenderAttributeProps, type Revision, type RowPage, type RowWire, SHAPE_FONT_OPTIONS, SHAPE_FONT_STACKS, ScrollArea, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, type SelectionRef, Separator, Skeleton, type SortInput, type SubscriptionHandle, type SubscriptionObserver, type SubscriptionStatus, type SyncEmbedRef, type SyncEmbedResolver, TEXT_TYPES, type TableDescription, type TableEnvelopeBase, type TableEvent, type TableRef, type TableSnapshot, Tabs, TabsContent, TabsList, TabsTrigger, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, type TypedAttributeValue, UI_FONT_ID, UI_FONT_STACK, type UseDatabaseTable, type UseTableList, badgeVariants, buttonVariants, cellValueEqual, cn, columnAnnotation, conditionMatches, createMemoryBlobStore, emptyFilter, filterIsComplete, importDocument, isBridgeError, isBridgeErrorCode, isDatabaseBridge, markToggleAction, newMutationContext, parseCellValue, renderRuns, toBridgeError, useBlock, useCoverAverageColor, useDatabaseTable, useDoc, useEditorContext, useMeta, usePresence, usePresenceSharing, useSelection, useSelectionView, useTableList, useText, validateProtocolDescriptor };
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as DropdownMenuSubContent, $t as Eye, A as SelectGroup, At as Skeleton, B as Input, Bt as useBlock, C as FilterBuilder, Ct as isBridgeError, D as ScrollArea, Dt as parseCellValue, E as SegmentSelector, Et as conditionMatches, F as SelectSeparator, Ft as CardFooter, G as DropdownMenuItem, Gt as useSelection, H as DropdownMenuCheckboxItem, Ht as useMeta, I as SelectTrigger, It as CardHeader, J as DropdownMenuRadioGroup, Jt as DocblocksI18nProvider, K as DropdownMenuLabel, Kt as useSelectionView, L as SelectValue, Lt as CardTitle, M as SelectLabel, Mt as CardAction, N as SelectScrollDownButton, Nt as CardContent, O as Select, Ot as TEXT_TYPES, P as SelectScrollUpButton, Pt as CardDescription, Q as DropdownMenuSub, Qt as Pen, R as Label, Rt as Badge, S as newMutationContext, St as BridgeError, T as filterIsComplete, Tt as toBridgeError, U as DropdownMenuContent, Ut as usePresence, V as DropdownMenu, Vt as useDoc, W as DropdownMenuGroup, Wt as usePresenceSharing, X as DropdownMenuSeparator, Xt as renderRuns, Y as DropdownMenuRadioItem, Z as DropdownMenuShortcut, _ as mapFrontmatter, _t as BASELINE_CAPABILITIES, a as DEFAULT_EMBED_SANDBOX, at as PopoverContent, b as useDatabaseTable, bt as validateProtocolDescriptor, c as SHAPE_FONT_OPTIONS, ct as PopoverTitle, d as FORMAT_PALETTE, dt as Button, et as DropdownMenuSubTrigger, ft as buttonVariants, g as mdToBlocks, gt as AlertTitle, h as insertNative, ht as AlertDescription, i as useEditorContext, it as PopoverAnchor, j as SelectItem, jt as Card, k as SelectContent, kt as columnAnnotation, l as SHAPE_FONT_STACKS, lt as PopoverTrigger, m as htmlToBlocks, mt as Alert, n as useCoverAverageColor, nn as createMemoryBlobStore, nt as Separator, ot as PopoverDescription, p as markToggleAction, pt as BareSelect, q as DropdownMenuPortal, qt as useText, r as EditorProvider, rt as Popover, st as PopoverHeader, t as Editor, tn as BookOpen, tt as DropdownMenuTrigger, ut as Checkbox, v as parseFrontmatter, vt as PROTOCOL_VERSION, w as emptyFilter, wt as isBridgeErrorCode, x as cellValueEqual, xt as BRIDGE_ERROR_CODES, y as GridBody, yt as isDatabaseBridge, z as InlineEditInput, zt as badgeVariants } from "./Editor-
|
|
1
|
+
import { $ as DropdownMenuSubContent, $t as Eye, A as SelectGroup, At as Skeleton, B as Input, Bt as useBlock, C as FilterBuilder, Ct as isBridgeError, D as ScrollArea, Dt as parseCellValue, E as SegmentSelector, Et as conditionMatches, F as SelectSeparator, Ft as CardFooter, G as DropdownMenuItem, Gt as useSelection, H as DropdownMenuCheckboxItem, Ht as useMeta, I as SelectTrigger, It as CardHeader, J as DropdownMenuRadioGroup, Jt as DocblocksI18nProvider, K as DropdownMenuLabel, Kt as useSelectionView, L as SelectValue, Lt as CardTitle, M as SelectLabel, Mt as CardAction, N as SelectScrollDownButton, Nt as CardContent, O as Select, Ot as TEXT_TYPES, P as SelectScrollUpButton, Pt as CardDescription, Q as DropdownMenuSub, Qt as Pen, R as Label, Rt as Badge, S as newMutationContext, St as BridgeError, T as filterIsComplete, Tt as toBridgeError, U as DropdownMenuContent, Ut as usePresence, V as DropdownMenu, Vt as useDoc, W as DropdownMenuGroup, Wt as usePresenceSharing, X as DropdownMenuSeparator, Xt as renderRuns, Y as DropdownMenuRadioItem, Z as DropdownMenuShortcut, _ as mapFrontmatter, _t as BASELINE_CAPABILITIES, a as DEFAULT_EMBED_SANDBOX, at as PopoverContent, b as useDatabaseTable, bt as validateProtocolDescriptor, c as SHAPE_FONT_OPTIONS, ct as PopoverTitle, d as FORMAT_PALETTE, dt as Button, et as DropdownMenuSubTrigger, ft as buttonVariants, g as mdToBlocks, gt as AlertTitle, h as insertNative, ht as AlertDescription, i as useEditorContext, it as PopoverAnchor, j as SelectItem, jt as Card, k as SelectContent, kt as columnAnnotation, l as SHAPE_FONT_STACKS, lt as PopoverTrigger, m as htmlToBlocks, mt as Alert, n as useCoverAverageColor, nn as createMemoryBlobStore, nt as Separator, ot as PopoverDescription, p as markToggleAction, pt as BareSelect, q as DropdownMenuPortal, qt as useText, r as EditorProvider, rt as Popover, st as PopoverHeader, t as Editor, tn as BookOpen, tt as DropdownMenuTrigger, ut as Checkbox, v as parseFrontmatter, vt as PROTOCOL_VERSION, w as emptyFilter, wt as isBridgeErrorCode, x as cellValueEqual, xt as BRIDGE_ERROR_CODES, y as GridBody, yt as isDatabaseBridge, z as InlineEditInput, zt as badgeVariants } from "./Editor-BrENM2MV.mjs";
|
|
2
2
|
import { a as preventDefault, s as cn } from "./constants-D8PSgkwi.mjs";
|
|
3
3
|
import { useCallback, useEffect, useRef, useState } from "react";
|
|
4
4
|
import { useTranslation } from "react-i18next";
|
|
@@ -483,6 +483,78 @@ function useTableList(bridge) {
|
|
|
483
483
|
};
|
|
484
484
|
}
|
|
485
485
|
//#endregion
|
|
486
|
+
//#region src/DocHeaderAvatar.tsx
|
|
487
|
+
/**
|
|
488
|
+
* The document header's avatar slot: the emoji picker's popover over the
|
|
489
|
+
* edit's mode, the display-only stand over the read-only ones. The library
|
|
490
|
+
* owns the wrapper (the button over the edit's mode, the span over the
|
|
491
|
+
* read-only stands), the picker, and the accessible names; the consumer may
|
|
492
|
+
* replace the slot's content and stand the document avatar elsewhere
|
|
493
|
+
* (the slot is hidden by the header's own prop).
|
|
494
|
+
*
|
|
495
|
+
* The slot stands the standard theme tokens (not the `--docblocks-*` ones):
|
|
496
|
+
* the header renders in the consumer's chrome, outside the editor root
|
|
497
|
+
* where the `--docblocks-*` tokens are not mapped.
|
|
498
|
+
*/
|
|
499
|
+
/** The read-only slot's frame: the span owns its content's centring. */
|
|
500
|
+
const READONLY_SLOT_CLASS = "flex size-8 shrink-0 items-center justify-center overflow-hidden rounded-full text-base font-normal";
|
|
501
|
+
/** The interactive slot's frame: the button centres its own content. */
|
|
502
|
+
const EDITABLE_SLOT_CLASS = "size-8 shrink-0 overflow-hidden rounded-full text-base font-normal";
|
|
503
|
+
/** The filled / the empty stand: an absent avatar reads as the placeholder's
|
|
504
|
+
* affordance (the dashed ring). */
|
|
505
|
+
function avatarStateClass(avatar) {
|
|
506
|
+
return avatar ? "bg-muted" : "border border-dashed border-input text-muted-foreground";
|
|
507
|
+
}
|
|
508
|
+
function DocHeaderAvatar({ avatar, editable, renderContent, onPick, onClear }) {
|
|
509
|
+
const { t } = useTranslation("editor");
|
|
510
|
+
const [open, setOpen] = useState(false);
|
|
511
|
+
const content = renderContent ? renderContent({
|
|
512
|
+
avatar,
|
|
513
|
+
editable
|
|
514
|
+
}) : avatar ?? (editable ? "+" : "");
|
|
515
|
+
const pick = (emoji) => {
|
|
516
|
+
onPick(emoji);
|
|
517
|
+
setOpen(false);
|
|
518
|
+
};
|
|
519
|
+
const clear = () => {
|
|
520
|
+
onClear();
|
|
521
|
+
setOpen(false);
|
|
522
|
+
};
|
|
523
|
+
if (!editable) return /* @__PURE__ */ jsx("span", {
|
|
524
|
+
"data-slot": "docblocks/doc-header-avatar",
|
|
525
|
+
"aria-label": t("docHeader.documentAvatarAria"),
|
|
526
|
+
className: cn(READONLY_SLOT_CLASS, avatarStateClass(avatar)),
|
|
527
|
+
children: content
|
|
528
|
+
});
|
|
529
|
+
return /* @__PURE__ */ jsxs(Popover, {
|
|
530
|
+
open,
|
|
531
|
+
onOpenChange: setOpen,
|
|
532
|
+
children: [/* @__PURE__ */ jsx(PopoverTrigger, {
|
|
533
|
+
asChild: true,
|
|
534
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
535
|
+
type: "button",
|
|
536
|
+
variant: "ghost",
|
|
537
|
+
size: "icon",
|
|
538
|
+
"data-slot": "docblocks/doc-header-avatar",
|
|
539
|
+
"aria-label": t("docHeader.editAvatarAria"),
|
|
540
|
+
title: t("docHeader.editAvatar"),
|
|
541
|
+
className: cn(EDITABLE_SLOT_CLASS, avatarStateClass(avatar)),
|
|
542
|
+
children: content
|
|
543
|
+
})
|
|
544
|
+
}), /* @__PURE__ */ jsx(PopoverContent, {
|
|
545
|
+
align: "start",
|
|
546
|
+
sideOffset: 6,
|
|
547
|
+
onOpenAutoFocus: preventDefault,
|
|
548
|
+
className: "w-auto p-2.5",
|
|
549
|
+
children: /* @__PURE__ */ jsx(EmojiPicker, {
|
|
550
|
+
selected: avatar,
|
|
551
|
+
onPick: pick,
|
|
552
|
+
onClear: clear
|
|
553
|
+
})
|
|
554
|
+
})]
|
|
555
|
+
});
|
|
556
|
+
}
|
|
557
|
+
//#endregion
|
|
486
558
|
//#region src/DocHeader.tsx
|
|
487
559
|
/**
|
|
488
560
|
* The document's header panel — a consumer-placed component (outside the
|
|
@@ -502,9 +574,11 @@ function useTableList(bridge) {
|
|
|
502
574
|
* edit's mode only (a click opens the emoji grid — a portaled
|
|
503
575
|
* standard-token surface, a pick commits `setAvatar` — one write — and
|
|
504
576
|
* closes, the clear option removes it; the read-only's stand shows the
|
|
505
|
-
* avatar display-only)
|
|
506
|
-
*
|
|
507
|
-
* the
|
|
577
|
+
* avatar display-only); the slot is the `DocHeaderAvatar` unit, and the
|
|
578
|
+
* consumer may replace its content or hide it altogether. The mode
|
|
579
|
+
* switchers are controlled (the `view` + the `onViewChange`, the `mode` +
|
|
580
|
+
* the `onModeChange` — the consumer owns the editor's view and the
|
|
581
|
+
* document's mode).
|
|
508
582
|
*
|
|
509
583
|
* The panel stands the standard theme tokens (not the `--docblocks-*` ones):
|
|
510
584
|
* it renders in the consumer's chrome, outside the editor root where the
|
|
@@ -518,14 +592,13 @@ function useTableList(bridge) {
|
|
|
518
592
|
function DocHeader(props) {
|
|
519
593
|
return /* @__PURE__ */ jsx(DocblocksI18nProvider, { children: /* @__PURE__ */ jsx(DocHeaderInner, { ...props }) });
|
|
520
594
|
}
|
|
521
|
-
function DocHeaderInner({ doc, view, onViewChange, accessLevel = "editor", mode = "edit", onModeChange, publishedDoc }) {
|
|
595
|
+
function DocHeaderInner({ doc, view, onViewChange, accessLevel = "editor", mode = "edit", onModeChange, publishedDoc, renderAvatarContent, hideAvatar = false }) {
|
|
522
596
|
const { t } = useTranslation("editor");
|
|
523
597
|
const effectiveMode = accessLevel === "viewer" ? "published" : mode;
|
|
524
598
|
const viewMode = effectiveMode !== "edit";
|
|
525
599
|
const snapshot = effectiveMode === "published" ? accessLevel === "viewer" ? doc ?? null : publishedDoc ?? null : null;
|
|
526
600
|
const [meta, setMeta] = useState(() => doc !== void 0 ? doc.meta : null);
|
|
527
601
|
const [titleEditing, setTitleEditing] = useState(false);
|
|
528
|
-
const [avatarOpen, setAvatarOpen] = useState(false);
|
|
529
602
|
useEffect(() => {
|
|
530
603
|
if (doc === void 0) return;
|
|
531
604
|
setMeta(doc.meta);
|
|
@@ -536,12 +609,10 @@ function DocHeaderInner({ doc, view, onViewChange, accessLevel = "editor", mode
|
|
|
536
609
|
const pickAvatar = (emoji) => {
|
|
537
610
|
if (doc === void 0) return;
|
|
538
611
|
doc.setAvatar(emoji);
|
|
539
|
-
setAvatarOpen(false);
|
|
540
612
|
};
|
|
541
613
|
const clearAvatar = () => {
|
|
542
614
|
if (doc === void 0) return;
|
|
543
615
|
doc.setAvatar(null);
|
|
544
|
-
setAvatarOpen(false);
|
|
545
616
|
};
|
|
546
617
|
const commitTitleEdit = (value) => {
|
|
547
618
|
setTitleEditing(false);
|
|
@@ -566,6 +637,7 @@ function DocHeaderInner({ doc, view, onViewChange, accessLevel = "editor", mode
|
|
|
566
637
|
};
|
|
567
638
|
const liveMeta = meta ?? NEUTRAL_META;
|
|
568
639
|
const displayMeta = snapshot !== null ? snapshot.meta : effectiveMode === "published" ? NEUTRAL_META : liveMeta;
|
|
640
|
+
const avatarValue = (viewMode ? displayMeta.avatar : liveMeta.avatar) || null;
|
|
569
641
|
return /* @__PURE__ */ jsxs("div", {
|
|
570
642
|
"data-slot": "docblocks/doc-header",
|
|
571
643
|
className: "flex items-center gap-3",
|
|
@@ -613,37 +685,12 @@ function DocHeaderInner({ doc, view, onViewChange, accessLevel = "editor", mode
|
|
|
613
685
|
pillSlot: "docblocks/doc-header-mode-pill",
|
|
614
686
|
buttonAttrName: "doc-header-mode-button"
|
|
615
687
|
}) : null,
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
open: avatarOpen,
|
|
623
|
-
onOpenChange: setAvatarOpen,
|
|
624
|
-
children: [/* @__PURE__ */ jsx(PopoverTrigger, {
|
|
625
|
-
asChild: true,
|
|
626
|
-
children: /* @__PURE__ */ jsx(Button, {
|
|
627
|
-
type: "button",
|
|
628
|
-
variant: "ghost",
|
|
629
|
-
size: "icon",
|
|
630
|
-
"data-slot": "docblocks/doc-header-avatar",
|
|
631
|
-
"aria-label": t("docHeader.editAvatarAria"),
|
|
632
|
-
title: t("docHeader.editAvatar"),
|
|
633
|
-
className: cn("size-8 shrink-0 overflow-hidden rounded-full text-base font-normal", liveMeta.avatar ? "bg-muted" : "border border-dashed border-input text-muted-foreground"),
|
|
634
|
-
children: liveMeta.avatar ? liveMeta.avatar : "+"
|
|
635
|
-
})
|
|
636
|
-
}), /* @__PURE__ */ jsx(PopoverContent, {
|
|
637
|
-
align: "start",
|
|
638
|
-
sideOffset: 6,
|
|
639
|
-
onOpenAutoFocus: preventDefault,
|
|
640
|
-
className: "w-auto p-2.5",
|
|
641
|
-
children: /* @__PURE__ */ jsx(EmojiPicker, {
|
|
642
|
-
selected: liveMeta.avatar ?? null,
|
|
643
|
-
onPick: pickAvatar,
|
|
644
|
-
onClear: clearAvatar
|
|
645
|
-
})
|
|
646
|
-
})]
|
|
688
|
+
hideAvatar ? null : /* @__PURE__ */ jsx(DocHeaderAvatar, {
|
|
689
|
+
avatar: avatarValue,
|
|
690
|
+
editable: !viewMode,
|
|
691
|
+
renderContent: renderAvatarContent,
|
|
692
|
+
onPick: pickAvatar,
|
|
693
|
+
onClear: clearAvatar
|
|
647
694
|
}),
|
|
648
695
|
titleEditing && !viewMode ? /* @__PURE__ */ jsx(InlineEditInput, {
|
|
649
696
|
initial: liveMeta.title,
|
package/dist/mermaid/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $t as Eye, At as Skeleton, E as SegmentSelector, Yt as INLINE_CODE_CLASS, Zt as RotateCcw, dt as Button, en as CodeXml, f as textOf, gt as AlertTitle, ht as AlertDescription, i as useEditorContext, mt as Alert, o as childrenSlot, s as CodeHeader, u as TextBlock } from "../Editor-
|
|
1
|
+
import { $t as Eye, At as Skeleton, E as SegmentSelector, Yt as INLINE_CODE_CLASS, Zt as RotateCcw, dt as Button, en as CodeXml, f as textOf, gt as AlertTitle, ht as AlertDescription, i as useEditorContext, mt as Alert, o as childrenSlot, s as CodeHeader, u as TextBlock } from "../Editor-BrENM2MV.mjs";
|
|
2
2
|
import { a as preventDefault, d as Minus, f as LoaderCircle, l as TriangleAlert, r as clamp, u as Plus } from "../constants-D8PSgkwi.mjs";
|
|
3
3
|
import { t as Maximize } from "../Maximize-BBHnCDWL.mjs";
|
|
4
4
|
import { useEffect, useRef, useState } from "react";
|
package/dist/styles.css
CHANGED
|
@@ -1581,6 +1581,9 @@
|
|
|
1581
1581
|
.py-6 {
|
|
1582
1582
|
padding-block: calc(var(--spacing) * 6);
|
|
1583
1583
|
}
|
|
1584
|
+
.pt-1 {
|
|
1585
|
+
padding-top: var(--spacing);
|
|
1586
|
+
}
|
|
1584
1587
|
.pt-1\.5 {
|
|
1585
1588
|
padding-top: calc(var(--spacing) * 1.5);
|
|
1586
1589
|
}
|
|
@@ -4162,6 +4165,13 @@
|
|
|
4162
4165
|
text-underline-offset: 2px;
|
|
4163
4166
|
}
|
|
4164
4167
|
|
|
4168
|
+
/* The link's run (the view's + the edit's modes' parity): the underline's
|
|
4169
|
+
stand over the color's token (the `LINK_CLASS`'s tailwind's stand). */
|
|
4170
|
+
[data-slot="docblocks/link"] {
|
|
4171
|
+
text-decoration: underline;
|
|
4172
|
+
text-underline-offset: 2px;
|
|
4173
|
+
}
|
|
4174
|
+
|
|
4165
4175
|
/* The interactive chip (the consumer's mention interactions stand over the
|
|
4166
4176
|
editor root): the link's cursor and the light neutral's hover
|
|
4167
4177
|
background — the rounded 3px rect with the 2px's letters' offset (the
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "docblocks-react-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.0",
|
|
4
4
|
"description": "React rendering + editing layer for docblocks: hooks, block renderers, caret/selection, keyboard, clipboard.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"access": "public"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
|
-
"docblocks-core": "^0.
|
|
37
|
+
"docblocks-core": "^0.7.0",
|
|
38
38
|
"framer-motion": "^11.0.0 || ^12.0.0 || ^13.0.0 || ^14.0.0",
|
|
39
39
|
"mermaid": "^12.0.0",
|
|
40
40
|
"pdfjs-dist": "^6.0.0",
|