docblocks-react-ui 0.24.0 → 0.24.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/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # docblocks-react-ui
2
2
 
3
+ ## 0.24.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 345f059: The link editor's popover closes on an outside press (the document's
8
+ pointerdown over the popover's own press's exclusion) and on the document's
9
+ Escape (the input's no-focus's stand) — the stands the anchor's right-click
10
+ menu already kept. A press on the popover's input keeps the mousedown's
11
+ default (the input's focus + the caret's seat over the click), so the
12
+ address's edit works after the input lost the focus — the typing lands in
13
+ the input, not in the document. The popover's chrome keeps the default's
14
+ suppression (the document's selection's life over the edit).
15
+
3
16
  ## 0.24.0
4
17
 
5
18
  ### Minor Changes
@@ -24020,9 +24020,14 @@ function resolveLinkHref(input) {
24020
24020
  * absolutely-positioned div inside the editor root (the root is the
24021
24021
  * positioning context), like the slash / the mention's menus. Enter / the
24022
24022
  * apply stands the commit (the `applyLinkHref`'s one transaction), the
24023
- * Escape stands the close (the no-write's stand), the invalid's stand
24023
+ * Escape stands the close (the no-write's stand — the document's stand
24024
+ * over the input's no-focus's, the LinkMenu's parity), the invalid's stand
24024
24025
  * stands the destructive's border + the message. The popover's mousedown
24025
- * stands the default's suppress (the selection's life over the edit).
24026
+ * stands the default's suppress (the selection's life over the edit) over
24027
+ * the non-form-control's stand only — the input's press keeps its default
24028
+ * (the focus + the caret's seat, the typing's stand over a lost focus).
24029
+ * The outside's press stands the close (the capture's document's stand,
24030
+ * the LinkMenu's parity).
24026
24031
  */
24027
24032
  /** The popover's width (px — the input's field's stand). */
24028
24033
  const POPOVER_WIDTH_PX = 288;
@@ -24043,6 +24048,27 @@ function LinkPopover({ rootRef, state, onClose }) {
24043
24048
  input.focus();
24044
24049
  input.select();
24045
24050
  }, []);
24051
+ useLayoutEffect(() => {
24052
+ const onKey = (event) => {
24053
+ if (event.key === "Escape") onClose();
24054
+ };
24055
+ const onPointerDown = (event) => {
24056
+ const el = popoverRef.current;
24057
+ const target = event.target instanceof Element ? event.target : null;
24058
+ if (el !== null && target !== null && !el.contains(target)) onClose();
24059
+ };
24060
+ document.addEventListener("keydown", onKey, true);
24061
+ document.addEventListener("pointerdown", onPointerDown, true);
24062
+ return () => {
24063
+ document.removeEventListener("keydown", onKey, true);
24064
+ document.removeEventListener("pointerdown", onPointerDown, true);
24065
+ };
24066
+ }, [onClose]);
24067
+ const handleMouseDown = (event) => {
24068
+ const target = event.target instanceof Element ? event.target : null;
24069
+ if (target !== null && target.closest("input, textarea") !== null) return;
24070
+ preventDefault(event);
24071
+ };
24046
24072
  useLayoutEffect(() => {
24047
24073
  const el = popoverRef.current;
24048
24074
  const root = rootRef.current;
@@ -24081,7 +24107,7 @@ function LinkPopover({ rootRef, state, onClose }) {
24081
24107
  left: position.left,
24082
24108
  top: position.top
24083
24109
  },
24084
- onMouseDown: preventDefault,
24110
+ onMouseDown: handleMouseDown,
24085
24111
  children: [
24086
24112
  /* @__PURE__ */ jsx(Input, {
24087
24113
  ref: inputRef,
@@ -24099,10 +24125,6 @@ function LinkPopover({ rootRef, state, onClose }) {
24099
24125
  event.preventDefault();
24100
24126
  event.stopPropagation();
24101
24127
  apply();
24102
- } else if (event.key === "Escape") {
24103
- event.preventDefault();
24104
- event.stopPropagation();
24105
- onClose();
24106
24128
  }
24107
24129
  }
24108
24130
  }),
package/dist/index.d.mts CHANGED
@@ -427,7 +427,7 @@ declare function AlertDescription({ className, ...props }: React$1.ComponentProp
427
427
  //#endregion
428
428
  //#region src/shared/ui/Badge.d.ts
429
429
  declare const badgeVariants: (props?: ({
430
- variant?: "default" | "custom" | "secondary" | "destructive" | "outline" | null | undefined;
430
+ variant?: "default" | "destructive" | "custom" | "secondary" | "outline" | null | undefined;
431
431
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
432
432
  declare function Badge({ className, variant, asChild, ...props }: React$1.ComponentProps<"span"> & VariantProps<typeof badgeVariants> & {
433
433
  asChild?: boolean;
@@ -438,7 +438,7 @@ declare function BareSelect({ className, children, ...props }: React$1.Component
438
438
  //#endregion
439
439
  //#region src/shared/ui/Button.d.ts
440
440
  declare const buttonVariants: (props?: ({
441
- variant?: "link" | "default" | "secondary" | "destructive" | "outline" | "ghost" | null | undefined;
441
+ variant?: "link" | "default" | "destructive" | "secondary" | "outline" | "ghost" | null | undefined;
442
442
  size?: "default" | "icon" | "sm" | "lg" | "xl" | null | undefined;
443
443
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
444
444
  declare function Button({ className, variant, size, asChild, type, ...props }: React$1.ComponentProps<"button"> & VariantProps<typeof buttonVariants> & {
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { C as UnknownSlashCommandError, S as UnhandledValueError, _ as CanvasPasteError, b as HookMisuseError, g as BlobNotFoundError, s as preventDefault, v as DocBlocksUiError, w as cn, x as PdfFetchError, y as EditorProviderError } from "./constants-D_3p65rk.mjs";
2
- import { $ as DropdownMenuShortcut, $t as DocblocksI18nProvider, A as Select, B as Label, Bt as CardFooter, C as cellValueEqual, Ct as isBridgeError, D as filterIsComplete, Dt as parseCellValue, E as emptyFilter, Et as conditionMatches, F as SelectScrollDownButton, Ft as Skeleton, G as DropdownMenuContent, Gt as useBlock, H as Input, Ht as CardTitle, I as SelectScrollUpButton, It as Card, J as DropdownMenuLabel, Jt as usePresence, K as DropdownMenuGroup, Kt as useDoc, L as SelectSeparator, Lt as CardAction, M as SelectGroup, Mt as Eye, N as SelectItem, O as SegmentSelector, Ot as TEXT_TYPES, P as SelectLabel, Pt as BookOpen, Q as DropdownMenuSeparator, Qt as useText, R as SelectTrigger, Rt as CardContent, S as useDatabaseTable, St as BridgeError, T as FilterBuilder, Tt as toBridgeError, U as DropdownMenu, Ut as Badge, V as InlineEditInput, Vt as CardHeader, W as DropdownMenuCheckboxItem, Wt as badgeVariants, X as DropdownMenuRadioGroup, Xt as useSelection, Y as DropdownMenuPortal, Yt as usePresenceSharing, Z as DropdownMenuRadioItem, Zt as useSelectionView, _ as mapFrontmatter, _t as BASELINE_CAPABILITIES, a as DEFAULT_EMBED_SANDBOX, at as Popover, b as renderRuns, bt as validateProtocolDescriptor, c as SHAPE_FONT_OPTIONS, ct as PopoverDescription, d as FORMAT_PALETTE, dt as PopoverTrigger, en as createMemoryBlobStore, et as DropdownMenuSub, ft as Checkbox, g as parseFrontmatter, gt as AlertTitle, h as mdToBlocks, ht as AlertDescription, i as useEditorContext, it as Separator, j as SelectContent, jt as Pen, k as ScrollArea, kt as columnAnnotation, l as SHAPE_FONT_STACKS, lt as PopoverHeader, m as insertNative, mt as Alert, n as useCoverAverageColor, nn as Button, nt as DropdownMenuSubTrigger, ot as PopoverAnchor, p as htmlToBlocks, pt as BareSelect, q as DropdownMenuItem, qt as useMeta, r as EditorProvider, rn as buttonVariants, rt as DropdownMenuTrigger, st as PopoverContent, t as Editor, tn as EditorErrorBoundary, tt as DropdownMenuSubContent, ut as PopoverTitle, v as markToggleAction, vt as PROTOCOL_VERSION, w as newMutationContext, wt as isBridgeErrorCode, x as GridBody, xt as BRIDGE_ERROR_CODES, yt as isDatabaseBridge, z as SelectValue, zt as CardDescription } from "./Editor-CDZqsAHh.mjs";
2
+ import { $ as DropdownMenuShortcut, $t as DocblocksI18nProvider, A as Select, B as Label, Bt as CardFooter, C as cellValueEqual, Ct as isBridgeError, D as filterIsComplete, Dt as parseCellValue, E as emptyFilter, Et as conditionMatches, F as SelectScrollDownButton, Ft as Skeleton, G as DropdownMenuContent, Gt as useBlock, H as Input, Ht as CardTitle, I as SelectScrollUpButton, It as Card, J as DropdownMenuLabel, Jt as usePresence, K as DropdownMenuGroup, Kt as useDoc, L as SelectSeparator, Lt as CardAction, M as SelectGroup, Mt as Eye, N as SelectItem, O as SegmentSelector, Ot as TEXT_TYPES, P as SelectLabel, Pt as BookOpen, Q as DropdownMenuSeparator, Qt as useText, R as SelectTrigger, Rt as CardContent, S as useDatabaseTable, St as BridgeError, T as FilterBuilder, Tt as toBridgeError, U as DropdownMenu, Ut as Badge, V as InlineEditInput, Vt as CardHeader, W as DropdownMenuCheckboxItem, Wt as badgeVariants, X as DropdownMenuRadioGroup, Xt as useSelection, Y as DropdownMenuPortal, Yt as usePresenceSharing, Z as DropdownMenuRadioItem, Zt as useSelectionView, _ as mapFrontmatter, _t as BASELINE_CAPABILITIES, a as DEFAULT_EMBED_SANDBOX, at as Popover, b as renderRuns, bt as validateProtocolDescriptor, c as SHAPE_FONT_OPTIONS, ct as PopoverDescription, d as FORMAT_PALETTE, dt as PopoverTrigger, en as createMemoryBlobStore, et as DropdownMenuSub, ft as Checkbox, g as parseFrontmatter, gt as AlertTitle, h as mdToBlocks, ht as AlertDescription, i as useEditorContext, it as Separator, j as SelectContent, jt as Pen, k as ScrollArea, kt as columnAnnotation, l as SHAPE_FONT_STACKS, lt as PopoverHeader, m as insertNative, mt as Alert, n as useCoverAverageColor, nn as Button, nt as DropdownMenuSubTrigger, ot as PopoverAnchor, p as htmlToBlocks, pt as BareSelect, q as DropdownMenuItem, qt as useMeta, r as EditorProvider, rn as buttonVariants, rt as DropdownMenuTrigger, st as PopoverContent, t as Editor, tn as EditorErrorBoundary, tt as DropdownMenuSubContent, ut as PopoverTitle, v as markToggleAction, vt as PROTOCOL_VERSION, w as newMutationContext, wt as isBridgeErrorCode, x as GridBody, xt as BRIDGE_ERROR_CODES, yt as isDatabaseBridge, z as SelectValue, zt as CardDescription } from "./Editor-Du_hrZ3E.mjs";
3
3
  import { useCallback, useEffect, useRef, useState } from "react";
4
4
  import { useTranslation } from "react-i18next";
5
5
  import { cva } from "class-variance-authority";
@@ -1,5 +1,5 @@
1
1
  import { a as clamp, d as Plus, f as Minus, p as LoaderCircle, s as preventDefault, u as TriangleAlert } from "../constants-D_3p65rk.mjs";
2
- import { At as RotateCcw, Ft as Skeleton, Mt as Eye, Nt as CodeXml, O as SegmentSelector, f as textOf, gt as AlertTitle, ht as AlertDescription, i as useEditorContext, mt as Alert, nn as Button, o as childrenSlot, s as CodeHeader, u as TextBlock, y as INLINE_CODE_CLASS } from "../Editor-CDZqsAHh.mjs";
2
+ import { At as RotateCcw, Ft as Skeleton, Mt as Eye, Nt as CodeXml, O as SegmentSelector, f as textOf, gt as AlertTitle, ht as AlertDescription, i as useEditorContext, mt as Alert, nn as Button, o as childrenSlot, s as CodeHeader, u as TextBlock, y as INLINE_CODE_CLASS } from "../Editor-Du_hrZ3E.mjs";
3
3
  import { t as Maximize } from "../Maximize-BBHnCDWL.mjs";
4
4
  import { useEffect, useRef, useState } from "react";
5
5
  import { useTranslation } from "react-i18next";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "docblocks-react-ui",
3
- "version": "0.24.0",
3
+ "version": "0.24.1",
4
4
  "description": "React rendering + editing layer for docblocks: hooks, block renderers, caret/selection, keyboard, clipboard.",
5
5
  "type": "module",
6
6
  "license": "MIT",