@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.
@@ -4304,6 +4304,16 @@ var backgroundColorItems = [
4304
4304
 
4305
4305
  // src/ui/input.tsx
4306
4306
  import { cva as cva10 } from "class-variance-authority";
4307
+
4308
+ // src/context/text-field-attributes.ts
4309
+ import { createContext as createContext4, useContext as useContext4, useState as useState6 } from "react";
4310
+ var EMPTY_ATTRIBUTES = Object.freeze({});
4311
+ var TextFieldAttributesContext = createContext4(EMPTY_ATTRIBUTES);
4312
+ function useTextFieldAttributes() {
4313
+ return useContext4(TextFieldAttributesContext);
4314
+ }
4315
+
4316
+ // src/ui/input.tsx
4307
4317
  import { jsx as jsx22 } from "react/jsx-runtime";
4308
4318
  var inputVariants = cva10(
4309
4319
  cn(
@@ -4325,9 +4335,16 @@ var inputVariants = cva10(
4325
4335
  }
4326
4336
  }
4327
4337
  );
4338
+ var TEXT_INPUT_TYPES = /* @__PURE__ */ new Set(["text", "search", "url", "email", "tel", "password"]);
4339
+ function UnstyledInput(_a) {
4340
+ var _b = _a, { type = "text" } = _b, props = __objRest(_b, ["type"]);
4341
+ const attributes = useTextFieldAttributes();
4342
+ const textFieldAttributes = TEXT_INPUT_TYPES.has(type.toLowerCase()) ? attributes : void 0;
4343
+ return /* @__PURE__ */ jsx22("input", __spreadValues(__spreadProps(__spreadValues({}, textFieldAttributes), { type }), props));
4344
+ }
4328
4345
  function Input(_a) {
4329
4346
  var _b = _a, { className, variant } = _b, props = __objRest(_b, ["className", "variant"]);
4330
- return /* @__PURE__ */ jsx22("input", __spreadValues({ className: cn(inputVariants({ variant }), className) }, props));
4347
+ return /* @__PURE__ */ jsx22(UnstyledInput, __spreadValues({ className: cn(inputVariants({ variant }), className) }, props));
4331
4348
  }
4332
4349
 
4333
4350
  // src/ui/menu.tsx
@@ -5560,11 +5577,11 @@ import { PathApi as PathApi5 } from "platejs";
5560
5577
  import { SlateElement as SlateElement2 } from "platejs/static";
5561
5578
 
5562
5579
  // src/context/heading-slug-context.tsx
5563
- import { createContext as createContext5, useContext as useContext5 } from "react";
5580
+ import { createContext as createContext6, useContext as useContext6 } from "react";
5564
5581
  import { jsx as jsx29 } from "react/jsx-runtime";
5565
- var HeadingSlugContext = createContext5(null);
5582
+ var HeadingSlugContext = createContext6(null);
5566
5583
  var useHeadingSlug = () => {
5567
- return useContext5(HeadingSlugContext);
5584
+ return useContext6(HeadingSlugContext);
5568
5585
  };
5569
5586
 
5570
5587
  // src/ui/heading-node-static.tsx
@@ -6197,20 +6214,20 @@ import { SlateElement as SlateElement9 } from "platejs/static";
6197
6214
 
6198
6215
  // src/context/link-resolution-context.tsx
6199
6216
  import {
6200
- createContext as createContext7,
6217
+ createContext as createContext8,
6201
6218
  useCallback as useCallback5,
6202
- useContext as useContext7,
6219
+ useContext as useContext8,
6203
6220
  useEffect as useEffect12,
6204
6221
  useMemo as useMemo8,
6205
6222
  useRef as useRef7,
6206
6223
  useSyncExternalStore as useSyncExternalStore2
6207
6224
  } from "react";
6208
6225
  import { jsx as jsx42 } from "react/jsx-runtime";
6209
- var LinkResolutionContext = createContext7(null);
6226
+ var LinkResolutionContext = createContext8(null);
6210
6227
  var NOOP_UNSUBSCRIBE = () => {
6211
6228
  };
6212
6229
  var usePagePreview = (reference) => {
6213
- const store = useContext7(LinkResolutionContext);
6230
+ const store = useContext8(LinkResolutionContext);
6214
6231
  const key = reference ? linkReferenceKey(reference) : null;
6215
6232
  const subscribe2 = useCallback5(
6216
6233
  (onChange) => {
@@ -6223,12 +6240,12 @@ var usePagePreview = (reference) => {
6223
6240
  return useSyncExternalStore2(subscribe2, getSnapshot, getSnapshot);
6224
6241
  };
6225
6242
  var useHasLinkSeed = (url) => {
6226
- const store = useContext7(LinkResolutionContext);
6243
+ const store = useContext8(LinkResolutionContext);
6227
6244
  if (!store || !url) return false;
6228
6245
  return store.seededUrls.has(url);
6229
6246
  };
6230
6247
  var useLinkMetadata = (url) => {
6231
- const store = useContext7(LinkResolutionContext);
6248
+ const store = useContext8(LinkResolutionContext);
6232
6249
  const subscribe2 = useCallback5(
6233
6250
  (onChange) => {
6234
6251
  if (!store || !url) return NOOP_UNSUBSCRIBE;
@@ -6364,11 +6381,11 @@ var getSmartLinkAnchorProps = (url) => {
6364
6381
 
6365
6382
  // src/ui/smart-link-view.tsx
6366
6383
  import { ArrowUpRightIcon, FileTextIcon, LinkIcon } from "lucide-react";
6367
- import { useCallback as useCallback6, useState as useState10 } from "react";
6384
+ import { useCallback as useCallback6, useState as useState11 } from "react";
6368
6385
  import { jsx as jsx43, jsxs as jsxs20 } from "react/jsx-runtime";
6369
6386
  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";
6370
6387
  function SmartLinkIcon({ icon, faviconUrl, provider, className }) {
6371
- const [failedSrc, setFailedSrc] = useState10(null);
6388
+ const [failedSrc, setFailedSrc] = useState11(null);
6372
6389
  const isPageLike = provider === "Page" || provider === "Internal link";
6373
6390
  const showFavicon = typeof faviconUrl === "string" && faviconUrl.length > 0 && failedSrc !== faviconUrl;
6374
6391
  const handleFaviconError = useCallback6(() => {
@@ -6410,7 +6427,7 @@ function SmartLinkInlineContent({ link, className }) {
6410
6427
  "span",
6411
6428
  {
6412
6429
  className: cn(
6413
- "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",
6430
+ "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",
6414
6431
  className
6415
6432
  ),
6416
6433
  children: [
@@ -6426,7 +6443,7 @@ function SmartLinkUrlContent({ link, className }) {
6426
6443
  "span",
6427
6444
  {
6428
6445
  className: cn(
6429
- "inline max-w-full wrap-break-word border-[#0C66E4]/35 border-b font-medium text-[#0C66E4] leading-[inherit]",
6446
+ "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!",
6430
6447
  className
6431
6448
  ),
6432
6449
  children: [
@@ -6458,7 +6475,7 @@ function SmartLinkCardContent({ link, className }) {
6458
6475
  ),
6459
6476
  /* @__PURE__ */ jsxs20("span", { className: "min-w-0 flex-1", children: [
6460
6477
  /* @__PURE__ */ jsxs20("span", { className: "flex min-w-0 items-start gap-3", children: [
6461
- /* @__PURE__ */ jsx43("span", { className: "min-w-0 flex-1 truncate font-semibold text-[#0C66E4] text-base leading-6", children: link.title }),
6478
+ /* @__PURE__ */ jsx43("span", { className: "min-w-0 flex-1 truncate font-semibold text-editor-link text-base leading-6", children: link.title }),
6462
6479
  link.status ? /* @__PURE__ */ jsx43(SmartLinkStatus, { status: link.status }) : null
6463
6480
  ] }),
6464
6481
  /* @__PURE__ */ jsxs20("span", { className: "mt-2 flex min-w-0 items-center gap-2 text-muted-foreground text-sm", children: [
@@ -6476,7 +6493,7 @@ function SmartLinkCardContent({ link, className }) {
6476
6493
  {
6477
6494
  faviconUrl: link.faviconUrl,
6478
6495
  provider: link.provider,
6479
- className: "size-5 rounded bg-[#0C66E4] p-1 text-white"
6496
+ className: "size-5 rounded bg-editor-link p-1 text-white dark-or-inherit:text-primary-foreground"
6480
6497
  }
6481
6498
  ),
6482
6499
  /* @__PURE__ */ jsx43("span", { className: "truncate", children: (_a = link.provider) != null ? _a : "Link" })
@@ -6491,7 +6508,7 @@ function SmartLinkCardContent({ link, className }) {
6491
6508
  );
6492
6509
  }
6493
6510
  function SmartLinkCardImage({ src }) {
6494
- const [hasFailed, setHasFailed] = useState10(false);
6511
+ const [hasFailed, setHasFailed] = useState11(false);
6495
6512
  const handleError = useCallback6(() => {
6496
6513
  setHasFailed(true);
6497
6514
  }, []);
@@ -7039,6 +7056,7 @@ import { SlateElement as SlateElement13 } from "platejs/static";
7039
7056
  // src/ui/media-file-display.ts
7040
7057
  var FILE_DISPLAY_MODES = ["inline", "url", "embed"];
7041
7058
  var DEFAULT_FILE_DISPLAY_MODE = "inline";
7059
+ 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!";
7042
7060
  var normalizeFileDisplayMode = (value) => {
7043
7061
  return value === "url" || value === "embed" || value === "inline" ? value : DEFAULT_FILE_DISPLAY_MODE;
7044
7062
  };
@@ -7075,20 +7093,10 @@ function MediaFileStaticBody({ canEmbed, displayMode, name, url }) {
7075
7093
  );
7076
7094
  }
7077
7095
  if (displayMode === "url") {
7078
- return /* @__PURE__ */ jsxs26(
7079
- "a",
7080
- {
7081
- className: "inline-flex max-w-full items-center gap-1 break-all border-[#0C66E4]/35 border-b font-medium text-[#0C66E4]",
7082
- contentEditable: false,
7083
- href: url,
7084
- rel: "noopener noreferrer",
7085
- target: "_blank",
7086
- children: [
7087
- /* @__PURE__ */ jsx50(Link, { className: "size-4 shrink-0 text-muted-foreground" }),
7088
- /* @__PURE__ */ jsx50("span", { className: "truncate", children: url })
7089
- ]
7090
- }
7091
- );
7096
+ return /* @__PURE__ */ jsxs26("a", { className: FILE_URL_CLASS_NAME, contentEditable: false, href: url, rel: "noopener noreferrer", target: "_blank", children: [
7097
+ /* @__PURE__ */ jsx50(Link, { className: "size-4 shrink-0 text-muted-foreground" }),
7098
+ /* @__PURE__ */ jsx50("span", { className: "truncate", children: url })
7099
+ ] });
7092
7100
  }
7093
7101
  return /* @__PURE__ */ jsx50(
7094
7102
  "a",
@@ -7128,7 +7136,7 @@ function MediaFileElementStatic(props) {
7128
7136
  // src/ui/media-image-node-static.tsx
7129
7137
  import { NodeApi as NodeApi6 } from "platejs";
7130
7138
  import { SlateElement as SlateElement14 } from "platejs/static";
7131
- import { useCallback as useCallback8, useRef as useRef8, useState as useState11 } from "react";
7139
+ import { useCallback as useCallback8, useRef as useRef8, useState as useState12 } from "react";
7132
7140
 
7133
7141
  // src/ui/media-image-lightbox.tsx
7134
7142
  import { AnimatePresence as AnimatePresence2, motion as motion2 } from "framer-motion";
@@ -7250,8 +7258,8 @@ function ImageLightbox({ alt, isOpen, onClose, sourceRect, src }) {
7250
7258
  import { jsx as jsx52, jsxs as jsxs28 } from "react/jsx-runtime";
7251
7259
  function ImageElementStatic(props) {
7252
7260
  const { align = "center", caption, hint, hintIcon, url } = props.element;
7253
- const [lightboxOpen, setLightboxOpen] = useState11(false);
7254
- const [sourceRect, setSourceRect] = useState11(null);
7261
+ const [lightboxOpen, setLightboxOpen] = useState12(false);
7262
+ const [sourceRect, setSourceRect] = useState12(null);
7255
7263
  const imgRef = useRef8(null);
7256
7264
  const handleOpen = useCallback8(() => {
7257
7265
  if (imgRef.current) {
@@ -7350,7 +7358,7 @@ import { BaseMentionPlugin } from "@platejs/mention";
7350
7358
  // src/ui/mention-node-static.tsx
7351
7359
  import { IS_APPLE } from "platejs";
7352
7360
  import { SlateElement as SlateElement16 } from "platejs/static";
7353
- import { useCallback as useCallback9, useState as useState14 } from "react";
7361
+ import { useCallback as useCallback9, useState as useState15 } from "react";
7354
7362
 
7355
7363
  // src/ui/member-profile-card.tsx
7356
7364
  import { ArrowUpRight, Mail, MapPin, Users } from "lucide-react";
@@ -7454,9 +7462,9 @@ function MemberProfileCard({ profile, fallbackName, isLoading }) {
7454
7462
  }
7455
7463
 
7456
7464
  // src/ui/mention-document-link.ts
7457
- import { useEffect as useEffect14, useState as useState12 } from "react";
7465
+ import { useEffect as useEffect14, useState as useState13 } from "react";
7458
7466
  var useDocumentPagePreview = ({ enabled, reference, resolvePage }) => {
7459
- const [page, setPage] = useState12(null);
7467
+ const [page, setPage] = useState13(null);
7460
7468
  const referenceKey = enabled && reference ? linkReferenceKey(reference) : null;
7461
7469
  useEffect14(() => {
7462
7470
  const nextReference = referenceKey ? linkReferenceFromKey(referenceKey) : null;
@@ -7496,10 +7504,10 @@ var getDocumentMentionLink = (element, page, displayMode) => {
7496
7504
  };
7497
7505
 
7498
7506
  // src/ui/use-member-profile.ts
7499
- import { useEffect as useEffect15, useState as useState13 } from "react";
7507
+ import { useEffect as useEffect15, useState as useState14 } from "react";
7500
7508
  var IDLE_STATE = { profile: null, isLoading: false, hasResolved: false };
7501
7509
  var useMemberProfile = ({ enabled, memberId, resolveMember }) => {
7502
- const [state, setState] = useState13(IDLE_STATE);
7510
+ const [state, setState] = useState14(IDLE_STATE);
7503
7511
  useEffect15(() => {
7504
7512
  if (!enabled || !resolveMember || memberId.length === 0) {
7505
7513
  setState(IDLE_STATE);
@@ -7568,7 +7576,7 @@ function UserMentionElementStatic(_a) {
7568
7576
  const resolveMember = adapter.mentions.resolveMember;
7569
7577
  const memberId = (_a2 = element.key) != null ? _a2 : "";
7570
7578
  const canShowCard = typeof resolveMember === "function" && memberId.length > 0;
7571
- const [wantOpen, setWantOpen] = useState14(false);
7579
+ const [wantOpen, setWantOpen] = useState15(false);
7572
7580
  const { profile, isLoading, hasResolved } = useMemberProfile({
7573
7581
  enabled: canShowCard && wantOpen,
7574
7582
  memberId,
@@ -8272,6 +8280,7 @@ function CommandInput(_a) {
8272
8280
  "variant",
8273
8281
  "wrapClassName"
8274
8282
  ]);
8283
+ const attributes = useTextFieldAttributes();
8275
8284
  return /* @__PURE__ */ jsx65(
8276
8285
  "div",
8277
8286
  {
@@ -8280,10 +8289,10 @@ function CommandInput(_a) {
8280
8289
  "data-slot": "command-input-wrapper",
8281
8290
  children: /* @__PURE__ */ jsx65(
8282
8291
  CommandPrimitive.Input,
8283
- __spreadValues({
8292
+ __spreadValues(__spreadProps(__spreadValues({}, attributes), {
8284
8293
  className: cn(inputVariants({ variant }), className),
8285
8294
  "data-slot": "command-input"
8286
- }, props)
8295
+ }), props)
8287
8296
  )
8288
8297
  }
8289
8298
  );
@@ -8664,7 +8673,7 @@ function TabTrigger({
8664
8673
  onKeyDown: handleTabKeyDown,
8665
8674
  children: [
8666
8675
  isEditing ? /* @__PURE__ */ jsx68(
8667
- "input",
8676
+ UnstyledInput,
8668
8677
  {
8669
8678
  ref: inputRef,
8670
8679
  className: cn(
@@ -9733,11 +9742,19 @@ var textareaVariants = cva19(
9733
9742
  );
9734
9743
  function Textarea(_a) {
9735
9744
  var _b = _a, { className, variant } = _b, props = __objRest(_b, ["className", "variant"]);
9736
- return /* @__PURE__ */ jsx81("textarea", __spreadValues({ className: cn(textareaVariants({ variant }), className) }, props));
9745
+ const attributes = useTextFieldAttributes();
9746
+ return /* @__PURE__ */ jsx81("textarea", __spreadValues(__spreadProps(__spreadValues({}, attributes), { className: cn(textareaVariants({ variant }), className) }), props));
9737
9747
  }
9738
9748
  function TextareaAutosize(_a) {
9739
9749
  var _b = _a, { children, className, variant } = _b, props = __objRest(_b, ["children", "className", "variant"]);
9740
- return /* @__PURE__ */ jsx81(ReactTextareaAutosize, __spreadValues({ autoComplete: "off", className: cn(textareaVariants({ variant }), className) }, props));
9750
+ const attributes = useTextFieldAttributes();
9751
+ return /* @__PURE__ */ jsx81(
9752
+ ReactTextareaAutosize,
9753
+ __spreadValues(__spreadProps(__spreadValues({}, attributes), {
9754
+ autoComplete: "off",
9755
+ className: cn(textareaVariants({ variant }), className)
9756
+ }), props)
9757
+ );
9741
9758
  }
9742
9759
 
9743
9760
  // src/ui/ai-menu.tsx
@@ -12788,15 +12805,14 @@ function EmojiPickerSearchBar({
12788
12805
  }) {
12789
12806
  return /* @__PURE__ */ jsx106("div", { className: "flex items-center px-2", children: /* @__PURE__ */ jsxs62("div", { className: "relative flex grow items-center", children: [
12790
12807
  /* @__PURE__ */ jsx106(
12791
- "input",
12808
+ UnstyledInput,
12792
12809
  {
12793
12810
  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",
12794
12811
  value: searchValue,
12795
12812
  onChange: (event) => setSearch(event.target.value),
12796
12813
  placeholder: i18n.search,
12797
12814
  "aria-label": "Search",
12798
- autoComplete: "off",
12799
- type: "text"
12815
+ autoComplete: "off"
12800
12816
  }
12801
12817
  ),
12802
12818
  children
@@ -13338,7 +13354,7 @@ function CardTitleRow({
13338
13354
  }) {
13339
13355
  if (isEditing) {
13340
13356
  return /* @__PURE__ */ jsx111(
13341
- "input",
13357
+ UnstyledInput,
13342
13358
  {
13343
13359
  ref: inputRef,
13344
13360
  className: "min-w-30 bg-transparent font-semibold text-foreground outline-none",
@@ -15444,6 +15460,7 @@ function InlineComboboxInput(_a) {
15444
15460
  Ariakit2.Combobox,
15445
15461
  __spreadValues(__spreadValues({
15446
15462
  autoSelect: true,
15463
+ render: /* @__PURE__ */ jsx128(UnstyledInput, {}),
15447
15464
  className: cn("absolute top-0 left-0 size-full bg-transparent outline-hidden", className),
15448
15465
  ref,
15449
15466
  value
@@ -15657,7 +15674,7 @@ import { useLink } from "@platejs/link/react";
15657
15674
  import { SuggestionPlugin as SuggestionPlugin3 } from "@platejs/suggestion/react";
15658
15675
  import { NodeApi as NodeApi14 } from "platejs";
15659
15676
  import { PlateElement as PlateElement20, useEditorPlugin as useEditorPlugin9, useElement as useElement11, useReadOnly as useReadOnly13 } from "platejs/react";
15660
- import { useCallback as useCallback42, useMemo as useMemo16, useState as useState40 } from "react";
15677
+ import { useCallback as useCallback42, useMemo as useMemo16, useState as useState41 } from "react";
15661
15678
 
15662
15679
  // src/ui/smart-link-clipboard.ts
15663
15680
  var copySmartLinkUrl = async (url) => {
@@ -15695,10 +15712,10 @@ import { ArrowUpRightIcon as ArrowUpRightIcon3, PencilIcon as PencilIcon6, Trash
15695
15712
 
15696
15713
  // src/ui/smart-link-copy-button.tsx
15697
15714
  import { CheckIcon as CheckIcon15, CopyIcon as CopyIcon2, XIcon as XIcon7 } from "lucide-react";
15698
- import { useCallback as useCallback40, useEffect as useEffect38, useState as useState39 } from "react";
15715
+ import { useCallback as useCallback40, useEffect as useEffect38, useState as useState40 } from "react";
15699
15716
  import { jsx as jsx130 } from "react/jsx-runtime";
15700
15717
  function SmartLinkCopyButton({ disabled, onCopy }) {
15701
- const [feedback, setFeedback] = useState39("idle");
15718
+ const [feedback, setFeedback] = useState40("idle");
15702
15719
  useEffect38(() => {
15703
15720
  if (feedback === "idle") return;
15704
15721
  const timeoutId = window.setTimeout(() => {
@@ -15866,8 +15883,8 @@ function LinkElement(_a) {
15866
15883
  const { api, editor, setOption } = useEditorPlugin9(linkPlugin);
15867
15884
  const adapter = useEditorAdapter();
15868
15885
  const readOnly = useReadOnly13();
15869
- const [isToolbarOpen, setIsToolbarOpen] = useState40(false);
15870
- const [isModeMenuOpen, setIsModeMenuOpen] = useState40(false);
15886
+ const [isToolbarOpen, setIsToolbarOpen] = useState41(false);
15887
+ const [isModeMenuOpen, setIsModeMenuOpen] = useState41(false);
15871
15888
  const displayMode = normalizeSmartLinkDisplayMode(element.displayMode);
15872
15889
  const open = !readOnly && (isToolbarOpen || isModeMenuOpen);
15873
15890
  const reference = useMemo16(() => readElementReference(element), [element]);
@@ -16044,12 +16061,12 @@ var PlainLinkElement = (props) => /* @__PURE__ */ jsx133(LinkElement, __spreadPr
16044
16061
 
16045
16062
  // src/ui/link-toolbar.tsx
16046
16063
  import { useEditorPlugin as useEditorPlugin12, useEditorSelector as useEditorSelector2, usePluginOption as usePluginOption17 } from "platejs/react";
16047
- import { useCallback as useCallback45, useEffect as useEffect41, useState as useState43 } from "react";
16064
+ import { useCallback as useCallback45, useEffect as useEffect41, useState as useState44 } from "react";
16048
16065
 
16049
16066
  // src/ui/link-search-panel.tsx
16050
16067
  import { BookmarkIcon, LinkIcon as LinkIcon4 } from "lucide-react";
16051
16068
  import { useEditorPlugin as useEditorPlugin10 } from "platejs/react";
16052
- import { useCallback as useCallback43, useEffect as useEffect39, useState as useState41 } from "react";
16069
+ import { useCallback as useCallback43, useEffect as useEffect39, useState as useState42 } from "react";
16053
16070
 
16054
16071
  // src/ui/link-toolbar-shared.ts
16055
16072
  import { unwrapLink as unwrapLink2, upsertLink } from "@platejs/link";
@@ -16192,10 +16209,10 @@ function LinkSearchPanel({ initialUrl }) {
16192
16209
  const adapter = useEditorAdapter();
16193
16210
  const { editor } = useEditorPlugin10(linkPlugin);
16194
16211
  const canLinkPage = adapter.permissions.canLinkPage;
16195
- const [query, setQuery] = useState41(initialUrl);
16196
- const [displayText, setDisplayText] = useState41(() => readSelectionText(editor));
16197
- const [pages, setPages] = useState41([]);
16198
- const [isLoading, setIsLoading] = useState41(true);
16212
+ const [query, setQuery] = useState42(initialUrl);
16213
+ const [displayText, setDisplayText] = useState42(() => readSelectionText(editor));
16214
+ const [pages, setPages] = useState42([]);
16215
+ const [isLoading, setIsLoading] = useState42(true);
16199
16216
  const trimmedQuery = query.trim();
16200
16217
  const safeUrl = trimmedQuery.length > 0 ? getSafeSmartLinkUrl(trimmedQuery) : null;
16201
16218
  const searchTerm = isLikelySmartLinkUrl(query) ? "" : trimmedQuery;
@@ -16339,11 +16356,11 @@ import { CursorOverlayPlugin as CursorOverlayPlugin2 } from "@platejs/selection/
16339
16356
  import { LinkIcon as LinkIcon5, Trash2Icon as Trash2Icon4 } from "lucide-react";
16340
16357
  import { NodeApi as NodeApi16 } from "platejs";
16341
16358
  import { useEditorPlugin as useEditorPlugin11, usePluginOption as usePluginOption16 } from "platejs/react";
16342
- import { useCallback as useCallback44, useEffect as useEffect40, useState as useState42 } from "react";
16359
+ import { useCallback as useCallback44, useEffect as useEffect40, useState as useState43 } from "react";
16343
16360
  import { jsx as jsx135, jsxs as jsxs85 } from "react/jsx-runtime";
16344
16361
  function EditLinkCommand({ autoFocus, initialUrl, setInitialUrl }) {
16345
- const [url, setUrl] = useState42(initialUrl);
16346
- const [text, setText] = useState42("");
16362
+ const [url, setUrl] = useState43(initialUrl);
16363
+ const [text, setText] = useState43("");
16347
16364
  const mode = usePluginOption16(linkPlugin, "mode");
16348
16365
  const { editor, setOption } = useEditorPlugin11(linkPlugin);
16349
16366
  const activeLinkId = usePluginOption16(linkPlugin, "activeId");
@@ -16470,7 +16487,7 @@ function LinkFloatingToolbar() {
16470
16487
  })) == null ? void 0 : _a2[0];
16471
16488
  }, []);
16472
16489
  const aboveUrl = (_a = aboveLink == null ? void 0 : aboveLink.url) != null ? _a : "";
16473
- const [initialUrl, setInitialUrl] = useState43(aboveUrl);
16490
+ const [initialUrl, setInitialUrl] = useState44(aboveUrl);
16474
16491
  const open = mode === "insert" || mode === "edit" || mode === "cursor";
16475
16492
  useEffect41(() => {
16476
16493
  setInitialUrl(aboveUrl);
@@ -17304,9 +17321,8 @@ function IconSettingsForm({
17304
17321
  }
17305
17322
  ),
17306
17323
  /* @__PURE__ */ jsx151(
17307
- "input",
17324
+ UnstyledInput,
17308
17325
  {
17309
- type: "text",
17310
17326
  value: colorValue,
17311
17327
  onChange: handleColorChange,
17312
17328
  placeholder: "Default",
@@ -17770,9 +17786,10 @@ function Caption(_a) {
17770
17786
  return /* @__PURE__ */ jsx155(CaptionPrimitive, __spreadProps(__spreadValues({}, props), { className: cn(captionVariants({ align }), "px-3 pb-2", className) }));
17771
17787
  }
17772
17788
  function CaptionTextarea(props) {
17789
+ const attributes = useTextFieldAttributes();
17773
17790
  return /* @__PURE__ */ jsx155(
17774
17791
  CaptionTextareaPrimitive,
17775
- __spreadProps(__spreadValues({}, props), {
17792
+ __spreadProps(__spreadValues(__spreadValues({}, attributes), props), {
17776
17793
  className: cn(
17777
17794
  "mt-2 w-full resize-none border-none bg-inherit p-0 font-[inherit] text-inherit",
17778
17795
  "focus:outline-none focus:placeholder:opacity-0",
@@ -18310,7 +18327,7 @@ import { useMediaState as useMediaState3 } from "@platejs/media/react";
18310
18327
  import { ResizableProvider as ResizableProvider4 } from "@platejs/resizable";
18311
18328
  import { ArrowUpRightIcon as ArrowUpRightIcon4, FileUpIcon, LinkIcon as LinkIcon7 } from "lucide-react";
18312
18329
  import { PlateElement as PlateElement26, useEditorRef as useEditorRef38, useElement as useElement18, withHOC as withHOC4 } from "platejs/react";
18313
- import { useCallback as useCallback59, useState as useState48 } from "react";
18330
+ import { useCallback as useCallback59, useState as useState49 } from "react";
18314
18331
 
18315
18332
  // src/ui/media-file-mode-dropdown.tsx
18316
18333
  import { ChevronDownIcon as ChevronDownIcon9, FileIcon, FrameIcon, LinkIcon as LinkIcon6 } from "lucide-react";
@@ -18399,7 +18416,10 @@ function MediaFileBody({ canEmbed, displayMode, name, onAnchorClick, url }) {
18399
18416
  return /* @__PURE__ */ jsxs103(
18400
18417
  "a",
18401
18418
  {
18402
- 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]",
18419
+ className: cn(
18420
+ FILE_URL_CLASS_NAME,
18421
+ "cursor-pointer transition-colors hover:border-editor-link dark-or-inherit:hover:border-editor-link!"
18422
+ ),
18403
18423
  contentEditable: false,
18404
18424
  href: url,
18405
18425
  onClick: onAnchorClick,
@@ -18437,7 +18457,7 @@ var MediaFileElement = withHOC4(ResizableProvider4, function MediaFileElement2(p
18437
18457
  const fileName = name != null ? name : "";
18438
18458
  const fileUrl = unsafeUrl != null ? unsafeUrl : "";
18439
18459
  const canEmbed = isEmbeddableFile(fileName, fileUrl);
18440
- const [isModeMenuOpen, setIsModeMenuOpen] = useState48(false);
18460
+ const [isModeMenuOpen, setIsModeMenuOpen] = useState49(false);
18441
18461
  const open = !readOnly && (selected || isModeMenuOpen);
18442
18462
  const handleOpen = useCallback59(() => {
18443
18463
  if (fileUrl.length === 0) return;
@@ -18684,7 +18704,7 @@ import {
18684
18704
  import { AudioLinesIcon, FileUpIcon as FileUpIcon2, FilmIcon, ImageIcon as ImageIcon2 } from "lucide-react";
18685
18705
  import { KEYS as KEYS29, nanoid as nanoid10 } from "platejs";
18686
18706
  import { PlateElement as PlateElement28, useEditorPlugin as useEditorPlugin17, withHOC as withHOC6 } from "platejs/react";
18687
- import { useCallback as useCallback60, useEffect as useEffect47, useRef as useRef16, useState as useState49 } from "react";
18707
+ import { useCallback as useCallback60, useEffect as useEffect47, useRef as useRef16, useState as useState50 } from "react";
18688
18708
  import { useFilePicker } from "use-file-picker";
18689
18709
 
18690
18710
  // src/hooks/use-upload-file.ts
@@ -18926,7 +18946,7 @@ function MediaPlaceholderPopover({ children }) {
18926
18946
  var _a, _b, _c;
18927
18947
  const { api, editor, getOption, tf } = useEditorPlugin17(PlaceholderPlugin3);
18928
18948
  const { id, element, mediaType, readOnly, selected, setIsUploading, setProgresses, setUpdatedFiles, size } = usePlaceholderPopoverState();
18929
- const [open, setOpen] = useState49(false);
18949
+ const [open, setOpen] = useState50(false);
18930
18950
  const currentMedia = MEDIA_CONFIG[mediaType];
18931
18951
  const uploadConfig = useUploadConfig();
18932
18952
  const adapter = useEditorAdapter();
@@ -18986,7 +19006,7 @@ function MediaPlaceholderPopover({ children }) {
18986
19006
  { at: path }
18987
19007
  );
18988
19008
  }, [uploadedFile, element.id, size]);
18989
- const [embedValue, setEmbedValue] = useState49("");
19009
+ const [embedValue, setEmbedValue] = useState50("");
18990
19010
  const onEmbed = useCallback60(
18991
19011
  (value) => {
18992
19012
  const path = editor.api.findPath(element);
@@ -19042,7 +19062,7 @@ function ImageProgress({
19042
19062
  imageRef,
19043
19063
  progress = 0
19044
19064
  }) {
19045
- const [objectUrl, setObjectUrl] = useState49(null);
19065
+ const [objectUrl, setObjectUrl] = useState50(null);
19046
19066
  useEffect47(() => {
19047
19067
  const url = URL.createObjectURL(file);
19048
19068
  setObjectUrl(url);
@@ -19430,7 +19450,7 @@ import { KEYS as KEYS31 } from "platejs";
19430
19450
  // src/ui/mention-element.tsx
19431
19451
  import { IS_APPLE as IS_APPLE2 } from "platejs";
19432
19452
  import { PlateElement as PlateElement31, useFocused as useFocused5, useHotkeys as useHotkeys4, useReadOnly as useReadOnly20, useSelected as useSelected7 } from "platejs/react";
19433
- import { useCallback as useCallback63, useState as useState51 } from "react";
19453
+ import { useCallback as useCallback63, useState as useState52 } from "react";
19434
19454
  import { useMounted as useMounted2 } from "react-tweet";
19435
19455
 
19436
19456
  // src/ui/mention-document-element.tsx
@@ -19442,7 +19462,7 @@ import {
19442
19462
  useReadOnly as useReadOnly19,
19443
19463
  useSelected as useSelected6
19444
19464
  } from "platejs/react";
19445
- import { useCallback as useCallback62, useMemo as useMemo18, useState as useState50 } from "react";
19465
+ import { useCallback as useCallback62, useMemo as useMemo18, useState as useState51 } from "react";
19446
19466
 
19447
19467
  // src/ui/mention-document-hover-card.tsx
19448
19468
  import { useCallback as useCallback61 } from "react";
@@ -19494,8 +19514,8 @@ function DocumentMentionElement(props) {
19494
19514
  const focused = useFocused4();
19495
19515
  const editor = useEditorRef41();
19496
19516
  const readOnly = useReadOnly19();
19497
- const [isToolbarOpen, setIsToolbarOpen] = useState50(false);
19498
- const [isModeMenuOpen, setIsModeMenuOpen] = useState50(false);
19517
+ const [isToolbarOpen, setIsToolbarOpen] = useState51(false);
19518
+ const [isModeMenuOpen, setIsModeMenuOpen] = useState51(false);
19499
19519
  const adapter = useEditorAdapter();
19500
19520
  const canLinkPage = adapter.permissions.canLinkPage;
19501
19521
  const resolvePage = adapter.pageLinks.resolvePage;
@@ -19648,7 +19668,7 @@ function UserMentionElement(props) {
19648
19668
  const resolveMember = adapter.mentions.resolveMember;
19649
19669
  const memberId = (_a = element.key) != null ? _a : "";
19650
19670
  const canShowCard = typeof resolveMember === "function" && memberId.length > 0;
19651
- const [wantOpen, setWantOpen] = useState51(false);
19671
+ const [wantOpen, setWantOpen] = useState52(false);
19652
19672
  const { profile, isLoading, hasResolved } = useMemberProfile({
19653
19673
  enabled: canShowCard && wantOpen,
19654
19674
  memberId,
@@ -19739,16 +19759,16 @@ function UserMentionElement(props) {
19739
19759
  import { DatePlugin as DatePlugin2 } from "@platejs/date/react";
19740
19760
  import { MentionPlugin } from "@platejs/mention/react";
19741
19761
  import { PlateElement as PlateElement32 } from "platejs/react";
19742
- import { useCallback as useCallback64, useState as useState54 } from "react";
19762
+ import { useCallback as useCallback64, useState as useState55 } from "react";
19743
19763
 
19744
19764
  // src/ui/mention-page-combobox-group.tsx
19745
19765
  import { FileTextIcon as FileTextIcon3 } from "lucide-react";
19746
- import { useEffect as useEffect49, useState as useState52 } from "react";
19766
+ import { useEffect as useEffect49, useState as useState53 } from "react";
19747
19767
  import { jsx as jsx172, jsxs as jsxs110 } from "react/jsx-runtime";
19748
19768
  function PageComboboxGroup({ search, onPageHover, onPageSelect }) {
19749
19769
  const adapter = useEditorAdapter();
19750
19770
  const debouncedSearch = useDebounce(search, 250);
19751
- const [pages, setPages] = useState52([]);
19771
+ const [pages, setPages] = useState53([]);
19752
19772
  useEffect49(() => {
19753
19773
  if (!adapter.permissions.canLinkPage) {
19754
19774
  setPages([]);
@@ -19798,12 +19818,12 @@ function PageStatusBadge({ status }) {
19798
19818
  }
19799
19819
 
19800
19820
  // src/ui/mention-people-combobox-group.tsx
19801
- import { useEffect as useEffect50, useState as useState53 } from "react";
19821
+ import { useEffect as useEffect50, useState as useState54 } from "react";
19802
19822
  import { jsx as jsx173, jsxs as jsxs111 } from "react/jsx-runtime";
19803
19823
  function PeopleComboboxGroup({ search, onUserHover, onUserSelect }) {
19804
19824
  const adapter = useEditorAdapter();
19805
19825
  const debouncedSearch = useDebounce(search, 150);
19806
- const [members, setMembers] = useState53([]);
19826
+ const [members, setMembers] = useState54([]);
19807
19827
  useEffect50(() => {
19808
19828
  if (!adapter.permissions.canMention) {
19809
19829
  setMembers([]);
@@ -19857,8 +19877,8 @@ var DEFAULT_PLACEHOLDER = "Mention a person, page, or date";
19857
19877
  var TODAY_PLACEHOLDER = "Today";
19858
19878
  function MentionInputElement(props) {
19859
19879
  const { children, editor, element } = props;
19860
- const [search, setSearch] = useState54("");
19861
- const [placeholder, setPlaceholder] = useState54(DEFAULT_PLACEHOLDER);
19880
+ const [search, setSearch] = useState55("");
19881
+ const [placeholder, setPlaceholder] = useState55(DEFAULT_PLACEHOLDER);
19862
19882
  const handleDateFocus = useCallback64(() => {
19863
19883
  setPlaceholder(TODAY_PLACEHOLDER);
19864
19884
  }, []);
@@ -21304,7 +21324,7 @@ function StepElement(props) {
21304
21324
  /* @__PURE__ */ jsxs117("div", { className: "flex-1 pt-0.5", children: [
21305
21325
  /* @__PURE__ */ jsxs117("div", { className: "flex items-center gap-2", contentEditable: false, children: [
21306
21326
  isEditingTitle ? /* @__PURE__ */ jsx179(
21307
- "input",
21327
+ UnstyledInput,
21308
21328
  {
21309
21329
  ref: titleInputRef,
21310
21330
  className: cn(titleClass, "min-w-30 bg-transparent outline-none"),
@@ -22275,7 +22295,7 @@ var TabTrigger2 = React73.forwardRef(
22275
22295
  onKeyDown: handleTabKeyDown,
22276
22296
  children: [
22277
22297
  isEditing ? /* @__PURE__ */ jsx182(
22278
- "input",
22298
+ UnstyledInput,
22279
22299
  {
22280
22300
  ref: inputRef,
22281
22301
  className: cn(
@@ -22517,7 +22537,7 @@ function TileElement(props) {
22517
22537
  ),
22518
22538
  children: [
22519
22539
  /* @__PURE__ */ jsx184("div", { className: "flex items-start justify-between gap-2", contentEditable: false, children: /* @__PURE__ */ jsx184("div", { className: "flex-1", children: isEditingTitle ? /* @__PURE__ */ jsx184(
22520
- "input",
22540
+ UnstyledInput,
22521
22541
  {
22522
22542
  ref: titleInputRef,
22523
22543
  className: "w-full bg-transparent font-semibold text-foreground outline-none",
@@ -22918,7 +22938,7 @@ function DefaultToggleView({
22918
22938
  children: [
22919
22939
  /* @__PURE__ */ jsx187(ToggleChevron, { open }),
22920
22940
  isEditing ? /* @__PURE__ */ jsx187(
22921
- "input",
22941
+ UnstyledInput,
22922
22942
  {
22923
22943
  ref: inputRef,
22924
22944
  className: "min-w-30 bg-transparent font-semibold text-foreground outline-none",
@@ -24984,7 +25004,7 @@ function UpdateElement(props) {
24984
25004
  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: [
24985
25005
  /* @__PURE__ */ jsx203("div", { className: "sticky top-24", contentEditable: false, children: /* @__PURE__ */ jsxs137("div", { className: "flex flex-col items-start gap-2", children: [
24986
25006
  isEditingLabel ? /* @__PURE__ */ jsx203(
24987
- "input",
25007
+ UnstyledInput,
24988
25008
  {
24989
25009
  ref: labelInputRef,
24990
25010
  className: "border-primary border-b bg-transparent text-sm font-medium text-primary outline-none",