@stll/folio-core 0.74.0 → 0.76.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/ai-edits/clean-text.d.ts +4 -1
- package/dist/ai-edits/clean-text.js +21 -7
- package/dist/ai-edits/headless.d.ts +7 -3
- package/dist/ai-edits/headless.js +36 -21
- package/dist/ai-edits/note-references.d.ts +1 -1
- package/dist/ai-edits/note-references.js +1 -1
- package/dist/ai-edits/pending-suggestions.d.ts +9 -7
- package/dist/ai-edits/pending-suggestions.js +135 -90
- package/dist/ai-edits/pendingJoin.d.ts +5 -1
- package/dist/ai-edits/pendingJoin.js +6 -2
- package/dist/ai-edits/read.js +9 -3
- package/dist/ai-edits/retired-comment-receipts.d.ts +2 -2
- package/dist/ai-edits/retired-comment-receipts.js +3 -18
- package/dist/ai-edits/tracked-batch-fidelity.d.ts +6 -10
- package/dist/ai-edits/tracked-batch-fidelity.js +3 -182
- package/dist/ai-edits/types.d.ts +9 -4
- package/dist/canonical/batchCommentReferences.js +2 -1
- package/dist/canonical/canonicalBatchReview.d.ts +4 -1
- package/dist/canonical/canonicalBatchReview.js +37 -22
- package/dist/canonical/canonicalComments.d.ts +6 -2
- package/dist/canonical/canonicalComments.js +16 -6
- package/dist/canonical/canonicalCompilerRefusal.d.ts +2 -4
- package/dist/canonical/canonicalCompilerRefusal.js +20 -14
- package/dist/canonical/canonicalPublicOperations.js +231 -79
- package/dist/canonical/canonicalRefusalGrounds.d.ts +4 -0
- package/dist/canonical/canonicalRefusalGrounds.js +56 -0
- package/dist/canonical/canonicalSession.d.ts +12 -6
- package/dist/canonical/canonicalSession.js +119 -122
- package/dist/canonical/canonicalTrackedBatchFidelity.js +3 -3
- package/dist/compare/inline-atoms.d.ts +35 -41
- package/dist/compare/inline-atoms.js +2 -465
- package/dist/compare/section-boundary-properties.d.ts +3 -30
- package/dist/compare/section-boundary-properties.js +4 -72
- package/dist/controller/canonicalClipboard.d.ts +1 -1
- package/dist/controller/canonicalClipboard.js +110 -55
- package/dist/controller/canonicalComposition.d.ts +1 -1
- package/dist/controller/canonicalComposition.js +5 -5
- package/dist/controller/canonicalContentControlValue.js +7 -7
- package/dist/controller/canonicalInput.d.ts +4 -2
- package/dist/controller/canonicalInput.js +33 -16
- package/dist/controller/canonicalReview.d.ts +21 -0
- package/dist/controller/canonicalReview.js +44 -9
- package/dist/controller/canonicalStoryEditor.d.ts +2 -3
- package/dist/controller/canonicalStoryEditor.js +43 -25
- package/dist/controller/canonicalStructure.d.ts +19 -3
- package/dist/controller/canonicalStructure.js +182 -58
- package/dist/controller/deferredDisplayListPainter.d.ts +8 -0
- package/dist/controller/deferredDisplayListPainter.js +34 -0
- package/dist/controller/folioEditor.js +4 -2
- package/dist/controller/fontReadiness.js +50 -23
- package/dist/controller/headerFooterEditorManager.js +3 -17
- package/dist/controller/hiddenEditorApi.d.ts +24 -3
- package/dist/controller/hiddenEditorApi.js +2 -0
- package/dist/controller/hiddenEditorManager.js +135 -207
- package/dist/controller/layoutPipeline.d.ts +4 -86
- package/dist/controller/layoutPipeline.js +8 -727
- package/dist/controller/layoutPipelineExecution.d.ts +94 -0
- package/dist/controller/layoutPipelineExecution.js +730 -0
- package/dist/controller/noteEditorManager.js +3 -16
- package/dist/docx/blockContentParser.d.ts +1 -3
- package/dist/docx/blockContentParser.js +3 -10
- package/dist/docx/bulletMarkers.d.ts +8 -0
- package/dist/docx/bulletMarkers.js +9 -1
- package/dist/docx/canonicalSave.d.ts +4 -3
- package/dist/docx/canonicalSave.js +4 -3
- package/dist/docx/canonicalSessionInput.js +25 -11
- package/dist/docx/ensureParaIds.d.ts +31 -0
- package/dist/docx/ensureParaIds.js +57 -32
- package/dist/docx/ensureUniqueControlIds.d.ts +13 -0
- package/dist/docx/ensureUniqueControlIds.js +47 -29
- package/dist/docx/ensureUniqueRevisionIds.d.ts +13 -0
- package/dist/docx/ensureUniqueRevisionIds.js +52 -29
- package/dist/docx/listMarkerComputation.d.ts +24 -17
- package/dist/docx/listMarkerComputation.js +31 -60
- package/dist/docx/listModelNormalization.js +8 -15
- package/dist/docx/rezip.d.ts +16 -3
- package/dist/docx/rezip.js +35 -9
- package/dist/docx/selectiveSave.js +13 -5
- package/dist/docx/server/templatePlan/apply.js +96 -7
- package/dist/docx/server/templatePlan/blocks.d.ts +70 -3
- package/dist/docx/server/templatePlan/blocks.js +272 -10
- package/dist/docx/server/templatePlan/builders.d.ts +52 -2
- package/dist/docx/server/templatePlan/builders.js +224 -5
- package/dist/docx/server/templatePlan/effects.d.ts +27 -0
- package/dist/docx/server/templatePlan/effects.js +188 -0
- package/dist/docx/server/templatePlan/emit.d.ts +4 -1
- package/dist/docx/server/templatePlan/emit.js +46 -2
- package/dist/docx/server/templatePlan/inspect.js +39 -52
- package/dist/docx/server/templatePlan/labels.d.ts +7 -2
- package/dist/docx/server/templatePlan/labels.js +120 -23
- package/dist/docx/server/templatePlan/plan.d.ts +24 -3
- package/dist/docx/server/templatePlan/plan.js +54 -15
- package/dist/docx/server/templatePlan/planShape.js +76 -22
- package/dist/docx/server/templatePlan/revisions.d.ts +46 -0
- package/dist/docx/server/templatePlan/revisions.js +407 -0
- package/dist/docx/server/templatePlan/story.d.ts +23 -1
- package/dist/docx/server/templatePlan/story.js +60 -2
- package/dist/docx/server/templatePlan/types.d.ts +354 -16
- package/dist/docx/server/templatePlan/verify.js +164 -14
- package/dist/docx/server/templatePlan/xml.d.ts +3 -0
- package/dist/docx/server/templatePlan/xml.js +4 -1
- package/dist/i18n/messages/ar.gen.js +1 -0
- package/dist/i18n/messages/catalogs.gen.d.ts +17 -0
- package/dist/i18n/messages/catalogs.gen.js +17 -0
- package/dist/i18n/messages/cs.gen.js +1 -0
- package/dist/i18n/messages/de.gen.js +1 -0
- package/dist/i18n/messages/en.gen.js +1 -0
- package/dist/i18n/messages/es.gen.js +1 -0
- package/dist/i18n/messages/et.gen.js +1 -0
- package/dist/i18n/messages/fr.gen.js +1 -0
- package/dist/i18n/messages/he.gen.js +1 -0
- package/dist/i18n/messages/hi.gen.js +1 -0
- package/dist/i18n/messages/hu.gen.js +1 -0
- package/dist/i18n/messages/lt.gen.js +1 -0
- package/dist/i18n/messages/lv.gen.js +1 -0
- package/dist/i18n/messages/messages.gen.d.ts +1 -0
- package/dist/i18n/messages/pl.gen.js +1 -0
- package/dist/i18n/messages/pt-BR.gen.js +1 -0
- package/dist/i18n/messages/sk.gen.js +1 -0
- package/dist/i18n/messages/tr.gen.js +1 -0
- package/dist/i18n/messages/zh-CN.gen.js +1 -0
- package/dist/internal/revisionResolutionStep.d.ts +2 -31
- package/dist/internal/revisionResolutionStep.js +2 -171
- package/dist/layout-bridge/convert/toFlowBlocks.js +0 -12
- package/dist/layout-bridge/convert/topLevelConversion.js +1 -10
- package/dist/prosemirror/commands/comments.d.ts +6 -234
- package/dist/prosemirror/commands/comments.js +5 -2464
- package/dist/prosemirror/commands/index.d.ts +4 -2
- package/dist/prosemirror/commands/index.js +4 -2
- package/dist/prosemirror/commands/tableCellMergeResolution.d.ts +1 -11
- package/dist/prosemirror/commands/tableCellMergeResolution.js +3 -154
- package/dist/prosemirror/extensions/features/ImagePasteExtension.js +1 -1
- package/dist/prosemirror/extensions/marks/HyperlinkExtension.js +6 -8
- package/dist/prosemirror/hyperlinkRemoval.d.ts +11 -8
- package/dist/prosemirror/hyperlinkRemoval.js +24 -15
- package/dist/prosemirror/listMarker.d.ts +1 -6
- package/dist/prosemirror/listMarker.js +4 -56
- package/dist/prosemirror/paraIds.d.ts +1 -14
- package/dist/prosemirror/paraIds.js +1 -14
- package/dist/prosemirror/paragraphMarkJoin.d.ts +0 -16
- package/dist/prosemirror/paragraphMarkJoin.js +3 -46
- package/dist/prosemirror/projectionReview.d.ts +49 -0
- package/dist/prosemirror/projectionReview.js +292 -0
- package/dist/prosemirror/rebaseParagraphRunFormatting.d.ts +1 -13
- package/dist/prosemirror/rebaseParagraphRunFormatting.js +1 -16
- package/dist/prosemirror/replacedAnnotations.d.ts +2 -5
- package/dist/prosemirror/replacedAnnotations.js +1 -10
- package/dist/prosemirror/revisionCarriers.d.ts +9 -1
- package/dist/prosemirror/revisionCarriers.js +15 -1
- package/dist/prosemirror/revisionRangeQueries.d.ts +32 -0
- package/dist/prosemirror/revisionRangeQueries.js +76 -0
- package/dist/prosemirror/runFormattingMarkNames.d.ts +1 -1
- package/dist/prosemirror/runFormattingMarkNames.js +1 -1
- package/dist/prosemirror/suggestionQueries.d.ts +114 -0
- package/dist/prosemirror/suggestionQueries.js +320 -0
- package/dist/prosemirror/tableGridMutation.d.ts +1 -16
- package/dist/prosemirror/tableGridMutation.js +1 -78
- package/dist/prosemirror/tableRowRevisionOwnership.d.ts +18 -0
- package/dist/prosemirror/tableRowRevisionOwnership.js +7 -0
- package/dist/prosemirror/utils/extractTrackedChanges.js +14 -4
- package/dist/server.d.ts +2 -2
- package/dist/types/canonicalCapabilities.d.ts +40 -69
- package/dist/types/canonicalCapabilities.js +51 -65
- package/dist/types/canonicalComments.d.ts +2 -2
- package/dist/types/canonicalSections.d.ts +2 -2
- package/dist/utils/clipboard.d.ts +2 -28
- package/dist/utils/clipboard.js +1 -96
- package/dist/utils/clipboardFiles.d.ts +27 -0
- package/dist/utils/clipboardFiles.js +98 -0
- package/dist/utils/rulerControl.d.ts +1 -0
- package/dist/utils/rulerControl.js +2 -1
- package/package.json +2 -2
- package/dist/internal/headlessRevisionResolutionGuard.d.ts +0 -3
- package/dist/internal/headlessRevisionResolutionGuard.js +0 -18
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
// src/utils/clipboardFiles.ts
|
|
2
|
+
/**
|
|
3
|
+
* Custom MIME type for internal clipboard format
|
|
4
|
+
*/
|
|
5
|
+
const INTERNAL_CLIPBOARD_TYPE = "application/x-stella-folio";
|
|
6
|
+
/**
|
|
7
|
+
* Standard clipboard MIME types
|
|
8
|
+
*/
|
|
9
|
+
const CLIPBOARD_TYPES = {
|
|
10
|
+
HTML: "text/html",
|
|
11
|
+
PLAIN: "text/plain"
|
|
12
|
+
};
|
|
13
|
+
function getClipboardImageFiles(clipboardData) {
|
|
14
|
+
if (!clipboardData) return [];
|
|
15
|
+
const collectFromItems = () => {
|
|
16
|
+
const items = clipboardData.items;
|
|
17
|
+
if (!items || items.length === 0) return [];
|
|
18
|
+
const files = [];
|
|
19
|
+
for (const item of Array.from(items)) {
|
|
20
|
+
if (item.kind !== "file") continue;
|
|
21
|
+
if (!item.type.startsWith("image/")) continue;
|
|
22
|
+
const file = item.getAsFile();
|
|
23
|
+
if (file) files.push(file);
|
|
24
|
+
}
|
|
25
|
+
return files;
|
|
26
|
+
};
|
|
27
|
+
const collectFromFiles = () => {
|
|
28
|
+
const clipboardFiles = clipboardData.files;
|
|
29
|
+
if (!clipboardFiles || clipboardFiles.length === 0) return [];
|
|
30
|
+
return Array.from(clipboardFiles).filter((file) => file.type.startsWith("image/"));
|
|
31
|
+
};
|
|
32
|
+
const candidates = collectFromItems();
|
|
33
|
+
const files = candidates.length ? candidates : collectFromFiles();
|
|
34
|
+
if (files.length <= 1) return files;
|
|
35
|
+
const preferredTypes = [
|
|
36
|
+
"image/png",
|
|
37
|
+
"image/jpeg",
|
|
38
|
+
"image/webp",
|
|
39
|
+
"image/gif",
|
|
40
|
+
"image/svg+xml",
|
|
41
|
+
"image/bmp",
|
|
42
|
+
"image/tiff"
|
|
43
|
+
];
|
|
44
|
+
const pickBest = (group) => {
|
|
45
|
+
let best = group[0];
|
|
46
|
+
let bestRank = preferredTypes.indexOf(best.type);
|
|
47
|
+
if (bestRank < 0) bestRank = Number.MAX_SAFE_INTEGER;
|
|
48
|
+
for (const file of group.slice(1)) {
|
|
49
|
+
let rank = preferredTypes.indexOf(file.type);
|
|
50
|
+
if (rank < 0) rank = Number.MAX_SAFE_INTEGER;
|
|
51
|
+
if (rank < bestRank) {
|
|
52
|
+
best = file;
|
|
53
|
+
bestRank = rank;
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
if (rank === bestRank && file.size > best.size) best = file;
|
|
57
|
+
}
|
|
58
|
+
return best;
|
|
59
|
+
};
|
|
60
|
+
const groups = /* @__PURE__ */ new Map();
|
|
61
|
+
for (const file of files) {
|
|
62
|
+
const rawName = file.name.trim();
|
|
63
|
+
const key = (rawName ? rawName.replace(/\.[^/.]+$/, "").toLowerCase() : "") || `size:${file.size}`;
|
|
64
|
+
const bucket = groups.get(key);
|
|
65
|
+
if (bucket) bucket.push(file);
|
|
66
|
+
else groups.set(key, [file]);
|
|
67
|
+
}
|
|
68
|
+
const deduped = [];
|
|
69
|
+
for (const group of groups.values()) deduped.push(pickBest(group));
|
|
70
|
+
return deduped;
|
|
71
|
+
}
|
|
72
|
+
const ENGINE_CLIPBOARD_TYPES = [
|
|
73
|
+
INTERNAL_CLIPBOARD_TYPE,
|
|
74
|
+
CLIPBOARD_TYPES.HTML,
|
|
75
|
+
CLIPBOARD_TYPES.PLAIN
|
|
76
|
+
];
|
|
77
|
+
const hasEngineClipboardContent = (clipboardData) => {
|
|
78
|
+
if (!clipboardData.types || !clipboardData.getData) return false;
|
|
79
|
+
const availableTypes = new Set(Array.from(clipboardData.types));
|
|
80
|
+
for (const type of ENGINE_CLIPBOARD_TYPES) {
|
|
81
|
+
if (!availableTypes.has(type)) continue;
|
|
82
|
+
try {
|
|
83
|
+
if (clipboardData.getData(type) !== "") return true;
|
|
84
|
+
} catch {}
|
|
85
|
+
}
|
|
86
|
+
return false;
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* Return image files only when the clipboard has no readable editor content.
|
|
90
|
+
* Rich HTML, internal payloads, and plain text must stay on the normal paste
|
|
91
|
+
* path; some applications include a rendered image beside that content.
|
|
92
|
+
*/
|
|
93
|
+
function getStandaloneClipboardImageFiles(clipboardData) {
|
|
94
|
+
const imageFiles = getClipboardImageFiles(clipboardData);
|
|
95
|
+
if (imageFiles.length === 0 || !clipboardData) return imageFiles;
|
|
96
|
+
return hasEngineClipboardContent(clipboardData) ? [] : imageFiles;
|
|
97
|
+
}
|
|
98
|
+
export { CLIPBOARD_TYPES, INTERNAL_CLIPBOARD_TYPE, getClipboardImageFiles, getStandaloneClipboardImageFiles };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { TWIPS_PER_INCH } from "./units.js";
|
|
2
2
|
// src/utils/rulerControl.ts
|
|
3
3
|
const TWIPS_PER_CM = 567;
|
|
4
|
+
const HORIZONTAL_RULER_HEIGHT_PX = 22;
|
|
4
5
|
const MIN_CONTENT_SIZE_TWIPS = 720;
|
|
5
6
|
/** Existing pointer bounds, shared with the keyboard controls. */
|
|
6
7
|
function getHorizontalRulerBounds({ pageWidth, leftMargin, rightMargin, leftIndent, rightIndent }) {
|
|
@@ -91,4 +92,4 @@ function createRulerControl({ value, min, max, unit, onChange }) {
|
|
|
91
92
|
}
|
|
92
93
|
};
|
|
93
94
|
}
|
|
94
|
-
export { clampRulerValue, createRulerControl, getHorizontalRulerBounds, getVerticalRulerBounds };
|
|
95
|
+
export { HORIZONTAL_RULER_HEIGHT_PX, clampRulerValue, createRulerControl, getHorizontalRulerBounds, getVerticalRulerBounds };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stll/folio-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.76.0",
|
|
4
4
|
"description": "Headless DOCX engine: reads .docx into a typed OOXML model, applies every edit as a validated operation, paginates it, and writes .docx back with untouched parts byte for byte.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"document-model",
|
|
@@ -173,7 +173,7 @@
|
|
|
173
173
|
"perf": "bun scripts/profile-editor.ts"
|
|
174
174
|
},
|
|
175
175
|
"dependencies": {
|
|
176
|
-
"@stll/docx-core": "^0.
|
|
176
|
+
"@stll/docx-core": "^0.47.0",
|
|
177
177
|
"@stll/template-conditions": "^0.7.0",
|
|
178
178
|
"@stll/utf8-boundaries": "0.2.0",
|
|
179
179
|
"better-result": "3.0.1",
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
// src/internal/headlessRevisionResolutionGuard.ts
|
|
2
|
-
const UNSAFE_PLUGIN_KEY_PREFIXES = [
|
|
3
|
-
"collab$",
|
|
4
|
-
"history$",
|
|
5
|
-
"y-sync$",
|
|
6
|
-
"y-undo$"
|
|
7
|
-
];
|
|
8
|
-
const pluginRuntimeKey = (plugin) => {
|
|
9
|
-
const key = Reflect.get(plugin, "key");
|
|
10
|
-
return typeof key === "string" ? key : null;
|
|
11
|
-
};
|
|
12
|
-
const retainsOrTransportsSteps = (plugin) => {
|
|
13
|
-
const key = pluginRuntimeKey(plugin);
|
|
14
|
-
return key !== null && UNSAFE_PLUGIN_KEY_PREFIXES.some((prefix) => key.startsWith(prefix));
|
|
15
|
-
};
|
|
16
|
-
/** Build the private plugin set for synchronous headless review states. */
|
|
17
|
-
const pluginsForHeadlessRevisionResolution = (plugins) => plugins.filter((plugin) => !retainsOrTransportsSteps(plugin));
|
|
18
|
-
export { pluginsForHeadlessRevisionResolution };
|