@stll/folio-core 0.57.0 → 0.58.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 (39) hide show
  1. package/dist/ai-edits/apply.js +77 -8
  2. package/dist/controller/canonicalClipboard.d.ts +3 -1
  3. package/dist/controller/canonicalClipboard.js +24 -12
  4. package/dist/controller/canonicalComposition.d.ts +13 -4
  5. package/dist/controller/canonicalComposition.js +82 -9
  6. package/dist/controller/canonicalInput.d.ts +1 -1
  7. package/dist/controller/canonicalInput.js +4 -3
  8. package/dist/controller/canonicalSelection.js +10 -1
  9. package/dist/controller/canonicalSession.d.ts +1 -1
  10. package/dist/controller/canonicalSession.js +59 -23
  11. package/dist/controller/canonicalStoryEditor.d.ts +1 -1
  12. package/dist/controller/canonicalStoryEditor.js +1 -1
  13. package/dist/controller/canonicalStructure.js +8 -3
  14. package/dist/controller/hiddenEditorApi.js +1 -1
  15. package/dist/controller/hiddenEditorManager.js +1 -1
  16. package/dist/docx/listRendering.d.ts +18 -0
  17. package/dist/{prosemirror/conversion/listRenderingDefinition.js → docx/listRendering.js} +17 -3
  18. package/dist/docx/server/materializeYjsDocx.js +1 -1
  19. package/dist/markdown/internals.js +7 -0
  20. package/dist/markdown/renderParagraph.js +11 -12
  21. package/dist/markdown/renderRuns.js +2 -2
  22. package/dist/markdown/types.d.ts +3 -0
  23. package/dist/prosemirror/attrs/index.js +4 -0
  24. package/dist/prosemirror/conversion/fromProseDoc.d.ts +8 -1
  25. package/dist/prosemirror/conversion/fromProseDoc.js +128 -27
  26. package/dist/prosemirror/conversion/toProseDoc.js +10 -23
  27. package/dist/prosemirror/extensions/nodes/ImageExtension.js +8 -1
  28. package/dist/prosemirror/imagePictureNames.d.ts +12 -0
  29. package/dist/prosemirror/imagePictureNames.js +20 -0
  30. package/dist/prosemirror/paragraphFormattingProvenance.js +1 -0
  31. package/dist/prosemirror/runStyleFormatting.d.ts +72 -2
  32. package/dist/prosemirror/runStyleFormatting.js +18 -1
  33. package/dist/prosemirror/schema/nodes.d.ts +1 -0
  34. package/dist/prosemirror/styles/styleResolver.d.ts +4 -1
  35. package/dist/prosemirror/styles/styleResolver.js +32 -11
  36. package/dist/types/canonicalCapabilities.d.ts +15 -1
  37. package/dist/types/canonicalCapabilities.js +15 -1
  38. package/package.json +2 -2
  39. package/dist/prosemirror/conversion/listRenderingDefinition.d.ts +0 -6
@@ -1,5 +1,6 @@
1
1
  import { createBuiltInStyleIndex } from "../../docx/builtInStyles.js";
2
2
  import { BUILT_IN_DEFAULT_PARAGRAPH_FORMATTING, resolveDefaultParagraphStyle } from "../../docx/defaultParagraphStyle.js";
3
+ import { mergeParagraphNumbering } from "../../docx/numberingReference.js";
3
4
  import { mergeParagraphFormatting } from "../../utils/paragraphFormattingMerge.js";
4
5
  import { cascadeStyleTextFormatting } from "./styleToggleCascade.js";
5
6
  //#region src/prosemirror/styles/styleResolver.ts
@@ -108,18 +109,21 @@ var StyleResolver = class {
108
109
  resolveParagraphStyleInTable(styleId, tableParagraphOverlay) {
109
110
  return this.resolveParagraphStyleCascade(styleId, tableParagraphOverlay);
110
111
  }
112
+ resolveParagraphFormatting(styleId, tableParagraphOverlay) {
113
+ const [defaults, overlay, style] = paragraphFormattingLayers({
114
+ resolver: this,
115
+ styleId,
116
+ tableParagraphOverlay
117
+ });
118
+ let formatting = defaults ? { ...defaults } : void 0;
119
+ for (const layer of [overlay, style]) formatting = mergeParagraphFormatting(formatting, layer) ?? formatting;
120
+ return formatting;
121
+ }
111
122
  resolveParagraphStyleCascade(styleId, tableParagraphOverlay) {
112
123
  const result = {};
113
- if (this.docDefaults?.pPr) result.paragraphFormatting = { ...this.docDefaults.pPr };
114
- if (tableParagraphOverlay) {
115
- const merged = mergeParagraphFormatting(result.paragraphFormatting, tableParagraphOverlay);
116
- if (merged !== void 0) result.paragraphFormatting = merged;
117
- }
118
- const style = styleId ? this.stylesById.get(styleId) ?? this.defaultParagraphStyle : this.defaultParagraphStyle;
119
- if (style?.pPr) {
120
- const merged = mergeParagraphFormatting(result.paragraphFormatting, style.pPr);
121
- if (merged) result.paragraphFormatting = merged;
122
- }
124
+ const paragraphFormatting = this.resolveParagraphFormatting(styleId, tableParagraphOverlay);
125
+ if (paragraphFormatting) result.paragraphFormatting = paragraphFormatting;
126
+ const style = paragraphStyleFor(this, styleId);
123
127
  const runFormatting = cascadeStyleTextFormatting([{
124
128
  formatting: this.docDefaults?.rPr,
125
129
  type: "defaults"
@@ -232,5 +236,22 @@ var StyleResolver = class {
232
236
  function createStyleResolver(styleDefinitions) {
233
237
  return new StyleResolver(styleDefinitions);
234
238
  }
239
+ const paragraphStyleFor = (resolver, styleId) => (styleId ? resolver.getStyle(styleId) : void 0) ?? resolver.getDefaultParagraphStyle();
240
+ /** Paragraph tiers that can contribute numbering; the table overlay is spacing-only. */
241
+ const paragraphNumberingLayers = (resolver, styleId) => [resolver.getDocDefaults()?.pPr, paragraphStyleFor(resolver, styleId)?.pPr];
242
+ const paragraphFormattingLayers = ({ resolver, styleId, tableParagraphOverlay }) => {
243
+ const [defaults, style] = paragraphNumberingLayers(resolver, styleId);
244
+ return [
245
+ defaults,
246
+ tableParagraphOverlay,
247
+ style
248
+ ];
249
+ };
250
+ /** The same ordered paragraph tiers, without unrelated run or paragraph fields. */
251
+ const resolveStyleParagraphNumbering = (resolver, styleId) => {
252
+ let numbering;
253
+ for (const layer of paragraphNumberingLayers(resolver, styleId)) numbering = mergeParagraphNumbering(numbering, layer?.numPr);
254
+ return numbering;
255
+ };
235
256
  //#endregion
236
- export { StyleResolver, createStyleResolver };
257
+ export { StyleResolver, createStyleResolver, resolveStyleParagraphNumbering };
@@ -4,12 +4,14 @@ declare const CANONICAL_GAP: {
4
4
  readonly authorityRouting: "authority-routing";
5
5
  readonly commands: "command-descriptors";
6
6
  readonly trackedHyperlinkResolution: "tracked-hyperlink-resolution";
7
+ readonly storyContentProjection: "story-content-projection";
7
8
  readonly comments: "comment-model-edits";
8
9
  readonly modelEdits: "direct-model-edits";
9
10
  readonly sectionProperties: "section-properties";
10
11
  readonly watermark: "watermark-model-edits";
11
12
  readonly collaboration: "collaboration-session";
12
13
  readonly dispatch: "unclassified-transactions";
14
+ readonly tableActivation: "table-session-activation";
13
15
  readonly save: "pm-save-projection";
14
16
  readonly resourceReplacement: "canonical-resource-replacement";
15
17
  readonly history: "pm-history";
@@ -48,7 +50,13 @@ declare const CANONICAL_CAPABILITIES: {
48
50
  readonly owner: "controller";
49
51
  readonly kind: "refusal";
50
52
  readonly adapters: readonly ["react", "vue"];
51
- readonly summary: "Hyperlink and TOC suggestions require serializable wrapper review provenance.";
53
+ readonly summary: "Hyperlink and TOC suggestions and edits intersecting review identities require serializable wrapper review provenance.";
54
+ };
55
+ readonly "story-content-projection": {
56
+ readonly owner: "controller";
57
+ readonly kind: "refusal";
58
+ readonly adapters: readonly ["react", "vue"];
59
+ readonly summary: "Unsupported inline, field and review content cannot be projected after canonical edits.";
52
60
  };
53
61
  readonly "comment-model-edits": {
54
62
  readonly owner: "adapters";
@@ -86,6 +94,12 @@ declare const CANONICAL_CAPABILITIES: {
86
94
  readonly adapters: readonly ["react", "vue"];
87
95
  readonly summary: "Unclassified native and plugin mutations are refused at the projection boundary.";
88
96
  };
97
+ readonly "table-session-activation": {
98
+ readonly owner: "controller";
99
+ readonly kind: "refusal";
100
+ readonly adapters: readonly ["react", "vue"];
101
+ readonly summary: "Canonical session activation requires table projection and cell addressing.";
102
+ };
89
103
  readonly "pm-save-projection": {
90
104
  readonly owner: "controller";
91
105
  readonly kind: "routing";
@@ -4,12 +4,14 @@ const CANONICAL_GAP = {
4
4
  authorityRouting: "authority-routing",
5
5
  commands: "command-descriptors",
6
6
  trackedHyperlinkResolution: "tracked-hyperlink-resolution",
7
+ storyContentProjection: "story-content-projection",
7
8
  comments: "comment-model-edits",
8
9
  modelEdits: "direct-model-edits",
9
10
  sectionProperties: "section-properties",
10
11
  watermark: "watermark-model-edits",
11
12
  collaboration: "collaboration-session",
12
13
  dispatch: "unclassified-transactions",
14
+ tableActivation: "table-session-activation",
13
15
  save: "pm-save-projection",
14
16
  resourceReplacement: "canonical-resource-replacement",
15
17
  history: "pm-history",
@@ -45,7 +47,13 @@ const CANONICAL_CAPABILITIES = {
45
47
  owner: "controller",
46
48
  kind: "refusal",
47
49
  adapters: ["react", "vue"],
48
- summary: "Hyperlink and TOC suggestions require serializable wrapper review provenance."
50
+ summary: "Hyperlink and TOC suggestions and edits intersecting review identities require serializable wrapper review provenance."
51
+ },
52
+ [CANONICAL_GAP.storyContentProjection]: {
53
+ owner: "controller",
54
+ kind: "refusal",
55
+ adapters: ["react", "vue"],
56
+ summary: "Unsupported inline, field and review content cannot be projected after canonical edits."
49
57
  },
50
58
  [CANONICAL_GAP.comments]: {
51
59
  owner: "adapters",
@@ -83,6 +91,12 @@ const CANONICAL_CAPABILITIES = {
83
91
  adapters: ["react", "vue"],
84
92
  summary: "Unclassified native and plugin mutations are refused at the projection boundary."
85
93
  },
94
+ [CANONICAL_GAP.tableActivation]: {
95
+ owner: "controller",
96
+ kind: "refusal",
97
+ adapters: ["react", "vue"],
98
+ summary: "Canonical session activation requires table projection and cell addressing."
99
+ },
86
100
  [CANONICAL_GAP.save]: {
87
101
  owner: "controller",
88
102
  kind: "routing",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stll/folio-core",
3
- "version": "0.57.0",
3
+ "version": "0.58.0",
4
4
  "description": "Headless, framework-neutral core of folio: the OOXML (.docx) parser, document model, ProseMirror integration, and page-layout engine. No React.",
5
5
  "keywords": [
6
6
  "document-model",
@@ -146,7 +146,7 @@
146
146
  "perf": "bun scripts/profile-editor.ts"
147
147
  },
148
148
  "dependencies": {
149
- "@stll/docx-core": "^0.33.0",
149
+ "@stll/docx-core": "^0.34.0",
150
150
  "@stll/docx-utils": "^0.1.0",
151
151
  "@stll/template-conditions": "^0.6.2",
152
152
  "better-result": "3.0.1",
@@ -1,6 +0,0 @@
1
- import { document_d_exports } from "../../types/document.js";
2
- //#region src/prosemirror/conversion/listRenderingDefinition.d.ts
3
- /** Compare scalar fields directly; only nested records need canonical ordering. */
4
- declare const listRenderingDefinitionsMatch: (left: document_d_exports.ListRendering, right: document_d_exports.ListRendering) => boolean;
5
- //#endregion
6
- export { listRenderingDefinitionsMatch };