documint 0.0.1 → 0.0.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.
Files changed (3) hide show
  1. package/dist/index.d.ts +42 -30
  2. package/dist/index.js +810 -738
  3. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -105,17 +105,7 @@ export type Anchor = {
105
105
  prefix?: string;
106
106
  suffix?: string;
107
107
  };
108
- export type Presence = {
109
- color?: string;
110
- cursor?: Anchor;
111
- imageUrl?: string;
112
- name: string;
113
- };
114
- /**
115
- * Canvas render themes for the editor surface. These tokens are intentionally
116
- * semantic so paint code can stay focused on structure rather than color
117
- * decisions.
118
- */
108
+ type EditorCommand = "dedent" | "deleteBackward" | "indent" | "insertLineBreak" | "moveListItemDown" | "moveListItemUp" | "moveToDocumentEnd" | "moveToDocumentStart" | "moveToLineEnd" | "moveToLineStart" | "redo" | "selectAll" | "toggleBold" | "toggleInlineCode" | "toggleItalic" | "toggleStrikethrough" | "toggleUnderline" | "undo";
119
109
  export type EditorTheme = {
120
110
  activeBlockBackground: string;
121
111
  activeBlockFlash: string;
@@ -158,6 +148,8 @@ export type EditorTheme = {
158
148
  leafText: string;
159
149
  linkText: string;
160
150
  listMarkerText: string;
151
+ mentionBackground?: string;
152
+ mentionText?: string;
161
153
  paddingX: number;
162
154
  paddingY: number;
163
155
  paragraphText: string;
@@ -168,7 +160,30 @@ export type EditorTheme = {
168
160
  tableBorder: string;
169
161
  tableHeaderBackground: string;
170
162
  };
171
- type EditorCommand = "dedent" | "deleteBackward" | "indent" | "insertLineBreak" | "moveListItemDown" | "moveListItemUp" | "moveToLineEnd" | "moveToLineStart" | "redo" | "toggleBold" | "toggleInlineCode" | "toggleItalic" | "toggleStrikethrough" | "toggleUnderline" | "undo";
163
+ /**
164
+ * A user known to the host. The full set is the mention roster; the subset
165
+ * that also appears in `presence` shows a live cursor in the document.
166
+ */
167
+ export type DocumentUser = {
168
+ id: string;
169
+ username: string;
170
+ fullName?: string;
171
+ avatarUrl?: string;
172
+ };
173
+ /**
174
+ * One user's live cursor in the document. `userId` foreign-keys into the
175
+ * `users` roster; entries without a matching user are silently dropped.
176
+ *
177
+ * `cursor` is a content-addressable anchor (prefix/suffix). The editor
178
+ * resolves it against the current document; if the anchor matches zero or
179
+ * more than one place, the cursor is treated as unresolved and rendered as
180
+ * an "unknown location" indicator rather than guessed.
181
+ */
182
+ export type DocumentPresence = {
183
+ userId: string;
184
+ cursor?: Anchor;
185
+ color?: string;
186
+ };
172
187
  export type EditorKeybinding = {
173
188
  altKey?: boolean;
174
189
  command: EditorCommand;
@@ -177,6 +192,20 @@ export type EditorKeybinding = {
177
192
  shiftKey?: boolean | "any";
178
193
  };
179
194
  export declare const defaultKeybindings: EditorKeybinding[];
195
+ export type DocumintProps = {
196
+ content: string;
197
+ className?: string;
198
+ theme?: DocumintTheme;
199
+ keybindings?: EditorKeybinding[];
200
+ presence?: DocumentPresence[];
201
+ users?: DocumentUser[];
202
+ onContentChange?: (content: string, document: Document$1) => void;
203
+ onStateChange?: (state: DocumintState) => void;
204
+ };
205
+ export type DocumintTheme = EditorTheme | {
206
+ dark: EditorTheme;
207
+ light: EditorTheme;
208
+ };
180
209
  export type DocumintState = {
181
210
  activeBlockType: string | null;
182
211
  activeCommentThreadIndex: number | null;
@@ -184,29 +213,12 @@ export type DocumintState = {
184
213
  canonicalContent: string;
185
214
  characterCount: number;
186
215
  commentThreadCount: number;
187
- docChangeCount: number;
188
- lastTransactionMs: number;
189
216
  layoutWidth: number;
190
- lineCount: number;
191
217
  resolvedCommentCount: number;
192
218
  selectionFrom: number;
193
219
  selectionTo: number;
194
- transactionCount: number;
195
- };
196
- export type DocumintTheme = EditorTheme | {
197
- dark: EditorTheme;
198
- light: EditorTheme;
199
- };
200
- export type DocumintProps = {
201
- className?: string;
202
- content: string;
203
- keybindings?: EditorKeybinding[];
204
- onContentChange?: (content: string, document: Document$1) => void;
205
- onStateChange?: (state: DocumintState) => void;
206
- presence?: Presence[];
207
- theme?: DocumintTheme;
208
220
  };
209
- export declare function Documint({ className, content, keybindings, onContentChange, onStateChange, presence, theme, }: DocumintProps): import("react/jsx-runtime").JSX.Element;
221
+ export declare function Documint({ className, content, keybindings, onContentChange, onStateChange, presence, theme, users, }: DocumintProps): import("react/jsx-runtime").JSX.Element;
210
222
  export declare const lightTheme: EditorTheme;
211
223
  export declare const darkTheme: EditorTheme;
212
224
  export declare const mintTheme: EditorTheme;