@sofereditor/react 0.1.0 → 0.2.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/dist/index.cjs +282 -35
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +32 -3
- package/dist/index.d.ts +32 -3
- package/dist/index.js +282 -35
- package/dist/index.js.map +1 -1
- package/package.json +28 -16
package/dist/index.d.cts
CHANGED
|
@@ -27,9 +27,16 @@ interface PageGeometry {
|
|
|
27
27
|
marginBottom: number;
|
|
28
28
|
marginLeft: number;
|
|
29
29
|
marginRight: number;
|
|
30
|
+
/**
|
|
31
|
+
* Espaço adicional somado ao marginTop só na 1ª página. Útil para clientes
|
|
32
|
+
* que rendem um header fixo (timbrado, identificação) na pág 1 via
|
|
33
|
+
* `renderPageHeader` e não querem que esse espaço seja reservado nas demais.
|
|
34
|
+
* Quando omitido, todas as páginas têm a mesma `contentHeight`.
|
|
35
|
+
*/
|
|
36
|
+
firstPageExtraTop?: number;
|
|
30
37
|
}
|
|
31
38
|
declare const A4_PAGE: PageGeometry;
|
|
32
|
-
declare function contentHeight(g: PageGeometry): number;
|
|
39
|
+
declare function contentHeight(g: PageGeometry, pageIndex?: number): number;
|
|
33
40
|
declare function contentWidth(g: PageGeometry): number;
|
|
34
41
|
interface BlockFragment {
|
|
35
42
|
index: number;
|
|
@@ -44,12 +51,22 @@ interface TableRowFragment {
|
|
|
44
51
|
/** First row NOT included (exclusive). */
|
|
45
52
|
rowEnd: number;
|
|
46
53
|
}
|
|
54
|
+
interface ListItemRangeFragment {
|
|
55
|
+
/** 0, 1, 2... sequential fragment id within the list group. */
|
|
56
|
+
index: number;
|
|
57
|
+
/** First top-level item (level 0) included (inclusive). */
|
|
58
|
+
itemStart: number;
|
|
59
|
+
/** First top-level item (level 0) NOT included (exclusive). */
|
|
60
|
+
itemEnd: number;
|
|
61
|
+
}
|
|
47
62
|
interface PageSlot {
|
|
48
63
|
topLevelIndex: number;
|
|
49
64
|
/** Set when this slot represents a paragraph/heading/blockquote line-level fragment. */
|
|
50
65
|
fragment?: BlockFragment;
|
|
51
66
|
/** Set when this slot is a row-range fragment of a table (Sub-phase 4.6). */
|
|
52
67
|
tableFragment?: TableRowFragment;
|
|
68
|
+
/** Set when this slot is an item-range fragment of an ordered/bullet list. */
|
|
69
|
+
listFragment?: ListItemRangeFragment;
|
|
53
70
|
}
|
|
54
71
|
interface PageEntry {
|
|
55
72
|
slots: PageSlot[];
|
|
@@ -58,7 +75,19 @@ interface PageLayout {
|
|
|
58
75
|
pages: PageEntry[];
|
|
59
76
|
}
|
|
60
77
|
declare function defaultPageLayout(topLevelCount: number): PageLayout;
|
|
61
|
-
|
|
78
|
+
type PaginationPhase = "measure" | "stable";
|
|
79
|
+
interface PageLayoutResult {
|
|
80
|
+
layout: PageLayout;
|
|
81
|
+
/**
|
|
82
|
+
* "measure" between a deps change and the post-commit measurement; "stable"
|
|
83
|
+
* once the layout matches the rendered DOM. Consumers can hide the caret /
|
|
84
|
+
* suppress visible flashes during "measure" (the DOM is briefly in the
|
|
85
|
+
* unfragmented intermediate state and the native caret may jump to the start
|
|
86
|
+
* of the line before useLayoutEffect re-applies the model selection).
|
|
87
|
+
*/
|
|
88
|
+
phase: PaginationPhase;
|
|
89
|
+
}
|
|
90
|
+
declare function usePageLayout(rootRef: RefObject<HTMLElement>, geometry: PageGeometry, topLevelCount: number, deps: ReadonlyArray<unknown>): PageLayoutResult;
|
|
62
91
|
|
|
63
92
|
interface UseEditorOptions {
|
|
64
93
|
document?: EditorDocument;
|
|
@@ -350,4 +379,4 @@ declare function selectionsEqual(a: Selection, b: Selection): boolean;
|
|
|
350
379
|
declare function isTableRectSelection(sel: Selection): boolean;
|
|
351
380
|
declare function applyDomSelection(root: HTMLElement, modelSel: Selection): void;
|
|
352
381
|
|
|
353
|
-
export { A4_PAGE, type BlockFragment, type CaptionAlign, Editor, type EditorProps, EditorProvider, type EditorProviderProps, ImageCaptionDialog, type ImageCaptionRequest, type ImageCaptionResult, LinkDialog, type LinkRequest, NodeView, type NodeViewFragment, PageConfigDialog, type PageConfigRequest, type PageEntry, type PageGeometry, type PageLayout, type PageRenderContext, type PageRenderProp, type PageSlot, type PendingMarks, type TableRowFragment, Toolbar, type ToolbarProps, type UseEditorOptions, type UseEditorResult, applyDomSelection, contentHeight, contentWidth, defaultPageLayout, deltaLength, findBlockIndex, getBlockElement, getCellElement, getFragmentForOffset, isTableRectSelection, readDomSelection, renderInline, selectionsEqual, sliceDelta, textOffsetWithin, useEditor, useEditorContext, usePageLayout, usePageSettings };
|
|
382
|
+
export { A4_PAGE, type BlockFragment, type CaptionAlign, Editor, type EditorProps, EditorProvider, type EditorProviderProps, ImageCaptionDialog, type ImageCaptionRequest, type ImageCaptionResult, LinkDialog, type LinkRequest, NodeView, type NodeViewFragment, PageConfigDialog, type PageConfigRequest, type PageEntry, type PageGeometry, type PageLayout, type PageLayoutResult, type PageRenderContext, type PageRenderProp, type PageSlot, type PaginationPhase, type PendingMarks, type TableRowFragment, Toolbar, type ToolbarProps, type UseEditorOptions, type UseEditorResult, applyDomSelection, contentHeight, contentWidth, defaultPageLayout, deltaLength, findBlockIndex, getBlockElement, getCellElement, getFragmentForOffset, isTableRectSelection, readDomSelection, renderInline, selectionsEqual, sliceDelta, textOffsetWithin, useEditor, useEditorContext, usePageLayout, usePageSettings };
|
package/dist/index.d.ts
CHANGED
|
@@ -27,9 +27,16 @@ interface PageGeometry {
|
|
|
27
27
|
marginBottom: number;
|
|
28
28
|
marginLeft: number;
|
|
29
29
|
marginRight: number;
|
|
30
|
+
/**
|
|
31
|
+
* Espaço adicional somado ao marginTop só na 1ª página. Útil para clientes
|
|
32
|
+
* que rendem um header fixo (timbrado, identificação) na pág 1 via
|
|
33
|
+
* `renderPageHeader` e não querem que esse espaço seja reservado nas demais.
|
|
34
|
+
* Quando omitido, todas as páginas têm a mesma `contentHeight`.
|
|
35
|
+
*/
|
|
36
|
+
firstPageExtraTop?: number;
|
|
30
37
|
}
|
|
31
38
|
declare const A4_PAGE: PageGeometry;
|
|
32
|
-
declare function contentHeight(g: PageGeometry): number;
|
|
39
|
+
declare function contentHeight(g: PageGeometry, pageIndex?: number): number;
|
|
33
40
|
declare function contentWidth(g: PageGeometry): number;
|
|
34
41
|
interface BlockFragment {
|
|
35
42
|
index: number;
|
|
@@ -44,12 +51,22 @@ interface TableRowFragment {
|
|
|
44
51
|
/** First row NOT included (exclusive). */
|
|
45
52
|
rowEnd: number;
|
|
46
53
|
}
|
|
54
|
+
interface ListItemRangeFragment {
|
|
55
|
+
/** 0, 1, 2... sequential fragment id within the list group. */
|
|
56
|
+
index: number;
|
|
57
|
+
/** First top-level item (level 0) included (inclusive). */
|
|
58
|
+
itemStart: number;
|
|
59
|
+
/** First top-level item (level 0) NOT included (exclusive). */
|
|
60
|
+
itemEnd: number;
|
|
61
|
+
}
|
|
47
62
|
interface PageSlot {
|
|
48
63
|
topLevelIndex: number;
|
|
49
64
|
/** Set when this slot represents a paragraph/heading/blockquote line-level fragment. */
|
|
50
65
|
fragment?: BlockFragment;
|
|
51
66
|
/** Set when this slot is a row-range fragment of a table (Sub-phase 4.6). */
|
|
52
67
|
tableFragment?: TableRowFragment;
|
|
68
|
+
/** Set when this slot is an item-range fragment of an ordered/bullet list. */
|
|
69
|
+
listFragment?: ListItemRangeFragment;
|
|
53
70
|
}
|
|
54
71
|
interface PageEntry {
|
|
55
72
|
slots: PageSlot[];
|
|
@@ -58,7 +75,19 @@ interface PageLayout {
|
|
|
58
75
|
pages: PageEntry[];
|
|
59
76
|
}
|
|
60
77
|
declare function defaultPageLayout(topLevelCount: number): PageLayout;
|
|
61
|
-
|
|
78
|
+
type PaginationPhase = "measure" | "stable";
|
|
79
|
+
interface PageLayoutResult {
|
|
80
|
+
layout: PageLayout;
|
|
81
|
+
/**
|
|
82
|
+
* "measure" between a deps change and the post-commit measurement; "stable"
|
|
83
|
+
* once the layout matches the rendered DOM. Consumers can hide the caret /
|
|
84
|
+
* suppress visible flashes during "measure" (the DOM is briefly in the
|
|
85
|
+
* unfragmented intermediate state and the native caret may jump to the start
|
|
86
|
+
* of the line before useLayoutEffect re-applies the model selection).
|
|
87
|
+
*/
|
|
88
|
+
phase: PaginationPhase;
|
|
89
|
+
}
|
|
90
|
+
declare function usePageLayout(rootRef: RefObject<HTMLElement>, geometry: PageGeometry, topLevelCount: number, deps: ReadonlyArray<unknown>): PageLayoutResult;
|
|
62
91
|
|
|
63
92
|
interface UseEditorOptions {
|
|
64
93
|
document?: EditorDocument;
|
|
@@ -350,4 +379,4 @@ declare function selectionsEqual(a: Selection, b: Selection): boolean;
|
|
|
350
379
|
declare function isTableRectSelection(sel: Selection): boolean;
|
|
351
380
|
declare function applyDomSelection(root: HTMLElement, modelSel: Selection): void;
|
|
352
381
|
|
|
353
|
-
export { A4_PAGE, type BlockFragment, type CaptionAlign, Editor, type EditorProps, EditorProvider, type EditorProviderProps, ImageCaptionDialog, type ImageCaptionRequest, type ImageCaptionResult, LinkDialog, type LinkRequest, NodeView, type NodeViewFragment, PageConfigDialog, type PageConfigRequest, type PageEntry, type PageGeometry, type PageLayout, type PageRenderContext, type PageRenderProp, type PageSlot, type PendingMarks, type TableRowFragment, Toolbar, type ToolbarProps, type UseEditorOptions, type UseEditorResult, applyDomSelection, contentHeight, contentWidth, defaultPageLayout, deltaLength, findBlockIndex, getBlockElement, getCellElement, getFragmentForOffset, isTableRectSelection, readDomSelection, renderInline, selectionsEqual, sliceDelta, textOffsetWithin, useEditor, useEditorContext, usePageLayout, usePageSettings };
|
|
382
|
+
export { A4_PAGE, type BlockFragment, type CaptionAlign, Editor, type EditorProps, EditorProvider, type EditorProviderProps, ImageCaptionDialog, type ImageCaptionRequest, type ImageCaptionResult, LinkDialog, type LinkRequest, NodeView, type NodeViewFragment, PageConfigDialog, type PageConfigRequest, type PageEntry, type PageGeometry, type PageLayout, type PageLayoutResult, type PageRenderContext, type PageRenderProp, type PageSlot, type PaginationPhase, type PendingMarks, type TableRowFragment, Toolbar, type ToolbarProps, type UseEditorOptions, type UseEditorResult, applyDomSelection, contentHeight, contentWidth, defaultPageLayout, deltaLength, findBlockIndex, getBlockElement, getCellElement, getFragmentForOffset, isTableRectSelection, readDomSelection, renderInline, selectionsEqual, sliceDelta, textOffsetWithin, useEditor, useEditorContext, usePageLayout, usePageSettings };
|