@lexical/tailwind 0.44.1-nightly.20260519.0 → 0.45.1-dev.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/package.json CHANGED
@@ -7,22 +7,22 @@
7
7
  "theme",
8
8
  "css"
9
9
  ],
10
- "version": "0.44.1-nightly.20260519.0",
10
+ "version": "0.45.1-dev.0",
11
11
  "license": "MIT",
12
12
  "repository": {
13
13
  "type": "git",
14
14
  "url": "git+https://github.com/facebook/lexical.git",
15
15
  "directory": "packages/lexical-tailwind"
16
16
  },
17
- "main": "LexicalTailwind.js",
18
- "types": "index.d.ts",
17
+ "main": "./dist/LexicalTailwind.js",
18
+ "types": "./dist/index.d.ts",
19
19
  "bugs": {
20
20
  "url": "https://github.com/facebook/lexical/issues"
21
21
  },
22
22
  "homepage": "https://github.com/facebook/lexical#readme",
23
23
  "dependencies": {
24
- "@lexical/extension": "0.44.1-nightly.20260519.0",
25
- "lexical": "0.44.1-nightly.20260519.0"
24
+ "@lexical/extension": "0.45.1-dev.0",
25
+ "lexical": "0.45.1-dev.0"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@tailwindcss/cli": "^4.2.4",
@@ -31,22 +31,36 @@
31
31
  },
32
32
  "description": "This package contains an extension to use Tailwind for the editor theme",
33
33
  "sideEffects": false,
34
- "module": "LexicalTailwind.mjs",
34
+ "module": "./dist/LexicalTailwind.mjs",
35
35
  "exports": {
36
36
  ".": {
37
+ "source": "./src/index.ts",
37
38
  "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"
39
+ "types": "./dist/index.d.ts",
40
+ "development": "./dist/LexicalTailwind.dev.mjs",
41
+ "production": "./dist/LexicalTailwind.prod.mjs",
42
+ "node": "./dist/LexicalTailwind.node.mjs",
43
+ "default": "./dist/LexicalTailwind.mjs"
43
44
  },
44
45
  "require": {
45
- "types": "./index.d.ts",
46
- "development": "./LexicalTailwind.dev.js",
47
- "production": "./LexicalTailwind.prod.js",
48
- "default": "./LexicalTailwind.js"
46
+ "types": "./dist/index.d.ts",
47
+ "development": "./dist/LexicalTailwind.dev.js",
48
+ "production": "./dist/LexicalTailwind.prod.js",
49
+ "default": "./dist/LexicalTailwind.js"
49
50
  }
50
51
  }
51
- }
52
+ },
53
+ "files": [
54
+ "dist",
55
+ "src",
56
+ "!src/__tests__",
57
+ "!src/__bench__",
58
+ "!src/__mocks__",
59
+ "!src/**/*.test.ts",
60
+ "!src/**/*.test.tsx",
61
+ "!src/**/*.bench.ts",
62
+ "!src/**/*.bench.tsx",
63
+ "README.md",
64
+ "LICENSE"
65
+ ]
52
66
  }
package/src/index.ts ADDED
@@ -0,0 +1,190 @@
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 {
10
+ declarePeerDependency,
11
+ defineExtension,
12
+ type EditorThemeClasses,
13
+ } from 'lexical';
14
+
15
+ function join(...args: string[]) {
16
+ return args.join(' ');
17
+ }
18
+
19
+ const checklistItemCommonClasses =
20
+ // 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)
21
+ join(
22
+ 'relative [&]:mx-[0.5em] px-[1.5em] list-none outline-none block min-h-[1.5em]',
23
+ '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',
24
+ 'rtl:before:left-auto rtl:before:right-0',
25
+ 'focus:before:shadow-[0_0_0_2px_#a6cdfe]',
26
+ );
27
+
28
+ const listCommonClasses = 'p-0 m-0 list-outside';
29
+
30
+ const theme: EditorThemeClasses = {
31
+ // TODO animation
32
+ blockCursor: join(
33
+ 'block pointer-events-none absolute',
34
+ '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',
35
+ ),
36
+ // characterLimit: "PlaygroundEditorTheme__characterLimit",
37
+ // code: 'PlaygroundEditorTheme__code',
38
+ // codeHighlight: {
39
+ // atrule: 'PlaygroundEditorTheme__tokenAttr',
40
+ // attr: 'PlaygroundEditorTheme__tokenAttr',
41
+ // boolean: 'PlaygroundEditorTheme__tokenProperty',
42
+ // builtin: 'PlaygroundEditorTheme__tokenSelector',
43
+ // cdata: 'PlaygroundEditorTheme__tokenComment',
44
+ // char: 'PlaygroundEditorTheme__tokenSelector',
45
+ // class: 'PlaygroundEditorTheme__tokenFunction',
46
+ // 'class-name': 'PlaygroundEditorTheme__tokenFunction',
47
+ // comment: 'PlaygroundEditorTheme__tokenComment',
48
+ // constant: 'PlaygroundEditorTheme__tokenProperty',
49
+ // deleted: 'PlaygroundEditorTheme__tokenProperty',
50
+ // doctype: 'PlaygroundEditorTheme__tokenComment',
51
+ // entity: 'PlaygroundEditorTheme__tokenOperator',
52
+ // function: 'PlaygroundEditorTheme__tokenFunction',
53
+ // important: 'PlaygroundEditorTheme__tokenVariable',
54
+ // inserted: 'PlaygroundEditorTheme__tokenSelector',
55
+ // keyword: 'PlaygroundEditorTheme__tokenAttr',
56
+ // namespace: 'PlaygroundEditorTheme__tokenVariable',
57
+ // number: 'PlaygroundEditorTheme__tokenProperty',
58
+ // operator: 'PlaygroundEditorTheme__tokenOperator',
59
+ // prolog: 'PlaygroundEditorTheme__tokenComment',
60
+ // property: 'PlaygroundEditorTheme__tokenProperty',
61
+ // punctuation: 'PlaygroundEditorTheme__tokenPunctuation',
62
+ // regex: 'PlaygroundEditorTheme__tokenVariable',
63
+ // selector: 'PlaygroundEditorTheme__tokenSelector',
64
+ // string: 'PlaygroundEditorTheme__tokenSelector',
65
+ // symbol: 'PlaygroundEditorTheme__tokenProperty',
66
+ // tag: 'PlaygroundEditorTheme__tokenProperty',
67
+ // url: 'PlaygroundEditorTheme__tokenOperator',
68
+ // variable: 'PlaygroundEditorTheme__tokenVariable',
69
+ // },
70
+ // embedBlock: {
71
+ // base: 'PlaygroundEditorTheme__embedBlock',
72
+ // focus: 'PlaygroundEditorTheme__embedBlockFocus',
73
+ // },
74
+ // hashtag: 'PlaygroundEditorTheme__hashtag',
75
+ heading: {
76
+ h1: 'text-[24px] text-neutral-950 font-normal m-0',
77
+ h2: 'text-[15px] text-gray-500 font-bold m-0 uppercase',
78
+ h3: 'text-[12px] m-0 uppercase',
79
+ h4: undefined,
80
+ h5: undefined,
81
+ h6: undefined,
82
+ },
83
+ hr: join(
84
+ 'p-0.5 border-none mx-0 my-[1em] cursor-pointer',
85
+ `after:block after:content-[''] after:h-[2px] after:leading-[2px] after:bg-[#ccc]`,
86
+ ),
87
+ hrSelected: 'outline-[2px] outline-solid outline-[rgb(60,132,244)]',
88
+ // image: 'editor-image',
89
+ // inlineImage: 'inline-editor-image',
90
+ // layoutContainer: 'PlaygroundEditorTheme__layoutContainer',
91
+ // layoutItem: 'PlaygroundEditorTheme__layoutItem',
92
+ link: join('text-blue-600', 'hover:underline hover:cursor-pointer'),
93
+ list: {
94
+ checklist: '',
95
+ listitem: join(
96
+ 'mx-8 my-0',
97
+ 'font-(family-name:--listitem-marker-font-family) text-(length:--listitem-marker-font-size) bg-(--listitem-marker-background-color)',
98
+ '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)',
99
+ ),
100
+ // TODO fix up checked/unchecked
101
+ listitemChecked: join(
102
+ checklistItemCommonClasses,
103
+ 'line-through',
104
+ 'before:border-[rgb(61,135,245)] before:bg-[#3d87f5] before:bg-no-repeat',
105
+ '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',
106
+ ),
107
+ listitemUnchecked: join(checklistItemCommonClasses, 'before:border-[#999]'),
108
+ nested: {
109
+ listitem: join('list-none', 'before:hidden', 'after:hidden'),
110
+ },
111
+ olDepth: [
112
+ 'list-decimal',
113
+ 'list-[upper-alpha]',
114
+ 'list-[lower-alpha]',
115
+ 'list-[upper-roman]',
116
+ 'list-[lower-roman]',
117
+ ].map(cls => join(listCommonClasses, cls)),
118
+ ul: join(listCommonClasses, 'list-disc'),
119
+ },
120
+ // mark: 'PlaygroundEditorTheme__mark',
121
+ // markOverlap: 'PlaygroundEditorTheme__markOverlap',
122
+ paragraph: 'relative m-0',
123
+ quote:
124
+ 'm-0 ml-5 mb-2.5 text-[15px] text-gray-500 border-slate-300 border-l-4 border-solid pl-4',
125
+ // tab: 'PlaygroundEditorTheme__tabNode',
126
+ table:
127
+ 'border-collapse border-spacing-0 overflow-scroll table-fixed w-max mt-0 mr-[25px] mb-[30px] ml-0',
128
+ tableCell:
129
+ 'border border-solid border-[#bbb] w-[75px] min-w-[75px] align-top text-start py-[6px] px-2 relative outline-none',
130
+ tableCellEditing: 'shadow-[0_0_5px_rgba(0,0,0,0.4)] rounded-[3px]',
131
+ tableCellHeader: 'bg-[#f2f3f5] text-start',
132
+ tableSelection: 'selection:bg-transparent',
133
+ // tableAddColumns: 'absolute bg-[#eee] h-full border-0 cursor-pointer animate-lexical-table-controls',
134
+ // tableAddRows: 'PlaygroundEditorTheme__tableAddRows',
135
+ // tableAlignment: {
136
+ // center: 'PlaygroundEditorTheme__tableAlignmentCenter',
137
+ // right: 'PlaygroundEditorTheme__tableAlignmentRight',
138
+ // },
139
+ // tableCellActionButton: 'PlaygroundEditorTheme__tableCellActionButton',
140
+ // tableCellActionButtonContainer:
141
+ // 'PlaygroundEditorTheme__tableCellActionButtonContainer',
142
+ // tableCellPrimarySelected: 'PlaygroundEditorTheme__tableCellPrimarySelected',
143
+ // tableCellResizer: 'PlaygroundEditorTheme__tableCellResizer',
144
+ // tableCellSelected: 'PlaygroundEditorTheme__tableCellSelected',
145
+ // tableFrozenColumn: 'PlaygroundEditorTheme__tableFrozenColumn',
146
+ // tableFrozenRow: 'PlaygroundEditorTheme__tableFrozenRow',
147
+ // tableRowStriping: 'PlaygroundEditorTheme__tableRowStriping',
148
+ // tableScrollableWrapper: 'PlaygroundEditorTheme__tableScrollableWrapper',
149
+ // tableCellSortedIndicator: 'PlaygroundEditorTheme__tableCellSortedIndicator',
150
+ // tableResizeRuler: 'PlaygroundEditorTheme__tableCellResizeRuler',
151
+ // tableSelected: 'PlaygroundEditorTheme__tableSelected',
152
+ // tableSelection: 'PlaygroundEditorTheme__tableSelection',
153
+ text: {
154
+ bold: 'font-bold',
155
+ capitalize: 'capitalize',
156
+ code: 'font-mono text-[94%] py-px px-1 background-color: bg-slate-100',
157
+ highlight:
158
+ 'bg-[rgba(255,212,0,0.14)] border-solid border-b-[2px] border-[rgba(255,212,0,0.3)]',
159
+ italic: 'italic',
160
+ lowercase: 'lowercase',
161
+ strikethrough: 'line-through',
162
+ subscript: 'text-[0.8em] !align-sub',
163
+ superscript: 'text-[0.8em] align-super',
164
+ underline: 'underline',
165
+ underlineStrikethrough: '[text-decoration:underline_line-through]',
166
+ uppercase: 'uppercase',
167
+ },
168
+ };
169
+
170
+ /**
171
+ * Configures the lexical theme ({@link EditorThemeClasses}) with tailwind defaults
172
+ */
173
+ export const TailwindExtension = defineExtension({
174
+ name: '@lexical/tailwind',
175
+ peerDependencies: [
176
+ declarePeerDependency('@lexical/react/TreeView', {
177
+ timeTravelButtonClassName:
178
+ 'absolute top-[10px] right-[15px] border-0 p-0 text-xs bg-transparent text-white hover:underline cursor-pointer',
179
+ timeTravelPanelButtonClassName:
180
+ 'p-0 border-0 bg-transparent flex-1 text-white text-xs hover:underline cursor-pointer',
181
+ timeTravelPanelClassName: 'overflow-hidden p-0 pb-2.5 mx-auto flex',
182
+ timeTravelPanelSliderClassName: 'p-0 flex-[8]',
183
+ treeTypeButtonClassName:
184
+ 'absolute top-[10px] right-[85px] border-0 p-0 text-xs bg-transparent text-white hover:underline cursor-pointer',
185
+ viewClassName:
186
+ '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',
187
+ }),
188
+ ],
189
+ theme,
190
+ });
File without changes
File without changes