laif-ds 0.2.85 → 0.2.87

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 (113) hide show
  1. package/README.md +11 -81
  2. package/dist/CHANGELOG.md +13 -0
  3. package/dist/_virtual/index6.js +2 -2
  4. package/dist/_virtual/index7.js +2 -2
  5. package/dist/agent-docs/adoption-report.json +2 -2
  6. package/dist/agent-docs/manifest.json +3 -3
  7. package/dist/components/editor/editor-hooks/use-update-toolbar.js +6 -6
  8. package/dist/components/editor/editor-ui/content-editable.js +1 -1
  9. package/dist/components/editor/nodes/mention-node.js +2 -2
  10. package/dist/components/editor/plugins/actions/clear-editor-plugin.js +2 -2
  11. package/dist/components/editor/plugins/actions/counter-character-plugin.js +2 -2
  12. package/dist/components/editor/plugins/mention-plugin.js +21 -21
  13. package/dist/components/editor/plugins/toolbar/block-format/format-bulleted-list.js +10 -10
  14. package/dist/components/editor/plugins/toolbar/block-format/format-check-list.js +5 -5
  15. package/dist/components/editor/plugins/toolbar/block-format/format-heading.js +5 -5
  16. package/dist/components/editor/plugins/toolbar/block-format/format-numbered-list.js +5 -5
  17. package/dist/components/editor/plugins/toolbar/block-format/format-paragraph.js +9 -9
  18. package/dist/components/editor/plugins/toolbar/block-format/format-quote.js +3 -3
  19. package/dist/components/editor/plugins/toolbar/block-format-toolbar-plugin.js +13 -13
  20. package/dist/components/editor/plugins/toolbar/font-format-toolbar-plugin.js +2 -2
  21. package/dist/components/editor/plugins/toolbar/history-toolbar-plugin.js +18 -19
  22. package/dist/components/editor/plugins/toolbar/mention-insert-toolbar-plugin.js +1 -1
  23. package/dist/components/editor/plugins/toolbar/toolbar-plugin.js +3 -3
  24. package/dist/components/ui/app-editor.js +51 -51
  25. package/dist/components/ui/markdown-renderer.js +33 -32
  26. package/dist/lib/utils.js +35 -34
  27. package/dist/node_modules/@floating-ui/core/dist/floating-ui.core.js +1 -1
  28. package/dist/node_modules/@floating-ui/{utils → core/node_modules/@floating-ui/utils}/dist/floating-ui.utils.js +33 -39
  29. package/dist/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +20 -19
  30. package/dist/node_modules/@floating-ui/dom/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +12 -0
  31. package/dist/node_modules/@lexical/clipboard/dist/LexicalClipboard.prod.js +354 -0
  32. package/dist/node_modules/@lexical/code-core/dist/LexicalCodeCore.prod.js +298 -0
  33. package/dist/node_modules/@lexical/dragon/dist/LexicalDragon.prod.js +89 -0
  34. package/dist/node_modules/@lexical/extension/dist/LexicalExtension.prod.js +611 -0
  35. package/dist/node_modules/@lexical/history/dist/LexicalHistory.prod.js +96 -0
  36. package/dist/node_modules/@lexical/html/dist/LexicalHtml.prod.js +604 -0
  37. package/dist/node_modules/@lexical/link/dist/LexicalLink.prod.js +201 -0
  38. package/dist/node_modules/@lexical/list/dist/LexicalList.prod.js +843 -0
  39. package/dist/node_modules/@lexical/markdown/dist/LexicalMarkdown.prod.js +555 -0
  40. package/dist/node_modules/@lexical/react/dist/LexicalCheckListPlugin.prod.js +11 -0
  41. package/dist/node_modules/@lexical/react/dist/LexicalClearEditorPlugin.prod.js +13 -0
  42. package/dist/node_modules/@lexical/react/dist/LexicalComposer.prod.js +45 -0
  43. package/dist/node_modules/@lexical/react/{LexicalComposerContext.prod.js → dist/LexicalComposerContext.prod.js} +1 -1
  44. package/dist/node_modules/@lexical/react/dist/LexicalContentEditable.prod.js +53 -0
  45. package/dist/node_modules/@lexical/react/dist/LexicalErrorBoundary.prod.js +21 -0
  46. package/dist/node_modules/@lexical/react/{LexicalHistoryPlugin.prod.js → dist/LexicalHistoryPlugin.prod.js} +3 -3
  47. package/dist/node_modules/@lexical/react/dist/LexicalListPlugin.prod.js +17 -0
  48. package/dist/node_modules/@lexical/react/dist/LexicalOnChangePlugin.prod.js +16 -0
  49. package/dist/node_modules/@lexical/react/dist/LexicalReactProviderExtension.prod.js +6 -0
  50. package/dist/node_modules/@lexical/react/dist/LexicalRichTextPlugin.prod.js +77 -0
  51. package/dist/node_modules/@lexical/react/dist/LexicalTypeaheadMenuPlugin.prod.js +245 -0
  52. package/dist/node_modules/@lexical/react/dist/useLexicalEditable.prod.js +22 -0
  53. package/dist/node_modules/@lexical/rich-text/dist/LexicalRichText.prod.js +567 -0
  54. package/dist/node_modules/@lexical/selection/dist/LexicalSelection.prod.js +123 -0
  55. package/dist/node_modules/@lexical/table/dist/LexicalTable.prod.js +929 -0
  56. package/dist/node_modules/@lexical/text/{LexicalText.prod.js → dist/LexicalText.prod.js} +6 -6
  57. package/dist/node_modules/@lexical/utils/dist/LexicalUtils.prod.js +111 -0
  58. package/dist/node_modules/eventemitter3/index2.js +1 -1
  59. package/dist/node_modules/lexical/dist/Lexical.prod.js +6731 -0
  60. package/dist/node_modules/style-to-object/cjs/index.js +1 -1
  61. package/package.json +17 -15
  62. package/dist/_virtual/prism-cpp.js +0 -3
  63. package/dist/_virtual/prism-cpp2.js +0 -5
  64. package/dist/_virtual/prism-java.js +0 -3
  65. package/dist/_virtual/prism-java2.js +0 -5
  66. package/dist/_virtual/prism-python.js +0 -3
  67. package/dist/_virtual/prism-python2.js +0 -5
  68. package/dist/_virtual/prism-rust.js +0 -3
  69. package/dist/_virtual/prism-rust2.js +0 -5
  70. package/dist/_virtual/prism-typescript.js +0 -3
  71. package/dist/_virtual/prism-typescript2.js +0 -5
  72. package/dist/_virtual/prism.js +0 -3
  73. package/dist/_virtual/prism2.js +0 -5
  74. package/dist/node_modules/@lexical/clipboard/LexicalClipboard.prod.js +0 -159
  75. package/dist/node_modules/@lexical/code/LexicalCode.prod.js +0 -236
  76. package/dist/node_modules/@lexical/dragon/LexicalDragon.prod.js +0 -46
  77. package/dist/node_modules/@lexical/history/LexicalHistory.prod.js +0 -89
  78. package/dist/node_modules/@lexical/html/LexicalHtml.prod.js +0 -108
  79. package/dist/node_modules/@lexical/link/LexicalLink.prod.js +0 -187
  80. package/dist/node_modules/@lexical/list/LexicalList.prod.js +0 -729
  81. package/dist/node_modules/@lexical/markdown/LexicalMarkdown.prod.js +0 -367
  82. package/dist/node_modules/@lexical/react/LexicalCheckListPlugin.prod.js +0 -11
  83. package/dist/node_modules/@lexical/react/LexicalClearEditorPlugin.prod.js +0 -17
  84. package/dist/node_modules/@lexical/react/LexicalComposer.prod.js +0 -45
  85. package/dist/node_modules/@lexical/react/LexicalContentEditable.prod.js +0 -55
  86. package/dist/node_modules/@lexical/react/LexicalErrorBoundary.prod.js +0 -49
  87. package/dist/node_modules/@lexical/react/LexicalListPlugin.prod.js +0 -17
  88. package/dist/node_modules/@lexical/react/LexicalOnChangePlugin.prod.js +0 -16
  89. package/dist/node_modules/@lexical/react/LexicalRichTextPlugin.prod.js +0 -56
  90. package/dist/node_modules/@lexical/react/LexicalTypeaheadMenuPlugin.prod.js +0 -220
  91. package/dist/node_modules/@lexical/react/useLexicalEditable.prod.js +0 -21
  92. package/dist/node_modules/@lexical/rich-text/LexicalRichText.prod.js +0 -376
  93. package/dist/node_modules/@lexical/selection/LexicalSelection.prod.js +0 -107
  94. package/dist/node_modules/@lexical/table/LexicalTable.prod.js +0 -661
  95. package/dist/node_modules/@lexical/utils/LexicalUtils.prod.js +0 -102
  96. package/dist/node_modules/lexical/Lexical.prod.js +0 -4912
  97. package/dist/node_modules/prismjs/components/prism-c.js +0 -77
  98. package/dist/node_modules/prismjs/components/prism-clike.js +0 -32
  99. package/dist/node_modules/prismjs/components/prism-cpp.js +0 -93
  100. package/dist/node_modules/prismjs/components/prism-css.js +0 -56
  101. package/dist/node_modules/prismjs/components/prism-java.js +0 -122
  102. package/dist/node_modules/prismjs/components/prism-javascript.js +0 -138
  103. package/dist/node_modules/prismjs/components/prism-markdown.js +0 -301
  104. package/dist/node_modules/prismjs/components/prism-markup.js +0 -174
  105. package/dist/node_modules/prismjs/components/prism-objectivec.js +0 -11
  106. package/dist/node_modules/prismjs/components/prism-powershell.js +0 -56
  107. package/dist/node_modules/prismjs/components/prism-python.js +0 -69
  108. package/dist/node_modules/prismjs/components/prism-rust.js +0 -124
  109. package/dist/node_modules/prismjs/components/prism-sql.js +0 -34
  110. package/dist/node_modules/prismjs/components/prism-swift.js +0 -114
  111. package/dist/node_modules/prismjs/components/prism-typescript.js +0 -53
  112. package/dist/node_modules/prismjs/prism.js +0 -1165
  113. /package/dist/node_modules/@floating-ui/{utils → dom/node_modules/@floating-ui/utils}/dist/floating-ui.utils.dom.js +0 -0
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { __exports as r } from "../../../_virtual/index6.js";
2
+ import { __exports as r } from "../../../_virtual/index7.js";
3
3
  import { __require as c } from "../../inline-style-parser/index.js";
4
4
  var f;
5
5
  function j() {
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "laif-ds",
3
3
  "private": false,
4
- "version": "0.2.85",
4
+ "version": "0.2.87",
5
5
  "type": "module",
6
- "main": "dist/index.es.js",
7
- "module": "dist/index.es.js",
6
+ "main": "dist/index.js",
7
+ "module": "dist/index.js",
8
8
  "types": "dist/index.d.ts",
9
9
  "sideEffects": [
10
10
  "**/*.css"
@@ -27,7 +27,7 @@
27
27
  "license": "MIT",
28
28
  "repository": {
29
29
  "type": "git",
30
- "url": "https://github.com/laif/ds"
30
+ "url": "https://github.com/laif-group/ds"
31
31
  },
32
32
  "keywords": [
33
33
  "react"
@@ -36,8 +36,10 @@
36
36
  "dev": "vite",
37
37
  "build": "tsc && vite build && npm run build:css && npm run copy:template-css && npm run copy:changelog && npm run copy:agent-docs && npm run report:agent-docs",
38
38
  "tsc": "tsc",
39
- "check": "npm run tsc && npm run lint",
39
+ "check": "npm run tsc && npm run lint && npm run format:check",
40
40
  "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
41
+ "format": "prettier --write \"src/**/*.{ts,tsx,css}\" \"scripts/**/*.mjs\" \"*.{js,ts,mjs}\"",
42
+ "format:check": "prettier --check \"src/**/*.{ts,tsx,css}\" \"scripts/**/*.mjs\" \"*.{js,ts,mjs}\"",
41
43
  "preview": "vite preview",
42
44
  "storybook": "concurrently \"npm run storybook:css\" \"BROWSER=none storybook dev -p 6008 --no-open\" \"sleep 3 && open http://localhost:6008\"",
43
45
  "build-storybook": "npm run build-storybook:css && storybook build",
@@ -105,15 +107,15 @@
105
107
  "@dnd-kit/core": "^6.3.1",
106
108
  "@dnd-kit/modifiers": "^9.0.0",
107
109
  "@hookform/resolvers": "^5.1.1",
108
- "@lexical/code": "^0.32.1",
109
- "@lexical/file": "^0.32.1",
110
- "@lexical/list": "^0.32.1",
111
- "@lexical/react": "^0.32.1",
112
- "@lexical/rich-text": "^0.32.1",
113
- "@lexical/selection": "^0.32.1",
114
- "@lexical/table": "^0.32.1",
115
- "@lexical/text": "^0.32.1",
116
- "@lexical/utils": "^0.32.1",
110
+ "@lexical/code": "^0.47.0",
111
+ "@lexical/file": "^0.47.0",
112
+ "@lexical/list": "^0.47.0",
113
+ "@lexical/react": "^0.47.0",
114
+ "@lexical/rich-text": "^0.47.0",
115
+ "@lexical/selection": "^0.47.0",
116
+ "@lexical/table": "^0.47.0",
117
+ "@lexical/text": "^0.47.0",
118
+ "@lexical/utils": "^0.47.0",
117
119
  "@radix-ui/react-accordion": "^1.2.11",
118
120
  "@radix-ui/react-alert-dialog": "^1.1.14",
119
121
  "@radix-ui/react-aspect-ratio": "^1.1.7",
@@ -154,7 +156,7 @@
154
156
  "embla-carousel-react": "^8.6.0",
155
157
  "framer-motion": "^11.0.0 || ^12.0.0",
156
158
  "input-otp": "^1.4.2",
157
- "lexical": "^0.32.1",
159
+ "lexical": "^0.47.0",
158
160
  "lucide-react": "^0.576.0",
159
161
  "mime": "^4.1.0",
160
162
  "next-themes": "^0.4.6",
@@ -1,3 +0,0 @@
1
- "use client";
2
- import { __require as r } from "../node_modules/prismjs/components/prism-cpp.js";
3
- r();
@@ -1,5 +0,0 @@
1
- "use client";
2
- var p = {};
3
- export {
4
- p as __exports
5
- };
@@ -1,3 +0,0 @@
1
- "use client";
2
- import { __require as r } from "../node_modules/prismjs/components/prism-java.js";
3
- r();
@@ -1,5 +0,0 @@
1
- "use client";
2
- var a = {};
3
- export {
4
- a as __exports
5
- };
@@ -1,3 +0,0 @@
1
- "use client";
2
- import { __require as r } from "../node_modules/prismjs/components/prism-python.js";
3
- r();
@@ -1,5 +0,0 @@
1
- "use client";
2
- var e = {};
3
- export {
4
- e as __exports
5
- };
@@ -1,3 +0,0 @@
1
- "use client";
2
- import { __require as r } from "../node_modules/prismjs/components/prism-rust.js";
3
- r();
@@ -1,5 +0,0 @@
1
- "use client";
2
- var s = {};
3
- export {
4
- s as __exports
5
- };
@@ -1,3 +0,0 @@
1
- "use client";
2
- import { __require as r } from "../node_modules/prismjs/components/prism-typescript.js";
3
- r();
@@ -1,5 +0,0 @@
1
- "use client";
2
- var e = {};
3
- export {
4
- e as __exports
5
- };
@@ -1,3 +0,0 @@
1
- "use client";
2
- import { __require as r } from "../node_modules/prismjs/prism.js";
3
- r();
@@ -1,5 +0,0 @@
1
- "use client";
2
- var e = { exports: {} };
3
- export {
4
- e as __module
5
- };
@@ -1,159 +0,0 @@
1
- "use client";
2
- import { $generateNodesFromDOM as y, $generateHtmlFromNodes as $ } from "../html/LexicalHtml.prod.js";
3
- import { $addNodeStyle as D, $sliceSelectedTextNodeContent as O } from "../selection/LexicalSelection.prod.js";
4
- import { objectKlassEquals as R } from "../utils/LexicalUtils.prod.js";
5
- import { $isRangeSelection as h, $getSelection as p, $createTabNode as E, getDOMSelection as T, COPY_COMMAND as _, COMMAND_PRIORITY_CRITICAL as A, SELECTION_INSERT_CLIPBOARD_NODES_COMMAND as M, $parseSerializedNode as v, $isTextNode as N, isSelectionWithinEditor as L, $getEditor as P, $getRoot as b, $isElementNode as g, $cloneWithProperties as F } from "../../lexical/Lexical.prod.js";
6
- function x(t, ...e) {
7
- const n = new URL("https://lexical.dev/docs/error"), i = new URLSearchParams();
8
- i.append("code", t);
9
- for (const r of e) i.append("v", r);
10
- throw n.search = i.toString(), Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`);
11
- }
12
- function I(t, e = p()) {
13
- return e == null && x(166), h(e) && e.isCollapsed() || e.getNodes().length === 0 ? "" : $(t, e);
14
- }
15
- function H(t, e = p()) {
16
- return e == null && x(166), h(e) && e.isCollapsed() || e.getNodes().length === 0 ? null : JSON.stringify(J(t, e));
17
- }
18
- function G(t, e, n) {
19
- const i = t.getData("application/x-lexical-editor");
20
- if (i) try {
21
- const s = JSON.parse(i);
22
- if (s.namespace === n._config.namespace && Array.isArray(s.nodes))
23
- return w(n, z(s.nodes), e);
24
- } catch {
25
- }
26
- const r = t.getData("text/html"), d = t.getData("text/plain");
27
- if (r && d !== r) try {
28
- const s = new DOMParser().parseFromString((function(l) {
29
- return window.trustedTypes && window.trustedTypes.createPolicy ? window.trustedTypes.createPolicy("lexical", { createHTML: (o) => o }).createHTML(l) : l;
30
- })(r), "text/html");
31
- return w(n, y(n, s), e);
32
- } catch {
33
- }
34
- const a = d || t.getData("text/uri-list");
35
- if (a != null) if (h(e)) {
36
- const s = a.split(/(\r?\n|\t)/);
37
- s[s.length - 1] === "" && s.pop();
38
- for (let l = 0; l < s.length; l++) {
39
- const o = p();
40
- if (h(o)) {
41
- const c = s[l];
42
- c === `
43
- ` || c === `\r
44
- ` ? o.insertParagraph() : c === " " ? o.insertNodes([E()]) : o.insertText(c);
45
- }
46
- }
47
- } else e.insertRawText(a);
48
- }
49
- function w(t, e, n) {
50
- t.dispatchCommand(M, { nodes: e, selection: n }) || n.insertNodes(e);
51
- }
52
- function S(t, e, n, i = []) {
53
- let r = e === null || n.isSelected(e);
54
- const d = g(n) && n.excludeFromCopy("html");
55
- let a = n;
56
- if (e !== null) {
57
- let o = F(n);
58
- o = N(o) && e !== null ? O(e, o) : o, a = o;
59
- }
60
- const s = g(a) ? a.getChildren() : [], l = (function(o) {
61
- const c = o.exportJSON(), u = o.constructor;
62
- if (c.type !== u.getType() && x(58, u.name), g(o)) {
63
- const m = c.children;
64
- Array.isArray(m) || x(59, u.name);
65
- }
66
- return c;
67
- })(a);
68
- if (N(a)) {
69
- const o = a.__text;
70
- o.length > 0 ? l.text = o : r = !1;
71
- }
72
- for (let o = 0; o < s.length; o++) {
73
- const c = s[o], u = S(t, e, c, l.children);
74
- !r && g(n) && u && n.extractWithChild(c, e, "clone") && (r = !0);
75
- }
76
- if (r && !d) i.push(l);
77
- else if (Array.isArray(l.children)) for (let o = 0; o < l.children.length; o++) {
78
- const c = l.children[o];
79
- i.push(c);
80
- }
81
- return r;
82
- }
83
- function J(t, e) {
84
- const n = [], i = b().getChildren();
85
- for (let r = 0; r < i.length; r++)
86
- S(t, e, i[r], n);
87
- return { namespace: t._config.namespace, nodes: n };
88
- }
89
- function z(t) {
90
- const e = [];
91
- for (let n = 0; n < t.length; n++) {
92
- const i = t[n], r = v(i);
93
- N(r) && D(r), e.push(r);
94
- }
95
- return e;
96
- }
97
- let f = null;
98
- async function K(t, e, n) {
99
- if (f !== null) return !1;
100
- if (e !== null) return new Promise(((o, c) => {
101
- t.update((() => {
102
- o(C(t, e, n));
103
- }));
104
- }));
105
- const i = t.getRootElement(), r = t._window || window, d = window.document, a = T(r);
106
- if (i === null || a === null) return !1;
107
- const s = d.createElement("span");
108
- s.style.cssText = "position: fixed; top: -1000px;", s.append(d.createTextNode("#")), i.append(s);
109
- const l = new Range();
110
- return l.setStart(s, 0), l.setEnd(s, 1), a.removeAllRanges(), a.addRange(l), new Promise(((o, c) => {
111
- const u = t.registerCommand(_, ((m) => (R(m, ClipboardEvent) && (u(), f !== null && (window.clearTimeout(f), f = null), o(C(t, m, n))), !0)), A);
112
- f = window.setTimeout((() => {
113
- u(), f = null, o(!1);
114
- }), 50), d.execCommand("copy"), s.remove();
115
- }));
116
- }
117
- function C(t, e, n) {
118
- if (n === void 0) {
119
- const r = T(t._window);
120
- if (!r) return !1;
121
- const d = r.anchorNode, a = r.focusNode;
122
- if (d !== null && a !== null && !L(t, d, a)) return !1;
123
- const s = p();
124
- if (s === null) return !1;
125
- n = B(s);
126
- }
127
- e.preventDefault();
128
- const i = e.clipboardData;
129
- return i !== null && (U(i, n), !0);
130
- }
131
- const W = [["text/html", I], ["application/x-lexical-editor", H]];
132
- function B(t = p()) {
133
- const e = { "text/plain": t ? t.getTextContent() : "" };
134
- if (t) {
135
- const n = P();
136
- for (const [i, r] of W) {
137
- const d = r(n, t);
138
- d !== null && (e[i] = d);
139
- }
140
- }
141
- return e;
142
- }
143
- function U(t, e) {
144
- for (const n in e) {
145
- const i = e[n];
146
- i !== void 0 && t.setData(n, i);
147
- }
148
- }
149
- export {
150
- J as $generateJSONFromSelectedNodes,
151
- z as $generateNodesFromSerializedNodes,
152
- B as $getClipboardDataFromSelection,
153
- I as $getHtmlContent,
154
- H as $getLexicalContent,
155
- G as $insertDataTransferForRichText,
156
- w as $insertGeneratedNodes,
157
- K as copyToClipboard,
158
- U as setLexicalClipboardDataTransfer
159
- };
@@ -1,236 +0,0 @@
1
- "use client";
2
- import { addClassNamesToElement as d, $getAdjacentCaret as D, removeClassNamesFromElement as I } from "../utils/LexicalUtils.prod.js";
3
- import { ElementNode as R, $createParagraphNode as T, $isTextNode as W, $isTabNode as $, $createTabNode as j, $createLineBreakNode as b, $applyNodeReplacement as A, isHTMLElement as B, $getSiblingCaret as q, TextNode as z } from "../../lexical/Lexical.prod.js";
4
- import "../../../_virtual/prism.js";
5
- import "../../prismjs/components/prism-clike.js";
6
- import "../../prismjs/components/prism-javascript.js";
7
- import "../../prismjs/components/prism-markup.js";
8
- import "../../prismjs/components/prism-markdown.js";
9
- import "../../prismjs/components/prism-c.js";
10
- import "../../prismjs/components/prism-css.js";
11
- import "../../prismjs/components/prism-objectivec.js";
12
- import "../../prismjs/components/prism-sql.js";
13
- import "../../prismjs/components/prism-powershell.js";
14
- import "../../../_virtual/prism-python.js";
15
- import "../../../_virtual/prism-rust.js";
16
- import "../../prismjs/components/prism-swift.js";
17
- import "../../../_virtual/prism-typescript.js";
18
- import "../../../_virtual/prism-java.js";
19
- import "../../../_virtual/prism-cpp.js";
20
- const Q = globalThis.Prism || window.Prism, O = (n) => {
21
- try {
22
- return !!n && Q.languages.hasOwnProperty(n);
23
- } catch {
24
- return !1;
25
- }
26
- };
27
- function J(n, e) {
28
- for (const t of n.childNodes) {
29
- if (B(t) && t.tagName === e) return !0;
30
- J(t, e);
31
- }
32
- return !1;
33
- }
34
- const c = "data-language", p = "data-highlight-language";
35
- class f extends R {
36
- static getType() {
37
- return "code";
38
- }
39
- static clone(e) {
40
- return new f(e.__language, e.__key);
41
- }
42
- constructor(e, t) {
43
- super(t), this.__language = e || void 0, this.__isSyntaxHighlightSupported = O(e);
44
- }
45
- createDOM(e) {
46
- const t = document.createElement("code");
47
- d(t, e.theme.code), t.setAttribute("spellcheck", "false");
48
- const r = this.getLanguage();
49
- return r && (t.setAttribute(c, r), this.getIsSyntaxHighlightSupported() && t.setAttribute(p, r)), t;
50
- }
51
- updateDOM(e, t, r) {
52
- const i = this.__language, s = e.__language;
53
- return i ? i !== s && (t.setAttribute(c, i), this.__isSyntaxHighlightSupported && t.setAttribute(p, i)) : s && (t.removeAttribute(c), e.__isSyntaxHighlightSupported && t.removeAttribute(p)), !1;
54
- }
55
- exportDOM(e) {
56
- const t = document.createElement("pre");
57
- d(t, e._config.theme.code), t.setAttribute("spellcheck", "false");
58
- const r = this.getLanguage();
59
- return r && (t.setAttribute(c, r), this.getIsSyntaxHighlightSupported() && t.setAttribute(p, r)), { element: t };
60
- }
61
- static importDOM() {
62
- return { code: (e) => e.textContent != null && (/\r?\n/.test(e.textContent) || J(e, "BR")) ? { conversion: C, priority: 1 } : null, div: () => ({ conversion: X, priority: 1 }), pre: () => ({ conversion: C, priority: 0 }), table: (e) => y(e) ? { conversion: G, priority: 3 } : null, td: (e) => {
63
- const t = e, r = t.closest("table");
64
- return t.classList.contains("js-file-line") || r && y(r) ? { conversion: v, priority: 3 } : null;
65
- }, tr: (e) => {
66
- const t = e.closest("table");
67
- return t && y(t) ? { conversion: v, priority: 3 } : null;
68
- } };
69
- }
70
- static importJSON(e) {
71
- return h().updateFromJSON(e);
72
- }
73
- updateFromJSON(e) {
74
- return super.updateFromJSON(e).setLanguage(e.language);
75
- }
76
- exportJSON() {
77
- return { ...super.exportJSON(), language: this.getLanguage() };
78
- }
79
- insertNewAfter(e, t = !0) {
80
- const r = this.getChildren(), i = r.length;
81
- if (i >= 2 && r[i - 1].getTextContent() === `
82
- ` && r[i - 2].getTextContent() === `
83
- ` && e.isCollapsed() && e.anchor.key === this.__key && e.anchor.offset === i) {
84
- r[i - 1].remove(), r[i - 2].remove();
85
- const o = T();
86
- return this.insertAfter(o, t), o;
87
- }
88
- const { anchor: s, focus: u } = e, a = (s.isBefore(u) ? s : u).getNode();
89
- if (W(a)) {
90
- let o = V(a);
91
- const g = [];
92
- for (; ; ) if ($(o)) g.push(j()), o = o.getNextSibling();
93
- else {
94
- if (!F(o)) break;
95
- {
96
- let l = 0;
97
- const w = o.getTextContent(), x = o.getTextContentSize();
98
- for (; l < x && w[l] === " "; ) l++;
99
- if (l !== 0 && g.push(L(" ".repeat(l))), l !== x) break;
100
- o = o.getNextSibling();
101
- }
102
- }
103
- const _ = a.splitText(s.offset)[0], E = s.offset === 0 ? 0 : 1, P = _.getIndexWithinParent() + E, M = a.getParentOrThrow(), k = [b(), ...g];
104
- M.splice(P, 0, k);
105
- const S = g[g.length - 1];
106
- S ? S.select() : s.offset === 0 ? _.selectPrevious() : _.getNextSibling().selectNext(0, 0);
107
- }
108
- if (U(a)) {
109
- const { offset: o } = e.anchor;
110
- a.splice(o, 0, [b()]), a.select(o + 1, o + 1);
111
- }
112
- return null;
113
- }
114
- canIndent() {
115
- return !1;
116
- }
117
- collapseAtStart() {
118
- const e = T();
119
- return this.getChildren().forEach(((t) => e.append(t))), this.replace(e), !0;
120
- }
121
- setLanguage(e) {
122
- const t = this.getWritable();
123
- return t.__language = e || void 0, t.__isSyntaxHighlightSupported = O(e), t;
124
- }
125
- getLanguage() {
126
- return this.getLatest().__language;
127
- }
128
- getIsSyntaxHighlightSupported() {
129
- return this.getLatest().__isSyntaxHighlightSupported;
130
- }
131
- }
132
- function h(n) {
133
- return A(new f(n));
134
- }
135
- function U(n) {
136
- return n instanceof f;
137
- }
138
- function C(n) {
139
- return { node: h(n.getAttribute(c)) };
140
- }
141
- function X(n) {
142
- const e = n, t = H(e);
143
- return t || (function(r) {
144
- let i = r.parentElement;
145
- for (; i !== null; ) {
146
- if (H(i)) return !0;
147
- i = i.parentElement;
148
- }
149
- return !1;
150
- })(e) ? { node: t ? h() : null } : { node: null };
151
- }
152
- function G() {
153
- return { node: h() };
154
- }
155
- function v() {
156
- return { node: null };
157
- }
158
- function H(n) {
159
- return n.style.fontFamily.match("monospace") !== null;
160
- }
161
- function y(n) {
162
- return n.classList.contains("js-file-line-container");
163
- }
164
- class m extends z {
165
- constructor(e = "", t, r) {
166
- super(e, r), this.__highlightType = t;
167
- }
168
- static getType() {
169
- return "code-highlight";
170
- }
171
- static clone(e) {
172
- return new m(e.__text, e.__highlightType || void 0, e.__key);
173
- }
174
- getHighlightType() {
175
- return this.getLatest().__highlightType;
176
- }
177
- setHighlightType(e) {
178
- const t = this.getWritable();
179
- return t.__highlightType = e || void 0, t;
180
- }
181
- canHaveFormat() {
182
- return !1;
183
- }
184
- createDOM(e) {
185
- const t = super.createDOM(e), r = N(e.theme, this.__highlightType);
186
- return d(t, r), t;
187
- }
188
- updateDOM(e, t, r) {
189
- const i = super.updateDOM(e, t, r), s = N(r.theme, e.__highlightType), u = N(r.theme, this.__highlightType);
190
- return s !== u && (s && I(t, s), u && d(t, u)), i;
191
- }
192
- static importJSON(e) {
193
- return L().updateFromJSON(e);
194
- }
195
- updateFromJSON(e) {
196
- return super.updateFromJSON(e).setHighlightType(e.highlightType);
197
- }
198
- exportJSON() {
199
- return { ...super.exportJSON(), highlightType: this.getHighlightType() };
200
- }
201
- setFormat(e) {
202
- return this;
203
- }
204
- isParentRequired() {
205
- return !0;
206
- }
207
- createParentElementNode() {
208
- return h();
209
- }
210
- }
211
- function N(n, e) {
212
- return e && n && n.codeHighlight && n.codeHighlight[e];
213
- }
214
- function L(n = "", e) {
215
- return A(new m(n, e));
216
- }
217
- function F(n) {
218
- return n instanceof m;
219
- }
220
- function K(n, e) {
221
- let t = n;
222
- for (let r = q(n, e); r && (F(r.origin) || $(r.origin)); r = D(r)) t = r.origin;
223
- return t;
224
- }
225
- function V(n) {
226
- return K(n, "previous");
227
- }
228
- export {
229
- L as $createCodeHighlightNode,
230
- h as $createCodeNode,
231
- V as $getFirstCodeNodeOfLine,
232
- F as $isCodeHighlightNode,
233
- U as $isCodeNode,
234
- m as CodeHighlightNode,
235
- f as CodeNode
236
- };
@@ -1,46 +0,0 @@
1
- "use client";
2
- import { $getSelection as T, $isRangeSelection as v, $isTextNode as N } from "../../lexical/Lexical.prod.js";
3
- function h(g) {
4
- const x = window.location.origin, d = (a) => {
5
- if (a.origin !== x) return;
6
- const R = g.getRootElement();
7
- if (document.activeElement !== R) return;
8
- const f = a.data;
9
- if (typeof f == "string") {
10
- let o;
11
- try {
12
- o = JSON.parse(f);
13
- } catch {
14
- return;
15
- }
16
- if (o && o.protocol === "nuanria_messaging" && o.type === "request") {
17
- const r = o.payload;
18
- if (r && r.functionId === "makeChanges") {
19
- const u = r.args;
20
- if (u) {
21
- const [c, m, p, l, S, y] = u;
22
- g.update((() => {
23
- const i = T();
24
- if (v(i)) {
25
- const w = i.anchor;
26
- let e = w.getNode(), t = 0, n = 0;
27
- if (N(e) && c >= 0 && m >= 0 && (t = c, n = c + m, i.setTextNodeRange(e, t, e, n)), t === n && p === "" || (i.insertRawText(p), e = w.getNode()), N(e)) {
28
- t = l, n = l + S;
29
- const s = e.getTextContentSize();
30
- t = t > s ? s : t, n = n > s ? s : n, i.setTextNodeRange(e, t, e, n);
31
- }
32
- a.stopImmediatePropagation();
33
- }
34
- }));
35
- }
36
- }
37
- }
38
- }
39
- };
40
- return window.addEventListener("message", d, !0), () => {
41
- window.removeEventListener("message", d, !0);
42
- };
43
- }
44
- export {
45
- h as registerDragonSupport
46
- };
@@ -1,89 +0,0 @@
1
- "use client";
2
- import { mergeRegister as G } from "../utils/LexicalUtils.prod.js";
3
- import { CAN_REDO_COMMAND as A, CAN_UNDO_COMMAND as D, CLEAR_HISTORY_COMMAND as J, COMMAND_PRIORITY_EDITOR as x, CLEAR_EDITOR_COMMAND as U, REDO_COMMAND as $, HISTORIC_TAG as H, UNDO_COMMAND as j, HISTORY_PUSH_TAG as w, HISTORY_MERGE_TAG as P, $isRangeSelection as T, $isTextNode as N, $isRootNode as Q } from "../../lexical/Lexical.prod.js";
4
- const E = 0, z = 1, v = 2, c = 0, V = 1, L = 2, b = 3, q = 4;
5
- function B(t, s, d, f, m) {
6
- if (t === null || d.size === 0 && f.size === 0 && !m) return c;
7
- const n = s._selection, r = t._selection;
8
- if (m) return V;
9
- if (!(T(n) && T(r) && r.isCollapsed() && n.isCollapsed())) return c;
10
- const o = (function(p, u, C) {
11
- const O = p._nodeMap, S = [];
12
- for (const M of u) {
13
- const R = O.get(M);
14
- R !== void 0 && S.push(R);
15
- }
16
- for (const [M, R] of C) {
17
- if (!R) continue;
18
- const I = O.get(M);
19
- I === void 0 || Q(I) || S.push(I);
20
- }
21
- return S;
22
- })(s, d, f);
23
- if (o.length === 0) return c;
24
- if (o.length > 1) {
25
- const p = s._nodeMap, u = p.get(n.anchor.key), C = p.get(r.anchor.key);
26
- return u && C && !t._nodeMap.has(u.__key) && N(u) && u.__text.length === 1 && n.anchor.offset === 1 ? L : c;
27
- }
28
- const a = o[0], i = t._nodeMap.get(a.__key);
29
- if (!N(i) || !N(a) || i.__mode !== a.__mode) return c;
30
- const e = i.__text, _ = a.__text;
31
- if (e === _) return c;
32
- const h = n.anchor, g = r.anchor;
33
- if (h.key !== g.key || h.type !== "text") return c;
34
- const l = h.offset, k = g.offset, y = _.length - e.length;
35
- return y === 1 && k === l - 1 ? L : y === -1 && k === l + 1 ? b : y === -1 && k === l ? q : c;
36
- }
37
- function F(t, s) {
38
- let d = Date.now(), f = c;
39
- return (m, n, r, o, a, i) => {
40
- const e = Date.now();
41
- if (i.has(H)) return f = c, d = e, v;
42
- const _ = B(m, n, o, a, t.isComposing()), h = (() => {
43
- const g = r === null || r.editor === t, l = i.has(w);
44
- if (!l && g && i.has(P)) return E;
45
- if (m === null) return z;
46
- const k = n._selection;
47
- return o.size > 0 || a.size > 0 ? l === !1 && _ !== c && _ === f && e < d + s && g || o.size === 1 && (function(y, p, u) {
48
- const C = p._nodeMap.get(y), O = u._nodeMap.get(y), S = p._selection, M = u._selection;
49
- return !(T(S) && T(M) && S.anchor.type === "element" && S.focus.type === "element" && M.anchor.type === "text" && M.focus.type === "text" || !N(C) || !N(O) || C.__parent !== O.__parent) && JSON.stringify(p.read((() => C.exportJSON()))) === JSON.stringify(u.read((() => O.exportJSON())));
50
- })(Array.from(o)[0], m, n) ? E : z : k !== null ? E : v;
51
- })();
52
- return d = e, f = _, h;
53
- };
54
- }
55
- function Y(t) {
56
- t.undoStack = [], t.redoStack = [], t.current = null;
57
- }
58
- function X(t, s, d) {
59
- const f = F(t, d);
60
- return G(t.registerCommand(j, (() => ((function(n, r) {
61
- const o = r.redoStack, a = r.undoStack;
62
- if (a.length !== 0) {
63
- const i = r.current, e = a.pop();
64
- i !== null && (o.push(i), n.dispatchCommand(A, !0)), a.length === 0 && n.dispatchCommand(D, !1), r.current = e || null, e && e.editor.setEditorState(e.editorState, { tag: H });
65
- }
66
- })(t, s), !0)), x), t.registerCommand($, (() => ((function(n, r) {
67
- const o = r.redoStack, a = r.undoStack;
68
- if (o.length !== 0) {
69
- const i = r.current;
70
- i !== null && (a.push(i), n.dispatchCommand(D, !0));
71
- const e = o.pop();
72
- o.length === 0 && n.dispatchCommand(A, !1), r.current = e || null, e && e.editor.setEditorState(e.editorState, { tag: H });
73
- }
74
- })(t, s), !0)), x), t.registerCommand(U, (() => (Y(s), !1)), x), t.registerCommand(J, (() => (Y(s), t.dispatchCommand(A, !1), t.dispatchCommand(D, !1), !0)), x), t.registerUpdateListener((({ editorState: n, prevEditorState: r, dirtyLeaves: o, dirtyElements: a, tags: i }) => {
75
- const e = s.current, _ = s.redoStack, h = s.undoStack, g = e === null ? null : e.editorState;
76
- if (e !== null && n === g) return;
77
- const l = f(r, n, e, o, a, i);
78
- if (l === z) _.length !== 0 && (s.redoStack = [], t.dispatchCommand(A, !1)), e !== null && (h.push({ ...e }), t.dispatchCommand(D, !0));
79
- else if (l === v) return;
80
- s.current = { editor: t, editorState: n };
81
- })));
82
- }
83
- function Z() {
84
- return { current: null, redoStack: [], undoStack: [] };
85
- }
86
- export {
87
- Z as createEmptyHistoryState,
88
- X as registerHistory
89
- };