@yurikilian/lex4 0.1.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.
Files changed (117) hide show
  1. package/LICENSE +21 -0
  2. package/dist/__tests__/setup.d.ts +1 -0
  3. package/dist/__tests__/setup.d.ts.map +1 -0
  4. package/dist/components/DocumentView.d.ts +10 -0
  5. package/dist/components/DocumentView.d.ts.map +1 -0
  6. package/dist/components/EditorSidebar.d.ts +12 -0
  7. package/dist/components/EditorSidebar.d.ts.map +1 -0
  8. package/dist/components/HeaderFooterActions.d.ts +16 -0
  9. package/dist/components/HeaderFooterActions.d.ts.map +1 -0
  10. package/dist/components/HeaderFooterToggle.d.ts +8 -0
  11. package/dist/components/HeaderFooterToggle.d.ts.map +1 -0
  12. package/dist/components/HistorySidebar.d.ts +3 -0
  13. package/dist/components/HistorySidebar.d.ts.map +1 -0
  14. package/dist/components/Lex4Editor.d.ts +10 -0
  15. package/dist/components/Lex4Editor.d.ts.map +1 -0
  16. package/dist/components/PageBody.d.ts +26 -0
  17. package/dist/components/PageBody.d.ts.map +1 -0
  18. package/dist/components/PageFooter.d.ts +18 -0
  19. package/dist/components/PageFooter.d.ts.map +1 -0
  20. package/dist/components/PageHeader.d.ts +18 -0
  21. package/dist/components/PageHeader.d.ts.map +1 -0
  22. package/dist/components/PageView.d.ts +21 -0
  23. package/dist/components/PageView.d.ts.map +1 -0
  24. package/dist/components/Toolbar.d.ts +3 -0
  25. package/dist/components/Toolbar.d.ts.map +1 -0
  26. package/dist/components/index.d.ts +12 -0
  27. package/dist/components/index.d.ts.map +1 -0
  28. package/dist/constants/dimensions.d.ts +25 -0
  29. package/dist/constants/dimensions.d.ts.map +1 -0
  30. package/dist/constants/index.d.ts +3 -0
  31. package/dist/constants/index.d.ts.map +1 -0
  32. package/dist/constants/page-layout.d.ts +11 -0
  33. package/dist/constants/page-layout.d.ts.map +1 -0
  34. package/dist/context/document-context.d.ts +108 -0
  35. package/dist/context/document-context.d.ts.map +1 -0
  36. package/dist/context/document-provider.d.ts +10 -0
  37. package/dist/context/document-provider.d.ts.map +1 -0
  38. package/dist/context/document-reducer.d.ts +8 -0
  39. package/dist/context/document-reducer.d.ts.map +1 -0
  40. package/dist/context/index.d.ts +5 -0
  41. package/dist/context/index.d.ts.map +1 -0
  42. package/dist/engine/index.d.ts +7 -0
  43. package/dist/engine/index.d.ts.map +1 -0
  44. package/dist/engine/measure.d.ts +15 -0
  45. package/dist/engine/measure.d.ts.map +1 -0
  46. package/dist/engine/overflow.d.ts +28 -0
  47. package/dist/engine/overflow.d.ts.map +1 -0
  48. package/dist/engine/paginate.d.ts +12 -0
  49. package/dist/engine/paginate.d.ts.map +1 -0
  50. package/dist/engine/reflow.d.ts +22 -0
  51. package/dist/engine/reflow.d.ts.map +1 -0
  52. package/dist/hooks/index.d.ts +4 -0
  53. package/dist/hooks/index.d.ts.map +1 -0
  54. package/dist/hooks/use-header-footer.d.ts +10 -0
  55. package/dist/hooks/use-header-footer.d.ts.map +1 -0
  56. package/dist/hooks/use-overflow-detection.d.ts +11 -0
  57. package/dist/hooks/use-overflow-detection.d.ts.map +1 -0
  58. package/dist/hooks/use-pagination.d.ts +22 -0
  59. package/dist/hooks/use-pagination.d.ts.map +1 -0
  60. package/dist/index.d.ts +9 -0
  61. package/dist/index.d.ts.map +1 -0
  62. package/dist/lex4-editor.cjs +3774 -0
  63. package/dist/lex4-editor.cjs.map +1 -0
  64. package/dist/lex4-editor.js +3774 -0
  65. package/dist/lex4-editor.js.map +1 -0
  66. package/dist/lexical/commands/format-commands.d.ts +14 -0
  67. package/dist/lexical/commands/format-commands.d.ts.map +1 -0
  68. package/dist/lexical/commands/index.d.ts +4 -0
  69. package/dist/lexical/commands/index.d.ts.map +1 -0
  70. package/dist/lexical/commands/list-commands.d.ts +25 -0
  71. package/dist/lexical/commands/list-commands.d.ts.map +1 -0
  72. package/dist/lexical/editor-setup.d.ts +10 -0
  73. package/dist/lexical/editor-setup.d.ts.map +1 -0
  74. package/dist/lexical/index.d.ts +8 -0
  75. package/dist/lexical/index.d.ts.map +1 -0
  76. package/dist/lexical/plugins/active-editor-plugin.d.ts +16 -0
  77. package/dist/lexical/plugins/active-editor-plugin.d.ts.map +1 -0
  78. package/dist/lexical/plugins/font-plugin.d.ts +19 -0
  79. package/dist/lexical/plugins/font-plugin.d.ts.map +1 -0
  80. package/dist/lexical/plugins/height-limit-plugin.d.ts +15 -0
  81. package/dist/lexical/plugins/height-limit-plugin.d.ts.map +1 -0
  82. package/dist/lexical/plugins/history-capture-plugin.d.ts +8 -0
  83. package/dist/lexical/plugins/history-capture-plugin.d.ts.map +1 -0
  84. package/dist/lexical/plugins/index.d.ts +9 -0
  85. package/dist/lexical/plugins/index.d.ts.map +1 -0
  86. package/dist/lexical/plugins/overflow-plugin.d.ts +22 -0
  87. package/dist/lexical/plugins/overflow-plugin.d.ts.map +1 -0
  88. package/dist/lexical/plugins/page-boundary-plugin.d.ts +9 -0
  89. package/dist/lexical/plugins/page-boundary-plugin.d.ts.map +1 -0
  90. package/dist/lexical/plugins/paragraph-indent-plugin.d.ts +7 -0
  91. package/dist/lexical/plugins/paragraph-indent-plugin.d.ts.map +1 -0
  92. package/dist/lexical/plugins/paste-plugin.d.ts +9 -0
  93. package/dist/lexical/plugins/paste-plugin.d.ts.map +1 -0
  94. package/dist/lexical/plugins/tab-indent-plugin.d.ts +9 -0
  95. package/dist/lexical/plugins/tab-indent-plugin.d.ts.map +1 -0
  96. package/dist/lexical/theme.d.ts +7 -0
  97. package/dist/lexical/theme.d.ts.map +1 -0
  98. package/dist/style.css +1065 -0
  99. package/dist/types/document.d.ts +40 -0
  100. package/dist/types/document.d.ts.map +1 -0
  101. package/dist/types/editor-props.d.ts +19 -0
  102. package/dist/types/editor-props.d.ts.map +1 -0
  103. package/dist/types/history.d.ts +43 -0
  104. package/dist/types/history.d.ts.map +1 -0
  105. package/dist/types/index.d.ts +5 -0
  106. package/dist/types/index.d.ts.map +1 -0
  107. package/dist/types/page.d.ts +26 -0
  108. package/dist/types/page.d.ts.map +1 -0
  109. package/dist/utils/debug.d.ts +41 -0
  110. package/dist/utils/debug.d.ts.map +1 -0
  111. package/dist/utils/editor-state-utils.d.ts +48 -0
  112. package/dist/utils/editor-state-utils.d.ts.map +1 -0
  113. package/dist/utils/history-manager.d.ts +26 -0
  114. package/dist/utils/history-manager.d.ts.map +1 -0
  115. package/dist/utils/index.d.ts +3 -0
  116. package/dist/utils/index.d.ts.map +1 -0
  117. package/package.json +80 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Yuri Kilian
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=setup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../src/__tests__/setup.ts"],"names":[],"mappings":"AAAA,OAAO,kCAAkC,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { default as React } from 'react';
2
+ /**
3
+ * DocumentView — Scrollable container rendering all pages vertically.
4
+ *
5
+ * Provides the page-layout visual with pages centered on a gray background
6
+ * with gaps between pages. Handles overflow content from pages by
7
+ * creating new pages or prepending to existing next pages.
8
+ */
9
+ export declare const DocumentView: React.FC;
10
+ //# sourceMappingURL=DocumentView.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DocumentView.d.ts","sourceRoot":"","sources":["../../src/components/DocumentView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkD,MAAM,OAAO,CAAC;AAWvE;;;;;;GAMG;AACH,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAgShC,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { default as React } from 'react';
2
+ interface EditorSidebarProps {
3
+ title: string;
4
+ subtitle?: string;
5
+ open: boolean;
6
+ onClose?: () => void;
7
+ headerActions?: React.ReactNode;
8
+ children: React.ReactNode;
9
+ }
10
+ export declare const EditorSidebar: React.FC<EditorSidebarProps>;
11
+ export {};
12
+ //# sourceMappingURL=EditorSidebar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EditorSidebar.d.ts","sourceRoot":"","sources":["../../src/components/EditorSidebar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,UAAU,kBAAkB;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAChC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CA6CtD,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { default as React } from 'react';
2
+ import { PageCounterMode } from '../types/document';
3
+ interface HeaderFooterActionsProps {
4
+ activePageId: string | null;
5
+ pageCounterMode: PageCounterMode;
6
+ onPageCounterModeChange: (mode: PageCounterMode) => void;
7
+ onCopyHeaderToAll: () => void;
8
+ onCopyFooterToAll: () => void;
9
+ onClearHeader: () => void;
10
+ onClearFooter: () => void;
11
+ onClearAllHeaders: () => void;
12
+ onClearAllFooters: () => void;
13
+ }
14
+ export declare const HeaderFooterActions: React.FC<HeaderFooterActionsProps>;
15
+ export {};
16
+ //# sourceMappingURL=HeaderFooterActions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HeaderFooterActions.d.ts","sourceRoot":"","sources":["../../src/components/HeaderFooterActions.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAO1B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEzD,UAAU,wBAAwB;IAChC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,eAAe,EAAE,eAAe,CAAC;IACjC,uBAAuB,EAAE,CAAC,IAAI,EAAE,eAAe,KAAK,IAAI,CAAC;IACzD,iBAAiB,EAAE,MAAM,IAAI,CAAC;IAC9B,iBAAiB,EAAE,MAAM,IAAI,CAAC;IAC9B,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B,iBAAiB,EAAE,MAAM,IAAI,CAAC;IAC9B,iBAAiB,EAAE,MAAM,IAAI,CAAC;CAC/B;AAED,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,wBAAwB,CA0FlE,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { default as React } from 'react';
2
+ interface HeaderFooterToggleProps {
3
+ enabled: boolean;
4
+ onToggle: (enabled: boolean) => void;
5
+ }
6
+ export declare const HeaderFooterToggle: React.FC<HeaderFooterToggleProps>;
7
+ export {};
8
+ //# sourceMappingURL=HeaderFooterToggle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HeaderFooterToggle.d.ts","sourceRoot":"","sources":["../../src/components/HeaderFooterToggle.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,UAAU,uBAAuB;IAC/B,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;CACtC;AAED,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CAmChE,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { default as React } from 'react';
2
+ export declare const HistorySidebar: React.FC;
3
+ //# sourceMappingURL=HistorySidebar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HistorySidebar.d.ts","sourceRoot":"","sources":["../../src/components/HistorySidebar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAc1B,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAgFlC,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { default as React } from 'react';
2
+ import { Lex4EditorProps } from '../types/editor-props';
3
+ /**
4
+ * Lex4Editor — The main public component.
5
+ *
6
+ * A paginated A4 document editor built on Meta Lexical.
7
+ * Each page is a true discrete A4 page with its own Lexical editor instance.
8
+ */
9
+ export declare const Lex4Editor: React.FC<Lex4EditorProps>;
10
+ //# sourceMappingURL=Lex4Editor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Lex4Editor.d.ts","sourceRoot":"","sources":["../../src/components/Lex4Editor.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyC,MAAM,OAAO,CAAC;AAC9D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAM7D,OAAO,eAAe,CAAC;AA0NvB;;;;;GAKG;AACH,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAiBhD,CAAC"}
@@ -0,0 +1,26 @@
1
+ import { default as React } from 'react';
2
+ import { SerializedEditorState } from 'lexical';
3
+ interface PageBodyProps {
4
+ pageId: string;
5
+ initialBodyState?: SerializedEditorState | null;
6
+ onBodyChange?: (state: SerializedEditorState) => void;
7
+ onOverflow?: (overflowContent: SerializedEditorState, cause: 'paste' | 'content') => void;
8
+ onFocus?: () => void;
9
+ onBackspaceAtStart?: () => void;
10
+ onDeleteAtEnd?: () => void;
11
+ onMoveToPreviousPage?: () => void;
12
+ onMoveToNextPage?: () => void;
13
+ readOnly?: boolean;
14
+ }
15
+ /**
16
+ * PageBody — Lexical editor instance for one page's body content.
17
+ *
18
+ * Each page gets its own Lexical editor. The OverflowPlugin
19
+ * handles splitting content when it exceeds the available height.
20
+ *
21
+ * When created with initialBodyState (e.g. from overflow), the
22
+ * LexicalComposer is initialized with that content.
23
+ */
24
+ export declare const PageBody: React.FC<PageBodyProps>;
25
+ export {};
26
+ //# sourceMappingURL=PageBody.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PageBody.d.ts","sourceRoot":"","sources":["../../src/components/PageBody.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA0C,MAAM,OAAO,CAAC;AAQ/D,OAAO,KAAK,EAAe,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAalE,UAAU,aAAa;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,gBAAgB,CAAC,EAAE,qBAAqB,GAAG,IAAI,CAAC;IAChD,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,qBAAqB,KAAK,IAAI,CAAC;IACtD,UAAU,CAAC,EAAE,CAAC,eAAe,EAAE,qBAAqB,EAAE,KAAK,EAAE,OAAO,GAAG,SAAS,KAAK,IAAI,CAAC;IAC1F,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,kBAAkB,CAAC,EAAE,MAAM,IAAI,CAAC;IAChC,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;IAC3B,oBAAoB,CAAC,EAAE,MAAM,IAAI,CAAC;IAClC,gBAAgB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC9B,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAsBD;;;;;;;;GAQG;AACH,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CA6F5C,CAAC"}
@@ -0,0 +1,18 @@
1
+ import { default as React } from 'react';
2
+ import { SerializedEditorState } from 'lexical';
3
+ interface PageFooterProps {
4
+ pageId: string;
5
+ initialFooterState?: SerializedEditorState | null;
6
+ pageCounterLabel?: string;
7
+ onFooterChange?: (state: SerializedEditorState, height: number) => void;
8
+ }
9
+ /**
10
+ * PageFooter — Mini Lexical editor for a page's footer region.
11
+ *
12
+ * Constrained to MAX_FOOTER_HEIGHT_PX. Uses overflow: clip to prevent
13
+ * the browser from scrolling the container to follow the cursor.
14
+ * Remounts via key={syncVersion} when content is copied/cleared externally.
15
+ */
16
+ export declare const PageFooter: React.FC<PageFooterProps>;
17
+ export {};
18
+ //# sourceMappingURL=PageFooter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PageFooter.d.ts","sourceRoot":"","sources":["../../src/components/PageFooter.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAuC,MAAM,OAAO,CAAC;AAM5D,OAAO,KAAK,EAAe,qBAAqB,EAAE,MAAM,SAAS,CAAC;AASlE,UAAU,eAAe;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,kBAAkB,CAAC,EAAE,qBAAqB,GAAG,IAAI,CAAC;IAClD,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,qBAAqB,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CACzE;AAED;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CA8EhD,CAAC"}
@@ -0,0 +1,18 @@
1
+ import { default as React } from 'react';
2
+ import { SerializedEditorState } from 'lexical';
3
+ interface PageHeaderProps {
4
+ pageId: string;
5
+ initialHeaderState?: SerializedEditorState | null;
6
+ pageCounterLabel?: string;
7
+ onHeaderChange?: (state: SerializedEditorState, height: number) => void;
8
+ }
9
+ /**
10
+ * PageHeader — Mini Lexical editor for a page's header region.
11
+ *
12
+ * Constrained to MAX_HEADER_HEIGHT_PX. Uses overflow: clip to prevent
13
+ * the browser from scrolling the container to follow the cursor.
14
+ * Remounts via key={syncVersion} when content is copied/cleared externally.
15
+ */
16
+ export declare const PageHeader: React.FC<PageHeaderProps>;
17
+ export {};
18
+ //# sourceMappingURL=PageHeader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PageHeader.d.ts","sourceRoot":"","sources":["../../src/components/PageHeader.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAuC,MAAM,OAAO,CAAC;AAM5D,OAAO,KAAK,EAAe,qBAAqB,EAAE,MAAM,SAAS,CAAC;AASlE,UAAU,eAAe;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,kBAAkB,CAAC,EAAE,qBAAqB,GAAG,IAAI,CAAC;IAClD,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,qBAAqB,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CACzE;AAED;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CA8EhD,CAAC"}
@@ -0,0 +1,21 @@
1
+ import { default as React } from 'react';
2
+ import { SerializedEditorState } from 'lexical';
3
+ interface PageViewProps {
4
+ pageId: string;
5
+ pageIndex: number;
6
+ onOverflow?: (overflowContent: SerializedEditorState, cause: 'paste' | 'content') => void;
7
+ onBackspaceAtStart?: (pageIndex: number, pageId: string) => void;
8
+ onDeleteAtEnd?: (pageIndex: number, pageId: string) => void;
9
+ onMoveToPreviousPage?: (pageIndex: number) => void;
10
+ onMoveToNextPage?: (pageIndex: number) => void;
11
+ }
12
+ /**
13
+ * PageView — A single A4 page with header, body, and footer regions.
14
+ *
15
+ * Dimensions are always exactly A4 (794 × 1123 px).
16
+ * Header and footer are only rendered when the global toggle is on.
17
+ * Uses CSS flexbox: header/footer are flex-shrink-0, body is flex-1.
18
+ */
19
+ export declare const PageView: React.FC<PageViewProps>;
20
+ export {};
21
+ //# sourceMappingURL=PageView.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PageView.d.ts","sourceRoot":"","sources":["../../src/components/PageView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsB,MAAM,OAAO,CAAC;AAM3C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAErD,UAAU,aAAa;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,CAAC,eAAe,EAAE,qBAAqB,EAAE,KAAK,EAAE,OAAO,GAAG,SAAS,KAAK,IAAI,CAAC;IAC1F,kBAAkB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACjE,aAAa,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5D,oBAAoB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IACnD,gBAAgB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;CAChD;AAED;;;;;;GAMG;AACH,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CA8F3C,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { default as React } from 'react';
2
+ export declare const Toolbar: React.FC;
3
+ //# sourceMappingURL=Toolbar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Toolbar.d.ts","sourceRoot":"","sources":["../../src/components/Toolbar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsB,MAAM,OAAO,CAAC;AA6B3C,eAAO,MAAM,OAAO,EAAE,KAAK,CAAC,EAmU3B,CAAC"}
@@ -0,0 +1,12 @@
1
+ export { Lex4Editor } from './Lex4Editor';
2
+ export { DocumentView } from './DocumentView';
3
+ export { PageView } from './PageView';
4
+ export { PageBody } from './PageBody';
5
+ export { PageHeader } from './PageHeader';
6
+ export { PageFooter } from './PageFooter';
7
+ export { Toolbar } from './Toolbar';
8
+ export { HeaderFooterToggle } from './HeaderFooterToggle';
9
+ export { HeaderFooterActions } from './HeaderFooterActions';
10
+ export { EditorSidebar } from './EditorSidebar';
11
+ export { HistorySidebar } from './HistorySidebar';
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * A4 page dimensions and layout constants.
3
+ *
4
+ * All values derived from the A4 standard (210mm × 297mm)
5
+ * converted to CSS pixels at 96 DPI.
6
+ */
7
+ export declare const A4_WIDTH_MM = 210;
8
+ export declare const A4_HEIGHT_MM = 297;
9
+ /** CSS pixels per millimeter at 96 DPI */
10
+ export declare const PX_PER_MM: number;
11
+ /** A4 width in CSS pixels (≈794px) */
12
+ export declare const A4_WIDTH_PX: number;
13
+ /** A4 height in CSS pixels (≈1123px) */
14
+ export declare const A4_HEIGHT_PX: number;
15
+ /** Default page margin in CSS pixels (≈10.6mm each side) */
16
+ export declare const PAGE_MARGIN_PX = 40;
17
+ /** Maximum header height as a ratio of page height */
18
+ export declare const MAX_HEADER_RATIO = 0.2;
19
+ /** Maximum footer height as a ratio of page height */
20
+ export declare const MAX_FOOTER_RATIO = 0.2;
21
+ /** Maximum header height in CSS pixels */
22
+ export declare const MAX_HEADER_HEIGHT_PX: number;
23
+ /** Maximum footer height in CSS pixels */
24
+ export declare const MAX_FOOTER_HEIGHT_PX: number;
25
+ //# sourceMappingURL=dimensions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dimensions.d.ts","sourceRoot":"","sources":["../../src/constants/dimensions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,WAAW,MAAM,CAAC;AAC/B,eAAO,MAAM,YAAY,MAAM,CAAC;AAEhC,0CAA0C;AAC1C,eAAO,MAAM,SAAS,QAAY,CAAC;AAEnC,sCAAsC;AACtC,eAAO,MAAM,WAAW,QAAsC,CAAC;AAE/D,wCAAwC;AACxC,eAAO,MAAM,YAAY,QAAuC,CAAC;AAEjE,4DAA4D;AAC5D,eAAO,MAAM,cAAc,KAAK,CAAC;AAEjC,sDAAsD;AACtD,eAAO,MAAM,gBAAgB,MAAM,CAAC;AAEpC,sDAAsD;AACtD,eAAO,MAAM,gBAAgB,MAAM,CAAC;AAEpC,0CAA0C;AAC1C,eAAO,MAAM,oBAAoB,QAA8C,CAAC;AAEhF,0CAA0C;AAC1C,eAAO,MAAM,oBAAoB,QAA8C,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { A4_WIDTH_MM, A4_HEIGHT_MM, A4_WIDTH_PX, A4_HEIGHT_PX, PX_PER_MM, PAGE_MARGIN_PX, MAX_HEADER_RATIO, MAX_FOOTER_RATIO, MAX_HEADER_HEIGHT_PX, MAX_FOOTER_HEIGHT_PX, } from './dimensions';
2
+ export { computeBodyHeight, computeContentAreaHeight, } from './page-layout';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/constants/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,SAAS,EACT,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EAChB,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,iBAAiB,EACjB,wBAAwB,GACzB,MAAM,eAAe,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Computes the available body height for a page, accounting for
3
+ * header/footer heights and page margins.
4
+ */
5
+ export declare function computeBodyHeight(headerHeight: number, footerHeight: number): number;
6
+ /**
7
+ * Computes the content area height based on whether
8
+ * headers/footers are enabled.
9
+ */
10
+ export declare function computeContentAreaHeight(headerFooterEnabled: boolean, headerHeight: number, footerHeight: number): number;
11
+ //# sourceMappingURL=page-layout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"page-layout.d.ts","sourceRoot":"","sources":["../../src/constants/page-layout.ts"],"names":[],"mappings":"AAKA;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,YAAY,EAAE,MAAM,EACpB,YAAY,EAAE,MAAM,GACnB,MAAM,CAGR;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,mBAAmB,EAAE,OAAO,EAC5B,YAAY,EAAE,MAAM,EACpB,YAAY,EAAE,MAAM,GACnB,MAAM,CAKR"}
@@ -0,0 +1,108 @@
1
+ import { Lex4Document, PageCounterMode } from '../types/document';
2
+ import { LexicalEditor } from 'lexical';
3
+ import { CaretPosition, CaretSelection, HistoryActionDescriptor, HistoryEntry } from '../types/history';
4
+ /** All actions the document reducer can handle */
5
+ export type DocumentAction = {
6
+ type: 'ADD_PAGE';
7
+ afterIndex?: number;
8
+ page?: import('../types/document').PageState;
9
+ } | {
10
+ type: 'REMOVE_PAGE';
11
+ pageId: string;
12
+ } | {
13
+ type: 'UPDATE_PAGE_BODY';
14
+ pageId: string;
15
+ bodyState: import('lexical').SerializedEditorState | null;
16
+ } | {
17
+ type: 'UPDATE_PAGE_HEADER_CONTENT';
18
+ pageId: string;
19
+ headerState: import('lexical').SerializedEditorState | null;
20
+ height: number;
21
+ } | {
22
+ type: 'UPDATE_PAGE_FOOTER_CONTENT';
23
+ pageId: string;
24
+ footerState: import('lexical').SerializedEditorState | null;
25
+ height: number;
26
+ } | {
27
+ type: 'UPDATE_PAGE_HEADER';
28
+ pageId: string;
29
+ headerState: import('lexical').SerializedEditorState | null;
30
+ } | {
31
+ type: 'UPDATE_PAGE_FOOTER';
32
+ pageId: string;
33
+ footerState: import('lexical').SerializedEditorState | null;
34
+ } | {
35
+ type: 'SET_HEADER_FOOTER_ENABLED';
36
+ enabled: boolean;
37
+ } | {
38
+ type: 'SET_PAGE_COUNTER_MODE';
39
+ mode: PageCounterMode;
40
+ } | {
41
+ type: 'COPY_HEADER_TO_ALL';
42
+ sourcePageId: string;
43
+ } | {
44
+ type: 'COPY_FOOTER_TO_ALL';
45
+ sourcePageId: string;
46
+ } | {
47
+ type: 'CLEAR_HEADER';
48
+ pageId: string;
49
+ } | {
50
+ type: 'CLEAR_FOOTER';
51
+ pageId: string;
52
+ } | {
53
+ type: 'CLEAR_ALL_HEADERS';
54
+ } | {
55
+ type: 'CLEAR_ALL_FOOTERS';
56
+ } | {
57
+ type: 'CLEAR_DOCUMENT_CONTENT';
58
+ } | {
59
+ type: 'SET_HEADER_HEIGHT';
60
+ pageId: string;
61
+ height: number;
62
+ } | {
63
+ type: 'SET_FOOTER_HEIGHT';
64
+ pageId: string;
65
+ height: number;
66
+ } | {
67
+ type: 'SET_DOCUMENT';
68
+ document: Lex4Document;
69
+ };
70
+ /** Registry of page editors for direct cross-page content manipulation */
71
+ export interface EditorRegistry {
72
+ register(pageId: string, editor: LexicalEditor): void;
73
+ unregister(pageId: string): void;
74
+ get(pageId: string): LexicalEditor | undefined;
75
+ all(): LexicalEditor[];
76
+ }
77
+ /** Shape of the document context value */
78
+ export interface DocumentContextValue {
79
+ document: Lex4Document;
80
+ dispatch: React.Dispatch<DocumentAction>;
81
+ activePageId: string | null;
82
+ setActivePageId: (id: string | null) => void;
83
+ activeEditor: LexicalEditor | null;
84
+ setActiveEditor: (editor: LexicalEditor | null, caretPosition?: CaretPosition | null) => void;
85
+ consumePendingCaretPosition: (caretPosition: CaretPosition) => CaretSelection | null | undefined;
86
+ consumePendingFocusAtEnd: (caretPosition: CaretPosition) => boolean;
87
+ requestFocusAtEnd: (caretPosition: CaretPosition) => void;
88
+ focusAtEndVersion: number;
89
+ globalSelectionActive: boolean;
90
+ setGlobalSelectionActive: (active: boolean) => void;
91
+ historyEntries: HistoryEntry[];
92
+ historyCursor: number;
93
+ canUndo: boolean;
94
+ canRedo: boolean;
95
+ queueHistoryAction: (action: HistoryActionDescriptor | null) => void;
96
+ runHistoryAction: (action: HistoryActionDescriptor, callback: () => void) => void;
97
+ jumpToHistoryEntry: (entryIndex: number) => void;
98
+ clearHistory: (reason?: string) => void;
99
+ historySidebarOpen: boolean;
100
+ setHistorySidebarOpen: (open: boolean) => void;
101
+ undo: () => void;
102
+ redo: () => void;
103
+ editorRegistry: EditorRegistry;
104
+ }
105
+ export declare const DocumentContext: import('react').Context<DocumentContextValue | null>;
106
+ /** Hook to access the document context. Throws if used outside provider. */
107
+ export declare function useDocument(): DocumentContextValue;
108
+ //# sourceMappingURL=document-context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"document-context.d.ts","sourceRoot":"","sources":["../../src/context/document-context.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EA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AAc,EAAE,cAAc,CAAC;CAChC;AAED,eAAO,MAAM,eAAe,sDAAmD,CAAC;AAEhF,4EAA4E;AAC5E,wBAAgB,WAAW,IAAI,oBAAoB,CAMlD"}
@@ -0,0 +1,10 @@
1
+ import { default as React } from 'react';
2
+ import { Lex4Document } from '../types/document';
3
+ interface DocumentProviderProps {
4
+ initialDocument?: Lex4Document;
5
+ onDocumentChange?: (doc: Lex4Document) => void;
6
+ children: React.ReactNode;
7
+ }
8
+ export declare const DocumentProvider: React.FC<DocumentProviderProps>;
9
+ export {};
10
+ //# sourceMappingURL=document-provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"document-provider.d.ts","sourceRoot":"","sources":["../../src/context/document-provider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwE,MAAM,OAAO,CAAC;AAC7F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAqBtD,UAAU,qBAAqB;IAC7B,eAAe,CAAC,EAAE,YAAY,CAAC;IAC/B,gBAAgB,CAAC,EAAE,CAAC,GAAG,EAAE,YAAY,KAAK,IAAI,CAAC;IAC/C,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAoPD,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CA+Z5D,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { Lex4Document } from '../types/document';
2
+ import { DocumentAction } from './document-context';
3
+ /**
4
+ * Pure reducer for document state.
5
+ * Handles all page-level and document-level mutations.
6
+ */
7
+ export declare function documentReducer(state: Lex4Document, action: DocumentAction): Lex4Document;
8
+ //# sourceMappingURL=document-reducer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"document-reducer.d.ts","sourceRoot":"","sources":["../../src/context/document-reducer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEtD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AA2CzD;;;GAGG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,cAAc,GAAG,YAAY,CA6NzF"}
@@ -0,0 +1,5 @@
1
+ export { DocumentContext, useDocument } from './document-context';
2
+ export type { DocumentAction, DocumentContextValue } from './document-context';
3
+ export { DocumentProvider } from './document-provider';
4
+ export { documentReducer } from './document-reducer';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/context/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAClE,YAAY,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC/E,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC"}
@@ -0,0 +1,7 @@
1
+ export { measureBlockHeights, totalBlockHeight } from './measure';
2
+ export { assignBlocksToPages } from './paginate';
3
+ export { detectOverflow, detectUnderflow } from './overflow';
4
+ export type { OverflowResult, UnderflowResult } from './overflow';
5
+ export { reflowDocument } from './reflow';
6
+ export type { PageContent, ReflowResult } from './reflow';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/engine/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7D,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { BlockMeasurement } from '../types/page';
2
+ /**
3
+ * Measures top-level block nodes in a Lexical editor's DOM.
4
+ *
5
+ * Reads the rendered height of each direct child element within
6
+ * the contentEditable container. This is the foundation for the
7
+ * pagination engine — we need accurate block heights to decide
8
+ * which blocks fit on each page.
9
+ */
10
+ export declare function measureBlockHeights(editorElement: HTMLElement): BlockMeasurement[];
11
+ /**
12
+ * Computes total height of a list of measured blocks.
13
+ */
14
+ export declare function totalBlockHeight(blocks: BlockMeasurement[]): number;
15
+ //# sourceMappingURL=measure.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"measure.d.ts","sourceRoot":"","sources":["../../src/engine/measure.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEtD;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,aAAa,EAAE,WAAW,GAAG,gBAAgB,EAAE,CAkBlF;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,gBAAgB,EAAE,GAAG,MAAM,CAEnE"}
@@ -0,0 +1,28 @@
1
+ import { BlockMeasurement } from '../types/page';
2
+ /** Result of overflow detection on a single page */
3
+ export interface OverflowResult {
4
+ hasOverflow: boolean;
5
+ fittingBlocks: BlockMeasurement[];
6
+ overflowingBlocks: BlockMeasurement[];
7
+ remainingHeight: number;
8
+ }
9
+ /**
10
+ * Detects which blocks fit within a page's body height and
11
+ * which overflow.
12
+ *
13
+ * Returns the split point: fitting blocks stay, overflowing
14
+ * blocks must be moved to the next page.
15
+ */
16
+ export declare function detectOverflow(blocks: BlockMeasurement[], maxBodyHeight: number): OverflowResult;
17
+ /** Result of underflow detection */
18
+ export interface UnderflowResult {
19
+ hasUnderflow: boolean;
20
+ pullableBlocks: BlockMeasurement[];
21
+ remainingNextPageBlocks: BlockMeasurement[];
22
+ }
23
+ /**
24
+ * Detects if blocks from the next page can be pulled back to
25
+ * fill remaining space on the current page.
26
+ */
27
+ export declare function detectUnderflow(remainingHeight: number, nextPageBlocks: BlockMeasurement[]): UnderflowResult;
28
+ //# sourceMappingURL=overflow.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"overflow.d.ts","sourceRoot":"","sources":["../../src/engine/overflow.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEtD,oDAAoD;AACpD,MAAM,WAAW,cAAc;IAC7B,WAAW,EAAE,OAAO,CAAC;IACrB,aAAa,EAAE,gBAAgB,EAAE,CAAC;IAClC,iBAAiB,EAAE,gBAAgB,EAAE,CAAC;IACtC,eAAe,EAAE,MAAM,CAAC;CACzB;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,gBAAgB,EAAE,EAC1B,aAAa,EAAE,MAAM,GACpB,cAAc,CAsBhB;AAED,oCAAoC;AACpC,MAAM,WAAW,eAAe;IAC9B,YAAY,EAAE,OAAO,CAAC;IACtB,cAAc,EAAE,gBAAgB,EAAE,CAAC;IACnC,uBAAuB,EAAE,gBAAgB,EAAE,CAAC;CAC7C;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAC7B,eAAe,EAAE,MAAM,EACvB,cAAc,EAAE,gBAAgB,EAAE,GACjC,eAAe,CAkBjB"}
@@ -0,0 +1,12 @@
1
+ import { BlockMeasurement, PageAssignment } from '../types/page';
2
+ /**
3
+ * Assigns an ordered list of measured blocks to pages.
4
+ *
5
+ * Fills each page up to `bodyHeightPx`, then starts a new page.
6
+ * Blocks are never split — a block that doesn't fit moves entirely
7
+ * to the next page (mid-block splitting is a future enhancement).
8
+ *
9
+ * Always returns at least one page, even if blocks is empty.
10
+ */
11
+ export declare function assignBlocksToPages(blocks: BlockMeasurement[], bodyHeightPx: number): PageAssignment[];
12
+ //# sourceMappingURL=paginate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paginate.d.ts","sourceRoot":"","sources":["../../src/engine/paginate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAEtE;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,gBAAgB,EAAE,EAC1B,YAAY,EAAE,MAAM,GACnB,cAAc,EAAE,CA4BlB"}
@@ -0,0 +1,22 @@
1
+ import { BlockMeasurement } from '../types/page';
2
+ /** A page's content as an ordered list of block measurements */
3
+ export interface PageContent {
4
+ pageId: string;
5
+ blocks: BlockMeasurement[];
6
+ }
7
+ /** Result of a full document reflow */
8
+ export interface ReflowResult {
9
+ pages: PageContent[];
10
+ pagesChanged: boolean;
11
+ }
12
+ /**
13
+ * Reflows all document content across pages.
14
+ *
15
+ * Takes the combined blocks from all pages and redistributes them
16
+ * to fit within the body height constraint. Creates new pages for
17
+ * overflow, removes empty trailing pages.
18
+ *
19
+ * Always returns at least one page.
20
+ */
21
+ export declare function reflowDocument(pages: PageContent[], bodyHeightPx: number): ReflowResult;
22
+ //# sourceMappingURL=reflow.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reflow.d.ts","sourceRoot":"","sources":["../../src/engine/reflow.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAGtD,gEAAgE;AAChE,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,gBAAgB,EAAE,CAAC;CAC5B;AAED,uCAAuC;AACvC,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,WAAW,EAAE,CAAC;IACrB,YAAY,EAAE,OAAO,CAAC;CACvB;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,WAAW,EAAE,EACpB,YAAY,EAAE,MAAM,GACnB,YAAY,CA6Dd"}
@@ -0,0 +1,4 @@
1
+ export { usePagination } from './use-pagination';
2
+ export { useOverflowDetection } from './use-overflow-detection';
3
+ export { useHeaderFooter } from './use-header-footer';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * useHeaderFooter — Tracks header/footer height via ResizeObserver
3
+ * and reports changes to the document context.
4
+ *
5
+ * Clamps the reported height to the maximum allowed.
6
+ */
7
+ export declare function useHeaderFooter(maxHeight: number, onHeightChange: (height: number) => void): {
8
+ attachRef: (el: HTMLElement | null) => void;
9
+ };
10
+ //# sourceMappingURL=use-header-footer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-header-footer.d.ts","sourceRoot":"","sources":["../../src/hooks/use-header-footer.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,SAAS,EAAE,MAAM,EACjB,cAAc,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI;oBAMjC,WAAW,GAAG,IAAI;EAgC1B"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * useOverflowDetection — Debounced overflow detection for a page body.
3
+ *
4
+ * Watches a contentEditable element and fires `onOverflow` when the
5
+ * content height exceeds the allowed body height. Uses a debounce
6
+ * to avoid firing on every keystroke.
7
+ */
8
+ export declare function useOverflowDetection(bodyHeight: number, onOverflow: (() => void) | undefined, debounceMs?: number): {
9
+ attachRef: (el: HTMLElement | null) => void;
10
+ };
11
+ //# sourceMappingURL=use-overflow-detection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-overflow-detection.d.ts","sourceRoot":"","sources":["../../src/hooks/use-overflow-detection.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAClC,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,EACpC,UAAU,GAAE,MAAY;oBAiBjB,WAAW,GAAG,IAAI;EA2B1B"}