@delali/web-editor 0.4.3 → 0.4.5

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.
@@ -0,0 +1,3 @@
1
+ import type { EditorAdapter } from './editor-adapter';
2
+ import { type TextFieldAttributeMap } from './text-field-attributes';
3
+ export declare function useInspectorTextFields(adapter: EditorAdapter, attributes: TextFieldAttributeMap): EditorAdapter;
@@ -0,0 +1,5 @@
1
+ import type { TextFieldAttributes } from '../types/editor';
2
+ export type TextFieldAttributeMap = Readonly<Record<string, string>>;
3
+ export declare const TextFieldAttributesContext: import("react").Context<Readonly<Record<string, string>>>;
4
+ export declare function useTextFieldAttributes(): Readonly<Record<string, string>>;
5
+ export declare function useStableTextFieldAttributes(attributes: TextFieldAttributes | undefined): Readonly<Record<string, string>>;
@@ -4308,6 +4308,16 @@ var backgroundColorItems = [
4308
4308
 
4309
4309
  // src/ui/input.tsx
4310
4310
  import { cva as cva10 } from "class-variance-authority";
4311
+
4312
+ // src/context/text-field-attributes.ts
4313
+ import { createContext as createContext4, useContext as useContext4, useState as useState6 } from "react";
4314
+ var EMPTY_ATTRIBUTES = Object.freeze({});
4315
+ var TextFieldAttributesContext = createContext4(EMPTY_ATTRIBUTES);
4316
+ function useTextFieldAttributes() {
4317
+ return useContext4(TextFieldAttributesContext);
4318
+ }
4319
+
4320
+ // src/ui/input.tsx
4311
4321
  import { jsx as jsx22 } from "react/jsx-runtime";
4312
4322
  var inputVariants = cva10(
4313
4323
  cn(
@@ -4329,9 +4339,16 @@ var inputVariants = cva10(
4329
4339
  }
4330
4340
  }
4331
4341
  );
4342
+ var TEXT_INPUT_TYPES = /* @__PURE__ */ new Set(["text", "search", "url", "email", "tel", "password"]);
4343
+ function UnstyledInput(_a) {
4344
+ var _b = _a, { type = "text" } = _b, props = __objRest(_b, ["type"]);
4345
+ const attributes = useTextFieldAttributes();
4346
+ const textFieldAttributes = TEXT_INPUT_TYPES.has(type.toLowerCase()) ? attributes : void 0;
4347
+ return /* @__PURE__ */ jsx22("input", __spreadValues(__spreadProps(__spreadValues({}, textFieldAttributes), { type }), props));
4348
+ }
4332
4349
  function Input(_a) {
4333
4350
  var _b = _a, { className, variant } = _b, props = __objRest(_b, ["className", "variant"]);
4334
- return /* @__PURE__ */ jsx22("input", __spreadValues({ className: cn(inputVariants({ variant }), className) }, props));
4351
+ return /* @__PURE__ */ jsx22(UnstyledInput, __spreadValues({ className: cn(inputVariants({ variant }), className) }, props));
4335
4352
  }
4336
4353
 
4337
4354
  // src/ui/menu.tsx
@@ -5564,11 +5581,11 @@ import { PathApi as PathApi5 } from "platejs";
5564
5581
  import { SlateElement as SlateElement2 } from "platejs/static";
5565
5582
 
5566
5583
  // src/context/heading-slug-context.tsx
5567
- import { createContext as createContext5, useContext as useContext5 } from "react";
5584
+ import { createContext as createContext6, useContext as useContext6 } from "react";
5568
5585
  import { jsx as jsx29 } from "react/jsx-runtime";
5569
- var HeadingSlugContext = createContext5(null);
5586
+ var HeadingSlugContext = createContext6(null);
5570
5587
  var useHeadingSlug = () => {
5571
- return useContext5(HeadingSlugContext);
5588
+ return useContext6(HeadingSlugContext);
5572
5589
  };
5573
5590
 
5574
5591
  // src/ui/heading-node-static.tsx
@@ -6201,20 +6218,20 @@ import { SlateElement as SlateElement9 } from "platejs/static";
6201
6218
 
6202
6219
  // src/context/link-resolution-context.tsx
6203
6220
  import {
6204
- createContext as createContext7,
6221
+ createContext as createContext8,
6205
6222
  useCallback as useCallback5,
6206
- useContext as useContext7,
6223
+ useContext as useContext8,
6207
6224
  useEffect as useEffect12,
6208
6225
  useMemo as useMemo8,
6209
6226
  useRef as useRef7,
6210
6227
  useSyncExternalStore as useSyncExternalStore2
6211
6228
  } from "react";
6212
6229
  import { jsx as jsx42 } from "react/jsx-runtime";
6213
- var LinkResolutionContext = createContext7(null);
6230
+ var LinkResolutionContext = createContext8(null);
6214
6231
  var NOOP_UNSUBSCRIBE = () => {
6215
6232
  };
6216
6233
  var usePagePreview = (reference) => {
6217
- const store = useContext7(LinkResolutionContext);
6234
+ const store = useContext8(LinkResolutionContext);
6218
6235
  const key = reference ? linkReferenceKey(reference) : null;
6219
6236
  const subscribe2 = useCallback5(
6220
6237
  (onChange) => {
@@ -6227,12 +6244,12 @@ var usePagePreview = (reference) => {
6227
6244
  return useSyncExternalStore2(subscribe2, getSnapshot, getSnapshot);
6228
6245
  };
6229
6246
  var useHasLinkSeed = (url) => {
6230
- const store = useContext7(LinkResolutionContext);
6247
+ const store = useContext8(LinkResolutionContext);
6231
6248
  if (!store || !url) return false;
6232
6249
  return store.seededUrls.has(url);
6233
6250
  };
6234
6251
  var useLinkMetadata = (url) => {
6235
- const store = useContext7(LinkResolutionContext);
6252
+ const store = useContext8(LinkResolutionContext);
6236
6253
  const subscribe2 = useCallback5(
6237
6254
  (onChange) => {
6238
6255
  if (!store || !url) return NOOP_UNSUBSCRIBE;
@@ -6368,11 +6385,11 @@ var getSmartLinkAnchorProps = (url) => {
6368
6385
 
6369
6386
  // src/ui/smart-link-view.tsx
6370
6387
  import { ArrowUpRightIcon, FileTextIcon, LinkIcon } from "lucide-react";
6371
- import { useCallback as useCallback6, useState as useState10 } from "react";
6388
+ import { useCallback as useCallback6, useState as useState11 } from "react";
6372
6389
  import { jsx as jsx43, jsxs as jsxs20 } from "react/jsx-runtime";
6373
6390
  var PLAIN_LINK_CLASS_NAME = "inline font-medium text-primary underline decoration-primary/45 decoration-1 underline-offset-[0.2em] transition-colors hover:decoration-primary hover:decoration-2";
6374
6391
  function SmartLinkIcon({ icon, faviconUrl, provider, className }) {
6375
- const [failedSrc, setFailedSrc] = useState10(null);
6392
+ const [failedSrc, setFailedSrc] = useState11(null);
6376
6393
  const isPageLike = provider === "Page" || provider === "Internal link";
6377
6394
  const showFavicon = typeof faviconUrl === "string" && faviconUrl.length > 0 && failedSrc !== faviconUrl;
6378
6395
  const handleFaviconError = useCallback6(() => {
@@ -6414,7 +6431,7 @@ function SmartLinkInlineContent({ link, className }) {
6414
6431
  "span",
6415
6432
  {
6416
6433
  className: cn(
6417
- "inline-flex max-w-full items-center gap-[0.2em] rounded-[0.25em] px-[0.4em] py-[0.1em] align-[-0.28em] font-medium text-[#0C66E4] leading-[1.3] outline outline-transparent transition-colors hover:bg-[#0C66E4]/5 hover:outline-[#0C66E4]/30",
6434
+ "inline-flex max-w-full items-center gap-[0.2em] rounded-[0.25em] px-[0.4em] py-[0.1em] align-[-0.28em] font-medium text-editor-link leading-[1.3] outline outline-transparent transition-colors hover:bg-editor-link/5 hover:outline-editor-link/30",
6418
6435
  className
6419
6436
  ),
6420
6437
  children: [
@@ -6430,7 +6447,7 @@ function SmartLinkUrlContent({ link, className }) {
6430
6447
  "span",
6431
6448
  {
6432
6449
  className: cn(
6433
- "inline max-w-full wrap-break-word border-[#0C66E4]/35 border-b font-medium text-[#0C66E4] leading-[inherit]",
6450
+ "inline max-w-full wrap-break-word border-b border-editor-link/35 font-medium text-editor-link leading-[inherit] dark-or-inherit:border-editor-link/35!",
6434
6451
  className
6435
6452
  ),
6436
6453
  children: [
@@ -6462,7 +6479,7 @@ function SmartLinkCardContent({ link, className }) {
6462
6479
  ),
6463
6480
  /* @__PURE__ */ jsxs20("span", { className: "min-w-0 flex-1", children: [
6464
6481
  /* @__PURE__ */ jsxs20("span", { className: "flex min-w-0 items-start gap-3", children: [
6465
- /* @__PURE__ */ jsx43("span", { className: "min-w-0 flex-1 truncate font-semibold text-[#0C66E4] text-base leading-6", children: link.title }),
6482
+ /* @__PURE__ */ jsx43("span", { className: "min-w-0 flex-1 truncate font-semibold text-editor-link text-base leading-6", children: link.title }),
6466
6483
  link.status ? /* @__PURE__ */ jsx43(SmartLinkStatus, { status: link.status }) : null
6467
6484
  ] }),
6468
6485
  /* @__PURE__ */ jsxs20("span", { className: "mt-2 flex min-w-0 items-center gap-2 text-muted-foreground text-sm", children: [
@@ -6480,7 +6497,7 @@ function SmartLinkCardContent({ link, className }) {
6480
6497
  {
6481
6498
  faviconUrl: link.faviconUrl,
6482
6499
  provider: link.provider,
6483
- className: "size-5 rounded bg-[#0C66E4] p-1 text-white"
6500
+ className: "size-5 rounded bg-editor-link p-1 text-white dark-or-inherit:text-primary-foreground"
6484
6501
  }
6485
6502
  ),
6486
6503
  /* @__PURE__ */ jsx43("span", { className: "truncate", children: (_a = link.provider) != null ? _a : "Link" })
@@ -6495,7 +6512,7 @@ function SmartLinkCardContent({ link, className }) {
6495
6512
  );
6496
6513
  }
6497
6514
  function SmartLinkCardImage({ src }) {
6498
- const [hasFailed, setHasFailed] = useState10(false);
6515
+ const [hasFailed, setHasFailed] = useState11(false);
6499
6516
  const handleError = useCallback6(() => {
6500
6517
  setHasFailed(true);
6501
6518
  }, []);
@@ -7043,6 +7060,7 @@ import { SlateElement as SlateElement13 } from "platejs/static";
7043
7060
  // src/ui/media-file-display.ts
7044
7061
  var FILE_DISPLAY_MODES = ["inline", "url", "embed"];
7045
7062
  var DEFAULT_FILE_DISPLAY_MODE = "inline";
7063
+ var FILE_URL_CLASS_NAME = "inline-flex max-w-full items-center gap-1 break-all border-b border-editor-link/35 font-medium text-editor-link dark-or-inherit:border-editor-link/35!";
7046
7064
  var normalizeFileDisplayMode = (value) => {
7047
7065
  return value === "url" || value === "embed" || value === "inline" ? value : DEFAULT_FILE_DISPLAY_MODE;
7048
7066
  };
@@ -7079,20 +7097,10 @@ function MediaFileStaticBody({ canEmbed, displayMode, name, url }) {
7079
7097
  );
7080
7098
  }
7081
7099
  if (displayMode === "url") {
7082
- return /* @__PURE__ */ jsxs26(
7083
- "a",
7084
- {
7085
- className: "inline-flex max-w-full items-center gap-1 break-all border-[#0C66E4]/35 border-b font-medium text-[#0C66E4]",
7086
- contentEditable: false,
7087
- href: url,
7088
- rel: "noopener noreferrer",
7089
- target: "_blank",
7090
- children: [
7091
- /* @__PURE__ */ jsx50(Link, { className: "size-4 shrink-0 text-muted-foreground" }),
7092
- /* @__PURE__ */ jsx50("span", { className: "truncate", children: url })
7093
- ]
7094
- }
7095
- );
7100
+ return /* @__PURE__ */ jsxs26("a", { className: FILE_URL_CLASS_NAME, contentEditable: false, href: url, rel: "noopener noreferrer", target: "_blank", children: [
7101
+ /* @__PURE__ */ jsx50(Link, { className: "size-4 shrink-0 text-muted-foreground" }),
7102
+ /* @__PURE__ */ jsx50("span", { className: "truncate", children: url })
7103
+ ] });
7096
7104
  }
7097
7105
  return /* @__PURE__ */ jsx50(
7098
7106
  "a",
@@ -7132,7 +7140,7 @@ function MediaFileElementStatic(props) {
7132
7140
  // src/ui/media-image-node-static.tsx
7133
7141
  import { NodeApi as NodeApi6 } from "platejs";
7134
7142
  import { SlateElement as SlateElement14 } from "platejs/static";
7135
- import { useCallback as useCallback8, useRef as useRef8, useState as useState11 } from "react";
7143
+ import { useCallback as useCallback8, useRef as useRef8, useState as useState12 } from "react";
7136
7144
 
7137
7145
  // src/ui/media-image-lightbox.tsx
7138
7146
  import { AnimatePresence as AnimatePresence2, motion as motion2 } from "framer-motion";
@@ -7254,8 +7262,8 @@ function ImageLightbox({ alt, isOpen, onClose, sourceRect, src }) {
7254
7262
  import { jsx as jsx52, jsxs as jsxs28 } from "react/jsx-runtime";
7255
7263
  function ImageElementStatic(props) {
7256
7264
  const { align = "center", caption, hint, hintIcon, url } = props.element;
7257
- const [lightboxOpen, setLightboxOpen] = useState11(false);
7258
- const [sourceRect, setSourceRect] = useState11(null);
7265
+ const [lightboxOpen, setLightboxOpen] = useState12(false);
7266
+ const [sourceRect, setSourceRect] = useState12(null);
7259
7267
  const imgRef = useRef8(null);
7260
7268
  const handleOpen = useCallback8(() => {
7261
7269
  if (imgRef.current) {
@@ -7354,7 +7362,7 @@ import { BaseMentionPlugin } from "@platejs/mention";
7354
7362
  // src/ui/mention-node-static.tsx
7355
7363
  import { IS_APPLE } from "platejs";
7356
7364
  import { SlateElement as SlateElement16 } from "platejs/static";
7357
- import { useCallback as useCallback9, useState as useState14 } from "react";
7365
+ import { useCallback as useCallback9, useState as useState15 } from "react";
7358
7366
 
7359
7367
  // src/ui/member-profile-card.tsx
7360
7368
  import { ArrowUpRight, Mail, MapPin, Users } from "lucide-react";
@@ -7458,9 +7466,9 @@ function MemberProfileCard({ profile, fallbackName, isLoading }) {
7458
7466
  }
7459
7467
 
7460
7468
  // src/ui/mention-document-link.ts
7461
- import { useEffect as useEffect14, useState as useState12 } from "react";
7469
+ import { useEffect as useEffect14, useState as useState13 } from "react";
7462
7470
  var useDocumentPagePreview = ({ enabled, reference, resolvePage }) => {
7463
- const [page, setPage] = useState12(null);
7471
+ const [page, setPage] = useState13(null);
7464
7472
  const referenceKey = enabled && reference ? linkReferenceKey(reference) : null;
7465
7473
  useEffect14(() => {
7466
7474
  const nextReference = referenceKey ? linkReferenceFromKey(referenceKey) : null;
@@ -7500,10 +7508,10 @@ var getDocumentMentionLink = (element, page, displayMode) => {
7500
7508
  };
7501
7509
 
7502
7510
  // src/ui/use-member-profile.ts
7503
- import { useEffect as useEffect15, useState as useState13 } from "react";
7511
+ import { useEffect as useEffect15, useState as useState14 } from "react";
7504
7512
  var IDLE_STATE = { profile: null, isLoading: false, hasResolved: false };
7505
7513
  var useMemberProfile = ({ enabled, memberId, resolveMember }) => {
7506
- const [state, setState] = useState13(IDLE_STATE);
7514
+ const [state, setState] = useState14(IDLE_STATE);
7507
7515
  useEffect15(() => {
7508
7516
  if (!enabled || !resolveMember || memberId.length === 0) {
7509
7517
  setState(IDLE_STATE);
@@ -7572,7 +7580,7 @@ function UserMentionElementStatic(_a) {
7572
7580
  const resolveMember = adapter.mentions.resolveMember;
7573
7581
  const memberId = (_a2 = element.key) != null ? _a2 : "";
7574
7582
  const canShowCard = typeof resolveMember === "function" && memberId.length > 0;
7575
- const [wantOpen, setWantOpen] = useState14(false);
7583
+ const [wantOpen, setWantOpen] = useState15(false);
7576
7584
  const { profile, isLoading, hasResolved } = useMemberProfile({
7577
7585
  enabled: canShowCard && wantOpen,
7578
7586
  memberId,
@@ -8276,6 +8284,7 @@ function CommandInput(_a) {
8276
8284
  "variant",
8277
8285
  "wrapClassName"
8278
8286
  ]);
8287
+ const attributes = useTextFieldAttributes();
8279
8288
  return /* @__PURE__ */ jsx65(
8280
8289
  "div",
8281
8290
  {
@@ -8284,10 +8293,10 @@ function CommandInput(_a) {
8284
8293
  "data-slot": "command-input-wrapper",
8285
8294
  children: /* @__PURE__ */ jsx65(
8286
8295
  CommandPrimitive.Input,
8287
- __spreadValues({
8296
+ __spreadValues(__spreadProps(__spreadValues({}, attributes), {
8288
8297
  className: cn(inputVariants({ variant }), className),
8289
8298
  "data-slot": "command-input"
8290
- }, props)
8299
+ }), props)
8291
8300
  )
8292
8301
  }
8293
8302
  );
@@ -8668,7 +8677,7 @@ function TabTrigger({
8668
8677
  onKeyDown: handleTabKeyDown,
8669
8678
  children: [
8670
8679
  isEditing ? /* @__PURE__ */ jsx68(
8671
- "input",
8680
+ UnstyledInput,
8672
8681
  {
8673
8682
  ref: inputRef,
8674
8683
  className: cn(
@@ -9737,11 +9746,19 @@ var textareaVariants = cva19(
9737
9746
  );
9738
9747
  function Textarea(_a) {
9739
9748
  var _b = _a, { className, variant } = _b, props = __objRest(_b, ["className", "variant"]);
9740
- return /* @__PURE__ */ jsx81("textarea", __spreadValues({ className: cn(textareaVariants({ variant }), className) }, props));
9749
+ const attributes = useTextFieldAttributes();
9750
+ return /* @__PURE__ */ jsx81("textarea", __spreadValues(__spreadProps(__spreadValues({}, attributes), { className: cn(textareaVariants({ variant }), className) }), props));
9741
9751
  }
9742
9752
  function TextareaAutosize(_a) {
9743
9753
  var _b = _a, { children, className, variant } = _b, props = __objRest(_b, ["children", "className", "variant"]);
9744
- return /* @__PURE__ */ jsx81(ReactTextareaAutosize, __spreadValues({ autoComplete: "off", className: cn(textareaVariants({ variant }), className) }, props));
9754
+ const attributes = useTextFieldAttributes();
9755
+ return /* @__PURE__ */ jsx81(
9756
+ ReactTextareaAutosize,
9757
+ __spreadValues(__spreadProps(__spreadValues({}, attributes), {
9758
+ autoComplete: "off",
9759
+ className: cn(textareaVariants({ variant }), className)
9760
+ }), props)
9761
+ );
9745
9762
  }
9746
9763
 
9747
9764
  // src/ui/ai-menu.tsx
@@ -12792,15 +12809,14 @@ function EmojiPickerSearchBar({
12792
12809
  }) {
12793
12810
  return /* @__PURE__ */ jsx106("div", { className: "flex items-center px-2", children: /* @__PURE__ */ jsxs62("div", { className: "relative flex grow items-center", children: [
12794
12811
  /* @__PURE__ */ jsx106(
12795
- "input",
12812
+ UnstyledInput,
12796
12813
  {
12797
12814
  className: "block w-full appearance-none rounded-full border-0 bg-muted px-10 py-2 text-sm outline-none placeholder:text-muted-foreground focus-visible:outline-none",
12798
12815
  value: searchValue,
12799
12816
  onChange: (event) => setSearch(event.target.value),
12800
12817
  placeholder: i18n.search,
12801
12818
  "aria-label": "Search",
12802
- autoComplete: "off",
12803
- type: "text"
12819
+ autoComplete: "off"
12804
12820
  }
12805
12821
  ),
12806
12822
  children
@@ -13342,7 +13358,7 @@ function CardTitleRow({
13342
13358
  }) {
13343
13359
  if (isEditing) {
13344
13360
  return /* @__PURE__ */ jsx111(
13345
- "input",
13361
+ UnstyledInput,
13346
13362
  {
13347
13363
  ref: inputRef,
13348
13364
  className: "min-w-30 bg-transparent font-semibold text-foreground outline-none",
@@ -15448,6 +15464,7 @@ function InlineComboboxInput(_a) {
15448
15464
  Ariakit2.Combobox,
15449
15465
  __spreadValues(__spreadValues({
15450
15466
  autoSelect: true,
15467
+ render: /* @__PURE__ */ jsx128(UnstyledInput, {}),
15451
15468
  className: cn("absolute top-0 left-0 size-full bg-transparent outline-hidden", className),
15452
15469
  ref,
15453
15470
  value
@@ -15661,7 +15678,7 @@ import { useLink } from "@platejs/link/react";
15661
15678
  import { SuggestionPlugin as SuggestionPlugin3 } from "@platejs/suggestion/react";
15662
15679
  import { NodeApi as NodeApi14 } from "platejs";
15663
15680
  import { PlateElement as PlateElement20, useEditorPlugin as useEditorPlugin9, useElement as useElement11, useReadOnly as useReadOnly13 } from "platejs/react";
15664
- import { useCallback as useCallback42, useMemo as useMemo16, useState as useState40 } from "react";
15681
+ import { useCallback as useCallback42, useMemo as useMemo16, useState as useState41 } from "react";
15665
15682
 
15666
15683
  // src/ui/smart-link-clipboard.ts
15667
15684
  var copySmartLinkUrl = async (url) => {
@@ -15699,10 +15716,10 @@ import { ArrowUpRightIcon as ArrowUpRightIcon3, PencilIcon as PencilIcon6, Trash
15699
15716
 
15700
15717
  // src/ui/smart-link-copy-button.tsx
15701
15718
  import { CheckIcon as CheckIcon15, CopyIcon as CopyIcon2, XIcon as XIcon7 } from "lucide-react";
15702
- import { useCallback as useCallback40, useEffect as useEffect38, useState as useState39 } from "react";
15719
+ import { useCallback as useCallback40, useEffect as useEffect38, useState as useState40 } from "react";
15703
15720
  import { jsx as jsx130 } from "react/jsx-runtime";
15704
15721
  function SmartLinkCopyButton({ disabled, onCopy }) {
15705
- const [feedback, setFeedback] = useState39("idle");
15722
+ const [feedback, setFeedback] = useState40("idle");
15706
15723
  useEffect38(() => {
15707
15724
  if (feedback === "idle") return;
15708
15725
  const timeoutId = window.setTimeout(() => {
@@ -15870,8 +15887,8 @@ function LinkElement(_a) {
15870
15887
  const { api, editor, setOption } = useEditorPlugin9(linkPlugin);
15871
15888
  const adapter = useEditorAdapter();
15872
15889
  const readOnly = useReadOnly13();
15873
- const [isToolbarOpen, setIsToolbarOpen] = useState40(false);
15874
- const [isModeMenuOpen, setIsModeMenuOpen] = useState40(false);
15890
+ const [isToolbarOpen, setIsToolbarOpen] = useState41(false);
15891
+ const [isModeMenuOpen, setIsModeMenuOpen] = useState41(false);
15875
15892
  const displayMode = normalizeSmartLinkDisplayMode(element.displayMode);
15876
15893
  const open = !readOnly && (isToolbarOpen || isModeMenuOpen);
15877
15894
  const reference = useMemo16(() => readElementReference(element), [element]);
@@ -16048,12 +16065,12 @@ var PlainLinkElement = (props) => /* @__PURE__ */ jsx133(LinkElement, __spreadPr
16048
16065
 
16049
16066
  // src/ui/link-toolbar.tsx
16050
16067
  import { useEditorPlugin as useEditorPlugin12, useEditorSelector as useEditorSelector2, usePluginOption as usePluginOption17 } from "platejs/react";
16051
- import { useCallback as useCallback45, useEffect as useEffect41, useState as useState43 } from "react";
16068
+ import { useCallback as useCallback45, useEffect as useEffect41, useState as useState44 } from "react";
16052
16069
 
16053
16070
  // src/ui/link-search-panel.tsx
16054
16071
  import { BookmarkIcon, LinkIcon as LinkIcon4 } from "lucide-react";
16055
16072
  import { useEditorPlugin as useEditorPlugin10 } from "platejs/react";
16056
- import { useCallback as useCallback43, useEffect as useEffect39, useState as useState41 } from "react";
16073
+ import { useCallback as useCallback43, useEffect as useEffect39, useState as useState42 } from "react";
16057
16074
 
16058
16075
  // src/ui/link-toolbar-shared.ts
16059
16076
  import { unwrapLink as unwrapLink2, upsertLink } from "@platejs/link";
@@ -16196,10 +16213,10 @@ function LinkSearchPanel({ initialUrl }) {
16196
16213
  const adapter = useEditorAdapter();
16197
16214
  const { editor } = useEditorPlugin10(linkPlugin);
16198
16215
  const canLinkPage = adapter.permissions.canLinkPage;
16199
- const [query, setQuery] = useState41(initialUrl);
16200
- const [displayText, setDisplayText] = useState41(() => readSelectionText(editor));
16201
- const [pages, setPages] = useState41([]);
16202
- const [isLoading, setIsLoading] = useState41(true);
16216
+ const [query, setQuery] = useState42(initialUrl);
16217
+ const [displayText, setDisplayText] = useState42(() => readSelectionText(editor));
16218
+ const [pages, setPages] = useState42([]);
16219
+ const [isLoading, setIsLoading] = useState42(true);
16203
16220
  const trimmedQuery = query.trim();
16204
16221
  const safeUrl = trimmedQuery.length > 0 ? getSafeSmartLinkUrl(trimmedQuery) : null;
16205
16222
  const searchTerm = isLikelySmartLinkUrl(query) ? "" : trimmedQuery;
@@ -16343,11 +16360,11 @@ import { CursorOverlayPlugin as CursorOverlayPlugin2 } from "@platejs/selection/
16343
16360
  import { LinkIcon as LinkIcon5, Trash2Icon as Trash2Icon4 } from "lucide-react";
16344
16361
  import { NodeApi as NodeApi16 } from "platejs";
16345
16362
  import { useEditorPlugin as useEditorPlugin11, usePluginOption as usePluginOption16 } from "platejs/react";
16346
- import { useCallback as useCallback44, useEffect as useEffect40, useState as useState42 } from "react";
16363
+ import { useCallback as useCallback44, useEffect as useEffect40, useState as useState43 } from "react";
16347
16364
  import { jsx as jsx135, jsxs as jsxs85 } from "react/jsx-runtime";
16348
16365
  function EditLinkCommand({ autoFocus, initialUrl, setInitialUrl }) {
16349
- const [url, setUrl] = useState42(initialUrl);
16350
- const [text, setText] = useState42("");
16366
+ const [url, setUrl] = useState43(initialUrl);
16367
+ const [text, setText] = useState43("");
16351
16368
  const mode = usePluginOption16(linkPlugin, "mode");
16352
16369
  const { editor, setOption } = useEditorPlugin11(linkPlugin);
16353
16370
  const activeLinkId = usePluginOption16(linkPlugin, "activeId");
@@ -16474,7 +16491,7 @@ function LinkFloatingToolbar() {
16474
16491
  })) == null ? void 0 : _a2[0];
16475
16492
  }, []);
16476
16493
  const aboveUrl = (_a = aboveLink == null ? void 0 : aboveLink.url) != null ? _a : "";
16477
- const [initialUrl, setInitialUrl] = useState43(aboveUrl);
16494
+ const [initialUrl, setInitialUrl] = useState44(aboveUrl);
16478
16495
  const open = mode === "insert" || mode === "edit" || mode === "cursor";
16479
16496
  useEffect41(() => {
16480
16497
  setInitialUrl(aboveUrl);
@@ -17308,9 +17325,8 @@ function IconSettingsForm({
17308
17325
  }
17309
17326
  ),
17310
17327
  /* @__PURE__ */ jsx151(
17311
- "input",
17328
+ UnstyledInput,
17312
17329
  {
17313
- type: "text",
17314
17330
  value: colorValue,
17315
17331
  onChange: handleColorChange,
17316
17332
  placeholder: "Default",
@@ -17774,9 +17790,10 @@ function Caption(_a) {
17774
17790
  return /* @__PURE__ */ jsx155(CaptionPrimitive, __spreadProps(__spreadValues({}, props), { className: cn(captionVariants({ align }), "px-3 pb-2", className) }));
17775
17791
  }
17776
17792
  function CaptionTextarea(props) {
17793
+ const attributes = useTextFieldAttributes();
17777
17794
  return /* @__PURE__ */ jsx155(
17778
17795
  CaptionTextareaPrimitive,
17779
- __spreadProps(__spreadValues({}, props), {
17796
+ __spreadProps(__spreadValues(__spreadValues({}, attributes), props), {
17780
17797
  className: cn(
17781
17798
  "mt-2 w-full resize-none border-none bg-inherit p-0 font-[inherit] text-inherit",
17782
17799
  "focus:outline-none focus:placeholder:opacity-0",
@@ -18314,7 +18331,7 @@ import { useMediaState as useMediaState3 } from "@platejs/media/react";
18314
18331
  import { ResizableProvider as ResizableProvider4 } from "@platejs/resizable";
18315
18332
  import { ArrowUpRightIcon as ArrowUpRightIcon4, FileUpIcon, LinkIcon as LinkIcon7 } from "lucide-react";
18316
18333
  import { PlateElement as PlateElement26, useEditorRef as useEditorRef38, useElement as useElement18, withHOC as withHOC4 } from "platejs/react";
18317
- import { useCallback as useCallback59, useState as useState48 } from "react";
18334
+ import { useCallback as useCallback59, useState as useState49 } from "react";
18318
18335
 
18319
18336
  // src/ui/media-file-mode-dropdown.tsx
18320
18337
  import { ChevronDownIcon as ChevronDownIcon9, FileIcon, FrameIcon, LinkIcon as LinkIcon6 } from "lucide-react";
@@ -18403,7 +18420,10 @@ function MediaFileBody({ canEmbed, displayMode, name, onAnchorClick, url }) {
18403
18420
  return /* @__PURE__ */ jsxs103(
18404
18421
  "a",
18405
18422
  {
18406
- className: "inline-flex max-w-full cursor-pointer items-center gap-1 break-all border-[#0C66E4]/35 border-b font-medium text-[#0C66E4] transition-colors hover:border-[#0C66E4]",
18423
+ className: cn(
18424
+ FILE_URL_CLASS_NAME,
18425
+ "cursor-pointer transition-colors hover:border-editor-link dark-or-inherit:hover:border-editor-link!"
18426
+ ),
18407
18427
  contentEditable: false,
18408
18428
  href: url,
18409
18429
  onClick: onAnchorClick,
@@ -18441,7 +18461,7 @@ var MediaFileElement = withHOC4(ResizableProvider4, function MediaFileElement2(p
18441
18461
  const fileName = name != null ? name : "";
18442
18462
  const fileUrl = unsafeUrl != null ? unsafeUrl : "";
18443
18463
  const canEmbed = isEmbeddableFile(fileName, fileUrl);
18444
- const [isModeMenuOpen, setIsModeMenuOpen] = useState48(false);
18464
+ const [isModeMenuOpen, setIsModeMenuOpen] = useState49(false);
18445
18465
  const open = !readOnly && (selected || isModeMenuOpen);
18446
18466
  const handleOpen = useCallback59(() => {
18447
18467
  if (fileUrl.length === 0) return;
@@ -18688,7 +18708,7 @@ import {
18688
18708
  import { AudioLinesIcon, FileUpIcon as FileUpIcon2, FilmIcon, ImageIcon as ImageIcon2 } from "lucide-react";
18689
18709
  import { KEYS as KEYS29, nanoid as nanoid10 } from "platejs";
18690
18710
  import { PlateElement as PlateElement28, useEditorPlugin as useEditorPlugin17, withHOC as withHOC6 } from "platejs/react";
18691
- import { useCallback as useCallback60, useEffect as useEffect47, useRef as useRef16, useState as useState49 } from "react";
18711
+ import { useCallback as useCallback60, useEffect as useEffect47, useRef as useRef16, useState as useState50 } from "react";
18692
18712
  import { useFilePicker } from "use-file-picker";
18693
18713
 
18694
18714
  // src/hooks/use-upload-file.ts
@@ -18930,7 +18950,7 @@ function MediaPlaceholderPopover({ children }) {
18930
18950
  var _a, _b, _c;
18931
18951
  const { api, editor, getOption, tf } = useEditorPlugin17(PlaceholderPlugin3);
18932
18952
  const { id, element, mediaType, readOnly, selected, setIsUploading, setProgresses, setUpdatedFiles, size } = usePlaceholderPopoverState();
18933
- const [open, setOpen] = useState49(false);
18953
+ const [open, setOpen] = useState50(false);
18934
18954
  const currentMedia = MEDIA_CONFIG[mediaType];
18935
18955
  const uploadConfig = useUploadConfig();
18936
18956
  const adapter = useEditorAdapter();
@@ -18990,7 +19010,7 @@ function MediaPlaceholderPopover({ children }) {
18990
19010
  { at: path }
18991
19011
  );
18992
19012
  }, [uploadedFile, element.id, size]);
18993
- const [embedValue, setEmbedValue] = useState49("");
19013
+ const [embedValue, setEmbedValue] = useState50("");
18994
19014
  const onEmbed = useCallback60(
18995
19015
  (value) => {
18996
19016
  const path = editor.api.findPath(element);
@@ -19046,7 +19066,7 @@ function ImageProgress({
19046
19066
  imageRef,
19047
19067
  progress = 0
19048
19068
  }) {
19049
- const [objectUrl, setObjectUrl] = useState49(null);
19069
+ const [objectUrl, setObjectUrl] = useState50(null);
19050
19070
  useEffect47(() => {
19051
19071
  const url = URL.createObjectURL(file);
19052
19072
  setObjectUrl(url);
@@ -19434,7 +19454,7 @@ import { KEYS as KEYS31 } from "platejs";
19434
19454
  // src/ui/mention-element.tsx
19435
19455
  import { IS_APPLE as IS_APPLE2 } from "platejs";
19436
19456
  import { PlateElement as PlateElement31, useFocused as useFocused5, useHotkeys as useHotkeys4, useReadOnly as useReadOnly20, useSelected as useSelected7 } from "platejs/react";
19437
- import { useCallback as useCallback63, useState as useState51 } from "react";
19457
+ import { useCallback as useCallback63, useState as useState52 } from "react";
19438
19458
  import { useMounted as useMounted2 } from "react-tweet";
19439
19459
 
19440
19460
  // src/ui/mention-document-element.tsx
@@ -19446,7 +19466,7 @@ import {
19446
19466
  useReadOnly as useReadOnly19,
19447
19467
  useSelected as useSelected6
19448
19468
  } from "platejs/react";
19449
- import { useCallback as useCallback62, useMemo as useMemo18, useState as useState50 } from "react";
19469
+ import { useCallback as useCallback62, useMemo as useMemo18, useState as useState51 } from "react";
19450
19470
 
19451
19471
  // src/ui/mention-document-hover-card.tsx
19452
19472
  import { useCallback as useCallback61 } from "react";
@@ -19498,8 +19518,8 @@ function DocumentMentionElement(props) {
19498
19518
  const focused = useFocused4();
19499
19519
  const editor = useEditorRef41();
19500
19520
  const readOnly = useReadOnly19();
19501
- const [isToolbarOpen, setIsToolbarOpen] = useState50(false);
19502
- const [isModeMenuOpen, setIsModeMenuOpen] = useState50(false);
19521
+ const [isToolbarOpen, setIsToolbarOpen] = useState51(false);
19522
+ const [isModeMenuOpen, setIsModeMenuOpen] = useState51(false);
19503
19523
  const adapter = useEditorAdapter();
19504
19524
  const canLinkPage = adapter.permissions.canLinkPage;
19505
19525
  const resolvePage = adapter.pageLinks.resolvePage;
@@ -19652,7 +19672,7 @@ function UserMentionElement(props) {
19652
19672
  const resolveMember = adapter.mentions.resolveMember;
19653
19673
  const memberId = (_a = element.key) != null ? _a : "";
19654
19674
  const canShowCard = typeof resolveMember === "function" && memberId.length > 0;
19655
- const [wantOpen, setWantOpen] = useState51(false);
19675
+ const [wantOpen, setWantOpen] = useState52(false);
19656
19676
  const { profile, isLoading, hasResolved } = useMemberProfile({
19657
19677
  enabled: canShowCard && wantOpen,
19658
19678
  memberId,
@@ -19743,16 +19763,16 @@ function UserMentionElement(props) {
19743
19763
  import { DatePlugin as DatePlugin2 } from "@platejs/date/react";
19744
19764
  import { MentionPlugin } from "@platejs/mention/react";
19745
19765
  import { PlateElement as PlateElement32 } from "platejs/react";
19746
- import { useCallback as useCallback64, useState as useState54 } from "react";
19766
+ import { useCallback as useCallback64, useState as useState55 } from "react";
19747
19767
 
19748
19768
  // src/ui/mention-page-combobox-group.tsx
19749
19769
  import { FileTextIcon as FileTextIcon3 } from "lucide-react";
19750
- import { useEffect as useEffect49, useState as useState52 } from "react";
19770
+ import { useEffect as useEffect49, useState as useState53 } from "react";
19751
19771
  import { jsx as jsx172, jsxs as jsxs110 } from "react/jsx-runtime";
19752
19772
  function PageComboboxGroup({ search, onPageHover, onPageSelect }) {
19753
19773
  const adapter = useEditorAdapter();
19754
19774
  const debouncedSearch = useDebounce(search, 250);
19755
- const [pages, setPages] = useState52([]);
19775
+ const [pages, setPages] = useState53([]);
19756
19776
  useEffect49(() => {
19757
19777
  if (!adapter.permissions.canLinkPage) {
19758
19778
  setPages([]);
@@ -19802,12 +19822,12 @@ function PageStatusBadge({ status }) {
19802
19822
  }
19803
19823
 
19804
19824
  // src/ui/mention-people-combobox-group.tsx
19805
- import { useEffect as useEffect50, useState as useState53 } from "react";
19825
+ import { useEffect as useEffect50, useState as useState54 } from "react";
19806
19826
  import { jsx as jsx173, jsxs as jsxs111 } from "react/jsx-runtime";
19807
19827
  function PeopleComboboxGroup({ search, onUserHover, onUserSelect }) {
19808
19828
  const adapter = useEditorAdapter();
19809
19829
  const debouncedSearch = useDebounce(search, 150);
19810
- const [members, setMembers] = useState53([]);
19830
+ const [members, setMembers] = useState54([]);
19811
19831
  useEffect50(() => {
19812
19832
  if (!adapter.permissions.canMention) {
19813
19833
  setMembers([]);
@@ -19861,8 +19881,8 @@ var DEFAULT_PLACEHOLDER = "Mention a person, page, or date";
19861
19881
  var TODAY_PLACEHOLDER = "Today";
19862
19882
  function MentionInputElement(props) {
19863
19883
  const { children, editor, element } = props;
19864
- const [search, setSearch] = useState54("");
19865
- const [placeholder, setPlaceholder] = useState54(DEFAULT_PLACEHOLDER);
19884
+ const [search, setSearch] = useState55("");
19885
+ const [placeholder, setPlaceholder] = useState55(DEFAULT_PLACEHOLDER);
19866
19886
  const handleDateFocus = useCallback64(() => {
19867
19887
  setPlaceholder(TODAY_PLACEHOLDER);
19868
19888
  }, []);
@@ -21308,7 +21328,7 @@ function StepElement(props) {
21308
21328
  /* @__PURE__ */ jsxs117("div", { className: "flex-1 pt-0.5", children: [
21309
21329
  /* @__PURE__ */ jsxs117("div", { className: "flex items-center gap-2", contentEditable: false, children: [
21310
21330
  isEditingTitle ? /* @__PURE__ */ jsx179(
21311
- "input",
21331
+ UnstyledInput,
21312
21332
  {
21313
21333
  ref: titleInputRef,
21314
21334
  className: cn(titleClass, "min-w-30 bg-transparent outline-none"),
@@ -22279,7 +22299,7 @@ var TabTrigger2 = React73.forwardRef(
22279
22299
  onKeyDown: handleTabKeyDown,
22280
22300
  children: [
22281
22301
  isEditing ? /* @__PURE__ */ jsx182(
22282
- "input",
22302
+ UnstyledInput,
22283
22303
  {
22284
22304
  ref: inputRef,
22285
22305
  className: cn(
@@ -22521,7 +22541,7 @@ function TileElement(props) {
22521
22541
  ),
22522
22542
  children: [
22523
22543
  /* @__PURE__ */ jsx184("div", { className: "flex items-start justify-between gap-2", contentEditable: false, children: /* @__PURE__ */ jsx184("div", { className: "flex-1", children: isEditingTitle ? /* @__PURE__ */ jsx184(
22524
- "input",
22544
+ UnstyledInput,
22525
22545
  {
22526
22546
  ref: titleInputRef,
22527
22547
  className: "w-full bg-transparent font-semibold text-foreground outline-none",
@@ -22922,7 +22942,7 @@ function DefaultToggleView({
22922
22942
  children: [
22923
22943
  /* @__PURE__ */ jsx187(ToggleChevron, { open }),
22924
22944
  isEditing ? /* @__PURE__ */ jsx187(
22925
- "input",
22945
+ UnstyledInput,
22926
22946
  {
22927
22947
  ref: inputRef,
22928
22948
  className: "min-w-30 bg-transparent font-semibold text-foreground outline-none",
@@ -24988,7 +25008,7 @@ function UpdateElement(props) {
24988
25008
  return /* @__PURE__ */ jsx203(PlateElement45, __spreadProps(__spreadValues({}, props), { className: "group/update relative", children: /* @__PURE__ */ jsxs137("div", { id: anchorId, className: "grid grid-cols-[140px_1fr] items-start gap-8 py-8", "data-plate-open-context-menu": true, children: [
24989
25009
  /* @__PURE__ */ jsx203("div", { className: "sticky top-24", contentEditable: false, children: /* @__PURE__ */ jsxs137("div", { className: "flex flex-col items-start gap-2", children: [
24990
25010
  isEditingLabel ? /* @__PURE__ */ jsx203(
24991
- "input",
25011
+ UnstyledInput,
24992
25012
  {
24993
25013
  ref: labelInputRef,
24994
25014
  className: "border-primary border-b bg-transparent text-sm font-medium text-primary outline-none",