@lexical/tailwind 0.35.1-nightly.20250925.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/LICENSE +21 -0
- package/LexicalTailwind.dev.js +160 -0
- package/LexicalTailwind.dev.mjs +158 -0
- package/LexicalTailwind.js +11 -0
- package/LexicalTailwind.js.flow +14 -0
- package/LexicalTailwind.mjs +12 -0
- package/LexicalTailwind.node.mjs +10 -0
- package/LexicalTailwind.prod.js +9 -0
- package/LexicalTailwind.prod.mjs +9 -0
- package/README.md +7 -0
- package/index.d.ts +11 -0
- package/package.json +52 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,160 @@
|
|
|
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
|
+
'use strict';
|
|
10
|
+
|
|
11
|
+
var lexical = require('lexical');
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
15
|
+
*
|
|
16
|
+
* This source code is licensed under the MIT license found in the
|
|
17
|
+
* LICENSE file in the root directory of this source tree.
|
|
18
|
+
*
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
function join(...args) {
|
|
22
|
+
return args.join(' ');
|
|
23
|
+
}
|
|
24
|
+
const checklistItemCommonClasses =
|
|
25
|
+
// This [&]: is necessary to override the mx-8 from listitem since the theme is not designed for tailwind semantics (both sets of classes are applied)
|
|
26
|
+
join('relative [&]:mx-[0.5em] px-[1.5em] list-none outline-none block min-h-[1.5em]', 'before:w-4 before:h-4 before:top-0.5 before:left-0 before:cursor-pointer before:block before:bg-color before:absolute before:border before:border-solid before:rounded-sm', 'rtl:before:left-auto rtl:before:right-0', 'focus:before:shadow-[0_0_0_2px_#a6cdfe]');
|
|
27
|
+
const listCommonClasses = 'p-0 m-0 list-outside';
|
|
28
|
+
const theme = {
|
|
29
|
+
// TODO animation
|
|
30
|
+
blockCursor: join('block pointer-events-none absolute', 'after:block after:absolute after:-top-0.5 after:width-5 after:border-t after:border-solid after:border-black after:animate-lexical-cursor-blink'),
|
|
31
|
+
// characterLimit: "PlaygroundEditorTheme__characterLimit",
|
|
32
|
+
// code: 'PlaygroundEditorTheme__code',
|
|
33
|
+
// codeHighlight: {
|
|
34
|
+
// atrule: 'PlaygroundEditorTheme__tokenAttr',
|
|
35
|
+
// attr: 'PlaygroundEditorTheme__tokenAttr',
|
|
36
|
+
// boolean: 'PlaygroundEditorTheme__tokenProperty',
|
|
37
|
+
// builtin: 'PlaygroundEditorTheme__tokenSelector',
|
|
38
|
+
// cdata: 'PlaygroundEditorTheme__tokenComment',
|
|
39
|
+
// char: 'PlaygroundEditorTheme__tokenSelector',
|
|
40
|
+
// class: 'PlaygroundEditorTheme__tokenFunction',
|
|
41
|
+
// 'class-name': 'PlaygroundEditorTheme__tokenFunction',
|
|
42
|
+
// comment: 'PlaygroundEditorTheme__tokenComment',
|
|
43
|
+
// constant: 'PlaygroundEditorTheme__tokenProperty',
|
|
44
|
+
// deleted: 'PlaygroundEditorTheme__tokenProperty',
|
|
45
|
+
// doctype: 'PlaygroundEditorTheme__tokenComment',
|
|
46
|
+
// entity: 'PlaygroundEditorTheme__tokenOperator',
|
|
47
|
+
// function: 'PlaygroundEditorTheme__tokenFunction',
|
|
48
|
+
// important: 'PlaygroundEditorTheme__tokenVariable',
|
|
49
|
+
// inserted: 'PlaygroundEditorTheme__tokenSelector',
|
|
50
|
+
// keyword: 'PlaygroundEditorTheme__tokenAttr',
|
|
51
|
+
// namespace: 'PlaygroundEditorTheme__tokenVariable',
|
|
52
|
+
// number: 'PlaygroundEditorTheme__tokenProperty',
|
|
53
|
+
// operator: 'PlaygroundEditorTheme__tokenOperator',
|
|
54
|
+
// prolog: 'PlaygroundEditorTheme__tokenComment',
|
|
55
|
+
// property: 'PlaygroundEditorTheme__tokenProperty',
|
|
56
|
+
// punctuation: 'PlaygroundEditorTheme__tokenPunctuation',
|
|
57
|
+
// regex: 'PlaygroundEditorTheme__tokenVariable',
|
|
58
|
+
// selector: 'PlaygroundEditorTheme__tokenSelector',
|
|
59
|
+
// string: 'PlaygroundEditorTheme__tokenSelector',
|
|
60
|
+
// symbol: 'PlaygroundEditorTheme__tokenProperty',
|
|
61
|
+
// tag: 'PlaygroundEditorTheme__tokenProperty',
|
|
62
|
+
// url: 'PlaygroundEditorTheme__tokenOperator',
|
|
63
|
+
// variable: 'PlaygroundEditorTheme__tokenVariable',
|
|
64
|
+
// },
|
|
65
|
+
// embedBlock: {
|
|
66
|
+
// base: 'PlaygroundEditorTheme__embedBlock',
|
|
67
|
+
// focus: 'PlaygroundEditorTheme__embedBlockFocus',
|
|
68
|
+
// },
|
|
69
|
+
// hashtag: 'PlaygroundEditorTheme__hashtag',
|
|
70
|
+
heading: {
|
|
71
|
+
h1: 'text-[24px] text-neutral-950 font-normal m-0',
|
|
72
|
+
h2: 'text-[15px] text-gray-500 font-bold m-0 uppercase',
|
|
73
|
+
h3: 'text-[12px] m-0 uppercase',
|
|
74
|
+
h4: undefined,
|
|
75
|
+
h5: undefined,
|
|
76
|
+
h6: undefined
|
|
77
|
+
},
|
|
78
|
+
hr: join('p-0.5 border-none mx-0 my-[1em] cursor-pointer', `after:block after:content-[''] after:h-[2px] after:leading-[2px] after:bg-[#ccc]`),
|
|
79
|
+
hrSelected: 'outline-[2px] outline-solid outline-[rgb(60,132,244)]',
|
|
80
|
+
// image: 'editor-image',
|
|
81
|
+
indent: '[--lexical-indent-base-value:40px]',
|
|
82
|
+
// inlineImage: 'inline-editor-image',
|
|
83
|
+
// layoutContainer: 'PlaygroundEditorTheme__layoutContainer',
|
|
84
|
+
// layoutItem: 'PlaygroundEditorTheme__layoutItem',
|
|
85
|
+
link: join('text-blue-600', 'hover:underline hover:cursor-pointer'),
|
|
86
|
+
list: {
|
|
87
|
+
checklist: '',
|
|
88
|
+
listitem: join('mx-8 my-0', 'font-(family-name:--listitem-marker-font-family) text-(length:--listitem-marker-font-size) bg-(--listitem-marker-background-color)', 'marker:text-(--listitem-marker-color) marker:font-(family-name:--listitem-marker-font-family) marker:text-(length:--listitem-marker-font-size) marker:bg-(--listitem-marker-background-color)'),
|
|
89
|
+
// TODO fix up checked/unchecked
|
|
90
|
+
listitemChecked: join(checklistItemCommonClasses, 'line-through', 'before:border-[rgb(61,135,245)] before:bg-[#3d87f5] before:bg-no-repeat', 'after:cursor-pointer after:border-white after:border-solid after:absolute after:block after:top-1.5 after:width-[3px] after:inset-x-[7px] after:height-1.5 after:rotate-45 after:border-t-0 after:border-r-0.5 after:border-b-0.5 after:border-l-0'),
|
|
91
|
+
listitemUnchecked: join(checklistItemCommonClasses, 'before:border-[#999]'),
|
|
92
|
+
nested: {
|
|
93
|
+
listitem: join('list-none', 'before:hidden', 'after:hidden')
|
|
94
|
+
},
|
|
95
|
+
olDepth: ['list-decimal', 'list-[upper-alpha]', 'list-[lower-alpha]', 'list-[upper-roman]', 'list-[lower-roman]'].map(cls => join(listCommonClasses, cls)),
|
|
96
|
+
ul: join(listCommonClasses, 'list-disc')
|
|
97
|
+
},
|
|
98
|
+
// mark: 'PlaygroundEditorTheme__mark',
|
|
99
|
+
// markOverlap: 'PlaygroundEditorTheme__markOverlap',
|
|
100
|
+
paragraph: 'relative m-0',
|
|
101
|
+
quote: 'm-0 ml-5 mb-2.5 text-[15px] text-gray-500 border-slate-300 border-l-4 border-solid pl-4',
|
|
102
|
+
// tab: 'PlaygroundEditorTheme__tabNode',
|
|
103
|
+
table: 'border-collapse border-spacing-0 overflow-scroll table-fixed w-max mt-0 mr-[25px] mb-[30px] ml-0',
|
|
104
|
+
tableCell: 'border border-solid border-[#bbb] w-[75px] min-w-[75px] align-top text-start py-[6px] px-2 relative outline-none',
|
|
105
|
+
tableCellEditing: 'shadow-[0_0_5px_rgba(0,0,0,0.4)] rounded-[3px]',
|
|
106
|
+
tableCellHeader: 'bg-[#f2f3f5] text-start',
|
|
107
|
+
tableSelection: 'selection:bg-transparent',
|
|
108
|
+
// tableAddColumns: 'absolute bg-[#eee] h-full border-0 cursor-pointer animate-lexical-table-controls',
|
|
109
|
+
// tableAddRows: 'PlaygroundEditorTheme__tableAddRows',
|
|
110
|
+
// tableAlignment: {
|
|
111
|
+
// center: 'PlaygroundEditorTheme__tableAlignmentCenter',
|
|
112
|
+
// right: 'PlaygroundEditorTheme__tableAlignmentRight',
|
|
113
|
+
// },
|
|
114
|
+
// tableCellActionButton: 'PlaygroundEditorTheme__tableCellActionButton',
|
|
115
|
+
// tableCellActionButtonContainer:
|
|
116
|
+
// 'PlaygroundEditorTheme__tableCellActionButtonContainer',
|
|
117
|
+
// tableCellPrimarySelected: 'PlaygroundEditorTheme__tableCellPrimarySelected',
|
|
118
|
+
// tableCellResizer: 'PlaygroundEditorTheme__tableCellResizer',
|
|
119
|
+
// tableCellSelected: 'PlaygroundEditorTheme__tableCellSelected',
|
|
120
|
+
// tableFrozenColumn: 'PlaygroundEditorTheme__tableFrozenColumn',
|
|
121
|
+
// tableFrozenRow: 'PlaygroundEditorTheme__tableFrozenRow',
|
|
122
|
+
// tableRowStriping: 'PlaygroundEditorTheme__tableRowStriping',
|
|
123
|
+
// tableScrollableWrapper: 'PlaygroundEditorTheme__tableScrollableWrapper',
|
|
124
|
+
// tableCellSortedIndicator: 'PlaygroundEditorTheme__tableCellSortedIndicator',
|
|
125
|
+
// tableResizeRuler: 'PlaygroundEditorTheme__tableCellResizeRuler',
|
|
126
|
+
// tableSelected: 'PlaygroundEditorTheme__tableSelected',
|
|
127
|
+
// tableSelection: 'PlaygroundEditorTheme__tableSelection',
|
|
128
|
+
text: {
|
|
129
|
+
bold: 'font-bold',
|
|
130
|
+
capitalize: 'capitalize',
|
|
131
|
+
code: 'font-mono text-[94%] py-px px-1 background-color: bg-slate-100',
|
|
132
|
+
highlight: 'bg-[rgba(255,212,0,0.14)] border-solid border-b-[2px] border-[rgba(255,212,0,0.3)]',
|
|
133
|
+
italic: 'italic',
|
|
134
|
+
lowercase: 'lowercase',
|
|
135
|
+
strikethrough: 'line-through',
|
|
136
|
+
subscript: 'text-[0.8em] !align-sub',
|
|
137
|
+
superscript: 'text-[0.8em] align-super',
|
|
138
|
+
underline: 'underline',
|
|
139
|
+
underlineStrikethrough: '[text-decoration:underline_line-through]',
|
|
140
|
+
uppercase: 'uppercase'
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Configures the lexical theme ({@link EditorThemeClasses}) with tailwind defaults
|
|
146
|
+
*/
|
|
147
|
+
const TailwindExtension = lexical.defineExtension({
|
|
148
|
+
name: '@lexical/tailwind',
|
|
149
|
+
peerDependencies: [lexical.declarePeerDependency('@lexical/react/TreeView', {
|
|
150
|
+
timeTravelButtonClassName: 'absolute top-[10px] right-[15px] border-0 p-0 text-xs bg-transparent text-white hover:underline cursor-pointer',
|
|
151
|
+
timeTravelPanelButtonClassName: 'p-0 border-0 bg-transparent flex-1 text-white text-xs hover:underline cursor-pointer',
|
|
152
|
+
timeTravelPanelClassName: 'overflow-hidden p-0 pb-2.5 mx-auto flex',
|
|
153
|
+
timeTravelPanelSliderClassName: 'p-0 flex-[8]',
|
|
154
|
+
treeTypeButtonClassName: 'absolute top-[10px] right-[85px] border-0 p-0 text-xs bg-transparent text-white hover:underline cursor-pointer',
|
|
155
|
+
viewClassName: 'block bg-neutral-950 text-white p-1.5 text-xs whitespace-pre-wrap mx-auto my-1 mb-2.5 max-h-[250px] relative rounded-b-[10px] overflow-auto leading-3.5'
|
|
156
|
+
})],
|
|
157
|
+
theme
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
exports.TailwindExtension = TailwindExtension;
|
|
@@ -0,0 +1,158 @@
|
|
|
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 { defineExtension, declarePeerDependency } from 'lexical';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
13
|
+
*
|
|
14
|
+
* This source code is licensed under the MIT license found in the
|
|
15
|
+
* LICENSE file in the root directory of this source tree.
|
|
16
|
+
*
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
function join(...args) {
|
|
20
|
+
return args.join(' ');
|
|
21
|
+
}
|
|
22
|
+
const checklistItemCommonClasses =
|
|
23
|
+
// This [&]: is necessary to override the mx-8 from listitem since the theme is not designed for tailwind semantics (both sets of classes are applied)
|
|
24
|
+
join('relative [&]:mx-[0.5em] px-[1.5em] list-none outline-none block min-h-[1.5em]', 'before:w-4 before:h-4 before:top-0.5 before:left-0 before:cursor-pointer before:block before:bg-color before:absolute before:border before:border-solid before:rounded-sm', 'rtl:before:left-auto rtl:before:right-0', 'focus:before:shadow-[0_0_0_2px_#a6cdfe]');
|
|
25
|
+
const listCommonClasses = 'p-0 m-0 list-outside';
|
|
26
|
+
const theme = {
|
|
27
|
+
// TODO animation
|
|
28
|
+
blockCursor: join('block pointer-events-none absolute', 'after:block after:absolute after:-top-0.5 after:width-5 after:border-t after:border-solid after:border-black after:animate-lexical-cursor-blink'),
|
|
29
|
+
// characterLimit: "PlaygroundEditorTheme__characterLimit",
|
|
30
|
+
// code: 'PlaygroundEditorTheme__code',
|
|
31
|
+
// codeHighlight: {
|
|
32
|
+
// atrule: 'PlaygroundEditorTheme__tokenAttr',
|
|
33
|
+
// attr: 'PlaygroundEditorTheme__tokenAttr',
|
|
34
|
+
// boolean: 'PlaygroundEditorTheme__tokenProperty',
|
|
35
|
+
// builtin: 'PlaygroundEditorTheme__tokenSelector',
|
|
36
|
+
// cdata: 'PlaygroundEditorTheme__tokenComment',
|
|
37
|
+
// char: 'PlaygroundEditorTheme__tokenSelector',
|
|
38
|
+
// class: 'PlaygroundEditorTheme__tokenFunction',
|
|
39
|
+
// 'class-name': 'PlaygroundEditorTheme__tokenFunction',
|
|
40
|
+
// comment: 'PlaygroundEditorTheme__tokenComment',
|
|
41
|
+
// constant: 'PlaygroundEditorTheme__tokenProperty',
|
|
42
|
+
// deleted: 'PlaygroundEditorTheme__tokenProperty',
|
|
43
|
+
// doctype: 'PlaygroundEditorTheme__tokenComment',
|
|
44
|
+
// entity: 'PlaygroundEditorTheme__tokenOperator',
|
|
45
|
+
// function: 'PlaygroundEditorTheme__tokenFunction',
|
|
46
|
+
// important: 'PlaygroundEditorTheme__tokenVariable',
|
|
47
|
+
// inserted: 'PlaygroundEditorTheme__tokenSelector',
|
|
48
|
+
// keyword: 'PlaygroundEditorTheme__tokenAttr',
|
|
49
|
+
// namespace: 'PlaygroundEditorTheme__tokenVariable',
|
|
50
|
+
// number: 'PlaygroundEditorTheme__tokenProperty',
|
|
51
|
+
// operator: 'PlaygroundEditorTheme__tokenOperator',
|
|
52
|
+
// prolog: 'PlaygroundEditorTheme__tokenComment',
|
|
53
|
+
// property: 'PlaygroundEditorTheme__tokenProperty',
|
|
54
|
+
// punctuation: 'PlaygroundEditorTheme__tokenPunctuation',
|
|
55
|
+
// regex: 'PlaygroundEditorTheme__tokenVariable',
|
|
56
|
+
// selector: 'PlaygroundEditorTheme__tokenSelector',
|
|
57
|
+
// string: 'PlaygroundEditorTheme__tokenSelector',
|
|
58
|
+
// symbol: 'PlaygroundEditorTheme__tokenProperty',
|
|
59
|
+
// tag: 'PlaygroundEditorTheme__tokenProperty',
|
|
60
|
+
// url: 'PlaygroundEditorTheme__tokenOperator',
|
|
61
|
+
// variable: 'PlaygroundEditorTheme__tokenVariable',
|
|
62
|
+
// },
|
|
63
|
+
// embedBlock: {
|
|
64
|
+
// base: 'PlaygroundEditorTheme__embedBlock',
|
|
65
|
+
// focus: 'PlaygroundEditorTheme__embedBlockFocus',
|
|
66
|
+
// },
|
|
67
|
+
// hashtag: 'PlaygroundEditorTheme__hashtag',
|
|
68
|
+
heading: {
|
|
69
|
+
h1: 'text-[24px] text-neutral-950 font-normal m-0',
|
|
70
|
+
h2: 'text-[15px] text-gray-500 font-bold m-0 uppercase',
|
|
71
|
+
h3: 'text-[12px] m-0 uppercase',
|
|
72
|
+
h4: undefined,
|
|
73
|
+
h5: undefined,
|
|
74
|
+
h6: undefined
|
|
75
|
+
},
|
|
76
|
+
hr: join('p-0.5 border-none mx-0 my-[1em] cursor-pointer', `after:block after:content-[''] after:h-[2px] after:leading-[2px] after:bg-[#ccc]`),
|
|
77
|
+
hrSelected: 'outline-[2px] outline-solid outline-[rgb(60,132,244)]',
|
|
78
|
+
// image: 'editor-image',
|
|
79
|
+
indent: '[--lexical-indent-base-value:40px]',
|
|
80
|
+
// inlineImage: 'inline-editor-image',
|
|
81
|
+
// layoutContainer: 'PlaygroundEditorTheme__layoutContainer',
|
|
82
|
+
// layoutItem: 'PlaygroundEditorTheme__layoutItem',
|
|
83
|
+
link: join('text-blue-600', 'hover:underline hover:cursor-pointer'),
|
|
84
|
+
list: {
|
|
85
|
+
checklist: '',
|
|
86
|
+
listitem: join('mx-8 my-0', 'font-(family-name:--listitem-marker-font-family) text-(length:--listitem-marker-font-size) bg-(--listitem-marker-background-color)', 'marker:text-(--listitem-marker-color) marker:font-(family-name:--listitem-marker-font-family) marker:text-(length:--listitem-marker-font-size) marker:bg-(--listitem-marker-background-color)'),
|
|
87
|
+
// TODO fix up checked/unchecked
|
|
88
|
+
listitemChecked: join(checklistItemCommonClasses, 'line-through', 'before:border-[rgb(61,135,245)] before:bg-[#3d87f5] before:bg-no-repeat', 'after:cursor-pointer after:border-white after:border-solid after:absolute after:block after:top-1.5 after:width-[3px] after:inset-x-[7px] after:height-1.5 after:rotate-45 after:border-t-0 after:border-r-0.5 after:border-b-0.5 after:border-l-0'),
|
|
89
|
+
listitemUnchecked: join(checklistItemCommonClasses, 'before:border-[#999]'),
|
|
90
|
+
nested: {
|
|
91
|
+
listitem: join('list-none', 'before:hidden', 'after:hidden')
|
|
92
|
+
},
|
|
93
|
+
olDepth: ['list-decimal', 'list-[upper-alpha]', 'list-[lower-alpha]', 'list-[upper-roman]', 'list-[lower-roman]'].map(cls => join(listCommonClasses, cls)),
|
|
94
|
+
ul: join(listCommonClasses, 'list-disc')
|
|
95
|
+
},
|
|
96
|
+
// mark: 'PlaygroundEditorTheme__mark',
|
|
97
|
+
// markOverlap: 'PlaygroundEditorTheme__markOverlap',
|
|
98
|
+
paragraph: 'relative m-0',
|
|
99
|
+
quote: 'm-0 ml-5 mb-2.5 text-[15px] text-gray-500 border-slate-300 border-l-4 border-solid pl-4',
|
|
100
|
+
// tab: 'PlaygroundEditorTheme__tabNode',
|
|
101
|
+
table: 'border-collapse border-spacing-0 overflow-scroll table-fixed w-max mt-0 mr-[25px] mb-[30px] ml-0',
|
|
102
|
+
tableCell: 'border border-solid border-[#bbb] w-[75px] min-w-[75px] align-top text-start py-[6px] px-2 relative outline-none',
|
|
103
|
+
tableCellEditing: 'shadow-[0_0_5px_rgba(0,0,0,0.4)] rounded-[3px]',
|
|
104
|
+
tableCellHeader: 'bg-[#f2f3f5] text-start',
|
|
105
|
+
tableSelection: 'selection:bg-transparent',
|
|
106
|
+
// tableAddColumns: 'absolute bg-[#eee] h-full border-0 cursor-pointer animate-lexical-table-controls',
|
|
107
|
+
// tableAddRows: 'PlaygroundEditorTheme__tableAddRows',
|
|
108
|
+
// tableAlignment: {
|
|
109
|
+
// center: 'PlaygroundEditorTheme__tableAlignmentCenter',
|
|
110
|
+
// right: 'PlaygroundEditorTheme__tableAlignmentRight',
|
|
111
|
+
// },
|
|
112
|
+
// tableCellActionButton: 'PlaygroundEditorTheme__tableCellActionButton',
|
|
113
|
+
// tableCellActionButtonContainer:
|
|
114
|
+
// 'PlaygroundEditorTheme__tableCellActionButtonContainer',
|
|
115
|
+
// tableCellPrimarySelected: 'PlaygroundEditorTheme__tableCellPrimarySelected',
|
|
116
|
+
// tableCellResizer: 'PlaygroundEditorTheme__tableCellResizer',
|
|
117
|
+
// tableCellSelected: 'PlaygroundEditorTheme__tableCellSelected',
|
|
118
|
+
// tableFrozenColumn: 'PlaygroundEditorTheme__tableFrozenColumn',
|
|
119
|
+
// tableFrozenRow: 'PlaygroundEditorTheme__tableFrozenRow',
|
|
120
|
+
// tableRowStriping: 'PlaygroundEditorTheme__tableRowStriping',
|
|
121
|
+
// tableScrollableWrapper: 'PlaygroundEditorTheme__tableScrollableWrapper',
|
|
122
|
+
// tableCellSortedIndicator: 'PlaygroundEditorTheme__tableCellSortedIndicator',
|
|
123
|
+
// tableResizeRuler: 'PlaygroundEditorTheme__tableCellResizeRuler',
|
|
124
|
+
// tableSelected: 'PlaygroundEditorTheme__tableSelected',
|
|
125
|
+
// tableSelection: 'PlaygroundEditorTheme__tableSelection',
|
|
126
|
+
text: {
|
|
127
|
+
bold: 'font-bold',
|
|
128
|
+
capitalize: 'capitalize',
|
|
129
|
+
code: 'font-mono text-[94%] py-px px-1 background-color: bg-slate-100',
|
|
130
|
+
highlight: 'bg-[rgba(255,212,0,0.14)] border-solid border-b-[2px] border-[rgba(255,212,0,0.3)]',
|
|
131
|
+
italic: 'italic',
|
|
132
|
+
lowercase: 'lowercase',
|
|
133
|
+
strikethrough: 'line-through',
|
|
134
|
+
subscript: 'text-[0.8em] !align-sub',
|
|
135
|
+
superscript: 'text-[0.8em] align-super',
|
|
136
|
+
underline: 'underline',
|
|
137
|
+
underlineStrikethrough: '[text-decoration:underline_line-through]',
|
|
138
|
+
uppercase: 'uppercase'
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Configures the lexical theme ({@link EditorThemeClasses}) with tailwind defaults
|
|
144
|
+
*/
|
|
145
|
+
const TailwindExtension = defineExtension({
|
|
146
|
+
name: '@lexical/tailwind',
|
|
147
|
+
peerDependencies: [declarePeerDependency('@lexical/react/TreeView', {
|
|
148
|
+
timeTravelButtonClassName: 'absolute top-[10px] right-[15px] border-0 p-0 text-xs bg-transparent text-white hover:underline cursor-pointer',
|
|
149
|
+
timeTravelPanelButtonClassName: 'p-0 border-0 bg-transparent flex-1 text-white text-xs hover:underline cursor-pointer',
|
|
150
|
+
timeTravelPanelClassName: 'overflow-hidden p-0 pb-2.5 mx-auto flex',
|
|
151
|
+
timeTravelPanelSliderClassName: 'p-0 flex-[8]',
|
|
152
|
+
treeTypeButtonClassName: 'absolute top-[10px] right-[85px] border-0 p-0 text-xs bg-transparent text-white hover:underline cursor-pointer',
|
|
153
|
+
viewClassName: 'block bg-neutral-950 text-white p-1.5 text-xs whitespace-pre-wrap mx-auto my-1 mb-2.5 max-h-[250px] relative rounded-b-[10px] overflow-auto leading-3.5'
|
|
154
|
+
})],
|
|
155
|
+
theme
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
export { TailwindExtension };
|
|
@@ -0,0 +1,11 @@
|
|
|
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
|
+
'use strict'
|
|
10
|
+
const LexicalTailwind = process.env.NODE_ENV !== 'production' ? require('./LexicalTailwind.dev.js') : require('./LexicalTailwind.prod.js');
|
|
11
|
+
module.exports = LexicalTailwind;
|
|
@@ -0,0 +1,14 @@
|
|
|
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
|
+
* @flow strict
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* LexicalTailwind
|
|
12
|
+
*/
|
|
13
|
+
import type {LexicalExtension, ExtensionConfigBase} from 'lexical';
|
|
14
|
+
declare export var TailwindExtension: LexicalExtension<ExtensionConfigBase, "@lexical/tailwind", void, void>;
|
|
@@ -0,0 +1,12 @@
|
|
|
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 * as modDev from './LexicalTailwind.dev.mjs';
|
|
10
|
+
import * as modProd from './LexicalTailwind.prod.mjs';
|
|
11
|
+
const mod = process.env.NODE_ENV !== 'production' ? modDev : modProd;
|
|
12
|
+
export const TailwindExtension = mod.TailwindExtension;
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
+
const mod = await (process.env.NODE_ENV !== 'production' ? import('./LexicalTailwind.dev.mjs') : import('./LexicalTailwind.prod.mjs'));
|
|
10
|
+
export const TailwindExtension = mod.TailwindExtension;
|
|
@@ -0,0 +1,9 @@
|
|
|
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
|
+
"use strict";var e=require("lexical");function r(...e){return e.join(" ")}const t=r("relative [&]:mx-[0.5em] px-[1.5em] list-none outline-none block min-h-[1.5em]","before:w-4 before:h-4 before:top-0.5 before:left-0 before:cursor-pointer before:block before:bg-color before:absolute before:border before:border-solid before:rounded-sm","rtl:before:left-auto rtl:before:right-0","focus:before:shadow-[0_0_0_2px_#a6cdfe]"),o="p-0 m-0 list-outside",l={blockCursor:r("block pointer-events-none absolute","after:block after:absolute after:-top-0.5 after:width-5 after:border-t after:border-solid after:border-black after:animate-lexical-cursor-blink"),heading:{h1:"text-[24px] text-neutral-950 font-normal m-0",h2:"text-[15px] text-gray-500 font-bold m-0 uppercase",h3:"text-[12px] m-0 uppercase",h4:void 0,h5:void 0,h6:void 0},hr:r("p-0.5 border-none mx-0 my-[1em] cursor-pointer","after:block after:content-[''] after:h-[2px] after:leading-[2px] after:bg-[#ccc]"),hrSelected:"outline-[2px] outline-solid outline-[rgb(60,132,244)]",indent:"[--lexical-indent-base-value:40px]",link:r("text-blue-600","hover:underline hover:cursor-pointer"),list:{checklist:"",listitem:r("mx-8 my-0","font-(family-name:--listitem-marker-font-family) text-(length:--listitem-marker-font-size) bg-(--listitem-marker-background-color)","marker:text-(--listitem-marker-color) marker:font-(family-name:--listitem-marker-font-family) marker:text-(length:--listitem-marker-font-size) marker:bg-(--listitem-marker-background-color)"),listitemChecked:r(t,"line-through","before:border-[rgb(61,135,245)] before:bg-[#3d87f5] before:bg-no-repeat","after:cursor-pointer after:border-white after:border-solid after:absolute after:block after:top-1.5 after:width-[3px] after:inset-x-[7px] after:height-1.5 after:rotate-45 after:border-t-0 after:border-r-0.5 after:border-b-0.5 after:border-l-0"),listitemUnchecked:r(t,"before:border-[#999]"),nested:{listitem:r("list-none","before:hidden","after:hidden")},olDepth:["list-decimal","list-[upper-alpha]","list-[lower-alpha]","list-[upper-roman]","list-[lower-roman]"].map((e=>r(o,e))),ul:r(o,"list-disc")},paragraph:"relative m-0",quote:"m-0 ml-5 mb-2.5 text-[15px] text-gray-500 border-slate-300 border-l-4 border-solid pl-4",table:"border-collapse border-spacing-0 overflow-scroll table-fixed w-max mt-0 mr-[25px] mb-[30px] ml-0",tableCell:"border border-solid border-[#bbb] w-[75px] min-w-[75px] align-top text-start py-[6px] px-2 relative outline-none",tableCellEditing:"shadow-[0_0_5px_rgba(0,0,0,0.4)] rounded-[3px]",tableCellHeader:"bg-[#f2f3f5] text-start",tableSelection:"selection:bg-transparent",text:{bold:"font-bold",capitalize:"capitalize",code:"font-mono text-[94%] py-px px-1 background-color: bg-slate-100",highlight:"bg-[rgba(255,212,0,0.14)] border-solid border-b-[2px] border-[rgba(255,212,0,0.3)]",italic:"italic",lowercase:"lowercase",strikethrough:"line-through",subscript:"text-[0.8em] !align-sub",superscript:"text-[0.8em] align-super",underline:"underline",underlineStrikethrough:"[text-decoration:underline_line-through]",uppercase:"uppercase"}},a=e.defineExtension({name:"@lexical/tailwind",peerDependencies:[e.declarePeerDependency("@lexical/react/TreeView",{timeTravelButtonClassName:"absolute top-[10px] right-[15px] border-0 p-0 text-xs bg-transparent text-white hover:underline cursor-pointer",timeTravelPanelButtonClassName:"p-0 border-0 bg-transparent flex-1 text-white text-xs hover:underline cursor-pointer",timeTravelPanelClassName:"overflow-hidden p-0 pb-2.5 mx-auto flex",timeTravelPanelSliderClassName:"p-0 flex-[8]",treeTypeButtonClassName:"absolute top-[10px] right-[85px] border-0 p-0 text-xs bg-transparent text-white hover:underline cursor-pointer",viewClassName:"block bg-neutral-950 text-white p-1.5 text-xs whitespace-pre-wrap mx-auto my-1 mb-2.5 max-h-[250px] relative rounded-b-[10px] overflow-auto leading-3.5"})],theme:l});exports.TailwindExtension=a;
|
|
@@ -0,0 +1,9 @@
|
|
|
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{defineExtension as e,declarePeerDependency as r}from"lexical";function t(...e){return e.join(" ")}const o=t("relative [&]:mx-[0.5em] px-[1.5em] list-none outline-none block min-h-[1.5em]","before:w-4 before:h-4 before:top-0.5 before:left-0 before:cursor-pointer before:block before:bg-color before:absolute before:border before:border-solid before:rounded-sm","rtl:before:left-auto rtl:before:right-0","focus:before:shadow-[0_0_0_2px_#a6cdfe]"),l="p-0 m-0 list-outside",a={blockCursor:t("block pointer-events-none absolute","after:block after:absolute after:-top-0.5 after:width-5 after:border-t after:border-solid after:border-black after:animate-lexical-cursor-blink"),heading:{h1:"text-[24px] text-neutral-950 font-normal m-0",h2:"text-[15px] text-gray-500 font-bold m-0 uppercase",h3:"text-[12px] m-0 uppercase",h4:void 0,h5:void 0,h6:void 0},hr:t("p-0.5 border-none mx-0 my-[1em] cursor-pointer","after:block after:content-[''] after:h-[2px] after:leading-[2px] after:bg-[#ccc]"),hrSelected:"outline-[2px] outline-solid outline-[rgb(60,132,244)]",indent:"[--lexical-indent-base-value:40px]",link:t("text-blue-600","hover:underline hover:cursor-pointer"),list:{checklist:"",listitem:t("mx-8 my-0","font-(family-name:--listitem-marker-font-family) text-(length:--listitem-marker-font-size) bg-(--listitem-marker-background-color)","marker:text-(--listitem-marker-color) marker:font-(family-name:--listitem-marker-font-family) marker:text-(length:--listitem-marker-font-size) marker:bg-(--listitem-marker-background-color)"),listitemChecked:t(o,"line-through","before:border-[rgb(61,135,245)] before:bg-[#3d87f5] before:bg-no-repeat","after:cursor-pointer after:border-white after:border-solid after:absolute after:block after:top-1.5 after:width-[3px] after:inset-x-[7px] after:height-1.5 after:rotate-45 after:border-t-0 after:border-r-0.5 after:border-b-0.5 after:border-l-0"),listitemUnchecked:t(o,"before:border-[#999]"),nested:{listitem:t("list-none","before:hidden","after:hidden")},olDepth:["list-decimal","list-[upper-alpha]","list-[lower-alpha]","list-[upper-roman]","list-[lower-roman]"].map((e=>t(l,e))),ul:t(l,"list-disc")},paragraph:"relative m-0",quote:"m-0 ml-5 mb-2.5 text-[15px] text-gray-500 border-slate-300 border-l-4 border-solid pl-4",table:"border-collapse border-spacing-0 overflow-scroll table-fixed w-max mt-0 mr-[25px] mb-[30px] ml-0",tableCell:"border border-solid border-[#bbb] w-[75px] min-w-[75px] align-top text-start py-[6px] px-2 relative outline-none",tableCellEditing:"shadow-[0_0_5px_rgba(0,0,0,0.4)] rounded-[3px]",tableCellHeader:"bg-[#f2f3f5] text-start",tableSelection:"selection:bg-transparent",text:{bold:"font-bold",capitalize:"capitalize",code:"font-mono text-[94%] py-px px-1 background-color: bg-slate-100",highlight:"bg-[rgba(255,212,0,0.14)] border-solid border-b-[2px] border-[rgba(255,212,0,0.3)]",italic:"italic",lowercase:"lowercase",strikethrough:"line-through",subscript:"text-[0.8em] !align-sub",superscript:"text-[0.8em] align-super",underline:"underline",underlineStrikethrough:"[text-decoration:underline_line-through]",uppercase:"uppercase"}},i=e({name:"@lexical/tailwind",peerDependencies:[r("@lexical/react/TreeView",{timeTravelButtonClassName:"absolute top-[10px] right-[15px] border-0 p-0 text-xs bg-transparent text-white hover:underline cursor-pointer",timeTravelPanelButtonClassName:"p-0 border-0 bg-transparent flex-1 text-white text-xs hover:underline cursor-pointer",timeTravelPanelClassName:"overflow-hidden p-0 pb-2.5 mx-auto flex",timeTravelPanelSliderClassName:"p-0 flex-[8]",treeTypeButtonClassName:"absolute top-[10px] right-[85px] border-0 p-0 text-xs bg-transparent text-white hover:underline cursor-pointer",viewClassName:"block bg-neutral-950 text-white p-1.5 text-xs whitespace-pre-wrap mx-auto my-1 mb-2.5 max-h-[250px] relative rounded-b-[10px] overflow-auto leading-3.5"})],theme:a});export{i as TailwindExtension};
|
package/README.md
ADDED
package/index.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
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
|
+
* Configures the lexical theme ({@link EditorThemeClasses}) with tailwind defaults
|
|
10
|
+
*/
|
|
11
|
+
export declare const TailwindExtension: import("lexical").LexicalExtension<import("lexical").ExtensionConfigBase, "@lexical/tailwind", unknown, unknown>;
|
package/package.json
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@lexical/tailwind",
|
|
3
|
+
"keywords": [
|
|
4
|
+
"lexical",
|
|
5
|
+
"editor",
|
|
6
|
+
"tailwind",
|
|
7
|
+
"theme",
|
|
8
|
+
"css"
|
|
9
|
+
],
|
|
10
|
+
"version": "0.35.1-nightly.20250925.0",
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "git+https://github.com/facebook/lexical.git",
|
|
15
|
+
"directory": "packages/lexical-tailwind"
|
|
16
|
+
},
|
|
17
|
+
"main": "LexicalTailwind.js",
|
|
18
|
+
"types": "index.d.ts",
|
|
19
|
+
"bugs": {
|
|
20
|
+
"url": "https://github.com/facebook/lexical/issues"
|
|
21
|
+
},
|
|
22
|
+
"homepage": "https://github.com/facebook/lexical#readme",
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"@lexical/extension": "0.35.1-nightly.20250925.0",
|
|
25
|
+
"lexical": "0.35.1-nightly.20250925.0"
|
|
26
|
+
},
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"@tailwindcss/cli": "^4.1.13",
|
|
29
|
+
"tailwind-merge": "^3.3.1",
|
|
30
|
+
"tailwindcss": "^4.1.13"
|
|
31
|
+
},
|
|
32
|
+
"description": "This package contains an extension to use Tailwind for the editor theme",
|
|
33
|
+
"sideEffects": false,
|
|
34
|
+
"module": "LexicalTailwind.mjs",
|
|
35
|
+
"exports": {
|
|
36
|
+
".": {
|
|
37
|
+
"import": {
|
|
38
|
+
"types": "./index.d.ts",
|
|
39
|
+
"development": "./LexicalTailwind.dev.mjs",
|
|
40
|
+
"production": "./LexicalTailwind.prod.mjs",
|
|
41
|
+
"node": "./LexicalTailwind.node.mjs",
|
|
42
|
+
"default": "./LexicalTailwind.mjs"
|
|
43
|
+
},
|
|
44
|
+
"require": {
|
|
45
|
+
"types": "./index.d.ts",
|
|
46
|
+
"development": "./LexicalTailwind.dev.js",
|
|
47
|
+
"production": "./LexicalTailwind.prod.js",
|
|
48
|
+
"default": "./LexicalTailwind.js"
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|