@fileverse-dev/ddoc 4.2.0-durability-8 → 4.2.0-yjs-dedupe-1

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 (45) hide show
  1. package/dist/{index-DU1L3PC_.mjs → index-BfVM4ukb.mjs} +1 -1
  2. package/dist/{index-BSWmSm-6.mjs → index-DYlSDaET.mjs} +49123 -49943
  3. package/dist/index.d.ts +0 -4
  4. package/dist/index.es.js +5 -8
  5. package/dist/{markdown-source-pane-BscaPxrM.mjs → markdown-source-pane-ve9MJKFE.mjs} +2 -2
  6. package/dist/package/components/editor-bubble-menu/types.d.ts +1 -0
  7. package/dist/package/components/editor-utils.d.ts +25 -1
  8. package/dist/package/components/inline-comment/comment-drawer-desktop.d.ts +2 -1
  9. package/dist/package/components/inline-comment/comment-drawer-mobile.d.ts +2 -1
  10. package/dist/package/components/inline-comment/comment-drawer.d.ts +1 -1
  11. package/dist/package/components/inline-comment/comment-input-field.d.ts +2 -1
  12. package/dist/package/components/inline-comment/comment-reply-input.d.ts +2 -1
  13. package/dist/package/components/inline-comment/comment-section.d.ts +1 -1
  14. package/dist/package/components/inline-comment/floating-comment/comment-floating-container.d.ts +1 -1
  15. package/dist/package/components/inline-comment/floating-comment/suggestion-thread-floating-card.d.ts +1 -1
  16. package/dist/package/components/inline-comment/floating-comment/thread-floating-card.d.ts +1 -1
  17. package/dist/package/components/inline-comment/floating-comment/types.d.ts +2 -0
  18. package/dist/package/components/inline-comment/types.d.ts +2 -0
  19. package/dist/package/components/split-view/split-view-markdown-pane.d.ts +1 -3
  20. package/dist/package/extensions/mardown-paste-handler/index.d.ts +0 -6
  21. package/dist/package/hooks/use-focus-mode.d.ts +1 -6
  22. package/dist/package/hooks/use-headless-editor.d.ts +1 -9
  23. package/dist/package/hooks/use-tab-editor.d.ts +3 -3
  24. package/dist/package/hooks/use-yjs-setup.d.ts +1 -7
  25. package/dist/package/stores/comment-store-provider.d.ts +1 -3
  26. package/dist/package/stores/comment-store.d.ts +0 -15
  27. package/dist/package/sync-local/SyncManager.d.ts +7 -30
  28. package/dist/package/sync-local/socketClient.d.ts +8 -55
  29. package/dist/package/sync-local/types/index.d.ts +11 -82
  30. package/dist/package/sync-local/useSyncManager.d.ts +0 -4
  31. package/dist/package/types.d.ts +2 -20
  32. package/dist/package/use-ddoc-editor.d.ts +0 -5
  33. package/dist/package/utils/colors.d.ts +0 -1
  34. package/dist/{split-view-toolbar-PQWTjOnQ.mjs → split-view-toolbar-8avjvjIR.mjs} +2 -2
  35. package/dist/style.css +1 -1
  36. package/package.json +4 -3
  37. package/dist/package/components/split-view/split-view-css-accordion.d.ts +0 -13
  38. package/dist/package/hooks/use-editor-commands.d.ts +0 -20
  39. package/dist/package/sync-local/floor.d.ts +0 -6
  40. package/dist/package/sync-local/presence.d.ts +0 -11
  41. package/dist/package/utils/insert-commands.d.ts +0 -20
  42. package/dist/package/utils/make-editor.d.ts +0 -9
  43. package/dist/package/utils/sanitize-css.d.ts +0 -45
  44. package/dist/package/utils/selection-utils.d.ts +0 -35
  45. package/dist/package/utils/typography.d.ts +0 -26
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@fileverse-dev/ddoc",
3
3
  "private": false,
4
4
  "description": "DDoc",
5
- "version": "4.2.0-durability-8",
5
+ "version": "4.2.0-yjs-dedupe-1",
6
6
  "main": "dist/index.es.js",
7
7
  "module": "dist/index.es.js",
8
8
  "exports": {
@@ -121,7 +121,6 @@
121
121
  "y-indexeddb": "^9.0.12",
122
122
  "y-prosemirror": "^1.2.5",
123
123
  "y-protocols": "^1.0.6",
124
- "yjs": "^13.6.15",
125
124
  "zustand": "^5.0.12"
126
125
  },
127
126
  "peerDependencies": {
@@ -134,6 +133,7 @@
134
133
  "framer-motion": ">=11.2.10",
135
134
  "frimousse": ">=0.3.0",
136
135
  "mermaid": "11.14.0",
136
+ "yjs": ">=13.6.30 <14",
137
137
  "viem": ">=2.35.0"
138
138
  },
139
139
  "devDependencies": {
@@ -164,6 +164,7 @@
164
164
  "tailwindcss": "^3.4.3",
165
165
  "typescript": "^5.2.2",
166
166
  "vite": "^5.0.0",
167
- "vitest": "^2.1.0"
167
+ "vitest": "^2.1.0",
168
+ "yjs": "13.6.30"
168
169
  }
169
170
  }
@@ -1,13 +0,0 @@
1
- interface SplitViewCssAccordionProps {
2
- /** The document's custom CSS (raw author selectors). */
3
- customCSS?: string;
4
- }
5
- /**
6
- * Split View LEFT pane: a collapsible, READ-ONLY view of the document's custom
7
- * CSS, shown above the markdown source. Custom CSS is edited in the styling
8
- * palette (the single source of truth), not in the markdown pane — this is a
9
- * transparency affordance so the author can see what CSS is applied while in
10
- * markdown mode. Renders nothing when there is no custom CSS.
11
- */
12
- export declare const SplitViewCssAccordion: ({ customCSS, }: SplitViewCssAccordionProps) => import("react/jsx-runtime").JSX.Element | null;
13
- export {};
@@ -1,20 +0,0 @@
1
- import { Editor } from '@tiptap/react';
2
- import { UploadImageOptions } from '../utils/insert-commands';
3
-
4
- export type EditorCommand = {
5
- run: (arg?: string) => void;
6
- isActive?: boolean;
7
- isEnabled: boolean;
8
- current?: string | null;
9
- };
10
- export type EditorCommandId = 'edit.undo' | 'edit.redo' | 'edit.selectAll' | 'edit.cut' | 'edit.copy' | 'edit.paste' | 'edit.pasteWithoutFormatting' | 'edit.delete' | 'edit.findReplace' | 'insert.image' | 'insert.table' | 'insert.link' | 'insert.comment' | 'insert.callout' | 'insert.quote' | 'insert.code' | 'insert.codeBlock' | 'insert.video' | 'insert.mermaid' | 'insert.plainText' | 'insert.tweet' | 'insert.soundcloud' | 'insert.divider' | 'insert.pageBreak' | 'insert.columns2' | 'insert.columns3' | 'format.bold' | 'format.italic' | 'format.underline' | 'format.strike' | 'format.superscript' | 'format.subscript' | 'format.heading' | 'format.align' | 'format.direction' | 'format.lineHeight' | 'format.fontFamily' | 'format.fontSize.increase' | 'format.fontSize.decrease' | 'format.list.bullet' | 'format.list.numbered' | 'format.list.check' | 'format.clearFormatting' | 'table.addRowAbove' | 'table.addRowBelow' | 'table.mergeCells' | 'table.deleteRow' | 'table.addColumnLeft' | 'table.addColumnRight' | 'table.deleteColumn' | 'table.toggleHeaderRow' | 'table.toggleHeaderColumn' | 'table.toggleHeaderCell' | 'table.deleteTable';
11
- export type UseEditorCommandsOptions = UploadImageOptions;
12
- /**
13
- * Reactive, editor-derived command registry (architecture doc §2 bucket 1).
14
- * INVARIANT: all isActive/current/isEnabled values are derived from the
15
- * editor via `useEditorState` (Tiptap's useSyncExternalStore wrapper) — the
16
- * hook holds no authoritative state of its own, so any number of instances
17
- * stay in sync, and consumers only re-render when a derived value changes
18
- * (deep-equality gated), not on every transaction.
19
- */
20
- export declare const useEditorCommands: (editor: Editor | null, options?: UseEditorCommandsOptions) => Record<EditorCommandId, EditorCommand>;
@@ -1,6 +0,0 @@
1
- export declare function advanceFloor(floor: number, pageSeqsAscending: number[]): number;
2
- export declare function shouldAuthorSnapshot(p: {
3
- isOwner: boolean;
4
- updatesSinceLastSnapshot: number;
5
- threshold: number;
6
- }): boolean;
@@ -1,11 +0,0 @@
1
- import { IDocCollabUsers } from '../types';
2
-
3
- export interface AwarenessIdentity {
4
- name: string;
5
- color: string;
6
- isEns: string | boolean;
7
- }
8
- export declare const PLACEHOLDER_COLOR = "#9CA3AF";
9
- export declare function buildIdentityMap(states: Map<number, Record<string, unknown>>): Map<string, AwarenessIdentity>;
10
- export declare function mergePresence(roomMembers: string[], identityBySocketId: Map<string, AwarenessIdentity>): IDocCollabUsers[];
11
- export declare function identitySignature(roomMembers: string[], identityBySocketId: Map<string, AwarenessIdentity>): string;
@@ -1,20 +0,0 @@
1
- import { Editor, Range } from '@tiptap/core';
2
- import { IpfsImageUploadResponse } from '../types';
3
-
4
- type InsertCommand = (editor: Editor, range?: Range) => void;
5
- export type UploadImageOptions = {
6
- onError?: (errorString: string) => void;
7
- ipfsImageUploadFn?: (file: File) => Promise<IpfsImageUploadResponse>;
8
- };
9
- /**
10
- * File-picker image upload — mirrors the toolbar flow
11
- * (editor-utils.tsx "Upload Image") and the slash "Image" item.
12
- */
13
- export declare const uploadImageCommand: (editor: Editor, { onError, ipfsImageUploadFn }?: UploadImageOptions) => void;
14
- /**
15
- * Insert commands shared by the slash menu and `useEditorCommands`.
16
- * Bodies are moved verbatim from `slash-command-utils.tsx`; the optional
17
- * `range` only differs when invoked from the slash menu.
18
- */
19
- export declare const insertCommands: Record<string, InsertCommand>;
20
- export {};
@@ -1,9 +0,0 @@
1
- import { Editor } from '@tiptap/react';
2
-
3
- /**
4
- * Shared jsdom editor factory for unit tests (use-editor-commands.test.tsx,
5
- * selection-utils.test.ts, ...). Collaboration owns the doc, so content must
6
- * be set via `setContent` *after* construction — passing `content` to the
7
- * `Editor` constructor is silently ignored once Collaboration is configured.
8
- */
9
- export declare const makeEditor: (content?: string) => Editor;
@@ -1,45 +0,0 @@
1
- /**
2
- * Sanitize + scope + validate author-supplied custom CSS before it is injected
3
- * into the document.
4
- *
5
- * Authors write **normal, full-page CSS** — `body { … }`, `html body h1 { … }`,
6
- * `h1 { … }`, `* { … }` — the way they'd style any web page. We transparently
7
- * scope every rule to the document so it can't leak into the app, AND we map the
8
- * page-root selectors (`html`, `body`, `:root`) onto the document root so that
9
- * `body { background: … }` styles the doc surface and `html body h1 { … }`
10
- * styles the doc's headings. No `.ProseMirror` prefix, no learning curve.
11
- *
12
- * Because the raw string reaches VIEWERS of a published doc, it is untrusted.
13
- * Every selector is force-scoped (so a `}` breakout is neutralised — the escaped
14
- * rule is simply scoped too), and dangerous declarations are stripped:
15
- * - external resource loads / exfiltration: `url(…)`, `@import`;
16
- * - clickjacking / UI redressing: `position: fixed | sticky`;
17
- * - legacy script vectors: `expression()`, `-moz-binding`, `behavior:`.
18
- *
19
- * We parse with the browser's own CSS engine (no dependency), rewrite each
20
- * selector, strip dangerous declarations at every nesting level, and let the
21
- * engine re-serialise — so the output is always a valid, balanced stylesheet.
22
- *
23
- * The sanitizer knows exactly what it removed, so it returns non-blocking
24
- * `diagnostics`; the editing UI surfaces them (CSS is forgiving — we warn,
25
- * never block).
26
- */
27
- export interface CssDiagnostic {
28
- level: 'warning' | 'error';
29
- message: string;
30
- }
31
- export interface CssValidationResult {
32
- /** Sanitized, scoped CSS, safe to inject. '' when nothing survives. */
33
- css: string;
34
- /** What was stripped/ignored, deduped. Empty when the CSS was fully clean. */
35
- diagnostics: CssDiagnostic[];
36
- }
37
- /**
38
- * Sanitize + scope AND report. Use this from the editing UI for diagnostics.
39
- */
40
- export declare const validateCustomCss: (raw: string | undefined | null, scope?: string) => CssValidationResult;
41
- /**
42
- * Sanitized + scoped CSS only — used at injection/export sinks that just need
43
- * the safe string. Diagnostics are surfaced separately via validateCustomCss.
44
- */
45
- export declare const sanitizeCustomCss: (raw: string | undefined | null, scope?: string) => string;
@@ -1,35 +0,0 @@
1
- import { Editor } from '@tiptap/core';
2
-
3
- /**
4
- * Cursor-relative word range in the current textblock, or null when the
5
- * cursor is not adjacent to a word character (whitespace runs, empty
6
- * blocks). Position math is relative ($from.start() + parentOffset), so it
7
- * is schema-agnostic (works under dBlock wrappers).
8
- */
9
- export declare const findWordRangeAtCursor: (editor: Editor) => {
10
- from: number;
11
- to: number;
12
- } | null;
13
- /**
14
- * Ensure a text target for anchored actions (inline comments): keep any
15
- * existing non-empty TextSelection; otherwise select the word under the
16
- * collapsed cursor. Shares findWordRangeAtCursor with enablement so
17
- * "enabled" always implies "dispatch does something".
18
- *
19
- * Only a TextSelection passes through untouched — a non-empty NodeSelection
20
- * (e.g. an image or horizontal rule selected as a node) looks "non-empty"
21
- * but has no text content, so `textBetween` over it is '' and anything
22
- * downstream that needs real text (e.g. createFloatingDraft) would silently
23
- * no-op. Falling through to findWordRangeAtCursor for any other selection
24
- * type gives either a legitimate adjacent word or null (schema-dependent —
25
- * e.g. false for a NodeSelection whose dBlock wrapper has no text).
26
- */
27
- export declare const selectWordAtCursor: (editor: Editor) => boolean;
28
- /**
29
- * Single enablement predicate for anchored text actions (inline comments):
30
- * true when there's already a non-empty TextSelection, or a word is
31
- * reachable from a collapsed cursor via findWordRangeAtCursor. Mirrors the
32
- * passthrough condition in selectWordAtCursor so "enabled" always implies
33
- * selectWordAtCursor will produce a real text target.
34
- */
35
- export declare const hasTextTargetAtSelection: (editor: Editor) => boolean;
@@ -1,26 +0,0 @@
1
- import { Editor } from '@tiptap/core';
2
-
3
- export declare const FONT_SIZES: readonly [8, 9, 10, 11, 12, 14, 16, 18, 24, 30, 32, 36, 48, 60, 72, 96];
4
- export declare const getFontSizeOptions: (editor?: Editor) => {
5
- title: string;
6
- value: string;
7
- label: string;
8
- command: (editor: Editor) => void;
9
- isActive: () => boolean | undefined;
10
- }[];
11
- export declare const getCurrentFontSize: (editor: Editor | null, currentSize: string) => string;
12
- export declare const uiValueToPercentage: (uiValue: string) => string;
13
- export declare const percentageToUiValue: (percentage: string) => string;
14
- export declare const LINE_HEIGHT_OPTIONS: {
15
- value: string;
16
- label: string;
17
- uiValue: string;
18
- description: string;
19
- }[];
20
- export declare const getLineHeightOptions: () => {
21
- value: string;
22
- label: string;
23
- uiValue: string;
24
- description: string;
25
- }[];
26
- export declare const getCurrentLineHeight: (editor: Editor | null, currentLineHeight?: string) => string;