@zuilib/text-editor 0.0.2 → 0.1.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/dist/styles.css CHANGED
@@ -80,6 +80,285 @@
80
80
  opacity: 0.7;
81
81
  }
82
82
 
83
+ /* Toolbar */
84
+ .zui-text-editor-toolbar {
85
+ position: sticky;
86
+ top: 0;
87
+ z-index: 10;
88
+ display: flex;
89
+ align-items: center;
90
+ gap: 0.125rem;
91
+ padding: 0.375rem 0.75rem;
92
+ border-bottom: 1px solid color-mix(in srgb, currentColor 12%, transparent);
93
+ background: inherit;
94
+ backdrop-filter: blur(8px);
95
+ }
96
+
97
+ .zui-text-editor-toolbar-button {
98
+ display: inline-flex;
99
+ align-items: center;
100
+ justify-content: center;
101
+ width: 1.75rem;
102
+ height: 1.75rem;
103
+ border: none;
104
+ border-radius: 0.375rem;
105
+ background: transparent;
106
+ color: inherit;
107
+ opacity: 0.65;
108
+ cursor: pointer;
109
+ }
110
+
111
+ .zui-text-editor-toolbar-button:hover {
112
+ opacity: 1;
113
+ background: color-mix(in srgb, currentColor 8%, transparent);
114
+ }
115
+
116
+ .zui-text-editor-toolbar-button.is-active {
117
+ opacity: 1;
118
+ background: color-mix(in srgb, currentColor 12%, transparent);
119
+ }
120
+
121
+ .zui-text-editor-toolbar-divider {
122
+ width: 1px;
123
+ height: 1.125rem;
124
+ margin: 0 0.375rem;
125
+ background: color-mix(in srgb, currentColor 15%, transparent);
126
+ }
127
+
128
+ /* Tables — artifact-style: rounded outer border, subtle header, tight rules */
129
+ .zui-table {
130
+ width: 100%;
131
+ margin: 1rem 0;
132
+ border-collapse: separate;
133
+ border-spacing: 0;
134
+ border: 1px solid color-mix(in srgb, currentColor 15%, transparent);
135
+ border-radius: 0.625rem;
136
+ overflow: hidden;
137
+ font-size: 0.875rem;
138
+ table-layout: fixed;
139
+ }
140
+
141
+ .zui-table-cell {
142
+ padding: 0.5rem 0.75rem;
143
+ border-bottom: 1px solid color-mix(in srgb, currentColor 10%, transparent);
144
+ border-right: 1px solid color-mix(in srgb, currentColor 10%, transparent);
145
+ vertical-align: top;
146
+ text-align: left;
147
+ }
148
+
149
+ .zui-table-cell:last-child {
150
+ border-right: none;
151
+ }
152
+
153
+ .zui-table tr:last-child > .zui-table-cell {
154
+ border-bottom: none;
155
+ }
156
+
157
+ .zui-table-cell-header {
158
+ background: color-mix(in srgb, currentColor 6%, transparent);
159
+ font-weight: 600;
160
+ }
161
+
162
+ .zui-table-cell > p,
163
+ .zui-table-cell-header > p {
164
+ margin-bottom: 0;
165
+ }
166
+
167
+ .zui-table-selected,
168
+ .zui-table-cell.zui-table-selected {
169
+ outline: none;
170
+ background: color-mix(in srgb, #6965db 14%, transparent);
171
+ }
172
+
173
+ /* Drawing canvas */
174
+ .zui-drawing {
175
+ margin: 1rem 0;
176
+ }
177
+
178
+ .zui-drawing-canvas {
179
+ position: relative;
180
+ border-radius: 0.75rem;
181
+ background: #ffffff;
182
+ outline: none;
183
+ overflow: hidden;
184
+ }
185
+
186
+ .zui-drawing-surface {
187
+ display: block;
188
+ width: 100%;
189
+ touch-action: none;
190
+ background-color: #ffffff;
191
+ background-image: radial-gradient(
192
+ circle,
193
+ rgba(0, 0, 0, 0.07) 1px,
194
+ transparent 1px
195
+ );
196
+ background-size: 20px 20px;
197
+ }
198
+
199
+ /*
200
+ * Dark mode (zui `.dark` class convention). The drawing surface, the color
201
+ * swatches, and the inline text input are darkened Excalidraw-style with a
202
+ * color-inversion filter, so stored shape colors stay theme-agnostic: the
203
+ * default near-black stroke renders light on the dark canvas, and the
204
+ * swatches preview exactly what will be drawn.
205
+ */
206
+ .dark .zui-drawing-canvas {
207
+ background: #18181b;
208
+ }
209
+
210
+ .dark .zui-drawing-surface,
211
+ .dark .zui-drawing-swatch,
212
+ .dark .zui-drawing-text-input {
213
+ filter: invert(93%) hue-rotate(180deg);
214
+ }
215
+
216
+ .dark .zui-drawing-toolbar-group {
217
+ background: #232329;
218
+ border-color: rgba(255, 255, 255, 0.1);
219
+ box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
220
+ }
221
+
222
+ .dark .zui-drawing-tool {
223
+ color: #e3e3e8;
224
+ }
225
+
226
+ .dark .zui-drawing-tool:hover {
227
+ background: rgba(255, 255, 255, 0.08);
228
+ }
229
+
230
+ .dark .zui-drawing-tool.is-active {
231
+ background: #45437a;
232
+ color: #dcdaff;
233
+ }
234
+
235
+ .dark .zui-drawing-swatch-label {
236
+ color: rgba(255, 255, 255, 0.55);
237
+ }
238
+
239
+ .dark .zui-drawing-resize {
240
+ background: rgba(255, 255, 255, 0.2);
241
+ }
242
+
243
+ .dark .zui-drawing-resize:hover {
244
+ background: rgba(255, 255, 255, 0.35);
245
+ }
246
+
247
+ .zui-drawing-toolbar {
248
+ position: absolute;
249
+ top: 0.5rem;
250
+ left: 0.5rem;
251
+ right: 0.5rem;
252
+ z-index: 5;
253
+ display: flex;
254
+ flex-wrap: wrap;
255
+ align-items: center;
256
+ gap: 0.5rem;
257
+ pointer-events: none;
258
+ }
259
+
260
+ .zui-drawing-toolbar-group {
261
+ display: flex;
262
+ align-items: center;
263
+ gap: 0.125rem;
264
+ padding: 0.25rem;
265
+ border: 1px solid rgba(0, 0, 0, 0.08);
266
+ border-radius: 0.5rem;
267
+ background: #ffffff;
268
+ box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
269
+ pointer-events: auto;
270
+ }
271
+
272
+ .zui-drawing-tool {
273
+ display: inline-flex;
274
+ align-items: center;
275
+ justify-content: center;
276
+ width: 1.75rem;
277
+ height: 1.75rem;
278
+ border: none;
279
+ border-radius: 0.375rem;
280
+ background: transparent;
281
+ color: #1e1e1e;
282
+ cursor: pointer;
283
+ }
284
+
285
+ .zui-drawing-tool:hover {
286
+ background: rgba(0, 0, 0, 0.06);
287
+ }
288
+
289
+ .zui-drawing-tool.is-active {
290
+ background: #e0dfff;
291
+ color: #4a47b1;
292
+ }
293
+
294
+ .zui-drawing-tool-danger {
295
+ color: #e03131;
296
+ }
297
+
298
+ .zui-drawing-swatch-label {
299
+ margin: 0 0.25rem;
300
+ font-size: 0.6875rem;
301
+ color: rgba(0, 0, 0, 0.5);
302
+ user-select: none;
303
+ }
304
+
305
+ .zui-drawing-swatch {
306
+ width: 1.125rem;
307
+ height: 1.125rem;
308
+ margin: 0 0.0625rem;
309
+ border: 1px solid rgba(0, 0, 0, 0.15);
310
+ border-radius: 0.3125rem;
311
+ cursor: pointer;
312
+ padding: 0;
313
+ }
314
+
315
+ .zui-drawing-swatch.is-active {
316
+ outline: 2px solid #6965db;
317
+ outline-offset: 1px;
318
+ }
319
+
320
+ .zui-drawing-swatch.is-transparent {
321
+ background-image: linear-gradient(
322
+ 45deg,
323
+ transparent 46%,
324
+ #e03131 46%,
325
+ #e03131 54%,
326
+ transparent 54%
327
+ );
328
+ }
329
+
330
+ .zui-drawing-text-input {
331
+ position: absolute;
332
+ z-index: 6;
333
+ padding: 2px 4px;
334
+ border: 1px dashed #6965db;
335
+ border-radius: 0.25rem;
336
+ background: rgba(255, 255, 255, 0.9);
337
+ font-family: ui-sans-serif, system-ui, sans-serif;
338
+ line-height: 1.35;
339
+ resize: none;
340
+ outline: none;
341
+ overflow: hidden;
342
+ white-space: pre;
343
+ }
344
+
345
+ .zui-drawing-resize {
346
+ position: absolute;
347
+ bottom: 0.25rem;
348
+ left: 50%;
349
+ transform: translateX(-50%);
350
+ width: 3rem;
351
+ height: 0.375rem;
352
+ border-radius: 999px;
353
+ background: rgba(0, 0, 0, 0.15);
354
+ cursor: ns-resize;
355
+ touch-action: none;
356
+ }
357
+
358
+ .zui-drawing-resize:hover {
359
+ background: rgba(0, 0, 0, 0.3);
360
+ }
361
+
83
362
  .zui-text-editor-textarea {
84
363
  width: 100%;
85
364
  height: 100%;
package/package.json CHANGED
@@ -1,15 +1,16 @@
1
1
  {
2
2
  "name": "@zuilib/text-editor",
3
- "version": "0.0.2",
3
+ "version": "0.1.0",
4
4
  "description": "ZUI — A markdown editor component wrapping Lexical",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",
8
- "sideEffects": ["**/*.css"],
9
- "files": ["dist"],
10
- "scripts": {
11
- "build": "tsup"
12
- },
8
+ "sideEffects": [
9
+ "**/*.css"
10
+ ],
11
+ "files": [
12
+ "dist"
13
+ ],
13
14
  "exports": {
14
15
  ".": {
15
16
  "types": "./dist/index.d.ts",
@@ -19,31 +20,36 @@
19
20
  "./package.json": "./package.json"
20
21
  },
21
22
  "peerDependencies": {
22
- "react": "^18.0.0 || ^19.0.0",
23
- "react-dom": "^18.0.0 || ^19.0.0",
24
- "lexical": "^0.35.0",
25
- "@lexical/react": "^0.35.0",
26
- "@lexical/markdown": "^0.35.0",
27
- "@lexical/rich-text": "^0.35.0",
28
23
  "@lexical/code": "^0.35.0",
24
+ "@lexical/link": "^0.35.0",
29
25
  "@lexical/list": "^0.35.0",
30
- "@lexical/link": "^0.35.0"
26
+ "@lexical/markdown": "^0.35.0",
27
+ "@lexical/react": "^0.35.0",
28
+ "@lexical/rich-text": "^0.35.0",
29
+ "@lexical/table": "^0.35.0",
30
+ "@lexical/utils": "^0.35.0",
31
+ "lexical": "^0.35.0",
32
+ "react": "^18.0.0 || ^19.0.0",
33
+ "react-dom": "^18.0.0 || ^19.0.0"
31
34
  },
32
35
  "dependencies": {
33
36
  "@zuilib/core": "^0.0.0"
34
37
  },
35
38
  "devDependencies": {
39
+ "@lexical/code": "^0.35.0",
40
+ "@lexical/headless": "0.35.0",
41
+ "@lexical/link": "^0.35.0",
42
+ "@lexical/list": "^0.35.0",
43
+ "@lexical/markdown": "^0.35.0",
44
+ "@lexical/react": "^0.35.0",
45
+ "@lexical/rich-text": "^0.35.0",
46
+ "@lexical/table": "^0.35.0",
47
+ "@lexical/utils": "^0.35.0",
36
48
  "@types/react": "^18.0.0 || ^19.0.0",
37
49
  "@types/react-dom": "^18.0.0 || ^19.0.0",
38
- "react": "^18.0.0 || ^19.0.0",
39
- "react-dom": "^18.0.0 || ^19.0.0",
40
50
  "lexical": "^0.35.0",
41
- "@lexical/react": "^0.35.0",
42
- "@lexical/markdown": "^0.35.0",
43
- "@lexical/rich-text": "^0.35.0",
44
- "@lexical/code": "^0.35.0",
45
- "@lexical/list": "^0.35.0",
46
- "@lexical/link": "^0.35.0"
51
+ "react": "^18.0.0 || ^19.0.0",
52
+ "react-dom": "^18.0.0 || ^19.0.0"
47
53
  },
48
54
  "keywords": [
49
55
  "lexical",
@@ -53,5 +59,9 @@
53
59
  "design-system",
54
60
  "react",
55
61
  "typescript"
56
- ]
57
- }
62
+ ],
63
+ "scripts": {
64
+ "build": "tsup",
65
+ "test": "node tests/roundtrip.mjs"
66
+ }
67
+ }