@mieweb/ui 0.7.1-dev.5 → 0.7.1-dev.7
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/brands/index.cjs +7 -7
- package/dist/brands/index.js +2 -2
- package/dist/chunk-3MGHTTZW.js +487 -0
- package/dist/chunk-3MGHTTZW.js.map +1 -0
- package/dist/{chunk-MBESCEWS.cjs → chunk-5M2YSPJH.cjs} +51 -15
- package/dist/chunk-5M2YSPJH.cjs.map +1 -0
- package/dist/chunk-6NXQSQ3A.cjs +511 -0
- package/dist/chunk-6NXQSQ3A.cjs.map +1 -0
- package/dist/{chunk-Y3ZZEDIU.js → chunk-B77UC56R.js} +7 -2
- package/dist/chunk-B77UC56R.js.map +1 -0
- package/dist/{chunk-CYMZ2QS5.js → chunk-BCJFOSZX.js} +2 -2
- package/dist/{chunk-CYMZ2QS5.js.map → chunk-BCJFOSZX.js.map} +1 -1
- package/dist/{chunk-YVBSAIJ4.js → chunk-GOAW2UCP.js} +46 -10
- package/dist/chunk-GOAW2UCP.js.map +1 -0
- package/dist/{chunk-O5UJRGRV.cjs → chunk-NPKPCYAT.cjs} +37 -3
- package/dist/chunk-NPKPCYAT.cjs.map +1 -0
- package/dist/{chunk-VIWEV6TJ.cjs → chunk-T5F565OC.cjs} +7 -2
- package/dist/chunk-T5F565OC.cjs.map +1 -0
- package/dist/{chunk-FKHMTRF2.js → chunk-UUI7WXI5.js} +37 -3
- package/dist/chunk-UUI7WXI5.js.map +1 -0
- package/dist/{chunk-SNEQXSC5.cjs → chunk-VA7QN4DX.cjs} +2 -2
- package/dist/{chunk-SNEQXSC5.cjs.map → chunk-VA7QN4DX.cjs.map} +1 -1
- package/dist/components/CollabStatus/index.cjs +21 -0
- package/dist/components/CollabStatus/index.cjs.map +1 -0
- package/dist/components/CollabStatus/index.d.cts +222 -0
- package/dist/components/CollabStatus/index.d.ts +222 -0
- package/dist/components/CollabStatus/index.js +4 -0
- package/dist/components/CollabStatus/index.js.map +1 -0
- package/dist/components/MediaEditor/index.cjs +7 -7
- package/dist/components/MediaEditor/index.d.cts +24 -1
- package/dist/components/MediaEditor/index.d.ts +24 -1
- package/dist/components/MediaEditor/index.js +2 -2
- package/dist/hooks/index.cjs +9 -9
- package/dist/hooks/index.d.cts +1 -1
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/index.js +1 -1
- package/dist/index.cjs +83 -70
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +12 -11
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/tailwind-preset.cjs +4 -4
- package/dist/tailwind-preset.js +1 -1
- package/dist/{useTranscriptEdits-DgeVQMSi.d.cts → useTranscriptEdits-CGzlemHT.d.cts} +4 -0
- package/dist/{useTranscriptEdits-C0Hhy2pO.d.ts → useTranscriptEdits-D32bLs0l.d.ts} +4 -0
- package/dist/utils/index.cjs +9 -9
- package/dist/utils/index.js +1 -1
- package/package.json +2 -1
- package/dist/chunk-FKHMTRF2.js.map +0 -1
- package/dist/chunk-MBESCEWS.cjs.map +0 -1
- package/dist/chunk-O5UJRGRV.cjs.map +0 -1
- package/dist/chunk-VIWEV6TJ.cjs.map +0 -1
- package/dist/chunk-Y3ZZEDIU.js.map +0 -1
- package/dist/chunk-YVBSAIJ4.js.map +0 -1
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
|
|
4
|
+
/** Another participant currently present in the room. */
|
|
5
|
+
interface CollabPeer {
|
|
6
|
+
/** Display name published through presence. */
|
|
7
|
+
name: string;
|
|
8
|
+
/** Optional presence color (cursor/avatar tint). */
|
|
9
|
+
color?: string;
|
|
10
|
+
}
|
|
11
|
+
/** Static identity of the open collaboration room, shown in the debug panel. */
|
|
12
|
+
interface CollabRoomInfo {
|
|
13
|
+
/** Room name on the sync server (e.g. `case/4`). */
|
|
14
|
+
name: string;
|
|
15
|
+
/** Transport URL the client connected to. */
|
|
16
|
+
url?: string;
|
|
17
|
+
/** This window's client id (stable per document), or null before connect. */
|
|
18
|
+
clientId?: number | null;
|
|
19
|
+
/** The acting application user id passed to the sync server. */
|
|
20
|
+
userId?: string;
|
|
21
|
+
}
|
|
22
|
+
/** Category of a collaboration event in the debug log. */
|
|
23
|
+
type CollabLogKind = 'doc' | 'awareness' | 'sync' | 'patch';
|
|
24
|
+
/** A single entry in the collaboration debug log. */
|
|
25
|
+
interface CollabLogEntry {
|
|
26
|
+
/** Stable key for rendering. */
|
|
27
|
+
id: number | string;
|
|
28
|
+
/** Wall-clock time of the event (epoch ms). */
|
|
29
|
+
at: number;
|
|
30
|
+
/** Event category. */
|
|
31
|
+
kind: CollabLogKind;
|
|
32
|
+
/** Whether this window or a peer originated it. */
|
|
33
|
+
origin?: 'local' | 'remote';
|
|
34
|
+
/** Human-readable detail line. */
|
|
35
|
+
detail: string;
|
|
36
|
+
}
|
|
37
|
+
/** Every user-facing string, so apps can translate the widget. */
|
|
38
|
+
interface CollabStatusLabels {
|
|
39
|
+
/** Trigger text once the initial sync completed. */
|
|
40
|
+
live: string;
|
|
41
|
+
/** Trigger text before the initial sync completes. */
|
|
42
|
+
connecting: string;
|
|
43
|
+
/** Summary of who else is editing, e.g. `Ann, Bo are editing`. */
|
|
44
|
+
editing: (names: string[]) => string;
|
|
45
|
+
/** Accessible name / tooltip of the trigger button. */
|
|
46
|
+
triggerLabel: string;
|
|
47
|
+
/** Heading of the room-occupants section. */
|
|
48
|
+
peersTitle: (count: number) => string;
|
|
49
|
+
/** Shown in the occupants section when nobody else is in the room. */
|
|
50
|
+
alone: React.ReactNode;
|
|
51
|
+
/** Heading of the debug panel. */
|
|
52
|
+
logTitle: (count: number) => string;
|
|
53
|
+
/** Accessible name of the panel close button. */
|
|
54
|
+
close: string;
|
|
55
|
+
/** Accessible name of the toggle that unclips long values. */
|
|
56
|
+
wrap: string;
|
|
57
|
+
/** Shown when the log is empty. */
|
|
58
|
+
empty: React.ReactNode;
|
|
59
|
+
roomTerm: string;
|
|
60
|
+
urlTerm: string;
|
|
61
|
+
clientTerm: string;
|
|
62
|
+
userTerm: string;
|
|
63
|
+
/** Suffix appended to the client id once synced / while connecting. */
|
|
64
|
+
clientSynced: string;
|
|
65
|
+
clientConnecting: string;
|
|
66
|
+
}
|
|
67
|
+
declare const defaultCollabStatusLabels: CollabStatusLabels;
|
|
68
|
+
interface CollabStatusProps {
|
|
69
|
+
/** True once the room has completed its initial sync with the server. */
|
|
70
|
+
connected: boolean;
|
|
71
|
+
/** Other people in the room right now. */
|
|
72
|
+
peers?: CollabPeer[];
|
|
73
|
+
/** Recent collaboration events, newest first. */
|
|
74
|
+
log?: CollabLogEntry[];
|
|
75
|
+
/** Identity of the open room, shown at the top of the panel. */
|
|
76
|
+
room?: CollabRoomInfo | null;
|
|
77
|
+
/** Set false to render a status-only chip with no debug panel. */
|
|
78
|
+
showLog?: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* Render the trigger as the bare connection dot, moving the status text into
|
|
81
|
+
* its accessible name. For headers with no room for a full chip.
|
|
82
|
+
*/
|
|
83
|
+
compact?: boolean;
|
|
84
|
+
/**
|
|
85
|
+
* An app-level condition worth the same glance as the connection state, e.g.
|
|
86
|
+
* `"Unsaved changes"`. While set, the dot turns amber and the text joins the
|
|
87
|
+
* trigger's accessible name and heads the panel.
|
|
88
|
+
*/
|
|
89
|
+
attention?: React.ReactNode;
|
|
90
|
+
/** Overrides for any user-facing string. */
|
|
91
|
+
labels?: Partial<CollabStatusLabels>;
|
|
92
|
+
/** Additional className for the trigger wrapper. */
|
|
93
|
+
className?: string;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Live-collaboration status chip: a connection dot, a `Live` / `Connecting…`
|
|
97
|
+
* label, a summary of who else is editing, and a click-to-open panel with the
|
|
98
|
+
* room identity, who is in the room, and a rolling log of collaboration
|
|
99
|
+
* events. Pass `compact` to shrink the trigger down to the dot alone, and
|
|
100
|
+
* `attention` to let an app condition ("Unsaved changes") share that dot.
|
|
101
|
+
*
|
|
102
|
+
* Transport-agnostic — it renders whatever presence state you hand it. For a
|
|
103
|
+
* Yjs (`y-websocket`) room, {@link useYjsCollabStatus} produces these props
|
|
104
|
+
* directly:
|
|
105
|
+
*
|
|
106
|
+
* @example
|
|
107
|
+
* ```tsx
|
|
108
|
+
* const doc = React.useMemo(() => new Y.Doc(), []);
|
|
109
|
+
* const provider = React.useMemo(
|
|
110
|
+
* () => new WebsocketProvider('ws://localhost:1234', 'case/4', doc),
|
|
111
|
+
* [doc]
|
|
112
|
+
* );
|
|
113
|
+
* const status = useYjsCollabStatus({ doc, provider, user: { name: 'Ann' } });
|
|
114
|
+
*
|
|
115
|
+
* return <CollabStatus {...status} />;
|
|
116
|
+
* ```
|
|
117
|
+
*/
|
|
118
|
+
declare function CollabStatus({ connected, peers, log, room, showLog, compact, attention, labels: labelOverrides, className, }: CollabStatusProps): react_jsx_runtime.JSX.Element;
|
|
119
|
+
|
|
120
|
+
/** The subset of `Y.Doc` this hook observes. */
|
|
121
|
+
interface YjsDocLike {
|
|
122
|
+
clientID: number;
|
|
123
|
+
on(event: string, handler: (...args: any[]) => void): void;
|
|
124
|
+
off(event: string, handler: (...args: any[]) => void): void;
|
|
125
|
+
}
|
|
126
|
+
/** The subset of `y-protocols/awareness`.`Awareness` this hook uses. */
|
|
127
|
+
interface YjsAwarenessLike {
|
|
128
|
+
clientID: number;
|
|
129
|
+
getStates(): Map<number, Record<string, any>>;
|
|
130
|
+
setLocalStateField(field: string, value: unknown): void;
|
|
131
|
+
on(event: string, handler: (...args: any[]) => void): void;
|
|
132
|
+
off(event: string, handler: (...args: any[]) => void): void;
|
|
133
|
+
}
|
|
134
|
+
/** The subset of `y-websocket`.`WebsocketProvider` this hook uses. */
|
|
135
|
+
interface YjsProviderLike {
|
|
136
|
+
awareness: YjsAwarenessLike;
|
|
137
|
+
/** True once the initial sync completed (y-websocket exposes this). */
|
|
138
|
+
synced?: boolean;
|
|
139
|
+
/** Room name, used as the default label in the debug panel. */
|
|
140
|
+
roomname?: string;
|
|
141
|
+
/** Server URL, used as the default label in the debug panel. */
|
|
142
|
+
url?: string;
|
|
143
|
+
on(event: string, handler: (...args: any[]) => void): void;
|
|
144
|
+
off(event: string, handler: (...args: any[]) => void): void;
|
|
145
|
+
}
|
|
146
|
+
/** A remote collaborator's edit that just changed the open document. */
|
|
147
|
+
interface CollabRemoteEdit {
|
|
148
|
+
/** Human-readable labels of the fields that changed. */
|
|
149
|
+
fields: string[];
|
|
150
|
+
/** Who made the change, when attributable from presence. */
|
|
151
|
+
by?: string;
|
|
152
|
+
/** Timestamp; a new value signals a fresh growl/toast. */
|
|
153
|
+
at: number;
|
|
154
|
+
}
|
|
155
|
+
interface UseYjsCollabStatusOptions {
|
|
156
|
+
/** The shared document. Pass null to keep the hook inert. */
|
|
157
|
+
doc: YjsDocLike | null | undefined;
|
|
158
|
+
/** The sync provider (e.g. `y-websocket`). Pass null to keep it inert. */
|
|
159
|
+
provider: YjsProviderLike | null | undefined;
|
|
160
|
+
/**
|
|
161
|
+
* Presence identity published for this window. Defaults to
|
|
162
|
+
* `User <clientID>` so windows are distinguishable without a login.
|
|
163
|
+
*/
|
|
164
|
+
user?: {
|
|
165
|
+
name?: string;
|
|
166
|
+
color?: string;
|
|
167
|
+
};
|
|
168
|
+
/** Room label for the debug panel. Defaults to `provider.roomname`. */
|
|
169
|
+
roomName?: string;
|
|
170
|
+
/** URL label for the debug panel. Defaults to `provider.url`. */
|
|
171
|
+
url?: string;
|
|
172
|
+
/** Application user id shown in the debug panel. */
|
|
173
|
+
userId?: string;
|
|
174
|
+
/** Maximum log entries kept in memory. Default 100. */
|
|
175
|
+
logCap?: number;
|
|
176
|
+
}
|
|
177
|
+
interface YjsCollabStatus {
|
|
178
|
+
/** True once the initial server sync completed. */
|
|
179
|
+
connected: boolean;
|
|
180
|
+
/** Other windows currently present in the room. */
|
|
181
|
+
peers: CollabPeer[];
|
|
182
|
+
/** Recent collaboration events, newest first. */
|
|
183
|
+
log: CollabLogEntry[];
|
|
184
|
+
/** Room identity for the debug panel. */
|
|
185
|
+
room: CollabRoomInfo | null;
|
|
186
|
+
/** The most recent remote edit, or null. */
|
|
187
|
+
lastRemoteEdit: CollabRemoteEdit | null;
|
|
188
|
+
/**
|
|
189
|
+
* Announce a local edit and the fields it touched, so other windows can
|
|
190
|
+
* attribute it. Also records a `patch` log entry.
|
|
191
|
+
*/
|
|
192
|
+
publishActivity: (fields: string[]) => void;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Bind {@link CollabStatus} to a Yjs room: tracks initial-sync state, publishes
|
|
196
|
+
* this window's presence, tracks peers joining/leaving, attributes remote edits,
|
|
197
|
+
* and keeps a capped log of document/awareness/sync events.
|
|
198
|
+
*
|
|
199
|
+
* The return value is spreadable straight into the component.
|
|
200
|
+
*
|
|
201
|
+
* @example
|
|
202
|
+
* ```tsx
|
|
203
|
+
* import * as Y from 'yjs';
|
|
204
|
+
* import { WebsocketProvider } from 'y-websocket';
|
|
205
|
+
* import { CollabStatus, useYjsCollabStatus } from '@mieweb/ui';
|
|
206
|
+
*
|
|
207
|
+
* function Header({ caseId }: { caseId: string }) {
|
|
208
|
+
* const doc = React.useMemo(() => new Y.Doc(), []);
|
|
209
|
+
* const provider = React.useMemo(
|
|
210
|
+
* () => new WebsocketProvider('ws://localhost:1234', `case/${caseId}`, doc),
|
|
211
|
+
* [doc, caseId]
|
|
212
|
+
* );
|
|
213
|
+
* React.useEffect(() => () => provider.destroy(), [provider]);
|
|
214
|
+
*
|
|
215
|
+
* const status = useYjsCollabStatus({ doc, provider, user: { name: 'Ann' } });
|
|
216
|
+
* return <CollabStatus {...status} />;
|
|
217
|
+
* }
|
|
218
|
+
* ```
|
|
219
|
+
*/
|
|
220
|
+
declare function useYjsCollabStatus({ doc, provider, user, roomName, url, userId, logCap, }: UseYjsCollabStatusOptions): YjsCollabStatus;
|
|
221
|
+
|
|
222
|
+
export { type CollabLogEntry, type CollabLogKind, type CollabPeer, type CollabRemoteEdit, type CollabRoomInfo, CollabStatus, type CollabStatusLabels, type CollabStatusProps, type UseYjsCollabStatusOptions, type YjsAwarenessLike, type YjsCollabStatus, type YjsDocLike, type YjsProviderLike, defaultCollabStatusLabels, useYjsCollabStatus };
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
|
|
4
|
+
/** Another participant currently present in the room. */
|
|
5
|
+
interface CollabPeer {
|
|
6
|
+
/** Display name published through presence. */
|
|
7
|
+
name: string;
|
|
8
|
+
/** Optional presence color (cursor/avatar tint). */
|
|
9
|
+
color?: string;
|
|
10
|
+
}
|
|
11
|
+
/** Static identity of the open collaboration room, shown in the debug panel. */
|
|
12
|
+
interface CollabRoomInfo {
|
|
13
|
+
/** Room name on the sync server (e.g. `case/4`). */
|
|
14
|
+
name: string;
|
|
15
|
+
/** Transport URL the client connected to. */
|
|
16
|
+
url?: string;
|
|
17
|
+
/** This window's client id (stable per document), or null before connect. */
|
|
18
|
+
clientId?: number | null;
|
|
19
|
+
/** The acting application user id passed to the sync server. */
|
|
20
|
+
userId?: string;
|
|
21
|
+
}
|
|
22
|
+
/** Category of a collaboration event in the debug log. */
|
|
23
|
+
type CollabLogKind = 'doc' | 'awareness' | 'sync' | 'patch';
|
|
24
|
+
/** A single entry in the collaboration debug log. */
|
|
25
|
+
interface CollabLogEntry {
|
|
26
|
+
/** Stable key for rendering. */
|
|
27
|
+
id: number | string;
|
|
28
|
+
/** Wall-clock time of the event (epoch ms). */
|
|
29
|
+
at: number;
|
|
30
|
+
/** Event category. */
|
|
31
|
+
kind: CollabLogKind;
|
|
32
|
+
/** Whether this window or a peer originated it. */
|
|
33
|
+
origin?: 'local' | 'remote';
|
|
34
|
+
/** Human-readable detail line. */
|
|
35
|
+
detail: string;
|
|
36
|
+
}
|
|
37
|
+
/** Every user-facing string, so apps can translate the widget. */
|
|
38
|
+
interface CollabStatusLabels {
|
|
39
|
+
/** Trigger text once the initial sync completed. */
|
|
40
|
+
live: string;
|
|
41
|
+
/** Trigger text before the initial sync completes. */
|
|
42
|
+
connecting: string;
|
|
43
|
+
/** Summary of who else is editing, e.g. `Ann, Bo are editing`. */
|
|
44
|
+
editing: (names: string[]) => string;
|
|
45
|
+
/** Accessible name / tooltip of the trigger button. */
|
|
46
|
+
triggerLabel: string;
|
|
47
|
+
/** Heading of the room-occupants section. */
|
|
48
|
+
peersTitle: (count: number) => string;
|
|
49
|
+
/** Shown in the occupants section when nobody else is in the room. */
|
|
50
|
+
alone: React.ReactNode;
|
|
51
|
+
/** Heading of the debug panel. */
|
|
52
|
+
logTitle: (count: number) => string;
|
|
53
|
+
/** Accessible name of the panel close button. */
|
|
54
|
+
close: string;
|
|
55
|
+
/** Accessible name of the toggle that unclips long values. */
|
|
56
|
+
wrap: string;
|
|
57
|
+
/** Shown when the log is empty. */
|
|
58
|
+
empty: React.ReactNode;
|
|
59
|
+
roomTerm: string;
|
|
60
|
+
urlTerm: string;
|
|
61
|
+
clientTerm: string;
|
|
62
|
+
userTerm: string;
|
|
63
|
+
/** Suffix appended to the client id once synced / while connecting. */
|
|
64
|
+
clientSynced: string;
|
|
65
|
+
clientConnecting: string;
|
|
66
|
+
}
|
|
67
|
+
declare const defaultCollabStatusLabels: CollabStatusLabels;
|
|
68
|
+
interface CollabStatusProps {
|
|
69
|
+
/** True once the room has completed its initial sync with the server. */
|
|
70
|
+
connected: boolean;
|
|
71
|
+
/** Other people in the room right now. */
|
|
72
|
+
peers?: CollabPeer[];
|
|
73
|
+
/** Recent collaboration events, newest first. */
|
|
74
|
+
log?: CollabLogEntry[];
|
|
75
|
+
/** Identity of the open room, shown at the top of the panel. */
|
|
76
|
+
room?: CollabRoomInfo | null;
|
|
77
|
+
/** Set false to render a status-only chip with no debug panel. */
|
|
78
|
+
showLog?: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* Render the trigger as the bare connection dot, moving the status text into
|
|
81
|
+
* its accessible name. For headers with no room for a full chip.
|
|
82
|
+
*/
|
|
83
|
+
compact?: boolean;
|
|
84
|
+
/**
|
|
85
|
+
* An app-level condition worth the same glance as the connection state, e.g.
|
|
86
|
+
* `"Unsaved changes"`. While set, the dot turns amber and the text joins the
|
|
87
|
+
* trigger's accessible name and heads the panel.
|
|
88
|
+
*/
|
|
89
|
+
attention?: React.ReactNode;
|
|
90
|
+
/** Overrides for any user-facing string. */
|
|
91
|
+
labels?: Partial<CollabStatusLabels>;
|
|
92
|
+
/** Additional className for the trigger wrapper. */
|
|
93
|
+
className?: string;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Live-collaboration status chip: a connection dot, a `Live` / `Connecting…`
|
|
97
|
+
* label, a summary of who else is editing, and a click-to-open panel with the
|
|
98
|
+
* room identity, who is in the room, and a rolling log of collaboration
|
|
99
|
+
* events. Pass `compact` to shrink the trigger down to the dot alone, and
|
|
100
|
+
* `attention` to let an app condition ("Unsaved changes") share that dot.
|
|
101
|
+
*
|
|
102
|
+
* Transport-agnostic — it renders whatever presence state you hand it. For a
|
|
103
|
+
* Yjs (`y-websocket`) room, {@link useYjsCollabStatus} produces these props
|
|
104
|
+
* directly:
|
|
105
|
+
*
|
|
106
|
+
* @example
|
|
107
|
+
* ```tsx
|
|
108
|
+
* const doc = React.useMemo(() => new Y.Doc(), []);
|
|
109
|
+
* const provider = React.useMemo(
|
|
110
|
+
* () => new WebsocketProvider('ws://localhost:1234', 'case/4', doc),
|
|
111
|
+
* [doc]
|
|
112
|
+
* );
|
|
113
|
+
* const status = useYjsCollabStatus({ doc, provider, user: { name: 'Ann' } });
|
|
114
|
+
*
|
|
115
|
+
* return <CollabStatus {...status} />;
|
|
116
|
+
* ```
|
|
117
|
+
*/
|
|
118
|
+
declare function CollabStatus({ connected, peers, log, room, showLog, compact, attention, labels: labelOverrides, className, }: CollabStatusProps): react_jsx_runtime.JSX.Element;
|
|
119
|
+
|
|
120
|
+
/** The subset of `Y.Doc` this hook observes. */
|
|
121
|
+
interface YjsDocLike {
|
|
122
|
+
clientID: number;
|
|
123
|
+
on(event: string, handler: (...args: any[]) => void): void;
|
|
124
|
+
off(event: string, handler: (...args: any[]) => void): void;
|
|
125
|
+
}
|
|
126
|
+
/** The subset of `y-protocols/awareness`.`Awareness` this hook uses. */
|
|
127
|
+
interface YjsAwarenessLike {
|
|
128
|
+
clientID: number;
|
|
129
|
+
getStates(): Map<number, Record<string, any>>;
|
|
130
|
+
setLocalStateField(field: string, value: unknown): void;
|
|
131
|
+
on(event: string, handler: (...args: any[]) => void): void;
|
|
132
|
+
off(event: string, handler: (...args: any[]) => void): void;
|
|
133
|
+
}
|
|
134
|
+
/** The subset of `y-websocket`.`WebsocketProvider` this hook uses. */
|
|
135
|
+
interface YjsProviderLike {
|
|
136
|
+
awareness: YjsAwarenessLike;
|
|
137
|
+
/** True once the initial sync completed (y-websocket exposes this). */
|
|
138
|
+
synced?: boolean;
|
|
139
|
+
/** Room name, used as the default label in the debug panel. */
|
|
140
|
+
roomname?: string;
|
|
141
|
+
/** Server URL, used as the default label in the debug panel. */
|
|
142
|
+
url?: string;
|
|
143
|
+
on(event: string, handler: (...args: any[]) => void): void;
|
|
144
|
+
off(event: string, handler: (...args: any[]) => void): void;
|
|
145
|
+
}
|
|
146
|
+
/** A remote collaborator's edit that just changed the open document. */
|
|
147
|
+
interface CollabRemoteEdit {
|
|
148
|
+
/** Human-readable labels of the fields that changed. */
|
|
149
|
+
fields: string[];
|
|
150
|
+
/** Who made the change, when attributable from presence. */
|
|
151
|
+
by?: string;
|
|
152
|
+
/** Timestamp; a new value signals a fresh growl/toast. */
|
|
153
|
+
at: number;
|
|
154
|
+
}
|
|
155
|
+
interface UseYjsCollabStatusOptions {
|
|
156
|
+
/** The shared document. Pass null to keep the hook inert. */
|
|
157
|
+
doc: YjsDocLike | null | undefined;
|
|
158
|
+
/** The sync provider (e.g. `y-websocket`). Pass null to keep it inert. */
|
|
159
|
+
provider: YjsProviderLike | null | undefined;
|
|
160
|
+
/**
|
|
161
|
+
* Presence identity published for this window. Defaults to
|
|
162
|
+
* `User <clientID>` so windows are distinguishable without a login.
|
|
163
|
+
*/
|
|
164
|
+
user?: {
|
|
165
|
+
name?: string;
|
|
166
|
+
color?: string;
|
|
167
|
+
};
|
|
168
|
+
/** Room label for the debug panel. Defaults to `provider.roomname`. */
|
|
169
|
+
roomName?: string;
|
|
170
|
+
/** URL label for the debug panel. Defaults to `provider.url`. */
|
|
171
|
+
url?: string;
|
|
172
|
+
/** Application user id shown in the debug panel. */
|
|
173
|
+
userId?: string;
|
|
174
|
+
/** Maximum log entries kept in memory. Default 100. */
|
|
175
|
+
logCap?: number;
|
|
176
|
+
}
|
|
177
|
+
interface YjsCollabStatus {
|
|
178
|
+
/** True once the initial server sync completed. */
|
|
179
|
+
connected: boolean;
|
|
180
|
+
/** Other windows currently present in the room. */
|
|
181
|
+
peers: CollabPeer[];
|
|
182
|
+
/** Recent collaboration events, newest first. */
|
|
183
|
+
log: CollabLogEntry[];
|
|
184
|
+
/** Room identity for the debug panel. */
|
|
185
|
+
room: CollabRoomInfo | null;
|
|
186
|
+
/** The most recent remote edit, or null. */
|
|
187
|
+
lastRemoteEdit: CollabRemoteEdit | null;
|
|
188
|
+
/**
|
|
189
|
+
* Announce a local edit and the fields it touched, so other windows can
|
|
190
|
+
* attribute it. Also records a `patch` log entry.
|
|
191
|
+
*/
|
|
192
|
+
publishActivity: (fields: string[]) => void;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Bind {@link CollabStatus} to a Yjs room: tracks initial-sync state, publishes
|
|
196
|
+
* this window's presence, tracks peers joining/leaving, attributes remote edits,
|
|
197
|
+
* and keeps a capped log of document/awareness/sync events.
|
|
198
|
+
*
|
|
199
|
+
* The return value is spreadable straight into the component.
|
|
200
|
+
*
|
|
201
|
+
* @example
|
|
202
|
+
* ```tsx
|
|
203
|
+
* import * as Y from 'yjs';
|
|
204
|
+
* import { WebsocketProvider } from 'y-websocket';
|
|
205
|
+
* import { CollabStatus, useYjsCollabStatus } from '@mieweb/ui';
|
|
206
|
+
*
|
|
207
|
+
* function Header({ caseId }: { caseId: string }) {
|
|
208
|
+
* const doc = React.useMemo(() => new Y.Doc(), []);
|
|
209
|
+
* const provider = React.useMemo(
|
|
210
|
+
* () => new WebsocketProvider('ws://localhost:1234', `case/${caseId}`, doc),
|
|
211
|
+
* [doc, caseId]
|
|
212
|
+
* );
|
|
213
|
+
* React.useEffect(() => () => provider.destroy(), [provider]);
|
|
214
|
+
*
|
|
215
|
+
* const status = useYjsCollabStatus({ doc, provider, user: { name: 'Ann' } });
|
|
216
|
+
* return <CollabStatus {...status} />;
|
|
217
|
+
* }
|
|
218
|
+
* ```
|
|
219
|
+
*/
|
|
220
|
+
declare function useYjsCollabStatus({ doc, provider, user, roomName, url, userId, logCap, }: UseYjsCollabStatusOptions): YjsCollabStatus;
|
|
221
|
+
|
|
222
|
+
export { type CollabLogEntry, type CollabLogKind, type CollabPeer, type CollabRemoteEdit, type CollabRoomInfo, CollabStatus, type CollabStatusLabels, type CollabStatusProps, type UseYjsCollabStatusOptions, type YjsAwarenessLike, type YjsCollabStatus, type YjsDocLike, type YjsProviderLike, defaultCollabStatusLabels, useYjsCollabStatus };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk5M2YSPJH_cjs = require('../../chunk-5M2YSPJH.cjs');
|
|
4
4
|
require('../../chunk-GOKC4CCZ.cjs');
|
|
5
5
|
require('../../chunk-BYUV3IZV.cjs');
|
|
6
6
|
require('../../chunk-DFCZPVG4.cjs');
|
|
@@ -8,7 +8,7 @@ require('../../chunk-DAPZPT5N.cjs');
|
|
|
8
8
|
require('../../chunk-KJPOFUF5.cjs');
|
|
9
9
|
require('../../chunk-MSRU3XBH.cjs');
|
|
10
10
|
require('../../chunk-A2QVQF54.cjs');
|
|
11
|
-
require('../../chunk-
|
|
11
|
+
require('../../chunk-NPKPCYAT.cjs');
|
|
12
12
|
require('../../chunk-NUFUV43P.cjs');
|
|
13
13
|
require('../../chunk-JYZW2PZS.cjs');
|
|
14
14
|
require('../../chunk-NNEFAUHV.cjs');
|
|
@@ -22,23 +22,23 @@ require('../../chunk-SCV7C55E.cjs');
|
|
|
22
22
|
|
|
23
23
|
Object.defineProperty(exports, "FillerWordsModal", {
|
|
24
24
|
enumerable: true,
|
|
25
|
-
get: function () { return
|
|
25
|
+
get: function () { return chunk5M2YSPJH_cjs.FillerWordsModal; }
|
|
26
26
|
});
|
|
27
27
|
Object.defineProperty(exports, "MediaEditor", {
|
|
28
28
|
enumerable: true,
|
|
29
|
-
get: function () { return
|
|
29
|
+
get: function () { return chunk5M2YSPJH_cjs.MediaEditor; }
|
|
30
30
|
});
|
|
31
31
|
Object.defineProperty(exports, "SilenceSettingsModal", {
|
|
32
32
|
enumerable: true,
|
|
33
|
-
get: function () { return
|
|
33
|
+
get: function () { return chunk5M2YSPJH_cjs.SilenceSettingsModal; }
|
|
34
34
|
});
|
|
35
35
|
Object.defineProperty(exports, "SpeedMarkerMenu", {
|
|
36
36
|
enumerable: true,
|
|
37
|
-
get: function () { return
|
|
37
|
+
get: function () { return chunk5M2YSPJH_cjs.SpeedMarkerMenu; }
|
|
38
38
|
});
|
|
39
39
|
Object.defineProperty(exports, "WordEditorModal", {
|
|
40
40
|
enumerable: true,
|
|
41
|
-
get: function () { return
|
|
41
|
+
get: function () { return chunk5M2YSPJH_cjs.WordEditorModal; }
|
|
42
42
|
});
|
|
43
43
|
//# sourceMappingURL=index.cjs.map
|
|
44
44
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -3,7 +3,7 @@ import * as React from 'react';
|
|
|
3
3
|
import { VariantProps } from 'class-variance-authority';
|
|
4
4
|
import { T as Transcript, E as EditableWord, S as SpeedMarker, P as PlaybackSpeed } from '../../transcript-Cg7uSW-C.cjs';
|
|
5
5
|
import { MediaKind, MediaPlayerRef } from '../MediaPlayer/index.cjs';
|
|
6
|
-
import { S as SilenceThresholdCount } from '../../useTranscriptEdits-
|
|
6
|
+
import { S as SilenceThresholdCount } from '../../useTranscriptEdits-CGzlemHT.cjs';
|
|
7
7
|
|
|
8
8
|
interface MediaEditorProps extends VariantProps<typeof mediaEditorVariants> {
|
|
9
9
|
/** Media URL */
|
|
@@ -34,6 +34,29 @@ interface MediaEditorProps extends VariantProps<typeof mediaEditorVariants> {
|
|
|
34
34
|
onCursorTimestampChange?: (timestampMs: number | null) => void;
|
|
35
35
|
/** Fired whenever the edited words change — lets the host build raw-data views */
|
|
36
36
|
onEditedWordsRender?: (editedWords: EditableWord[]) => void;
|
|
37
|
+
/**
|
|
38
|
+
* Undo beyond the editor's own history.
|
|
39
|
+
*
|
|
40
|
+
* The editor's undo is word-level, which is the right grain for typing and
|
|
41
|
+
* the wrong one for a host that also versions the document — undoing a batch
|
|
42
|
+
* change one word at a time is not undoing it. When a host provides this, the
|
|
43
|
+
* Undo control stays available once the editor's own stack is empty and hands
|
|
44
|
+
* over instead of going dead, so there is one Undo rather than two.
|
|
45
|
+
*/
|
|
46
|
+
onUndoBeyond?: () => void;
|
|
47
|
+
/** Whether the host has anything left to undo. Keeps Undo live at depth 0. */
|
|
48
|
+
canUndoBeyond?: boolean;
|
|
49
|
+
/** What `onUndoBeyond` would undo, for the tooltip (e.g. a version name). */
|
|
50
|
+
undoBeyondLabel?: string;
|
|
51
|
+
/**
|
|
52
|
+
* Redo beyond the editor's own history — the counterpart to `onUndoBeyond`.
|
|
53
|
+
* The editor redoes its own word-level steps first and only calls this once
|
|
54
|
+
* they are exhausted, so the pair walks the same states in both directions.
|
|
55
|
+
*/
|
|
56
|
+
onRedo?: () => void;
|
|
57
|
+
canRedo?: boolean;
|
|
58
|
+
/** What `onRedo` would redo, for the tooltip. */
|
|
59
|
+
redoLabel?: string;
|
|
37
60
|
/** Optional ref to the internal MediaPlayer (host escape hatch, e.g. thumbnail capture) */
|
|
38
61
|
playerRef?: React.Ref<MediaPlayerRef>;
|
|
39
62
|
/** Additional class name */
|
|
@@ -3,7 +3,7 @@ import * as React from 'react';
|
|
|
3
3
|
import { VariantProps } from 'class-variance-authority';
|
|
4
4
|
import { T as Transcript, E as EditableWord, S as SpeedMarker, P as PlaybackSpeed } from '../../transcript-Cg7uSW-C.js';
|
|
5
5
|
import { MediaKind, MediaPlayerRef } from '../MediaPlayer/index.js';
|
|
6
|
-
import { S as SilenceThresholdCount } from '../../useTranscriptEdits-
|
|
6
|
+
import { S as SilenceThresholdCount } from '../../useTranscriptEdits-D32bLs0l.js';
|
|
7
7
|
|
|
8
8
|
interface MediaEditorProps extends VariantProps<typeof mediaEditorVariants> {
|
|
9
9
|
/** Media URL */
|
|
@@ -34,6 +34,29 @@ interface MediaEditorProps extends VariantProps<typeof mediaEditorVariants> {
|
|
|
34
34
|
onCursorTimestampChange?: (timestampMs: number | null) => void;
|
|
35
35
|
/** Fired whenever the edited words change — lets the host build raw-data views */
|
|
36
36
|
onEditedWordsRender?: (editedWords: EditableWord[]) => void;
|
|
37
|
+
/**
|
|
38
|
+
* Undo beyond the editor's own history.
|
|
39
|
+
*
|
|
40
|
+
* The editor's undo is word-level, which is the right grain for typing and
|
|
41
|
+
* the wrong one for a host that also versions the document — undoing a batch
|
|
42
|
+
* change one word at a time is not undoing it. When a host provides this, the
|
|
43
|
+
* Undo control stays available once the editor's own stack is empty and hands
|
|
44
|
+
* over instead of going dead, so there is one Undo rather than two.
|
|
45
|
+
*/
|
|
46
|
+
onUndoBeyond?: () => void;
|
|
47
|
+
/** Whether the host has anything left to undo. Keeps Undo live at depth 0. */
|
|
48
|
+
canUndoBeyond?: boolean;
|
|
49
|
+
/** What `onUndoBeyond` would undo, for the tooltip (e.g. a version name). */
|
|
50
|
+
undoBeyondLabel?: string;
|
|
51
|
+
/**
|
|
52
|
+
* Redo beyond the editor's own history — the counterpart to `onUndoBeyond`.
|
|
53
|
+
* The editor redoes its own word-level steps first and only calls this once
|
|
54
|
+
* they are exhausted, so the pair walks the same states in both directions.
|
|
55
|
+
*/
|
|
56
|
+
onRedo?: () => void;
|
|
57
|
+
canRedo?: boolean;
|
|
58
|
+
/** What `onRedo` would redo, for the tooltip. */
|
|
59
|
+
redoLabel?: string;
|
|
37
60
|
/** Optional ref to the internal MediaPlayer (host escape hatch, e.g. thumbnail capture) */
|
|
38
61
|
playerRef?: React.Ref<MediaPlayerRef>;
|
|
39
62
|
/** Additional class name */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { FillerWordsModal, MediaEditor, SilenceSettingsModal, SpeedMarkerMenu, WordEditorModal } from '../../chunk-
|
|
1
|
+
export { FillerWordsModal, MediaEditor, SilenceSettingsModal, SpeedMarkerMenu, WordEditorModal } from '../../chunk-GOAW2UCP.js';
|
|
2
2
|
import '../../chunk-JBB25LFB.js';
|
|
3
3
|
import '../../chunk-KOCTIB6U.js';
|
|
4
4
|
import '../../chunk-XCLQZ4FV.js';
|
|
@@ -6,7 +6,7 @@ import '../../chunk-J7Z7467B.js';
|
|
|
6
6
|
import '../../chunk-IUFDGB5O.js';
|
|
7
7
|
import '../../chunk-PVUDXJAI.js';
|
|
8
8
|
import '../../chunk-ZVSW2KS6.js';
|
|
9
|
-
import '../../chunk-
|
|
9
|
+
import '../../chunk-UUI7WXI5.js';
|
|
10
10
|
import '../../chunk-6CGM5H4J.js';
|
|
11
11
|
import '../../chunk-SQHMGT4W.js';
|
|
12
12
|
import '../../chunk-4SMSH4OY.js';
|
package/dist/hooks/index.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var chunk4GXECTPS_cjs = require('../chunk-4GXECTPS.cjs');
|
|
4
4
|
var chunk2O7D6F67_cjs = require('../chunk-2O7D6F67.cjs');
|
|
5
|
-
var
|
|
5
|
+
var chunkNPKPCYAT_cjs = require('../chunk-NPKPCYAT.cjs');
|
|
6
6
|
require('../chunk-NUFUV43P.cjs');
|
|
7
7
|
var chunkJYZW2PZS_cjs = require('../chunk-JYZW2PZS.cjs');
|
|
8
8
|
var chunkYVPC65ZJ_cjs = require('../chunk-YVPC65ZJ.cjs');
|
|
@@ -61,35 +61,35 @@ Object.defineProperty(exports, "useTheme", {
|
|
|
61
61
|
});
|
|
62
62
|
Object.defineProperty(exports, "DEFAULT_FILLER_WORDS", {
|
|
63
63
|
enumerable: true,
|
|
64
|
-
get: function () { return
|
|
64
|
+
get: function () { return chunkNPKPCYAT_cjs.DEFAULT_FILLER_WORDS; }
|
|
65
65
|
});
|
|
66
66
|
Object.defineProperty(exports, "DEFAULT_MIN_SILENCE_MS", {
|
|
67
67
|
enumerable: true,
|
|
68
|
-
get: function () { return
|
|
68
|
+
get: function () { return chunkNPKPCYAT_cjs.DEFAULT_MIN_SILENCE_MS; }
|
|
69
69
|
});
|
|
70
70
|
Object.defineProperty(exports, "DEFAULT_NL_SILENCE_MS", {
|
|
71
71
|
enumerable: true,
|
|
72
|
-
get: function () { return
|
|
72
|
+
get: function () { return chunkNPKPCYAT_cjs.DEFAULT_NL_SILENCE_MS; }
|
|
73
73
|
});
|
|
74
74
|
Object.defineProperty(exports, "buildPlaybackSegments", {
|
|
75
75
|
enumerable: true,
|
|
76
|
-
get: function () { return
|
|
76
|
+
get: function () { return chunkNPKPCYAT_cjs.buildPlaybackSegments; }
|
|
77
77
|
});
|
|
78
78
|
Object.defineProperty(exports, "getSpeedAtIndex", {
|
|
79
79
|
enumerable: true,
|
|
80
|
-
get: function () { return
|
|
80
|
+
get: function () { return chunkNPKPCYAT_cjs.getSpeedAtIndex; }
|
|
81
81
|
});
|
|
82
82
|
Object.defineProperty(exports, "initEditableWords", {
|
|
83
83
|
enumerable: true,
|
|
84
|
-
get: function () { return
|
|
84
|
+
get: function () { return chunkNPKPCYAT_cjs.initEditableWords; }
|
|
85
85
|
});
|
|
86
86
|
Object.defineProperty(exports, "insertSilences", {
|
|
87
87
|
enumerable: true,
|
|
88
|
-
get: function () { return
|
|
88
|
+
get: function () { return chunkNPKPCYAT_cjs.insertSilences; }
|
|
89
89
|
});
|
|
90
90
|
Object.defineProperty(exports, "useTranscriptEdits", {
|
|
91
91
|
enumerable: true,
|
|
92
|
-
get: function () { return
|
|
92
|
+
get: function () { return chunkNPKPCYAT_cjs.useTranscriptEdits; }
|
|
93
93
|
});
|
|
94
94
|
Object.defineProperty(exports, "useMediaTransport", {
|
|
95
95
|
enumerable: true,
|
package/dist/hooks/index.d.cts
CHANGED
|
@@ -2,7 +2,7 @@ export { R as ResolvedTheme, T as Theme, u as useTheme } from '../useTheme-B9SWu
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { RefObject } from 'react';
|
|
4
4
|
export { A as AnchoredPlacement, U as UseAnchoredPositionOptions, a as UseAnchoredPositionReturn, u as useAnchoredPosition } from '../useAnchoredPosition-nXdSFKHf.cjs';
|
|
5
|
-
export { D as DEFAULT_FILLER_WORDS, a as DEFAULT_MIN_SILENCE_MS, b as DEFAULT_NL_SILENCE_MS, F as FillerAnalysis, S as SilenceThresholdCount, T as TranscriptClipboard, c as TranscriptEditStats, U as UseTranscriptEditsOptions, d as UseTranscriptEditsResult, e as buildPlaybackSegments, g as getSpeedAtIndex, i as initEditableWords, f as insertSilences, u as useTranscriptEdits } from '../useTranscriptEdits-
|
|
5
|
+
export { D as DEFAULT_FILLER_WORDS, a as DEFAULT_MIN_SILENCE_MS, b as DEFAULT_NL_SILENCE_MS, F as FillerAnalysis, S as SilenceThresholdCount, T as TranscriptClipboard, c as TranscriptEditStats, U as UseTranscriptEditsOptions, d as UseTranscriptEditsResult, e as buildPlaybackSegments, g as getSpeedAtIndex, i as initEditableWords, f as insertSilences, u as useTranscriptEdits } from '../useTranscriptEdits-CGzlemHT.cjs';
|
|
6
6
|
import '../transcript-Cg7uSW-C.cjs';
|
|
7
7
|
|
|
8
8
|
interface UseScrollSpyOptions {
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export { R as ResolvedTheme, T as Theme, u as useTheme } from '../useTheme-B9SWu
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { RefObject } from 'react';
|
|
4
4
|
export { A as AnchoredPlacement, U as UseAnchoredPositionOptions, a as UseAnchoredPositionReturn, u as useAnchoredPosition } from '../useAnchoredPosition-nXdSFKHf.js';
|
|
5
|
-
export { D as DEFAULT_FILLER_WORDS, a as DEFAULT_MIN_SILENCE_MS, b as DEFAULT_NL_SILENCE_MS, F as FillerAnalysis, S as SilenceThresholdCount, T as TranscriptClipboard, c as TranscriptEditStats, U as UseTranscriptEditsOptions, d as UseTranscriptEditsResult, e as buildPlaybackSegments, g as getSpeedAtIndex, i as initEditableWords, f as insertSilences, u as useTranscriptEdits } from '../useTranscriptEdits-
|
|
5
|
+
export { D as DEFAULT_FILLER_WORDS, a as DEFAULT_MIN_SILENCE_MS, b as DEFAULT_NL_SILENCE_MS, F as FillerAnalysis, S as SilenceThresholdCount, T as TranscriptClipboard, c as TranscriptEditStats, U as UseTranscriptEditsOptions, d as UseTranscriptEditsResult, e as buildPlaybackSegments, g as getSpeedAtIndex, i as initEditableWords, f as insertSilences, u as useTranscriptEdits } from '../useTranscriptEdits-D32bLs0l.js';
|
|
6
6
|
import '../transcript-Cg7uSW-C.js';
|
|
7
7
|
|
|
8
8
|
interface UseScrollSpyOptions {
|