reifyui 0.11.1 → 0.13.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/README.md +31 -2
- package/dist/chart.js +2 -0
- package/dist/chart.js.map +1 -1
- package/dist/chunk-EL2DHWOH.js +1710 -0
- package/dist/chunk-EL2DHWOH.js.map +1 -0
- package/dist/chunk-J633KV57.js +41 -0
- package/dist/chunk-J633KV57.js.map +1 -0
- package/dist/chunk-J7SECRIG.js +295 -0
- package/dist/chunk-J7SECRIG.js.map +1 -0
- package/dist/chunk-PIRPLH2Z.js +231 -0
- package/dist/chunk-PIRPLH2Z.js.map +1 -0
- package/dist/chunk-PZ5AY32C.js +10 -0
- package/dist/chunk-PZ5AY32C.js.map +1 -0
- package/dist/chunk-UKG4Z6QK.js +130 -0
- package/dist/chunk-UKG4Z6QK.js.map +1 -0
- package/dist/chunk-ZYWE47EO.js +19 -0
- package/dist/chunk-ZYWE47EO.js.map +1 -0
- package/dist/collab.cjs +169 -0
- package/dist/collab.cjs.map +1 -0
- package/dist/collab.d.ts +30 -0
- package/dist/collab.js +18 -0
- package/dist/collab.js.map +1 -0
- package/dist/graph.cjs +2244 -0
- package/dist/graph.cjs.map +1 -0
- package/dist/graph.d.ts +41 -0
- package/dist/graph.js +1870 -0
- package/dist/graph.js.map +1 -0
- package/dist/harness.js +1 -0
- package/dist/harness.js.map +1 -1
- package/dist/index.cjs +2044 -867
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +20 -2
- package/dist/index.js +892 -1686
- package/dist/index.js.map +1 -1
- package/dist/sheet-doc.cjs +235 -0
- package/dist/sheet-doc.cjs.map +1 -0
- package/dist/sheet-doc.d.ts +16 -0
- package/dist/sheet-doc.js +20 -0
- package/dist/sheet-doc.js.map +1 -0
- package/dist/sheet.cjs +2322 -0
- package/dist/sheet.cjs.map +1 -0
- package/dist/sheet.d.ts +23 -0
- package/dist/sheet.js +237 -0
- package/dist/sheet.js.map +1 -0
- package/dist/slides.js +2 -0
- package/dist/slides.js.map +1 -1
- package/package.json +35 -3
- package/src/auth/client.js +4 -2
- package/src/collab/colors.js +18 -0
- package/src/collab/index.d.ts +30 -0
- package/src/collab/index.js +8 -0
- package/src/collab/keepAlive.js +34 -0
- package/src/collab/useLiveDoc.js +76 -0
- package/src/components/CascadeMenu.jsx +216 -0
- package/src/components/ChatMessages.jsx +30 -9
- package/src/components/Chip.jsx +37 -10
- package/src/components/Composer.jsx +80 -2
- package/src/components/resizable.jsx +82 -12
- package/src/graph/ConnectPane.jsx +634 -0
- package/src/graph/ConnectToolDetail.jsx +565 -0
- package/src/graph/LogsPane.jsx +328 -0
- package/src/graph/Skeleton.jsx +13 -0
- package/src/graph/draft.js +108 -0
- package/src/graph/format.js +37 -0
- package/src/graph/index.d.ts +41 -0
- package/src/graph/index.js +14 -0
- package/src/graph/useGraphCollab.js +299 -0
- package/src/graph/vgraph.js +215 -0
- package/src/index.d.ts +20 -2
- package/src/index.js +6 -1
- package/src/mention/MentionInput.jsx +420 -0
- package/src/mention/mentionModel.js +177 -0
- package/src/sheet/RunStrip.jsx +57 -0
- package/src/sheet/SheetGrid.jsx +444 -353
- package/src/sheet/doc.d.ts +16 -0
- package/src/sheet/index.d.ts +23 -0
- package/src/sheet/index.js +10 -0
- package/src/sheet/sheetDoc.js +203 -0
- package/src/sheet/useSheetCollab.js +102 -0
- package/src/sheet/useSheetRun.js +80 -0
- package/styles/chat.css +47 -5
- package/styles/chip.css +36 -0
- package/styles/graph.css +395 -0
- package/styles/mention.css +79 -0
- package/styles/sheet.css +156 -112
|
@@ -7,13 +7,24 @@
|
|
|
7
7
|
// accessoriesLeft nodes before the flexible spacer (attach button, model select, mic, …)
|
|
8
8
|
// accessoriesRight nodes after the spacer, before the send button
|
|
9
9
|
// renderSend() replaces the default send button entirely
|
|
10
|
+
// inline single-line layout: accessories, textarea and send share ONE row,
|
|
11
|
+
// vertically aligned (the classic chat input). Buttons stick to the
|
|
12
|
+
// bottom edge as the textarea grows, so multiline still reads right.
|
|
13
|
+
// tray node rendered INSIDE the card, under the action row — one seamless
|
|
14
|
+
// surface, no divider band. This is where a product puts the row that
|
|
15
|
+
// belongs to the message being composed (Arena's harness+model chips,
|
|
16
|
+
// a template picker, a recipient list) rather than to the app chrome.
|
|
17
|
+
// onFiles(FileList) files dropped on the composer (or on dropTargetRef's element, when a
|
|
18
|
+
// product wants the whole conversation to take a drop). The composer is
|
|
19
|
+
// the one that lights up (.is-dropping) either way. Absent: no drop.
|
|
20
|
+
// dropTargetRef a ref to a wider drop target than the composer itself
|
|
10
21
|
// classNames { root, input, row } — each REPLACES the default class when provided,
|
|
11
22
|
// so a product can restyle wholesale without fighting the package CSS
|
|
12
23
|
//
|
|
13
24
|
// NOTE: autoGrow and a CSS-driven min-height on the textarea are mutually exclusive — autoGrow
|
|
14
25
|
// writes an explicit height on every keystroke, which the min-height then cannot raise. A fixed
|
|
15
26
|
// multi-line box wants autoGrow={false} + rows.
|
|
16
|
-
import React, { useEffect, useRef } from 'react';
|
|
27
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
17
28
|
import { IcSend } from './icons.jsx';
|
|
18
29
|
|
|
19
30
|
// Takes a single `props` object (destructured inside) so TSX consumers don't infer every slot
|
|
@@ -28,6 +39,7 @@ export function Composer(props) {
|
|
|
28
39
|
placeholder,
|
|
29
40
|
rows = 1,
|
|
30
41
|
autoGrow = true,
|
|
42
|
+
inline = false,
|
|
31
43
|
maxRows = 15,
|
|
32
44
|
autoFocus,
|
|
33
45
|
// The composer on a landing page often has an ANIMATING placeholder (a typewriter cycling
|
|
@@ -35,6 +47,9 @@ export function Composer(props) {
|
|
|
35
47
|
// one is given — so the field announces a different name every few seconds.
|
|
36
48
|
inputAriaLabel,
|
|
37
49
|
attachments,
|
|
50
|
+
tray,
|
|
51
|
+
onFiles,
|
|
52
|
+
dropTargetRef,
|
|
38
53
|
accessoriesLeft,
|
|
39
54
|
accessoriesRight,
|
|
40
55
|
renderSend,
|
|
@@ -43,6 +58,34 @@ export function Composer(props) {
|
|
|
43
58
|
} = props;
|
|
44
59
|
const ownRef = useRef(null);
|
|
45
60
|
const taRef = inputRef || ownRef;
|
|
61
|
+
const rootRef = useRef(null);
|
|
62
|
+
|
|
63
|
+
// Drag-and-drop attach. Native listeners on the target (the composer, or the wider element a
|
|
64
|
+
// product names), so any element can take the drop; a depth counter, because children fire
|
|
65
|
+
// their own enter/leave pairs and the highlight would flicker off while crossing them.
|
|
66
|
+
const [dropping, setDropping] = useState(false);
|
|
67
|
+
useEffect(() => {
|
|
68
|
+
if (!onFiles || disabled) return undefined;
|
|
69
|
+
const el = (dropTargetRef && dropTargetRef.current) || rootRef.current;
|
|
70
|
+
if (!el) return undefined;
|
|
71
|
+
let depth = 0;
|
|
72
|
+
const hasFiles = (e) => Array.from((e.dataTransfer && e.dataTransfer.types) || []).includes('Files');
|
|
73
|
+
const enter = (e) => { if (!hasFiles(e)) return; e.preventDefault(); depth += 1; setDropping(true); };
|
|
74
|
+
const over = (e) => { if (!hasFiles(e)) return; e.preventDefault(); e.dataTransfer.dropEffect = 'copy'; };
|
|
75
|
+
const leave = (e) => { if (!hasFiles(e)) return; e.preventDefault(); depth = Math.max(0, depth - 1); if (depth === 0) setDropping(false); };
|
|
76
|
+
const drop = (e) => {
|
|
77
|
+
if (!hasFiles(e)) return;
|
|
78
|
+
e.preventDefault(); depth = 0; setDropping(false);
|
|
79
|
+
if (e.dataTransfer.files && e.dataTransfer.files.length) onFiles(e.dataTransfer.files);
|
|
80
|
+
};
|
|
81
|
+
el.addEventListener('dragenter', enter); el.addEventListener('dragover', over);
|
|
82
|
+
el.addEventListener('dragleave', leave); el.addEventListener('drop', drop);
|
|
83
|
+
return () => {
|
|
84
|
+
el.removeEventListener('dragenter', enter); el.removeEventListener('dragover', over);
|
|
85
|
+
el.removeEventListener('dragleave', leave); el.removeEventListener('drop', drop);
|
|
86
|
+
};
|
|
87
|
+
}, [onFiles, disabled, dropTargetRef]);
|
|
88
|
+
const rootClass = (classNames.root ?? 'wbx-composer') + (dropping ? ' is-dropping' : '');
|
|
46
89
|
|
|
47
90
|
// Auto-grow the composer to fit its content, capped at ~maxRows rows (then it scrolls).
|
|
48
91
|
useEffect(() => {
|
|
@@ -56,8 +99,42 @@ export function Composer(props) {
|
|
|
56
99
|
el.style.overflowY = el.scrollHeight > max ? 'auto' : 'hidden';
|
|
57
100
|
}, [value, autoGrow, maxRows, taRef]);
|
|
58
101
|
|
|
102
|
+
const sendEl = renderSend ? renderSend() : (
|
|
103
|
+
<button type="button" className="uic-send" disabled={sendDisabled} onClick={() => onSend()} aria-label="Send message">
|
|
104
|
+
<IcSend />
|
|
105
|
+
</button>
|
|
106
|
+
);
|
|
107
|
+
|
|
108
|
+
if (inline) {
|
|
109
|
+
return (
|
|
110
|
+
<div ref={rootRef} className={rootClass}>
|
|
111
|
+
{attachments}
|
|
112
|
+
<div className="uic-composer-line">
|
|
113
|
+
{accessoriesLeft}
|
|
114
|
+
<textarea
|
|
115
|
+
ref={taRef}
|
|
116
|
+
className={classNames.input ?? 'wbx-composer-input'}
|
|
117
|
+
rows={rows}
|
|
118
|
+
value={value}
|
|
119
|
+
placeholder={placeholder}
|
|
120
|
+
aria-label={inputAriaLabel || placeholder}
|
|
121
|
+
disabled={disabled}
|
|
122
|
+
autoFocus={autoFocus}
|
|
123
|
+
onChange={(e) => onChange(e.target.value)}
|
|
124
|
+
onKeyDown={(e) => {
|
|
125
|
+
if (e.key === 'Enter' && !e.shiftKey) { e.preventDefault(); onSend(); }
|
|
126
|
+
}}
|
|
127
|
+
/>
|
|
128
|
+
{accessoriesRight}
|
|
129
|
+
{sendEl}
|
|
130
|
+
</div>
|
|
131
|
+
{tray ? <div className="uic-composer-tray">{tray}</div> : null}
|
|
132
|
+
</div>
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
|
|
59
136
|
return (
|
|
60
|
-
<div className={
|
|
137
|
+
<div ref={rootRef} className={rootClass}>
|
|
61
138
|
{attachments}
|
|
62
139
|
<textarea
|
|
63
140
|
ref={taRef}
|
|
@@ -89,6 +166,7 @@ export function Composer(props) {
|
|
|
89
166
|
</button>
|
|
90
167
|
)}
|
|
91
168
|
</div>
|
|
169
|
+
{tray ? <div className="uic-composer-tray">{tray}</div> : null}
|
|
92
170
|
</div>
|
|
93
171
|
);
|
|
94
172
|
}
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
// - min/max clamps (absolute px and/or a viewport fraction, e.g. 60vw)
|
|
4
4
|
// - per-user width persistence (localStorage, storageKey)
|
|
5
5
|
// - double-click the divider to reset to the default width
|
|
6
|
+
// - axis: 'x' (default, side-by-side panes) or 'y' (stacked panes, e.g. an artifact preview
|
|
7
|
+
// under a narrow chat column, where splitting sideways would leave neither half readable)
|
|
6
8
|
//
|
|
7
9
|
// Usage:
|
|
8
10
|
// const pane = useResizablePane({ initial: 340, min: 320, maxFraction: 0.6,
|
|
@@ -17,15 +19,22 @@ export function useResizablePane(opts = {}) {
|
|
|
17
19
|
min = 240,
|
|
18
20
|
max = null, // absolute px cap (null = none)
|
|
19
21
|
maxFraction = null, // viewport-width fraction cap, e.g. 0.6 for 60vw (null = none)
|
|
20
|
-
fromRight = false, // divider sits on the pane's LEFT edge (dragging
|
|
21
|
-
storageKey = null, // persist the chosen
|
|
22
|
+
fromRight = false, // divider sits on the pane's LEFT/TOP edge (dragging toward it shrinks)
|
|
23
|
+
storageKey = null, // persist the chosen size per user (localStorage)
|
|
24
|
+
axis = 'x', // 'x' = width (col-resize), 'y' = height (row-resize)
|
|
22
25
|
} = opts;
|
|
26
|
+
const vertical = axis === 'y';
|
|
27
|
+
// One clamp, one drag, one persistence path for both orientations: the axis only decides which
|
|
28
|
+
// pointer coordinate and which viewport dimension are read.
|
|
29
|
+
const coord = (e) => (vertical ? e.clientY : e.clientX);
|
|
30
|
+
const viewportExtent = () => (typeof window === 'undefined' ? 0 : (vertical ? window.innerHeight : window.innerWidth));
|
|
31
|
+
const cursor = vertical ? 'row-resize' : 'col-resize';
|
|
23
32
|
|
|
24
33
|
const clamp = useCallback((x) => {
|
|
25
34
|
let hi = max ?? Infinity;
|
|
26
|
-
if (maxFraction && typeof window !== 'undefined') hi = Math.min(hi, Math.round(
|
|
35
|
+
if (maxFraction && typeof window !== 'undefined') hi = Math.min(hi, Math.round(viewportExtent() * maxFraction));
|
|
27
36
|
return Math.min(hi, Math.max(min, x));
|
|
28
|
-
}, [min, max, maxFraction]);
|
|
37
|
+
}, [min, max, maxFraction, vertical]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
29
38
|
|
|
30
39
|
const [width, setWidth] = useState(() => {
|
|
31
40
|
if (storageKey && typeof window !== 'undefined') {
|
|
@@ -46,38 +55,99 @@ export function useResizablePane(opts = {}) {
|
|
|
46
55
|
|
|
47
56
|
const onMouseDown = useCallback((e) => {
|
|
48
57
|
e.preventDefault();
|
|
49
|
-
const sx = e
|
|
58
|
+
const sx = coord(e), base = widthRef.current, dir = fromRight ? -1 : 1;
|
|
50
59
|
// While dragging, neutralize iframes/text-selection so an embedded preview can't swallow
|
|
51
60
|
// mousemove/mouseup (which would strand the drag).
|
|
52
61
|
document.body.classList.add('uic-resizing');
|
|
53
|
-
const move = (ev) => setWidth(clamp(base + dir * (ev
|
|
62
|
+
const move = (ev) => setWidth(clamp(base + dir * (coord(ev) - sx)));
|
|
54
63
|
const up = () => {
|
|
55
64
|
window.removeEventListener('mousemove', move); window.removeEventListener('mouseup', up);
|
|
56
65
|
document.body.style.cursor = ''; document.body.classList.remove('uic-resizing');
|
|
57
66
|
persist(widthRef.current);
|
|
58
67
|
};
|
|
59
68
|
window.addEventListener('mousemove', move); window.addEventListener('mouseup', up);
|
|
60
|
-
document.body.style.cursor =
|
|
61
|
-
}, [clamp, fromRight, persist]);
|
|
69
|
+
document.body.style.cursor = cursor;
|
|
70
|
+
}, [clamp, fromRight, persist, vertical]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
71
|
+
|
|
72
|
+
// Touch / pen drags (pointer events). Mouse keeps the mousedown path above
|
|
73
|
+
// untouched — this handler ignores mouse pointers so the two never double up.
|
|
74
|
+
const onPointerDown = useCallback((e) => {
|
|
75
|
+
if (e.pointerType === 'mouse') return;
|
|
76
|
+
e.preventDefault();
|
|
77
|
+
const sx = coord(e), base = widthRef.current, dir = fromRight ? -1 : 1;
|
|
78
|
+
const el = e.currentTarget;
|
|
79
|
+
document.body.classList.add('uic-resizing');
|
|
80
|
+
try { el.setPointerCapture(e.pointerId); } catch { /* unsupported */ }
|
|
81
|
+
const move = (ev) => setWidth(clamp(base + dir * (coord(ev) - sx)));
|
|
82
|
+
const up = () => {
|
|
83
|
+
el.removeEventListener('pointermove', move);
|
|
84
|
+
el.removeEventListener('pointerup', up);
|
|
85
|
+
el.removeEventListener('pointercancel', up);
|
|
86
|
+
document.body.classList.remove('uic-resizing');
|
|
87
|
+
persist(widthRef.current);
|
|
88
|
+
};
|
|
89
|
+
el.addEventListener('pointermove', move);
|
|
90
|
+
el.addEventListener('pointerup', up);
|
|
91
|
+
el.addEventListener('pointercancel', up);
|
|
92
|
+
}, [clamp, fromRight, persist, vertical]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
93
|
+
|
|
94
|
+
// Keyboard resizing: move the pane edge by a signed px delta (clamped,
|
|
95
|
+
// persisted). Positive delta = wider pane.
|
|
96
|
+
const nudge = useCallback((delta) => {
|
|
97
|
+
const w = clamp(widthRef.current + delta);
|
|
98
|
+
setWidth(w);
|
|
99
|
+
persist(w);
|
|
100
|
+
}, [clamp, persist]);
|
|
62
101
|
|
|
63
102
|
const reset = useCallback(() => {
|
|
64
103
|
setWidth(initial);
|
|
65
104
|
if (storageKey) { try { window.localStorage.removeItem(storageKey); } catch { /* private mode */ } }
|
|
66
105
|
}, [initial, storageKey]);
|
|
67
106
|
|
|
68
|
-
|
|
107
|
+
// Resolved clamp bounds for aria-valuemin/max on the divider.
|
|
108
|
+
let maxResolved = max ?? null;
|
|
109
|
+
if (maxFraction && typeof window !== 'undefined') {
|
|
110
|
+
const frac = Math.round(viewportExtent() * maxFraction);
|
|
111
|
+
maxResolved = maxResolved == null ? frac : Math.min(maxResolved, frac);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
return { width, onMouseDown, onPointerDown, nudge, reset, min, max: maxResolved, fromRight, axis };
|
|
69
115
|
}
|
|
70
116
|
|
|
71
|
-
/** The grabbable divider (comfortable 7px hit area, col-resize cursor, dblclick = reset).
|
|
117
|
+
/** The grabbable divider (comfortable 7px hit area, col-resize cursor, dblclick = reset).
|
|
118
|
+
* Keyboard: focus it (Tab) and use ArrowLeft/ArrowRight to move the divider
|
|
119
|
+
* in 24px steps (Shift for 96px); touch drags work through pointer events.
|
|
120
|
+
* Mouse drag and double-click reset behave exactly as before. */
|
|
72
121
|
export function PaneResizer(props) {
|
|
73
122
|
const { pane, className, title = 'Drag to resize (double-click to reset)' } = props;
|
|
123
|
+
const vertical = pane.axis === 'y';
|
|
124
|
+
const onKeyDown = (e) => {
|
|
125
|
+
const keys = vertical ? ['ArrowUp', 'ArrowDown'] : ['ArrowLeft', 'ArrowRight'];
|
|
126
|
+
if (!keys.includes(e.key)) return;
|
|
127
|
+
if (!pane.nudge) return;
|
|
128
|
+
e.preventDefault();
|
|
129
|
+
const step = e.shiftKey ? 96 : 24;
|
|
130
|
+
// Arrows move the SEPARATOR: for a trailing pane (divider on its leading
|
|
131
|
+
// edge) the forward key shrinks the pane; for a leading pane it grows it.
|
|
132
|
+
const forward = e.key === 'ArrowRight' || e.key === 'ArrowDown';
|
|
133
|
+
const dir = (forward ? 1 : -1) * (pane.fromRight ? -1 : 1);
|
|
134
|
+
pane.nudge(dir * step);
|
|
135
|
+
};
|
|
74
136
|
return (
|
|
75
137
|
<div
|
|
76
|
-
className={className ?? 'uic-vresize'}
|
|
138
|
+
className={className ?? (vertical ? 'uic-hresize' : 'uic-vresize')}
|
|
77
139
|
role="separator"
|
|
78
|
-
|
|
140
|
+
// The separator's own orientation: a stacked (axis 'y') split is divided by a HORIZONTAL bar.
|
|
141
|
+
aria-orientation={vertical ? 'horizontal' : 'vertical'}
|
|
142
|
+
aria-label={title}
|
|
143
|
+
aria-valuenow={Math.round(pane.width)}
|
|
144
|
+
aria-valuemin={pane.min != null ? Math.round(pane.min) : undefined}
|
|
145
|
+
aria-valuemax={pane.max != null ? Math.round(pane.max) : undefined}
|
|
146
|
+
tabIndex={0}
|
|
79
147
|
title={title}
|
|
80
148
|
onMouseDown={pane.onMouseDown}
|
|
149
|
+
onPointerDown={pane.onPointerDown}
|
|
150
|
+
onKeyDown={onKeyDown}
|
|
81
151
|
onDoubleClick={pane.reset}
|
|
82
152
|
/>
|
|
83
153
|
);
|