onchain-lexical-ui 0.0.1
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/README.md +5 -0
- package/package.json +221 -0
- package/src/Button.module.less +36 -0
- package/src/Button.tsx +50 -0
- package/src/ColorPicker.module.less +89 -0
- package/src/ColorPicker.tsx +369 -0
- package/src/ContentEditable.module.less +78 -0
- package/src/ContentEditable.tsx +41 -0
- package/src/Dialog.module.less +23 -0
- package/src/Dialog.tsx +34 -0
- package/src/DropDown.module.less +95 -0
- package/src/DropDown.tsx +267 -0
- package/src/DropdownColorPicker.tsx +41 -0
- package/src/EditorShellStyles/index.module.less +43 -0
- package/src/EditorShellStyles/index.tsx +18 -0
- package/src/EquationEditor.module.less +41 -0
- package/src/EquationEditor.tsx +49 -0
- package/src/ExcalidrawModal.module.less +62 -0
- package/src/ExcalidrawModal.tsx +252 -0
- package/src/FileInput.tsx +40 -0
- package/src/FlashMessage.module.less +28 -0
- package/src/FlashMessage.tsx +31 -0
- package/src/Icon/index.module.less +4 -0
- package/src/Icon/index.tsx +32 -0
- package/src/ImageResizer.tsx +317 -0
- package/src/Input.module.less +38 -0
- package/src/KatexEquationAlterer.module.less +41 -0
- package/src/KatexEquationAlterer.tsx +84 -0
- package/src/KatexRenderer.tsx +73 -0
- package/src/Modal.module.less +65 -0
- package/src/Modal.tsx +176 -0
- package/src/Select.module.less +41 -0
- package/src/Select.tsx +37 -0
- package/src/Skeleton.module.less +67 -0
- package/src/Skeleton.tsx +28 -0
- package/src/Switch.tsx +38 -0
- package/src/TextInput.tsx +48 -0
- package/src/utils/joinClasses.ts +13 -0
package/README.md
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "onchain-lexical-ui",
|
|
3
|
+
"license": "MIT",
|
|
4
|
+
"version": "0.0.1",
|
|
5
|
+
"sideEffects": false,
|
|
6
|
+
"dependencies": {
|
|
7
|
+
"@ant-design/icons": "^6.0.0",
|
|
8
|
+
"@excalidraw/excalidraw": "^0.18.0",
|
|
9
|
+
"@lexical/react": "^0.30.0",
|
|
10
|
+
"@lexical/utils": "^0.30.0",
|
|
11
|
+
"katex": "^0.16.22",
|
|
12
|
+
"lexical": "0.30.0",
|
|
13
|
+
"onchain-lexical-context": "^0.0.1",
|
|
14
|
+
"react-draggable": "^4.5.0"
|
|
15
|
+
},
|
|
16
|
+
"browser": {
|
|
17
|
+
"crypto": false
|
|
18
|
+
},
|
|
19
|
+
"exports": {
|
|
20
|
+
"./EditorShellStyles": {
|
|
21
|
+
"import": {
|
|
22
|
+
"types": "./src/EditorShellStyles.tsx",
|
|
23
|
+
"default": "./dist/EditorShellStyles.mjs"
|
|
24
|
+
},
|
|
25
|
+
"require": {
|
|
26
|
+
"types": "./src/EditorShellStyles.tsx",
|
|
27
|
+
"default": "./dist/EditorShellStyles.js"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"./Icon": {
|
|
31
|
+
"import": {
|
|
32
|
+
"types": "./src/Icon/index.tsx",
|
|
33
|
+
"default": "./dist/Icon.mjs"
|
|
34
|
+
},
|
|
35
|
+
"require": {
|
|
36
|
+
"types": "./src/Icon.tsx",
|
|
37
|
+
"default": "./dist/Icon.js"
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"./Button": {
|
|
41
|
+
"import": {
|
|
42
|
+
"types": "./src/Button.tsx",
|
|
43
|
+
"default": "./dist/Button.mjs"
|
|
44
|
+
},
|
|
45
|
+
"require": {
|
|
46
|
+
"types": "./src/Button.tsx",
|
|
47
|
+
"default": "./dist/Button.js"
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
"./ColorPicker": {
|
|
51
|
+
"import": {
|
|
52
|
+
"types": "./src/ColorPicker.tsx",
|
|
53
|
+
"default": "./dist/ColorPicker.mjs"
|
|
54
|
+
},
|
|
55
|
+
"require": {
|
|
56
|
+
"types": "./src/ColorPicker.tsx",
|
|
57
|
+
"default": "./dist/ColorPicker.js"
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
"./ContentEditable": {
|
|
61
|
+
"import": {
|
|
62
|
+
"types": "./src/ContentEditable.tsx",
|
|
63
|
+
"default": "./dist/ContentEditable.mjs"
|
|
64
|
+
},
|
|
65
|
+
"require": {
|
|
66
|
+
"types": "./src/ContentEditable.tsx",
|
|
67
|
+
"default": "./dist/ContentEditable.js"
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
"./Dialog": {
|
|
71
|
+
"import": {
|
|
72
|
+
"types": "./src/Dialog.tsx",
|
|
73
|
+
"default": "./dist/Dialog.mjs"
|
|
74
|
+
},
|
|
75
|
+
"require": {
|
|
76
|
+
"types": "./src/Dialog.tsx",
|
|
77
|
+
"default": "./dist/Dialog.js"
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
"./DropDown": {
|
|
81
|
+
"import": {
|
|
82
|
+
"types": "./src/DropDown.tsx",
|
|
83
|
+
"default": "./dist/DropDown.mjs"
|
|
84
|
+
},
|
|
85
|
+
"require": {
|
|
86
|
+
"types": "./src/DropDown.tsx",
|
|
87
|
+
"default": "./dist/DropDown.js"
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
"./DropdownColorPicker": {
|
|
91
|
+
"import": {
|
|
92
|
+
"types": "./src/DropdownColorPicker.tsx",
|
|
93
|
+
"default": "./dist/DropdownColorPicker.mjs"
|
|
94
|
+
},
|
|
95
|
+
"require": {
|
|
96
|
+
"types": "./src/DropdownColorPicker.tsx",
|
|
97
|
+
"default": "./dist/DropdownColorPicker.js"
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
"./EquationEditor": {
|
|
101
|
+
"import": {
|
|
102
|
+
"types": "./src/EquationEditor.tsx",
|
|
103
|
+
"default": "./dist/EquationEditor.mjs"
|
|
104
|
+
},
|
|
105
|
+
"require": {
|
|
106
|
+
"types": "./src/EquationEditor.tsx",
|
|
107
|
+
"default": "./dist/EquationEditor.js"
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
"./ExcalidrawModal": {
|
|
111
|
+
"import": {
|
|
112
|
+
"types": "./src/ExcalidrawModal.tsx",
|
|
113
|
+
"default": "./dist/ExcalidrawModal.mjs"
|
|
114
|
+
},
|
|
115
|
+
"require": {
|
|
116
|
+
"types": "./src/ExcalidrawModal.tsx",
|
|
117
|
+
"default": "./dist/ExcalidrawModal.js"
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
"./FileInput": {
|
|
121
|
+
"import": {
|
|
122
|
+
"types": "./src/FileInput.tsx",
|
|
123
|
+
"default": "./dist/FileInput.mjs"
|
|
124
|
+
},
|
|
125
|
+
"require": {
|
|
126
|
+
"types": "./src/FileInput.tsx",
|
|
127
|
+
"default": "./dist/FileInput.js"
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
"./FlashMessage": {
|
|
131
|
+
"import": {
|
|
132
|
+
"types": "./src/FlashMessage.tsx",
|
|
133
|
+
"default": "./dist/FlashMessage.mjs"
|
|
134
|
+
},
|
|
135
|
+
"require": {
|
|
136
|
+
"types": "./src/FlashMessage.tsx",
|
|
137
|
+
"default": "./dist/FlashMessage.js"
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
"./ImageResizer": {
|
|
141
|
+
"import": {
|
|
142
|
+
"types": "./src/ImageResizer.tsx",
|
|
143
|
+
"default": "./dist/ImageResizer.mjs"
|
|
144
|
+
},
|
|
145
|
+
"require": {
|
|
146
|
+
"types": "./src/ImageResizer.tsx",
|
|
147
|
+
"default": "./dist/ImageResizer.js"
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
"./KatexEquationAlterer": {
|
|
151
|
+
"import": {
|
|
152
|
+
"types": "./src/KatexEquationAlterer.tsx",
|
|
153
|
+
"default": "./dist/KatexEquationAlterer.mjs"
|
|
154
|
+
},
|
|
155
|
+
"require": {
|
|
156
|
+
"types": "./src/KatexEquationAlterer.tsx",
|
|
157
|
+
"default": "./dist/KatexEquationAlterer.js"
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
"./KatexRenderer": {
|
|
161
|
+
"import": {
|
|
162
|
+
"types": "./src/KatexRenderer.tsx",
|
|
163
|
+
"default": "./dist/KatexRenderer.mjs"
|
|
164
|
+
},
|
|
165
|
+
"require": {
|
|
166
|
+
"types": "./src/KatexRenderer.tsx",
|
|
167
|
+
"default": "./dist/KatexRenderer.js"
|
|
168
|
+
}
|
|
169
|
+
},
|
|
170
|
+
"./Modal": {
|
|
171
|
+
"import": {
|
|
172
|
+
"types": "./src/Modal.tsx",
|
|
173
|
+
"default": "./dist/Modal.mjs"
|
|
174
|
+
},
|
|
175
|
+
"require": {
|
|
176
|
+
"types": "./src/Modal.tsx",
|
|
177
|
+
"default": "./dist/Modal.js"
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
"./Select": {
|
|
181
|
+
"import": {
|
|
182
|
+
"types": "./src/Select.tsx",
|
|
183
|
+
"default": "./dist/Select.mjs"
|
|
184
|
+
},
|
|
185
|
+
"require": {
|
|
186
|
+
"types": "./src/Select.tsx",
|
|
187
|
+
"default": "./dist/Select.js"
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
"./Skeleton": {
|
|
191
|
+
"import": {
|
|
192
|
+
"types": "./src/Skeleton.tsx",
|
|
193
|
+
"default": "./dist/Skeleton.mjs"
|
|
194
|
+
},
|
|
195
|
+
"require": {
|
|
196
|
+
"types": "./src/Skeleton.tsx",
|
|
197
|
+
"default": "./dist/Skeleton.js"
|
|
198
|
+
}
|
|
199
|
+
},
|
|
200
|
+
"./Switch": {
|
|
201
|
+
"import": {
|
|
202
|
+
"types": "./src/Switch.tsx",
|
|
203
|
+
"default": "./dist/Switch.mjs"
|
|
204
|
+
},
|
|
205
|
+
"require": {
|
|
206
|
+
"types": "./src/Switch.tsx",
|
|
207
|
+
"default": "./dist/Switch.js"
|
|
208
|
+
}
|
|
209
|
+
},
|
|
210
|
+
"./TextInput": {
|
|
211
|
+
"import": {
|
|
212
|
+
"types": "./src/TextInput.tsx",
|
|
213
|
+
"default": "./dist/TextInput.mjs"
|
|
214
|
+
},
|
|
215
|
+
"require": {
|
|
216
|
+
"types": "./src/TextInput.tsx",
|
|
217
|
+
"default": "./dist/TextInput.js"
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
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
|
+
|
|
10
|
+
.Button__root {
|
|
11
|
+
padding-top: 10px;
|
|
12
|
+
padding-bottom: 10px;
|
|
13
|
+
padding-left: 15px;
|
|
14
|
+
padding-right: 15px;
|
|
15
|
+
border: 0px;
|
|
16
|
+
background-color: #eee;
|
|
17
|
+
border-radius: 2px;
|
|
18
|
+
cursor: pointer;
|
|
19
|
+
font-size: 14px;
|
|
20
|
+
}
|
|
21
|
+
.Button__root:hover {
|
|
22
|
+
background-color: #ddd;
|
|
23
|
+
}
|
|
24
|
+
.Button__small {
|
|
25
|
+
padding-top: 5px;
|
|
26
|
+
padding-bottom: 5px;
|
|
27
|
+
padding-left: 10px;
|
|
28
|
+
padding-right: 10px;
|
|
29
|
+
font-size: 13px;
|
|
30
|
+
}
|
|
31
|
+
.Button__disabled {
|
|
32
|
+
cursor: not-allowed;
|
|
33
|
+
}
|
|
34
|
+
.Button__disabled:hover {
|
|
35
|
+
background-color: #eee;
|
|
36
|
+
}
|
package/src/Button.tsx
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
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 type {JSX} from 'react';
|
|
10
|
+
|
|
11
|
+
import * as React from 'react';
|
|
12
|
+
import {ReactNode} from 'react';
|
|
13
|
+
|
|
14
|
+
import Styles from './Button.module.less';
|
|
15
|
+
import joinClasses from './utils/joinClasses';
|
|
16
|
+
|
|
17
|
+
export default function Button({
|
|
18
|
+
'data-test-id': dataTestId,
|
|
19
|
+
children,
|
|
20
|
+
className,
|
|
21
|
+
onClick,
|
|
22
|
+
disabled,
|
|
23
|
+
small,
|
|
24
|
+
title,
|
|
25
|
+
}: {
|
|
26
|
+
'data-test-id'?: string;
|
|
27
|
+
children: ReactNode;
|
|
28
|
+
className?: string;
|
|
29
|
+
disabled?: boolean;
|
|
30
|
+
onClick: () => void;
|
|
31
|
+
small?: boolean;
|
|
32
|
+
title?: string;
|
|
33
|
+
}): JSX.Element {
|
|
34
|
+
return (
|
|
35
|
+
<button
|
|
36
|
+
disabled={disabled}
|
|
37
|
+
className={joinClasses(
|
|
38
|
+
Styles.Button__root,
|
|
39
|
+
disabled && Styles.Button__disabled,
|
|
40
|
+
small && Styles.Button__small,
|
|
41
|
+
className,
|
|
42
|
+
)}
|
|
43
|
+
onClick={onClick}
|
|
44
|
+
title={title}
|
|
45
|
+
aria-label={title}
|
|
46
|
+
{...(dataTestId && {'data-test-id': dataTestId})}>
|
|
47
|
+
{children}
|
|
48
|
+
</button>
|
|
49
|
+
);
|
|
50
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
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
|
+
.color-picker-wrapper {
|
|
10
|
+
padding: 20px;
|
|
11
|
+
:global {
|
|
12
|
+
.color-picker-basic-color {
|
|
13
|
+
display: flex;
|
|
14
|
+
flex-wrap: wrap;
|
|
15
|
+
gap: 10px;
|
|
16
|
+
margin: 0;
|
|
17
|
+
padding: 0;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.color-picker-basic-color button {
|
|
21
|
+
border: 1px solid #ccc;
|
|
22
|
+
border-radius: 2px;
|
|
23
|
+
height: 16px;
|
|
24
|
+
width: 16px;
|
|
25
|
+
cursor: pointer;
|
|
26
|
+
list-style-type: none;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.color-picker-basic-color button.active {
|
|
30
|
+
box-shadow: 0px 0px 2px 2px rgba(0, 0, 0, 0.3);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.color-picker-saturation {
|
|
34
|
+
width: 100%;
|
|
35
|
+
position: relative;
|
|
36
|
+
margin-top: 15px;
|
|
37
|
+
height: 150px;
|
|
38
|
+
background-image: linear-gradient(transparent, black),
|
|
39
|
+
linear-gradient(to right, white, transparent);
|
|
40
|
+
user-select: none;
|
|
41
|
+
}
|
|
42
|
+
.color-picker-saturation_cursor {
|
|
43
|
+
position: absolute;
|
|
44
|
+
width: 20px;
|
|
45
|
+
height: 20px;
|
|
46
|
+
border: 2px solid #ffffff;
|
|
47
|
+
border-radius: 50%;
|
|
48
|
+
box-shadow: 0 0 15px #00000026;
|
|
49
|
+
box-sizing: border-box;
|
|
50
|
+
transform: translate(-10px, -10px);
|
|
51
|
+
}
|
|
52
|
+
.color-picker-hue {
|
|
53
|
+
width: 100%;
|
|
54
|
+
position: relative;
|
|
55
|
+
margin-top: 15px;
|
|
56
|
+
height: 12px;
|
|
57
|
+
background-image: linear-gradient(
|
|
58
|
+
to right,
|
|
59
|
+
rgb(255, 0, 0),
|
|
60
|
+
rgb(255, 255, 0),
|
|
61
|
+
rgb(0, 255, 0),
|
|
62
|
+
rgb(0, 255, 255),
|
|
63
|
+
rgb(0, 0, 255),
|
|
64
|
+
rgb(255, 0, 255),
|
|
65
|
+
rgb(255, 0, 0)
|
|
66
|
+
);
|
|
67
|
+
user-select: none;
|
|
68
|
+
border-radius: 12px;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.color-picker-hue_cursor {
|
|
72
|
+
position: absolute;
|
|
73
|
+
width: 20px;
|
|
74
|
+
height: 20px;
|
|
75
|
+
border: 2px solid #ffffff;
|
|
76
|
+
border-radius: 50%;
|
|
77
|
+
box-shadow: #0003 0 0 0 0.5px;
|
|
78
|
+
box-sizing: border-box;
|
|
79
|
+
transform: translate(-10px, -4px);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.color-picker-color {
|
|
83
|
+
border: 1px solid #ccc;
|
|
84
|
+
margin-top: 15px;
|
|
85
|
+
width: 100%;
|
|
86
|
+
height: 20px;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|