oasis-editor 0.0.25 → 0.0.27

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,7 +1,7 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
3
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
- import { n as normalizeSelection, g as getParagraphs, c as createEditorParagraphFromRuns, a as getParagraphLength, b as createEditorRun, d as getDocumentSections, e as createEditorStyledRun, f as getParagraphText, h as getActiveZone, i as getActiveSectionIndex, p as positionToParagraphOffset, j as paragraphOffsetToPosition, k as clampPosition, l as findParagraphIndex, m as createCollapsedSelection, o as isSelectionCollapsed, q as createEditorParagraph, r as getBlockParagraphs, s as findParagraphTableLocation, t as buildTableCellLayout, u as createEditorTableCell, v as createEditorTable, w as createEditorTableRow, x as underlineStyleToCssDecorationStyle, y as resolveImageSrc, z as createEditorFootnote, A as createFootnoteReferenceRun, B as renumberFootnotes, C as iterateFootnoteReferenceRuns, D as getFootnoteDisplayMarker, E as createSignal, F as createEffect, G as onCleanup, H as buildCanvasLayoutSnapshot, I as on, J as onMount, K as debounce, L as unwrap, M as getDocumentParagraphs, N as getDocumentSectionsCanonical, O as createEditorDocument, P as getPageContentWidth, Q as getDocumentPageSettings, R as getTableCellContentWidthForParagraph, S as resolveResizedDimensions, T as resolveTextBoxRenderHeight, U as resolveEffectiveParagraphStyle, V as resolveEffectiveTextStyleForParagraph, W as iterateEndnoteReferenceRuns, X as JSZip, Y as imageContentTypeDefaults, Z as imageExtensionFromMime, _ as pxToPt$1, $ as buildSegmentTable, a0 as buildCanvasTableLayout, a1 as resolveFloatingObjectRect, a2 as getTextBoxFloatingGeometry, a3 as getPresetPathSegments, a4 as projectBlocksLayout, a5 as textStyleToFontSizePt, a6 as PX_PER_POINT, a7 as DEFAULT_FONT_SIZE_PX, a8 as isDoubleUnderlineStyle, a9 as isWavyUnderlineStyle, aa as underlineStyleLineWidthPx, ab as underlineStyleDashArray, ac as getListLabelInset, ad as getParagraphBorderInsets, ae as normalizeFamily, af as ROBOTO_FONT_FILES, ag as loadFontAsset, ah as OFFICE_COMPAT_FONT_FAMILIES, ai as buildSfnt, aj as defaultFontDecoderRegistry, ak as SfntFontProgram, al as collectPdfFontFamilies, am as projectDocumentLayout, an as getPageHeaderZoneTop, ao as getPageBodyTop, ap as getPageColumnRects, aq as findFootnoteReference, ar as FOOTNOTE_MARKER_GUTTER_PX, as as resolveImporterForFile, at as createEditorStateFromDocument, au as getDocumentParagraphsCanonical, av as getToolbarStyleState, aw as STANDARD_FONT_SIZES_PT, ax as fontSizePxToPt, ay as probeLocalFontFamilies, az as createInitialEditorState, aA as parseFontSizePtToPx, aB as formatFontSizePt, aC as listKindForTag, aD as isParagraphTag, aE as collectInlineRuns, aF as parseParagraphStyle, aG as t, aH as preciseFontModeVersion, aI as isPreciseFontModeEnabled, aJ as togglePreciseFontMode, aK as nextFontSizePt, aL as previousFontSizePt, aM as fontSizePtToPx, aN as createDefaultToolbarPreset, aO as defaultMenuItems, aP as MenuRegistry, aQ as createToolbarRegistry, aR as Editor, aS as resolveCommandRef, aT as commandRefName, aU as InlineShell, aV as BalloonShell, aW as DocumentShell, aX as createMemo, aY as getCaretRectFromSnapshot, aZ as getParagraphRectFromSnapshot, a_ as createComponent, a$ as CaretOverlay, b0 as Show, b1 as createRenderEffect, b2 as style, b3 as setAttribute, b4 as setStyleProperty, b5 as memo, b6 as template, b7 as insert, b8 as use, b9 as addEventListener, ba as Dialog, bb as delegateEvents, bc as className, bd as For, be as UNDERLINE_STYLE_OPTIONS, bf as Tabs, bg as measureParagraphMinContentWidthPx, bh as getEditableBlocksForZone, bi as findParagraphLocation, bj as createSectionBoundaryParagraph, bk as normalizePageSettings, bl as DEFAULT_EDITOR_PAGE_SETTINGS, bm as markStart, bn as markEnd, bo as getParagraphEntries, bp as getParagraphById, bq as PluginUiHost, br as OasisEditorEditor, bs as perfTimer, bt as OasisBrandMark, bu as setPreciseFontPreference, bv as setWelcomeSeen, bw as enablePreciseFontMode, bx as createOasisEditorClient, by as setLocale, bz as createEditorZoom, bA as startLongTaskObserver, bB as installGlobalReport, bC as applyStoredPreciseFontPreference, bD as getWelcomeSeen, bE as isLocalFontAccessSupported, bF as EDITOR_SCROLL_PADDING_PX, bG as Toolbar, bH as OasisEditorLoading, bI as createEditorLogger, bJ as getCachedCanvasImage, bK as registerDomStatsSurface } from "./index-Df7Ob0Ek.js";
4
+ import { n as normalizeSelection, g as getParagraphs, c as createEditorParagraphFromRuns, a as getParagraphLength, b as createEditorRun, d as getDocumentSections, e as createEditorStyledRun, f as getParagraphText, h as getActiveZone, i as getActiveSectionIndex, p as positionToParagraphOffset, j as paragraphOffsetToPosition, k as clampPosition, l as findParagraphIndex, m as createCollapsedSelection, o as isSelectionCollapsed, q as createEditorParagraph, r as getBlockParagraphs, s as findParagraphTableLocation, t as buildTableCellLayout, u as createEditorTableCell, v as createEditorTable, w as createEditorTableRow, x as underlineStyleToCssDecorationStyle, y as resolveImageSrc, z as createEditorFootnote, A as createFootnoteReferenceRun, B as renumberFootnotes, C as iterateFootnoteReferenceRuns, D as getFootnoteDisplayMarker, E as createSignal, F as createEffect, G as onCleanup, H as buildCanvasLayoutSnapshot, I as on, J as onMount, K as debounce, L as unwrap, M as getDocumentParagraphs, N as getDocumentSectionsCanonical, O as createEditorDocument, P as getPageContentWidth, Q as getDocumentPageSettings, R as getTableCellContentWidthForParagraph, S as resolveResizedDimensions, T as resolveTextBoxRenderHeight, U as resolveEffectiveParagraphStyle, V as resolveEffectiveTextStyleForParagraph, W as iterateEndnoteReferenceRuns, X as JSZip, Y as imageContentTypeDefaults, Z as imageExtensionFromMime, _ as pxToPt$1, $ as buildSegmentTable, a0 as buildCanvasTableLayout, a1 as resolveFloatingObjectRect, a2 as getTextBoxFloatingGeometry, a3 as getPresetPathSegments, a4 as projectBlocksLayout, a5 as textStyleToFontSizePt, a6 as PX_PER_POINT, a7 as DEFAULT_FONT_SIZE_PX, a8 as isDoubleUnderlineStyle, a9 as isWavyUnderlineStyle, aa as underlineStyleLineWidthPx, ab as underlineStyleDashArray, ac as getListLabelInset, ad as getParagraphBorderInsets, ae as normalizeFamily, af as ROBOTO_FONT_FILES, ag as loadFontAsset, ah as OFFICE_COMPAT_FONT_FAMILIES, ai as buildSfnt, aj as defaultFontDecoderRegistry, ak as SfntFontProgram, al as collectPdfFontFamilies, am as projectDocumentLayout, an as getPageHeaderZoneTop, ao as getPageBodyTop, ap as getPageColumnRects, aq as findFootnoteReference, ar as FOOTNOTE_MARKER_GUTTER_PX, as as resolveImporterForFile, at as createEditorStateFromDocument, au as getDocumentParagraphsCanonical, av as getToolbarStyleState, aw as STANDARD_FONT_SIZES_PT, ax as fontSizePxToPt, ay as probeLocalFontFamilies, az as createInitialEditorState, aA as parseFontSizePtToPx, aB as formatFontSizePt, aC as listKindForTag, aD as isParagraphTag, aE as collectInlineRuns, aF as parseParagraphStyle, aG as t, aH as preciseFontModeVersion, aI as isPreciseFontModeEnabled, aJ as togglePreciseFontMode, aK as nextFontSizePt, aL as previousFontSizePt, aM as fontSizePtToPx, aN as createDefaultToolbarPreset, aO as defaultMenuItems, aP as MenuRegistry, aQ as createToolbarRegistry, aR as Editor, aS as resolveCommandRef, aT as commandRefName, aU as InlineShell, aV as BalloonShell, aW as DocumentShell, aX as createMemo, aY as getCaretRectFromSnapshot, aZ as getParagraphRectFromSnapshot, a_ as createComponent, a$ as CaretOverlay, b0 as Show, b1 as createRenderEffect, b2 as style, b3 as setAttribute, b4 as setStyleProperty, b5 as memo, b6 as template, b7 as insert, b8 as use, b9 as addEventListener, ba as Dialog, bb as delegateEvents, bc as className, bd as For, be as UNDERLINE_STYLE_OPTIONS, bf as Tabs, bg as measureParagraphMinContentWidthPx, bh as getEditableBlocksForZone, bi as findParagraphLocation, bj as createSectionBoundaryParagraph, bk as normalizePageSettings, bl as DEFAULT_EDITOR_PAGE_SETTINGS, bm as markStart, bn as markEnd, bo as getParagraphEntries, bp as getParagraphById, bq as PluginUiHost, br as OasisEditorEditor, bs as perfTimer, bt as OasisBrandMark, bu as setPreciseFontPreference, bv as setWelcomeSeen, bw as enablePreciseFontMode, bx as createOasisEditorClient, by as setLocale, bz as createEditorZoom, bA as startLongTaskObserver, bB as installGlobalReport, bC as applyStoredPreciseFontPreference, bD as getWelcomeSeen, bE as isLocalFontAccessSupported, bF as EDITOR_SCROLL_PADDING_PX, bG as Toolbar, bH as OasisEditorLoading, bI as createEditorLogger, bJ as getCachedCanvasImage, bK as registerDomStatsSurface } from "./index-BaKkmGAh.js";
5
5
  function getSelectedObjectRun(state, predicate) {
6
6
  const normalized = normalizeSelection(state);
7
7
  if (normalized.isCollapsed || normalized.startIndex !== normalized.endIndex || normalized.endParagraphOffset - normalized.startParagraphOffset !== 1) {
@@ -7255,12 +7255,14 @@ function createResizeSession(adapter, deps) {
7255
7255
  }
7256
7256
  });
7257
7257
  const handleMouseMove = (event) => {
7258
+ var _a;
7258
7259
  const resize = active;
7259
7260
  if (!resize) {
7260
7261
  return;
7261
7262
  }
7262
- const deltaX = event.clientX - resize.startClientX;
7263
- const deltaY = event.clientY - resize.startClientY;
7263
+ const z = ((_a = deps.zoomFactor) == null ? void 0 : _a.call(deps)) ?? 1;
7264
+ const deltaX = (event.clientX - resize.startClientX) / z;
7265
+ const deltaY = (event.clientY - resize.startClientY) / z;
7264
7266
  const maxWidth = adapter.getMaxWidth(deps.state, resize.paragraphId);
7265
7267
  const { width, height } = resolveResizedDimensions(
7266
7268
  resize,
@@ -7504,7 +7506,8 @@ function createEditorImageOperations(deps) {
7504
7506
  updateHistoryState: deps.updateHistoryState,
7505
7507
  cloneState: deps.cloneState,
7506
7508
  focusInput: deps.focusInput,
7507
- logger: deps.logger
7509
+ logger: deps.logger,
7510
+ zoomFactor: deps.zoomFactor
7508
7511
  }
7509
7512
  );
7510
7513
  const imageRotateSession = createRotateSession(
@@ -7705,7 +7708,8 @@ function createEditorTextBoxOperations(deps) {
7705
7708
  updateHistoryState: deps.updateHistoryState,
7706
7709
  cloneState: deps.cloneState,
7707
7710
  focusInput: deps.focusInput,
7708
- logger: deps.logger
7711
+ logger: deps.logger,
7712
+ zoomFactor: deps.zoomFactor
7709
7713
  }
7710
7714
  );
7711
7715
  const rotateSession = createRotateSession(
@@ -39181,7 +39185,8 @@ function cloneLayoutSnapshot(snapshot) {
39181
39185
  top: paragraph.tableCell.top,
39182
39186
  width: paragraph.tableCell.width,
39183
39187
  height: paragraph.tableCell.height
39184
- } : void 0
39188
+ } : void 0,
39189
+ verticalMode: paragraph.verticalMode
39185
39190
  })),
39186
39191
  inlineImages: snapshot.inlineImages.map((image) => ({
39187
39192
  paragraphId: image.paragraphId,
@@ -39195,6 +39200,21 @@ function cloneLayoutSnapshot(snapshot) {
39195
39200
  width: image.width,
39196
39201
  height: image.height
39197
39202
  })),
39203
+ inlineTextBoxes: snapshot.inlineTextBoxes.map(
39204
+ (box) => ({
39205
+ paragraphId: box.paragraphId,
39206
+ paragraphIndex: box.paragraphIndex,
39207
+ zone: box.zone,
39208
+ pageIndex: box.pageIndex,
39209
+ startOffset: box.startOffset,
39210
+ endOffset: box.endOffset,
39211
+ left: box.left,
39212
+ top: box.top,
39213
+ width: box.width,
39214
+ height: box.height,
39215
+ rotation: box.rotation
39216
+ })
39217
+ ),
39198
39218
  unsupportedRegions: snapshot.unsupportedRegions.map((region) => ({
39199
39219
  ...region
39200
39220
  }))
@@ -39224,6 +39244,9 @@ function buildApi() {
39224
39244
  inlineImages: lastLayoutSnapshot.inlineImages.map((image) => ({
39225
39245
  ...image
39226
39246
  })),
39247
+ inlineTextBoxes: lastLayoutSnapshot.inlineTextBoxes.map((box) => ({
39248
+ ...box
39249
+ })),
39227
39250
  unsupportedRegions: lastLayoutSnapshot.unsupportedRegions.map(
39228
39251
  (region) => ({
39229
39252
  ...region
@@ -44772,9 +44795,11 @@ function createEditorTableResize(deps) {
44772
44795
  setActiveCursorClass(currentResizing.type === "column");
44773
44796
  };
44774
44797
  const handleWindowMouseUp = (event) => {
44798
+ var _a;
44775
44799
  const currentResizing = resizing();
44776
44800
  if (!currentResizing) return;
44777
- const delta = (currentResizing.type === "column" ? event.clientX : event.clientY) - currentResizing.initialPos;
44801
+ const z = ((_a = deps.zoomFactor) == null ? void 0 : _a.call(deps)) ?? 1;
44802
+ const delta = ((currentResizing.type === "column" ? event.clientX : event.clientY) - currentResizing.initialPos) / z;
44778
44803
  if (Math.abs(delta) >= DRAG_THRESHOLD_PX) {
44779
44804
  deps.applyTransactionalState((current) => {
44780
44805
  if (currentResizing.type === "row") {
@@ -45871,7 +45896,7 @@ function createEditorNavigation(deps) {
45871
45896
  function createEditorRevisionController(deps) {
45872
45897
  const [hoveredRevision, setHoveredRevision] = createSignal(null);
45873
45898
  const handleRevisionMouseEnter = (revisionId, event) => {
45874
- var _a, _b;
45899
+ var _a, _b, _c;
45875
45900
  const paragraphs = getParagraphs(deps.state());
45876
45901
  let foundRevision;
45877
45902
  for (const p of paragraphs) {
@@ -45887,13 +45912,14 @@ function createEditorRevisionController(deps) {
45887
45912
  const rect = event.currentTarget.getBoundingClientRect();
45888
45913
  const surfaceRect = (_b = deps.surfaceRef()) == null ? void 0 : _b.getBoundingClientRect();
45889
45914
  if (!surfaceRect) return;
45915
+ const z = ((_c = deps.zoomFactor) == null ? void 0 : _c.call(deps)) ?? 1;
45890
45916
  setHoveredRevision({
45891
45917
  revisionId: foundRevision.id,
45892
45918
  author: foundRevision.author,
45893
45919
  date: foundRevision.date,
45894
45920
  type: foundRevision.type,
45895
- left: rect.left - surfaceRect.left,
45896
- top: rect.top - surfaceRect.top
45921
+ left: (rect.left - surfaceRect.left) / z,
45922
+ top: (rect.top - surfaceRect.top) / z
45897
45923
  });
45898
45924
  };
45899
45925
  const handleRevisionMouseLeave = () => {
@@ -45911,7 +45937,8 @@ function useEditorInteractionWiring(ctx) {
45911
45937
  state,
45912
45938
  applyTransactionalState: ctx.applyTransactionalState,
45913
45939
  surfaceRef: ctx.surfaceRef,
45914
- viewportRef: ctx.viewportRef
45940
+ viewportRef: ctx.viewportRef,
45941
+ zoomFactor: ctx.zoomFactor
45915
45942
  });
45916
45943
  const tableDrag = createEditorTableDrag({
45917
45944
  state,
@@ -45921,7 +45948,8 @@ function useEditorInteractionWiring(ctx) {
45921
45948
  });
45922
45949
  const revisionController = createEditorRevisionController({
45923
45950
  state,
45924
- surfaceRef: () => ctx.surfaceRef() ?? null
45951
+ surfaceRef: () => ctx.surfaceRef() ?? null,
45952
+ zoomFactor: ctx.zoomFactor
45925
45953
  });
45926
45954
  const textDrag = createEditorTextDrag({
45927
45955
  state,
@@ -46636,7 +46664,8 @@ function OasisEditorApp(props = {}) {
46636
46664
  focusInput,
46637
46665
  focusInputAfterPointerSelection,
46638
46666
  cloneState,
46639
- logger
46667
+ logger,
46668
+ zoomFactor: zoom.zoomFactor
46640
46669
  });
46641
46670
  const textBoxOps = createEditorTextBoxOperations({
46642
46671
  state,
@@ -46645,7 +46674,8 @@ function OasisEditorApp(props = {}) {
46645
46674
  updateHistoryState,
46646
46675
  focusInput,
46647
46676
  cloneState,
46648
- logger
46677
+ logger,
46678
+ zoomFactor: zoom.zoomFactor
46649
46679
  });
46650
46680
  const styleController = createEditorStyleController({
46651
46681
  state: () => state,
@@ -29,6 +29,8 @@ export interface ResizeSessionDeps {
29
29
  cloneState: (source: EditorState) => EditorState;
30
30
  focusInput: () => void;
31
31
  logger: EditorLogger;
32
+ /** Visual zoom factor `z`; pointer deltas (screen px) are divided by it. */
33
+ zoomFactor?: () => number;
32
34
  }
33
35
  /**
34
36
  * Drives a handle-based resize: it tracks the pointer, resolves the next size
@@ -31,6 +31,8 @@ export interface EditorImageOperationsDeps {
31
31
  focusInputAfterPointerSelection: () => void;
32
32
  cloneState: (source: EditorState) => EditorState;
33
33
  logger: EditorLogger;
34
+ /** Visual zoom factor `z`; resize pointer deltas are divided by it. */
35
+ zoomFactor?: () => number;
34
36
  }
35
37
  export declare function createEditorImageOperations(deps: EditorImageOperationsDeps): {
36
38
  dragging: import('solid-js').Accessor<boolean>;
@@ -4,6 +4,8 @@ import { RevisionBox } from '../../ui/editorUiTypes.js';
4
4
  export interface UseEditorRevisionProps {
5
5
  state: () => EditorState;
6
6
  surfaceRef: () => HTMLDivElement | null;
7
+ /** Visual zoom factor `z`; screen-px offsets are divided by it for px-local. */
8
+ zoomFactor?: () => number;
7
9
  }
8
10
  export declare function createEditorRevisionController(deps: UseEditorRevisionProps): {
9
11
  hoveredRevision: import('solid-js').Accessor<RevisionBox | null>;
@@ -7,4 +7,6 @@ export declare function createEditorTableResize(deps: {
7
7
  applyTransactionalState: (producer: (current: EditorState) => EditorState) => void;
8
8
  surfaceRef: () => HTMLElement | undefined;
9
9
  viewportRef: () => HTMLElement | undefined;
10
+ /** Visual zoom factor `z`; resize pointer deltas are divided by it. */
11
+ zoomFactor?: () => number;
10
12
  }): TableResizeOps;
@@ -11,6 +11,8 @@ export interface EditorTextBoxOperationsDeps {
11
11
  focusInput: () => void;
12
12
  cloneState: (source: EditorState) => EditorState;
13
13
  logger: EditorLogger;
14
+ /** Visual zoom factor `z`; resize pointer deltas are divided by it. */
15
+ zoomFactor?: () => number;
14
16
  }
15
17
  export declare function createEditorTextBoxOperations(deps: EditorTextBoxOperationsDeps): {
16
18
  handleTextBoxResizeHandleMouseDown: (paragraphId: string, paragraphOffset: number, direction: ResizeHandleDirection, event: MouseEvent & {
@@ -2438,7 +2438,7 @@ function OasisEditorAppLazy(props = {}) {
2438
2438
  onCleanup(() => {
2439
2439
  cancelled = true;
2440
2440
  });
2441
- import("./OasisEditorApp-y3iUL8-k.js").then((m) => {
2441
+ import("./OasisEditorApp-TgBKJPpl.js").then((m) => {
2442
2442
  cancelled = true;
2443
2443
  setProgress(1);
2444
2444
  setTimeout(() => setApp(() => m.OasisEditorApp), 180);
@@ -21646,7 +21646,6 @@ function getToolbarStyleState(state) {
21646
21646
  };
21647
21647
  }
21648
21648
  const EDITOR_SCROLL_PADDING_PX = 34;
21649
- const EDITOR_SCROLLBAR_RESERVE_PX = 10;
21650
21649
  const PX_PER_INCH$2 = 96;
21651
21650
  const PX_PER_CM = PX_PER_INCH$2 / 2.54;
21652
21651
  const MIN_CONTENT_WIDTH_PX = 24;
@@ -21810,11 +21809,13 @@ function HorizontalRuler(props) {
21810
21809
  return typeof navigator !== "undefined" && ((_a = navigator.language) == null ? void 0 : _a.toLowerCase().startsWith("en")) ? "in" : "cm";
21811
21810
  };
21812
21811
  const ticks = createMemo(() => computeRulerTicks(pageSettings().width, baseGeometry().contentLeft, unit()));
21813
- const trackWidth = createMemo(() => pageLeft() * 2 + pageSettings().width);
21812
+ const z = () => props.zoomFactor();
21813
+ const sx = (value) => value * z();
21814
+ const trackWidth = createMemo(() => pageLeft() * 2 + sx(pageSettings().width));
21814
21815
  const pageXFromClient = (clientX) => {
21815
21816
  const rect = pageRef == null ? void 0 : pageRef.getBoundingClientRect();
21816
21817
  if (!rect) return 0;
21817
- return clamp$1(clientX - rect.left, 0, pageSettings().width);
21818
+ return clamp$1((clientX - rect.left) / z(), 0, pageSettings().width);
21818
21819
  };
21819
21820
  const beginDrag = (type, event) => {
21820
21821
  var _a;
@@ -21921,7 +21922,7 @@ function HorizontalRuler(props) {
21921
21922
  children: (tick) => [(() => {
21922
21923
  var _el$11 = _tmpl$2$l();
21923
21924
  createRenderEffect((_p$) => {
21924
- var _v$27 = `oasis-editor-horizontal-ruler-tick oasis-editor-horizontal-ruler-tick-${tick.kind}`, _v$28 = `${tick.x}px`;
21925
+ var _v$27 = `oasis-editor-horizontal-ruler-tick oasis-editor-horizontal-ruler-tick-${tick.kind}`, _v$28 = `${sx(tick.x)}px`;
21925
21926
  _v$27 !== _p$.e && className(_el$11, _p$.e = _v$27);
21926
21927
  _v$28 !== _p$.t && setStyleProperty(_el$11, "left", _p$.t = _v$28);
21927
21928
  return _p$;
@@ -21933,7 +21934,7 @@ function HorizontalRuler(props) {
21933
21934
  })(), memo(() => memo(() => !!tick.label)() && (() => {
21934
21935
  var _el$12 = _tmpl$3$e();
21935
21936
  insert(_el$12, () => tick.label);
21936
- createRenderEffect((_$p) => setStyleProperty(_el$12, "left", `${tick.x}px`));
21937
+ createRenderEffect((_$p) => setStyleProperty(_el$12, "left", `${sx(tick.x)}px`));
21937
21938
  return _el$12;
21938
21939
  })())]
21939
21940
  }), _el$7);
@@ -21944,7 +21945,7 @@ function HorizontalRuler(props) {
21944
21945
  _el$1.$$pointerdown = (event) => beginDrag("leftIndent", event);
21945
21946
  _el$10.$$pointerdown = (event) => beginDrag("rightIndent", event);
21946
21947
  createRenderEffect((_p$) => {
21947
- var _v$ = t("ruler.horizontal"), _v$2 = `${trackWidth()}px`, _v$3 = `translateX(${-scrollLeft()}px)`, _v$4 = `${pageLeft()}px`, _v$5 = `${pageSettings().width}px`, _v$6 = `${geometry().contentLeft}px`, _v$7 = `${geometry().contentRight}px`, _v$8 = `${Math.max(0, pageSettings().width - geometry().contentRight)}px`, _v$9 = `${geometry().contentLeft}px`, _v$0 = `${Math.max(0, geometry().contentRight - geometry().contentLeft)}px`, _v$1 = `${geometry().contentLeft}px`, _v$10 = t("ruler.leftMargin"), _v$11 = t("ruler.leftMargin"), _v$12 = `${geometry().contentRight}px`, _v$13 = t("ruler.rightMargin"), _v$14 = t("ruler.rightMargin"), _v$15 = `${geometry().firstLineX}px`, _v$16 = t("ruler.firstLineIndent"), _v$17 = t("ruler.firstLineIndent"), _v$18 = `${geometry().leftIndentX}px`, _v$19 = t("ruler.hangingIndent"), _v$20 = t("ruler.hangingIndent"), _v$21 = `${geometry().leftIndentX}px`, _v$22 = t("ruler.leftIndent"), _v$23 = t("ruler.leftIndent"), _v$24 = `${geometry().rightIndentX}px`, _v$25 = t("ruler.rightIndent"), _v$26 = t("ruler.rightIndent");
21948
+ var _v$ = t("ruler.horizontal"), _v$2 = `${trackWidth()}px`, _v$3 = `translateX(${-scrollLeft()}px)`, _v$4 = `${pageLeft()}px`, _v$5 = `${sx(pageSettings().width)}px`, _v$6 = `${sx(geometry().contentLeft)}px`, _v$7 = `${sx(geometry().contentRight)}px`, _v$8 = `${sx(Math.max(0, pageSettings().width - geometry().contentRight))}px`, _v$9 = `${sx(geometry().contentLeft)}px`, _v$0 = `${sx(Math.max(0, geometry().contentRight - geometry().contentLeft))}px`, _v$1 = `${sx(geometry().contentLeft)}px`, _v$10 = t("ruler.leftMargin"), _v$11 = t("ruler.leftMargin"), _v$12 = `${sx(geometry().contentRight)}px`, _v$13 = t("ruler.rightMargin"), _v$14 = t("ruler.rightMargin"), _v$15 = `${sx(geometry().firstLineX)}px`, _v$16 = t("ruler.firstLineIndent"), _v$17 = t("ruler.firstLineIndent"), _v$18 = `${sx(geometry().leftIndentX)}px`, _v$19 = t("ruler.hangingIndent"), _v$20 = t("ruler.hangingIndent"), _v$21 = `${sx(geometry().leftIndentX)}px`, _v$22 = t("ruler.leftIndent"), _v$23 = t("ruler.leftIndent"), _v$24 = `${sx(geometry().rightIndentX)}px`, _v$25 = t("ruler.rightIndent"), _v$26 = t("ruler.rightIndent");
21948
21949
  _v$ !== _p$.e && setAttribute(_el$, "aria-label", _p$.e = _v$);
21949
21950
  _v$2 !== _p$.t && setStyleProperty(_el$2, "width", _p$.t = _v$2);
21950
21951
  _v$3 !== _p$.a && setStyleProperty(_el$2, "transform", _p$.a = _v$3);
@@ -36519,7 +36520,7 @@ function createEditorZoom(initial = ZOOM_DEFAULT) {
36519
36520
  const zoomFactor = createMemo(() => zoomPercent() / 100);
36520
36521
  return { zoomPercent, setZoomPercent, adjustZoom, zoomFactor };
36521
36522
  }
36522
- var _tmpl$$m = /* @__PURE__ */ template(`<div data-testid=editor-editor-shell><div class=oasis-editor-editor data-testid=editor-editor><div class=oasis-editor-editor-zoom-sizer><div class=oasis-editor-editor-scroll-content data-testid=editor-editor-scroll-content style="position:absolute;top:0px;transform-origin:top left"><textarea aria-label="Editor input"autocomplete=off autocapitalize=off class=oasis-editor-input data-testid=editor-input value style=pointer-events:none></textarea><input data-testid=editor-import-docx-input type=file style=display:none><input accept="image/png, image/jpeg, image/gif"data-testid=editor-insert-image-input type=file style=display:none></div></div></div><div class=oasis-editor-statusbar data-testid=editor-statusbar><span class=oasis-editor-statusbar-item data-testid=editor-statusbar-word-count></span><span class=oasis-editor-statusbar-item data-testid=editor-statusbar-character-count></span><span class=oasis-editor-statusbar-item></span><div class=oasis-editor-statusbar-zoom data-testid=editor-statusbar-zoom-control><button type=button class=oasis-editor-zoom-button>−</button><input class=oasis-editor-zoom-slider type=range><button type=button class=oasis-editor-zoom-button>+</button><span class="oasis-editor-statusbar-item oasis-editor-zoom-value"data-testid=editor-statusbar-zoom>%`), _tmpl$2$g = /* @__PURE__ */ template(`<div class=oasis-editor-import-overlay data-testid=editor-import-overlay role=status aria-live=polite><div class=oasis-editor-import-card><div class=oasis-editor-import-title></div><div class=oasis-editor-import-phase data-testid=editor-import-phase></div><div class=oasis-editor-import-progress-track><div class=oasis-editor-import-progress-bar data-testid=editor-import-progress-bar></div></div><div class=oasis-editor-import-progress-label>`), _tmpl$3$a = /* @__PURE__ */ template(`<span class=oasis-editor-import-done-icon>`), _tmpl$4$8 = /* @__PURE__ */ template(`<span class=oasis-editor-import-error-icon>`), _tmpl$5$7 = /* @__PURE__ */ template(`<span>`);
36523
+ var _tmpl$$m = /* @__PURE__ */ template(`<div data-testid=editor-editor-shell><div class=oasis-editor-editor data-testid=editor-editor><div class=oasis-editor-editor-zoom-sizer><div class=oasis-editor-editor-scroll-content data-testid=editor-editor-scroll-content style="position:absolute;top:0px;transform-origin:top left"><textarea aria-label="Editor input"autocomplete=off autocapitalize=off class=oasis-editor-input data-testid=editor-input value style=pointer-events:none></textarea><input data-testid=editor-import-docx-input type=file style=display:none><input accept="image/png, image/jpeg, image/gif"data-testid=editor-insert-image-input type=file style=display:none></div></div></div><div class=oasis-editor-statusbar data-testid=editor-statusbar><div class="oasis-editor-statusbar-group oasis-editor-statusbar-start"><span class=oasis-editor-statusbar-item data-testid=editor-statusbar-word-count></span><span class=oasis-editor-statusbar-item data-testid=editor-statusbar-character-count></span><span class=oasis-editor-statusbar-item></span></div><div class="oasis-editor-statusbar-group oasis-editor-statusbar-end"><div class=oasis-editor-statusbar-zoom data-testid=editor-statusbar-zoom-control><button type=button class=oasis-editor-zoom-button>−</button><input class=oasis-editor-zoom-slider type=range><button type=button class=oasis-editor-zoom-button>+</button><span class="oasis-editor-statusbar-item oasis-editor-zoom-value"data-testid=editor-statusbar-zoom>%`), _tmpl$2$g = /* @__PURE__ */ template(`<div class=oasis-editor-import-overlay data-testid=editor-import-overlay role=status aria-live=polite><div class=oasis-editor-import-card><div class=oasis-editor-import-title></div><div class=oasis-editor-import-phase data-testid=editor-import-phase></div><div class=oasis-editor-import-progress-track><div class=oasis-editor-import-progress-bar data-testid=editor-import-progress-bar></div></div><div class=oasis-editor-import-progress-label>`), _tmpl$3$a = /* @__PURE__ */ template(`<span class=oasis-editor-import-done-icon>`), _tmpl$4$8 = /* @__PURE__ */ template(`<span class=oasis-editor-import-error-icon>`), _tmpl$5$7 = /* @__PURE__ */ template(`<span>`);
36523
36524
  function OasisEditorEditor(props) {
36524
36525
  const layout = () => props.layout ?? {};
36525
36526
  const overlays = () => props.overlays;
@@ -36540,13 +36541,11 @@ function OasisEditorEditor(props) {
36540
36541
  return rawViewportHeight ?? "min(72vh, 920px)";
36541
36542
  };
36542
36543
  const shellStyle = createMemo(() => ({
36543
- // pageWidth + both horizontal gutters + the reserved vertical-scrollbar
36544
- // gutter. The paper is width:100% of the scroll content and
36545
- // `.oasis-editor-editor` reserves the scrollbar via `scrollbar-gutter:
36546
- // stable`, so this keeps the paper exactly `pageWidth` while leaving room for
36547
- // the scrollbar — preventing a spurious horizontal scrollbar (notably in
36548
- // landscape) and letting the editor area grow to fit a wider page.
36549
- width: `min(${widestPageWidth() + EDITOR_SCROLL_PADDING_PX * 2 + EDITOR_SCROLLBAR_RESERVE_PX}px, 100%)`,
36544
+ // Word-like chrome spans the whole stage. The page remains centered by the
36545
+ // zoom-sizer/scroll-content layer, while pages wider than the available
36546
+ // stage continue to overflow inside the viewport instead of widening the
36547
+ // shell and pulling the ruler, scrollbar and status bar inward.
36548
+ width: "100%",
36550
36549
  height: "100%",
36551
36550
  "max-height": viewportHeight(),
36552
36551
  ...layout().style ?? {}
@@ -36580,6 +36579,24 @@ function OasisEditorEditor(props) {
36580
36579
  const zoomSizerWidth = createMemo(() => Math.max(unscaledContentWidth() * zoomFactor(), viewportSize().width));
36581
36580
  const zoomSizerHeight = createMemo(() => Math.max(measuredContentHeight() * zoomFactor(), viewportSize().height));
36582
36581
  const zoomLayerLeft = createMemo(() => Math.max(0, (zoomSizerWidth() - unscaledContentWidth() * zoomFactor()) / 2));
36582
+ let prevZoomFactor = zoomFactor();
36583
+ createEffect(() => {
36584
+ const next = zoomFactor();
36585
+ const prev = prevZoomFactor;
36586
+ prevZoomFactor = next;
36587
+ if (next === prev || prev <= 0) return;
36588
+ const el = viewportElement;
36589
+ if (!el) return;
36590
+ const ratio = next / prev;
36591
+ const halfW = el.clientWidth / 2;
36592
+ const halfH = el.clientHeight / 2;
36593
+ const targetLeft = (el.scrollLeft + halfW) * ratio - halfW;
36594
+ const targetTop = (el.scrollTop + halfH) * ratio - halfH;
36595
+ requestAnimationFrame(() => {
36596
+ el.scrollLeft = targetLeft;
36597
+ el.scrollTop = targetTop;
36598
+ });
36599
+ });
36583
36600
  const statusDocumentLayout = createMemo(() => {
36584
36601
  var _a, _b, _c, _d;
36585
36602
  return projectDocumentLayout(documentForStats(), void 0, (_b = (_a = layout()).measuredBlockHeights) == null ? void 0 : _b.call(_a), (_d = (_c = layout()).measuredParagraphLayouts) == null ? void 0 : _d.call(_c));
@@ -36633,7 +36650,7 @@ function OasisEditorEditor(props) {
36633
36650
  queueMicrotask(recomputeViewportPageIndex);
36634
36651
  });
36635
36652
  return (() => {
36636
- var _el$ = _tmpl$$m(), _el$2 = _el$.firstChild, _el$3 = _el$2.firstChild, _el$4 = _el$3.firstChild, _el$5 = _el$4.firstChild, _el$6 = _el$5.nextSibling, _el$7 = _el$6.nextSibling, _el$8 = _el$2.nextSibling, _el$9 = _el$8.firstChild, _el$0 = _el$9.nextSibling, _el$1 = _el$0.nextSibling, _el$10 = _el$1.nextSibling, _el$11 = _el$10.firstChild, _el$12 = _el$11.nextSibling, _el$13 = _el$12.nextSibling, _el$14 = _el$13.nextSibling, _el$15 = _el$14.firstChild;
36653
+ var _el$ = _tmpl$$m(), _el$2 = _el$.firstChild, _el$3 = _el$2.firstChild, _el$4 = _el$3.firstChild, _el$5 = _el$4.firstChild, _el$6 = _el$5.nextSibling, _el$7 = _el$6.nextSibling, _el$8 = _el$2.nextSibling, _el$9 = _el$8.firstChild, _el$0 = _el$9.firstChild, _el$1 = _el$0.nextSibling, _el$10 = _el$1.nextSibling, _el$11 = _el$9.nextSibling, _el$12 = _el$11.firstChild, _el$13 = _el$12.firstChild, _el$14 = _el$13.nextSibling, _el$15 = _el$14.nextSibling, _el$16 = _el$15.nextSibling, _el$17 = _el$16.firstChild;
36637
36654
  insert(_el$, createComponent(Show, {
36638
36655
  get when() {
36639
36656
  return memo(() => !!layout().showHorizontalRuler)() && overlays().toolbarHost;
@@ -36647,7 +36664,8 @@ function OasisEditorEditor(props) {
36647
36664
  return overlays().toolbarHost;
36648
36665
  },
36649
36666
  viewportRef,
36650
- readOnly: () => Boolean(layout().readOnly)
36667
+ readOnly: () => Boolean(layout().readOnly),
36668
+ zoomFactor
36651
36669
  });
36652
36670
  }
36653
36671
  }), _el$2);
@@ -36913,51 +36931,51 @@ function OasisEditorEditor(props) {
36913
36931
  const isDone = progress().phase === "done";
36914
36932
  const isError = progress().phase === "error";
36915
36933
  return (() => {
36916
- var _el$16 = _tmpl$2$g(), _el$17 = _el$16.firstChild, _el$18 = _el$17.firstChild, _el$19 = _el$18.nextSibling, _el$20 = _el$19.nextSibling, _el$21 = _el$20.firstChild, _el$22 = _el$20.nextSibling;
36917
- _el$16.classList.toggle("oasis-editor-import-overlay-done", !!isDone);
36918
- _el$16.classList.toggle("oasis-editor-import-overlay-error", !!isError);
36919
- setAttribute(_el$16, "aria-busy", !isDone && !isError);
36920
- insert(_el$17, createComponent(OasisBrandMark, {
36934
+ var _el$18 = _tmpl$2$g(), _el$19 = _el$18.firstChild, _el$20 = _el$19.firstChild, _el$21 = _el$20.nextSibling, _el$22 = _el$21.nextSibling, _el$23 = _el$22.firstChild, _el$24 = _el$22.nextSibling;
36935
+ _el$18.classList.toggle("oasis-editor-import-overlay-done", !!isDone);
36936
+ _el$18.classList.toggle("oasis-editor-import-overlay-error", !!isError);
36937
+ setAttribute(_el$18, "aria-busy", !isDone && !isError);
36938
+ insert(_el$19, createComponent(OasisBrandMark, {
36921
36939
  height: 40,
36922
36940
  "class": "oasis-editor-loading-mark"
36923
- }), _el$18);
36924
- insert(_el$18, () => t("import.overlay.title"));
36925
- insert(_el$19, () => t(`import.phase.${progress().phase}`));
36926
- _el$21.classList.toggle("oasis-editor-import-progress-bar-done", !!isDone);
36927
- _el$21.classList.toggle("oasis-editor-import-progress-bar-error", !!isError);
36928
- insert(_el$22, isDone ? (() => {
36929
- var _el$23 = _tmpl$3$a();
36930
- insert(_el$23, () => t("import.phase.done"));
36931
- return _el$23;
36941
+ }), _el$20);
36942
+ insert(_el$20, () => t("import.overlay.title"));
36943
+ insert(_el$21, () => t(`import.phase.${progress().phase}`));
36944
+ _el$23.classList.toggle("oasis-editor-import-progress-bar-done", !!isDone);
36945
+ _el$23.classList.toggle("oasis-editor-import-progress-bar-error", !!isError);
36946
+ insert(_el$24, isDone ? (() => {
36947
+ var _el$25 = _tmpl$3$a();
36948
+ insert(_el$25, () => t("import.phase.done"));
36949
+ return _el$25;
36932
36950
  })() : isError ? (() => {
36933
- var _el$24 = _tmpl$4$8();
36934
- insert(_el$24, () => t("import.phase.error"));
36935
- return _el$24;
36951
+ var _el$26 = _tmpl$4$8();
36952
+ insert(_el$26, () => t("import.phase.error"));
36953
+ return _el$26;
36936
36954
  })() : [memo(() => Math.round(progress().progress)), "%"]);
36937
36955
  createRenderEffect((_p$) => {
36938
36956
  var _v$19 = !!(progress().phase === "applying-editor-state" || progress().phase === "stabilizing-layout"), _v$20 = `${progress().progress}%`;
36939
- _v$19 !== _p$.e && _el$21.classList.toggle("oasis-editor-import-progress-bar-indeterminate", _p$.e = _v$19);
36940
- _v$20 !== _p$.t && setStyleProperty(_el$21, "width", _p$.t = _v$20);
36957
+ _v$19 !== _p$.e && _el$23.classList.toggle("oasis-editor-import-progress-bar-indeterminate", _p$.e = _v$19);
36958
+ _v$20 !== _p$.t && setStyleProperty(_el$23, "width", _p$.t = _v$20);
36941
36959
  return _p$;
36942
36960
  }, {
36943
36961
  e: void 0,
36944
36962
  t: void 0
36945
36963
  });
36946
- return _el$16;
36964
+ return _el$18;
36947
36965
  })();
36948
36966
  }
36949
36967
  }), _el$8);
36950
- insert(_el$9, () => t("status.words", [wordCount()]));
36951
- insert(_el$0, () => t("status.characters", [characterCount()]));
36952
- insert(_el$1, () => t("status.page", [currentPage(), totalPages()]));
36953
- _el$11.$$click = () => adjustZoom(-ZOOM_STEP);
36954
- _el$12.$$input = (event) => setZoomPercent(clampZoom(event.currentTarget.valueAsNumber));
36955
- setAttribute(_el$12, "min", ZOOM_MIN);
36956
- setAttribute(_el$12, "max", ZOOM_MAX);
36957
- setAttribute(_el$12, "step", ZOOM_STEP);
36958
- _el$13.$$click = () => adjustZoom(ZOOM_STEP);
36959
- insert(_el$14, zoomPercent, _el$15);
36960
- insert(_el$8, createComponent(Show, {
36968
+ insert(_el$0, () => t("status.words", [wordCount()]));
36969
+ insert(_el$1, () => t("status.characters", [characterCount()]));
36970
+ insert(_el$10, () => t("status.page", [currentPage(), totalPages()]));
36971
+ _el$13.$$click = () => adjustZoom(-ZOOM_STEP);
36972
+ _el$14.$$input = (event) => setZoomPercent(clampZoom(event.currentTarget.valueAsNumber));
36973
+ setAttribute(_el$14, "min", ZOOM_MIN);
36974
+ setAttribute(_el$14, "max", ZOOM_MAX);
36975
+ setAttribute(_el$14, "step", ZOOM_STEP);
36976
+ _el$15.$$click = () => adjustZoom(ZOOM_STEP);
36977
+ insert(_el$16, zoomPercent, _el$17);
36978
+ insert(_el$11, createComponent(Show, {
36961
36979
  get when() {
36962
36980
  return overlays().persistenceStatus;
36963
36981
  },
@@ -36969,10 +36987,10 @@ function OasisEditorEditor(props) {
36969
36987
  return createComponent(Show, {
36970
36988
  when: key,
36971
36989
  get children() {
36972
- var _el$25 = _tmpl$5$7();
36973
- insert(_el$25, () => t(key));
36974
- createRenderEffect(() => className(_el$25, `oasis-editor-statusbar-item oasis-editor-persistence-status oasis-editor-status-${status.replace("...", "ing").replace(".", "")}`));
36975
- return _el$25;
36990
+ var _el$27 = _tmpl$5$7();
36991
+ insert(_el$27, () => t(key));
36992
+ createRenderEffect(() => className(_el$27, `oasis-editor-statusbar-item oasis-editor-persistence-status oasis-editor-status-${status.replace("...", "ing").replace(".", "")}`));
36993
+ return _el$27;
36976
36994
  }
36977
36995
  });
36978
36996
  })();
@@ -36993,13 +37011,13 @@ function OasisEditorEditor(props) {
36993
37011
  _v$1 !== _p$.l && setStyleProperty(_el$5, "top", _p$.l = _v$1);
36994
37012
  _v$10 !== _p$.u && setStyleProperty(_el$5, "height", _p$.u = _v$10);
36995
37013
  _v$11 !== _p$.c && setAttribute(_el$6, "accept", _p$.c = _v$11);
36996
- _v$12 !== _p$.w && setAttribute(_el$10, "aria-label", _p$.w = _v$12);
36997
- _v$13 !== _p$.m && setAttribute(_el$11, "aria-label", _p$.m = _v$13);
36998
- _v$14 !== _p$.f && (_el$11.disabled = _p$.f = _v$14);
36999
- _v$15 !== _p$.y && setAttribute(_el$12, "aria-label", _p$.y = _v$15);
37000
- _v$16 !== _p$.g && setAttribute(_el$12, "aria-valuetext", _p$.g = _v$16);
37001
- _v$17 !== _p$.p && setAttribute(_el$13, "aria-label", _p$.p = _v$17);
37002
- _v$18 !== _p$.b && (_el$13.disabled = _p$.b = _v$18);
37014
+ _v$12 !== _p$.w && setAttribute(_el$12, "aria-label", _p$.w = _v$12);
37015
+ _v$13 !== _p$.m && setAttribute(_el$13, "aria-label", _p$.m = _v$13);
37016
+ _v$14 !== _p$.f && (_el$13.disabled = _p$.f = _v$14);
37017
+ _v$15 !== _p$.y && setAttribute(_el$14, "aria-label", _p$.y = _v$15);
37018
+ _v$16 !== _p$.g && setAttribute(_el$14, "aria-valuetext", _p$.g = _v$16);
37019
+ _v$17 !== _p$.p && setAttribute(_el$15, "aria-label", _p$.p = _v$17);
37020
+ _v$18 !== _p$.b && (_el$15.disabled = _p$.b = _v$18);
37003
37021
  return _p$;
37004
37022
  }, {
37005
37023
  e: void 0,
@@ -37023,7 +37041,7 @@ function OasisEditorEditor(props) {
37023
37041
  p: void 0,
37024
37042
  b: void 0
37025
37043
  });
37026
- createRenderEffect(() => _el$12.value = zoomPercent());
37044
+ createRenderEffect(() => _el$14.value = zoomPercent());
37027
37045
  return _el$;
37028
37046
  })();
37029
37047
  }