@multicomma/arkcn 0.1.2 → 0.1.3
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 +1 -1
- package/registry/index.json +1 -1
- package/registry/items/accordion.json +302 -0
- package/registry/items/activity-feed.json +408 -0
- package/registry/items/alert-dialog.json +676 -0
- package/registry/items/alert.json +113 -0
- package/registry/items/angle-slider.json +378 -0
- package/registry/items/app-shell.json +2654 -1
- package/registry/items/aspect-ratio.json +36 -0
- package/registry/items/attachment.json +299 -1
- package/registry/items/avatar.json +213 -0
- package/registry/items/badge.json +44 -0
- package/registry/items/breadcrumb.json +191 -0
- package/registry/items/bubble.json +146 -0
- package/registry/items/button-group.json +110 -0
- package/registry/items/button.json +52 -0
- package/registry/items/calendar.json +499 -1
- package/registry/items/canvas.json +446 -1
- package/registry/items/card.json +192 -0
- package/registry/items/carousel.json +208 -1
- package/registry/items/cascader.json +797 -1
- package/registry/items/chart.json +1764 -1
- package/registry/items/chat.json +993 -0
- package/registry/items/checkbox.json +503 -0
- package/registry/items/clipboard.json +308 -0
- package/registry/items/collapsible.json +226 -0
- package/registry/items/color-picker.json +1261 -0
- package/registry/items/combobox.json +1123 -1
- package/registry/items/command.json +837 -1
- package/registry/items/comment-thread.json +952 -1
- package/registry/items/context-menu.json +1344 -1
- package/registry/items/data-grid.json +449 -1
- package/registry/items/data-table.json +1310 -1
- package/registry/items/date-input.json +476 -0
- package/registry/items/dialog.json +592 -0
- package/registry/items/direction.json +29 -1
- package/registry/items/drawer.json +797 -0
- package/registry/items/dropdown-menu.json +1311 -1
- package/registry/items/editable.json +503 -0
- package/registry/items/empty.json +166 -0
- package/registry/items/field.json +286 -1
- package/registry/items/file-upload.json +638 -0
- package/registry/items/floating-panel.json +720 -0
- package/registry/items/floating-toolbar.json +43 -0
- package/registry/items/format.json +109 -0
- package/registry/items/gantt.json +773 -1
- package/registry/items/hooks/use-mobile.json +1 -0
- package/registry/items/hotkeys.json +99 -1
- package/registry/items/hover-card.json +357 -0
- package/registry/items/image-cropper.json +431 -0
- package/registry/items/input-group.json +189 -0
- package/registry/items/input-otp.json +181 -0
- package/registry/items/input.json +28 -0
- package/registry/items/item.json +308 -0
- package/registry/items/json-tree-view.json +336 -0
- package/registry/items/kanban.json +624 -1
- package/registry/items/kbd.json +54 -0
- package/registry/items/label.json +28 -0
- package/registry/items/lib/controllable.json +1 -0
- package/registry/items/lib/data-table-adapter.json +1 -0
- package/registry/items/lib/drag-preview.json +1 -0
- package/registry/items/lib/form.json +1 -0
- package/registry/items/lib/history.json +1 -0
- package/registry/items/lib/row-layout.json +1 -0
- package/registry/items/lib/table.json +1 -0
- package/registry/items/lib/time.json +1 -0
- package/registry/items/lib/utils.json +1 -0
- package/registry/items/live-region.json +43 -0
- package/registry/items/marker.json +96 -0
- package/registry/items/marquee.json +300 -0
- package/registry/items/menubar.json +1282 -1
- package/registry/items/message.json +166 -0
- package/registry/items/navigation-menu.json +561 -1
- package/registry/items/node-graph.json +1037 -1
- package/registry/items/number-input.json +519 -0
- package/registry/items/pagination.json +244 -1
- package/registry/items/password-input.json +311 -0
- package/registry/items/popconfirm.json +566 -0
- package/registry/items/popover.json +615 -0
- package/registry/items/progress.json +516 -0
- package/registry/items/qr-code.json +249 -0
- package/registry/items/query-builder.json +1368 -1
- package/registry/items/radio-group.json +362 -0
- package/registry/items/rating-group.json +304 -0
- package/registry/items/resizable.json +242 -1
- package/registry/items/rich-text-editor.json +934 -1
- package/registry/items/scheduler.json +1013 -1
- package/registry/items/scroll-area.json +227 -0
- package/registry/items/segment-group.json +363 -0
- package/registry/items/select.json +956 -0
- package/registry/items/separator.json +45 -1
- package/registry/items/sheet.json +592 -0
- package/registry/items/sidebar.json +785 -1
- package/registry/items/signature-pad.json +330 -0
- package/registry/items/skeleton.json +28 -0
- package/registry/items/slider.json +799 -0
- package/registry/items/sonner.json +135 -0
- package/registry/items/spinner.json +28 -0
- package/registry/items/steps.json +483 -0
- package/registry/items/swap.json +107 -0
- package/registry/items/switch.json +362 -0
- package/registry/items/table.json +210 -0
- package/registry/items/tabs.json +326 -0
- package/registry/items/tags-input.json +640 -0
- package/registry/items/textarea.json +28 -0
- package/registry/items/timer.json +289 -0
- package/registry/items/toc.json +372 -0
- package/registry/items/toggle-group.json +214 -1
- package/registry/items/toggle.json +124 -0
- package/registry/items/tooltip.json +417 -0
- package/registry/items/tour.json +498 -0
- package/registry/items/transfer-list.json +609 -1
- package/registry/items/tree-select.json +742 -1
- package/registry/items/tree-view.json +794 -0
- package/registry/items/virtual-list.json +214 -1
- package/src/components/ui/app-shell.tsx +11 -0
- package/src/components/ui/attachment.tsx +1 -0
- package/src/components/ui/calendar.tsx +1 -0
- package/src/components/ui/canvas.tsx +8 -0
- package/src/components/ui/carousel.tsx +3 -0
- package/src/components/ui/cascader.tsx +1 -0
- package/src/components/ui/chart.tsx +10 -0
- package/src/components/ui/combobox.tsx +3 -0
- package/src/components/ui/command.tsx +1 -0
- package/src/components/ui/comment-thread.tsx +11 -0
- package/src/components/ui/context-menu.tsx +6 -0
- package/src/components/ui/data-grid.tsx +8 -0
- package/src/components/ui/data-table.tsx +6 -0
- package/src/components/ui/direction.tsx +2 -0
- package/src/components/ui/dropdown-menu.tsx +6 -0
- package/src/components/ui/field.tsx +1 -0
- package/src/components/ui/gantt.tsx +15 -0
- package/src/components/ui/hotkeys.tsx +3 -0
- package/src/components/ui/kanban.tsx +3 -0
- package/src/components/ui/menubar.tsx +6 -0
- package/src/components/ui/navigation-menu.tsx +1 -0
- package/src/components/ui/node-graph.tsx +23 -0
- package/src/components/ui/pagination.tsx +1 -0
- package/src/components/ui/query-builder.tsx +7 -0
- package/src/components/ui/resizable.tsx +1 -0
- package/src/components/ui/rich-text-editor.tsx +54 -0
- package/src/components/ui/scheduler.tsx +26 -0
- package/src/components/ui/separator.tsx +1 -0
- package/src/components/ui/sidebar.tsx +5 -0
- package/src/components/ui/toggle-group.tsx +3 -0
- package/src/components/ui/transfer-list.tsx +11 -0
- package/src/components/ui/tree-select.tsx +5 -0
- package/src/components/ui/virtual-list.tsx +7 -0
|
@@ -221,9 +221,11 @@ function DataTableFacetedFilter<TData, TValue>({
|
|
|
221
221
|
options,
|
|
222
222
|
}: {
|
|
223
223
|
table?: DataTableInstance<TData>
|
|
224
|
+
/** Id of the column this filter applies to. */
|
|
224
225
|
columnId?: string
|
|
225
226
|
column?: DataTableColumn<TData, TValue>
|
|
226
227
|
title?: string
|
|
228
|
+
/** Facet options as `{ value, label, icon? }`. */
|
|
227
229
|
options: FacetOption[]
|
|
228
230
|
}) {
|
|
229
231
|
const table = useDataTableContext(tableProp)
|
|
@@ -581,6 +583,7 @@ function DataTableBody<TData>({
|
|
|
581
583
|
...props
|
|
582
584
|
}: Omit<React.ComponentProps<typeof TableBody>, "children"> & {
|
|
583
585
|
table?: DataTableInstance<TData>
|
|
586
|
+
/** Content shown when there are no rows. */
|
|
584
587
|
empty?: React.ReactNode
|
|
585
588
|
children: (row: DataTableRowInstance<TData>) => React.ReactNode
|
|
586
589
|
}) {
|
|
@@ -676,6 +679,7 @@ function DataTablePageSize<TData>({
|
|
|
676
679
|
children,
|
|
677
680
|
}: {
|
|
678
681
|
table?: DataTableInstance<TData>
|
|
682
|
+
/** Choices offered in the page size select. */
|
|
679
683
|
pageSizes?: number[]
|
|
680
684
|
className?: string
|
|
681
685
|
children?: React.ReactNode
|
|
@@ -823,6 +827,7 @@ function DataTableBulkActions<TData>({
|
|
|
823
827
|
...props
|
|
824
828
|
}: React.ComponentProps<"div"> & {
|
|
825
829
|
table?: DataTableInstance<TData>
|
|
830
|
+
/** Noun used in the selection announcement, e.g. `task`. */
|
|
826
831
|
entityName?: string
|
|
827
832
|
}) {
|
|
828
833
|
const table = useDataTableContext(tableProp)
|
|
@@ -892,6 +897,7 @@ function DataTableBulkActionsCount<TData>({
|
|
|
892
897
|
...props
|
|
893
898
|
}: React.ComponentProps<"div"> & {
|
|
894
899
|
table?: DataTableInstance<TData>
|
|
900
|
+
/** Noun used in the selection announcement, e.g. `task`. */
|
|
895
901
|
entityName?: string
|
|
896
902
|
}) {
|
|
897
903
|
const table = useDataTableContext(tableProp)
|
|
@@ -93,6 +93,7 @@ function DropdownMenuItem({
|
|
|
93
93
|
...props
|
|
94
94
|
}: Omit<React.ComponentProps<typeof DropdownMenuPrimitive.Item>, "value"> & {
|
|
95
95
|
value?: string
|
|
96
|
+
/** Indent the item to align with items that have an indicator. */
|
|
96
97
|
inset?: boolean
|
|
97
98
|
variant?: "default" | "destructive"
|
|
98
99
|
}) {
|
|
@@ -137,8 +138,10 @@ function DropdownMenuCheckboxItem({
|
|
|
137
138
|
value,
|
|
138
139
|
...props
|
|
139
140
|
}: Omit<React.ComponentProps<typeof DropdownMenuPrimitive.CheckboxItem>, "checked" | "value"> & {
|
|
141
|
+
/** Checked state of the item. */
|
|
140
142
|
checked?: boolean
|
|
141
143
|
value?: string
|
|
144
|
+
/** Indent the item to align with items that have an indicator. */
|
|
142
145
|
inset?: boolean
|
|
143
146
|
}) {
|
|
144
147
|
const id = React.useId()
|
|
@@ -169,6 +172,7 @@ function DropdownMenuRadioItem({
|
|
|
169
172
|
inset,
|
|
170
173
|
...props
|
|
171
174
|
}: React.ComponentProps<typeof DropdownMenuPrimitive.RadioItem> & {
|
|
175
|
+
/** Indent the item to align with items that have an indicator. */
|
|
172
176
|
inset?: boolean
|
|
173
177
|
}) {
|
|
174
178
|
return (
|
|
@@ -191,6 +195,7 @@ function DropdownMenuLabel({
|
|
|
191
195
|
inset,
|
|
192
196
|
...props
|
|
193
197
|
}: React.ComponentProps<typeof DropdownMenuPrimitive.ItemGroupLabel> & {
|
|
198
|
+
/** Indent the item to align with items that have an indicator. */
|
|
194
199
|
inset?: boolean
|
|
195
200
|
}) {
|
|
196
201
|
return (
|
|
@@ -240,6 +245,7 @@ function DropdownMenuSubTrigger({
|
|
|
240
245
|
children,
|
|
241
246
|
...props
|
|
242
247
|
}: React.ComponentProps<typeof DropdownMenuPrimitive.TriggerItem> & {
|
|
248
|
+
/** Indent the item to align with items that have an indicator. */
|
|
243
249
|
inset?: boolean
|
|
244
250
|
}) {
|
|
245
251
|
return (
|
|
@@ -164,6 +164,7 @@ function FieldError({
|
|
|
164
164
|
errors,
|
|
165
165
|
...props
|
|
166
166
|
}: React.ComponentProps<"div"> & {
|
|
167
|
+
/** Error messages to render; a string, an array, or an object with a `message`. */
|
|
167
168
|
errors?: Array<{ message?: string } | undefined>
|
|
168
169
|
}) {
|
|
169
170
|
const content = useMemo(() => {
|
|
@@ -81,16 +81,22 @@ type BarStore = ReturnType<typeof createBarStore>
|
|
|
81
81
|
type Interaction = {
|
|
82
82
|
id: string
|
|
83
83
|
type: "move" | "resize-start" | "resize-end"
|
|
84
|
+
/** First date on the time scale. */
|
|
84
85
|
start: Date
|
|
86
|
+
/** Last date on the time scale. */
|
|
85
87
|
end: Date
|
|
86
88
|
}
|
|
87
89
|
|
|
88
90
|
type GanttContextValue = {
|
|
91
|
+
/** First date on the time scale. */
|
|
89
92
|
start: Date
|
|
93
|
+
/** Last date on the time scale. */
|
|
90
94
|
end: Date
|
|
91
95
|
days: number
|
|
92
96
|
dayWidth: number
|
|
97
|
+
/** Height of every row in px. */
|
|
93
98
|
rowHeight: number
|
|
99
|
+
/** Width of the sticky label column in px. */
|
|
94
100
|
sidebarWidth: number
|
|
95
101
|
scale: GanttScale
|
|
96
102
|
editable: boolean
|
|
@@ -148,19 +154,28 @@ function Gantt({
|
|
|
148
154
|
children,
|
|
149
155
|
...props
|
|
150
156
|
}: Omit<React.ComponentProps<"div">, "onChange"> & {
|
|
157
|
+
/** First date on the time scale. */
|
|
151
158
|
start: Date
|
|
159
|
+
/** Last date on the time scale. */
|
|
152
160
|
end: Date
|
|
153
161
|
/** Pixels per day; controllable. Zooming changes it. */
|
|
154
162
|
dayWidth?: number
|
|
163
|
+
/** Initial pixels per day when uncontrolled. */
|
|
155
164
|
defaultDayWidth?: number
|
|
165
|
+
/** Called when the zoom changes. */
|
|
156
166
|
onDayWidthChange?: (dayWidth: number) => void
|
|
167
|
+
/** Lower bound for zooming out. */
|
|
157
168
|
minDayWidth?: number
|
|
169
|
+
/** Upper bound for zooming in. */
|
|
158
170
|
maxDayWidth?: number
|
|
159
171
|
/** Header tiers. Defaults from `dayWidth`: month below 16px, week below 32px, else day. */
|
|
160
172
|
scale?: GanttScale
|
|
173
|
+
/** Height of every row in px. */
|
|
161
174
|
rowHeight?: number
|
|
175
|
+
/** Width of the sticky label column in px. */
|
|
162
176
|
sidebarWidth?: number
|
|
163
177
|
editable?: boolean
|
|
178
|
+
/** Called with `{ id, start, end }` snapped to whole days after a move, resize, or keyboard change. */
|
|
164
179
|
onBarChange?: (change: GanttBarChange) => void
|
|
165
180
|
}) {
|
|
166
181
|
const viewportRef = React.useRef<HTMLDivElement>(null)
|
|
@@ -108,6 +108,7 @@ function formatHotkey(hotkey: string, mac = isMac()): string[][] {
|
|
|
108
108
|
|
|
109
109
|
type HotkeyEntry = {
|
|
110
110
|
id: string
|
|
111
|
+
/** Key combination such as `mod+k`, or a sequence such as `g d`. */
|
|
111
112
|
hotkey: string
|
|
112
113
|
label: string
|
|
113
114
|
group: string
|
|
@@ -152,6 +153,7 @@ function HotkeysProvider({
|
|
|
152
153
|
children: React.ReactNode
|
|
153
154
|
/** Opens the shortcuts dialog; `null` disables it. */
|
|
154
155
|
dialogHotkey?: string | null
|
|
156
|
+
/** Milliseconds allowed between keys of a sequence. */
|
|
155
157
|
sequenceTimeout?: number
|
|
156
158
|
}) {
|
|
157
159
|
const [entries, setEntries] = React.useState<HotkeyEntry[]>([])
|
|
@@ -222,6 +224,7 @@ function HotkeysProvider({
|
|
|
222
224
|
|
|
223
225
|
/** Register a hotkey for the lifetime of the component. Listed in `HotkeysDialog` when it has a label. */
|
|
224
226
|
function useHotkey(
|
|
227
|
+
/** Key combination such as `mod+k`, or a sequence such as `g d`. */
|
|
225
228
|
hotkey: string,
|
|
226
229
|
handler: (event: KeyboardEvent) => void,
|
|
227
230
|
options: { label?: string; group?: string; enabled?: boolean; allowInInput?: boolean } = {}
|
|
@@ -127,7 +127,9 @@ function Kanban({
|
|
|
127
127
|
children,
|
|
128
128
|
...props
|
|
129
129
|
}: React.ComponentProps<"div"> & {
|
|
130
|
+
/** Called with `{ cardId, fromColumnId, toColumnId, fromIndex, toIndex }`; apply it with `moveCard`. */
|
|
130
131
|
onCardMove?: (details: KanbanCardMoveDetails) => void
|
|
132
|
+
/** Called with `{ columnId, fromIndex, toIndex }`; apply it with `moveColumn`. */
|
|
131
133
|
onColumnMove?: (details: KanbanColumnMoveDetails) => void
|
|
132
134
|
}) {
|
|
133
135
|
const [instanceId] = React.useState(() => Symbol("kanban"))
|
|
@@ -221,6 +223,7 @@ function Kanban({
|
|
|
221
223
|
type: data.type,
|
|
222
224
|
id: data.type === "card" ? data.cardId : data.columnId,
|
|
223
225
|
columnId: data.type === "card" ? data.columnId : undefined,
|
|
226
|
+
/** Height of the drop slot, normally the dragged card's height. */
|
|
224
227
|
height: source.element.getBoundingClientRect().height,
|
|
225
228
|
})
|
|
226
229
|
},
|
|
@@ -249,6 +249,7 @@ function MenubarItem({
|
|
|
249
249
|
...props
|
|
250
250
|
}: Omit<React.ComponentProps<typeof MenubarPrimitive.Item>, "value"> & {
|
|
251
251
|
value?: string
|
|
252
|
+
/** Indent the item to align with items that have an indicator. */
|
|
252
253
|
inset?: boolean
|
|
253
254
|
variant?: "default" | "destructive"
|
|
254
255
|
}) {
|
|
@@ -293,8 +294,10 @@ function MenubarCheckboxItem({
|
|
|
293
294
|
value,
|
|
294
295
|
...props
|
|
295
296
|
}: Omit<React.ComponentProps<typeof MenubarPrimitive.CheckboxItem>, "checked" | "value"> & {
|
|
297
|
+
/** Checked state of the item. */
|
|
296
298
|
checked?: boolean
|
|
297
299
|
value?: string
|
|
300
|
+
/** Indent the item to align with items that have an indicator. */
|
|
298
301
|
inset?: boolean
|
|
299
302
|
}) {
|
|
300
303
|
const id = React.useId()
|
|
@@ -325,6 +328,7 @@ function MenubarRadioItem({
|
|
|
325
328
|
inset,
|
|
326
329
|
...props
|
|
327
330
|
}: React.ComponentProps<typeof MenubarPrimitive.RadioItem> & {
|
|
331
|
+
/** Indent the item to align with items that have an indicator. */
|
|
328
332
|
inset?: boolean
|
|
329
333
|
}) {
|
|
330
334
|
return (
|
|
@@ -347,6 +351,7 @@ function MenubarLabel({
|
|
|
347
351
|
inset,
|
|
348
352
|
...props
|
|
349
353
|
}: React.ComponentProps<typeof MenubarPrimitive.ItemGroupLabel> & {
|
|
354
|
+
/** Indent the item to align with items that have an indicator. */
|
|
350
355
|
inset?: boolean
|
|
351
356
|
}) {
|
|
352
357
|
return (
|
|
@@ -396,6 +401,7 @@ function MenubarSubTrigger({
|
|
|
396
401
|
children,
|
|
397
402
|
...props
|
|
398
403
|
}: React.ComponentProps<typeof MenubarPrimitive.TriggerItem> & {
|
|
404
|
+
/** Indent the item to align with items that have an indicator. */
|
|
399
405
|
inset?: boolean
|
|
400
406
|
}) {
|
|
401
407
|
return (
|
|
@@ -39,9 +39,11 @@ type NodeGraphConnection = { source: NodeGraphPortRef; target: NodeGraphPortRef
|
|
|
39
39
|
type NodeGraphSelection = { nodes: string[]; edges: string[] }
|
|
40
40
|
type NodeGraphNodeMove = { id: string; position: XY }
|
|
41
41
|
type NodeGraphConnectingState = {
|
|
42
|
+
/** Output-side port as `{ nodeId, portId }`. */
|
|
42
43
|
source: NodeGraphPortRef & { side: NodeGraphPortSide; type: string }
|
|
43
44
|
/** Cursor position in graph coordinates. */
|
|
44
45
|
position: XY
|
|
46
|
+
/** Input-side port as `{ nodeId, portId }`. */
|
|
45
47
|
target: (NodeGraphPortRef & { side: NodeGraphPortSide; type: string }) | null
|
|
46
48
|
valid: boolean
|
|
47
49
|
}
|
|
@@ -121,13 +123,17 @@ type LayoutStore = ReturnType<typeof createLayoutStore>
|
|
|
121
123
|
|
|
122
124
|
type NodeGraphContextValue = {
|
|
123
125
|
store: LayoutStore
|
|
126
|
+
/** Controlled pan and zoom as `{ x, y, zoom }`. */
|
|
124
127
|
viewport: NodeGraphViewportState
|
|
125
128
|
setViewport: (next: NodeGraphViewportState | ((prev: NodeGraphViewportState) => NodeGraphViewportState)) => void
|
|
126
129
|
viewportRef: React.RefObject<HTMLDivElement | null>
|
|
127
130
|
size: { width: number; height: number }
|
|
131
|
+
/** Lower zoom bound. */
|
|
128
132
|
minZoom: number
|
|
133
|
+
/** Upper zoom bound. */
|
|
129
134
|
maxZoom: number
|
|
130
135
|
snapGrid: number
|
|
136
|
+
/** Controlled selection as `{ nodes, edges }` ids. */
|
|
131
137
|
selection: NodeGraphSelection
|
|
132
138
|
setSelection: (next: NodeGraphSelection) => void
|
|
133
139
|
connecting: NodeGraphConnectingState | null
|
|
@@ -208,13 +214,21 @@ function useControllable<T>(value: T | undefined, defaultValue: T, onChange?: (v
|
|
|
208
214
|
* ------------------------------------------------------------------------- */
|
|
209
215
|
|
|
210
216
|
type NodeGraphProps = Omit<React.ComponentProps<"div">, "onSelect"> & {
|
|
217
|
+
/** Controlled pan and zoom as `{ x, y, zoom }`. */
|
|
211
218
|
viewport?: NodeGraphViewportState
|
|
219
|
+
/** Initial pan and zoom when uncontrolled. */
|
|
212
220
|
defaultViewport?: NodeGraphViewportState
|
|
221
|
+
/** Called with `{ x, y, zoom }` while panning or zooming. */
|
|
213
222
|
onViewportChange?: (viewport: NodeGraphViewportState) => void
|
|
223
|
+
/** Controlled selection as `{ nodes, edges }` ids. */
|
|
214
224
|
selection?: NodeGraphSelection
|
|
225
|
+
/** Initial selected nodes and edges when uncontrolled. */
|
|
215
226
|
defaultSelection?: NodeGraphSelection
|
|
227
|
+
/** Called with `{ nodes, edges }` when the selection changes. */
|
|
216
228
|
onSelectionChange?: (selection: NodeGraphSelection) => void
|
|
229
|
+
/** Lower zoom bound. */
|
|
217
230
|
minZoom?: number
|
|
231
|
+
/** Upper zoom bound. */
|
|
218
232
|
maxZoom?: number
|
|
219
233
|
/** Grid size nodes snap to while dragging and nudging. `0` disables snapping. */
|
|
220
234
|
snapGrid?: number
|
|
@@ -473,6 +487,7 @@ function NodeGraph({
|
|
|
473
487
|
}
|
|
474
488
|
lastMoves = [...starts].map(([id, start]) => ({
|
|
475
489
|
id,
|
|
490
|
+
/** Node position in graph coordinates. */
|
|
476
491
|
position: { x: snap(start.x + dx, snapGrid), y: snap(start.y + dy, snapGrid) },
|
|
477
492
|
}))
|
|
478
493
|
latest.current.onNodesMove?.(lastMoves)
|
|
@@ -498,7 +513,9 @@ function NodeGraph({
|
|
|
498
513
|
const [source, target] = a.side === "output" ? [a, b] : [b, a]
|
|
499
514
|
if (isValidConnection) {
|
|
500
515
|
return isValidConnection({
|
|
516
|
+
/** Output-side port as `{ nodeId, portId }`. */
|
|
501
517
|
source: { nodeId: source.nodeId, portId: source.portId },
|
|
518
|
+
/** Input-side port as `{ nodeId, portId }`. */
|
|
502
519
|
target: { nodeId: target.nodeId, portId: target.portId },
|
|
503
520
|
sourceType: source.type,
|
|
504
521
|
targetType: target.type,
|
|
@@ -531,6 +548,7 @@ function NodeGraph({
|
|
|
531
548
|
const anchored = target && validate(source, target) ? store.getPortPosition(target) : null
|
|
532
549
|
state = {
|
|
533
550
|
source,
|
|
551
|
+
/** Node position in graph coordinates. */
|
|
534
552
|
position: anchored ?? screenToGraph({ x: e.clientX, y: e.clientY }),
|
|
535
553
|
target,
|
|
536
554
|
valid: !!anchored,
|
|
@@ -542,12 +560,15 @@ function NodeGraph({
|
|
|
542
560
|
if (state.target && state.valid) {
|
|
543
561
|
const [from, to] = source.side === "output" ? [source, state.target] : [state.target, source]
|
|
544
562
|
latest.current.onConnect?.({
|
|
563
|
+
/** Output-side port as `{ nodeId, portId }`. */
|
|
545
564
|
source: { nodeId: from.nodeId, portId: from.portId },
|
|
565
|
+
/** Input-side port as `{ nodeId, portId }`. */
|
|
546
566
|
target: { nodeId: to.nodeId, portId: to.portId },
|
|
547
567
|
})
|
|
548
568
|
} else if (!state.target) {
|
|
549
569
|
latest.current.onConnectEnd?.({
|
|
550
570
|
source,
|
|
571
|
+
/** Node position in graph coordinates. */
|
|
551
572
|
position: screenToGraph({ x: e.clientX, y: e.clientY }),
|
|
552
573
|
client: { x: e.clientX, y: e.clientY },
|
|
553
574
|
})
|
|
@@ -1056,7 +1077,9 @@ function NodeGraphEdge({
|
|
|
1056
1077
|
...props
|
|
1057
1078
|
}: Omit<React.ComponentProps<"g">, "children" | "target"> & {
|
|
1058
1079
|
value: string
|
|
1080
|
+
/** Output-side port as `{ nodeId, portId }`. */
|
|
1059
1081
|
source: NodeGraphPortRef
|
|
1082
|
+
/** Input-side port as `{ nodeId, portId }`. */
|
|
1060
1083
|
target: NodeGraphPortRef
|
|
1061
1084
|
selected?: boolean
|
|
1062
1085
|
/** Render prop for labels; receives the path midpoint. */
|
|
@@ -183,6 +183,7 @@ function valueLabel(rule: QueryRule, field: QueryField | undefined): string {
|
|
|
183
183
|
|
|
184
184
|
/** Natural-language sentence, e.g. "Status is Active and Created is after 2026-01-01". */
|
|
185
185
|
function describeQuery(
|
|
186
|
+
/** The group node this part renders. */
|
|
186
187
|
group: QueryGroup,
|
|
187
188
|
{ fields, operators = defaultOperators }: DescribeOptions,
|
|
188
189
|
depth = 0
|
|
@@ -215,7 +216,9 @@ function pruneQuery(group: QueryGroup, operators = defaultOperators): QueryGroup
|
|
|
215
216
|
* ------------------------------------------------------------------------- */
|
|
216
217
|
|
|
217
218
|
type QueryBuilderContextValue = {
|
|
219
|
+
/** Fields the user can filter on: `{ name, label, type, options, operators, placeholder }`. */
|
|
218
220
|
fields: QueryField[]
|
|
221
|
+
/** Operator definitions; defaults to `defaultOperators`. */
|
|
219
222
|
operators: QueryOperator[]
|
|
220
223
|
value: QueryGroup
|
|
221
224
|
disabled: boolean
|
|
@@ -263,7 +266,9 @@ function QueryBuilder({
|
|
|
263
266
|
children,
|
|
264
267
|
...props
|
|
265
268
|
}: Omit<React.ComponentProps<"div">, "defaultValue" | "onChange"> & {
|
|
269
|
+
/** Fields the user can filter on: `{ name, label, type, options, operators, placeholder }`. */
|
|
266
270
|
fields: QueryField[]
|
|
271
|
+
/** Operator definitions; defaults to `defaultOperators`. */
|
|
267
272
|
operators?: QueryOperator[]
|
|
268
273
|
value?: QueryGroup
|
|
269
274
|
defaultValue?: QueryGroup
|
|
@@ -412,6 +417,7 @@ function QueryBuilderMatch({
|
|
|
412
417
|
}: Omit<React.ComponentProps<typeof Select>, "collection" | "value" | "onValueChange"> & {
|
|
413
418
|
/** Text before the select. Defaults to "Match" at the top level and "Where" in nested groups. */
|
|
414
419
|
before?: React.ReactNode
|
|
420
|
+
/** Text rendered after the match select. */
|
|
415
421
|
after?: React.ReactNode
|
|
416
422
|
}) {
|
|
417
423
|
const { setMatch, disabled } = useQueryBuilder()
|
|
@@ -580,6 +586,7 @@ function QueryBuilderOperatorSelect({ className, ...props }: PickerProps & { cla
|
|
|
580
586
|
}
|
|
581
587
|
|
|
582
588
|
type ValueEditorRenderProps = {
|
|
589
|
+
/** The rule node this part renders. */
|
|
583
590
|
rule: QueryRule
|
|
584
591
|
field: QueryField | undefined
|
|
585
592
|
operator: QueryOperator | undefined
|
|
@@ -114,13 +114,16 @@ function RichTextEditor({
|
|
|
114
114
|
}: Omit<React.ComponentProps<"div">, "content" | "onChange"> & {
|
|
115
115
|
/** Controlled HTML. Prefer `defaultContent` + `onChange` unless you need to replace the document. */
|
|
116
116
|
content?: string
|
|
117
|
+
/** Initial HTML when uncontrolled. */
|
|
117
118
|
defaultContent?: string
|
|
118
119
|
onChange?: (change: RichTextChange) => void
|
|
119
120
|
placeholder?: string
|
|
120
121
|
editable?: boolean
|
|
122
|
+
/** Focus the editor on mount. */
|
|
121
123
|
autofocus?: boolean
|
|
122
124
|
/** Extra tiptap extensions appended to the built-in set. */
|
|
123
125
|
extensions?: Extensions
|
|
126
|
+
/** Maximum characters; the count shows `data-over` past it. */
|
|
124
127
|
characterLimit?: number
|
|
125
128
|
/** Escape hatch for any other `useEditor` option. */
|
|
126
129
|
editorOptions?: Partial<UseEditorOptions>
|
|
@@ -196,8 +199,11 @@ function RichTextEditor({
|
|
|
196
199
|
type ActionDef = {
|
|
197
200
|
label: string
|
|
198
201
|
icon: React.ComponentType<{ className?: string }>
|
|
202
|
+
/** Keyboard shortcut shown in the tooltip. */
|
|
199
203
|
shortcut?: string
|
|
204
|
+
/** Whether the toggle is pressed. */
|
|
200
205
|
isActive?: (editor: Editor) => boolean
|
|
206
|
+
/** Whether the action can run right now; disables the control when false. */
|
|
201
207
|
canRun?: (editor: Editor) => boolean
|
|
202
208
|
run: (editor: Editor) => void
|
|
203
209
|
}
|
|
@@ -208,133 +214,171 @@ const actions = {
|
|
|
208
214
|
bold: {
|
|
209
215
|
label: "Bold",
|
|
210
216
|
icon: BoldIcon,
|
|
217
|
+
/** Keyboard shortcut shown in the tooltip. */
|
|
211
218
|
shortcut: "⌘B",
|
|
219
|
+
/** Whether the toggle is pressed. */
|
|
212
220
|
isActive: (e) => e.isActive("bold"),
|
|
213
221
|
run: (e) => chain(e).toggleBold().run(),
|
|
214
222
|
},
|
|
215
223
|
italic: {
|
|
216
224
|
label: "Italic",
|
|
217
225
|
icon: ItalicIcon,
|
|
226
|
+
/** Keyboard shortcut shown in the tooltip. */
|
|
218
227
|
shortcut: "⌘I",
|
|
228
|
+
/** Whether the toggle is pressed. */
|
|
219
229
|
isActive: (e) => e.isActive("italic"),
|
|
220
230
|
run: (e) => chain(e).toggleItalic().run(),
|
|
221
231
|
},
|
|
222
232
|
underline: {
|
|
223
233
|
label: "Underline",
|
|
224
234
|
icon: UnderlineIcon,
|
|
235
|
+
/** Keyboard shortcut shown in the tooltip. */
|
|
225
236
|
shortcut: "⌘U",
|
|
237
|
+
/** Whether the toggle is pressed. */
|
|
226
238
|
isActive: (e) => e.isActive("underline"),
|
|
227
239
|
run: (e) => chain(e).toggleUnderline().run(),
|
|
228
240
|
},
|
|
229
241
|
strike: {
|
|
230
242
|
label: "Strikethrough",
|
|
231
243
|
icon: StrikethroughIcon,
|
|
244
|
+
/** Keyboard shortcut shown in the tooltip. */
|
|
232
245
|
shortcut: "⌘⇧S",
|
|
246
|
+
/** Whether the toggle is pressed. */
|
|
233
247
|
isActive: (e) => e.isActive("strike"),
|
|
234
248
|
run: (e) => chain(e).toggleStrike().run(),
|
|
235
249
|
},
|
|
236
250
|
code: {
|
|
237
251
|
label: "Inline code",
|
|
238
252
|
icon: CodeIcon,
|
|
253
|
+
/** Keyboard shortcut shown in the tooltip. */
|
|
239
254
|
shortcut: "⌘E",
|
|
255
|
+
/** Whether the toggle is pressed. */
|
|
240
256
|
isActive: (e) => e.isActive("code"),
|
|
241
257
|
run: (e) => chain(e).toggleCode().run(),
|
|
242
258
|
},
|
|
243
259
|
highlight: {
|
|
244
260
|
label: "Highlight",
|
|
245
261
|
icon: HighlighterIcon,
|
|
262
|
+
/** Keyboard shortcut shown in the tooltip. */
|
|
246
263
|
shortcut: "⌘⇧H",
|
|
264
|
+
/** Whether the toggle is pressed. */
|
|
247
265
|
isActive: (e) => e.isActive("highlight"),
|
|
248
266
|
run: (e) => chain(e).toggleHighlight().run(),
|
|
249
267
|
},
|
|
250
268
|
paragraph: {
|
|
251
269
|
label: "Paragraph",
|
|
252
270
|
icon: PilcrowIcon,
|
|
271
|
+
/** Keyboard shortcut shown in the tooltip. */
|
|
253
272
|
shortcut: "⌘⌥0",
|
|
273
|
+
/** Whether the toggle is pressed. */
|
|
254
274
|
isActive: (e) => e.isActive("paragraph"),
|
|
255
275
|
run: (e) => chain(e).setParagraph().run(),
|
|
256
276
|
},
|
|
257
277
|
heading1: {
|
|
258
278
|
label: "Heading 1",
|
|
259
279
|
icon: Heading1Icon,
|
|
280
|
+
/** Keyboard shortcut shown in the tooltip. */
|
|
260
281
|
shortcut: "⌘⌥1",
|
|
282
|
+
/** Whether the toggle is pressed. */
|
|
261
283
|
isActive: (e) => e.isActive("heading", { level: 1 }),
|
|
262
284
|
run: (e) => chain(e).toggleHeading({ level: 1 }).run(),
|
|
263
285
|
},
|
|
264
286
|
heading2: {
|
|
265
287
|
label: "Heading 2",
|
|
266
288
|
icon: Heading2Icon,
|
|
289
|
+
/** Keyboard shortcut shown in the tooltip. */
|
|
267
290
|
shortcut: "⌘⌥2",
|
|
291
|
+
/** Whether the toggle is pressed. */
|
|
268
292
|
isActive: (e) => e.isActive("heading", { level: 2 }),
|
|
269
293
|
run: (e) => chain(e).toggleHeading({ level: 2 }).run(),
|
|
270
294
|
},
|
|
271
295
|
heading3: {
|
|
272
296
|
label: "Heading 3",
|
|
273
297
|
icon: Heading3Icon,
|
|
298
|
+
/** Keyboard shortcut shown in the tooltip. */
|
|
274
299
|
shortcut: "⌘⌥3",
|
|
300
|
+
/** Whether the toggle is pressed. */
|
|
275
301
|
isActive: (e) => e.isActive("heading", { level: 3 }),
|
|
276
302
|
run: (e) => chain(e).toggleHeading({ level: 3 }).run(),
|
|
277
303
|
},
|
|
278
304
|
bulletList: {
|
|
279
305
|
label: "Bullet list",
|
|
280
306
|
icon: ListIcon,
|
|
307
|
+
/** Keyboard shortcut shown in the tooltip. */
|
|
281
308
|
shortcut: "⌘⇧8",
|
|
309
|
+
/** Whether the toggle is pressed. */
|
|
282
310
|
isActive: (e) => e.isActive("bulletList"),
|
|
283
311
|
run: (e) => chain(e).toggleBulletList().run(),
|
|
284
312
|
},
|
|
285
313
|
orderedList: {
|
|
286
314
|
label: "Numbered list",
|
|
287
315
|
icon: ListOrderedIcon,
|
|
316
|
+
/** Keyboard shortcut shown in the tooltip. */
|
|
288
317
|
shortcut: "⌘⇧7",
|
|
318
|
+
/** Whether the toggle is pressed. */
|
|
289
319
|
isActive: (e) => e.isActive("orderedList"),
|
|
290
320
|
run: (e) => chain(e).toggleOrderedList().run(),
|
|
291
321
|
},
|
|
292
322
|
taskList: {
|
|
293
323
|
label: "Task list",
|
|
294
324
|
icon: ListChecksIcon,
|
|
325
|
+
/** Keyboard shortcut shown in the tooltip. */
|
|
295
326
|
shortcut: "⌘⇧9",
|
|
327
|
+
/** Whether the toggle is pressed. */
|
|
296
328
|
isActive: (e) => e.isActive("taskList"),
|
|
297
329
|
run: (e) => chain(e).toggleTaskList().run(),
|
|
298
330
|
},
|
|
299
331
|
blockquote: {
|
|
300
332
|
label: "Quote",
|
|
301
333
|
icon: QuoteIcon,
|
|
334
|
+
/** Keyboard shortcut shown in the tooltip. */
|
|
302
335
|
shortcut: "⌘⇧B",
|
|
336
|
+
/** Whether the toggle is pressed. */
|
|
303
337
|
isActive: (e) => e.isActive("blockquote"),
|
|
304
338
|
run: (e) => chain(e).toggleBlockquote().run(),
|
|
305
339
|
},
|
|
306
340
|
codeBlock: {
|
|
307
341
|
label: "Code block",
|
|
308
342
|
icon: SquareCodeIcon,
|
|
343
|
+
/** Keyboard shortcut shown in the tooltip. */
|
|
309
344
|
shortcut: "⌘⌥C",
|
|
345
|
+
/** Whether the toggle is pressed. */
|
|
310
346
|
isActive: (e) => e.isActive("codeBlock"),
|
|
311
347
|
run: (e) => chain(e).toggleCodeBlock().run(),
|
|
312
348
|
},
|
|
313
349
|
alignLeft: {
|
|
314
350
|
label: "Align left",
|
|
315
351
|
icon: AlignLeftIcon,
|
|
352
|
+
/** Keyboard shortcut shown in the tooltip. */
|
|
316
353
|
shortcut: "⌘⇧L",
|
|
354
|
+
/** Whether the toggle is pressed. */
|
|
317
355
|
isActive: (e) => e.isActive({ textAlign: "left" }),
|
|
318
356
|
run: (e) => chain(e).setTextAlign("left").run(),
|
|
319
357
|
},
|
|
320
358
|
alignCenter: {
|
|
321
359
|
label: "Align center",
|
|
322
360
|
icon: AlignCenterIcon,
|
|
361
|
+
/** Keyboard shortcut shown in the tooltip. */
|
|
323
362
|
shortcut: "⌘⇧E",
|
|
363
|
+
/** Whether the toggle is pressed. */
|
|
324
364
|
isActive: (e) => e.isActive({ textAlign: "center" }),
|
|
325
365
|
run: (e) => chain(e).setTextAlign("center").run(),
|
|
326
366
|
},
|
|
327
367
|
alignRight: {
|
|
328
368
|
label: "Align right",
|
|
329
369
|
icon: AlignRightIcon,
|
|
370
|
+
/** Keyboard shortcut shown in the tooltip. */
|
|
330
371
|
shortcut: "⌘⇧R",
|
|
372
|
+
/** Whether the toggle is pressed. */
|
|
331
373
|
isActive: (e) => e.isActive({ textAlign: "right" }),
|
|
332
374
|
run: (e) => chain(e).setTextAlign("right").run(),
|
|
333
375
|
},
|
|
334
376
|
alignJustify: {
|
|
335
377
|
label: "Justify",
|
|
336
378
|
icon: AlignJustifyIcon,
|
|
379
|
+
/** Keyboard shortcut shown in the tooltip. */
|
|
337
380
|
shortcut: "⌘⇧J",
|
|
381
|
+
/** Whether the toggle is pressed. */
|
|
338
382
|
isActive: (e) => e.isActive({ textAlign: "justify" }),
|
|
339
383
|
run: (e) => chain(e).setTextAlign("justify").run(),
|
|
340
384
|
},
|
|
@@ -347,21 +391,27 @@ const actions = {
|
|
|
347
391
|
undo: {
|
|
348
392
|
label: "Undo",
|
|
349
393
|
icon: Undo2Icon,
|
|
394
|
+
/** Keyboard shortcut shown in the tooltip. */
|
|
350
395
|
shortcut: "⌘Z",
|
|
396
|
+
/** Whether the action can run right now; disables the control when false. */
|
|
351
397
|
canRun: (e) => e.can().undo(),
|
|
352
398
|
run: (e) => chain(e).undo().run(),
|
|
353
399
|
},
|
|
354
400
|
redo: {
|
|
355
401
|
label: "Redo",
|
|
356
402
|
icon: Redo2Icon,
|
|
403
|
+
/** Keyboard shortcut shown in the tooltip. */
|
|
357
404
|
shortcut: "⌘⇧Z",
|
|
405
|
+
/** Whether the action can run right now; disables the control when false. */
|
|
358
406
|
canRun: (e) => e.can().redo(),
|
|
359
407
|
run: (e) => chain(e).redo().run(),
|
|
360
408
|
},
|
|
361
409
|
unsetLink: {
|
|
362
410
|
label: "Remove link",
|
|
363
411
|
icon: UnlinkIcon,
|
|
412
|
+
/** Whether the toggle is pressed. */
|
|
364
413
|
isActive: (e) => e.isActive("link"),
|
|
414
|
+
/** Whether the action can run right now; disables the control when false. */
|
|
365
415
|
canRun: (e) => e.isActive("link"),
|
|
366
416
|
run: (e) => chain(e).unsetLink().run(),
|
|
367
417
|
},
|
|
@@ -440,6 +490,7 @@ function ControlTooltip({
|
|
|
440
490
|
children,
|
|
441
491
|
}: {
|
|
442
492
|
label: React.ReactNode
|
|
493
|
+
/** Keyboard shortcut shown in the tooltip. */
|
|
443
494
|
shortcut?: string
|
|
444
495
|
children: React.ReactElement
|
|
445
496
|
}) {
|
|
@@ -458,8 +509,11 @@ type ControlProps = {
|
|
|
458
509
|
/** A built-in action; supplies icon, label, shortcut and behaviour. */
|
|
459
510
|
name?: ActionName
|
|
460
511
|
label?: string
|
|
512
|
+
/** Keyboard shortcut shown in the tooltip. */
|
|
461
513
|
shortcut?: string
|
|
514
|
+
/** Whether the toggle is pressed. */
|
|
462
515
|
isActive?: (editor: Editor) => boolean
|
|
516
|
+
/** Whether the action can run right now; disables the control when false. */
|
|
463
517
|
canRun?: (editor: Editor) => boolean
|
|
464
518
|
onToggle?: (editor: Editor) => void
|
|
465
519
|
tooltip?: boolean
|