@fileverse-dev/ddoc 5.1.3 → 5.1.4-small-feeds

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.
@@ -3,7 +3,7 @@ var Wr = (t, e, O) => e in t ? Vr(t, e, { enumerable: !0, configurable: !0, writ
3
3
  var gt = (t, e, O) => Wr(t, typeof e != "symbol" ? e + "" : e, O);
4
4
  import { jsx as Cr } from "react/jsx-runtime";
5
5
  import { useRef as pe, useEffect as St } from "react";
6
- import { s as y, A as pO, T as dO, a as Gr, S as et, b as Lr, P as fO, E as j, i as QO, c as _, D as le, k as tt, F as Ar, M as Pt, W as Er, R as Ur, d as mO, N as oe, e as V, f as Mr, g as Ot, h as ce, p as $O, j as Y, t as h, l as Ir, I as rt, L as at, m as ye, n as ue, o as Qe, q as gO, r as te, u as SO, v as Br, w as Nr, x as PO, y as kO, z as Dr, B as Fr, C as Kr, G as Oe, H as ZO, J as Jr, K as kt, O as Hr, Q as ea, U as ta, V as Oa, X as ra, Y as aa, Z as ia, _ as sa, $ as na, a0 as la, a1 as oa, a2 as ca } from "./index-sJxouaO8.mjs";
6
+ import { s as y, A as pO, T as dO, a as Gr, S as et, b as Lr, P as fO, E as j, i as QO, c as _, D as le, k as tt, F as Ar, M as Pt, W as Er, R as Ur, d as mO, N as oe, e as V, f as Mr, g as Ot, h as ce, p as $O, j as Y, t as h, l as Ir, I as rt, L as at, m as ye, n as ue, o as Qe, q as gO, r as te, u as SO, v as Br, w as Nr, x as PO, y as kO, z as Dr, B as Fr, C as Kr, G as Oe, H as ZO, J as Jr, K as kt, O as Hr, Q as ea, U as ta, V as Oa, X as ra, Y as aa, Z as ia, _ as sa, $ as na, a0 as la, a1 as oa, a2 as ca } from "./index-CapPoFVO.mjs";
7
7
  class ua {
8
8
  /**
9
9
  Create a new completion context. (Mostly useful for testing
@@ -1,21 +1,3 @@
1
1
  import { NodeSelectorProps } from './types';
2
- import { EditorState, Transaction } from 'prosemirror-state';
3
- import { Dispatch } from '@tiptap/react';
4
2
 
5
- interface ListConfig {
6
- type: 'bulletList' | 'orderedList' | 'taskList';
7
- itemType: 'listItem' | 'taskItem';
8
- hasAttrs?: boolean;
9
- }
10
- type ListConversionProps = {
11
- tr: Transaction;
12
- dispatch: Dispatch;
13
- state: EditorState;
14
- from: number;
15
- to: number;
16
- listConfig?: ListConfig;
17
- };
18
- export declare const convertListToParagraphs: ({ tr, dispatch, state, from, to, }: ListConversionProps) => boolean;
19
- export declare const convertToList: ({ tr, dispatch, state, from, to, listConfig, }: ListConversionProps) => boolean;
20
3
  export declare const NodeSelector: ({ editor, elementRef }: NodeSelectorProps) => import("react/jsx-runtime").JSX.Element;
21
- export {};
@@ -4,7 +4,7 @@ import { FontDescriptor, IpfsImageFetchPayload, IpfsImageUploadResponse } from '
4
4
  import { Tab } from './tabs/utils/tab-utils';
5
5
 
6
6
  import * as Y from 'yjs';
7
- declare const MemoizedTiptapToolBar: React.MemoExoticComponent<({ editor, onError, isPresentationMode, setIsPresentationMode, enableCollaboration, zoomLevel, setZoomLevel, isNavbarVisible, setIsNavbarVisible, ipfsImageUploadFn, onMarkdownExport, onMarkdownImport, onPdfExport, onHtmlExport, onTxtExport, onOdtExport, onDocxImport, isLoading, ipfsImageFetchFn, fetchV1ImageFn, isConnected, tabs, ydoc, onRegisterExportTrigger, toggleFocusMode, isSplitView, onToggleSplitView, fonts: consumerFonts, renderToolbarLeading, }: {
7
+ declare const MemoizedTiptapToolBar: React.MemoExoticComponent<({ editor, onError, isPresentationMode, setIsPresentationMode, enableCollaboration, zoomLevel, setZoomLevel, isNavbarVisible, setIsNavbarVisible, ipfsImageUploadFn, onMarkdownExport, onMarkdownImport, onPdfExport, onHtmlExport, onTxtExport, onOdtExport, onDocxImport, ipfsImageFetchFn, fetchV1ImageFn, isConnected, tabs, ydoc, onRegisterExportTrigger, toggleFocusMode, isSplitView, onToggleSplitView, fonts: consumerFonts, renderToolbarLeading, }: {
8
8
  editor: Editor | null;
9
9
  onError?: (errorString: string) => void;
10
10
  isPresentationMode?: boolean;
@@ -22,7 +22,6 @@ declare const MemoizedTiptapToolBar: React.MemoExoticComponent<({ editor, onErro
22
22
  onTxtExport?: () => void;
23
23
  onOdtExport?: () => void;
24
24
  onDocxImport?: () => void;
25
- isLoading: boolean;
26
25
  fetchV1ImageFn?: (url: string) => Promise<ArrayBuffer | undefined>;
27
26
  ipfsImageFetchFn?: (_data: IpfsImageFetchPayload) => Promise<{
28
27
  url: string;
@@ -169,12 +169,3 @@ export declare const TextFormatingPopup: ({ editor, isOpen, setIsOpen, setToolVi
169
169
  setToolVisibility: Dispatch<SetStateAction<IEditorTool>>;
170
170
  fonts?: FontDescriptor[];
171
171
  }) => import("react/jsx-runtime").JSX.Element;
172
- export declare const checkActiveListsAndDBlocks: (editor: Editor) => {
173
- activeListTypes: string[];
174
- activeListDBlocks: number[];
175
- activeDBlocks: number[];
176
- from: number;
177
- to: number;
178
- state: import('prosemirror-state').EditorState;
179
- hasMultipleLists: boolean;
180
- };
@@ -2,14 +2,13 @@ import { default as React } from 'react';
2
2
  import { Editor } from '@tiptap/react';
3
3
  import { FontDescriptor, IpfsImageFetchPayload, IpfsImageUploadResponse } from '../types';
4
4
 
5
- declare const MemoizedMobileToolbar: React.MemoExoticComponent<({ editor, onError, isKeyboardVisible, isNavbarVisible, setIsNavbarVisible, ipfsImageUploadFn, isLoading, ipfsImageFetchFn, fetchV1ImageFn, fonts, }: {
5
+ declare const MemoizedMobileToolbar: React.MemoExoticComponent<({ editor, onError, isKeyboardVisible, isNavbarVisible, setIsNavbarVisible, ipfsImageUploadFn, ipfsImageFetchFn, fetchV1ImageFn, fonts, }: {
6
6
  editor: Editor | null;
7
7
  onError?: (errorString: string) => void;
8
8
  isKeyboardVisible: boolean;
9
9
  isNavbarVisible: boolean;
10
10
  setIsNavbarVisible: React.Dispatch<React.SetStateAction<boolean>>;
11
11
  ipfsImageUploadFn?: (file: File) => Promise<IpfsImageUploadResponse>;
12
- isLoading: boolean;
13
12
  ipfsImageFetchFn?: (_data: IpfsImageFetchPayload) => Promise<{
14
13
  url: string;
15
14
  file: File;
@@ -0,0 +1,5 @@
1
+ export declare const ToolbarReveal: ({ isReady, className, children, }: {
2
+ isReady: boolean;
3
+ className?: string;
4
+ children: React.ReactNode;
5
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ export { ListToggle } from './list-toggle';
2
+ export { listAtSelection } from './shared';
@@ -0,0 +1,10 @@
1
+ import { NodeRange, NodeType } from '@tiptap/pm/model';
2
+ import { Transaction } from '@tiptap/pm/state';
3
+
4
+ /**
5
+ * prosemirror-transform's `lift`, with the lifted content wrapped in
6
+ * `wrapper` when given: a dBlock is `group: 'dBlock'`, so a block inside a
7
+ * list item cannot be wrapped in one first and lifted afterwards — the
8
+ * wrapper has to be part of the lift step's slice (spec §3.4 step 2).
9
+ */
10
+ export declare const liftOut: (tr: Transaction, range: NodeRange, target: number, wrapper: NodeType | null) => void;
@@ -0,0 +1,8 @@
1
+ import { Extension } from '@tiptap/core';
2
+
3
+ /**
4
+ * One list engine for every trigger and both schemas (docs/LIST_TOGGLE.md).
5
+ * toggleBulletList / toggleOrderedList / toggleTaskList and the Mod-Shift
6
+ * shortcuts all call toggleList, so overriding it catches all of them.
7
+ */
8
+ export declare const ListToggle: Extension<any, any>;
@@ -0,0 +1,45 @@
1
+ import { Node as ProseMirrorNode } from '@tiptap/pm/model';
2
+ import { Plugin, PluginKey, Transaction } from '@tiptap/pm/state';
3
+ import { DecorationSet } from '@tiptap/pm/view';
4
+
5
+ /** Custom properties the marker CSS reads (docs/LIST_TOGGLE.md §3.9). */
6
+ export declare const MARKER_FONT_SIZE_VAR = "--ddoc-marker-font-size";
7
+ export declare const MARKER_FONT_FAMILY_VAR = "--ddoc-marker-font-family";
8
+ export type MarkerFont = {
9
+ fontSize: string | null;
10
+ fontFamily: string | null;
11
+ };
12
+ type Property = keyof MarkerFont;
13
+ /** A raw value, and whether the paragraph (not the run) declared it. */
14
+ export type Declared = {
15
+ value: string;
16
+ onParagraph: boolean;
17
+ } | null;
18
+ /** One voting run of an item's first paragraph. */
19
+ export type Run = Record<Property, Declared>;
20
+ /** A run's own value, else its paragraph's; an empty string counts as unset. */
21
+ export declare const declaredValue: (own: unknown, paragraph: unknown) => Declared;
22
+ /**
23
+ * The marker takes a property only when every voting run agrees on it in
24
+ * canonical form (docs/LIST_TOGGLE.md §3.9).
25
+ */
26
+ export declare const resolveMarkerFont: (runs: readonly Run[], paragraphHasOwnSize: boolean) => MarkerFont;
27
+ /** The document adapter: a `listItem`'s marker font from its first paragraph. */
28
+ export declare const markerFont: (item: ProseMirrorNode) => MarkerFont;
29
+ /** The inline style carrying a marker font to its `<li>`; null for the default. */
30
+ export declare const markerFontStyle: ({ fontSize, fontFamily, }: MarkerFont) => string | null;
31
+ /**
32
+ * The top-level block ranges a transaction changed, merged so each block is
33
+ * rebuilt once (M-3). Mark and attr steps have empty step maps, so their own
34
+ * positions are read as well.
35
+ */
36
+ export declare const changedBlockRanges: (tr: Transaction) => [number, number][];
37
+ export declare const markerFontPluginKey: PluginKey<DecorationSet>;
38
+ /** Display only: decorations carry each marker's font, the document is never written. */
39
+ export declare const markerFontPlugin: () => Plugin<DecorationSet>;
40
+ /**
41
+ * The HTML adapter for print: sets the marker font on every `li` whose first
42
+ * `<p>` agrees, by the same rule as the editor. Run before math rendering.
43
+ */
44
+ export declare const applyMarkerFonts: (root: ParentNode) => void;
45
+ export {};
@@ -0,0 +1,12 @@
1
+ import { NodeType } from '@tiptap/pm/model';
2
+ import { Transaction } from '@tiptap/pm/state';
3
+ import { SharedList } from './shared';
4
+
5
+ /** bullet ↔ numbered: the items are valid in both list types (spec §3.5). */
6
+ export declare const retypeList: (tr: Transaction, shared: SharedList, listType: NodeType) => true;
7
+ /**
8
+ * Covered items only, each isolated so both wrappers can be swapped in one
9
+ * ReplaceAroundStep around the untouched body — a setNodeMarkup sequence is
10
+ * invalid at every intermediate step (taskList(listItem)).
11
+ */
12
+ export declare const retypeItems: (tr: Transaction, shared: SharedList, firstIndex: number, lastIndex: number, listType: NodeType, itemType: NodeType) => true;
@@ -0,0 +1,49 @@
1
+ import { Node as ProseMirrorNode, NodeRange, ResolvedPos } from '@tiptap/pm/model';
2
+ import { EditorState, Transaction } from '@tiptap/pm/state';
3
+
4
+ /** The engine moves spacing itself; the stage-1 list-exit plugin skips transactions carrying this meta. */
5
+ export declare const LIST_TOGGLE_META = "listToggle";
6
+ export declare const isList: (node: ProseMirrorNode | null | undefined) => boolean;
7
+ export declare const isListItemNode: (node: ProseMirrorNode | null | undefined) => boolean;
8
+ export declare const isDBlock: (node: ProseMirrorNode | null | undefined) => boolean;
9
+ export type SharedList = {
10
+ node: ProseMirrorNode;
11
+ depth: number;
12
+ pos: number;
13
+ };
14
+ /** The innermost list containing BOTH ends of the selection (spec §3.2). */
15
+ export declare const sharedList: ($from: ResolvedPos, $to: ResolvedPos) => SharedList | null;
16
+ export type RowBlock = {
17
+ pos: number;
18
+ node: ProseMirrorNode;
19
+ };
20
+ /**
21
+ * The children of range.parent inside the range. Where those children are
22
+ * v1 dBlocks (the doc, a column) each is looked through to its single block.
23
+ */
24
+ export declare const rowBlocks: (range: NodeRange) => {
25
+ blocks: RowBlock[];
26
+ throughDBlock: boolean;
27
+ };
28
+ /** Position of `parent.child(index)` when `parent` sits at `parentPos`. */
29
+ export declare const childPos: (parent: ProseMirrorNode, parentPos: number, index: number) => number;
30
+ /** A NodeRange covering exactly the node that starts at `pos`. */
31
+ export declare const nodeRangeAt: (tr: Transaction, pos: number) => NodeRange;
32
+ /**
33
+ * Tiptap dispatches a chain's transaction even when a command returned
34
+ * false; preventDispatch is the only way to make "false" mean "nothing".
35
+ */
36
+ export declare const refuse: (tr: Transaction) => false;
37
+ /**
38
+ * Joins the list at `listDepth` around tr.selection.$from with a same-type
39
+ * list right after it, then right before it (spec §3.6). Neighbours are
40
+ * read through v1 dBlocks, and the join then cuts two levels.
41
+ */
42
+ export declare const joinNeighbours: (tr: Transaction, listDepth: number) => void;
43
+ /** Splits the list so the item at itemPos is alone in its own list; returns the item's new position. */
44
+ export declare const isolateItem: (tr: Transaction, itemPos: number, splitDepth: number) => number;
45
+ /** For UI "Text" entries: the list a toggle-off would act on, if any. */
46
+ export declare const listAtSelection: (state: EditorState) => {
47
+ listType: string;
48
+ itemType: string;
49
+ } | null;
@@ -0,0 +1,12 @@
1
+ import { Node as ProseMirrorNode } from '@tiptap/pm/model';
2
+ import { Transaction } from '@tiptap/pm/state';
3
+
4
+ /**
5
+ * Edge spacing policy (spec §3.5), mirroring the ownership plugin's takeEdge
6
+ * rule: an item's spaceBefore belongs to its first child and its spaceAfter
7
+ * to its last child, each only when that child is a paragraph.
8
+ */
9
+ /** Item → paragraphs. The item's value wins over the paragraph's own. */
10
+ export declare const edgesToParagraphs: (tr: Transaction, itemPos: number, item: ProseMirrorNode) => void;
11
+ /** Paragraphs → the (new) item at itemPos; the moved values are nulled on the paragraphs. */
12
+ export declare const edgesToItem: (tr: Transaction, itemPos: number) => void;
@@ -0,0 +1,33 @@
1
+ import { Editor } from '@tiptap/react';
2
+ import { CommentAnchor } from '../comment/comment-decoration-plugin';
3
+
4
+ /** `D(ul(li(p("aa"))))` style outline of the document, with dBlocks. */
5
+ export declare const shape: (editor: Editor) => string;
6
+ /** The same outline with v1 dBlock wrappers removed, so one expectation serves both schemas. */
7
+ export declare const flatShape: (editor: Editor) => string;
8
+ export declare const selectionText: (editor: Editor) => string;
9
+ /** Caret at the end of `text`. */
10
+ export declare const caretIn: (editor: Editor, text: string) => boolean;
11
+ /** Selection from inside `a` to inside `b` (one character in from each edge). */
12
+ export declare const rangeOver: (editor: Editor, a: string, b: string) => boolean;
13
+ /** Sets attrs on the nearest `typeName` ancestor of `text`. */
14
+ export declare const setAttrs: (editor: Editor, typeName: string, text: string, attrs: Record<string, unknown>) => void;
15
+ /** NodeSelection over the nearest `typeName` ancestor of `text` (e.g. a whole listItem). */
16
+ export declare const selectNode: (editor: Editor, typeName: string, text: string) => boolean;
17
+ export type ListHarness = {
18
+ editor: Editor;
19
+ anchors: CommentAnchor[];
20
+ };
21
+ /** Production extension set + the comment decoration plugin, content set. */
22
+ export declare const makeListEditor: (version: number, html: string) => ListHarness;
23
+ export declare const addComment: ({ editor, anchors }: ListHarness, id: string, text: string, extra?: Partial<CommentAnchor>) => void;
24
+ /** `id:text` per decorated comment, sorted, e.g. `ca:aa cb:bb`. */
25
+ export declare const decorated: (editor: Editor) => string;
26
+ /**
27
+ * `id:text` per anchor whose Yjs RelativePositions still resolve, sorted. This
28
+ * is what the comment store reads after a local edit; `decorated` only shows
29
+ * the plugin's ProseMirror-mapped decorations.
30
+ */
31
+ export declare const resolvedAnchors: ({ editor, anchors }: ListHarness) => string;
32
+ /** Schema validity, and in v1 the "one block per dBlock" invariant. */
33
+ export declare const expectValid: (editor: Editor, version: number) => void;
@@ -0,0 +1,18 @@
1
+ import { CommandProps } from '@tiptap/core';
2
+ import { Node as ProseMirrorNode, NodeType } from '@tiptap/pm/model';
3
+ import { Transaction } from '@tiptap/pm/state';
4
+ import { SharedList } from './shared';
5
+
6
+ /**
7
+ * Toggle off when the list's parent is not a list item (spec §3.4): the
8
+ * covered items leave the list, each body child becoming its own block at
9
+ * the list's level. Items are processed last to first, so every edit lands
10
+ * at or after the item's start and earlier items keep their positions.
11
+ */
12
+ export declare const toggleOffTopLevel: (tr: Transaction, shared: SharedList, firstIndex: number, lastIndex: number, dBlockType: NodeType | undefined) => true;
13
+ /**
14
+ * With an outer item of the other node, stock liftListItem unwraps the
15
+ * covered items into the outer item and discards their wrappers, so their
16
+ * edge spacing is moved onto the paragraphs first (spec §3.4, R4-1).
17
+ */
18
+ export declare const toggleOffNested: (props: CommandProps, shared: SharedList, firstIndex: number, lastIndex: number, outerItem: ProseMirrorNode, itemType: NodeType, itemTypeOrName: string | NodeType) => boolean;
@@ -0,0 +1,10 @@
1
+ import { NodeRange, NodeType } from '@tiptap/pm/model';
2
+ import { Transaction } from '@tiptap/pm/state';
3
+
4
+ /**
5
+ * Wraps the row blocks of `range` into one list (spec §3.3). Blocks are
6
+ * wrapped last to first on their original positions: a wrap only touches
7
+ * positions at or after its block, and in v2 the boundary between two
8
+ * neighbours is ambiguous under mapping (both wraps insert there).
9
+ */
10
+ export declare const wrapRow: (tr: Transaction, range: NodeRange, listType: NodeType, paragraph: NodeType) => boolean;
@@ -1,7 +1,7 @@
1
1
  import { jsx as m, jsxs as L } from "react/jsx-runtime";
2
2
  import { useRef as D, useState as E, useEffect as A } from "react";
3
3
  import { DynamicDropdown as P, Tooltip as O, IconButton as T } from "@fileverse/ui";
4
- import { a3 as _, a4 as w, c as R } from "./index-sJxouaO8.mjs";
4
+ import { a3 as _, a4 as w, c as R } from "./index-CapPoFVO.mjs";
5
5
  const p = (e, n, o = n) => {
6
6
  const { state: i } = e, l = i.changeByRange((t) => {
7
7
  const d = i.sliceDoc(t.from, t.to), r = i.sliceDoc(