@react-fabric/lexical 1.0.0-beta.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 (136) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +10 -0
  3. package/dist/cjs/_virtual/prism.js +5 -0
  4. package/dist/cjs/editor/Lexical.module.css +1 -0
  5. package/dist/cjs/node_modules/@lexical/clipboard/LexicalClipboard.dev.js +432 -0
  6. package/dist/cjs/node_modules/@lexical/clipboard/LexicalClipboard.js +21 -0
  7. package/dist/cjs/node_modules/@lexical/clipboard/LexicalClipboard.prod.js +27 -0
  8. package/dist/cjs/node_modules/@lexical/code/LexicalCode.dev.js +1139 -0
  9. package/dist/cjs/node_modules/@lexical/code/LexicalCode.js +25 -0
  10. package/dist/cjs/node_modules/@lexical/code/LexicalCode.prod.js +50 -0
  11. package/dist/cjs/node_modules/@lexical/html/LexicalHtml.dev.js +245 -0
  12. package/dist/cjs/node_modules/@lexical/html/LexicalHtml.js +19 -0
  13. package/dist/cjs/node_modules/@lexical/html/LexicalHtml.prod.js +18 -0
  14. package/dist/cjs/node_modules/@lexical/link/LexicalLink.dev.js +471 -0
  15. package/dist/cjs/node_modules/@lexical/link/LexicalLink.js +17 -0
  16. package/dist/cjs/node_modules/@lexical/link/LexicalLink.prod.js +24 -0
  17. package/dist/cjs/node_modules/@lexical/list/LexicalList.dev.js +1275 -0
  18. package/dist/cjs/node_modules/@lexical/list/LexicalList.js +29 -0
  19. package/dist/cjs/node_modules/@lexical/list/LexicalList.prod.js +29 -0
  20. package/dist/cjs/node_modules/@lexical/rich-text/LexicalRichText.dev.js +789 -0
  21. package/dist/cjs/node_modules/@lexical/rich-text/LexicalRichText.js +29 -0
  22. package/dist/cjs/node_modules/@lexical/rich-text/LexicalRichText.prod.js +26 -0
  23. package/dist/cjs/node_modules/@lexical/selection/LexicalSelection.dev.js +976 -0
  24. package/dist/cjs/node_modules/@lexical/selection/LexicalSelection.js +35 -0
  25. package/dist/cjs/node_modules/@lexical/selection/LexicalSelection.prod.js +35 -0
  26. package/dist/cjs/node_modules/@lexical/table/LexicalTable.dev.js +2792 -0
  27. package/dist/cjs/node_modules/@lexical/table/LexicalTable.js +23 -0
  28. package/dist/cjs/node_modules/@lexical/table/LexicalTable.prod.js +55 -0
  29. package/dist/cjs/node_modules/@lexical/utils/LexicalUtils.dev.js +888 -0
  30. package/dist/cjs/node_modules/@lexical/utils/LexicalUtils.js +35 -0
  31. package/dist/cjs/node_modules/@lexical/utils/LexicalUtils.prod.js +66 -0
  32. package/dist/cjs/node_modules/@mdi/js/mdi.js +8 -0
  33. package/dist/cjs/node_modules/prismjs/components/prism-c.js +82 -0
  34. package/dist/cjs/node_modules/prismjs/components/prism-clike.js +33 -0
  35. package/dist/cjs/node_modules/prismjs/components/prism-cpp.js +101 -0
  36. package/dist/cjs/node_modules/prismjs/components/prism-css.js +66 -0
  37. package/dist/cjs/node_modules/prismjs/components/prism-java.js +126 -0
  38. package/dist/cjs/node_modules/prismjs/components/prism-javascript.js +174 -0
  39. package/dist/cjs/node_modules/prismjs/components/prism-markdown.js +417 -0
  40. package/dist/cjs/node_modules/prismjs/components/prism-markup.js +188 -0
  41. package/dist/cjs/node_modules/prismjs/components/prism-objectivec.js +14 -0
  42. package/dist/cjs/node_modules/prismjs/components/prism-powershell.js +60 -0
  43. package/dist/cjs/node_modules/prismjs/components/prism-python.js +67 -0
  44. package/dist/cjs/node_modules/prismjs/components/prism-rust.js +130 -0
  45. package/dist/cjs/node_modules/prismjs/components/prism-sql.js +34 -0
  46. package/dist/cjs/node_modules/prismjs/components/prism-swift.js +150 -0
  47. package/dist/cjs/node_modules/prismjs/components/prism-typescript.js +62 -0
  48. package/dist/cjs/node_modules/prismjs/prism.js +1951 -0
  49. package/dist/cjs/packages/lexical/src/components/StickyComponent.js +221 -0
  50. package/dist/cjs/packages/lexical/src/editor/LexicalEditor.js +156 -0
  51. package/dist/cjs/packages/lexical/src/editor/theme.js +97 -0
  52. package/dist/cjs/packages/lexical/src/hooks/useFormatWatcher.js +451 -0
  53. package/dist/cjs/packages/lexical/src/index.js +7 -0
  54. package/dist/cjs/packages/lexical/src/nodes/StickyNode.js +218 -0
  55. package/dist/cjs/packages/lexical/src/plugins/DraggableBlockPlugin.js +314 -0
  56. package/dist/cjs/packages/lexical/src/plugins/StickyPlugin.js +20 -0
  57. package/dist/cjs/packages/lexical/src/plugins/ToolbarPlugin.js +258 -0
  58. package/dist/cjs/packages/lexical/src/utils/index.js +214 -0
  59. package/dist/esm/_virtual/prism.js +5 -0
  60. package/dist/esm/editor/Lexical.module.css +1 -0
  61. package/dist/esm/node_modules/@lexical/clipboard/LexicalClipboard.dev.js +423 -0
  62. package/dist/esm/node_modules/@lexical/clipboard/LexicalClipboard.js +19 -0
  63. package/dist/esm/node_modules/@lexical/clipboard/LexicalClipboard.prod.js +18 -0
  64. package/dist/esm/node_modules/@lexical/code/LexicalCode.dev.js +1121 -0
  65. package/dist/esm/node_modules/@lexical/code/LexicalCode.js +21 -0
  66. package/dist/esm/node_modules/@lexical/code/LexicalCode.prod.js +32 -0
  67. package/dist/esm/node_modules/@lexical/html/LexicalHtml.dev.js +244 -0
  68. package/dist/esm/node_modules/@lexical/html/LexicalHtml.js +18 -0
  69. package/dist/esm/node_modules/@lexical/html/LexicalHtml.prod.js +17 -0
  70. package/dist/esm/node_modules/@lexical/link/LexicalLink.dev.js +463 -0
  71. package/dist/esm/node_modules/@lexical/link/LexicalLink.js +17 -0
  72. package/dist/esm/node_modules/@lexical/link/LexicalLink.prod.js +16 -0
  73. package/dist/esm/node_modules/@lexical/list/LexicalList.dev.js +1262 -0
  74. package/dist/esm/node_modules/@lexical/list/LexicalList.js +23 -0
  75. package/dist/esm/node_modules/@lexical/list/LexicalList.prod.js +16 -0
  76. package/dist/esm/node_modules/@lexical/rich-text/LexicalRichText.dev.js +781 -0
  77. package/dist/esm/node_modules/@lexical/rich-text/LexicalRichText.js +23 -0
  78. package/dist/esm/node_modules/@lexical/rich-text/LexicalRichText.prod.js +18 -0
  79. package/dist/esm/node_modules/@lexical/selection/LexicalSelection.dev.js +957 -0
  80. package/dist/esm/node_modules/@lexical/selection/LexicalSelection.js +26 -0
  81. package/dist/esm/node_modules/@lexical/selection/LexicalSelection.prod.js +16 -0
  82. package/dist/esm/node_modules/@lexical/table/LexicalTable.dev.js +2754 -0
  83. package/dist/esm/node_modules/@lexical/table/LexicalTable.js +20 -0
  84. package/dist/esm/node_modules/@lexical/table/LexicalTable.prod.js +17 -0
  85. package/dist/esm/node_modules/@lexical/utils/LexicalUtils.dev.js +839 -0
  86. package/dist/esm/node_modules/@lexical/utils/LexicalUtils.js +26 -0
  87. package/dist/esm/node_modules/@lexical/utils/LexicalUtils.prod.js +17 -0
  88. package/dist/esm/node_modules/@mdi/js/mdi.js +7 -0
  89. package/dist/esm/node_modules/prismjs/components/prism-c.js +82 -0
  90. package/dist/esm/node_modules/prismjs/components/prism-clike.js +33 -0
  91. package/dist/esm/node_modules/prismjs/components/prism-cpp.js +101 -0
  92. package/dist/esm/node_modules/prismjs/components/prism-css.js +66 -0
  93. package/dist/esm/node_modules/prismjs/components/prism-java.js +126 -0
  94. package/dist/esm/node_modules/prismjs/components/prism-javascript.js +174 -0
  95. package/dist/esm/node_modules/prismjs/components/prism-markdown.js +417 -0
  96. package/dist/esm/node_modules/prismjs/components/prism-markup.js +188 -0
  97. package/dist/esm/node_modules/prismjs/components/prism-objectivec.js +14 -0
  98. package/dist/esm/node_modules/prismjs/components/prism-powershell.js +60 -0
  99. package/dist/esm/node_modules/prismjs/components/prism-python.js +67 -0
  100. package/dist/esm/node_modules/prismjs/components/prism-rust.js +130 -0
  101. package/dist/esm/node_modules/prismjs/components/prism-sql.js +34 -0
  102. package/dist/esm/node_modules/prismjs/components/prism-swift.js +150 -0
  103. package/dist/esm/node_modules/prismjs/components/prism-typescript.js +62 -0
  104. package/dist/esm/node_modules/prismjs/prism.js +1951 -0
  105. package/dist/esm/packages/lexical/src/components/StickyComponent.js +221 -0
  106. package/dist/esm/packages/lexical/src/editor/LexicalEditor.js +156 -0
  107. package/dist/esm/packages/lexical/src/editor/theme.js +97 -0
  108. package/dist/esm/packages/lexical/src/hooks/useFormatWatcher.js +450 -0
  109. package/dist/esm/packages/lexical/src/index.js +3 -0
  110. package/dist/esm/packages/lexical/src/nodes/StickyNode.js +216 -0
  111. package/dist/esm/packages/lexical/src/plugins/DraggableBlockPlugin.js +314 -0
  112. package/dist/esm/packages/lexical/src/plugins/StickyPlugin.js +20 -0
  113. package/dist/esm/packages/lexical/src/plugins/ToolbarPlugin.js +258 -0
  114. package/dist/esm/packages/lexical/src/utils/index.js +211 -0
  115. package/dist/types/components/StickyComponent.d.ts +9 -0
  116. package/dist/types/editor/LexicalEditor.d.ts +13 -0
  117. package/dist/types/editor/theme.d.ts +70 -0
  118. package/dist/types/hooks/useFormatWatcher.d.ts +40 -0
  119. package/dist/types/index.d.ts +1 -0
  120. package/dist/types/nodes/StickyNode.d.ts +35 -0
  121. package/dist/types/plugins/DraggableBlockPlugin.d.ts +3 -0
  122. package/dist/types/plugins/StickyPlugin.d.ts +1 -0
  123. package/dist/types/plugins/ToolbarPlugin.d.ts +1 -0
  124. package/dist/types/utils/index.d.ts +57 -0
  125. package/package.json +55 -0
  126. package/src/components/StickyComponent.tsx +271 -0
  127. package/src/editor/Lexical.module.css +218 -0
  128. package/src/editor/LexicalEditor.tsx +222 -0
  129. package/src/editor/theme.ts +93 -0
  130. package/src/hooks/useFormatWatcher.ts +504 -0
  131. package/src/index.ts +24 -0
  132. package/src/nodes/StickyNode.tsx +249 -0
  133. package/src/plugins/DraggableBlockPlugin.tsx +418 -0
  134. package/src/plugins/StickyPlugin.ts +38 -0
  135. package/src/plugins/ToolbarPlugin.tsx +279 -0
  136. package/src/utils/index.ts +303 -0
@@ -0,0 +1,211 @@
1
+ 'use client';
2
+
3
+ import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
4
+ import _classCallCheck from '@babel/runtime/helpers/classCallCheck';
5
+ import _createClass from '@babel/runtime/helpers/createClass';
6
+ import '@react-fabric/utilities';
7
+
8
+ function isHTMLElement(x) {
9
+ return x instanceof HTMLElement;
10
+ }
11
+ var Point = /*#__PURE__*/function () {
12
+ function Point(x, y) {
13
+ _classCallCheck(this, Point);
14
+ this._x = x;
15
+ this._y = y;
16
+ }
17
+ return _createClass(Point, [{
18
+ key: "x",
19
+ get: function get() {
20
+ return this._x;
21
+ }
22
+ }, {
23
+ key: "y",
24
+ get: function get() {
25
+ return this._y;
26
+ }
27
+ }, {
28
+ key: "equals",
29
+ value: function equals(_ref) {
30
+ var x = _ref.x,
31
+ y = _ref.y;
32
+ return this.x === x && this.y === y;
33
+ }
34
+ }, {
35
+ key: "calcDeltaXTo",
36
+ value: function calcDeltaXTo(_ref2) {
37
+ var x = _ref2.x;
38
+ return this.x - x;
39
+ }
40
+ }, {
41
+ key: "calcDeltaYTo",
42
+ value: function calcDeltaYTo(_ref3) {
43
+ var y = _ref3.y;
44
+ return this.y - y;
45
+ }
46
+ }, {
47
+ key: "calcHorizontalDistanceTo",
48
+ value: function calcHorizontalDistanceTo(point) {
49
+ return Math.abs(this.calcDeltaXTo(point));
50
+ }
51
+ }, {
52
+ key: "calcVerticalDistance",
53
+ value: function calcVerticalDistance(point) {
54
+ return Math.abs(this.calcDeltaYTo(point));
55
+ }
56
+ }, {
57
+ key: "calcDistanceTo",
58
+ value: function calcDistanceTo(point) {
59
+ return Math.sqrt(Math.pow(this.calcDeltaXTo(point), 2) + Math.pow(this.calcDeltaYTo(point), 2));
60
+ }
61
+ }]);
62
+ }();
63
+ function isPoint(x) {
64
+ return x instanceof Point;
65
+ }
66
+ var Rect = /*#__PURE__*/function () {
67
+ function Rect(left, top, right, bottom) {
68
+ _classCallCheck(this, Rect);
69
+ var _ref4 = top <= bottom ? [top, bottom] : [bottom, top],
70
+ _ref5 = _slicedToArray(_ref4, 2),
71
+ physicTop = _ref5[0],
72
+ physicBottom = _ref5[1];
73
+ var _ref6 = left <= right ? [left, right] : [right, left],
74
+ _ref7 = _slicedToArray(_ref6, 2),
75
+ physicLeft = _ref7[0],
76
+ physicRight = _ref7[1];
77
+ this._top = physicTop;
78
+ this._right = physicRight;
79
+ this._left = physicLeft;
80
+ this._bottom = physicBottom;
81
+ }
82
+ return _createClass(Rect, [{
83
+ key: "top",
84
+ get: function get() {
85
+ return this._top;
86
+ }
87
+ }, {
88
+ key: "right",
89
+ get: function get() {
90
+ return this._right;
91
+ }
92
+ }, {
93
+ key: "bottom",
94
+ get: function get() {
95
+ return this._bottom;
96
+ }
97
+ }, {
98
+ key: "left",
99
+ get: function get() {
100
+ return this._left;
101
+ }
102
+ }, {
103
+ key: "width",
104
+ get: function get() {
105
+ return Math.abs(this._left - this._right);
106
+ }
107
+ }, {
108
+ key: "height",
109
+ get: function get() {
110
+ return Math.abs(this._bottom - this._top);
111
+ }
112
+ }, {
113
+ key: "equals",
114
+ value: function equals(_ref8) {
115
+ var top = _ref8.top,
116
+ left = _ref8.left,
117
+ bottom = _ref8.bottom,
118
+ right = _ref8.right;
119
+ return top === this._top && bottom === this._bottom && left === this._left && right === this._right;
120
+ }
121
+ }, {
122
+ key: "contains",
123
+ value: function contains(target) {
124
+ if (isPoint(target)) {
125
+ var x = target.x,
126
+ y = target.y;
127
+ var isOnTopSide = y < this._top;
128
+ var isOnBottomSide = y > this._bottom;
129
+ var isOnLeftSide = x < this._left;
130
+ var isOnRightSide = x > this._right;
131
+ var result = !isOnTopSide && !isOnBottomSide && !isOnLeftSide && !isOnRightSide;
132
+ return {
133
+ reason: {
134
+ isOnBottomSide: isOnBottomSide,
135
+ isOnLeftSide: isOnLeftSide,
136
+ isOnRightSide: isOnRightSide,
137
+ isOnTopSide: isOnTopSide
138
+ },
139
+ result: result
140
+ };
141
+ } else {
142
+ var top = target.top,
143
+ left = target.left,
144
+ bottom = target.bottom,
145
+ right = target.right;
146
+ return top >= this._top && top <= this._bottom && bottom >= this._top && bottom <= this._bottom && left >= this._left && left <= this._right && right >= this._left && right <= this._right;
147
+ }
148
+ }
149
+ }, {
150
+ key: "intersectsWith",
151
+ value: function intersectsWith(rect) {
152
+ var x1 = rect.left,
153
+ y1 = rect.top,
154
+ w1 = rect.width,
155
+ h1 = rect.height;
156
+ var x2 = this.left,
157
+ y2 = this.top,
158
+ w2 = this.width,
159
+ h2 = this.height;
160
+ var maxX = x1 + w1 >= x2 + w2 ? x1 + w1 : x2 + w2;
161
+ var maxY = y1 + h1 >= y2 + h2 ? y1 + h1 : y2 + h2;
162
+ var minX = x1 <= x2 ? x1 : x2;
163
+ var minY = y1 <= y2 ? y1 : y2;
164
+ return maxX - minX <= w1 + w2 && maxY - minY <= h1 + h2;
165
+ }
166
+ }, {
167
+ key: "generateNewRect",
168
+ value: function generateNewRect(_ref9) {
169
+ var _ref9$left = _ref9.left,
170
+ left = _ref9$left === void 0 ? this.left : _ref9$left,
171
+ _ref9$top = _ref9.top,
172
+ top = _ref9$top === void 0 ? this.top : _ref9$top,
173
+ _ref9$right = _ref9.right,
174
+ right = _ref9$right === void 0 ? this.right : _ref9$right,
175
+ _ref9$bottom = _ref9.bottom,
176
+ bottom = _ref9$bottom === void 0 ? this.bottom : _ref9$bottom;
177
+ return new Rect(left, top, right, bottom);
178
+ }
179
+ }], [{
180
+ key: "fromLTRB",
181
+ value: function fromLTRB(left, top, right, bottom) {
182
+ return new Rect(left, top, right, bottom);
183
+ }
184
+ }, {
185
+ key: "fromLWTH",
186
+ value: function fromLWTH(left, width, top, height) {
187
+ return new Rect(left, top, left + width, top + height);
188
+ }
189
+ }, {
190
+ key: "fromPoints",
191
+ value: function fromPoints(startPoint, endPoint) {
192
+ var top = startPoint.y,
193
+ left = startPoint.x;
194
+ var bottom = endPoint.y,
195
+ right = endPoint.x;
196
+ return Rect.fromLTRB(left, top, right, bottom);
197
+ }
198
+ }, {
199
+ key: "fromDOM",
200
+ value: function fromDOM(dom) {
201
+ var _dom$getBoundingClien = dom.getBoundingClientRect(),
202
+ top = _dom$getBoundingClien.top,
203
+ width = _dom$getBoundingClien.width,
204
+ left = _dom$getBoundingClien.left,
205
+ height = _dom$getBoundingClien.height;
206
+ return Rect.fromLWTH(left, width, top, height);
207
+ }
208
+ }]);
209
+ }();
210
+
211
+ export { Point, Rect, isHTMLElement, isPoint };
@@ -0,0 +1,9 @@
1
+ import { type NodeKey } from "lexical";
2
+ export declare const StickyComponent: ({ x, y, nodeKey, color, state, user, }: {
3
+ user: string;
4
+ state?: AnyObject;
5
+ color: "pink" | "yellow";
6
+ nodeKey: NodeKey;
7
+ x: number;
8
+ y: number;
9
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,13 @@
1
+ export interface EditorProps {
2
+ value?: string | AnyObject;
3
+ readOnly?: boolean;
4
+ /**
5
+ * publish mode removes all wrapping and renders plain lexical view for exporting to pdf using puppeteer
6
+ */
7
+ publishMode?: boolean;
8
+ header?: string;
9
+ footer?: string;
10
+ onChange?: (value: KeyValue) => void;
11
+ onDirty?: (isDirty: boolean) => void;
12
+ }
13
+ export declare const LexicalEditor: ({ value, readOnly, publishMode, onChange, onDirty, }: EditorProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,70 @@
1
+ export declare const LexicalTheme: {
2
+ ltr: string;
3
+ rtl: string;
4
+ paragraph: string;
5
+ quote: string;
6
+ heading: {
7
+ h1: string;
8
+ h2: string;
9
+ h3: string;
10
+ h4: string;
11
+ h5: string;
12
+ h6: string;
13
+ };
14
+ list: {
15
+ nested: {
16
+ listitem: string;
17
+ };
18
+ ol: string;
19
+ ul: string;
20
+ listitem: string;
21
+ listitemChecked: string;
22
+ listitemUnchecked: string;
23
+ };
24
+ hashtag: string;
25
+ image: string;
26
+ link: string;
27
+ text: {
28
+ bold: string;
29
+ code: string;
30
+ italic: string;
31
+ strikethrough: string;
32
+ subscript: string;
33
+ superscript: string;
34
+ underline: string;
35
+ underlineStrikethrough: string;
36
+ };
37
+ code: string;
38
+ codeHighlight: {
39
+ atrule: string;
40
+ attr: string;
41
+ boolean: string;
42
+ builtin: string;
43
+ cdata: string;
44
+ char: string;
45
+ class: string;
46
+ "class-name": string;
47
+ comment: string;
48
+ constant: string;
49
+ deleted: string;
50
+ doctype: string;
51
+ entity: string;
52
+ function: string;
53
+ important: string;
54
+ inserted: string;
55
+ keyword: string;
56
+ namespace: string;
57
+ number: string;
58
+ operator: string;
59
+ prolog: string;
60
+ property: string;
61
+ punctuation: string;
62
+ regex: string;
63
+ selector: string;
64
+ string: string;
65
+ symbol: string;
66
+ tag: string;
67
+ url: string;
68
+ variable: string;
69
+ };
70
+ };
@@ -0,0 +1,40 @@
1
+ import { type HeadingTagType } from "@lexical/rich-text";
2
+ import { type ElementNode, type RangeSelection, type TextNode } from "lexical";
3
+ export declare function getSelectedNode(selection: RangeSelection): TextNode | ElementNode;
4
+ export declare const useFormatWatcher: () => {
5
+ editor: import("lexical").LexicalEditor;
6
+ blockType: "number" | "paragraph" | "code" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "bullet" | "check" | "quote";
7
+ rootType: "table" | "root";
8
+ selectedElementKey: string | null;
9
+ fontSize: string;
10
+ fontColor: string;
11
+ bgColor: string;
12
+ fontFamily: string;
13
+ isLink: boolean;
14
+ isBold: boolean;
15
+ isItalic: boolean;
16
+ isUnderline: boolean;
17
+ isStrikethrough: boolean;
18
+ isSubscript: boolean;
19
+ isSuperscript: boolean;
20
+ isCode: boolean;
21
+ canUndo: boolean;
22
+ canRedo: boolean;
23
+ isRTL: boolean;
24
+ isEditable: boolean;
25
+ codeLanguage: string;
26
+ activeEditor: import("lexical").LexicalEditor;
27
+ indent: () => void;
28
+ outdent: () => void;
29
+ clearFormatting: () => void;
30
+ onFontColorSelect: (value: string) => void;
31
+ onBgColorSelect: (value: string) => void;
32
+ formatQuote: () => void;
33
+ onSizeChange: (value: string) => void;
34
+ formatBlock: () => void;
35
+ formatNormal: () => void;
36
+ formatHeading: (headingSize: HeadingTagType) => void;
37
+ formatBulletList: () => void;
38
+ formatCheckList: () => void;
39
+ formatNumberedList: () => void;
40
+ };
@@ -0,0 +1 @@
1
+ export { LexicalEditor } from "./editor/LexicalEditor";
@@ -0,0 +1,35 @@
1
+ /// <reference types="react" />
2
+ import { DecoratorNode, type DOMConversionMap, type DOMExportOutput, type EditorConfig, type LexicalEditor, type LexicalNode, type NodeKey, type SerializedLexicalNode, type Spread } from "lexical";
3
+ type StickyNoteColor = "pink" | "yellow" | "green" | "blue";
4
+ interface StickyNodeType {
5
+ xOffset: number;
6
+ yOffset: number;
7
+ user?: string;
8
+ color?: StickyNoteColor;
9
+ state?: AnyObject;
10
+ }
11
+ export type SerializedStickyNode = Spread<StickyNodeType, SerializedLexicalNode>;
12
+ export declare class StickyNode extends DecoratorNode<JSX.Element> {
13
+ __x: number;
14
+ __y: number;
15
+ __user: string;
16
+ __state?: AnyObject;
17
+ __color: StickyNoteColor;
18
+ static getType(): string;
19
+ static clone(node: StickyNode): StickyNode;
20
+ static importJSON(serializedNode: SerializedStickyNode): StickyNode;
21
+ static importDOM(): DOMConversionMap | null;
22
+ constructor(x: number, y: number, user?: string, color?: StickyNoteColor, state?: KeyValue, key?: NodeKey);
23
+ exportJSON(): SerializedStickyNode;
24
+ createDOM(config: EditorConfig): HTMLElement;
25
+ updateDOM(): false;
26
+ exportDOM(): DOMExportOutput;
27
+ setPosition(x: number, y: number): void;
28
+ toggleColor(): void;
29
+ updateState(text: KeyValue): void;
30
+ decorate(editor: LexicalEditor, config: EditorConfig): JSX.Element;
31
+ isIsolated(): true;
32
+ }
33
+ export declare function $isStickyNode(node: LexicalNode | null | undefined): node is StickyNode;
34
+ export declare function $createStickyNode({ xOffset, yOffset, user, color, state, }: StickyNodeType): StickyNode;
35
+ export {};
@@ -0,0 +1,3 @@
1
+ export declare const DraggableBlockPlugin: ({ anchorElem, }: {
2
+ anchorElem?: HTMLElement;
3
+ }) => JSX.Element;
@@ -0,0 +1 @@
1
+ export declare const StickyPlugin: () => JSX.Element | null;
@@ -0,0 +1 @@
1
+ export declare const ToolbarPlugin: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,57 @@
1
+ export declare function isHTMLElement(x: unknown): x is HTMLElement;
2
+ export declare class Point {
3
+ private readonly _x;
4
+ private readonly _y;
5
+ constructor(x: number, y: number);
6
+ get x(): number;
7
+ get y(): number;
8
+ equals({ x, y }: Point): boolean;
9
+ calcDeltaXTo({ x }: Point): number;
10
+ calcDeltaYTo({ y }: Point): number;
11
+ calcHorizontalDistanceTo(point: Point): number;
12
+ calcVerticalDistance(point: Point): number;
13
+ calcDistanceTo(point: Point): number;
14
+ }
15
+ export declare function isPoint(x: unknown): x is Point;
16
+ interface ContainsPointReturn {
17
+ result: boolean;
18
+ reason: {
19
+ isOnTopSide: boolean;
20
+ isOnBottomSide: boolean;
21
+ isOnLeftSide: boolean;
22
+ isOnRightSide: boolean;
23
+ };
24
+ }
25
+ export declare class Rect {
26
+ private readonly _left;
27
+ private readonly _top;
28
+ private readonly _right;
29
+ private readonly _bottom;
30
+ constructor(left: number, top: number, right: number, bottom: number);
31
+ get top(): number;
32
+ get right(): number;
33
+ get bottom(): number;
34
+ get left(): number;
35
+ get width(): number;
36
+ get height(): number;
37
+ equals({ top, left, bottom, right }: Rect): boolean;
38
+ contains({ x, y }: Point): ContainsPointReturn;
39
+ contains({ top, left, bottom, right }: Rect): boolean;
40
+ intersectsWith(rect: Rect): boolean;
41
+ generateNewRect({ left, top, right, bottom, }: {
42
+ left?: number | undefined;
43
+ top?: number | undefined;
44
+ right?: number | undefined;
45
+ bottom?: number | undefined;
46
+ }): Rect;
47
+ static fromLTRB(left: number, top: number, right: number, bottom: number): Rect;
48
+ static fromLWTH(left: number, width: number, top: number, height: number): Rect;
49
+ static fromPoints(startPoint: Point, endPoint: Point): Rect;
50
+ static fromDOM(dom: HTMLElement): Rect;
51
+ }
52
+ export declare const convertLatLng: (lonLat: AnyObject) => any[];
53
+ export declare const convertToDMS: (coord: number, isLat?: boolean) => string;
54
+ export declare const getLocationAsText: (latlon: AnyObject) => string;
55
+ export declare const getLocationUrl: (latlon: AnyObject) => string;
56
+ export declare const bookmarksFilterHookMatcher: (bookmark: KeyValue, query: string) => any;
57
+ export {};
package/package.json ADDED
@@ -0,0 +1,55 @@
1
+ {
2
+ "name": "@react-fabric/lexical",
3
+ "version": "1.0.0-beta.0",
4
+ "description": "RUF: Lexical editor",
5
+ "author": "Adarsh Pastakia <adarshpastakia@outlook.com>",
6
+ "license": "MIT",
7
+ "repository": "https://github.com/adarshpastakia/react-ui-framework/tree/main/packages/lexical",
8
+ "source": "src/index.ts",
9
+ "main": "dist/cjs/index.js",
10
+ "module": "dist/esm/index.js",
11
+ "types": "dist/types/index.d.ts",
12
+ "directories": {
13
+ "src": "src",
14
+ "test": "tests"
15
+ },
16
+ "files": [
17
+ "src",
18
+ "dist"
19
+ ],
20
+ "publishConfig": {
21
+ "access": "public",
22
+ "registry": "https://registry.npmjs.org/"
23
+ },
24
+ "scripts": {
25
+ "makelink": "yarn link",
26
+ "removelink": "yarn unlink",
27
+ "prebuild": "rm -rf ./dist",
28
+ "build:dts": "tsc -p ./tsconfig.build.json",
29
+ "build:rollup": "rollup -c ../../rollup.config.mjs",
30
+ "build": "npm-run-all -p build:rollup build:dts",
31
+ "watch:dts": "tsc -w -p ./tsconfig.build.json",
32
+ "watch:rollup": "rollup -w -c ../../rollup.config.mjs",
33
+ "watch": "npm-run-all -p watch:rollup watch:dts"
34
+ },
35
+ "dependencies": {
36
+ "@lexical/headless": "^0.17.1",
37
+ "@lexical/react": "^0.17.1",
38
+ "@react-fabric/core": "^1.0.0-beta.0",
39
+ "@react-fabric/form": "^1.0.0-beta.0",
40
+ "@react-fabric/utilities": "^1.0.0-beta.0",
41
+ "classnames": "^2.5.1",
42
+ "lexical": "^0.17.1"
43
+ },
44
+ "peerDependencies": {
45
+ "i18next": "^23.15.1",
46
+ "react": ">=18.0.0 <20.0.0",
47
+ "react-dom": ">=18.0.0 <20.0.0",
48
+ "react-i18next": "^15.0.2"
49
+ },
50
+ "engines": {
51
+ "node": ">=18.12.0",
52
+ "npm": ">=8.19.0"
53
+ },
54
+ "gitHead": "83fa79064b1d57e71149005432192d506810bbda"
55
+ }