@wakastellar/ui 3.3.3 → 3.5.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/badge-BbwO7QeZ.js +1 -0
- package/dist/badge-BfiocODp.mjs +23 -0
- package/dist/charts.cjs.js +1 -1
- package/dist/charts.es.js +1 -1
- package/dist/chunk-14q5BKub.js +1 -0
- package/dist/{chunk-BH6uBOac.mjs → chunk-Cr9pTUWm.mjs} +5 -5
- package/dist/cn-DEtaFQsA.js +1 -0
- package/dist/cn-DUn6aSIQ.mjs +24 -0
- package/dist/doc.cjs.js +2 -2
- package/dist/doc.es.js +19 -19
- package/dist/editor.cjs.js +48 -0
- package/dist/editor.d.ts +1 -0
- package/dist/editor.es.js +6551 -0
- package/dist/{exceljs.min-DG9M8IZ1.mjs → exceljs.min-DL1XYDll.mjs} +1 -1
- package/dist/{exceljs.min-BuefmDRS.js → exceljs.min-qeIfSCbF.js} +1 -1
- package/dist/export.cjs.js +1 -1
- package/dist/export.es.js +1 -1
- package/dist/index.cjs.js +150 -150
- package/dist/index.es.js +26782 -27591
- package/dist/input-BfaSAGVw.js +1 -0
- package/dist/input-DVr_Qkl8.mjs +14 -0
- package/dist/rich-text.cjs.js +1 -1
- package/dist/rich-text.es.js +1 -1
- package/dist/security-CyBpuklN.mjs +122 -0
- package/dist/security-bFWwDrlg.js +1 -0
- package/dist/separator-NrkltulH.js +1 -0
- package/dist/separator-ibN2mycs.mjs +51 -0
- package/dist/src/components/editor/blocks/index.d.ts +51 -0
- package/dist/src/components/editor/blocks/waka-acceptance-criteria-block.d.ts +60 -0
- package/dist/src/components/editor/blocks/waka-ai-assist-block.d.ts +58 -0
- package/dist/src/components/editor/blocks/waka-api-endpoint-block.d.ts +63 -0
- package/dist/src/components/editor/blocks/waka-code-playground-block.d.ts +61 -0
- package/dist/src/components/editor/blocks/waka-comment-thread-block.d.ts +85 -0
- package/dist/src/components/editor/blocks/waka-diagram-block.d.ts +52 -0
- package/dist/src/components/editor/blocks/waka-embed-block.d.ts +58 -0
- package/dist/src/components/editor/blocks/waka-slash-menu-block.d.ts +67 -0
- package/dist/src/components/editor/blocks/waka-user-story-block.d.ts +79 -0
- package/dist/src/components/editor/blocks/waka-version-diff-block.d.ts +73 -0
- package/dist/src/components/editor/index.d.ts +66 -0
- package/dist/src/components/editor/waka-ai-writer.d.ts +80 -0
- package/dist/src/components/editor/waka-collaborative-editor.d.ts +93 -0
- package/dist/src/components/editor/waka-diff-viewer.d.ts +71 -0
- package/dist/src/components/editor/waka-dnd-editor.d.ts +64 -0
- package/dist/src/components/editor/waka-document-editor.d.ts +92 -0
- package/dist/src/components/editor/waka-editor-elements.d.ts +79 -0
- package/dist/src/components/editor/waka-editor-leaves.d.ts +39 -0
- package/dist/src/components/editor/waka-editor-plugins.d.ts +41 -0
- package/dist/src/components/editor/waka-editor-toolbar.d.ts +20 -0
- package/dist/src/components/editor/waka-editor.d.ts +59 -0
- package/dist/src/components/editor/waka-floating-toolbar.d.ts +47 -0
- package/dist/src/components/editor/waka-markdown-editor.d.ts +60 -0
- package/dist/src/components/editor/waka-mention-editor.d.ts +125 -0
- package/dist/src/components/editor/waka-slash-menu.d.ts +70 -0
- package/dist/src/components/editor/waka-spec-editor.d.ts +88 -0
- package/dist/src/components/index.d.ts +1 -15
- package/dist/src/editor.d.ts +26 -0
- package/dist/textarea-CdQWggYG.js +1 -0
- package/dist/textarea-DJDXJ3nd.mjs +23 -0
- package/dist/types-C2St0wOW.js +1 -0
- package/dist/{types-B6GVaSIP.mjs → types-JnqoLyuv.mjs} +214 -211
- package/dist/{useDataTableImport-BPvfo--2.mjs → useDataTableImport-BWUFesPi.mjs} +3 -3
- package/dist/{useDataTableImport-Cm_pCKnO.js → useDataTableImport-T7ddpN5k.js} +3 -3
- package/dist/waka-doc-renderer-CTxC7Trf.js +3 -0
- package/dist/{waka-doc-renderer-BkIvas3z.mjs → waka-doc-renderer-Cw-Xnyen.mjs} +264 -281
- package/dist/waka-editor-plugins-DR6tpsUC.mjs +135 -0
- package/dist/waka-editor-plugins-sGSh9hn2.js +1 -0
- package/dist/waka-rich-text-editor-BlIdtknG.js +1 -0
- package/dist/waka-rich-text-editor-D1uA3zbB.js +1 -0
- package/dist/waka-rich-text-editor-DgSWiXMW.mjs +342 -0
- package/dist/waka-rich-text-editor-DndVJuDw.mjs +2 -0
- package/package.json +87 -2
- package/src/blocks/footer/index.tsx +1 -6
- package/src/blocks/login/index.tsx +1 -7
- package/src/blocks/profile/index.tsx +3 -5
- package/src/components/editor/blocks/index.ts +182 -0
- package/src/components/editor/blocks/waka-acceptance-criteria-block.tsx +326 -0
- package/src/components/editor/blocks/waka-ai-assist-block.tsx +284 -0
- package/src/components/editor/blocks/waka-api-endpoint-block.tsx +382 -0
- package/src/components/editor/blocks/waka-code-playground-block.tsx +331 -0
- package/src/components/editor/blocks/waka-comment-thread-block.tsx +448 -0
- package/src/components/editor/blocks/waka-diagram-block.tsx +293 -0
- package/src/components/editor/blocks/waka-embed-block.tsx +416 -0
- package/src/components/editor/blocks/waka-slash-menu-block.tsx +432 -0
- package/src/components/editor/blocks/waka-user-story-block.tsx +295 -0
- package/src/components/editor/blocks/waka-version-diff-block.tsx +426 -0
- package/src/components/editor/index.ts +279 -0
- package/src/components/editor/waka-ai-writer.tsx +434 -0
- package/src/components/editor/waka-collaborative-editor.tsx +426 -0
- package/src/components/editor/waka-diff-viewer.tsx +352 -0
- package/src/components/editor/waka-dnd-editor.tsx +284 -0
- package/src/components/editor/waka-document-editor.tsx +502 -0
- package/src/components/editor/waka-editor-elements.tsx +312 -0
- package/src/components/editor/waka-editor-leaves.tsx +101 -0
- package/src/components/editor/waka-editor-plugins.ts +207 -0
- package/src/components/editor/waka-editor-toolbar.tsx +358 -0
- package/src/components/editor/waka-editor.tsx +431 -0
- package/src/components/editor/waka-floating-toolbar.tsx +268 -0
- package/src/components/editor/waka-markdown-editor.tsx +395 -0
- package/src/components/editor/waka-mention-editor.tsx +459 -0
- package/src/components/editor/waka-slash-menu.tsx +392 -0
- package/src/components/editor/waka-spec-editor.tsx +657 -0
- package/src/components/index.ts +1 -18
- package/dist/chunk-BDDJmn7V.js +0 -1
- package/dist/cn-DnPbmOCy.js +0 -1
- package/dist/cn-DpLcAzrf.mjs +0 -22
- package/dist/separator-BDReXBvI.mjs +0 -59
- package/dist/separator-BKjNl9sI.js +0 -1
- package/dist/src/components/waka-actor-badge/index.d.ts +0 -8
- package/dist/src/components/waka-actors-list/index.d.ts +0 -18
- package/dist/src/components/waka-ai-assistant-button/index.d.ts +0 -8
- package/dist/src/components/waka-document-flyover/index.d.ts +0 -10
- package/dist/src/components/waka-document-preview-popup/index.d.ts +0 -26
- package/dist/src/components/waka-hour-balance-badge/index.d.ts +0 -8
- package/dist/src/components/waka-hour-consumption-table/index.d.ts +0 -15
- package/dist/src/components/waka-hour-pack-dialog/index.d.ts +0 -8
- package/dist/src/components/waka-project-stats-header/index.d.ts +0 -15
- package/dist/src/components/waka-step-comment-bubble/index.d.ts +0 -13
- package/dist/src/components/waka-step-comment-panel/index.d.ts +0 -20
- package/dist/src/components/waka-step-permission-matrix/index.d.ts +0 -12
- package/dist/src/components/waka-time-entry-dialog/index.d.ts +0 -16
- package/dist/src/components/waka-time-tracking-flyover/index.d.ts +0 -11
- package/dist/types-BH9cQRqZ.js +0 -1
- package/dist/waka-doc-renderer-BZ2-SqyT.js +0 -3
- package/dist/waka-rich-text-editor-BJGlQgpq.js +0 -1
- package/dist/waka-rich-text-editor-BJzzxeP1.mjs +0 -361
- package/dist/waka-rich-text-editor-wnXLwvUo.js +0 -1
- package/src/components/waka-actor-badge/index.tsx +0 -34
- package/src/components/waka-actors-list/index.tsx +0 -125
- package/src/components/waka-ai-assistant-button/index.tsx +0 -31
- package/src/components/waka-document-flyover/index.tsx +0 -36
- package/src/components/waka-document-preview-popup/index.tsx +0 -103
- package/src/components/waka-hour-balance-badge/index.tsx +0 -43
- package/src/components/waka-hour-consumption-table/index.tsx +0 -72
- package/src/components/waka-hour-pack-dialog/index.tsx +0 -72
- package/src/components/waka-project-stats-header/index.tsx +0 -69
- package/src/components/waka-step-comment-bubble/index.tsx +0 -71
- package/src/components/waka-step-comment-panel/index.tsx +0 -106
- package/src/components/waka-step-permission-matrix/index.tsx +0 -65
- package/src/components/waka-time-entry-dialog/index.tsx +0 -131
- package/src/components/waka-time-tracking-flyover/index.tsx +0 -41
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import { cn } from "../../utils/cn"
|
|
5
|
+
|
|
6
|
+
// ─── Table Elements ──────────────────────────────────────────────────────────
|
|
7
|
+
|
|
8
|
+
export interface PlateElementProps {
|
|
9
|
+
attributes?: Record<string, unknown>
|
|
10
|
+
children?: React.ReactNode
|
|
11
|
+
element?: Record<string, unknown>
|
|
12
|
+
className?: string
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function TableElement({ children, attributes, className }: PlateElementProps) {
|
|
16
|
+
return (
|
|
17
|
+
<table
|
|
18
|
+
{...attributes}
|
|
19
|
+
className={cn(
|
|
20
|
+
"w-full border-collapse text-sm my-4",
|
|
21
|
+
"border border-border rounded-lg overflow-hidden",
|
|
22
|
+
className
|
|
23
|
+
)}
|
|
24
|
+
>
|
|
25
|
+
<tbody>{children}</tbody>
|
|
26
|
+
</table>
|
|
27
|
+
)
|
|
28
|
+
}
|
|
29
|
+
TableElement.displayName = "TableElement"
|
|
30
|
+
|
|
31
|
+
export function TableRowElement({ children, attributes, className }: PlateElementProps) {
|
|
32
|
+
return (
|
|
33
|
+
<tr
|
|
34
|
+
{...attributes}
|
|
35
|
+
className={cn("border-b border-border last:border-b-0", className)}
|
|
36
|
+
>
|
|
37
|
+
{children}
|
|
38
|
+
</tr>
|
|
39
|
+
)
|
|
40
|
+
}
|
|
41
|
+
TableRowElement.displayName = "TableRowElement"
|
|
42
|
+
|
|
43
|
+
export function TableCellElement({ children, attributes, className }: PlateElementProps) {
|
|
44
|
+
return (
|
|
45
|
+
<td
|
|
46
|
+
{...attributes}
|
|
47
|
+
className={cn(
|
|
48
|
+
"px-3 py-2 text-sm text-foreground",
|
|
49
|
+
"border-r border-border last:border-r-0",
|
|
50
|
+
className
|
|
51
|
+
)}
|
|
52
|
+
>
|
|
53
|
+
{children}
|
|
54
|
+
</td>
|
|
55
|
+
)
|
|
56
|
+
}
|
|
57
|
+
TableCellElement.displayName = "TableCellElement"
|
|
58
|
+
|
|
59
|
+
export function TableCellHeaderElement({ children, attributes, className }: PlateElementProps) {
|
|
60
|
+
return (
|
|
61
|
+
<th
|
|
62
|
+
{...attributes}
|
|
63
|
+
className={cn(
|
|
64
|
+
"px-3 py-2 text-xs font-bold uppercase tracking-wider",
|
|
65
|
+
"text-muted-foreground text-left bg-muted/50",
|
|
66
|
+
"border-r border-border last:border-r-0",
|
|
67
|
+
className
|
|
68
|
+
)}
|
|
69
|
+
>
|
|
70
|
+
{children}
|
|
71
|
+
</th>
|
|
72
|
+
)
|
|
73
|
+
}
|
|
74
|
+
TableCellHeaderElement.displayName = "TableCellHeaderElement"
|
|
75
|
+
|
|
76
|
+
// ─── Layout Elements ─────────────────────────────────────────────────────────
|
|
77
|
+
|
|
78
|
+
export function ColumnGroupElement({ children, attributes, className }: PlateElementProps) {
|
|
79
|
+
return (
|
|
80
|
+
<div
|
|
81
|
+
{...attributes}
|
|
82
|
+
className={cn("flex gap-6 my-4", className)}
|
|
83
|
+
>
|
|
84
|
+
{children}
|
|
85
|
+
</div>
|
|
86
|
+
)
|
|
87
|
+
}
|
|
88
|
+
ColumnGroupElement.displayName = "ColumnGroupElement"
|
|
89
|
+
|
|
90
|
+
export function ColumnElement({ children, attributes, className }: PlateElementProps) {
|
|
91
|
+
return (
|
|
92
|
+
<div
|
|
93
|
+
{...attributes}
|
|
94
|
+
className={cn("flex-1 min-w-0", className)}
|
|
95
|
+
>
|
|
96
|
+
{children}
|
|
97
|
+
</div>
|
|
98
|
+
)
|
|
99
|
+
}
|
|
100
|
+
ColumnElement.displayName = "ColumnElement"
|
|
101
|
+
|
|
102
|
+
// ─── Callout Element ─────────────────────────────────────────────────────────
|
|
103
|
+
|
|
104
|
+
const CALLOUT_VARIANTS: Record<string, string> = {
|
|
105
|
+
info: "bg-blue-50 border-blue-200 text-blue-900 dark:bg-blue-950/30 dark:border-blue-800 dark:text-blue-200",
|
|
106
|
+
warning: "bg-amber-50 border-amber-200 text-amber-900 dark:bg-amber-950/30 dark:border-amber-800 dark:text-amber-200",
|
|
107
|
+
success: "bg-green-50 border-green-200 text-green-900 dark:bg-green-950/30 dark:border-green-800 dark:text-green-200",
|
|
108
|
+
error: "bg-red-50 border-red-200 text-red-900 dark:bg-red-950/30 dark:border-red-800 dark:text-red-200",
|
|
109
|
+
dark: "bg-card border-border text-card-foreground",
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export function CalloutElement({ children, attributes, element, className }: PlateElementProps) {
|
|
113
|
+
const variant = (element?.variant as string) || "info"
|
|
114
|
+
const variantClasses = CALLOUT_VARIANTS[variant] ?? CALLOUT_VARIANTS.info
|
|
115
|
+
|
|
116
|
+
return (
|
|
117
|
+
<div
|
|
118
|
+
{...attributes}
|
|
119
|
+
className={cn(
|
|
120
|
+
"border rounded-xl p-4 my-3",
|
|
121
|
+
variantClasses,
|
|
122
|
+
className
|
|
123
|
+
)}
|
|
124
|
+
>
|
|
125
|
+
{children}
|
|
126
|
+
</div>
|
|
127
|
+
)
|
|
128
|
+
}
|
|
129
|
+
CalloutElement.displayName = "CalloutElement"
|
|
130
|
+
|
|
131
|
+
// ─── Heading Elements ────────────────────────────────────────────────────────
|
|
132
|
+
|
|
133
|
+
export function H1Element({ children, attributes, className }: PlateElementProps) {
|
|
134
|
+
return (
|
|
135
|
+
<h1
|
|
136
|
+
{...attributes}
|
|
137
|
+
className={cn(
|
|
138
|
+
"text-2xl font-extrabold text-foreground mt-8 mb-2 first:mt-0",
|
|
139
|
+
className
|
|
140
|
+
)}
|
|
141
|
+
>
|
|
142
|
+
{children}
|
|
143
|
+
</h1>
|
|
144
|
+
)
|
|
145
|
+
}
|
|
146
|
+
H1Element.displayName = "H1Element"
|
|
147
|
+
|
|
148
|
+
export function H2Element({ children, attributes, className }: PlateElementProps) {
|
|
149
|
+
return (
|
|
150
|
+
<h2
|
|
151
|
+
{...attributes}
|
|
152
|
+
className={cn(
|
|
153
|
+
"text-sm font-bold text-foreground uppercase tracking-wider",
|
|
154
|
+
"mt-6 mb-3 border-b-2 border-border pb-1.5",
|
|
155
|
+
className
|
|
156
|
+
)}
|
|
157
|
+
>
|
|
158
|
+
{children}
|
|
159
|
+
</h2>
|
|
160
|
+
)
|
|
161
|
+
}
|
|
162
|
+
H2Element.displayName = "H2Element"
|
|
163
|
+
|
|
164
|
+
export function H3Element({ children, attributes, className }: PlateElementProps) {
|
|
165
|
+
return (
|
|
166
|
+
<h3
|
|
167
|
+
{...attributes}
|
|
168
|
+
className={cn(
|
|
169
|
+
"text-sm font-semibold text-primary italic mt-1 mb-4",
|
|
170
|
+
className
|
|
171
|
+
)}
|
|
172
|
+
>
|
|
173
|
+
{children}
|
|
174
|
+
</h3>
|
|
175
|
+
)
|
|
176
|
+
}
|
|
177
|
+
H3Element.displayName = "H3Element"
|
|
178
|
+
|
|
179
|
+
export function H4Element({ children, attributes, className }: PlateElementProps) {
|
|
180
|
+
return (
|
|
181
|
+
<h4
|
|
182
|
+
{...attributes}
|
|
183
|
+
className={cn(
|
|
184
|
+
"text-xs font-bold text-primary uppercase tracking-wide mt-2 mb-0.5",
|
|
185
|
+
className
|
|
186
|
+
)}
|
|
187
|
+
>
|
|
188
|
+
{children}
|
|
189
|
+
</h4>
|
|
190
|
+
)
|
|
191
|
+
}
|
|
192
|
+
H4Element.displayName = "H4Element"
|
|
193
|
+
|
|
194
|
+
export function H5Element({ children, attributes, className }: PlateElementProps) {
|
|
195
|
+
return (
|
|
196
|
+
<h5
|
|
197
|
+
{...attributes}
|
|
198
|
+
className={cn(
|
|
199
|
+
"text-xs font-semibold text-muted-foreground mt-2 mb-0.5",
|
|
200
|
+
className
|
|
201
|
+
)}
|
|
202
|
+
>
|
|
203
|
+
{children}
|
|
204
|
+
</h5>
|
|
205
|
+
)
|
|
206
|
+
}
|
|
207
|
+
H5Element.displayName = "H5Element"
|
|
208
|
+
|
|
209
|
+
export function H6Element({ children, attributes, className }: PlateElementProps) {
|
|
210
|
+
return (
|
|
211
|
+
<h6
|
|
212
|
+
{...attributes}
|
|
213
|
+
className={cn(
|
|
214
|
+
"text-xs font-medium text-muted-foreground mt-2 mb-0.5",
|
|
215
|
+
className
|
|
216
|
+
)}
|
|
217
|
+
>
|
|
218
|
+
{children}
|
|
219
|
+
</h6>
|
|
220
|
+
)
|
|
221
|
+
}
|
|
222
|
+
H6Element.displayName = "H6Element"
|
|
223
|
+
|
|
224
|
+
// ─── Blockquote Element ──────────────────────────────────────────────────────
|
|
225
|
+
|
|
226
|
+
export function BlockquoteElement({ children, attributes, className }: PlateElementProps) {
|
|
227
|
+
return (
|
|
228
|
+
<blockquote
|
|
229
|
+
{...attributes}
|
|
230
|
+
className={cn(
|
|
231
|
+
"border-l-3 border-primary/50 pl-4 py-2",
|
|
232
|
+
"bg-muted/30 rounded-r-lg",
|
|
233
|
+
"italic text-muted-foreground",
|
|
234
|
+
"my-3",
|
|
235
|
+
className
|
|
236
|
+
)}
|
|
237
|
+
>
|
|
238
|
+
{children}
|
|
239
|
+
</blockquote>
|
|
240
|
+
)
|
|
241
|
+
}
|
|
242
|
+
BlockquoteElement.displayName = "BlockquoteElement"
|
|
243
|
+
|
|
244
|
+
// ─── Paragraph Element ──────────────────────────────────────────────────────
|
|
245
|
+
|
|
246
|
+
export function ParagraphElement({ children, attributes, className }: PlateElementProps) {
|
|
247
|
+
return (
|
|
248
|
+
<p
|
|
249
|
+
{...attributes}
|
|
250
|
+
className={cn(
|
|
251
|
+
"text-sm leading-relaxed text-foreground my-0.5",
|
|
252
|
+
className
|
|
253
|
+
)}
|
|
254
|
+
>
|
|
255
|
+
{children}
|
|
256
|
+
</p>
|
|
257
|
+
)
|
|
258
|
+
}
|
|
259
|
+
ParagraphElement.displayName = "ParagraphElement"
|
|
260
|
+
|
|
261
|
+
// ─── Link Element ────────────────────────────────────────────────────────────
|
|
262
|
+
|
|
263
|
+
export function LinkElement({ children, attributes, element, className }: PlateElementProps) {
|
|
264
|
+
return (
|
|
265
|
+
<a
|
|
266
|
+
{...attributes}
|
|
267
|
+
href={element?.url as string}
|
|
268
|
+
target="_blank"
|
|
269
|
+
rel="noopener noreferrer"
|
|
270
|
+
className={cn(
|
|
271
|
+
"text-primary underline decoration-primary/30 hover:decoration-primary",
|
|
272
|
+
"transition-colors cursor-pointer",
|
|
273
|
+
className
|
|
274
|
+
)}
|
|
275
|
+
>
|
|
276
|
+
{children}
|
|
277
|
+
</a>
|
|
278
|
+
)
|
|
279
|
+
}
|
|
280
|
+
LinkElement.displayName = "LinkElement"
|
|
281
|
+
|
|
282
|
+
// ─── Mention Element ─────────────────────────────────────────────────────────
|
|
283
|
+
|
|
284
|
+
export function MentionElement({ children, attributes, element, className }: PlateElementProps) {
|
|
285
|
+
return (
|
|
286
|
+
<span
|
|
287
|
+
{...attributes}
|
|
288
|
+
contentEditable={false}
|
|
289
|
+
className={cn(
|
|
290
|
+
"inline-flex items-center rounded-md px-1.5 py-0.5",
|
|
291
|
+
"bg-primary/10 text-primary text-sm font-medium",
|
|
292
|
+
"border border-primary/20",
|
|
293
|
+
className
|
|
294
|
+
)}
|
|
295
|
+
>
|
|
296
|
+
@{(element?.value as string) || "unknown"}
|
|
297
|
+
{children}
|
|
298
|
+
</span>
|
|
299
|
+
)
|
|
300
|
+
}
|
|
301
|
+
MentionElement.displayName = "MentionElement"
|
|
302
|
+
|
|
303
|
+
// ─── Separator Element ──────────────────────────────────────────────────────
|
|
304
|
+
|
|
305
|
+
export function SeparatorElement({ attributes, className }: PlateElementProps) {
|
|
306
|
+
return (
|
|
307
|
+
<div {...attributes} className={cn("my-6", className)}>
|
|
308
|
+
<hr className="border-border" />
|
|
309
|
+
</div>
|
|
310
|
+
)
|
|
311
|
+
}
|
|
312
|
+
SeparatorElement.displayName = "SeparatorElement"
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import { cn } from "../../utils/cn"
|
|
5
|
+
|
|
6
|
+
// ─── Leaf Props ──────────────────────────────────────────────────────────────
|
|
7
|
+
|
|
8
|
+
export interface PlateLeafProps {
|
|
9
|
+
attributes?: Record<string, unknown>
|
|
10
|
+
children?: React.ReactNode
|
|
11
|
+
leaf?: Record<string, unknown>
|
|
12
|
+
className?: string
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// ─── Mark Leaves ─────────────────────────────────────────────────────────────
|
|
16
|
+
|
|
17
|
+
export function BoldLeaf({ children, attributes, className }: PlateLeafProps) {
|
|
18
|
+
return (
|
|
19
|
+
<strong {...attributes} className={cn("font-bold", className)}>
|
|
20
|
+
{children}
|
|
21
|
+
</strong>
|
|
22
|
+
)
|
|
23
|
+
}
|
|
24
|
+
BoldLeaf.displayName = "BoldLeaf"
|
|
25
|
+
|
|
26
|
+
export function ItalicLeaf({ children, attributes, className }: PlateLeafProps) {
|
|
27
|
+
return (
|
|
28
|
+
<em {...attributes} className={cn("italic", className)}>
|
|
29
|
+
{children}
|
|
30
|
+
</em>
|
|
31
|
+
)
|
|
32
|
+
}
|
|
33
|
+
ItalicLeaf.displayName = "ItalicLeaf"
|
|
34
|
+
|
|
35
|
+
export function UnderlineLeaf({ children, attributes, className }: PlateLeafProps) {
|
|
36
|
+
return (
|
|
37
|
+
<span {...attributes} className={cn("underline decoration-foreground/50", className)}>
|
|
38
|
+
{children}
|
|
39
|
+
</span>
|
|
40
|
+
)
|
|
41
|
+
}
|
|
42
|
+
UnderlineLeaf.displayName = "UnderlineLeaf"
|
|
43
|
+
|
|
44
|
+
export function StrikethroughLeaf({ children, attributes, className }: PlateLeafProps) {
|
|
45
|
+
return (
|
|
46
|
+
<s {...attributes} className={cn("line-through text-muted-foreground", className)}>
|
|
47
|
+
{children}
|
|
48
|
+
</s>
|
|
49
|
+
)
|
|
50
|
+
}
|
|
51
|
+
StrikethroughLeaf.displayName = "StrikethroughLeaf"
|
|
52
|
+
|
|
53
|
+
export function CodeLeaf({ children, attributes, className }: PlateLeafProps) {
|
|
54
|
+
return (
|
|
55
|
+
<code
|
|
56
|
+
{...attributes}
|
|
57
|
+
className={cn(
|
|
58
|
+
"rounded-md bg-muted px-1.5 py-0.5",
|
|
59
|
+
"font-mono text-[0.85em] text-foreground",
|
|
60
|
+
className
|
|
61
|
+
)}
|
|
62
|
+
>
|
|
63
|
+
{children}
|
|
64
|
+
</code>
|
|
65
|
+
)
|
|
66
|
+
}
|
|
67
|
+
CodeLeaf.displayName = "CodeLeaf"
|
|
68
|
+
|
|
69
|
+
export function HighlightLeaf({ children, attributes, className }: PlateLeafProps) {
|
|
70
|
+
return (
|
|
71
|
+
<mark
|
|
72
|
+
{...attributes}
|
|
73
|
+
className={cn(
|
|
74
|
+
"bg-yellow-200/60 dark:bg-yellow-500/30",
|
|
75
|
+
"rounded-sm px-0.5",
|
|
76
|
+
className
|
|
77
|
+
)}
|
|
78
|
+
>
|
|
79
|
+
{children}
|
|
80
|
+
</mark>
|
|
81
|
+
)
|
|
82
|
+
}
|
|
83
|
+
HighlightLeaf.displayName = "HighlightLeaf"
|
|
84
|
+
|
|
85
|
+
export function SuperscriptLeaf({ children, attributes, className }: PlateLeafProps) {
|
|
86
|
+
return (
|
|
87
|
+
<sup {...attributes} className={cn("text-[0.75em]", className)}>
|
|
88
|
+
{children}
|
|
89
|
+
</sup>
|
|
90
|
+
)
|
|
91
|
+
}
|
|
92
|
+
SuperscriptLeaf.displayName = "SuperscriptLeaf"
|
|
93
|
+
|
|
94
|
+
export function SubscriptLeaf({ children, attributes, className }: PlateLeafProps) {
|
|
95
|
+
return (
|
|
96
|
+
<sub {...attributes} className={cn("text-[0.75em]", className)}>
|
|
97
|
+
{children}
|
|
98
|
+
</sub>
|
|
99
|
+
)
|
|
100
|
+
}
|
|
101
|
+
SubscriptLeaf.displayName = "SubscriptLeaf"
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default plugin configurations for WakaEditor
|
|
3
|
+
*
|
|
4
|
+
* Each plugin set can be toggled via WakaEditorProps flags.
|
|
5
|
+
* All plugins come from @platejs/* packages which are peerDependencies.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type { PlatePlugin } from "platejs/react"
|
|
9
|
+
|
|
10
|
+
// ─── Core text formatting plugins ────────────────────────────────────────────
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Dynamically loads the core formatting plugins (marks + block elements).
|
|
14
|
+
* These are always included in the editor.
|
|
15
|
+
*/
|
|
16
|
+
export async function loadCorePlugins(): Promise<PlatePlugin[]> {
|
|
17
|
+
const [basicNodes, table, layout, callout] = await Promise.all([
|
|
18
|
+
import("@platejs/basic-nodes/react"),
|
|
19
|
+
import("@platejs/table/react"),
|
|
20
|
+
import("@platejs/layout/react"),
|
|
21
|
+
import("@platejs/callout/react"),
|
|
22
|
+
])
|
|
23
|
+
|
|
24
|
+
return [
|
|
25
|
+
// Marks
|
|
26
|
+
basicNodes.BoldPlugin,
|
|
27
|
+
basicNodes.ItalicPlugin,
|
|
28
|
+
basicNodes.UnderlinePlugin,
|
|
29
|
+
basicNodes.StrikethroughPlugin,
|
|
30
|
+
basicNodes.CodePlugin,
|
|
31
|
+
basicNodes.HighlightPlugin,
|
|
32
|
+
basicNodes.SuperscriptPlugin,
|
|
33
|
+
basicNodes.SubscriptPlugin,
|
|
34
|
+
// Block elements
|
|
35
|
+
basicNodes.H1Plugin,
|
|
36
|
+
basicNodes.H2Plugin,
|
|
37
|
+
basicNodes.H3Plugin,
|
|
38
|
+
basicNodes.H4Plugin,
|
|
39
|
+
basicNodes.H5Plugin,
|
|
40
|
+
basicNodes.H6Plugin,
|
|
41
|
+
basicNodes.BlockquotePlugin,
|
|
42
|
+
// Table
|
|
43
|
+
table.TablePlugin,
|
|
44
|
+
table.TableRowPlugin,
|
|
45
|
+
table.TableCellPlugin,
|
|
46
|
+
table.TableCellHeaderPlugin,
|
|
47
|
+
// Layout
|
|
48
|
+
layout.ColumnPlugin,
|
|
49
|
+
layout.ColumnItemPlugin,
|
|
50
|
+
// Callout
|
|
51
|
+
callout.CalloutPlugin,
|
|
52
|
+
]
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// ─── Optional plugin loaders ──────────────────────────────────────────────────
|
|
56
|
+
|
|
57
|
+
/** Loads the link plugin */
|
|
58
|
+
export async function loadLinkPlugin(): Promise<PlatePlugin[]> {
|
|
59
|
+
const { LinkPlugin } = await import("@platejs/link/react")
|
|
60
|
+
return [
|
|
61
|
+
LinkPlugin.configure({
|
|
62
|
+
options: {
|
|
63
|
+
allowedSchemes: ["http", "https", "mailto", "tel"],
|
|
64
|
+
},
|
|
65
|
+
}),
|
|
66
|
+
]
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** Loads media plugins (image, video, embed) */
|
|
70
|
+
export async function loadMediaPlugins(): Promise<PlatePlugin[]> {
|
|
71
|
+
const { ImagePlugin, MediaEmbedPlugin } = await import("@platejs/media/react")
|
|
72
|
+
return [ImagePlugin, MediaEmbedPlugin]
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** Loads mention plugins */
|
|
76
|
+
export async function loadMentionPlugins(): Promise<PlatePlugin[]> {
|
|
77
|
+
const { MentionPlugin, MentionInputPlugin } = await import("@platejs/mention/react")
|
|
78
|
+
return [
|
|
79
|
+
MentionPlugin.configure({
|
|
80
|
+
options: {
|
|
81
|
+
trigger: "@",
|
|
82
|
+
triggerPreviousCharPattern: /^$|^[\s"']$/,
|
|
83
|
+
insertSpaceAfterMention: true,
|
|
84
|
+
},
|
|
85
|
+
}),
|
|
86
|
+
MentionInputPlugin,
|
|
87
|
+
]
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/** Loads DnD (drag and drop) plugin */
|
|
91
|
+
export async function loadDndPlugin(): Promise<PlatePlugin[]> {
|
|
92
|
+
const { DndPlugin } = await import("@platejs/dnd/react")
|
|
93
|
+
return [DndPlugin]
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/** Loads TOC (table of contents) plugin */
|
|
97
|
+
export async function loadTocPlugin(): Promise<PlatePlugin[]> {
|
|
98
|
+
const { TocPlugin } = await import("@platejs/toc/react")
|
|
99
|
+
return [TocPlugin]
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/** Loads indent plugin */
|
|
103
|
+
export async function loadIndentPlugin(): Promise<PlatePlugin[]> {
|
|
104
|
+
const { IndentPlugin } = await import("@platejs/indent/react")
|
|
105
|
+
return [IndentPlugin]
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/** Loads markdown serialization plugin */
|
|
109
|
+
export async function loadMarkdownPlugin(): Promise<PlatePlugin[]> {
|
|
110
|
+
const { MarkdownPlugin } = await import("@platejs/markdown")
|
|
111
|
+
return [MarkdownPlugin]
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/** Loads selection plugin */
|
|
115
|
+
export async function loadSelectionPlugin(): Promise<PlatePlugin[]> {
|
|
116
|
+
const { BlockSelectionPlugin } = await import("@platejs/selection/react")
|
|
117
|
+
return [BlockSelectionPlugin]
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/** Loads AI plugins (AI menu + AI chat) */
|
|
121
|
+
export async function loadAIPlugins(options?: {
|
|
122
|
+
endpoint?: string
|
|
123
|
+
systemPrompt?: string
|
|
124
|
+
headers?: Record<string, string>
|
|
125
|
+
}): Promise<PlatePlugin[]> {
|
|
126
|
+
const { AIPlugin, AIChatPlugin } = await import("@platejs/ai/react")
|
|
127
|
+
const plugins: PlatePlugin[] = [AIPlugin]
|
|
128
|
+
|
|
129
|
+
if (options?.endpoint) {
|
|
130
|
+
plugins.push(
|
|
131
|
+
AIChatPlugin.configure({
|
|
132
|
+
options: {
|
|
133
|
+
chat: {
|
|
134
|
+
api: options.endpoint,
|
|
135
|
+
body: { system: options.systemPrompt ?? "You are a helpful writing assistant." },
|
|
136
|
+
headers: options.headers,
|
|
137
|
+
},
|
|
138
|
+
},
|
|
139
|
+
}) as PlatePlugin,
|
|
140
|
+
)
|
|
141
|
+
} else {
|
|
142
|
+
plugins.push(AIChatPlugin as PlatePlugin)
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
return plugins
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/** Loads emoji plugin */
|
|
149
|
+
export async function loadEmojiPlugin(): Promise<PlatePlugin[]> {
|
|
150
|
+
const { EmojiPlugin } = await import("@platejs/emoji/react")
|
|
151
|
+
return [EmojiPlugin as PlatePlugin]
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/** Loads floating toolbar plugin */
|
|
155
|
+
export async function loadFloatingPlugin(): Promise<PlatePlugin[]> {
|
|
156
|
+
// @platejs/floating provides hooks, not a plugin.
|
|
157
|
+
// Return empty; the WakaFloatingToolbar component uses the hook directly.
|
|
158
|
+
return []
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/** Loads diff plugin for document comparison */
|
|
162
|
+
export async function loadDiffPlugin(): Promise<PlatePlugin[]> {
|
|
163
|
+
// @platejs/diff provides utility functions (computeDiff), not editor plugins.
|
|
164
|
+
// Return empty; the WakaDiffViewer component uses the functions directly.
|
|
165
|
+
return []
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/** Loads combobox/slash-command plugins */
|
|
169
|
+
export async function loadComboboxPlugins(): Promise<PlatePlugin[]> {
|
|
170
|
+
const { SlashPlugin, SlashInputPlugin } = await import("@platejs/combobox/react")
|
|
171
|
+
return [
|
|
172
|
+
SlashPlugin.configure({
|
|
173
|
+
options: {
|
|
174
|
+
trigger: "/",
|
|
175
|
+
triggerPreviousCharPattern: /^$|^[\s"']$/,
|
|
176
|
+
},
|
|
177
|
+
}) as PlatePlugin,
|
|
178
|
+
SlashInputPlugin as PlatePlugin,
|
|
179
|
+
]
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
// ─── Plugin presets ───────────────────────────────────────────────────────────
|
|
183
|
+
|
|
184
|
+
export type WakaEditorPreset = "minimal" | "standard" | "full"
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Returns the list of optional plugin loaders based on a named preset.
|
|
188
|
+
*/
|
|
189
|
+
export function getPresetLoaders(preset: WakaEditorPreset) {
|
|
190
|
+
switch (preset) {
|
|
191
|
+
case "minimal":
|
|
192
|
+
return []
|
|
193
|
+
case "standard":
|
|
194
|
+
return [loadLinkPlugin, loadIndentPlugin]
|
|
195
|
+
case "full":
|
|
196
|
+
return [
|
|
197
|
+
loadLinkPlugin,
|
|
198
|
+
loadMediaPlugins,
|
|
199
|
+
loadMentionPlugins,
|
|
200
|
+
loadDndPlugin,
|
|
201
|
+
loadTocPlugin,
|
|
202
|
+
loadIndentPlugin,
|
|
203
|
+
loadMarkdownPlugin,
|
|
204
|
+
loadSelectionPlugin,
|
|
205
|
+
]
|
|
206
|
+
}
|
|
207
|
+
}
|