laif-ds 1.1.5 → 1.2.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.
Files changed (37) hide show
  1. package/dist/CHANGELOG.md +6 -0
  2. package/dist/_virtual/prism-cpp.js +3 -0
  3. package/dist/_virtual/prism-cpp2.js +5 -0
  4. package/dist/_virtual/prism-java.js +3 -0
  5. package/dist/_virtual/prism-java2.js +5 -0
  6. package/dist/_virtual/prism-python.js +3 -0
  7. package/dist/_virtual/prism-python2.js +5 -0
  8. package/dist/_virtual/prism-rust.js +3 -0
  9. package/dist/_virtual/prism-rust2.js +5 -0
  10. package/dist/_virtual/prism-typescript.js +3 -0
  11. package/dist/_virtual/prism-typescript2.js +5 -0
  12. package/dist/_virtual/prism.js +3 -0
  13. package/dist/_virtual/prism2.js +5 -0
  14. package/dist/agent-docs/adoption-report.json +16 -14
  15. package/dist/agent-docs/components/AppEditor.md +4 -0
  16. package/dist/agent-docs/manifest.json +3 -3
  17. package/dist/components/editor/plugins/paste-markdown-plugin.js +75 -0
  18. package/dist/components/ui/app-editor.js +128 -116
  19. package/dist/node_modules/@lexical/code-prism/dist/LexicalCodePrism.prod.js +27 -0
  20. package/dist/node_modules/@lexical/markdown/dist/LexicalMarkdown.prod.js +114 -109
  21. package/dist/node_modules/prismjs/components/prism-c.js +77 -0
  22. package/dist/node_modules/prismjs/components/prism-clike.js +32 -0
  23. package/dist/node_modules/prismjs/components/prism-cpp.js +93 -0
  24. package/dist/node_modules/prismjs/components/prism-css.js +56 -0
  25. package/dist/node_modules/prismjs/components/prism-java.js +122 -0
  26. package/dist/node_modules/prismjs/components/prism-javascript.js +138 -0
  27. package/dist/node_modules/prismjs/components/prism-markdown.js +301 -0
  28. package/dist/node_modules/prismjs/components/prism-markup.js +174 -0
  29. package/dist/node_modules/prismjs/components/prism-objectivec.js +11 -0
  30. package/dist/node_modules/prismjs/components/prism-powershell.js +56 -0
  31. package/dist/node_modules/prismjs/components/prism-python.js +69 -0
  32. package/dist/node_modules/prismjs/components/prism-rust.js +124 -0
  33. package/dist/node_modules/prismjs/components/prism-sql.js +34 -0
  34. package/dist/node_modules/prismjs/components/prism-swift.js +114 -0
  35. package/dist/node_modules/prismjs/components/prism-typescript.js +53 -0
  36. package/dist/node_modules/prismjs/prism.js +1165 -0
  37. package/package.json +1 -1
package/dist/CHANGELOG.md CHANGED
@@ -5,6 +5,12 @@ All notable technical changes to the laif-ds core will be documented in this fil
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [laif-ds@1.2.0]
9
+
10
+ ### 🚀 Added
11
+
12
+ - **AppEditor**: Pasting plain text containing Markdown now converts it into formatted content (headings, links, code blocks, etc.), matching the formatting already applied to `defaultValue`; plain text without Markdown, HTML, and Lexical clipboard pastes keep their previous behavior
13
+
8
14
  ## [laif-ds@1.1.5]
9
15
 
10
16
  ### 🚀 Added
@@ -0,0 +1,3 @@
1
+ "use client";
2
+ import { __require as r } from "../node_modules/prismjs/components/prism-cpp.js";
3
+ r();
@@ -0,0 +1,5 @@
1
+ "use client";
2
+ var p = {};
3
+ export {
4
+ p as __exports
5
+ };
@@ -0,0 +1,3 @@
1
+ "use client";
2
+ import { __require as r } from "../node_modules/prismjs/components/prism-java.js";
3
+ r();
@@ -0,0 +1,5 @@
1
+ "use client";
2
+ var a = {};
3
+ export {
4
+ a as __exports
5
+ };
@@ -0,0 +1,3 @@
1
+ "use client";
2
+ import { __require as r } from "../node_modules/prismjs/components/prism-python.js";
3
+ r();
@@ -0,0 +1,5 @@
1
+ "use client";
2
+ var e = {};
3
+ export {
4
+ e as __exports
5
+ };
@@ -0,0 +1,3 @@
1
+ "use client";
2
+ import { __require as r } from "../node_modules/prismjs/components/prism-rust.js";
3
+ r();
@@ -0,0 +1,5 @@
1
+ "use client";
2
+ var s = {};
3
+ export {
4
+ s as __exports
5
+ };
@@ -0,0 +1,3 @@
1
+ "use client";
2
+ import { __require as r } from "../node_modules/prismjs/components/prism-typescript.js";
3
+ r();
@@ -0,0 +1,5 @@
1
+ "use client";
2
+ var e = {};
3
+ export {
4
+ e as __exports
5
+ };
@@ -0,0 +1,3 @@
1
+ "use client";
2
+ import { __require as r } from "../node_modules/prismjs/prism.js";
3
+ r();
@@ -0,0 +1,5 @@
1
+ "use client";
2
+ var e = { exports: {} };
3
+ export {
4
+ e as __module
5
+ };
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "schemaVersion": "1.0.0",
3
- "generatedAt": "2026-10-21T07:11:32.035Z",
3
+ "generatedAt": "2026-10-26T17:03:35.397Z",
4
4
  "package": {
5
5
  "name": "laif-ds",
6
- "version": "1.1.5"
6
+ "version": "1.2.0"
7
7
  },
8
8
  "summary": {
9
- "scannedFiles": 504,
9
+ "scannedFiles": 505,
10
10
  "deprecatedComponentsCount": 5,
11
11
  "deprecatedComponentsUsedCount": 3,
12
12
  "componentsWithoutExamplesCount": 5,
@@ -489,8 +489,9 @@
489
489
  },
490
490
  {
491
491
  "className": "text-muted-foreground text-sm",
492
- "occurrences": 28,
492
+ "occurrences": 29,
493
493
  "files": [
494
+ "src/components/stories/app-editor.stories.tsx",
494
495
  "src/components/stories/app-form.stories.tsx",
495
496
  "src/components/stories/app-stepper.stories.tsx",
496
497
  "src/components/stories/app-time-picker.stories.tsx",
@@ -520,20 +521,12 @@
520
521
  "src/components/ui/secure-pdf-viewer.tsx"
521
522
  ]
522
523
  },
523
- {
524
- "className": "bg-muted rounded-md p-4",
525
- "occurrences": 20,
526
- "files": [
527
- "src/components/stories/card.stories.tsx",
528
- "src/components/stories/data-table-no-utils-example.stories.tsx",
529
- "src/components/stories/data-table-utils-example.stories.tsx"
530
- ]
531
- },
532
524
  {
533
525
  "className": "flex items-center justify-between",
534
- "occurrences": 19,
526
+ "occurrences": 20,
535
527
  "files": [
536
528
  "src/components/stories/app-card.stories.tsx",
529
+ "src/components/stories/app-editor.stories.tsx",
537
530
  "src/components/stories/data-table-utils-example.stories.tsx",
538
531
  "src/components/stories/sidebar.stories.tsx",
539
532
  "src/components/stories/switch.stories.tsx",
@@ -543,6 +536,15 @@
543
536
  "src/components/ui/tables/data-cross-table/editable-input.tsx"
544
537
  ]
545
538
  },
539
+ {
540
+ "className": "bg-muted rounded-md p-4",
541
+ "occurrences": 20,
542
+ "files": [
543
+ "src/components/stories/card.stories.tsx",
544
+ "src/components/stories/data-table-no-utils-example.stories.tsx",
545
+ "src/components/stories/data-table-utils-example.stories.tsx"
546
+ ]
547
+ },
546
548
  {
547
549
  "className": "mb-2 text-lg font-medium",
548
550
  "occurrences": 19,
@@ -60,6 +60,10 @@ type MentionItem = {
60
60
  - **Editing**: Autosave via `onValueChange`. Keyboard navigation and selection per Lexical defaults.
61
61
  - **Markdown Features**: Full support for headings, lists, quotes, links, inline code, bold, italic, strikethrough, and custom underline syntax.
62
62
  - **Links**: `[text](url)` in `defaultValue` renders as a link and is emitted back unchanged; links pasted as HTML are kept as links. Enable the `link` toolbar for a user-facing button; to insert a link programmatically (e.g. a "quick insert" action outside the editor) call `ref.current.insertLink(url, text)`. Give the triggering button `onMouseDown={(e) => e.preventDefault()}` so the editor keeps its caret.
63
+ - **Paste from Markdown** (when `onlyMarkdown=true`): pasting **plain text that contains Markdown** (headings, `**bold**`, `*italic*`, `` `code` ``, bulleted/numbered lists, quotes, fenced code, `[links](url)`, `<u>underline</u>`) converts it with the same transformers as `defaultValue` — formatted nodes, no leftover markers, no empty paragraphs from blank lines. A single line pasted mid-paragraph merges inline. Everything else keeps the default Lexical paste:
64
+ - plain text with no Markdown construct (look-alikes such as `5 * 3`, `file_name_v2`, `#hashtag` are not treated as Markdown);
65
+ - any clipboard carrying `text/html` (web pages, Word, Outlook) or Lexical's own format — even when its plain-text flavour looks like Markdown. Copying Markdown source from an editor that also writes HTML (e.g. VS Code) therefore pastes as-is.
66
+ - The paste is a single undo step.
63
67
  - **Mentions** (opt-in via `mentions`):
64
68
  - `mentions` is either a ready `MentionItem[]` or a **loader function** `() => MentionItem[] | Promise<MentionItem[]>`. The loader is called **once, the first time the menu opens**, so a large list is never preloaded on mount; while it resolves the menu shows a `Loading…` row, and on failure a `Couldn't load mentions` row (re-opening the menu retries). The resolved list is then filtered client-side like the array form.
65
69
  - With the **loader form**, `meta.mentions` cannot reconcile against a synchronous source list, so its emitted items carry `id`/`label`/`value` from the chip but **not `sublabel`** (which is menu-only metadata). The array form preserves `sublabel`.
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "schemaVersion": "1.1.0",
3
- "generatedAt": "2026-10-21T07:11:31.501Z",
3
+ "generatedAt": "2026-10-26T17:03:34.845Z",
4
4
  "package": {
5
5
  "name": "laif-ds",
6
- "version": "1.1.5"
6
+ "version": "1.2.0"
7
7
  },
8
8
  "stats": {
9
9
  "documentedComponentCount": 97,
@@ -6556,5 +6556,5 @@
6556
6556
  ]
6557
6557
  }
6558
6558
  ],
6559
- "checksum": "acf523f850e6553b7e6ee468f3246be9dd5b9c624ff99c56260dc3c475afa1c3"
6559
+ "checksum": "0ae7e68a8339e77f0a232184ea036347a3ae7c383c803d1c7215951e7eaadd49"
6560
6560
  }
@@ -0,0 +1,75 @@
1
+ "use client";
2
+ import { $generateNodesFromMarkdownString as f } from "../../../node_modules/@lexical/markdown/dist/LexicalMarkdown.prod.js";
3
+ import { useLexicalComposerContext as c } from "../../../node_modules/@lexical/react/dist/LexicalComposerContext.prod.js";
4
+ import { PASTE_COMMAND as _, $isRangeSelection as l, $getSelection as m, PASTE_TAG as d, COMMAND_PRIORITY_LOW as p } from "../../../node_modules/lexical/dist/Lexical.prod.js";
5
+ import { useEffect as S } from "react";
6
+ const w = [
7
+ /^#{1,6}\s+\S/m,
8
+ // # heading
9
+ /^\s*[-*+]\s+\S/m,
10
+ // - bulleted list
11
+ /^\s*\d+[.)]\s+\S/m,
12
+ // 1. numbered list
13
+ /^>\s?\S/m,
14
+ // > quote
15
+ /^```/m,
16
+ // fenced code block
17
+ /\*\*[^*\s](?:[^*\n]*[^*\s])?\*\*/,
18
+ // **bold**
19
+ /(^|[^\w])__[^_\s](?:[^_\n]*[^_\s])?__(?!\w)/m,
20
+ // __bold__
21
+ /(^|[^\w*])\*[^*\s](?:[^*\n]*[^*\s])?\*(?![\w*])/m,
22
+ // *italic*
23
+ /(^|[^\w])_[^_\s](?:[^_\n]*[^_\s])?_(?!\w)/m,
24
+ // _italic_
25
+ /~~[^~\s](?:[^~\n]*[^~\s])?~~/,
26
+ // ~~strikethrough~~
27
+ /`[^`\n]+`/,
28
+ // `inline code`
29
+ /\[[^\]\n]+\]\([^)\s]+\)/,
30
+ // [link](url)
31
+ /<u>[^<\n]+<\/u>/
32
+ // <u>underline</u> (AppEditor's extended syntax)
33
+ ];
34
+ function g(e) {
35
+ return w.some((t) => t.test(e));
36
+ }
37
+ function k({
38
+ transformers: e,
39
+ preprocess: t
40
+ }) {
41
+ const [n] = c();
42
+ return S(
43
+ () => n.registerCommand(
44
+ _,
45
+ (r) => {
46
+ if (!(r instanceof ClipboardEvent)) return !1;
47
+ const o = r.clipboardData;
48
+ if (!o) return !1;
49
+ const a = Array.from(o.types);
50
+ if (a.includes("text/html") || a.includes("application/x-lexical-editor"))
51
+ return !1;
52
+ const s = o.getData("text/plain");
53
+ return !s || !g(s) || !l(m()) ? !1 : (r.preventDefault(), n.update(
54
+ () => {
55
+ const i = m();
56
+ if (!l(i)) return;
57
+ const u = t ? t(s) : s;
58
+ i.insertNodes(
59
+ f(u, e)
60
+ );
61
+ },
62
+ // Same tag as Lexical's own paste: its own undo entry.
63
+ { tag: d }
64
+ ), !0);
65
+ },
66
+ // Above RichTextPlugin's COMMAND_PRIORITY_EDITOR, so it runs first.
67
+ p
68
+ ),
69
+ [n, e, t]
70
+ ), null;
71
+ }
72
+ export {
73
+ k as PasteMarkdownPlugin,
74
+ g as looksLikeMarkdown
75
+ };
@@ -1,231 +1,243 @@
1
1
  "use client";
2
- import { jsx as r, jsxs as n, Fragment as u } from "react/jsx-runtime";
3
- import { LinkNode as U } from "../../node_modules/@lexical/link/dist/LexicalLink.prod.js";
4
- import { ListNode as _, ListItemNode as Q } from "../../node_modules/@lexical/list/dist/LexicalList.prod.js";
5
- import { TRANSFORMERS as K, $convertToMarkdownString as W, $convertFromMarkdownString as Z } from "../../node_modules/@lexical/markdown/dist/LexicalMarkdown.prod.js";
6
- import { CheckListPlugin as q } from "../../node_modules/@lexical/react/dist/LexicalCheckListPlugin.prod.js";
7
- import { ClearEditorPlugin as G } from "../../node_modules/@lexical/react/dist/LexicalClearEditorPlugin.prod.js";
8
- import { LexicalComposer as J } from "../../node_modules/@lexical/react/dist/LexicalComposer.prod.js";
2
+ import { jsx as r, jsxs as n, Fragment as h } from "react/jsx-runtime";
3
+ import "../../node_modules/@lexical/code-prism/dist/LexicalCodePrism.prod.js";
4
+ import { CodeNode as _ } from "../../node_modules/@lexical/code-core/dist/LexicalCodeCore.prod.js";
5
+ import { LinkNode as Q } from "../../node_modules/@lexical/link/dist/LexicalLink.prod.js";
6
+ import { ListNode as K, ListItemNode as W } from "../../node_modules/@lexical/list/dist/LexicalList.prod.js";
7
+ import { TRANSFORMERS as Z, $convertToMarkdownString as q, $convertFromMarkdownString as G } from "../../node_modules/@lexical/markdown/dist/LexicalMarkdown.prod.js";
8
+ import { CheckListPlugin as J } from "../../node_modules/@lexical/react/dist/LexicalCheckListPlugin.prod.js";
9
+ import { ClearEditorPlugin as X } from "../../node_modules/@lexical/react/dist/LexicalClearEditorPlugin.prod.js";
10
+ import { LexicalComposer as Y } from "../../node_modules/@lexical/react/dist/LexicalComposer.prod.js";
9
11
  import { useLexicalComposerContext as L } from "../../node_modules/@lexical/react/dist/LexicalComposerContext.prod.js";
10
- import { LexicalErrorBoundary as X } from "../../node_modules/@lexical/react/dist/LexicalErrorBoundary.prod.js";
11
- import { HistoryPlugin as Y } from "../../node_modules/@lexical/react/dist/LexicalHistoryPlugin.prod.js";
12
- import { ListPlugin as V } from "../../node_modules/@lexical/react/dist/LexicalListPlugin.prod.js";
13
- import { OnChangePlugin as rr } from "../../node_modules/@lexical/react/dist/LexicalOnChangePlugin.prod.js";
14
- import { RichTextPlugin as or } from "../../node_modules/@lexical/react/dist/LexicalRichTextPlugin.prod.js";
15
- import { HeadingNode as er, QuoteNode as tr } from "../../node_modules/@lexical/rich-text/dist/LexicalRichText.prod.js";
16
- import { ParagraphNode as g, TextNode as h, $nodesOfType as ir, $getRoot as N } from "../../node_modules/lexical/dist/Lexical.prod.js";
17
- import { forwardRef as nr, useState as lr, useMemo as ar, useImperativeHandle as sr, useEffect as mr } from "react";
18
- import { ContentEditable as cr } from "../editor/editor-ui/content-editable.js";
12
+ import { LexicalErrorBoundary as V } from "../../node_modules/@lexical/react/dist/LexicalErrorBoundary.prod.js";
13
+ import { HistoryPlugin as rr } from "../../node_modules/@lexical/react/dist/LexicalHistoryPlugin.prod.js";
14
+ import { ListPlugin as or } from "../../node_modules/@lexical/react/dist/LexicalListPlugin.prod.js";
15
+ import { OnChangePlugin as er } from "../../node_modules/@lexical/react/dist/LexicalOnChangePlugin.prod.js";
16
+ import { RichTextPlugin as tr } from "../../node_modules/@lexical/react/dist/LexicalRichTextPlugin.prod.js";
17
+ import { HeadingNode as ir, QuoteNode as nr } from "../../node_modules/@lexical/rich-text/dist/LexicalRichText.prod.js";
18
+ import { ParagraphNode as N, TextNode as v, $nodesOfType as lr, $getRoot as b } from "../../node_modules/lexical/dist/Lexical.prod.js";
19
+ import { forwardRef as ar, useState as sr, useMemo as mr, useImperativeHandle as cr, useEffect as dr } from "react";
20
+ import { ContentEditable as pr } from "../editor/editor-ui/content-editable.js";
19
21
  import { MentionNode as k } from "../editor/nodes/mention-node.js";
20
- import { ActionsPlugin as dr } from "../editor/plugins/actions/actions-plugin.js";
21
- import { ClearEditorActionPlugin as pr } from "../editor/plugins/actions/clear-editor-plugin.js";
22
- import { CounterCharacterPlugin as fr } from "../editor/plugins/actions/counter-character-plugin.js";
23
- import { MENTION_TRANSFORMER as ur, MentionPlugin as gr, collectMentions as hr } from "../editor/plugins/mention-plugin.js";
24
- import { FormatBulletedList as Nr } from "../editor/plugins/toolbar/block-format/format-bulleted-list.js";
25
- import { FormatCheckList as br } from "../editor/plugins/toolbar/block-format/format-check-list.js";
26
- import { FormatHeading as vr } from "../editor/plugins/toolbar/block-format/format-heading.js";
27
- import { FormatNumberedList as xr } from "../editor/plugins/toolbar/block-format/format-numbered-list.js";
28
- import { FormatParagraph as Er } from "../editor/plugins/toolbar/block-format/format-paragraph.js";
29
- import { FormatQuote as Fr } from "../editor/plugins/toolbar/block-format/format-quote.js";
30
- import { BlockFormatDropDown as Pr } from "../editor/plugins/toolbar/block-format-toolbar-plugin.js";
22
+ import { ActionsPlugin as fr } from "../editor/plugins/actions/actions-plugin.js";
23
+ import { ClearEditorActionPlugin as ur } from "../editor/plugins/actions/clear-editor-plugin.js";
24
+ import { CounterCharacterPlugin as gr } from "../editor/plugins/actions/counter-character-plugin.js";
25
+ import { MENTION_TRANSFORMER as hr, MentionPlugin as Nr, collectMentions as vr } from "../editor/plugins/mention-plugin.js";
26
+ import { PasteMarkdownPlugin as br } from "../editor/plugins/paste-markdown-plugin.js";
27
+ import { FormatBulletedList as xr } from "../editor/plugins/toolbar/block-format/format-bulleted-list.js";
28
+ import { FormatCheckList as Er } from "../editor/plugins/toolbar/block-format/format-check-list.js";
29
+ import { FormatHeading as Fr } from "../editor/plugins/toolbar/block-format/format-heading.js";
30
+ import { FormatNumberedList as Pr } from "../editor/plugins/toolbar/block-format/format-numbered-list.js";
31
+ import { FormatParagraph as Cr } from "../editor/plugins/toolbar/block-format/format-paragraph.js";
32
+ import { FormatQuote as Rr } from "../editor/plugins/toolbar/block-format/format-quote.js";
33
+ import { BlockFormatDropDown as yr } from "../editor/plugins/toolbar/block-format-toolbar-plugin.js";
31
34
  import { FontFormatToolbarPlugin as m } from "../editor/plugins/toolbar/font-format-toolbar-plugin.js";
32
- import { LinkToolbarPlugin as yr, $insertLink as Rr } from "../editor/plugins/toolbar/link-toolbar-plugin.js";
33
- import { MentionInsertToolbarPlugin as Cr } from "../editor/plugins/toolbar/mention-insert-toolbar-plugin.js";
35
+ import { LinkToolbarPlugin as Tr, $insertLink as kr } from "../editor/plugins/toolbar/link-toolbar-plugin.js";
36
+ import { MentionInsertToolbarPlugin as wr } from "../editor/plugins/toolbar/mention-insert-toolbar-plugin.js";
34
37
  import { ToolbarPlugin as f } from "../editor/plugins/toolbar/toolbar-plugin.js";
35
- import { editorTheme as Tr } from "../editor/themes/editor-theme.js";
36
- import { TooltipProvider as kr } from "./tooltip.js";
37
- import { HistoryToolbarPlugin as wr } from "../editor/plugins/toolbar/history-toolbar-plugin.js";
38
- import { cn as Lr } from "../../lib/utils.js";
39
- const Sr = "Start typing...", Ar = {
38
+ import { editorTheme as Lr } from "../editor/themes/editor-theme.js";
39
+ import { TooltipProvider as Sr } from "./tooltip.js";
40
+ import { HistoryToolbarPlugin as Ar } from "../editor/plugins/toolbar/history-toolbar-plugin.js";
41
+ import { cn as Mr } from "../../lib/utils.js";
42
+ const $r = "Start typing...", Ir = {
40
43
  format: ["underline"],
41
44
  tag: "++",
42
45
  type: "text-format"
43
46
  }, w = [
44
- ...K,
45
- Ar
46
- ], Mr = (o) => o.replace(/<u>(.*?)<\/u>/g, "++$1++"), $r = (o) => o.replace(/\+\+(.+?)\+\+/g, "<u>$1</u>");
47
- function Ir({
47
+ ...Z,
48
+ Ir
49
+ ], S = (o) => o.replace(/<u>(.*?)<\/u>/g, "++$1++"), Or = (o) => o.replace(/\+\+(.+?)\+\+/g, "<u>$1</u>");
50
+ function Hr({
48
51
  handleRef: o
49
52
  }) {
50
53
  const [e] = L();
51
- return sr(
54
+ return cr(
52
55
  o,
53
56
  () => ({
54
57
  insertLink: (t, a) => {
55
- e.focus(), e.update(() => Rr(t, a));
58
+ e.focus(), e.update(() => kr(t, a));
56
59
  }
57
60
  }),
58
61
  [e]
59
62
  ), null;
60
63
  }
61
- function Or({
64
+ function jr({
62
65
  defaultValue: o,
63
66
  onlyMarkdown: e,
64
67
  transformers: t
65
68
  }) {
66
69
  const [a] = L();
67
- return mr(() => {
70
+ return dr(() => {
68
71
  o && a.update(() => {
69
- e ? Z(
70
- Mr(o),
72
+ e ? G(
73
+ S(o),
71
74
  t
72
- ) : N().append(
73
- new g().append(new h(o))
75
+ ) : b().append(
76
+ new N().append(new v(o))
74
77
  );
75
- const c = N();
78
+ const c = b();
76
79
  (c.getFirstChild() ?? c).selectStart();
77
80
  });
78
81
  }, [a, o, e, t]), null;
79
82
  }
80
- function Hr({
83
+ function Br({
81
84
  defaultValue: o,
82
85
  onMarkdownEdit: e,
83
86
  onValueChange: t,
84
87
  plugins: a = [],
85
88
  toolbars: c = [],
86
- placeholder: S = Sr,
87
- onlyMarkdown: b = !0,
88
- className: A = "rounded-lg border border-d-border",
89
- wrpClassName: M = "",
89
+ placeholder: A = $r,
90
+ onlyMarkdown: u = !0,
91
+ className: M = "rounded-lg border border-d-border",
92
+ wrpClassName: $ = "",
90
93
  mentions: d,
91
- mentionTrigger: v = "@"
92
- }, $) {
93
- const [, I] = lr(null), s = d !== void 0, x = ar(
94
- () => s ? [ur, ...w] : w,
94
+ mentionTrigger: x = "@"
95
+ }, I) {
96
+ const [, O] = sr(null), s = d !== void 0, g = mr(
97
+ () => s ? [hr, ...w] : w,
95
98
  [s]
96
- ), O = {
99
+ ), H = {
97
100
  namespace: "AppEditor",
98
- theme: Tr,
101
+ theme: Lr,
99
102
  nodes: [
100
- er,
101
- g,
102
- h,
103
- tr,
104
- _,
103
+ ir,
104
+ N,
105
+ v,
106
+ nr,
107
+ K,
108
+ W,
109
+ // Required by the Markdown LINK and CODE transformers: without them a
110
+ // link or a fenced block in `defaultValue` (or in a paste) throws and
111
+ // leaves the editor empty.
105
112
  Q,
106
- // TRANSFORMERS includes the Markdown LINK transformer, which needs this
107
- // node to import `[text](url)` from `defaultValue`.
108
- U,
113
+ _,
109
114
  ...s ? [k] : []
110
115
  ],
111
116
  onError: (i) => {
112
117
  console.error(i);
113
118
  },
114
- ...o && !b ? {
119
+ ...o && !u ? {
115
120
  editorState: () => {
116
- N().append(
117
- new g().append(new h(o))
121
+ b().append(
122
+ new N().append(new v(o))
118
123
  );
119
124
  }
120
125
  } : {}
121
- }, E = (i) => a.includes(i), p = (i) => c.includes(i), F = E("clear"), P = E("counter"), y = p("block-format"), H = p("font-format"), R = p("history"), j = p("link");
122
- return /* @__PURE__ */ r("div", { className: Lr("bg-d-background flex h-96 flex-col", M), children: /* @__PURE__ */ r(J, { initialConfig: O, children: /* @__PURE__ */ n(kr, { children: [
123
- /* @__PURE__ */ r(Ir, { handleRef: $ }),
126
+ }, E = (i) => a.includes(i), p = (i) => c.includes(i), F = E("clear"), P = E("counter"), C = p("block-format"), j = p("font-format"), R = p("history"), B = p("link");
127
+ return /* @__PURE__ */ r("div", { className: Mr("bg-d-background flex h-96 flex-col", $), children: /* @__PURE__ */ r(Y, { initialConfig: H, children: /* @__PURE__ */ n(Sr, { children: [
128
+ /* @__PURE__ */ r(Hr, { handleRef: I }),
124
129
  o && /* @__PURE__ */ r(
125
- Or,
130
+ jr,
126
131
  {
127
132
  defaultValue: o,
128
- onlyMarkdown: b,
129
- transformers: x
133
+ onlyMarkdown: u,
134
+ transformers: g
130
135
  }
131
136
  ),
132
- s && /* @__PURE__ */ r(gr, { source: d, trigger: v }),
137
+ u && /* @__PURE__ */ r(
138
+ br,
139
+ {
140
+ transformers: g,
141
+ preprocess: S
142
+ }
143
+ ),
144
+ s && /* @__PURE__ */ r(Nr, { source: d, trigger: x }),
133
145
  /* @__PURE__ */ n("div", { className: "border-d-border flex items-center border-b", children: [
134
- R && /* @__PURE__ */ r(f, { children: () => /* @__PURE__ */ r("div", { className: "vertical-align-middle sticky top-0 z-10 flex gap-2 overflow-auto p-1", children: /* @__PURE__ */ r(wr, {}) }) }),
135
- y && /* @__PURE__ */ r(f, { children: () => /* @__PURE__ */ r(u, { children: /* @__PURE__ */ r("div", { className: "vertical-align-middle sticky top-0 z-10 flex gap-2 overflow-auto p-1", children: /* @__PURE__ */ n(Pr, { children: [
136
- /* @__PURE__ */ r(Er, {}),
137
- /* @__PURE__ */ r(vr, { levels: ["h1", "h2", "h3"] }),
146
+ R && /* @__PURE__ */ r(f, { children: () => /* @__PURE__ */ r("div", { className: "vertical-align-middle sticky top-0 z-10 flex gap-2 overflow-auto p-1", children: /* @__PURE__ */ r(Ar, {}) }) }),
147
+ C && /* @__PURE__ */ r(f, { children: () => /* @__PURE__ */ r(h, { children: /* @__PURE__ */ r("div", { className: "vertical-align-middle sticky top-0 z-10 flex gap-2 overflow-auto p-1", children: /* @__PURE__ */ n(yr, { children: [
148
+ /* @__PURE__ */ r(Cr, {}),
149
+ /* @__PURE__ */ r(Fr, { levels: ["h1", "h2", "h3"] }),
150
+ /* @__PURE__ */ r(Pr, {}),
138
151
  /* @__PURE__ */ r(xr, {}),
139
- /* @__PURE__ */ r(Nr, {}),
140
- /* @__PURE__ */ r(br, {}),
141
- /* @__PURE__ */ r(Fr, {})
152
+ /* @__PURE__ */ r(Er, {}),
153
+ /* @__PURE__ */ r(Rr, {})
142
154
  ] }) }) }) }),
143
- H && /* @__PURE__ */ r(f, { children: () => /* @__PURE__ */ n("div", { className: "vertical-align-middle sticky top-0 z-10 flex gap-2 overflow-auto p-1", children: [
155
+ j && /* @__PURE__ */ r(f, { children: () => /* @__PURE__ */ n("div", { className: "vertical-align-middle sticky top-0 z-10 flex gap-2 overflow-auto p-1", children: [
144
156
  /* @__PURE__ */ r(m, { format: "bold" }),
145
157
  /* @__PURE__ */ r(m, { format: "italic" }),
146
158
  /* @__PURE__ */ r(m, { format: "underline" }),
147
159
  /* @__PURE__ */ r(m, { format: "strikethrough" }),
148
160
  /* @__PURE__ */ r(m, { format: "code" }),
149
161
  s && /* @__PURE__ */ r(
150
- Cr,
162
+ wr,
151
163
  {
152
- trigger: v ?? "@"
164
+ trigger: x ?? "@"
153
165
  }
154
166
  )
155
167
  ] }) }),
156
- j && /* @__PURE__ */ r(f, { children: () => /* @__PURE__ */ r("div", { className: "vertical-align-middle sticky top-0 z-10 flex gap-2 overflow-auto p-1", children: /* @__PURE__ */ r(yr, {}) }) })
168
+ B && /* @__PURE__ */ r(f, { children: () => /* @__PURE__ */ r("div", { className: "vertical-align-middle sticky top-0 z-10 flex gap-2 overflow-auto p-1", children: /* @__PURE__ */ r(Tr, {}) }) })
157
169
  ] }),
158
170
  /* @__PURE__ */ n("div", { className: "relative flex min-h-0 w-full flex-1 flex-col", children: [
159
- R && /* @__PURE__ */ r(Y, {}),
171
+ R && /* @__PURE__ */ r(rr, {}),
160
172
  /* @__PURE__ */ r(
161
- or,
173
+ tr,
162
174
  {
163
- ErrorBoundary: X,
175
+ ErrorBoundary: V,
164
176
  contentEditable: /* @__PURE__ */ r(
165
177
  "div",
166
178
  {
167
- ref: I,
179
+ ref: O,
168
180
  className: "flex min-h-0 w-full flex-1 overflow-auto",
169
181
  children: /* @__PURE__ */ r(
170
- cr,
182
+ pr,
171
183
  {
172
- placeholder: S,
173
- className: `border-d-border w-full rounded-none border-b ${A}`
184
+ placeholder: A,
185
+ className: `border-d-border w-full rounded-none border-b ${M}`
174
186
  }
175
187
  )
176
188
  }
177
189
  )
178
190
  }
179
191
  ),
180
- y && /* @__PURE__ */ n(u, { children: [
181
- /* @__PURE__ */ r(V, {}),
182
- /* @__PURE__ */ r(q, {})
192
+ C && /* @__PURE__ */ n(h, { children: [
193
+ /* @__PURE__ */ r(or, {}),
194
+ /* @__PURE__ */ r(J, {})
183
195
  ] }),
184
- (F || P) && /* @__PURE__ */ r(dr, { children: /* @__PURE__ */ n("div", { className: "clear-both flex items-center justify-between gap-2 p-1", children: [
196
+ (F || P) && /* @__PURE__ */ r(fr, { children: /* @__PURE__ */ n("div", { className: "clear-both flex items-center justify-between gap-2 p-1", children: [
185
197
  /* @__PURE__ */ r("div", { className: "flex flex-1 justify-start" }),
186
- /* @__PURE__ */ r("div", { children: P && /* @__PURE__ */ r(fr, { charset: "UTF-16" }) }),
187
- /* @__PURE__ */ r("div", { className: "flex flex-1 justify-end gap-2", children: F && /* @__PURE__ */ n(u, { children: [
188
- /* @__PURE__ */ r(pr, {}),
189
- /* @__PURE__ */ r(G, {})
198
+ /* @__PURE__ */ r("div", { children: P && /* @__PURE__ */ r(gr, { charset: "UTF-16" }) }),
199
+ /* @__PURE__ */ r("div", { className: "flex flex-1 justify-end gap-2", children: F && /* @__PURE__ */ n(h, { children: [
200
+ /* @__PURE__ */ r(ur, {}),
201
+ /* @__PURE__ */ r(X, {})
190
202
  ] }) })
191
203
  ] }) })
192
204
  ] }),
193
205
  /* @__PURE__ */ r(
194
- rr,
206
+ er,
195
207
  {
196
208
  ignoreSelectionChange: !0,
197
209
  onChange: (i) => {
198
210
  if (!t && !e) return;
199
- const C = $r(
200
- i.read(() => W(x))
211
+ const y = Or(
212
+ i.read(() => q(g))
201
213
  );
202
214
  if (!t) {
203
- e?.(C);
215
+ e?.(y);
204
216
  return;
205
217
  }
206
218
  let T = [];
207
219
  if (s) {
208
- const B = i.read(
209
- () => hr(ir(k))
210
- ), z = Array.isArray(d) ? d : [], D = new Map(
211
- z.map((l) => [String(l.id), l])
220
+ const z = i.read(
221
+ () => vr(lr(k))
222
+ ), D = Array.isArray(d) ? d : [], U = new Map(
223
+ D.map((l) => [String(l.id), l])
212
224
  );
213
- T = B.map(
214
- (l) => D.get(String(l.id)) ?? {
225
+ T = z.map(
226
+ (l) => U.get(String(l.id)) ?? {
215
227
  id: l.id,
216
228
  label: l.label,
217
229
  value: l.value
218
230
  }
219
231
  );
220
232
  }
221
- t(C, { mentions: T });
233
+ t(y, { mentions: T });
222
234
  }
223
235
  }
224
236
  )
225
237
  ] }) }) });
226
238
  }
227
- const jr = nr(Hr);
228
- jr.displayName = "AppEditor";
239
+ const zr = ar(Br);
240
+ zr.displayName = "AppEditor";
229
241
  export {
230
- jr as AppEditor
242
+ zr as AppEditor
231
243
  };