superdoc 2.7.0-next.4 → 2.7.0-next.6

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.
@@ -19,7 +19,7 @@ var COLLABORATION_UPGRADE_ENGINE_MINIMUM_NODE_MAJOR = 20;
19
19
  var PRIVATE_ENGINE_INFO = (0, _superdoc_docx_engine_collaboration_upgrade_engine.getCollaborationUpgradeEngineInfo)();
20
20
  var ENGINE_INFO = Object.freeze({
21
21
  ...PRIVATE_ENGINE_INFO,
22
- superdocVersion: "2.7.0-next.4",
22
+ superdocVersion: "2.7.0-next.6",
23
23
  roomSchemaVersion: Object.freeze({ ...PRIVATE_ENGINE_INFO.roomSchemaVersion }),
24
24
  supportedBundleVersions: SUPPORTED_COLLABORATION_UPGRADE_BUNDLE_VERSIONS,
25
25
  supportedV1ReaderContractVersions: SUPPORTED_V1_READER_CONTRACT_VERSIONS
@@ -18,7 +18,7 @@ var COLLABORATION_UPGRADE_ENGINE_MINIMUM_NODE_MAJOR = 20;
18
18
  var PRIVATE_ENGINE_INFO = getCollaborationUpgradeEngineInfo$1();
19
19
  var ENGINE_INFO = Object.freeze({
20
20
  ...PRIVATE_ENGINE_INFO,
21
- superdocVersion: "2.7.0-next.4",
21
+ superdocVersion: "2.7.0-next.6",
22
22
  roomSchemaVersion: Object.freeze({ ...PRIVATE_ENGINE_INFO.roomSchemaVersion }),
23
23
  supportedBundleVersions: SUPPORTED_COLLABORATION_UPGRADE_BUNDLE_VERSIONS,
24
24
  supportedV1ReaderContractVersions: SUPPORTED_V1_READER_CONTRACT_VERSIONS
@@ -3,6 +3,8 @@ import { PageStyles } from './styles.js';
3
3
  import { PositionValidationOptions, PositionValidationSummary } from './pm-position-validation.js';
4
4
  import { DomPainterInput, PageDecorationProvider, PaintSnapshot, PositionMapping, FlowMode } from './renderer.js';
5
5
  import { DomPainterPersistentPageInput } from './persistent-page-surface.js';
6
+ export { createWebFlowPainter, ensureWebFlowStyles, WEB_FLOW_CLASS_NAMES } from './web-flow/index.js';
7
+ export type { WebFlowAppliedPaint, WebFlowDomBinding, WebFlowPaintCommand, WebFlowPaintItem, WebFlowPaintSnapshot, WebFlowPaintTransaction, WebFlowPainterHandle, WebFlowPainterOptions, WebFlowPaintWorkSummary, WebFlowStableDomKey, } from './web-flow/index.js';
6
8
  export { DOM_CLASS_NAMES } from './constants.js';
7
9
  export type { DomClassName } from './constants.js';
8
10
  export { ensureDocumentSurfaceStyles } from './styles.js';
@@ -0,0 +1,3 @@
1
+ export { createWebFlowPainter } from './painter.js';
2
+ export { ensureWebFlowStyles, WEB_FLOW_CLASS_NAMES } from './styles.js';
3
+ export type { WebFlowAppliedPaint, WebFlowDomBinding, WebFlowPaintCommand, WebFlowPaintItem, WebFlowPaintSnapshot, WebFlowPaintTransaction, WebFlowPainterHandle, WebFlowPainterOptions, WebFlowPaintWorkSummary, WebFlowStableDomKey, } from './types.js';
@@ -0,0 +1,2 @@
1
+ import { WebFlowPainterHandle, WebFlowPainterOptions } from './types.js';
2
+ export declare function createWebFlowPainter(mount: HTMLElement, options?: WebFlowPainterOptions): WebFlowPainterHandle;
@@ -0,0 +1,6 @@
1
+ import { WebFlowPaintItem, WebFlowPainterOptions } from './types.js';
2
+ export declare function renderWebFlowItem(item: WebFlowPaintItem, doc: Document, options: WebFlowPainterOptions): HTMLElement;
3
+ /** Identity-only signature for deciding whether a retained node needs dataset rebasing. */
4
+ export declare function webFlowItemIdentityFingerprint(item: WebFlowPaintItem): string;
5
+ /** Rebase canonical identity datasets without replacing an unchanged retained node. */
6
+ export declare function rebaseWebFlowItemNode(node: HTMLElement, previous: WebFlowPaintItem, next: WebFlowPaintItem): () => void;
@@ -0,0 +1,10 @@
1
+ export declare const WEB_FLOW_CLASS_NAMES: {
2
+ readonly root: "superdoc-web-flow";
3
+ readonly block: "superdoc-web-flow-block";
4
+ readonly paragraph: "superdoc-web-flow-paragraph";
5
+ readonly run: "superdoc-web-flow-run";
6
+ readonly listMarker: "superdoc-web-flow-list-marker";
7
+ readonly table: "superdoc-web-flow-table";
8
+ readonly diagnostic: "superdoc-web-flow-diagnostic";
9
+ };
10
+ export declare function ensureWebFlowStyles(doc: Document): void;
@@ -0,0 +1,77 @@
1
+ import { FlowBlock, LayoutSourceIdentity } from '../../../../contracts/src/index.js';
2
+ /** Opaque adapter-issued identity. The painter never derives this value from DOM or block ids. */
3
+ export type WebFlowStableDomKey = string;
4
+ export interface WebFlowPaintItem {
5
+ readonly stableDomKey: WebFlowStableDomKey;
6
+ readonly renderFingerprint: string;
7
+ readonly block: FlowBlock;
8
+ readonly layoutEpoch?: number;
9
+ readonly layoutIdentities?: readonly LayoutSourceIdentity[];
10
+ readonly editable?: boolean;
11
+ }
12
+ export type WebFlowPaintCommand = {
13
+ readonly kind: 'replace-all';
14
+ readonly epoch: number;
15
+ readonly items: readonly WebFlowPaintItem[];
16
+ } | {
17
+ readonly kind: 'splice';
18
+ readonly expectedBaseEpoch: number;
19
+ readonly epoch: number;
20
+ readonly storyKey: string;
21
+ readonly expectedRemovedKeys: readonly WebFlowStableDomKey[];
22
+ readonly expectedLeftKey: WebFlowStableDomKey | null;
23
+ readonly expectedRightKey: WebFlowStableDomKey | null;
24
+ readonly items: readonly WebFlowPaintItem[];
25
+ /** Identity-only updates for retained nodes downstream of a structural splice. */
26
+ readonly retainedRebases?: readonly WebFlowPaintItem[];
27
+ };
28
+ export interface WebFlowPaintWorkSummary {
29
+ readonly kind: WebFlowPaintCommand['kind'];
30
+ readonly retainedNodes: number;
31
+ readonly createdNodes: number;
32
+ readonly removedNodes: number;
33
+ readonly rebasedNodes: number;
34
+ readonly touchedItems: number;
35
+ }
36
+ export interface WebFlowDomBinding {
37
+ readonly key: WebFlowStableDomKey;
38
+ readonly renderFingerprint: string;
39
+ readonly blockId: string;
40
+ readonly node: HTMLElement;
41
+ }
42
+ export interface WebFlowPaintSnapshot {
43
+ readonly epoch: number | null;
44
+ readonly version: number;
45
+ readonly bindings: readonly WebFlowDomBinding[];
46
+ }
47
+ export interface WebFlowAppliedPaint {
48
+ readonly work: WebFlowPaintWorkSummary;
49
+ /** Bindings directly owned by this command; localized splices never scan the retained root. */
50
+ readonly touchedBindings: readonly WebFlowDomBinding[];
51
+ /** Bindings whose DOM node or retained identity changed in this command. */
52
+ readonly changedBindings: readonly WebFlowDomBinding[];
53
+ }
54
+ export interface WebFlowPaintTransaction {
55
+ readonly command: WebFlowPaintCommand;
56
+ /** Installs the candidate synchronously. The caller must then finalize or roll it back. */
57
+ apply(): WebFlowAppliedPaint;
58
+ /** Publishes the applied state and releases the rollback journal. */
59
+ finalize(): WebFlowAppliedPaint;
60
+ /** Restores the exact pre-apply DOM and retained state. */
61
+ rollback(): void;
62
+ }
63
+ export interface WebFlowPainterHandle {
64
+ prepare(command: WebFlowPaintCommand): WebFlowPaintTransaction;
65
+ snapshot(): WebFlowPaintSnapshot;
66
+ /** Rebuilds the last committed derived DOM after an externally owned mutation. */
67
+ restoreCommittedDomAfterUnownedMutation(): WebFlowPaintSnapshot;
68
+ dispose(): void;
69
+ }
70
+ export interface WebFlowPainterOptions {
71
+ readonly resolvePhysical?: (cssFontFamily: string, face: {
72
+ weight: '400' | '700';
73
+ style: 'normal' | 'italic';
74
+ }) => string;
75
+ /** Fires synchronously when the mutation observer first detects unowned DOM. */
76
+ readonly onUnownedMutation?: (kind: 'text' | 'dom') => void;
77
+ }
@@ -2543,7 +2543,11 @@ export type ViewLayout = 'print' | 'web';
2543
2543
  * Mirrors OOXML document view settings.
2544
2544
  */
2545
2545
  export interface ViewOptions {
2546
- /** Document view layout (OOXML ST_View compatible). */
2546
+ /**
2547
+ * Document view layout (OOXML ST_View compatible). In the browser editor,
2548
+ * `'web'` selects the retained semantic DOM surface. Browser normal flow
2549
+ * rewraps content as the editor container changes width.
2550
+ */
2547
2551
  layout?: ViewLayout;
2548
2552
  }
2549
2553
  export interface ExportParams {
@@ -3378,6 +3382,11 @@ export interface Config {
3378
3382
  experimental?: {
3379
3383
  unifiedHistory?: boolean;
3380
3384
  v2Host?: boolean;
3385
+ /**
3386
+ * Temporary V2 web-surface rollout control. The value is snapshotted at
3387
+ * mount and changing it requires a remount. This is not a stable renderer API.
3388
+ */
3389
+ v2WebSurface?: 'dense-control' | 'retained-dom';
3381
3390
  /**
3382
3391
  * Derived-invalidation deferral for direct single-paragraph edits (v2
3383
3392
  * engine only). Field display text settles off the keystroke path under
@@ -3605,10 +3614,8 @@ export interface Config {
3605
3614
  */
3606
3615
  workerStartupTimeoutMs?: number;
3607
3616
  /**
3608
- * Opt-in toggle for the layout engine. Auto-disabled when web layout is
3609
- * requested without `layoutEngineOptions.flowMode === 'semantic'`; the
3610
- * loader logs a warning and falls back to the legacy ProseMirror render
3611
- * path in that case.
3617
+ * Compatibility toggle retained for existing configurations. V2 always
3618
+ * uses the OOXML kernel; `viewOptions.layout` selects the mounted renderer.
3612
3619
  */
3613
3620
  useLayoutEngine?: boolean;
3614
3621
  /**
package/dist/superdoc.cjs CHANGED
@@ -43484,10 +43484,6 @@ var SuperDoc = class extends require_eventemitter3.import_eventemitter3.default
43484
43484
  this.config.layoutEngineOptions = this.config.layoutEngineOptions || {};
43485
43485
  const isWebLayout = this.config.viewOptions?.layout === "web";
43486
43486
  const isSemanticFlow = this.config.layoutEngineOptions?.flowMode === "semantic";
43487
- if (isWebLayout && this.config.useLayoutEngine && !isSemanticFlow) {
43488
- console.warn("[SuperDoc] Web layout uses PM fallback unless layoutEngineOptions.flowMode is set to 'semantic'. Automatically disabling layout engine.");
43489
- this.config.useLayoutEngine = false;
43490
- }
43491
43487
  if (!isWebLayout && isSemanticFlow) {
43492
43488
  console.warn("[SuperDoc] flowMode 'semantic' is only valid with web layout. Coercing to 'paginated'.");
43493
43489
  this.config.layoutEngineOptions.flowMode = "paginated";
@@ -43518,7 +43514,7 @@ var SuperDoc = class extends require_eventemitter3.import_eventemitter3.default
43518
43514
  this.config.colors = shuffleArray(this.config.colors);
43519
43515
  this.userColorMap = /* @__PURE__ */ new Map();
43520
43516
  this.colorIndex = 0;
43521
- this.version = "2.7.0-next.4";
43517
+ this.version = "2.7.0-next.6";
43522
43518
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
43523
43519
  this.superdocId = config.superdocId || require_uuid.v4();
43524
43520
  this.colors = this.config.colors ?? [];
@@ -43417,10 +43417,6 @@ var SuperDoc = class extends import_eventemitter3.default {
43417
43417
  this.config.layoutEngineOptions = this.config.layoutEngineOptions || {};
43418
43418
  const isWebLayout = this.config.viewOptions?.layout === "web";
43419
43419
  const isSemanticFlow = this.config.layoutEngineOptions?.flowMode === "semantic";
43420
- if (isWebLayout && this.config.useLayoutEngine && !isSemanticFlow) {
43421
- console.warn("[SuperDoc] Web layout uses PM fallback unless layoutEngineOptions.flowMode is set to 'semantic'. Automatically disabling layout engine.");
43422
- this.config.useLayoutEngine = false;
43423
- }
43424
43420
  if (!isWebLayout && isSemanticFlow) {
43425
43421
  console.warn("[SuperDoc] flowMode 'semantic' is only valid with web layout. Coercing to 'paginated'.");
43426
43422
  this.config.layoutEngineOptions.flowMode = "paginated";
@@ -43451,7 +43447,7 @@ var SuperDoc = class extends import_eventemitter3.default {
43451
43447
  this.config.colors = shuffleArray(this.config.colors);
43452
43448
  this.userColorMap = /* @__PURE__ */ new Map();
43453
43449
  this.colorIndex = 0;
43454
- this.version = "2.7.0-next.4";
43450
+ this.version = "2.7.0-next.6";
43455
43451
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
43456
43452
  this.superdocId = config.superdocId || v4();
43457
43453
  this.colors = this.config.colors ?? [];