@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.
Files changed (140) hide show
  1. package/dist/badge-BbwO7QeZ.js +1 -0
  2. package/dist/badge-BfiocODp.mjs +23 -0
  3. package/dist/charts.cjs.js +1 -1
  4. package/dist/charts.es.js +1 -1
  5. package/dist/chunk-14q5BKub.js +1 -0
  6. package/dist/{chunk-BH6uBOac.mjs → chunk-Cr9pTUWm.mjs} +5 -5
  7. package/dist/cn-DEtaFQsA.js +1 -0
  8. package/dist/cn-DUn6aSIQ.mjs +24 -0
  9. package/dist/doc.cjs.js +2 -2
  10. package/dist/doc.es.js +19 -19
  11. package/dist/editor.cjs.js +48 -0
  12. package/dist/editor.d.ts +1 -0
  13. package/dist/editor.es.js +6551 -0
  14. package/dist/{exceljs.min-DG9M8IZ1.mjs → exceljs.min-DL1XYDll.mjs} +1 -1
  15. package/dist/{exceljs.min-BuefmDRS.js → exceljs.min-qeIfSCbF.js} +1 -1
  16. package/dist/export.cjs.js +1 -1
  17. package/dist/export.es.js +1 -1
  18. package/dist/index.cjs.js +150 -150
  19. package/dist/index.es.js +26782 -27591
  20. package/dist/input-BfaSAGVw.js +1 -0
  21. package/dist/input-DVr_Qkl8.mjs +14 -0
  22. package/dist/rich-text.cjs.js +1 -1
  23. package/dist/rich-text.es.js +1 -1
  24. package/dist/security-CyBpuklN.mjs +122 -0
  25. package/dist/security-bFWwDrlg.js +1 -0
  26. package/dist/separator-NrkltulH.js +1 -0
  27. package/dist/separator-ibN2mycs.mjs +51 -0
  28. package/dist/src/components/editor/blocks/index.d.ts +51 -0
  29. package/dist/src/components/editor/blocks/waka-acceptance-criteria-block.d.ts +60 -0
  30. package/dist/src/components/editor/blocks/waka-ai-assist-block.d.ts +58 -0
  31. package/dist/src/components/editor/blocks/waka-api-endpoint-block.d.ts +63 -0
  32. package/dist/src/components/editor/blocks/waka-code-playground-block.d.ts +61 -0
  33. package/dist/src/components/editor/blocks/waka-comment-thread-block.d.ts +85 -0
  34. package/dist/src/components/editor/blocks/waka-diagram-block.d.ts +52 -0
  35. package/dist/src/components/editor/blocks/waka-embed-block.d.ts +58 -0
  36. package/dist/src/components/editor/blocks/waka-slash-menu-block.d.ts +67 -0
  37. package/dist/src/components/editor/blocks/waka-user-story-block.d.ts +79 -0
  38. package/dist/src/components/editor/blocks/waka-version-diff-block.d.ts +73 -0
  39. package/dist/src/components/editor/index.d.ts +66 -0
  40. package/dist/src/components/editor/waka-ai-writer.d.ts +80 -0
  41. package/dist/src/components/editor/waka-collaborative-editor.d.ts +93 -0
  42. package/dist/src/components/editor/waka-diff-viewer.d.ts +71 -0
  43. package/dist/src/components/editor/waka-dnd-editor.d.ts +64 -0
  44. package/dist/src/components/editor/waka-document-editor.d.ts +92 -0
  45. package/dist/src/components/editor/waka-editor-elements.d.ts +79 -0
  46. package/dist/src/components/editor/waka-editor-leaves.d.ts +39 -0
  47. package/dist/src/components/editor/waka-editor-plugins.d.ts +41 -0
  48. package/dist/src/components/editor/waka-editor-toolbar.d.ts +20 -0
  49. package/dist/src/components/editor/waka-editor.d.ts +59 -0
  50. package/dist/src/components/editor/waka-floating-toolbar.d.ts +47 -0
  51. package/dist/src/components/editor/waka-markdown-editor.d.ts +60 -0
  52. package/dist/src/components/editor/waka-mention-editor.d.ts +125 -0
  53. package/dist/src/components/editor/waka-slash-menu.d.ts +70 -0
  54. package/dist/src/components/editor/waka-spec-editor.d.ts +88 -0
  55. package/dist/src/components/index.d.ts +1 -15
  56. package/dist/src/editor.d.ts +26 -0
  57. package/dist/textarea-CdQWggYG.js +1 -0
  58. package/dist/textarea-DJDXJ3nd.mjs +23 -0
  59. package/dist/types-C2St0wOW.js +1 -0
  60. package/dist/{types-B6GVaSIP.mjs → types-JnqoLyuv.mjs} +214 -211
  61. package/dist/{useDataTableImport-BPvfo--2.mjs → useDataTableImport-BWUFesPi.mjs} +3 -3
  62. package/dist/{useDataTableImport-Cm_pCKnO.js → useDataTableImport-T7ddpN5k.js} +3 -3
  63. package/dist/waka-doc-renderer-CTxC7Trf.js +3 -0
  64. package/dist/{waka-doc-renderer-BkIvas3z.mjs → waka-doc-renderer-Cw-Xnyen.mjs} +264 -281
  65. package/dist/waka-editor-plugins-DR6tpsUC.mjs +135 -0
  66. package/dist/waka-editor-plugins-sGSh9hn2.js +1 -0
  67. package/dist/waka-rich-text-editor-BlIdtknG.js +1 -0
  68. package/dist/waka-rich-text-editor-D1uA3zbB.js +1 -0
  69. package/dist/waka-rich-text-editor-DgSWiXMW.mjs +342 -0
  70. package/dist/waka-rich-text-editor-DndVJuDw.mjs +2 -0
  71. package/package.json +87 -2
  72. package/src/blocks/footer/index.tsx +1 -6
  73. package/src/blocks/login/index.tsx +1 -7
  74. package/src/blocks/profile/index.tsx +3 -5
  75. package/src/components/editor/blocks/index.ts +182 -0
  76. package/src/components/editor/blocks/waka-acceptance-criteria-block.tsx +326 -0
  77. package/src/components/editor/blocks/waka-ai-assist-block.tsx +284 -0
  78. package/src/components/editor/blocks/waka-api-endpoint-block.tsx +382 -0
  79. package/src/components/editor/blocks/waka-code-playground-block.tsx +331 -0
  80. package/src/components/editor/blocks/waka-comment-thread-block.tsx +448 -0
  81. package/src/components/editor/blocks/waka-diagram-block.tsx +293 -0
  82. package/src/components/editor/blocks/waka-embed-block.tsx +416 -0
  83. package/src/components/editor/blocks/waka-slash-menu-block.tsx +432 -0
  84. package/src/components/editor/blocks/waka-user-story-block.tsx +295 -0
  85. package/src/components/editor/blocks/waka-version-diff-block.tsx +426 -0
  86. package/src/components/editor/index.ts +279 -0
  87. package/src/components/editor/waka-ai-writer.tsx +434 -0
  88. package/src/components/editor/waka-collaborative-editor.tsx +426 -0
  89. package/src/components/editor/waka-diff-viewer.tsx +352 -0
  90. package/src/components/editor/waka-dnd-editor.tsx +284 -0
  91. package/src/components/editor/waka-document-editor.tsx +502 -0
  92. package/src/components/editor/waka-editor-elements.tsx +312 -0
  93. package/src/components/editor/waka-editor-leaves.tsx +101 -0
  94. package/src/components/editor/waka-editor-plugins.ts +207 -0
  95. package/src/components/editor/waka-editor-toolbar.tsx +358 -0
  96. package/src/components/editor/waka-editor.tsx +431 -0
  97. package/src/components/editor/waka-floating-toolbar.tsx +268 -0
  98. package/src/components/editor/waka-markdown-editor.tsx +395 -0
  99. package/src/components/editor/waka-mention-editor.tsx +459 -0
  100. package/src/components/editor/waka-slash-menu.tsx +392 -0
  101. package/src/components/editor/waka-spec-editor.tsx +657 -0
  102. package/src/components/index.ts +1 -18
  103. package/dist/chunk-BDDJmn7V.js +0 -1
  104. package/dist/cn-DnPbmOCy.js +0 -1
  105. package/dist/cn-DpLcAzrf.mjs +0 -22
  106. package/dist/separator-BDReXBvI.mjs +0 -59
  107. package/dist/separator-BKjNl9sI.js +0 -1
  108. package/dist/src/components/waka-actor-badge/index.d.ts +0 -8
  109. package/dist/src/components/waka-actors-list/index.d.ts +0 -18
  110. package/dist/src/components/waka-ai-assistant-button/index.d.ts +0 -8
  111. package/dist/src/components/waka-document-flyover/index.d.ts +0 -10
  112. package/dist/src/components/waka-document-preview-popup/index.d.ts +0 -26
  113. package/dist/src/components/waka-hour-balance-badge/index.d.ts +0 -8
  114. package/dist/src/components/waka-hour-consumption-table/index.d.ts +0 -15
  115. package/dist/src/components/waka-hour-pack-dialog/index.d.ts +0 -8
  116. package/dist/src/components/waka-project-stats-header/index.d.ts +0 -15
  117. package/dist/src/components/waka-step-comment-bubble/index.d.ts +0 -13
  118. package/dist/src/components/waka-step-comment-panel/index.d.ts +0 -20
  119. package/dist/src/components/waka-step-permission-matrix/index.d.ts +0 -12
  120. package/dist/src/components/waka-time-entry-dialog/index.d.ts +0 -16
  121. package/dist/src/components/waka-time-tracking-flyover/index.d.ts +0 -11
  122. package/dist/types-BH9cQRqZ.js +0 -1
  123. package/dist/waka-doc-renderer-BZ2-SqyT.js +0 -3
  124. package/dist/waka-rich-text-editor-BJGlQgpq.js +0 -1
  125. package/dist/waka-rich-text-editor-BJzzxeP1.mjs +0 -361
  126. package/dist/waka-rich-text-editor-wnXLwvUo.js +0 -1
  127. package/src/components/waka-actor-badge/index.tsx +0 -34
  128. package/src/components/waka-actors-list/index.tsx +0 -125
  129. package/src/components/waka-ai-assistant-button/index.tsx +0 -31
  130. package/src/components/waka-document-flyover/index.tsx +0 -36
  131. package/src/components/waka-document-preview-popup/index.tsx +0 -103
  132. package/src/components/waka-hour-balance-badge/index.tsx +0 -43
  133. package/src/components/waka-hour-consumption-table/index.tsx +0 -72
  134. package/src/components/waka-hour-pack-dialog/index.tsx +0 -72
  135. package/src/components/waka-project-stats-header/index.tsx +0 -69
  136. package/src/components/waka-step-comment-bubble/index.tsx +0 -71
  137. package/src/components/waka-step-comment-panel/index.tsx +0 -106
  138. package/src/components/waka-step-permission-matrix/index.tsx +0 -65
  139. package/src/components/waka-time-entry-dialog/index.tsx +0 -131
  140. package/src/components/waka-time-tracking-flyover/index.tsx +0 -41
@@ -0,0 +1,295 @@
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import { cn } from "../../../utils/cn"
5
+ import type { PlateElementProps } from "../waka-editor-elements"
6
+
7
+ // ============================================================================
8
+ // Types
9
+ // ============================================================================
10
+
11
+ /** Slate node type for user story blocks */
12
+ export const USER_STORY_BLOCK_TYPE = "user_story" as const
13
+
14
+ /** Shape of a user story element in the Slate document */
15
+ export interface UserStoryElement {
16
+ type: typeof USER_STORY_BLOCK_TYPE
17
+ /** The role ("As a ...") */
18
+ role: string
19
+ /** The action ("I want ...") */
20
+ action: string
21
+ /** The benefit ("So that ...") */
22
+ benefit: string
23
+ /** Optional story ID (e.g. "US-042") */
24
+ storyId?: string
25
+ /** Optional priority */
26
+ priority?: "must" | "should" | "could" | "wont"
27
+ /** Optional story points estimate */
28
+ points?: number
29
+ children: Array<{ text: string }>
30
+ }
31
+
32
+ /** Props for the WakaUserStoryBlock element renderer */
33
+ export interface WakaUserStoryBlockProps extends PlateElementProps {
34
+ element?: UserStoryElement & Record<string, unknown>
35
+ /** Called when a field value changes */
36
+ onFieldChange?: (field: "role" | "action" | "benefit", value: string) => void
37
+ }
38
+
39
+ // ============================================================================
40
+ // Priority config
41
+ // ============================================================================
42
+
43
+ const PRIORITY_CONFIG: Record<string, { label: string; color: string; bg: string }> = {
44
+ must: { label: "Must Have", color: "text-red-700 dark:text-red-400", bg: "bg-red-50 dark:bg-red-500/10" },
45
+ should: { label: "Should Have", color: "text-amber-700 dark:text-amber-400", bg: "bg-amber-50 dark:bg-amber-500/10" },
46
+ could: { label: "Could Have", color: "text-blue-700 dark:text-blue-400", bg: "bg-blue-50 dark:bg-blue-500/10" },
47
+ wont: { label: "Won't Have", color: "text-gray-500 dark:text-gray-400", bg: "bg-gray-50 dark:bg-gray-500/10" },
48
+ }
49
+
50
+ // ============================================================================
51
+ // Field Row Component
52
+ // ============================================================================
53
+
54
+ interface FieldRowProps {
55
+ label: string
56
+ icon: React.ReactNode
57
+ value: string
58
+ placeholder: string
59
+ readOnly?: boolean
60
+ onChange?: (value: string) => void
61
+ }
62
+
63
+ function FieldRow({ label, icon, value, placeholder, readOnly, onChange }: FieldRowProps) {
64
+ return (
65
+ <div className="flex items-start gap-3 group">
66
+ <div className="flex items-center gap-1.5 pt-1 shrink-0 w-[90px]">
67
+ <span className="text-blue-500 dark:text-blue-400">{icon}</span>
68
+ <span className="text-[11px] font-semibold uppercase tracking-wider text-blue-600 dark:text-blue-400">
69
+ {label}
70
+ </span>
71
+ </div>
72
+ <div className="flex-1 min-w-0">
73
+ {readOnly ? (
74
+ <p className="text-sm text-foreground py-1">
75
+ {value || <span className="text-muted-foreground italic">{placeholder}</span>}
76
+ </p>
77
+ ) : (
78
+ <input
79
+ type="text"
80
+ value={value}
81
+ onChange={(e) => onChange?.(e.target.value)}
82
+ placeholder={placeholder}
83
+ className={cn(
84
+ "w-full bg-transparent text-sm text-foreground py-1 px-0",
85
+ "border-0 border-b border-transparent",
86
+ "focus:border-blue-300 dark:focus:border-blue-600",
87
+ "focus:outline-none transition-colors",
88
+ "placeholder:text-muted-foreground/50 placeholder:italic"
89
+ )}
90
+ />
91
+ )}
92
+ </div>
93
+ </div>
94
+ )
95
+ }
96
+
97
+ // ============================================================================
98
+ // Element Component
99
+ // ============================================================================
100
+
101
+ /**
102
+ * WakaUserStoryBlock - A Plate.js block element for writing User Stories
103
+ * in the structured format "As a [role], I want [action], so that [benefit]".
104
+ *
105
+ * Each field is editable inline within the block. Renders with a distinctive
106
+ * visual treatment: blue left border, user icon, and structured layout.
107
+ *
108
+ * Register as a custom element in your Plate editor:
109
+ * ```ts
110
+ * const editor = usePlateEditor({
111
+ * plugins: [...],
112
+ * components: {
113
+ * [USER_STORY_BLOCK_TYPE]: WakaUserStoryBlock,
114
+ * },
115
+ * })
116
+ * ```
117
+ *
118
+ * Insert via slash command or programmatically:
119
+ * ```ts
120
+ * editor.insertNodes(createUserStoryNodes())
121
+ * ```
122
+ */
123
+ export function WakaUserStoryBlock({
124
+ attributes,
125
+ children,
126
+ element,
127
+ className,
128
+ }: WakaUserStoryBlockProps) {
129
+ const storyElement = element as UserStoryElement | undefined
130
+ const priority = storyElement?.priority
131
+ const storyId = storyElement?.storyId
132
+ const points = storyElement?.points
133
+
134
+ return (
135
+ <div
136
+ {...attributes}
137
+ contentEditable={false}
138
+ className={cn(
139
+ "relative my-4 rounded-lg overflow-hidden",
140
+ "border-l-4 border-blue-500 dark:border-blue-400",
141
+ "bg-blue-50/50 dark:bg-blue-950/20",
142
+ "border border-blue-200/60 dark:border-blue-800/40",
143
+ "shadow-sm hover:shadow-md transition-shadow duration-200",
144
+ className
145
+ )}
146
+ >
147
+ {/* Header bar */}
148
+ <div className="flex items-center justify-between px-4 py-2 bg-blue-100/50 dark:bg-blue-900/20 border-b border-blue-200/40 dark:border-blue-800/30">
149
+ <div className="flex items-center gap-2">
150
+ {/* User icon */}
151
+ <svg
152
+ className="h-4 w-4 text-blue-600 dark:text-blue-400"
153
+ viewBox="0 0 24 24"
154
+ fill="none"
155
+ stroke="currentColor"
156
+ strokeWidth={2}
157
+ aria-hidden="true"
158
+ >
159
+ <path strokeLinecap="round" strokeLinejoin="round" d="M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z" />
160
+ </svg>
161
+ <span className="text-xs font-bold uppercase tracking-wider text-blue-700 dark:text-blue-300">
162
+ User Story
163
+ </span>
164
+ {storyId && (
165
+ <span className="text-[10px] font-mono font-semibold text-blue-500 dark:text-blue-400 bg-blue-100 dark:bg-blue-800/40 px-1.5 py-0.5 rounded">
166
+ {storyId}
167
+ </span>
168
+ )}
169
+ </div>
170
+
171
+ <div className="flex items-center gap-2">
172
+ {/* Story points */}
173
+ {points !== undefined && (
174
+ <span className="inline-flex items-center justify-center h-5 min-w-[20px] px-1 rounded-full bg-blue-200 dark:bg-blue-700/50 text-[10px] font-bold text-blue-800 dark:text-blue-200">
175
+ {points}
176
+ </span>
177
+ )}
178
+
179
+ {/* Priority badge */}
180
+ {priority && PRIORITY_CONFIG[priority] && (
181
+ <span className={cn(
182
+ "text-[10px] font-semibold px-2 py-0.5 rounded-full",
183
+ PRIORITY_CONFIG[priority].bg,
184
+ PRIORITY_CONFIG[priority].color
185
+ )}>
186
+ {PRIORITY_CONFIG[priority].label}
187
+ </span>
188
+ )}
189
+ </div>
190
+ </div>
191
+
192
+ {/* Fields */}
193
+ <div className="px-4 py-3 space-y-2">
194
+ <FieldRow
195
+ label="As a"
196
+ icon={
197
+ <svg className="h-3 w-3" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={2}>
198
+ <path strokeLinecap="round" strokeLinejoin="round" d="M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z" />
199
+ </svg>
200
+ }
201
+ value={storyElement?.role || ""}
202
+ placeholder="role (e.g. platform administrator)"
203
+ readOnly
204
+ />
205
+ <FieldRow
206
+ label="I want"
207
+ icon={
208
+ <svg className="h-3 w-3" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={2}>
209
+ <path strokeLinecap="round" strokeLinejoin="round" d="M13 10V3L4 14h7v7l9-11h-7z" />
210
+ </svg>
211
+ }
212
+ value={storyElement?.action || ""}
213
+ placeholder="action (e.g. to deploy services with one click)"
214
+ readOnly
215
+ />
216
+ <FieldRow
217
+ label="So that"
218
+ icon={
219
+ <svg className="h-3 w-3" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={2}>
220
+ <path strokeLinecap="round" strokeLinejoin="round" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" />
221
+ </svg>
222
+ }
223
+ value={storyElement?.benefit || ""}
224
+ placeholder="benefit (e.g. I can reduce time-to-market)"
225
+ readOnly
226
+ />
227
+ </div>
228
+
229
+ {/* Editable Slate children (hidden, required by Plate) */}
230
+ <div className="hidden">{children}</div>
231
+ </div>
232
+ )
233
+ }
234
+
235
+ WakaUserStoryBlock.displayName = "WakaUserStoryBlock"
236
+
237
+ // ============================================================================
238
+ // Node Factory
239
+ // ============================================================================
240
+
241
+ /**
242
+ * Creates the Slate nodes for inserting a user story block.
243
+ *
244
+ * @param options - Optional pre-fill values
245
+ * @returns Array of Slate nodes to insert
246
+ */
247
+ export function createUserStoryNodes(options?: {
248
+ role?: string
249
+ action?: string
250
+ benefit?: string
251
+ storyId?: string
252
+ priority?: "must" | "should" | "could" | "wont"
253
+ points?: number
254
+ }): UserStoryElement[] {
255
+ return [
256
+ {
257
+ type: USER_STORY_BLOCK_TYPE,
258
+ role: options?.role || "",
259
+ action: options?.action || "",
260
+ benefit: options?.benefit || "",
261
+ storyId: options?.storyId,
262
+ priority: options?.priority,
263
+ points: options?.points,
264
+ children: [{ text: "" }],
265
+ },
266
+ ]
267
+ }
268
+
269
+ /**
270
+ * Creates a Plate plugin configuration for user story blocks.
271
+ * Use with dynamic import for tree-shaking.
272
+ *
273
+ * @example
274
+ * ```ts
275
+ * const userStoryPlugin = await createUserStoryPlugin()
276
+ * // Add to editor plugins
277
+ * ```
278
+ */
279
+ export async function createUserStoryPlugin() {
280
+ try {
281
+ const { createPlatePlugin } = await import("platejs/react")
282
+ return createPlatePlugin({
283
+ key: USER_STORY_BLOCK_TYPE,
284
+ node: {
285
+ isElement: true,
286
+ isVoid: true,
287
+ type: USER_STORY_BLOCK_TYPE,
288
+ component: WakaUserStoryBlock,
289
+ },
290
+ })
291
+ } catch {
292
+ console.warn("[WakaUserStoryBlock] platejs not installed")
293
+ return null
294
+ }
295
+ }