@crystallize/design-system 1.13.2 → 1.14.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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @crystallize/design-system
2
2
 
3
+ ## 1.14.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 97f6c34: Clean up the visuals of the code block in rich text editor
8
+
3
9
  ## 1.13.2
4
10
 
5
11
  ### Patch Changes
package/dist/index.css CHANGED
@@ -2145,58 +2145,66 @@ button {
2145
2145
 
2146
2146
  /* src/rich-text-editor/plugins/CodeActionMenuPlugin/index.css */
2147
2147
  .c-rte-code-action-menu-container {
2148
- height: 35.8px;
2149
- font-size: 10px;
2150
- color: rgba(0, 0, 0, 0.5);
2148
+ height: 37px;
2151
2149
  position: absolute;
2152
2150
  display: flex;
2153
2151
  align-items: center;
2154
2152
  flex-direction: row;
2155
2153
  user-select: none;
2154
+ border-radius: 0.375rem;
2155
+ background-color: rgb(var(--c-color-gray-100-800) / 0.75);
2156
+ padding-left: 0.75rem;
2157
+ padding-right: 0.75rem;
2158
+ font-size: 0.75rem;
2159
+ line-height: 1rem;
2160
+ --tw-text-opacity: 1;
2161
+ color: rgb(var(--c-color-gray-700-200) / var(--tw-text-opacity));
2156
2162
  }
2157
2163
  .c-rte-code-highlight-language {
2158
2164
  margin-right: 4px;
2159
2165
  }
2160
2166
  .c-rte-code-button {
2167
+ border-radius: 0.125rem;
2168
+ padding: 0.25rem;
2161
2169
  border: 1px solid transparent;
2162
- border-radius: 4px;
2163
- padding: 4px;
2164
2170
  background: none;
2165
2171
  cursor: pointer;
2166
2172
  flex-shrink: 0;
2167
2173
  display: flex;
2168
2174
  align-items: center;
2169
- color: rgba(0, 0, 0, 0.5);
2170
2175
  text-transform: uppercase;
2171
2176
  }
2172
2177
  .c-rte-code-button:hover {
2173
- border: 1px solid rgba(0, 0, 0, 0.3);
2178
+ border-color: rgb(var(--c-color-gray-900-50) / 0.3);
2174
2179
  opacity: 0.9;
2175
2180
  }
2176
2181
  .c-rte-code-button:active {
2177
- background-color: rgba(223, 232, 250);
2178
- border: 1px solid rgba(0, 0, 0, 0.45);
2182
+ border-color: rgb(var(--c-color-gray-900-50) / 0.5);
2183
+ --tw-bg-opacity: 1;
2184
+ background-color: rgb(var(--c-color-gray-50-900) / var(--tw-bg-opacity));
2179
2185
  }
2180
2186
  .c-rte-code-button__icon {
2181
2187
  height: 16px;
2182
2188
  width: 16px;
2183
2189
  opacity: 0.6;
2184
2190
  display: flex;
2185
- color: rgba(0, 0, 0, 0.5);
2186
2191
  background-size: contain;
2192
+ color: rgb(var(--c-color-gray));
2187
2193
  }
2188
2194
  .c-rte-prettier-wrapper {
2189
2195
  position: relative;
2190
2196
  }
2191
2197
  .c-rte-code-error-tips {
2192
- padding: 5px;
2193
- border-radius: 4px;
2194
- color: #fff;
2195
- background: #222;
2196
- margin-top: 4px;
2197
2198
  position: absolute;
2199
+ right: 0px;
2198
2200
  top: 26px;
2199
- right: 0;
2201
+ margin-top: 0.5rem;
2202
+ border-radius: 0.25rem;
2203
+ --tw-bg-opacity: 1;
2204
+ background-color: rgb(var(--c-color-gray-200-700) / var(--tw-bg-opacity));
2205
+ padding: 0.75rem;
2206
+ --tw-text-opacity: 1;
2207
+ color: rgb(var(--c-color-gray-900-50) / var(--tw-text-opacity));
2200
2208
  }
2201
2209
 
2202
2210
  /* src/rich-text-editor/plugins/DraggableBlockPlugin/index.css */
@@ -2527,7 +2535,7 @@ button {
2527
2535
  padding-bottom: 8px;
2528
2536
  min-height: calc(var(--c-rte-min-height) - 8px);
2529
2537
  }
2530
- .c-rich-text-editor pre {
2538
+ .c-rich-text-editor [contenteditable] pre {
2531
2539
  line-height: 1.1;
2532
2540
  color: #fff;
2533
2541
  margin: 0;
@@ -2539,41 +2547,21 @@ button {
2539
2547
  font-size: 0.875rem;
2540
2548
  line-height: 1.25rem;
2541
2549
  }
2542
- .c-rich-text-editor pre::-webkit-scrollbar {
2550
+ .c-rich-text-editor [contenteditable] pre::-webkit-scrollbar {
2543
2551
  background: transparent;
2544
2552
  width: 10px;
2545
2553
  }
2546
- .c-rich-text-editor pre::-webkit-scrollbar-thumb {
2554
+ .c-rich-text-editor [contenteditable] pre::-webkit-scrollbar-thumb {
2547
2555
  background: #999;
2548
2556
  }
2549
- .c-rich-text-editor [role=separator] {
2550
- height: 1px;
2551
- --tw-bg-opacity: 1;
2552
- background-color: rgb(var(--c-color-gray-200-700) / var(--tw-bg-opacity));
2553
- }
2554
- .c-rich-text-editor .ltr {
2555
- text-align: left;
2556
- }
2557
- .c-rich-text-editor .rtl {
2558
- text-align: right;
2559
- }
2560
- .c-rich-text-editor button.item i {
2561
- opacity: 0.6;
2562
- }
2563
- .c-rich-text-editor button.item.dropdown-item-active {
2564
- background-color: rgba(223, 232, 250, 0.3);
2565
- }
2566
- .c-rich-text-editor button.item.dropdown-item-active i {
2567
- opacity: 1;
2568
- }
2569
- .c-rich-text-editor hr {
2557
+ .c-rich-text-editor [contenteditable] hr {
2570
2558
  padding: 4px 0;
2571
2559
  border: 1px solid red;
2572
2560
  border: none;
2573
2561
  margin: 1em 0;
2574
2562
  cursor: pointer;
2575
2563
  }
2576
- .c-rich-text-editor hr:after {
2564
+ .c-rich-text-editor [contenteditable] hr:after {
2577
2565
  content: "";
2578
2566
  display: block;
2579
2567
  height: 1px;
@@ -2582,10 +2570,24 @@ button {
2582
2570
  --tw-bg-opacity: 1;
2583
2571
  background-color: rgb(var(--c-color-purple-100-800) / var(--tw-bg-opacity));
2584
2572
  }
2585
- .c-rich-text-editor hr.selected {
2573
+ .c-rich-text-editor [contenteditable] hr.selected {
2586
2574
  outline: 2px solid rgb(60, 132, 244);
2587
2575
  user-select: none;
2588
2576
  }
2577
+ .c-rich-text-editor [role=separator] {
2578
+ height: 1px;
2579
+ --tw-bg-opacity: 1;
2580
+ background-color: rgb(var(--c-color-gray-200-700) / var(--tw-bg-opacity));
2581
+ }
2582
+ .c-rich-text-editor .ltr {
2583
+ text-align: left;
2584
+ }
2585
+ .c-rich-text-editor .rtl {
2586
+ text-align: right;
2587
+ }
2588
+ .c-rich-text-editor button.item i {
2589
+ opacity: 0.6;
2590
+ }
2589
2591
  .c-rich-text-editor .TableNode__contentEditable {
2590
2592
  min-height: 20px;
2591
2593
  border: 0px;
package/dist/index.js CHANGED
@@ -4665,7 +4665,7 @@ function PrettierButton({ lang, editor, getCodeDOMNode }) {
4665
4665
 
4666
4666
  // src/rich-text-editor/plugins/CodeActionMenuPlugin/index.tsx
4667
4667
  var import_jsx_runtime86 = require("react/jsx-runtime");
4668
- var CODE_PADDING = 8;
4668
+ var CODE_PADDING = 0;
4669
4669
  function CodeActionMenuContainer({ anchorElem }) {
4670
4670
  const [editor] = (0, import_LexicalComposerContext.useLexicalComposerContext)();
4671
4671
  const [lang, setLang] = (0, import_react71.useState)("");
package/dist/index.mjs CHANGED
@@ -4617,7 +4617,7 @@ function PrettierButton({ lang, editor, getCodeDOMNode }) {
4617
4617
 
4618
4618
  // src/rich-text-editor/plugins/CodeActionMenuPlugin/index.tsx
4619
4619
  import { Fragment as Fragment2, jsx as jsx86, jsxs as jsxs65 } from "react/jsx-runtime";
4620
- var CODE_PADDING = 8;
4620
+ var CODE_PADDING = 0;
4621
4621
  function CodeActionMenuContainer({ anchorElem }) {
4622
4622
  const [editor] = useLexicalComposerContext();
4623
4623
  const [lang, setLang] = useState3("");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crystallize/design-system",
3
- "version": "1.13.2",
3
+ "version": "1.14.0",
4
4
  "types": "./dist/index.d.ts",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -20,23 +20,23 @@
20
20
  }
21
21
  },
22
22
  "dependencies": {
23
- "@lexical/clipboard": "0.9.0",
24
- "@lexical/code": "0.9.0",
25
- "@lexical/file": "0.9.0",
26
- "@lexical/hashtag": "0.9.0",
27
- "@lexical/html": "0.9.0",
28
- "@lexical/link": "0.9.0",
29
- "@lexical/list": "0.9.0",
30
- "@lexical/mark": "0.9.0",
31
- "@lexical/markdown": "0.9.0",
32
- "@lexical/overflow": "0.9.0",
33
- "@lexical/react": "0.9.0",
34
- "@lexical/rich-text": "0.9.0",
35
- "@lexical/selection": "0.9.0",
36
- "@lexical/table": "0.9.0",
37
- "@lexical/text": "0.9.0",
38
- "@lexical/utils": "0.9.0",
39
- "@lexical/yjs": "0.9.0",
23
+ "@lexical/clipboard": "0.10.0",
24
+ "@lexical/code": "0.10.0",
25
+ "@lexical/file": "0.10.0",
26
+ "@lexical/hashtag": "0.10.0",
27
+ "@lexical/html": "0.10.0",
28
+ "@lexical/link": "0.10.0",
29
+ "@lexical/list": "0.10.0",
30
+ "@lexical/mark": "0.10.0",
31
+ "@lexical/markdown": "0.10.0",
32
+ "@lexical/overflow": "0.10.0",
33
+ "@lexical/react": "0.10.0",
34
+ "@lexical/rich-text": "0.10.0",
35
+ "@lexical/selection": "0.10.0",
36
+ "@lexical/table": "0.10.0",
37
+ "@lexical/text": "0.10.0",
38
+ "@lexical/utils": "0.10.0",
39
+ "@lexical/yjs": "0.10.0",
40
40
  "@radix-ui/react-checkbox": "1.0.1",
41
41
  "@radix-ui/react-dialog": "1.0.2",
42
42
  "@radix-ui/react-dropdown-menu": "2.0.1",
@@ -46,7 +46,7 @@
46
46
  "@radix-ui/react-select": "1.1.2",
47
47
  "@radix-ui/react-slider": "^1.1.0",
48
48
  "class-variance-authority": "^0.4.0",
49
- "lexical": "0.9.0",
49
+ "lexical": "0.10.0",
50
50
  "prettier": "2.8.4",
51
51
  "use-debounce": "8.0.4"
52
52
  },
@@ -1,12 +1,12 @@
1
1
  .c-rte-code-action-menu-container {
2
- height: 35.8px;
3
- font-size: 10px;
4
- color: rgba(0, 0, 0, 0.5);
2
+ height: 37px;
5
3
  position: absolute;
6
4
  display: flex;
7
5
  align-items: center;
8
6
  flex-direction: row;
9
7
  user-select: none;
8
+
9
+ @apply rounded-md bg-gray-100-800/75 px-3 text-xs text-gray-700-200;
10
10
  }
11
11
 
12
12
  .c-rte-code-highlight-language {
@@ -14,25 +14,21 @@
14
14
  }
15
15
 
16
16
  .c-rte-code-button {
17
+ @apply rounded-sm p-1;
17
18
  border: 1px solid transparent;
18
- border-radius: 4px;
19
- padding: 4px;
20
19
  background: none;
21
20
  cursor: pointer;
22
21
  flex-shrink: 0;
23
22
  display: flex;
24
23
  align-items: center;
25
- color: rgba(0, 0, 0, 0.5);
26
24
  text-transform: uppercase;
27
25
 
28
26
  &:hover {
29
- border: 1px solid rgba(0, 0, 0, 0.3);
30
- opacity: 0.9;
27
+ @apply border-gray-900-50/30 opacity-90;
31
28
  }
32
29
 
33
30
  &:active {
34
- background-color: rgba(223, 232, 250);
35
- border: 1px solid rgba(0, 0, 0, 0.45);
31
+ @apply border-gray-900-50/50 bg-gray-50-900;
36
32
  }
37
33
 
38
34
  &__icon {
@@ -40,8 +36,8 @@
40
36
  width: 16px;
41
37
  opacity: 0.6;
42
38
  display: flex;
43
- color: rgba(0, 0, 0, 0.5);
44
39
  background-size: contain;
40
+ @apply text-gray;
45
41
  }
46
42
  }
47
43
 
@@ -50,12 +46,5 @@
50
46
  }
51
47
 
52
48
  .c-rte-code-error-tips {
53
- padding: 5px;
54
- border-radius: 4px;
55
- color: #fff;
56
- background: #222;
57
- margin-top: 4px;
58
- position: absolute;
59
- top: 26px;
60
- right: 0;
49
+ @apply absolute right-0 top-[26px] mt-2 rounded bg-gray-200-700 p-3 text-gray-900-50;
61
50
  }
@@ -16,7 +16,7 @@ import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext
16
16
  import { CopyButton } from './components/CopyButton';
17
17
  import { canBePrettier, PrettierButton } from './components/PrettierButton';
18
18
 
19
- const CODE_PADDING = 8;
19
+ const CODE_PADDING = 0;
20
20
 
21
21
  interface Position {
22
22
  top: string;
@@ -60,23 +60,47 @@
60
60
  min-height: calc(var(--c-rte-min-height) - 8px);
61
61
  }
62
62
 
63
- pre {
64
- line-height: 1.1;
65
- color: #fff;
66
- margin: 0;
67
- padding: 10px;
68
- overflow: auto;
69
- max-height: 180px;
70
- @apply bg-purple-50-900 text-sm;
71
- }
72
-
73
- pre::-webkit-scrollbar {
74
- background: transparent;
75
- width: 10px;
76
- }
63
+ [contenteditable] {
64
+ pre {
65
+ line-height: 1.1;
66
+ color: #fff;
67
+ margin: 0;
68
+ padding: 10px;
69
+ overflow: auto;
70
+ max-height: 180px;
71
+ @apply bg-purple-50-900 text-sm;
72
+
73
+ &::-webkit-scrollbar {
74
+ background: transparent;
75
+ width: 10px;
76
+ }
77
+
78
+ &::-webkit-scrollbar-thumb {
79
+ background: #999;
80
+ }
81
+ }
77
82
 
78
- pre::-webkit-scrollbar-thumb {
79
- background: #999;
83
+ hr {
84
+ padding: 4px 0;
85
+ border: 1px solid red;
86
+ border: none;
87
+ margin: 1em 0;
88
+ cursor: pointer;
89
+
90
+ &:after {
91
+ content: '';
92
+ display: block;
93
+ height: 1px;
94
+ background-color: #ccc;
95
+ line-height: 1px;
96
+ @apply bg-purple-100-800;
97
+ }
98
+
99
+ &.selected {
100
+ outline: 2px solid rgb(60, 132, 244);
101
+ user-select: none;
102
+ }
103
+ }
80
104
  }
81
105
 
82
106
  [role='separator'] {
@@ -95,36 +119,6 @@
95
119
  opacity: 0.6;
96
120
  }
97
121
 
98
- button.item.dropdown-item-active {
99
- background-color: rgba(223, 232, 250, 0.3);
100
- }
101
-
102
- button.item.dropdown-item-active i {
103
- opacity: 1;
104
- }
105
-
106
- hr {
107
- padding: 4px 0;
108
- border: 1px solid red;
109
- border: none;
110
- margin: 1em 0;
111
- cursor: pointer;
112
- }
113
-
114
- hr:after {
115
- content: '';
116
- display: block;
117
- height: 1px;
118
- background-color: #ccc;
119
- line-height: 1px;
120
- @apply bg-purple-100-800;
121
- }
122
-
123
- hr.selected {
124
- outline: 2px solid rgb(60, 132, 244);
125
- user-select: none;
126
- }
127
-
128
122
  .TableNode__contentEditable {
129
123
  min-height: 20px;
130
124
  border: 0px;