@crystallize/design-system 1.7.0 → 1.9.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.
- package/CHANGELOG.md +13 -0
- package/dist/index.css +53 -332
- package/dist/index.d.ts +15 -8
- package/dist/index.js +1717 -4568
- package/dist/index.mjs +1639 -2355
- package/package.json +1 -1
- package/src/action-menu/action-item-separator.tsx +14 -0
- package/src/action-menu/action-item.tsx +2 -2
- package/src/action-menu/action-menu.css +8 -0
- package/src/action-menu/action-menu.tsx +2 -1
- package/src/dropdown-menu/dropdown-menu-root.tsx +3 -1
- package/src/dropdown-menu/index.ts +5 -2
- package/src/iconography/subscription-contracts.tsx +4 -4
- package/src/iconography/subscription-plans.tsx +5 -5
- package/src/rich-text-editor/model/crystallize-to-lexical.ts +12 -1
- package/src/rich-text-editor/model/lexical-to-crystallize.ts +38 -38
- package/src/rich-text-editor/nodes/BaseNodes.ts +0 -7
- package/src/rich-text-editor/nodes/TableCellNodes.ts +0 -7
- package/src/rich-text-editor/plugins/ActionsPlugin/index.tsx +1 -1
- package/src/rich-text-editor/plugins/CodeActionMenuPlugin/components/CopyButton/index.tsx +3 -2
- package/src/rich-text-editor/plugins/CodeActionMenuPlugin/components/PrettierButton/index.tsx +0 -1
- package/src/rich-text-editor/plugins/FloatingTextFormatToolbarPlugin/index.css +17 -17
- package/src/rich-text-editor/plugins/FloatingTextFormatToolbarPlugin/index.tsx +1 -1
- package/src/rich-text-editor/plugins/MaxLengthPlugin/index.tsx +2 -7
- package/src/rich-text-editor/plugins/TableActionMenuPlugin/index.tsx +80 -149
- package/src/rich-text-editor/plugins/ToolbarPlugin/index.tsx +23 -36
- package/src/rich-text-editor/plugins/ToolbarPlugin/insert-table.tsx +55 -0
- package/src/rich-text-editor/rich-text-editor.css +10 -322
- package/src/rich-text-editor/rich-text-editor.stories.tsx +35 -5
- package/src/rich-text-editor/rich-text-editor.tsx +6 -39
- package/src/rich-text-editor/tests/rich-text-editor-code.test.tsx +10 -6
- package/src/rich-text-editor/tests/rich-text-editor-model-conversions.test.tsx +19 -7
- package/src/rich-text-editor/themes/CrystallizeRTEditorTheme.css +3 -11
- package/dist/TableComponent-I2YOOYOU.css +0 -281
- package/dist/TableComponent-QINOO453.mjs +0 -1377
- package/dist/chevron-down-3FRWSIKS.svg +0 -1
- package/dist/chunk-VUXQZRSP.mjs +0 -737
- package/dist/markdown-4BGQNLLT.svg +0 -1
- package/src/rich-text-editor/nodes/KeywordNode.ts +0 -73
- package/src/rich-text-editor/nodes/TableComponent.tsx +0 -1547
- package/src/rich-text-editor/nodes/TableNode.tsx +0 -398
- package/src/rich-text-editor/plugins/ComponentPickerPlugin/index.tsx +0 -320
- package/src/rich-text-editor/plugins/DragDropPastePlugin/index.ts +0 -40
- package/src/rich-text-editor/plugins/MarkdownShortcutPlugin/index.tsx +0 -16
- package/src/rich-text-editor/plugins/MarkdownTransformers/index.ts +0 -195
- package/src/rich-text-editor/plugins/SpeechToTextPlugin/index.ts +0 -113
- package/src/rich-text-editor/plugins/TableCellResizer/index.css +0 -12
- package/src/rich-text-editor/plugins/TableCellResizer/index.tsx +0 -386
- package/src/rich-text-editor/plugins/TablePlugin.tsx +0 -190
- package/src/rich-text-editor/plugins/TreeViewPlugin/index.tsx +0 -25
- package/src/rich-text-editor/plugins/TypingPerfPlugin/index.ts +0 -117
|
@@ -1,117 +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 {useEffect} from 'react';
|
|
10
|
-
|
|
11
|
-
import useReport from '../../hooks/useReport';
|
|
12
|
-
|
|
13
|
-
const validInputTypes = new Set([
|
|
14
|
-
'insertText',
|
|
15
|
-
'insertCompositionText',
|
|
16
|
-
'insertFromComposition',
|
|
17
|
-
'insertLineBreak',
|
|
18
|
-
'insertParagraph',
|
|
19
|
-
'deleteCompositionText',
|
|
20
|
-
'deleteContentBackward',
|
|
21
|
-
'deleteByComposition',
|
|
22
|
-
'deleteContent',
|
|
23
|
-
'deleteContentForward',
|
|
24
|
-
'deleteWordBackward',
|
|
25
|
-
'deleteWordForward',
|
|
26
|
-
'deleteHardLineBackward',
|
|
27
|
-
'deleteSoftLineBackward',
|
|
28
|
-
'deleteHardLineForward',
|
|
29
|
-
'deleteSoftLineForward',
|
|
30
|
-
]);
|
|
31
|
-
|
|
32
|
-
export default function TypingPerfPlugin(): JSX.Element | null {
|
|
33
|
-
const report = useReport();
|
|
34
|
-
useEffect(() => {
|
|
35
|
-
let start = 0;
|
|
36
|
-
let timerId: ReturnType<typeof setTimeout> | null;
|
|
37
|
-
let keyPressTimerId: ReturnType<typeof setTimeout> | null;
|
|
38
|
-
let log: Array<DOMHighResTimeStamp> = [];
|
|
39
|
-
let invalidatingEvent = false;
|
|
40
|
-
|
|
41
|
-
const measureEventEnd = function logKeyPress() {
|
|
42
|
-
if (keyPressTimerId != null) {
|
|
43
|
-
if (invalidatingEvent) {
|
|
44
|
-
invalidatingEvent = false;
|
|
45
|
-
} else {
|
|
46
|
-
log.push(performance.now() - start);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
clearTimeout(keyPressTimerId);
|
|
50
|
-
keyPressTimerId = null;
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
const measureEventStart = function measureEvent() {
|
|
55
|
-
if (timerId != null) {
|
|
56
|
-
clearTimeout(timerId);
|
|
57
|
-
timerId = null;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
// We use a setTimeout(0) instead of requestAnimationFrame, due to
|
|
61
|
-
// inconsistencies between the sequencing of rAF in different browsers.
|
|
62
|
-
keyPressTimerId = setTimeout(measureEventEnd, 0);
|
|
63
|
-
// Schedule a timer to report the results.
|
|
64
|
-
timerId = setTimeout(() => {
|
|
65
|
-
const total = log.reduce((a, b) => a + b, 0);
|
|
66
|
-
const reportedText =
|
|
67
|
-
'Typing Perf: ' + Math.round((total / log.length) * 100) / 100 + 'ms';
|
|
68
|
-
report(reportedText);
|
|
69
|
-
log = [];
|
|
70
|
-
}, 2000);
|
|
71
|
-
// Make the time after we do the previous logic, so we don't measure the overhead
|
|
72
|
-
// for it all.
|
|
73
|
-
start = performance.now();
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
const beforeInputHandler = function beforeInputHandler(event: InputEvent) {
|
|
77
|
-
if (!validInputTypes.has(event.inputType) || invalidatingEvent) {
|
|
78
|
-
invalidatingEvent = false;
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
measureEventStart();
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
const keyDownHandler = function keyDownHandler(event: KeyboardEvent) {
|
|
86
|
-
const keyCode = event.keyCode;
|
|
87
|
-
|
|
88
|
-
if (keyCode === 8 || keyCode === 13) {
|
|
89
|
-
measureEventStart();
|
|
90
|
-
}
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
const pasteHandler = function pasteHandler() {
|
|
94
|
-
invalidatingEvent = true;
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
const cutHandler = function cutHandler() {
|
|
98
|
-
invalidatingEvent = true;
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
window.addEventListener('keydown', keyDownHandler, true);
|
|
102
|
-
window.addEventListener('selectionchange', measureEventEnd, true);
|
|
103
|
-
window.addEventListener('beforeinput', beforeInputHandler, true);
|
|
104
|
-
window.addEventListener('paste', pasteHandler, true);
|
|
105
|
-
window.addEventListener('cut', cutHandler, true);
|
|
106
|
-
|
|
107
|
-
return () => {
|
|
108
|
-
window.removeEventListener('keydown', keyDownHandler, true);
|
|
109
|
-
window.removeEventListener('selectionchange', measureEventEnd, true);
|
|
110
|
-
window.removeEventListener('beforeinput', beforeInputHandler, true);
|
|
111
|
-
window.removeEventListener('paste', pasteHandler, true);
|
|
112
|
-
window.removeEventListener('cut', cutHandler, true);
|
|
113
|
-
};
|
|
114
|
-
}, [report]);
|
|
115
|
-
|
|
116
|
-
return null;
|
|
117
|
-
}
|