@crystallize/design-system 1.12.0 → 1.13.2
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.
- package/CHANGELOG.md +19 -0
- package/dist/draggable-block-menu-KKHDNKJA.svg +1 -0
- package/dist/index.css +565 -1025
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3295 -3431
- package/dist/index.mjs +3199 -3335
- package/package.json +6 -7
- package/src/button/Button.stories.tsx +1 -0
- package/src/card/card.stories.tsx +1 -0
- package/src/checkbox/checkbox.stories.tsx +1 -1
- package/src/checkbox/checkbox.tsx +1 -1
- package/src/colors/Colors.stories.tsx +3 -3
- package/src/dialog/config.tsx +1 -1
- package/src/dialog/index.tsx +1 -1
- package/src/dropdown-menu/dropdown-menu-item.tsx +2 -2
- package/src/dropdown-menu/dropdown-menu-label.tsx +1 -1
- package/src/icon-button/IconButton.stories.tsx +1 -0
- package/src/iconography/Icon.stories.tsx +1 -0
- package/src/inline-radio/inline-radio.stories.tsx +3 -3
- package/src/inline-radio/inline-radio.tsx +2 -2
- package/src/input/input.tsx +1 -1
- package/src/input-with-label/input-with-label.tsx +1 -1
- package/src/label/label.stories.tsx +1 -0
- package/src/progress/Progress.stories.tsx +2 -1
- package/src/progress/progress.tsx +1 -1
- package/src/radio/radio.stories.tsx +1 -1
- package/src/radio/radio.tsx +1 -1
- package/src/rich-text-editor/i18n/translations/en.ts +2 -2
- package/src/rich-text-editor/plugins/ActionsPlugin/index.css +3 -0
- package/src/rich-text-editor/plugins/ActionsPlugin/index.tsx +1 -2
- package/src/rich-text-editor/plugins/AutoLinkPlugin/index.tsx +1 -1
- package/src/rich-text-editor/plugins/CodeActionMenuPlugin/components/CopyButton/index.tsx +6 -2
- package/src/rich-text-editor/plugins/CodeActionMenuPlugin/components/PrettierButton/index.tsx +10 -6
- package/src/rich-text-editor/plugins/CodeActionMenuPlugin/index.css +32 -17
- package/src/rich-text-editor/plugins/CodeActionMenuPlugin/index.tsx +3 -4
- package/src/rich-text-editor/plugins/DimensionsDetectorPlugin/index.tsx +49 -0
- package/src/rich-text-editor/plugins/DraggableBlockPlugin/index.css +14 -14
- package/src/rich-text-editor/plugins/DraggableBlockPlugin/index.tsx +4 -4
- package/src/rich-text-editor/plugins/FloatingLinkEditorPlugin/index.css +87 -21
- package/src/rich-text-editor/plugins/FloatingLinkEditorPlugin/index.tsx +11 -17
- package/src/rich-text-editor/plugins/FloatingTextFormatToolbarPlugin/index.css +10 -2
- package/src/rich-text-editor/plugins/FloatingTextFormatToolbarPlugin/index.tsx +17 -17
- package/src/rich-text-editor/plugins/LinkPlugin/index.tsx +1 -1
- package/src/rich-text-editor/plugins/ListMaxIndentLevelPlugin/index.ts +10 -21
- package/src/rich-text-editor/plugins/TableActionMenuPlugin/index.css +6 -0
- package/src/rich-text-editor/plugins/TableActionMenuPlugin/index.tsx +2 -2
- package/src/rich-text-editor/plugins/ToolbarPlugin/index.css +115 -0
- package/src/rich-text-editor/plugins/ToolbarPlugin/index.tsx +57 -78
- package/src/rich-text-editor/plugins/ToolbarPlugin/insert-table.tsx +5 -5
- package/src/rich-text-editor/rich-text-editor-icons.css +213 -0
- package/src/rich-text-editor/rich-text-editor.css +33 -913
- package/src/rich-text-editor/rich-text-editor.stories.tsx +11 -0
- package/src/rich-text-editor/rich-text-editor.tsx +13 -27
- package/src/rich-text-editor/themes/CrystallizeRTEditorTheme.ts +1 -1
- package/src/rich-text-editor/ui/LinkPreview.tsx +7 -8
- package/src/rich-text-editor/utils/getSelectedNode.ts +4 -5
- package/src/rich-text-editor/utils/point.ts +4 -7
- package/src/rich-text-editor/utils/rect.ts +18 -41
- package/src/rich-text-editor/utils/url.ts +1 -2
- package/src/select/select-root.tsx +1 -1
- package/src/select/select.stories.tsx +1 -1
- package/src/select/select.ts +0 -1
- package/src/slider/Slider.stories.tsx +2 -1
- package/src/slider/slider.tsx +2 -2
- package/src/spinner/Spinner.stories.tsx +1 -0
- package/src/spinner/index.tsx +1 -1
- package/src/tag/Tag.stories.tsx +1 -0
- package/dist/camera-CR7D2PNH.svg +0 -1
- package/dist/clipboard-OSEFDF25.svg +0 -1
- package/dist/gear-ICMT4NTP.svg +0 -1
- package/dist/journal-code-XUT44HDV.svg +0 -1
- package/dist/lock-WCYOZOHW.svg +0 -1
- package/dist/lock-fill-JZSKOSHK.svg +0 -1
- package/dist/pencil-fill-STFSC26F.svg +0 -1
- package/dist/plug-HGGGEVS3.svg +0 -1
- package/dist/plug-fill-OTG3U4TN.svg +0 -1
- package/src/rich-text-editor/hooks/useReport.ts +0 -64
- package/src/rich-text-editor/plugins/CodeActionMenuPlugin/components/PrettierButton/index.css +0 -14
- package/src/rich-text-editor/ui/LinkPreview.css +0 -57
- package/src/rich-text-editor/utils/isMobileWidth.ts +0 -7
- package/src/rich-text-editor/utils/joinClasses.ts +0 -13
- package/src/rich-text-editor/utils/swipe.ts +0 -127
|
@@ -182,6 +182,17 @@ const fullModel: CrystallizeRichText = [
|
|
|
182
182
|
},
|
|
183
183
|
],
|
|
184
184
|
},
|
|
185
|
+
{
|
|
186
|
+
kind: 'block',
|
|
187
|
+
type: 'quote',
|
|
188
|
+
textContent:
|
|
189
|
+
'We hold these truths to be self-evident: all men and women are created, by the, you know the, you know the thing.',
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
kind: 'block',
|
|
193
|
+
type: 'paragraph',
|
|
194
|
+
textContent: 'Joe Biden',
|
|
195
|
+
},
|
|
185
196
|
];
|
|
186
197
|
|
|
187
198
|
export const AllElements: Story = {
|
|
@@ -13,6 +13,7 @@ import { TabIndentationPlugin } from '@lexical/react/LexicalTabIndentationPlugin
|
|
|
13
13
|
import { TablePlugin } from '@lexical/react/LexicalTablePlugin';
|
|
14
14
|
|
|
15
15
|
import './rich-text-editor.css';
|
|
16
|
+
import './plugins/FloatingLinkEditorPlugin/index.css';
|
|
16
17
|
import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
|
|
17
18
|
import { ContentEditable } from '@lexical/react/LexicalContentEditable';
|
|
18
19
|
|
|
@@ -25,6 +26,7 @@ import { BaseNodes } from './nodes/BaseNodes';
|
|
|
25
26
|
import AutoLinkPlugin from './plugins/AutoLinkPlugin';
|
|
26
27
|
import CodeActionMenuPlugin from './plugins/CodeActionMenuPlugin';
|
|
27
28
|
import CodeHighlightPlugin from './plugins/CodeHighlightPlugin';
|
|
29
|
+
import { DimensionDetectorPlugin } from './plugins/DimensionsDetectorPlugin';
|
|
28
30
|
import FloatingLinkEditorPlugin from './plugins/FloatingLinkEditorPlugin';
|
|
29
31
|
import FloatingTextFormatToolbarPlugin from './plugins/FloatingTextFormatToolbarPlugin';
|
|
30
32
|
import LinkPlugin from './plugins/LinkPlugin';
|
|
@@ -60,6 +62,7 @@ type TRichTextBase = {
|
|
|
60
62
|
editable?: boolean;
|
|
61
63
|
language?: SupportedLanguages;
|
|
62
64
|
labelTranslations?: I18N;
|
|
65
|
+
id?: string;
|
|
63
66
|
};
|
|
64
67
|
|
|
65
68
|
export function RichTextEditor({
|
|
@@ -109,13 +112,10 @@ function RichTextEditorWithoutContext({
|
|
|
109
112
|
slotPreContent,
|
|
110
113
|
maxLength,
|
|
111
114
|
editable,
|
|
115
|
+
id,
|
|
112
116
|
}: TRichTextBase): JSX.Element {
|
|
113
117
|
const { historyState } = useSharedHistoryContext();
|
|
114
|
-
const placeholder =
|
|
115
|
-
<div className="text-[14px] font-normal text-gray-300-600 italic absolute overflow-hidden text-ellipsis top-0 left-6 right-10 select-none whitespace-nowrap inline-block pointer-events-none ">
|
|
116
|
-
{placeholderText ?? ''}
|
|
117
|
-
</div>
|
|
118
|
-
);
|
|
118
|
+
const placeholder = <div className="c-rte-placeholder">{placeholderText ?? ''}</div>;
|
|
119
119
|
|
|
120
120
|
const [editor] = useLexicalComposerContext();
|
|
121
121
|
const [floatingAnchorElem, setFloatingAnchorElem] = useState<HTMLDivElement | null>(null);
|
|
@@ -133,23 +133,6 @@ function RichTextEditorWithoutContext({
|
|
|
133
133
|
editor.setEditable(editable || false);
|
|
134
134
|
}, [editable, editor]);
|
|
135
135
|
|
|
136
|
-
// Deal with different window sizes
|
|
137
|
-
useEffect(() => {
|
|
138
|
-
const updateViewPortWidth = () => {
|
|
139
|
-
const isNextSmallWidthViewport = window.matchMedia('(max-width: 1025px)').matches;
|
|
140
|
-
|
|
141
|
-
if (isNextSmallWidthViewport !== isSmallWidthViewport) {
|
|
142
|
-
setIsSmallWidthViewport(isNextSmallWidthViewport);
|
|
143
|
-
}
|
|
144
|
-
};
|
|
145
|
-
|
|
146
|
-
window.addEventListener('resize', updateViewPortWidth);
|
|
147
|
-
|
|
148
|
-
return () => {
|
|
149
|
-
window.removeEventListener('resize', updateViewPortWidth);
|
|
150
|
-
};
|
|
151
|
-
}, [isSmallWidthViewport]);
|
|
152
|
-
|
|
153
136
|
function onLocalChange(editorState: EditorState) {
|
|
154
137
|
if (onChange) {
|
|
155
138
|
if (triggerOnChangeOnAutoFocus || firstOnChangeTriggeredRef.current) {
|
|
@@ -163,9 +146,12 @@ function RichTextEditorWithoutContext({
|
|
|
163
146
|
return (
|
|
164
147
|
<>
|
|
165
148
|
<OnChangePlugin onChange={onLocalChange} ignoreSelectionChange />
|
|
166
|
-
<
|
|
149
|
+
<DimensionDetectorPlugin onChange={d => setIsSmallWidthViewport(d.isSmallWidth)} />
|
|
150
|
+
{isSmallWidthViewport ? null : (
|
|
151
|
+
<ToolbarPlugin actionsMenuPrepend={actionsMenuPrepend} actionsMenuAppend={actionsMenuAppend} />
|
|
152
|
+
)}
|
|
167
153
|
{slotPreContent}
|
|
168
|
-
<div className="editor-container">
|
|
154
|
+
<div className="c-rte-editor-container">
|
|
169
155
|
{maxLength != null ? <MaxLengthPlugin maxLength={maxLength} /> : null}
|
|
170
156
|
{!autoFocus ? null : <AutoFocusPlugin />}
|
|
171
157
|
<ClearEditorPlugin />
|
|
@@ -175,9 +161,9 @@ function RichTextEditorWithoutContext({
|
|
|
175
161
|
|
|
176
162
|
<RichTextPlugin
|
|
177
163
|
contentEditable={
|
|
178
|
-
<div className="editor-scroller">
|
|
179
|
-
<div className="editor" ref={onRef}>
|
|
180
|
-
<ContentEditable className="
|
|
164
|
+
<div className="c-rte-editor-scroller">
|
|
165
|
+
<div className="c-rte-editor" ref={onRef}>
|
|
166
|
+
<ContentEditable className="c-rte-contenteditable-root" id={id} />
|
|
181
167
|
</div>
|
|
182
168
|
</div>
|
|
183
169
|
}
|
|
@@ -59,7 +59,7 @@ const theme: EditorThemeClasses = {
|
|
|
59
59
|
h5: 'CrystallizeRTEditorTheme__h5',
|
|
60
60
|
h6: 'CrystallizeRTEditorTheme__h6',
|
|
61
61
|
},
|
|
62
|
-
image: '
|
|
62
|
+
image: '',
|
|
63
63
|
indent: 'CrystallizeRTEditorTheme__indent',
|
|
64
64
|
link: 'CrystallizeRTEditorTheme__link',
|
|
65
65
|
list: {
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import './LinkPreview.css';
|
|
10
9
|
import { CSSProperties, Suspense, useEffect, useState } from 'react';
|
|
11
10
|
import { $getSelection, $isTextNode } from 'lexical';
|
|
12
11
|
import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
|
|
@@ -120,16 +119,16 @@ function LinkPreviewContent({
|
|
|
120
119
|
}
|
|
121
120
|
|
|
122
121
|
return (
|
|
123
|
-
<div className="
|
|
122
|
+
<div className="c-rte-link-preview">
|
|
124
123
|
{preview.google.image && (
|
|
125
|
-
<div className="
|
|
126
|
-
<img src={preview.google.image} alt={preview.google.title} className="
|
|
124
|
+
<div className="c-rte-link-preview-image-wrapper">
|
|
125
|
+
<img src={preview.google.image} alt={preview.google.title} className="c-rte-link-preview-image" />
|
|
127
126
|
</div>
|
|
128
127
|
)}
|
|
129
|
-
{preview.google.title && <div className="
|
|
130
|
-
{preview.google.description && <div className="
|
|
128
|
+
{preview.google.title && <div className="c-rte-link-preview-title">{preview.google.title}</div>}
|
|
129
|
+
{preview.google.description && <div className="c-rte-link-preview-description">{preview.google.description}</div>}
|
|
131
130
|
{textContent && textContent !== preview.google.title ? (
|
|
132
|
-
<Button className="
|
|
131
|
+
<Button className="c-rte-link-preview__replace-text-btn" onClick={useTitleForText}>
|
|
133
132
|
{tr('linkPreviewReplaceTextWithTitle')}
|
|
134
133
|
</Button>
|
|
135
134
|
) : null}
|
|
@@ -140,7 +139,7 @@ function LinkPreviewContent({
|
|
|
140
139
|
function Glimmer(props: { style: CSSProperties; index: number }): JSX.Element {
|
|
141
140
|
return (
|
|
142
141
|
<div
|
|
143
|
-
className="
|
|
142
|
+
className="c-rte-link-preview-glimmer"
|
|
144
143
|
{...props}
|
|
145
144
|
style={{
|
|
146
145
|
animationDelay: String((props.index || 0) * 300),
|
|
@@ -5,12 +5,11 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
|
-
import {$isAtNodeEnd} from '@lexical/selection';
|
|
9
|
-
import {ElementNode, RangeSelection, TextNode} from 'lexical';
|
|
10
8
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
import type { ElementNode, RangeSelection, TextNode } from 'lexical';
|
|
10
|
+
import { $isAtNodeEnd } from '@lexical/selection';
|
|
11
|
+
|
|
12
|
+
export function getSelectedNode(selection: RangeSelection): TextNode | ElementNode {
|
|
14
13
|
const anchor = selection.anchor;
|
|
15
14
|
const focus = selection.focus;
|
|
16
15
|
const anchorNode = selection.anchor.getNode();
|
|
@@ -22,15 +22,15 @@ export class Point {
|
|
|
22
22
|
return this._y;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
public equals({x, y}: Point): boolean {
|
|
25
|
+
public equals({ x, y }: Point): boolean {
|
|
26
26
|
return this.x === x && this.y === y;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
public calcDeltaXTo({x}: Point): number {
|
|
29
|
+
public calcDeltaXTo({ x }: Point): number {
|
|
30
30
|
return this.x - x;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
public calcDeltaYTo({y}: Point): number {
|
|
33
|
+
public calcDeltaYTo({ y }: Point): number {
|
|
34
34
|
return this.y - y;
|
|
35
35
|
}
|
|
36
36
|
|
|
@@ -43,10 +43,7 @@ export class Point {
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
public calcDistanceTo(point: Point): number {
|
|
46
|
-
return Math.sqrt(
|
|
47
|
-
Math.pow(this.calcDeltaXTo(point), 2) +
|
|
48
|
-
Math.pow(this.calcDeltaYTo(point), 2),
|
|
49
|
-
);
|
|
46
|
+
return Math.sqrt(Math.pow(this.calcDeltaXTo(point), 2) + Math.pow(this.calcDeltaYTo(point), 2));
|
|
50
47
|
}
|
|
51
48
|
}
|
|
52
49
|
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
|
-
import {isPoint, Point} from './point';
|
|
8
|
+
import { isPoint, Point } from './point';
|
|
9
9
|
|
|
10
10
|
type ContainsPointReturn = {
|
|
11
11
|
result: boolean;
|
|
@@ -24,11 +24,9 @@ export class Rect {
|
|
|
24
24
|
private readonly _bottom: number;
|
|
25
25
|
|
|
26
26
|
constructor(left: number, top: number, right: number, bottom: number) {
|
|
27
|
-
const [physicTop, physicBottom] =
|
|
28
|
-
top <= bottom ? [top, bottom] : [bottom, top];
|
|
27
|
+
const [physicTop, physicBottom] = top <= bottom ? [top, bottom] : [bottom, top];
|
|
29
28
|
|
|
30
|
-
const [physicLeft, physicRight] =
|
|
31
|
-
left <= right ? [left, right] : [right, left];
|
|
29
|
+
const [physicLeft, physicRight] = left <= right ? [left, right] : [right, left];
|
|
32
30
|
|
|
33
31
|
this._top = physicTop;
|
|
34
32
|
this._right = physicRight;
|
|
@@ -60,28 +58,22 @@ export class Rect {
|
|
|
60
58
|
return Math.abs(this._bottom - this._top);
|
|
61
59
|
}
|
|
62
60
|
|
|
63
|
-
public equals({top, left, bottom, right}: Rect): boolean {
|
|
64
|
-
return
|
|
65
|
-
top === this._top &&
|
|
66
|
-
bottom === this._bottom &&
|
|
67
|
-
left === this._left &&
|
|
68
|
-
right === this._right
|
|
69
|
-
);
|
|
61
|
+
public equals({ top, left, bottom, right }: Rect): boolean {
|
|
62
|
+
return top === this._top && bottom === this._bottom && left === this._left && right === this._right;
|
|
70
63
|
}
|
|
71
64
|
|
|
72
|
-
public contains({x, y}: Point): ContainsPointReturn;
|
|
73
|
-
public contains({top, left, bottom, right}: Rect): boolean;
|
|
65
|
+
public contains({ x, y }: Point): ContainsPointReturn;
|
|
66
|
+
public contains({ top, left, bottom, right }: Rect): boolean;
|
|
74
67
|
public contains(target: Point | Rect): boolean | ContainsPointReturn {
|
|
75
68
|
if (isPoint(target)) {
|
|
76
|
-
const {x, y} = target;
|
|
69
|
+
const { x, y } = target;
|
|
77
70
|
|
|
78
71
|
const isOnTopSide = y < this._top;
|
|
79
72
|
const isOnBottomSide = y > this._bottom;
|
|
80
73
|
const isOnLeftSide = x < this._left;
|
|
81
74
|
const isOnRightSide = x > this._right;
|
|
82
75
|
|
|
83
|
-
const result =
|
|
84
|
-
!isOnTopSide && !isOnBottomSide && !isOnLeftSide && !isOnRightSide;
|
|
76
|
+
const result = !isOnTopSide && !isOnBottomSide && !isOnLeftSide && !isOnRightSide;
|
|
85
77
|
|
|
86
78
|
return {
|
|
87
79
|
reason: {
|
|
@@ -93,7 +85,7 @@ export class Rect {
|
|
|
93
85
|
result,
|
|
94
86
|
};
|
|
95
87
|
} else {
|
|
96
|
-
const {top, left, bottom, right} = target;
|
|
88
|
+
const { top, left, bottom, right } = target;
|
|
97
89
|
|
|
98
90
|
return (
|
|
99
91
|
top >= this._top &&
|
|
@@ -109,8 +101,8 @@ export class Rect {
|
|
|
109
101
|
}
|
|
110
102
|
|
|
111
103
|
public intersectsWith(rect: Rect): boolean {
|
|
112
|
-
const {left: x1, top: y1, width: w1, height: h1} = rect;
|
|
113
|
-
const {left: x2, top: y2, width: w2, height: h2} = this;
|
|
104
|
+
const { left: x1, top: y1, width: w1, height: h1 } = rect;
|
|
105
|
+
const { left: x2, top: y2, width: w2, height: h2 } = this;
|
|
114
106
|
const maxX = x1 + w1 >= x2 + w2 ? x1 + w1 : x2 + w2;
|
|
115
107
|
const maxY = y1 + h1 >= y2 + h2 ? y1 + h1 : y2 + h2;
|
|
116
108
|
const minX = x1 <= x2 ? x1 : x2;
|
|
@@ -118,41 +110,26 @@ export class Rect {
|
|
|
118
110
|
return maxX - minX <= w1 + w2 && maxY - minY <= h1 + h2;
|
|
119
111
|
}
|
|
120
112
|
|
|
121
|
-
public generateNewRect({
|
|
122
|
-
left = this.left,
|
|
123
|
-
top = this.top,
|
|
124
|
-
right = this.right,
|
|
125
|
-
bottom = this.bottom,
|
|
126
|
-
}): Rect {
|
|
113
|
+
public generateNewRect({ left = this.left, top = this.top, right = this.right, bottom = this.bottom }): Rect {
|
|
127
114
|
return new Rect(left, top, right, bottom);
|
|
128
115
|
}
|
|
129
116
|
|
|
130
|
-
static fromLTRB(
|
|
131
|
-
left: number,
|
|
132
|
-
top: number,
|
|
133
|
-
right: number,
|
|
134
|
-
bottom: number,
|
|
135
|
-
): Rect {
|
|
117
|
+
static fromLTRB(left: number, top: number, right: number, bottom: number): Rect {
|
|
136
118
|
return new Rect(left, top, right, bottom);
|
|
137
119
|
}
|
|
138
120
|
|
|
139
|
-
static fromLWTH(
|
|
140
|
-
left: number,
|
|
141
|
-
width: number,
|
|
142
|
-
top: number,
|
|
143
|
-
height: number,
|
|
144
|
-
): Rect {
|
|
121
|
+
static fromLWTH(left: number, width: number, top: number, height: number): Rect {
|
|
145
122
|
return new Rect(left, top, left + width, top + height);
|
|
146
123
|
}
|
|
147
124
|
|
|
148
125
|
static fromPoints(startPoint: Point, endPoint: Point): Rect {
|
|
149
|
-
const {y: top, x: left} = startPoint;
|
|
150
|
-
const {y: bottom, x: right} = endPoint;
|
|
126
|
+
const { y: top, x: left } = startPoint;
|
|
127
|
+
const { y: bottom, x: right } = endPoint;
|
|
151
128
|
return Rect.fromLTRB(left, top, right, bottom);
|
|
152
129
|
}
|
|
153
130
|
|
|
154
131
|
static fromDOM(dom: HTMLElement): Rect {
|
|
155
|
-
const {top, width, left, height} = dom.getBoundingClientRect();
|
|
132
|
+
const { top, width, left, height } = dom.getBoundingClientRect();
|
|
156
133
|
return Rect.fromLWTH(left, width, top, height);
|
|
157
134
|
}
|
|
158
135
|
}
|
|
@@ -8,8 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
export function sanitizeUrl(url: string): string {
|
|
10
10
|
/** A pattern that matches safe URLs. */
|
|
11
|
-
const SAFE_URL_PATTERN =
|
|
12
|
-
/^(?:(?:https?|mailto|ftp|tel|file|sms):|[^&:/?#]*(?:[/?#]|$))/gi;
|
|
11
|
+
const SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file|sms):|[^&:/?#]*(?:[/?#]|$))/gi;
|
|
13
12
|
|
|
14
13
|
/** A pattern that matches safe data URLs. */
|
|
15
14
|
const DATA_URL_PATTERN =
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ComponentProps, forwardRef } from 'react';
|
|
2
|
-
import * as SelectPrimitives from '@radix-ui/react-select';
|
|
3
2
|
import { cva, VariantProps } from 'class-variance-authority';
|
|
3
|
+
import * as SelectPrimitives from '@radix-ui/react-select';
|
|
4
4
|
|
|
5
5
|
import { Icon } from '../iconography';
|
|
6
6
|
|
package/src/select/select.ts
CHANGED
package/src/slider/slider.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as SliderPrimitive from '@radix-ui/react-slider';
|
|
2
|
-
import { cx } from 'class-variance-authority';
|
|
3
1
|
import { forwardRef } from 'react';
|
|
2
|
+
import { cx } from 'class-variance-authority';
|
|
3
|
+
import * as SliderPrimitive from '@radix-ui/react-slider';
|
|
4
4
|
|
|
5
5
|
import './slider.css';
|
|
6
6
|
|
package/src/spinner/index.tsx
CHANGED
package/src/tag/Tag.stories.tsx
CHANGED
package/dist/camera-CR7D2PNH.svg
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-camera"><path d="M15 12a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1h1.172a3 3 0 0 0 2.12-.879l.83-.828A1 1 0 0 1 6.827 3h2.344a1 1 0 0 1 .707.293l.828.828A3 3 0 0 0 12.828 5H14a1 1 0 0 1 1 1v6zM2 4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2h-1.172a2 2 0 0 1-1.414-.586l-.828-.828A2 2 0 0 0 9.172 2H6.828a2 2 0 0 0-1.414.586l-.828.828A2 2 0 0 1 3.172 4H2z"/><path d="M8 11a2.5 2.5 0 1 1 0-5 2.5 2.5 0 0 1 0 5zm0 1a3.5 3.5 0 1 0 0-7 3.5 3.5 0 0 0 0 7zM3 6.5a.5.5 0 1 1-1 0 .5.5 0 0 1 1 0z"/></svg>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-clipboard"><path d="M4 1.5H3a2 2 0 0 0-2 2V14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V3.5a2 2 0 0 0-2-2h-1v1h1a1 1 0 0 1 1 1V14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V3.5a1 1 0 0 1 1-1h1v-1z"/><path d="M9.5 1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5v-1a.5.5 0 0 1 .5-.5h3zm-3-1A1.5 1.5 0 0 0 5 1.5v1A1.5 1.5 0 0 0 6.5 4h3A1.5 1.5 0 0 0 11 2.5v-1A1.5 1.5 0 0 0 9.5 0h-3z"/></svg>
|
package/dist/gear-ICMT4NTP.svg
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-gear"><path d="M8 4.754a3.246 3.246 0 1 0 0 6.492 3.246 3.246 0 0 0 0-6.492zM5.754 8a2.246 2.246 0 1 1 4.492 0 2.246 2.246 0 0 1-4.492 0z"/><path d="M9.796 1.343c-.527-1.79-3.065-1.79-3.592 0l-.094.319a.873.873 0 0 1-1.255.52l-.292-.16c-1.64-.892-3.433.902-2.54 2.541l.159.292a.873.873 0 0 1-.52 1.255l-.319.094c-1.79.527-1.79 3.065 0 3.592l.319.094a.873.873 0 0 1 .52 1.255l-.16.292c-.892 1.64.901 3.434 2.541 2.54l.292-.159a.873.873 0 0 1 1.255.52l.094.319c.527 1.79 3.065 1.79 3.592 0l.094-.319a.873.873 0 0 1 1.255-.52l.292.16c1.64.893 3.434-.902 2.54-2.541l-.159-.292a.873.873 0 0 1 .52-1.255l.319-.094c1.79-.527 1.79-3.065 0-3.592l-.319-.094a.873.873 0 0 1-.52-1.255l.16-.292c.893-1.64-.902-3.433-2.541-2.54l-.292.159a.873.873 0 0 1-1.255-.52l-.094-.319zm-2.633.283c.246-.835 1.428-.835 1.674 0l.094.319a1.873 1.873 0 0 0 2.693 1.115l.291-.16c.764-.415 1.6.42 1.184 1.185l-.159.292a1.873 1.873 0 0 0 1.116 2.692l.318.094c.835.246.835 1.428 0 1.674l-.319.094a1.873 1.873 0 0 0-1.115 2.693l.16.291c.415.764-.42 1.6-1.185 1.184l-.291-.159a1.873 1.873 0 0 0-2.693 1.116l-.094.318c-.246.835-1.428.835-1.674 0l-.094-.319a1.873 1.873 0 0 0-2.692-1.115l-.292.16c-.764.415-1.6-.42-1.184-1.185l.159-.291A1.873 1.873 0 0 0 1.945 8.93l-.319-.094c-.835-.246-.835-1.428 0-1.674l.319-.094A1.873 1.873 0 0 0 3.06 4.377l-.16-.292c-.415-.764.42-1.6 1.185-1.184l.292.159a1.873 1.873 0 0 0 2.692-1.115l.094-.319z"/></svg>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-journal-code"><path fill-rule="evenodd" d="M8.646 5.646a.5.5 0 0 1 .708 0l2 2a.5.5 0 0 1 0 .708l-2 2a.5.5 0 0 1-.708-.708L10.293 8 8.646 6.354a.5.5 0 0 1 0-.708zm-1.292 0a.5.5 0 0 0-.708 0l-2 2a.5.5 0 0 0 0 .708l2 2a.5.5 0 0 0 .708-.708L5.707 8l1.647-1.646a.5.5 0 0 0 0-.708z"/><path d="M3 0h10a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2v-1h1v1a1 1 0 0 0 1 1h10a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1H3a1 1 0 0 0-1 1v1H1V2a2 2 0 0 1 2-2z"/><path d="M1 5v-.5a.5.5 0 0 1 1 0V5h.5a.5.5 0 0 1 0 1h-2a.5.5 0 0 1 0-1H1zm0 3v-.5a.5.5 0 0 1 1 0V8h.5a.5.5 0 0 1 0 1h-2a.5.5 0 0 1 0-1H1zm0 3v-.5a.5.5 0 0 1 1 0v.5h.5a.5.5 0 0 1 0 1h-2a.5.5 0 0 1 0-1H1z"/></svg>
|
package/dist/lock-WCYOZOHW.svg
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-lock"><path d="M8 1a2 2 0 0 1 2 2v4H6V3a2 2 0 0 1 2-2zm3 6V3a3 3 0 0 0-6 0v4a2 2 0 0 0-2 2v5a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2zM5 8h6a1 1 0 0 1 1 1v5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V9a1 1 0 0 1 1-1z"/></svg>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-lock-fill"><path d="M8 1a2 2 0 0 1 2 2v4H6V3a2 2 0 0 1 2-2zm3 6V3a3 3 0 0 0-6 0v4a2 2 0 0 0-2 2v5a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2z"/></svg>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-pencil-fill"><path d="M12.854.146a.5.5 0 0 0-.707 0L10.5 1.793 14.207 5.5l1.647-1.646a.5.5 0 0 0 0-.708l-3-3zm.646 6.061L9.793 2.5 3.293 9H3.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.207l6.5-6.5zm-7.468 7.468A.5.5 0 0 1 6 13.5V13h-.5a.5.5 0 0 1-.5-.5V12h-.5a.5.5 0 0 1-.5-.5V11h-.5a.5.5 0 0 1-.5-.5V10h-.5a.499.499 0 0 1-.175-.032l-.179.178a.5.5 0 0 0-.11.168l-2 5a.5.5 0 0 0 .65.65l5-2a.5.5 0 0 0 .168-.11l.178-.178z"/></svg>
|
package/dist/plug-HGGGEVS3.svg
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-plug"><path d="M6 0a.5.5 0 0 1 .5.5V3h3V.5a.5.5 0 0 1 1 0V3h1a.5.5 0 0 1 .5.5v3A3.5 3.5 0 0 1 8.5 10c-.002.434-.01.845-.04 1.22-.041.514-.126 1.003-.317 1.424a2.083 2.083 0 0 1-.97 1.028C6.725 13.9 6.169 14 5.5 14c-.998 0-1.61.33-1.974.718A1.922 1.922 0 0 0 3 16H2c0-.616.232-1.367.797-1.968C3.374 13.42 4.261 13 5.5 13c.581 0 .962-.088 1.218-.219.241-.123.4-.3.514-.55.121-.266.193-.621.23-1.09.027-.34.035-.718.037-1.141A3.5 3.5 0 0 1 4 6.5v-3a.5.5 0 0 1 .5-.5h1V.5A.5.5 0 0 1 6 0zM5 4v2.5A2.5 2.5 0 0 0 7.5 9h1A2.5 2.5 0 0 0 11 6.5V4H5z"/></svg>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-plug-fill"><path d="M6 0a.5.5 0 0 1 .5.5V3h3V.5a.5.5 0 0 1 1 0V3h1a.5.5 0 0 1 .5.5v3A3.5 3.5 0 0 1 8.5 10c-.002.434-.01.845-.04 1.22-.041.514-.126 1.003-.317 1.424a2.083 2.083 0 0 1-.97 1.028C6.725 13.9 6.169 14 5.5 14c-.998 0-1.61.33-1.974.718A1.922 1.922 0 0 0 3 16H2c0-.616.232-1.367.797-1.968C3.374 13.42 4.261 13 5.5 13c.581 0 .962-.088 1.218-.219.241-.123.4-.3.514-.55.121-.266.193-.621.23-1.09.027-.34.035-.718.037-1.141A3.5 3.5 0 0 1 4 6.5v-3a.5.5 0 0 1 .5-.5h1V.5A.5.5 0 0 1 6 0z"/></svg>
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import {useCallback, useEffect, useRef} from 'react';
|
|
10
|
-
|
|
11
|
-
const getElement = (): HTMLElement => {
|
|
12
|
-
let element = document.getElementById('report-container');
|
|
13
|
-
|
|
14
|
-
if (element === null) {
|
|
15
|
-
element = document.createElement('div');
|
|
16
|
-
element.id = 'report-container';
|
|
17
|
-
element.style.position = 'fixed';
|
|
18
|
-
element.style.top = '50%';
|
|
19
|
-
element.style.left = '50%';
|
|
20
|
-
element.style.fontSize = '32px';
|
|
21
|
-
element.style.transform = 'translate(-50%, -50px)';
|
|
22
|
-
element.style.padding = '20px';
|
|
23
|
-
element.style.background = 'rgba(240, 240, 240, 0.4)';
|
|
24
|
-
element.style.borderRadius = '20px';
|
|
25
|
-
|
|
26
|
-
if (document.body) {
|
|
27
|
-
document.body.appendChild(element);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
return element;
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
export default function useReport(): (
|
|
35
|
-
arg0: string,
|
|
36
|
-
) => ReturnType<typeof setTimeout> {
|
|
37
|
-
const timer = useRef<ReturnType<typeof setTimeout> | null>(null);
|
|
38
|
-
const cleanup = useCallback(() => {
|
|
39
|
-
if (timer !== null) {
|
|
40
|
-
clearTimeout(timer.current as ReturnType<typeof setTimeout>);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
if (document.body) {
|
|
44
|
-
document.body.removeChild(getElement());
|
|
45
|
-
}
|
|
46
|
-
}, []);
|
|
47
|
-
|
|
48
|
-
useEffect(() => {
|
|
49
|
-
return cleanup;
|
|
50
|
-
}, [cleanup]);
|
|
51
|
-
|
|
52
|
-
return useCallback(
|
|
53
|
-
(content) => {
|
|
54
|
-
// eslint-disable-next-line no-console
|
|
55
|
-
console.log(content);
|
|
56
|
-
const element = getElement();
|
|
57
|
-
clearTimeout(timer.current as ReturnType<typeof setTimeout>);
|
|
58
|
-
element.innerHTML = content;
|
|
59
|
-
timer.current = setTimeout(cleanup, 1000);
|
|
60
|
-
return timer.current;
|
|
61
|
-
},
|
|
62
|
-
[cleanup],
|
|
63
|
-
);
|
|
64
|
-
}
|
package/src/rich-text-editor/plugins/CodeActionMenuPlugin/components/PrettierButton/index.css
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
.code-action-menu-container .prettier-wrapper {
|
|
2
|
-
position: relative;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
.code-action-menu-container .prettier-wrapper .code-error-tips {
|
|
6
|
-
padding: 5px;
|
|
7
|
-
border-radius: 4px;
|
|
8
|
-
color: #fff;
|
|
9
|
-
background: #222;
|
|
10
|
-
margin-top: 4px;
|
|
11
|
-
position: absolute;
|
|
12
|
-
top: 26px;
|
|
13
|
-
right: 0;
|
|
14
|
-
}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
@keyframes glimmer-animation {
|
|
11
|
-
0% {
|
|
12
|
-
background: #f9f9f9;
|
|
13
|
-
}
|
|
14
|
-
.50% {
|
|
15
|
-
background: #eeeeee;
|
|
16
|
-
}
|
|
17
|
-
.100% {
|
|
18
|
-
background: #f9f9f9;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
.LinkPreview__container {
|
|
23
|
-
/* @apply pb-3; */
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.LinkPreview__imageWrapper {
|
|
27
|
-
@apply text-center;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
.LinkPreview__image {
|
|
31
|
-
@apply m-auto max-h-[250px] max-w-full;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
.LinkPreview__title {
|
|
35
|
-
@apply mx-6 mt-2 font-serif font-semibold leading-5 text-gray-700-200;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
.LinkPreview__description {
|
|
39
|
-
@apply mx-6 mt-2 mb-4 text-sm leading-5;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
.LinkPreview__domain {
|
|
43
|
-
@apply mx-6 mt-2 text-sm text-gray-700-200;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
.LinkPreview__glimmer {
|
|
47
|
-
background: #f9f9f9;
|
|
48
|
-
border-radius: 8px;
|
|
49
|
-
height: 18px;
|
|
50
|
-
margin-bottom: 8px;
|
|
51
|
-
margin-left: 12px;
|
|
52
|
-
margin-right: 12px;
|
|
53
|
-
animation-duration: 3s;
|
|
54
|
-
animation-iteration-count: infinite;
|
|
55
|
-
animation-timing-function: linear;
|
|
56
|
-
animation-name: glimmer-animation;
|
|
57
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
export default function joinClasses(
|
|
10
|
-
...args: Array<string | boolean | null | undefined>
|
|
11
|
-
) {
|
|
12
|
-
return args.filter(Boolean).join(' ');
|
|
13
|
-
}
|