@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.
Files changed (51) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/index.css +53 -332
  3. package/dist/index.d.ts +15 -8
  4. package/dist/index.js +1717 -4568
  5. package/dist/index.mjs +1639 -2355
  6. package/package.json +1 -1
  7. package/src/action-menu/action-item-separator.tsx +14 -0
  8. package/src/action-menu/action-item.tsx +2 -2
  9. package/src/action-menu/action-menu.css +8 -0
  10. package/src/action-menu/action-menu.tsx +2 -1
  11. package/src/dropdown-menu/dropdown-menu-root.tsx +3 -1
  12. package/src/dropdown-menu/index.ts +5 -2
  13. package/src/iconography/subscription-contracts.tsx +4 -4
  14. package/src/iconography/subscription-plans.tsx +5 -5
  15. package/src/rich-text-editor/model/crystallize-to-lexical.ts +12 -1
  16. package/src/rich-text-editor/model/lexical-to-crystallize.ts +38 -38
  17. package/src/rich-text-editor/nodes/BaseNodes.ts +0 -7
  18. package/src/rich-text-editor/nodes/TableCellNodes.ts +0 -7
  19. package/src/rich-text-editor/plugins/ActionsPlugin/index.tsx +1 -1
  20. package/src/rich-text-editor/plugins/CodeActionMenuPlugin/components/CopyButton/index.tsx +3 -2
  21. package/src/rich-text-editor/plugins/CodeActionMenuPlugin/components/PrettierButton/index.tsx +0 -1
  22. package/src/rich-text-editor/plugins/FloatingTextFormatToolbarPlugin/index.css +17 -17
  23. package/src/rich-text-editor/plugins/FloatingTextFormatToolbarPlugin/index.tsx +1 -1
  24. package/src/rich-text-editor/plugins/MaxLengthPlugin/index.tsx +2 -7
  25. package/src/rich-text-editor/plugins/TableActionMenuPlugin/index.tsx +80 -149
  26. package/src/rich-text-editor/plugins/ToolbarPlugin/index.tsx +23 -36
  27. package/src/rich-text-editor/plugins/ToolbarPlugin/insert-table.tsx +55 -0
  28. package/src/rich-text-editor/rich-text-editor.css +10 -322
  29. package/src/rich-text-editor/rich-text-editor.stories.tsx +35 -5
  30. package/src/rich-text-editor/rich-text-editor.tsx +6 -39
  31. package/src/rich-text-editor/tests/rich-text-editor-code.test.tsx +10 -6
  32. package/src/rich-text-editor/tests/rich-text-editor-model-conversions.test.tsx +19 -7
  33. package/src/rich-text-editor/themes/CrystallizeRTEditorTheme.css +3 -11
  34. package/dist/TableComponent-I2YOOYOU.css +0 -281
  35. package/dist/TableComponent-QINOO453.mjs +0 -1377
  36. package/dist/chevron-down-3FRWSIKS.svg +0 -1
  37. package/dist/chunk-VUXQZRSP.mjs +0 -737
  38. package/dist/markdown-4BGQNLLT.svg +0 -1
  39. package/src/rich-text-editor/nodes/KeywordNode.ts +0 -73
  40. package/src/rich-text-editor/nodes/TableComponent.tsx +0 -1547
  41. package/src/rich-text-editor/nodes/TableNode.tsx +0 -398
  42. package/src/rich-text-editor/plugins/ComponentPickerPlugin/index.tsx +0 -320
  43. package/src/rich-text-editor/plugins/DragDropPastePlugin/index.ts +0 -40
  44. package/src/rich-text-editor/plugins/MarkdownShortcutPlugin/index.tsx +0 -16
  45. package/src/rich-text-editor/plugins/MarkdownTransformers/index.ts +0 -195
  46. package/src/rich-text-editor/plugins/SpeechToTextPlugin/index.ts +0 -113
  47. package/src/rich-text-editor/plugins/TableCellResizer/index.css +0 -12
  48. package/src/rich-text-editor/plugins/TableCellResizer/index.tsx +0 -386
  49. package/src/rich-text-editor/plugins/TablePlugin.tsx +0 -190
  50. package/src/rich-text-editor/plugins/TreeViewPlugin/index.tsx +0 -25
  51. 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
- }