@thangph2146/lexical-editor 0.0.4 → 0.0.5

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 (99) hide show
  1. package/dist/editor-x/editor.cjs +721 -432
  2. package/dist/editor-x/editor.cjs.map +1 -1
  3. package/dist/editor-x/editor.css +1418 -1120
  4. package/dist/editor-x/editor.css.map +1 -1
  5. package/dist/editor-x/editor.js +725 -436
  6. package/dist/editor-x/editor.js.map +1 -1
  7. package/dist/index.cjs +757 -469
  8. package/dist/index.cjs.map +1 -1
  9. package/dist/index.css +1418 -1120
  10. package/dist/index.css.map +1 -1
  11. package/dist/index.js +760 -472
  12. package/dist/index.js.map +1 -1
  13. package/package.json +3 -3
  14. package/src/components/lexical-editor.tsx +138 -123
  15. package/src/editor-x/editor.tsx +16 -3
  16. package/src/editor-x/plugins.tsx +385 -380
  17. package/src/nodes/list-with-color-node.tsx +160 -160
  18. package/src/plugins/autocomplete-plugin.tsx +2574 -2574
  19. package/src/plugins/context-menu-plugin.tsx +239 -9
  20. package/src/plugins/floating-text-format-plugin.tsx +84 -92
  21. package/src/plugins/images-plugin.tsx +4 -4
  22. package/src/plugins/list-color-plugin.tsx +178 -178
  23. package/src/plugins/tab-focus-plugin.tsx +66 -66
  24. package/src/plugins/table-column-resizer-plugin.tsx +329 -190
  25. package/src/plugins/toolbar/block-format/block-format-data.tsx +4 -0
  26. package/src/plugins/toolbar/block-format/format-bulleted-list.tsx +40 -40
  27. package/src/plugins/toolbar/block-format/format-list-with-marker.tsx +74 -74
  28. package/src/plugins/toolbar/block-format/format-numbered-list.tsx +40 -40
  29. package/src/plugins/toolbar/block-format-toolbar-plugin.tsx +118 -117
  30. package/src/plugins/toolbar/element-format-toolbar-plugin.tsx +37 -53
  31. package/src/plugins/toolbar/font-format-toolbar-plugin.tsx +8 -15
  32. package/src/plugins/toolbar/font-size-toolbar-plugin.tsx +2 -3
  33. package/src/plugins/toolbar/history-toolbar-plugin.tsx +2 -5
  34. package/src/plugins/toolbar/subsuper-toolbar-plugin.tsx +15 -23
  35. package/src/themes/_mixins.scss +158 -10
  36. package/src/themes/_variables.scss +168 -0
  37. package/src/themes/core/_code.scss +59 -0
  38. package/src/themes/core/_images.scss +80 -0
  39. package/src/themes/core/_lists.scss +214 -0
  40. package/src/themes/core/_misc.scss +46 -0
  41. package/src/themes/core/_reset.scss +119 -0
  42. package/src/themes/core/_tables.scss +145 -0
  43. package/src/themes/core/_text.scss +35 -0
  44. package/src/themes/core/_typography.scss +73 -0
  45. package/src/themes/editor-theme copy.scss +763 -0
  46. package/src/themes/editor-theme.scss +9 -623
  47. package/src/themes/editor-theme.ts +118 -118
  48. package/src/themes/plugins/_auto-embed.scss +11 -0
  49. package/src/themes/plugins/_color-picker.scss +103 -0
  50. package/src/themes/plugins/_draggable-block.scss +32 -0
  51. package/src/themes/plugins/_floating-link-editor.scss +47 -0
  52. package/src/themes/plugins/_floating-toolbars.scss +61 -0
  53. package/src/themes/plugins/_image-resizer.scss +38 -0
  54. package/src/themes/plugins/_image.scss +57 -0
  55. package/src/themes/plugins/_layout.scss +39 -0
  56. package/src/themes/plugins/_list-color.scss +23 -0
  57. package/src/themes/plugins/_mentions.scss +21 -0
  58. package/src/themes/plugins/_menus-and-pickers.scss +153 -0
  59. package/src/themes/plugins/_table.scss +20 -0
  60. package/src/themes/plugins/_toolbar.scss +36 -0
  61. package/src/themes/plugins/_tree-view.scss +11 -0
  62. package/src/themes/plugins copy.scss +656 -0
  63. package/src/themes/plugins.scss +20 -1165
  64. package/src/themes/ui-components/_animations.scss +31 -0
  65. package/src/themes/ui-components/_backgrounds.scss +27 -0
  66. package/src/themes/ui-components/_borders.scss +20 -0
  67. package/src/themes/ui-components/_button.scss +176 -0
  68. package/src/themes/ui-components/_checkbox.scss +14 -0
  69. package/src/themes/ui-components/_cursors.scss +31 -0
  70. package/src/themes/ui-components/_dialog.scss +86 -0
  71. package/src/themes/ui-components/_display-sizing.scss +100 -0
  72. package/src/themes/ui-components/_flex.scss +124 -0
  73. package/src/themes/ui-components/_form-layout.scss +15 -0
  74. package/src/themes/ui-components/_icons.scss +23 -0
  75. package/src/themes/ui-components/_input.scss +86 -0
  76. package/src/themes/ui-components/_label.scss +19 -0
  77. package/src/themes/ui-components/_loader.scss +9 -0
  78. package/src/themes/ui-components/_margins-paddings.scss +45 -0
  79. package/src/themes/ui-components/_popover.scss +16 -0
  80. package/src/themes/ui-components/_positioning.scss +73 -0
  81. package/src/themes/ui-components/_rounded.scss +19 -0
  82. package/src/themes/ui-components/_scroll-area.scss +11 -0
  83. package/src/themes/ui-components/_select.scss +110 -0
  84. package/src/themes/ui-components/_separator.scss +19 -0
  85. package/src/themes/ui-components/_shadow.scss +15 -0
  86. package/src/themes/ui-components/_tabs.scss +46 -0
  87. package/src/themes/ui-components/_text-utilities.scss +48 -0
  88. package/src/themes/ui-components/_toggle-toolbar.scss +128 -0
  89. package/src/themes/ui-components/_toggle.scss +80 -0
  90. package/src/themes/ui-components/_typography.scss +22 -0
  91. package/src/themes/ui-components copy.scss +1335 -0
  92. package/src/themes/ui-components.scss +27 -937
  93. package/src/transformers/markdown-list-transformer.ts +51 -51
  94. package/src/ui/button.tsx +11 -2
  95. package/src/ui/collapsible.tsx +1 -1
  96. package/src/ui/dialog.tsx +2 -2
  97. package/src/ui/flex.tsx +4 -4
  98. package/src/ui/popover.tsx +1 -1
  99. package/src/ui/tooltip.tsx +2 -2
@@ -17,10 +17,7 @@ import {
17
17
 
18
18
  import { useToolbarContext } from "../../context/toolbar-context"
19
19
  import { useUpdateToolbarHandler } from "../../editor-hooks/use-update-toolbar"
20
- import {
21
- ToggleGroup,
22
- ToggleGroupItem,
23
- } from "../../ui/toggle-group"
20
+ import { Button } from "../../ui/button"
24
21
 
25
22
  const FORMATS = [
26
23
  { format: "bold", icon: BoldIcon, label: "Bold" },
@@ -57,18 +54,14 @@ export function FontFormatToolbarPlugin() {
57
54
  useUpdateToolbarHandler($updateToolbar)
58
55
 
59
56
  return (
60
- <ToggleGroup
61
- type="multiple"
62
- value={activeFormats}
63
- onValueChange={setActiveFormats}
64
- variant="default"
65
- size="sm"
66
- >
57
+ <>
67
58
  {FORMATS.map(({ format, icon: Icon, label }) => (
68
- <ToggleGroupItem
59
+ <Button
69
60
  key={format}
70
- value={format}
61
+ variant="ghost"
62
+ size="sm"
71
63
  aria-label={label}
64
+ data-state={activeFormats.includes(format) ? "on" : "off"}
72
65
  className="editor-toolbar-item"
73
66
  onClick={() => {
74
67
  activeEditor.dispatchCommand(
@@ -78,8 +71,8 @@ export function FontFormatToolbarPlugin() {
78
71
  }}
79
72
  >
80
73
  <Icon className="editor-icon-sm" />
81
- </ToggleGroupItem>
74
+ </Button>
82
75
  ))}
83
- </ToggleGroup>
76
+ </>
84
77
  )
85
78
  }
@@ -11,7 +11,6 @@ import { Minus, Plus } from "lucide-react"
11
11
  import { useToolbarContext } from "../../context/toolbar-context"
12
12
  import { useUpdateToolbarHandler } from "../../editor-hooks/use-update-toolbar"
13
13
  import { Button } from "../../ui/button"
14
- import { ButtonGroup } from "../../ui/button-group"
15
14
  import { Input } from "../../ui/input"
16
15
  import { IconSize } from "../../ui/typography"
17
16
 
@@ -127,7 +126,7 @@ export function FontSizeToolbarPlugin() {
127
126
  }, [stopTimer])
128
127
 
129
128
  return (
130
- <ButtonGroup>
129
+ <>
131
130
  <Button
132
131
  variant="outline"
133
132
  size="icon"
@@ -172,6 +171,6 @@ export function FontSizeToolbarPlugin() {
172
171
  <Plus />
173
172
  </IconSize>
174
173
  </Button>
175
- </ButtonGroup>
174
+ </>
176
175
  )
177
176
  }
@@ -14,7 +14,6 @@ import { RedoIcon, UndoIcon } from "lucide-react"
14
14
 
15
15
  import { useToolbarContext } from "../../context/toolbar-context"
16
16
  import { Button } from "../../ui/button"
17
- import { ButtonGroup } from "../../ui/button-group"
18
17
 
19
18
  export function HistoryToolbarPlugin() {
20
19
  const [editor] = useLexicalComposerContext()
@@ -53,7 +52,7 @@ export function HistoryToolbarPlugin() {
53
52
  }, [$updateToolbar, activeEditor, editor])
54
53
 
55
54
  return (
56
- <ButtonGroup>
55
+ <>
57
56
  <Button
58
57
  disabled={!canUndo || !isEditable}
59
58
  onClick={() => {
@@ -62,7 +61,6 @@ export function HistoryToolbarPlugin() {
62
61
  title={IS_APPLE ? "Undo (⌘Z)" : "Undo (Ctrl+Z)"}
63
62
  type="button"
64
63
  aria-label="Undo"
65
- size="sm"
66
64
  variant="ghost"
67
65
  className="editor-toolbar-item"
68
66
  >
@@ -76,12 +74,11 @@ export function HistoryToolbarPlugin() {
76
74
  title={IS_APPLE ? "Redo (⇧⌘Z)" : "Redo (Ctrl+Y)"}
77
75
  type="button"
78
76
  aria-label="Redo"
79
- size="sm"
80
77
  variant="ghost"
81
78
  className="editor-toolbar-item"
82
79
  >
83
80
  <RedoIcon className="editor-icon-sm" />
84
81
  </Button>
85
- </ButtonGroup>
82
+ </>
86
83
  )
87
84
  }
@@ -7,10 +7,7 @@ import { SubscriptIcon, SuperscriptIcon } from "lucide-react"
7
7
 
8
8
  import { useToolbarContext } from "../../context/toolbar-context"
9
9
  import { useUpdateToolbarHandler } from "../../editor-hooks/use-update-toolbar"
10
- import {
11
- ToggleGroup,
12
- ToggleGroupItem,
13
- } from "../../ui/toggle-group"
10
+ import { Button } from "../../ui/button"
14
11
  import { IconSize } from "../../ui/typography"
15
12
 
16
13
  export function SubSuperToolbarPlugin() {
@@ -30,40 +27,35 @@ export function SubSuperToolbarPlugin() {
30
27
  useUpdateToolbarHandler($updateToolbar)
31
28
 
32
29
  return (
33
- <ToggleGroup
34
- type="single"
35
- value={
36
- isSubscript ? "subscript" : isSuperscript ? "superscript" : ""
37
- }
38
- size="default"
39
- variant="outline"
40
- >
41
- <ToggleGroupItem
42
- value="subscript"
43
- size="default"
30
+ <>
31
+ <Button
32
+ variant="outline"
33
+ size="icon"
44
34
  aria-label="Toggle subscript"
35
+ data-state={isSubscript ? "on" : "off"}
45
36
  onClick={() => {
46
37
  activeEditor.dispatchCommand(FORMAT_TEXT_COMMAND, "subscript")
47
38
  }}
48
- variant={"outline"}
39
+ className="editor-toolbar-item"
49
40
  >
50
41
  <IconSize size="sm">
51
42
  <SubscriptIcon />
52
43
  </IconSize>
53
- </ToggleGroupItem>
54
- <ToggleGroupItem
55
- value="superscript"
56
- size="default"
44
+ </Button>
45
+ <Button
46
+ variant="outline"
47
+ size="icon"
57
48
  aria-label="Toggle superscript"
49
+ data-state={isSuperscript ? "on" : "off"}
58
50
  onClick={() => {
59
51
  activeEditor.dispatchCommand(FORMAT_TEXT_COMMAND, "superscript")
60
52
  }}
61
- variant={"outline"}
53
+ className="editor-toolbar-item"
62
54
  >
63
55
  <IconSize size="sm">
64
56
  <SuperscriptIcon />
65
57
  </IconSize>
66
- </ToggleGroupItem>
67
- </ToggleGroup>
58
+ </Button>
59
+ </>
68
60
  )
69
61
  }
@@ -7,13 +7,13 @@
7
7
  @mixin focus-ring {
8
8
  &:focus-visible {
9
9
  outline: none;
10
- box-shadow: 0 0 0 2px var(--ring), 0 0 0 4px $editor-bg-color;
10
+ box-shadow: 0 0 0 $editor-outline-width var(--ring), 0 0 0 calc($editor-outline-width * 2) $editor-bg-color;
11
11
  }
12
12
  }
13
13
 
14
14
  @mixin text-sm {
15
- font-size: 14px;
16
- line-height: 20px;
15
+ font-size: $editor-font-size-sm;
16
+ line-height: $editor-line-height-snug;
17
17
  }
18
18
 
19
19
  @mixin flex-center {
@@ -21,6 +21,11 @@
21
21
  align-items: center;
22
22
  }
23
23
 
24
+ @mixin flex-center-between {
25
+ @include flex-center;
26
+ justify-content: space-between;
27
+ }
28
+
24
29
  @mixin flex-col {
25
30
  display: flex;
26
31
  flex-direction: column;
@@ -31,6 +36,32 @@
31
36
  justify-content: center;
32
37
  }
33
38
 
39
+ @mixin backdrop-blur($blur: 8px, $bg: rgba(255, 255, 255, 0.8)) {
40
+ background-color: $bg;
41
+ @supports (backdrop-filter: blur($blur)) {
42
+ backdrop-filter: blur($blur);
43
+ }
44
+ }
45
+
46
+ @mixin backdrop-blur-dark($blur: 8px, $bg: rgba(15, 15, 15, 0.8)) {
47
+ .dark & {
48
+ @supports (backdrop-filter: blur($blur)) {
49
+ background-color: $bg;
50
+ backdrop-filter: blur($blur);
51
+ }
52
+ }
53
+ }
54
+
55
+ @mixin control-size($size) {
56
+ width: $size;
57
+ height: $size;
58
+ }
59
+
60
+ @mixin icon-size($size) {
61
+ @include control-size($size);
62
+ flex-shrink: 0;
63
+ }
64
+
34
65
  @mixin shadow-sm {
35
66
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
36
67
  }
@@ -47,6 +78,27 @@
47
78
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
48
79
  }
49
80
 
81
+ @mixin absolute-full {
82
+ position: absolute;
83
+ inset: 0;
84
+ }
85
+
86
+ @mixin truncate {
87
+ overflow: hidden;
88
+ text-overflow: ellipsis;
89
+ white-space: nowrap;
90
+ }
91
+
92
+ @mixin overflow-hidden {
93
+ overflow: hidden;
94
+ }
95
+
96
+ @mixin scrollbar-hide {
97
+ &::-webkit-scrollbar { display: none; }
98
+ -ms-overflow-style: none;
99
+ scrollbar-width: none;
100
+ }
101
+
50
102
  @mixin rounded-sm {
51
103
  border-radius: calc($editor-border-radius - 2px);
52
104
  }
@@ -55,26 +107,48 @@
55
107
  border-radius: $editor-border-radius;
56
108
  }
57
109
 
110
+ @mixin rounded-r-md {
111
+ border-top-right-radius: $editor-border-radius;
112
+ border-bottom-right-radius: $editor-border-radius;
113
+ }
114
+
115
+ @mixin rounded-l-md {
116
+ border-top-left-radius: $editor-border-radius;
117
+ border-bottom-left-radius: $editor-border-radius;
118
+ }
119
+
120
+ @mixin rounded-t-md {
121
+ border-top-left-radius: $editor-border-radius;
122
+ border-top-right-radius: $editor-border-radius;
123
+ }
124
+
125
+ @mixin rounded-b-md {
126
+ border-bottom-left-radius: $editor-border-radius;
127
+ border-bottom-right-radius: $editor-border-radius;
128
+ }
129
+
58
130
  @mixin rounded-lg {
59
131
  border-radius: calc($editor-border-radius + 4px);
60
132
  }
61
133
 
134
+ @mixin rounded-full {
135
+ border-radius: 9999px;
136
+ }
137
+
62
138
  // --- Unified Hover Styles ---
63
139
  @mixin editor-hover-base {
64
- background-color: $editor-accent-color;
65
- color: $editor-accent-foreground-color;
66
- border-color: $editor-accent-color;
67
140
  transform: translateY(-1px);
68
- box-shadow: 0 2px 4px -1px rgba(0, 0, 0, 0.1);
141
+ box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
69
142
  }
70
143
 
71
144
  @mixin editor-active-base {
72
- transform: translateY(0);
145
+ transform: translateY(0) scale(0.98);
73
146
  box-shadow: none;
147
+ filter: brightness(0.95);
74
148
  }
75
149
 
76
150
  @mixin editor-button-interactive {
77
- &:hover:not(:disabled):not([data-state="on"]) {
151
+ &:hover:not(:disabled):not([data-state="on"]):not([data-state="active"]) {
78
152
  @include editor-hover-base;
79
153
  }
80
154
 
@@ -83,9 +157,45 @@
83
157
  }
84
158
  }
85
159
 
160
+ @mixin editor-input-interactive {
161
+ &:hover:not(:disabled):not([readonly]) {
162
+ background-color: color-mix(in srgb, var(--background), black 3%);
163
+ border-color: $editor-accent-color;
164
+ transform: translateY(-1px);
165
+ box-shadow: 0 2px 4px -1px rgba(0, 0, 0, 0.1);
166
+ }
167
+
168
+ &:focus {
169
+ border-color: var(--primary);
170
+ box-shadow: 0 0 0 2px var(--ring);
171
+ outline: none;
172
+ }
173
+ }
174
+
175
+ @mixin floating-toolbar-base {
176
+ position: absolute;
177
+ top: 0;
178
+ left: 0;
179
+ @include flex-center;
180
+ gap: $editor-gap-1;
181
+ @include rounded-md;
182
+ border: $editor-border-width solid var(--border);
183
+ padding: $editor-gap-1;
184
+ opacity: 0;
185
+ @include shadow-lg;
186
+ transition: opacity $editor-transition-normal, transform $editor-transition-normal;
187
+ will-change: transform;
188
+ z-index: $editor-z-index-floating;
189
+
190
+ &--visible {
191
+ opacity: 1;
192
+ animation: editor-floating-zoom-in $editor-transition-normal cubic-bezier(0.16, 1, 0.3, 1);
193
+ }
194
+ }
195
+
86
196
  // Interactive mixin for dropdown/menu items
87
197
  @mixin editor-dropdown-item-interactive {
88
- &:hover, &:focus, &--selected, &[aria-selected="true"], &[data-selected="true"] {
198
+ &:hover, &:focus, &--selected, &[aria-selected="true"], &[data-selected="true"], &[data-state="active"], &[data-state="on"] {
89
199
  background-color: $editor-accent-color;
90
200
  color: $editor-accent-foreground-color;
91
201
  border-color: $editor-border-color; // Use border color for visibility
@@ -101,7 +211,45 @@
101
211
  to { transform: rotate(360deg); }
102
212
  }
103
213
 
214
+ @keyframes pulse {
215
+ 0%, 100% { opacity: 1; }
216
+ 50% { opacity: .5; }
217
+ }
218
+
104
219
  @keyframes editor-fade-in {
105
220
  from { opacity: 0; transform: translateY(-10px); }
106
221
  to { opacity: 1; transform: translateY(0); }
107
222
  }
223
+
224
+ @keyframes editor-dialog-zoom-in {
225
+ from {
226
+ opacity: 0;
227
+ transform: translate(-50%, -48%) scale(0.95);
228
+ }
229
+ to {
230
+ opacity: 1;
231
+ transform: translate(-50%, -50%) scale(1);
232
+ }
233
+ }
234
+
235
+ @keyframes editor-popover-zoom-in {
236
+ from {
237
+ opacity: 0;
238
+ transform: scale(0.95);
239
+ }
240
+ to {
241
+ opacity: 1;
242
+ transform: scale(1);
243
+ }
244
+ }
245
+
246
+ @keyframes editor-floating-zoom-in {
247
+ from {
248
+ opacity: 0;
249
+ transform: scale(0.95) translateY(4px);
250
+ }
251
+ to {
252
+ opacity: 1;
253
+ transform: scale(1) translateY(0);
254
+ }
255
+ }
@@ -6,23 +6,191 @@
6
6
 
7
7
  // Typography
8
8
  $editor-font-family: var(--font-inter), "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !default;
9
+ $editor-font-family-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace !default;
10
+ $editor-font-size-xs: 0.75rem !default;
11
+ $editor-font-size-sm: 0.875rem !default;
12
+ $editor-font-size-md: 1rem !default;
13
+ $editor-font-size-lg: 1.125rem !default;
9
14
  $editor-font-size-base: 16px !default;
15
+ $editor-line-height-tight: 1.25 !default;
16
+ $editor-line-height-snug: 1.375 !default;
17
+ $editor-line-height-normal: 1.5 !default;
18
+ $editor-line-height-relaxed: 1.625 !default;
19
+ $editor-line-height-loose: 2 !default;
10
20
  $editor-line-height-base: 1.75 !default;
11
21
 
22
+ // Font Weights
23
+ $editor-font-weight-normal: 400 !default;
24
+ $editor-font-weight-medium: 500 !default;
25
+ $editor-font-weight-semibold: 600 !default;
26
+ $editor-font-weight-bold: 700 !default;
27
+
28
+ // Heading Sizes & Spacing
29
+ $editor-h1-size: 36px !default;
30
+ $editor-h2-size: 30px !default;
31
+ $editor-h3-size: 24px !default;
32
+ $editor-h4-size: 20px !default;
33
+ $editor-h5-size: 18px !default;
34
+ $editor-h6-size: 16px !default;
35
+
36
+ $editor-heading-line-height: 1.25 !default;
37
+ $editor-heading-margin-top: 24px !default;
38
+ $editor-heading-margin-bottom: 12px !default;
39
+ $editor-heading-letter-spacing-tight: -0.025em !default;
40
+
41
+ // Code Block
42
+ $editor-code-padding: 16px !default;
43
+ $editor-code-font-size: 14px !default;
44
+ $editor-code-margin: 24px !default;
45
+
46
+ // Quote
47
+ $editor-quote-padding: 16px !default;
48
+ $editor-quote-border-width: 4px !default;
49
+ $editor-quote-font-size: 18px !default;
50
+
51
+ // Lists
52
+ $editor-list-padding-left: 24px !default;
53
+ $editor-list-item-margin-bottom: 4px !default;
54
+ $editor-list-margin-vertical: 8px !default;
55
+ $editor-checklist-gap: 12px !default;
56
+ $editor-checklist-item-padding-vertical: 4px !default;
57
+ $editor-checklist-icon-size: 18px !default;
58
+ $editor-checklist-icon-margin-top: 3px !default;
59
+ $editor-checklist-icon-border-radius: 4px !default;
60
+ $editor-checklist-icon-checkmark-size: 16px !default;
61
+
62
+ // Paragraph
63
+ $editor-paragraph-margin-vertical: 12px !default;
64
+
65
+ // Editor Content
66
+ $editor-content-min-height: 288px !default;
67
+ $editor-content-padding-x: 32px !default;
68
+ $editor-content-padding-y: 16px !default;
69
+ $editor-placeholder-padding-y: 18px !default;
70
+
71
+ // Table
72
+ $editor-table-margin-vertical: 16px !default;
73
+ $editor-table-cell-padding-x: 6px !default;
74
+ $editor-table-cell-padding-y: 8px !default;
75
+ $editor-table-action-button-size: 20px !default;
76
+ $editor-table-resizer-width: 8px !default;
77
+ $editor-table-resizer-offset: -4px !default;
78
+ $editor-table-action-button-top: 6px !default;
79
+ $editor-table-action-button-right: 4px !default;
80
+ $editor-table-cell-editing-shadow: rgba(0, 0, 0, 0.1) !default;
81
+ $editor-table-cell-selection-opacity: 0.3 !default;
82
+ $editor-table-sorted-indicator-height: 4px !default;
83
+ $editor-shadow-blur-sm: 4px !default;
84
+ $editor-shadow-blur-md: 8px !default;
85
+ $editor-shadow-blur-lg: 12px !default;
86
+
87
+ // Media
88
+ $editor-image-broken-size: 200px !default;
89
+ $editor-tweet-max-width: 550px !default;
90
+
91
+ // Horizontal Rule
92
+ $editor-hr-height: 2px !default;
93
+ $editor-hr-margin-vertical: 1em !default;
94
+
95
+ // Inline Code
96
+ $editor-inline-code-padding-x: 6px !default;
97
+ $editor-inline-code-padding-y: 2px !default;
98
+
99
+ // Formatting
100
+ $editor-script-font-size: 0.8em !default;
101
+ $editor-hashtag-opacity: 0.1 !default;
102
+ $editor-image-caption-min-width: 100px !default;
103
+ $editor-image-caption-bg: rgba(255, 255, 255, 0.9) !default;
104
+
12
105
  // Colors - Compatible with Shadcn CSS Variables
13
106
  $editor-primary-color: var(--primary, #3b82f6) !default; // blue-500 fallback
14
107
  $editor-link-color: #3b82f6 !default; // Fixed link color (Blue 500) to ensure consistency across apps
15
108
  $editor-text-color: var(--foreground, #1f2937) !default; // gray-800 fallback
16
109
  $editor-bg-color: var(--background, transparent) !default;
17
110
  $editor-muted-color: var(--muted, #f3f4f6) !default; // gray-100 fallback
111
+ $editor-muted-foreground-color: var(--muted-foreground, #64748b) !default; // slate-500 fallback
18
112
  $editor-border-color: var(--border, #d1d5db) !default; // gray-300 fallback
19
113
  $editor-quote-border-color: var(--input, #e5e7eb) !default; // gray-200 fallback
20
114
  $editor-accent-color: var(--accent, #f1f5f9) !default; // slate-100 fallback
21
115
  $editor-accent-foreground-color: var(--accent-foreground, #0f172a) !default; // slate-900 fallback
22
116
 
117
+ // Borders & Outlines
118
+ $editor-border-width: 1px !default;
119
+ $editor-border-width-thick: 2px !default;
120
+ $editor-outline-width: 2px !default;
121
+ $editor-outline-offset: 2px !default;
122
+
23
123
  // Layout
24
124
  $editor-border-radius: var(--radius, 8px) !default;
25
125
  $editor-spacing-unit: 8px !default;
126
+ $editor-control-size-sm: 32px !default; // h-8
127
+ $editor-control-size-md: 36px !default; // h-9
128
+ $editor-control-size-lg: 40px !default; // h-10
129
+ $editor-control-size-xl: 44px !default; // h-11
130
+
131
+ // Transitions
132
+ $editor-transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1) !default;
133
+ $editor-transition-normal: 200ms cubic-bezier(0.4, 0, 0.2, 1) !default;
134
+ $editor-transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1) !default;
135
+
136
+ // Animations
137
+ $editor-animation-pulse: 2s !default;
138
+ $editor-animation-spin: 1s !default;
139
+
140
+ // Gaps
141
+ $editor-gap-0-5: 2px !default;
142
+ $editor-gap-1: 4px !default;
143
+ $editor-gap-1-5: 6px !default;
144
+ $editor-gap-2: 8px !default;
145
+ $editor-gap-3: 12px !default;
146
+ $editor-gap-4: 16px !default;
147
+ $editor-gap-5: 20px !default;
148
+
149
+ // Opacity
150
+ $editor-opacity-disabled: 0.5 !default;
151
+ $editor-opacity-muted: 0.7 !default;
152
+ $editor-opacity-soft: 0.3 !default;
153
+
154
+ // Z-index
155
+ $editor-z-index-layer-1: 1 !default;
156
+ $editor-z-index-layer-10: 10 !default;
157
+ $editor-z-index-toolbar: 20 !default;
158
+ $editor-z-index-floating: 50 !default;
159
+ $editor-z-index-dialog-overlay: 50 !default;
160
+ $editor-z-index-dialog: 51 !default;
161
+ $editor-z-index-popover: 100 !default;
162
+
163
+ // Dialog
164
+ $editor-dialog-max-width-default: 32rem !default;
165
+ $editor-dialog-max-width-lg: 50rem !default;
166
+ $editor-dialog-overlay-blur: 4px !default;
167
+ $editor-dialog-overlay-bg: rgba(0, 0, 0, 0.4) !default;
168
+ $editor-popover-width: 18rem !default;
169
+ $editor-popover-max-height: 300px !default;
170
+ $editor-tooltip-max-width: 200px !default;
171
+ $editor-toolbar-select-width: 220px !default;
172
+ $editor-format-select-width: 72px !default;
173
+ $editor-floating-toolbar-max-width: 560px !default;
174
+ $editor-color-picker-height: 160px !default;
175
+ $editor-scroll-area-max-height: 350px !default;
176
+ $editor-link-editor-max-width: 400px !default;
177
+ $editor-component-picker-width: 250px !default;
178
+ $editor-mentions-width: 200px !default;
179
+
180
+ // Select & Toggle
181
+ $editor-select-min-width-auto: 7rem !default;
182
+ $editor-select-item-padding-vertical: 0.375rem !default;
183
+ $editor-block-format-label-max-width: 80px !default;
184
+
185
+ // Separator
186
+ $editor-separator-min-height-vertical: 1.5rem !default;
187
+
188
+ // Icon
189
+ $editor-icon-size-xs: 12px !default;
190
+ $editor-icon-size-sm: 16px !default;
191
+ $editor-icon-size-md: 20px !default;
192
+ $editor-icon-size-lg: 24px !default;
193
+ $editor-icon-size-xl: 32px !default;
26
194
 
27
195
  // Code
28
196
  $editor-code-bg: var(--muted, #f3f4f6) !default;
@@ -0,0 +1,59 @@
1
+ @use "../variables" as *;
2
+ @use "../mixins" as *;
3
+
4
+ .lexical-editor-root {
5
+ // Code Block
6
+ .editor-code {
7
+ background-color: $editor-code-bg;
8
+ color: $editor-code-color;
9
+ font-family: $editor-font-family-mono;
10
+ display: block;
11
+ padding: $editor-code-padding $editor-code-padding $editor-code-padding ($editor-code-padding * 4);
12
+ line-height: $editor-line-height-base;
13
+ font-size: $editor-code-font-size;
14
+ margin: $editor-code-margin 0 !important;
15
+ overflow-x: auto;
16
+ border: $editor-border-width solid var(--border);
17
+ position: relative;
18
+ @include rounded-md;
19
+ tab-size: 2;
20
+ @include shadow-sm;
21
+
22
+ &::before {
23
+ content: attr(data-gutter);
24
+ position: absolute;
25
+ background-color: var(--muted);
26
+ left: 0;
27
+ top: 0;
28
+ bottom: 0;
29
+ padding: $editor-code-padding;
30
+ border-right: $editor-border-width solid var(--border);
31
+ color: var(--muted-foreground);
32
+ white-space: pre-wrap;
33
+ text-align: right;
34
+ min-width: ($editor-code-padding * 3);
35
+ font-size: calc($editor-code-font-size - $editor-outline-width);
36
+ user-select: none;
37
+ }
38
+ }
39
+
40
+ // Inline Code
41
+ .editor-text-code {
42
+ background-color: $editor-muted-color;
43
+ color: $editor-text-color;
44
+ padding: $editor-inline-code-padding-y $editor-inline-code-padding-x;
45
+ font-family: $editor-font-family-mono;
46
+ font-size: $editor-code-font-size;
47
+ @include rounded-md;
48
+ border: $editor-border-width solid $editor-border-color;
49
+ font-weight: $editor-font-weight-medium;
50
+ }
51
+
52
+ // Hashtag
53
+ .editor-hashtag {
54
+ background-color: rgba($editor-primary-color, $editor-hashtag-opacity);
55
+ color: $editor-primary-color;
56
+ border-bottom: $editor-border-width solid $editor-primary-color;
57
+ padding: 0 calc($editor-gap-1 / 2);
58
+ }
59
+ }