@kedataindo/docflow-core 0.0.70 → 0.0.71

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.
@@ -1 +1 @@
1
- export { b as AIAction, c as AIActionRequest, d as AICompleteRequest, e as AIConfig, f as AIContextLocation, g as AIDraftCitation, h as AIDraftEvent, a as AIDraftFn, i as AIProvider, A as AIStreamFn, k as AiChatRequestContext, l as Auth, m as CONTEXT_CHAR_CAP, n as CslDate, o as CslItemData, p as CslName, H as HttpKeyStorageUrls, K as KeyStorage, L as LOCAL_STORAGE_KEY, O as OpenAICompatibleConfig, S as StreamEvent, r as buildAIPrompt, s as httpKeyStorage, t as localStorageKeyStorage, u as memoryKeyStorage, v as openaiCompatibleProvider, w as toAIStreamFn, x as trimContextAfter, y as trimContextBefore } from '../index-CDULnDYX.cjs';
1
+ export { b as AIAction, c as AIActionRequest, d as AICompleteRequest, e as AIConfig, f as AIContextLocation, g as AIDraftCitation, h as AIDraftEvent, a as AIDraftFn, i as AIProvider, A as AIStreamFn, k as AiChatRequestContext, l as Auth, m as CONTEXT_CHAR_CAP, n as CslDate, o as CslItemData, p as CslName, H as HttpKeyStorageUrls, K as KeyStorage, L as LOCAL_STORAGE_KEY, O as OpenAICompatibleConfig, S as StreamEvent, r as buildAIPrompt, s as httpKeyStorage, t as localStorageKeyStorage, u as memoryKeyStorage, v as openaiCompatibleProvider, w as toAIStreamFn, x as trimContextAfter, y as trimContextBefore } from '../index-BTF6gajh.cjs';
@@ -1 +1 @@
1
- export { b as AIAction, c as AIActionRequest, d as AICompleteRequest, e as AIConfig, f as AIContextLocation, g as AIDraftCitation, h as AIDraftEvent, a as AIDraftFn, i as AIProvider, A as AIStreamFn, k as AiChatRequestContext, l as Auth, m as CONTEXT_CHAR_CAP, n as CslDate, o as CslItemData, p as CslName, H as HttpKeyStorageUrls, K as KeyStorage, L as LOCAL_STORAGE_KEY, O as OpenAICompatibleConfig, S as StreamEvent, r as buildAIPrompt, s as httpKeyStorage, t as localStorageKeyStorage, u as memoryKeyStorage, v as openaiCompatibleProvider, w as toAIStreamFn, x as trimContextAfter, y as trimContextBefore } from '../index-CDULnDYX.js';
1
+ export { b as AIAction, c as AIActionRequest, d as AICompleteRequest, e as AIConfig, f as AIContextLocation, g as AIDraftCitation, h as AIDraftEvent, a as AIDraftFn, i as AIProvider, A as AIStreamFn, k as AiChatRequestContext, l as Auth, m as CONTEXT_CHAR_CAP, n as CslDate, o as CslItemData, p as CslName, H as HttpKeyStorageUrls, K as KeyStorage, L as LOCAL_STORAGE_KEY, O as OpenAICompatibleConfig, S as StreamEvent, r as buildAIPrompt, s as httpKeyStorage, t as localStorageKeyStorage, u as memoryKeyStorage, v as openaiCompatibleProvider, w as toAIStreamFn, x as trimContextAfter, y as trimContextBefore } from '../index-BTF6gajh.js';
@@ -84,6 +84,8 @@ interface AIActionRequest {
84
84
  before: string;
85
85
  after: string;
86
86
  } & AIContextLocation;
87
+ /** Cursor location context (page, line, paragraph index, section heading). */
88
+ location?: AIContextLocation;
87
89
  /** User instruction (/ai prompt, chat message, tone target, target language). */
88
90
  prompt?: string;
89
91
  /** For doc-aware chat / RAG scoping. */
@@ -84,6 +84,8 @@ interface AIActionRequest {
84
84
  before: string;
85
85
  after: string;
86
86
  } & AIContextLocation;
87
+ /** Cursor location context (page, line, paragraph index, section heading). */
88
+ location?: AIContextLocation;
87
89
  /** User instruction (/ai prompt, chat message, tone target, target language). */
88
90
  prompt?: string;
89
91
  /** For doc-aware chat / RAG scoping. */
package/dist/index.cjs CHANGED
@@ -729,27 +729,27 @@ var calculatePageCount = (view, pageOptions, headerHeight = 0, footerHeight = 0)
729
729
  return currentPageCount;
730
730
  }
731
731
  }
732
+ let totalEditorContentHeight = 0;
733
+ for (const child of Array.from(editorDom.children)) {
734
+ if (!(child instanceof HTMLElement)) continue;
735
+ if (child.hasAttribute("data-rm-pagination")) continue;
736
+ if (child.classList.contains("rm-page-break")) continue;
737
+ totalEditorContentHeight += child.getBoundingClientRect().height;
738
+ }
739
+ const maxPagesByContent = Math.ceil(totalEditorContentHeight / pageContentAreaHeight);
740
+ const contentCap = Math.max(currentPageCount, maxPagesByContent + 1);
732
741
  const prev = pageGapTracker.get(editorDom);
733
- if (prev && prev.pages < currentPageCount && lastPageGap > prev.gap - 2) {
742
+ if (prev && prev.pages < currentPageCount && lastPageGap > prev.gap - 2 && currentPageCount >= maxPagesByContent) {
734
743
  return currentPageCount;
735
744
  }
736
745
  const recent = prev?.recent ?? [];
737
746
  let flapping = prev?.flapping ?? [];
738
- if (recent.length >= 4 && recent.filter((p) => p === currentPageCount + addPage).length >= 2) {
747
+ if (recent.length >= 4 && recent.filter((p) => p === currentPageCount + addPage).length >= 2 && currentPageCount >= maxPagesByContent) {
739
748
  flapping = [.../* @__PURE__ */ new Set([...flapping, currentPageCount + addPage, currentPageCount])];
740
749
  pageGapTracker.set(editorDom, { gap: lastPageGap, pages: currentPageCount, recent, flapping });
741
750
  return currentPageCount;
742
751
  }
743
752
  pageGapTracker.set(editorDom, { gap: lastPageGap, pages: currentPageCount, recent, flapping });
744
- let totalEditorContentHeight = 0;
745
- for (const child of Array.from(editorDom.children)) {
746
- if (!(child instanceof HTMLElement)) continue;
747
- if (child.hasAttribute("data-rm-pagination")) continue;
748
- if (child.classList.contains("rm-page-break")) continue;
749
- totalEditorContentHeight += child.getBoundingClientRect().height;
750
- }
751
- const maxPagesByContent = Math.ceil(totalEditorContentHeight / pageContentAreaHeight);
752
- const contentCap = Math.max(currentPageCount, maxPagesByContent + 1);
753
753
  if (currentPageCount + addPage > contentCap) {
754
754
  return contentCap;
755
755
  }
package/dist/index.d.cts CHANGED
@@ -4,8 +4,8 @@ import { IndexeddbPersistence } from 'y-indexeddb';
4
4
  import { WebrtcProvider } from 'y-webrtc';
5
5
  import { WebsocketProvider } from 'y-websocket';
6
6
  import * as Y from 'yjs';
7
- import { I as ImageUploadHandler, C as CitationPort, A as AIStreamFn, a as AIDraftFn } from './index-CDULnDYX.cjs';
8
- export { b as AIAction, c as AIActionRequest, d as AICompleteRequest, e as AIConfig, f as AIContextLocation, g as AIDraftCitation, h as AIDraftEvent, i as AIProvider, j as AIProviderFactory, k as AiChatRequestContext, l as Auth, m as CONTEXT_CHAR_CAP, n as CslDate, o as CslItemData, p as CslName, H as HttpKeyStorageUrls, q as ImageUploadResult, K as KeyStorage, L as LOCAL_STORAGE_KEY, O as OpenAICompatibleConfig, S as StreamEvent, r as buildAIPrompt, s as httpKeyStorage, t as localStorageKeyStorage, u as memoryKeyStorage, v as openaiCompatibleProvider, w as toAIStreamFn, x as trimContextAfter, y as trimContextBefore } from './index-CDULnDYX.cjs';
7
+ import { I as ImageUploadHandler, C as CitationPort, A as AIStreamFn, a as AIDraftFn } from './index-BTF6gajh.cjs';
8
+ export { b as AIAction, c as AIActionRequest, d as AICompleteRequest, e as AIConfig, f as AIContextLocation, g as AIDraftCitation, h as AIDraftEvent, i as AIProvider, j as AIProviderFactory, k as AiChatRequestContext, l as Auth, m as CONTEXT_CHAR_CAP, n as CslDate, o as CslItemData, p as CslName, H as HttpKeyStorageUrls, q as ImageUploadResult, K as KeyStorage, L as LOCAL_STORAGE_KEY, O as OpenAICompatibleConfig, S as StreamEvent, r as buildAIPrompt, s as httpKeyStorage, t as localStorageKeyStorage, u as memoryKeyStorage, v as openaiCompatibleProvider, w as toAIStreamFn, x as trimContextAfter, y as trimContextBefore } from './index-BTF6gajh.cjs';
9
9
  import { PluginKey } from '@tiptap/pm/state';
10
10
  import { Node } from '@tiptap/pm/model';
11
11
 
package/dist/index.d.ts CHANGED
@@ -4,8 +4,8 @@ import { IndexeddbPersistence } from 'y-indexeddb';
4
4
  import { WebrtcProvider } from 'y-webrtc';
5
5
  import { WebsocketProvider } from 'y-websocket';
6
6
  import * as Y from 'yjs';
7
- import { I as ImageUploadHandler, C as CitationPort, A as AIStreamFn, a as AIDraftFn } from './index-CDULnDYX.js';
8
- export { b as AIAction, c as AIActionRequest, d as AICompleteRequest, e as AIConfig, f as AIContextLocation, g as AIDraftCitation, h as AIDraftEvent, i as AIProvider, j as AIProviderFactory, k as AiChatRequestContext, l as Auth, m as CONTEXT_CHAR_CAP, n as CslDate, o as CslItemData, p as CslName, H as HttpKeyStorageUrls, q as ImageUploadResult, K as KeyStorage, L as LOCAL_STORAGE_KEY, O as OpenAICompatibleConfig, S as StreamEvent, r as buildAIPrompt, s as httpKeyStorage, t as localStorageKeyStorage, u as memoryKeyStorage, v as openaiCompatibleProvider, w as toAIStreamFn, x as trimContextAfter, y as trimContextBefore } from './index-CDULnDYX.js';
7
+ import { I as ImageUploadHandler, C as CitationPort, A as AIStreamFn, a as AIDraftFn } from './index-BTF6gajh.js';
8
+ export { b as AIAction, c as AIActionRequest, d as AICompleteRequest, e as AIConfig, f as AIContextLocation, g as AIDraftCitation, h as AIDraftEvent, i as AIProvider, j as AIProviderFactory, k as AiChatRequestContext, l as Auth, m as CONTEXT_CHAR_CAP, n as CslDate, o as CslItemData, p as CslName, H as HttpKeyStorageUrls, q as ImageUploadResult, K as KeyStorage, L as LOCAL_STORAGE_KEY, O as OpenAICompatibleConfig, S as StreamEvent, r as buildAIPrompt, s as httpKeyStorage, t as localStorageKeyStorage, u as memoryKeyStorage, v as openaiCompatibleProvider, w as toAIStreamFn, x as trimContextAfter, y as trimContextBefore } from './index-BTF6gajh.js';
9
9
  import { PluginKey } from '@tiptap/pm/state';
10
10
  import { Node } from '@tiptap/pm/model';
11
11
 
package/dist/index.js CHANGED
@@ -669,27 +669,27 @@ var calculatePageCount = (view, pageOptions, headerHeight = 0, footerHeight = 0)
669
669
  return currentPageCount;
670
670
  }
671
671
  }
672
+ let totalEditorContentHeight = 0;
673
+ for (const child of Array.from(editorDom.children)) {
674
+ if (!(child instanceof HTMLElement)) continue;
675
+ if (child.hasAttribute("data-rm-pagination")) continue;
676
+ if (child.classList.contains("rm-page-break")) continue;
677
+ totalEditorContentHeight += child.getBoundingClientRect().height;
678
+ }
679
+ const maxPagesByContent = Math.ceil(totalEditorContentHeight / pageContentAreaHeight);
680
+ const contentCap = Math.max(currentPageCount, maxPagesByContent + 1);
672
681
  const prev = pageGapTracker.get(editorDom);
673
- if (prev && prev.pages < currentPageCount && lastPageGap > prev.gap - 2) {
682
+ if (prev && prev.pages < currentPageCount && lastPageGap > prev.gap - 2 && currentPageCount >= maxPagesByContent) {
674
683
  return currentPageCount;
675
684
  }
676
685
  const recent = prev?.recent ?? [];
677
686
  let flapping = prev?.flapping ?? [];
678
- if (recent.length >= 4 && recent.filter((p) => p === currentPageCount + addPage).length >= 2) {
687
+ if (recent.length >= 4 && recent.filter((p) => p === currentPageCount + addPage).length >= 2 && currentPageCount >= maxPagesByContent) {
679
688
  flapping = [.../* @__PURE__ */ new Set([...flapping, currentPageCount + addPage, currentPageCount])];
680
689
  pageGapTracker.set(editorDom, { gap: lastPageGap, pages: currentPageCount, recent, flapping });
681
690
  return currentPageCount;
682
691
  }
683
692
  pageGapTracker.set(editorDom, { gap: lastPageGap, pages: currentPageCount, recent, flapping });
684
- let totalEditorContentHeight = 0;
685
- for (const child of Array.from(editorDom.children)) {
686
- if (!(child instanceof HTMLElement)) continue;
687
- if (child.hasAttribute("data-rm-pagination")) continue;
688
- if (child.classList.contains("rm-page-break")) continue;
689
- totalEditorContentHeight += child.getBoundingClientRect().height;
690
- }
691
- const maxPagesByContent = Math.ceil(totalEditorContentHeight / pageContentAreaHeight);
692
- const contentCap = Math.max(currentPageCount, maxPagesByContent + 1);
693
693
  if (currentPageCount + addPage > contentCap) {
694
694
  return contentCap;
695
695
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kedataindo/docflow-core",
3
3
  "license": "UNLICENSED",
4
- "version": "0.0.70",
4
+ "version": "0.0.71",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.js",