oasis-editor 0.0.113 → 0.0.114

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 { d as domTextMeasurer, g as getProjectedParagraphBlockHeight, e as estimateTableBlockHeight, p as projectParagraphLayout, a as getPageContentWidth, b as getPageBodyTop, c as getPageBodyBottom, l as listReferencedEndnotes, f as getFootnoteDisplayMarker, s as setActiveHyphenation, h as getDocumentSections, i as buildFootnoteReservations, M as MAX_FOOTNOTE_LAYOUT_ITERATIONS, r as reservationSignature, j as applyFootnotesToPages, k as getRunField, m as projectBlocksLayout, v as visitRun, n as assertNever, o as createSignal, q as createEditorStateFromDocument, t as createInitialEditorState, S as STANDARD_FONT_SIZES_PT, u as fontSizePxToPt, w as probeLocalFontFamilies, x as createEditorParagraphFromRuns, y as isInlineObjectRun, z as createEditorStyledRun, A as getParagraphLength, B as getParagraphText, C as getActiveZone, D as getActiveSectionIndex, E as getParagraphs, F as normalizeSelection, G as positionToParagraphOffset, H as paragraphOffsetToPosition, I as clampPosition, J as findParagraphIndex, K as createCollapsedSelection, L as isSelectionCollapsed, N as parseFontSizePtToPx, O as formatFontSizePt, P as createEditorParagraph, Q as getBlockParagraphs, R as findParagraphTableLocation, T as buildTableCellLayout, U as PT_PER_PX, V as createEditorTableCell, W as createEditorTableRow, X as createEditorTable, Y as underlineStyleToCssDecorationStyle, Z as resolveImageSrc, _ as listKindForTag, $ as isParagraphTag, a0 as collectInlineRuns, a1 as parseParagraphStyle, a2 as getRunImage, a3 as InlineShell, a4 as BalloonShell, a5 as DocumentShell, a6 as createMemo, a7 as getCaretRectFromSnapshot, a8 as getParagraphRectFromSnapshot, a9 as createComponent, aa as CaretOverlay, ab as Show, ac as createRenderEffect, ad as style, ae as setAttribute, af as setStyleProperty, ag as memo, ah as template, ai as addEventListener, aj as insert, ak as delegateEvents, al as useI18n, am as createEffect, an as use, ao as Dialog, ap as className, aq as For, ar as UNDERLINE_STYLE_OPTIONS, as as Tabs, at as onMount, au as onCleanup, av as PluginUiHost, aw as OasisEditorEditor, ax as OasisBrandMark, ay as setPreciseFontPreference, az as setWelcomeSeen, aA as enablePreciseFontMode, aB as TWIPS_PER_POINT, aC as PX_PER_INCH, aD as TWIPS_PER_INCH, aE as normalizeHex6, aF as TABLE_CONDITIONAL_FLAG_ATTRIBUTES, aG as TABLE_BORDER_EDGE_KEYS, aH as resolveEffectiveParagraphStyle, aI as resolveEffectiveTextStyleForParagraph, aJ as EMU_PER_PT, aK as OOXML_ROTATION_UNITS, aL as OOXML_PERCENT_DENOMINATOR, aM as parseHexColorToRgb255, aN as EMU_PER_PX, aO as getRunFootnoteReference, aP as getRunEndnoteReference, aQ as iterateFootnoteReferenceRuns, aR as iterateEndnoteReferenceRuns, aS as imageContentTypeDefaults, aT as getRunFieldChar, aU as getRunFieldInstruction, aV as createEditorRun, aW as JSZip, aX as imageExtensionFromMime, aY as pxToPt$1, aZ as resolveFloatingObjectRect, a_ as getTextBoxFloatingGeometry, a$ as getPresetPathSegments, b0 as buildListLabels, b1 as getImageFloatingGeometry, b2 as textStyleToFontSizePt, b3 as PX_PER_POINT, b4 as DEFAULT_FONT_SIZE_PX, b5 as resolveOpenTypeFeatureTags, b6 as rgb255ToHex, b7 as isDoubleUnderlineStyle, b8 as isWavyUnderlineStyle, b9 as underlineStyleLineWidthPx, ba as underlineStyleDashArray, bb as resolveListLabel, bc as getListLabelInset, bd as getAlignedListLabelInset, be as getParagraphBorderInsets, bf as buildSegmentTable, bg as buildCanvasTableLayout, bh as resolveCanvasTableWidth, bi as resolveFloatingTableRect, bj as normalizeFamily, bk as ROBOTO_FONT_FILES, bl as loadFontAsset, bm as OFFICE_COMPAT_FONT_FAMILIES, bn as BinaryReader, bo as buildSfnt, bp as defaultFontDecoderRegistry, bq as SfntFontProgram, br as collectPdfFontFamilies, bs as outlineFrom, bt as getPageHeaderZoneTop, bu as getPageColumnRects, bv as findFootnoteReference, bw as FOOTNOTE_MARKER_GUTTER_PX, bx as resolveImporterForFile, by as getDocumentSectionsCanonical, bz as getDocumentParagraphsCanonical, bA as getDocumentParagraphs, bB as getDocumentPageSettings, bC as getTableCellContentWidthForParagraph, bD as layoutMetricsEpoch, bE as bumpLayoutMetricsEpoch, bF as createCanvasLayoutSnapshotProvider, bG as on, bH as debounce, bI as unwrap, bJ as perfTimer, bK as getRunTextBox, bL as createEditorDocument, bM as resolveResizedDimensions, bN as resolveTextBoxRenderHeight, bO as getToolbarStyleState, bP as getCachedCanvasImage, bQ as measureParagraphMinContentWidthPx, bR as getEditableBlocksForZone, bS as findParagraphLocation, bT as createSectionBoundaryParagraph, bU as normalizePageSettings, bV as DEFAULT_EDITOR_PAGE_SETTINGS, bW as markStart, bX as markEnd, bY as getParagraphEntries, bZ as getParagraphById, b_ as createEditorFootnote, b$ as createFootnoteReferenceRun, c0 as renumberFootnotes, c1 as getHeadingLevel, c2 as preciseFontModeVersion, c3 as isPreciseFontModeEnabled, c4 as resolveNamedTextStyle, c5 as togglePreciseFontMode, c6 as nextFontSizePt, c7 as previousFontSizePt, c8 as fontSizePtToPx, c9 as createDefaultToolbarPreset, ca as MenuRegistry, cb as createToolbarRegistry, cc as Editor, cd as resolveCommandRef, ce as commandRefName, cf as createOasisEditorClient, cg as createEditorZoom, ch as startLongTaskObserver, ci as installGlobalReport, cj as applyStoredPreciseFontPreference, ck as getWelcomeSeen, cl as isLocalFontAccessSupported, cm as EDITOR_SCROLL_PADDING_PX, cn as Toolbar, co as OasisEditorLoading, cp as I18nProvider, cq as createTranslator, cr as createEditorLogger, cs as registerDomStatsSurface } from "./index-DSDwe-yy.js";
4
+ import { d as domTextMeasurer, g as getProjectedParagraphBlockHeight, e as estimateTableBlockHeight, p as projectParagraphLayout, a as getPageContentWidth, b as getPageBodyTop, c as getPageBodyBottom, l as listReferencedEndnotes, f as getFootnoteDisplayMarker, s as setActiveHyphenation, h as getDocumentSections, i as buildFootnoteReservations, M as MAX_FOOTNOTE_LAYOUT_ITERATIONS, r as reservationSignature, j as applyFootnotesToPages, k as getRunField, m as projectBlocksLayout, v as visitRun, n as assertNever, o as createSignal, q as createEditorStateFromDocument, t as createInitialEditorState, S as STANDARD_FONT_SIZES_PT, u as fontSizePxToPt, w as probeLocalFontFamilies, x as createEditorParagraphFromRuns, y as isInlineObjectRun, z as createEditorStyledRun, A as getParagraphLength, B as getParagraphText, C as getActiveZone, D as getActiveSectionIndex, E as getParagraphs, F as normalizeSelection, G as positionToParagraphOffset, H as paragraphOffsetToPosition, I as clampPosition, J as findParagraphIndex, K as createCollapsedSelection, L as isSelectionCollapsed, N as parseFontSizePtToPx, O as formatFontSizePt, P as createEditorParagraph, Q as getBlockParagraphs, R as findParagraphTableLocation, T as buildTableCellLayout, U as PT_PER_PX, V as createEditorTableCell, W as createEditorTableRow, X as createEditorTable, Y as underlineStyleToCssDecorationStyle, Z as resolveImageSrc, _ as listKindForTag, $ as isParagraphTag, a0 as collectInlineRuns, a1 as parseParagraphStyle, a2 as getRunImage, a3 as InlineShell, a4 as BalloonShell, a5 as DocumentShell, a6 as createMemo, a7 as getCaretRectFromSnapshot, a8 as getParagraphRectFromSnapshot, a9 as createComponent, aa as CaretOverlay, ab as Show, ac as createRenderEffect, ad as style, ae as setAttribute, af as setStyleProperty, ag as memo, ah as template, ai as addEventListener, aj as insert, ak as delegateEvents, al as useI18n, am as createEffect, an as use, ao as Dialog, ap as className, aq as For, ar as UNDERLINE_STYLE_OPTIONS, as as Tabs, at as createStore, au as reconcile, av as onMount, aw as onCleanup, ax as PluginUiHost, ay as OasisEditorEditor, az as OasisBrandMark, aA as setPreciseFontPreference, aB as setWelcomeSeen, aC as enablePreciseFontMode, aD as TWIPS_PER_POINT, aE as PX_PER_INCH, aF as TWIPS_PER_INCH, aG as normalizeHex6, aH as TABLE_CONDITIONAL_FLAG_ATTRIBUTES, aI as TABLE_BORDER_EDGE_KEYS, aJ as resolveEffectiveParagraphStyle, aK as resolveEffectiveTextStyleForParagraph, aL as EMU_PER_PT, aM as OOXML_ROTATION_UNITS, aN as OOXML_PERCENT_DENOMINATOR, aO as parseHexColorToRgb255, aP as EMU_PER_PX, aQ as getRunFootnoteReference, aR as getRunEndnoteReference, aS as iterateFootnoteReferenceRuns, aT as iterateEndnoteReferenceRuns, aU as imageContentTypeDefaults, aV as getRunFieldChar, aW as getRunFieldInstruction, aX as createEditorRun, aY as JSZip, aZ as imageExtensionFromMime, a_ as pxToPt$1, a$ as resolveFloatingObjectRect, b0 as getTextBoxFloatingGeometry, b1 as getPresetPathSegments, b2 as buildListLabels, b3 as getImageFloatingGeometry, b4 as textStyleToFontSizePt, b5 as PX_PER_POINT, b6 as DEFAULT_FONT_SIZE_PX, b7 as resolveOpenTypeFeatureTags, b8 as rgb255ToHex, b9 as isDoubleUnderlineStyle, ba as isWavyUnderlineStyle, bb as underlineStyleLineWidthPx, bc as WAVY_UNDERLINE_WAVELENGTH_PX, bd as WAVY_UNDERLINE_AMPLITUDE_PX, be as underlineStyleDashArray, bf as resolveListLabel, bg as getListLabelInset, bh as getAlignedListLabelInset, bi as getParagraphBorderInsets, bj as buildSegmentTable, bk as buildCanvasTableLayout, bl as resolveCanvasTableWidth, bm as resolveFloatingTableRect, bn as normalizeFamily, bo as ROBOTO_FONT_FILES, bp as loadFontAsset, bq as OFFICE_COMPAT_FONT_FAMILIES, br as BinaryReader, bs as buildSfnt, bt as defaultFontDecoderRegistry, bu as SfntFontProgram, bv as collectPdfFontFamilies, bw as outlineFrom, bx as getPageHeaderZoneTop, by as getPageColumnRects, bz as findFootnoteReference, bA as FOOTNOTE_MARKER_GUTTER_PX, bB as resolveImporterForFile, bC as getDocumentSectionsCanonical, bD as getDocumentParagraphsCanonical, bE as getDocumentParagraphs, bF as getDocumentPageSettings, bG as getTableCellContentWidthForParagraph, bH as layoutMetricsEpoch, bI as bumpLayoutMetricsEpoch, bJ as createCanvasLayoutSnapshotProvider, bK as on, bL as debounce, bM as unwrap, bN as perfTimer, bO as getRunTextBox, bP as createEditorDocument, bQ as resolveResizedDimensions, bR as resolveTextBoxRenderHeight, bS as getToolbarStyleState, bT as getCachedCanvasImage, bU as measureParagraphMinContentWidthPx, bV as getEditableBlocksForZone, bW as findParagraphLocation, bX as createSectionBoundaryParagraph, bY as normalizePageSettings, bZ as DEFAULT_EDITOR_PAGE_SETTINGS, b_ as markStart, b$ as markEnd, c0 as getParagraphEntries, c1 as getParagraphById, c2 as createEditorFootnote, c3 as createFootnoteReferenceRun, c4 as renumberFootnotes, c5 as getHeadingLevel, c6 as preciseFontModeVersion, c7 as isPreciseFontModeEnabled, c8 as resolveNamedTextStyle, c9 as togglePreciseFontMode, ca as nextFontSizePt, cb as previousFontSizePt, cc as fontSizePtToPx, cd as createDefaultToolbarPreset, ce as MenuRegistry, cf as createToolbarRegistry, cg as Editor, ch as resolveCommandRef, ci as commandRefName, cj as createOasisEditorClient, ck as createEditorZoom, cl as startLongTaskObserver, cm as installGlobalReport, cn as applyStoredPreciseFontPreference, co as getWelcomeSeen, cp as isLocalFontAccessSupported, cq as EDITOR_SCROLL_PADDING_PX, cr as Toolbar, cs as OasisEditorLoading, ct as I18nProvider, cu as createTranslator, cv as createEditorLogger, cw as registerDomStatsSurface } from "./index-CwpzM--5.js";
5
5
  function projectHeaderFooterBlocksWithDependencies(blocks, deps, context = {}) {
6
6
  const {
7
7
  pageIndex,
@@ -32449,194 +32449,400 @@ function resolveBorder(style2, widthValue, colorValue) {
32449
32449
  color: colorValue.trim() || DEFAULT_BORDER_COLOR
32450
32450
  };
32451
32451
  }
32452
- function TablePropertiesDialog(props) {
32452
+ function numericInput(label, value, setter, testId, disabled = false, allowNegative = false) {
32453
+ return (() => {
32454
+ var _el$ = _tmpl$$5(), _el$2 = _el$.firstChild, _el$3 = _el$2.nextSibling;
32455
+ insert(_el$2, label);
32456
+ _el$3.$$input = (e) => setter(e.currentTarget.value);
32457
+ setAttribute(_el$3, "min", allowNegative ? void 0 : "0");
32458
+ _el$3.disabled = disabled;
32459
+ setAttribute(_el$3, "data-testid", testId);
32460
+ createRenderEffect(() => _el$3.value = value());
32461
+ return _el$;
32462
+ })();
32463
+ }
32464
+ function checkbox(label, checked, setter, testId, disabled = false) {
32465
+ return (() => {
32466
+ var _el$4 = _tmpl$2$1(), _el$5 = _el$4.firstChild;
32467
+ _el$5.addEventListener("change", (e) => setter(e.currentTarget.checked));
32468
+ _el$5.disabled = disabled;
32469
+ setAttribute(_el$5, "data-testid", testId);
32470
+ insert(_el$4, label, null);
32471
+ createRenderEffect(() => _el$5.checked = checked());
32472
+ return _el$4;
32473
+ })();
32474
+ }
32475
+ function TableTabPanel(p) {
32476
+ const t = useI18n();
32477
+ return (() => {
32478
+ var _el$6 = _tmpl$6$1(), _el$7 = _el$6.firstChild, _el$8 = _el$7.firstChild, _el$9 = _el$8.nextSibling, _el$0 = _el$9.firstChild, _el$1 = _el$0.firstChild, _el$10 = _el$1.nextSibling, _el$11 = _el$10.firstChild, _el$12 = _el$11.nextSibling, _el$13 = _el$7.nextSibling, _el$14 = _el$13.firstChild, _el$15 = _el$14.nextSibling, _el$16 = _el$15.nextSibling, _el$17 = _el$13.nextSibling, _el$18 = _el$17.firstChild, _el$19 = _el$18.nextSibling;
32479
+ insert(_el$8, () => t("table.sizeSection"));
32480
+ insert(_el$9, () => numericInput(t("table.preferredWidth"), () => p.form.tableWidth, (v) => p.set("tableWidth", v), "editor-table-properties-table-width"), _el$0);
32481
+ insert(_el$1, () => t("table.measureIn"));
32482
+ _el$10.addEventListener("change", (e) => p.set("tableWidthUnit", e.currentTarget.value));
32483
+ insert(_el$11, () => t("table.points"));
32484
+ insert(_el$12, () => t("table.percent"));
32485
+ insert(_el$14, () => t("table.alignmentSection"));
32486
+ insert(_el$15, () => ["left", "center", "right"].map((align) => (() => {
32487
+ var _el$43 = _tmpl$7(), _el$44 = _el$43.firstChild;
32488
+ _el$44.addEventListener("change", () => p.set("tableAlign", align));
32489
+ setAttribute(_el$44, "data-testid", `editor-table-properties-align-${align}`);
32490
+ insert(_el$43, () => t(`table.align${align[0].toUpperCase()}${align.slice(1)}`), null);
32491
+ createRenderEffect(() => _el$44.checked = p.form.tableAlign === align);
32492
+ return _el$43;
32493
+ })()));
32494
+ insert(_el$16, () => numericInput(t("table.indentFromLeft"), () => p.form.tableIndentLeft, (v) => p.set("tableIndentLeft", v), "editor-table-properties-indent-left"));
32495
+ insert(_el$18, () => t("table.textWrappingSection"));
32496
+ insert(_el$19, () => checkbox(t("table.wrapNone"), () => p.form.tableWrapping === "none", () => p.set("tableWrapping", "none"), "editor-table-properties-wrap-none"), null);
32497
+ insert(_el$19, () => checkbox(t("table.wrapAround"), () => p.form.tableWrapping === "around", () => p.set("tableWrapping", "around"), "editor-table-properties-wrap-around"), null);
32498
+ insert(_el$17, createComponent(Show, {
32499
+ get when() {
32500
+ return p.form.tableWrapping === "around";
32501
+ },
32502
+ get children() {
32503
+ return [(() => {
32504
+ var _el$20 = _tmpl$3$1(), _el$21 = _el$20.firstChild, _el$22 = _el$21.firstChild, _el$23 = _el$22.nextSibling, _el$24 = _el$23.firstChild, _el$25 = _el$24.nextSibling, _el$26 = _el$25.nextSibling, _el$27 = _el$21.nextSibling, _el$28 = _el$27.firstChild, _el$29 = _el$28.nextSibling, _el$30 = _el$29.firstChild, _el$31 = _el$30.nextSibling, _el$32 = _el$31.nextSibling;
32505
+ insert(_el$22, () => t("table.horizontalAnchor"));
32506
+ _el$23.addEventListener("change", (e) => p.set("floatingHorizontalAnchor", e.currentTarget.value));
32507
+ insert(_el$24, () => t("table.anchorMargin"));
32508
+ insert(_el$25, () => t("table.anchorPage"));
32509
+ insert(_el$26, () => t("table.anchorText"));
32510
+ insert(_el$28, () => t("table.verticalAnchor"));
32511
+ _el$29.addEventListener("change", (e) => p.set("floatingVerticalAnchor", e.currentTarget.value));
32512
+ insert(_el$30, () => t("table.anchorMargin"));
32513
+ insert(_el$31, () => t("table.anchorPage"));
32514
+ insert(_el$32, () => t("table.anchorText"));
32515
+ createRenderEffect(() => _el$23.value = p.form.floatingHorizontalAnchor);
32516
+ createRenderEffect(() => _el$29.value = p.form.floatingVerticalAnchor);
32517
+ return _el$20;
32518
+ })(), (() => {
32519
+ var _el$33 = _tmpl$4$1(), _el$34 = _el$33.firstChild, _el$35 = _el$34.firstChild, _el$36 = _el$35.nextSibling, _el$37 = _el$36.firstChild, _el$38 = _el$34.nextSibling, _el$39 = _el$38.firstChild, _el$40 = _el$39.nextSibling, _el$41 = _el$40.firstChild;
32520
+ insert(_el$33, () => numericInput(t("table.positionX"), () => p.form.floatingX, (v) => p.set("floatingX", v), "editor-table-properties-floating-x", Boolean(p.form.floatingXAlign), true), _el$34);
32521
+ insert(_el$33, () => numericInput(t("table.positionY"), () => p.form.floatingY, (v) => p.set("floatingY", v), "editor-table-properties-floating-y", Boolean(p.form.floatingYAlign), true), _el$34);
32522
+ insert(_el$35, () => t("table.horizontalAlignment"));
32523
+ _el$36.addEventListener("change", (e) => p.set("floatingXAlign", e.currentTarget.value));
32524
+ insert(_el$37, () => t("table.explicitOffset"));
32525
+ insert(_el$36, () => ["left", "center", "right", "inside", "outside"].map((value) => (() => {
32526
+ var _el$45 = _tmpl$8();
32527
+ _el$45.value = value;
32528
+ insert(_el$45, value);
32529
+ return _el$45;
32530
+ })()), null);
32531
+ insert(_el$39, () => t("table.verticalAlignment"));
32532
+ _el$40.addEventListener("change", (e) => p.set("floatingYAlign", e.currentTarget.value));
32533
+ insert(_el$41, () => t("table.explicitOffset"));
32534
+ insert(_el$40, () => ["top", "center", "bottom", "inside", "outside"].map((value) => (() => {
32535
+ var _el$46 = _tmpl$8();
32536
+ _el$46.value = value;
32537
+ insert(_el$46, value);
32538
+ return _el$46;
32539
+ })()), null);
32540
+ createRenderEffect(() => _el$36.value = p.form.floatingXAlign);
32541
+ createRenderEffect(() => _el$40.value = p.form.floatingYAlign);
32542
+ return _el$33;
32543
+ })(), (() => {
32544
+ var _el$42 = _tmpl$5$1();
32545
+ insert(_el$42, () => numericInput(t("table.distanceTop"), () => p.form.floatingDistanceTop, (v) => p.set("floatingDistanceTop", v), "editor-table-properties-floating-distance-top"), null);
32546
+ insert(_el$42, () => numericInput(t("table.distanceRight"), () => p.form.floatingDistanceRight, (v) => p.set("floatingDistanceRight", v), "editor-table-properties-floating-distance-right"), null);
32547
+ insert(_el$42, () => numericInput(t("table.distanceBottom"), () => p.form.floatingDistanceBottom, (v) => p.set("floatingDistanceBottom", v), "editor-table-properties-floating-distance-bottom"), null);
32548
+ insert(_el$42, () => numericInput(t("table.distanceLeft"), () => p.form.floatingDistanceLeft, (v) => p.set("floatingDistanceLeft", v), "editor-table-properties-floating-distance-left"), null);
32549
+ return _el$42;
32550
+ })(), memo(() => checkbox(t("table.allowOverlap"), () => p.form.floatingOverlap === "overlap", (value) => p.set("floatingOverlap", value ? "overlap" : "never"), "editor-table-properties-floating-overlap"))];
32551
+ }
32552
+ }), null);
32553
+ createRenderEffect(() => _el$10.value = p.form.tableWidthUnit);
32554
+ return _el$6;
32555
+ })();
32556
+ }
32557
+ function RowTabPanel(p) {
32558
+ const t = useI18n();
32559
+ return (() => {
32560
+ var _el$47 = _tmpl$9(), _el$48 = _el$47.firstChild, _el$49 = _el$48.firstChild, _el$50 = _el$49.firstChild, _el$51 = _el$50.nextSibling, _el$52 = _el$51.firstChild, _el$53 = _el$52.nextSibling, _el$54 = _el$53.nextSibling, _el$55 = _el$48.nextSibling;
32561
+ insert(_el$48, () => numericInput(t("table.rowHeight"), () => p.form.rowHeight, (v) => p.set("rowHeight", v), "editor-table-properties-row-height"), _el$49);
32562
+ insert(_el$50, () => t("table.rowHeightRule"));
32563
+ _el$51.addEventListener("change", (e) => p.set("rowHeightRule", e.currentTarget.value));
32564
+ insert(_el$52, () => t("table.rowAuto"));
32565
+ insert(_el$53, () => t("table.rowAtLeast"));
32566
+ insert(_el$54, () => t("table.rowExactly"));
32567
+ insert(_el$55, () => checkbox(t("table.repeatHeader"), () => p.form.repeatHeader, (v) => p.set("repeatHeader", v), "editor-table-properties-repeat-header"), null);
32568
+ insert(_el$55, () => checkbox(t("table.allowBreakAcrossPages"), () => p.form.allowBreakAcrossPages, (v) => p.set("allowBreakAcrossPages", v), "editor-table-properties-allow-break"), null);
32569
+ insert(_el$55, () => checkbox(t("table.hiddenRow"), () => p.form.hiddenRow, (v) => p.set("hiddenRow", v), "editor-table-properties-hidden-row"), null);
32570
+ createRenderEffect(() => _el$51.value = p.form.rowHeightRule);
32571
+ return _el$47;
32572
+ })();
32573
+ }
32574
+ function ColumnTabPanel(p) {
32575
+ const t = useI18n();
32576
+ return (() => {
32577
+ var _el$56 = _tmpl$0(), _el$57 = _el$56.firstChild;
32578
+ insert(_el$57, () => numericInput(t("table.columnWidth"), () => p.form.columnWidth, (v) => p.set("columnWidth", v), "editor-table-properties-column-width"));
32579
+ return _el$56;
32580
+ })();
32581
+ }
32582
+ function CellTabPanel(p) {
32453
32583
  const t = useI18n();
32454
- const [activeTab, setActiveTab] = createSignal("table");
32455
- const [tableWidth, setTableWidth] = createSignal("");
32456
- const [tableWidthUnit, setTableWidthUnit] = createSignal("points");
32457
- const [tableAlign, setTableAlign] = createSignal("");
32458
- const [tableIndentLeft, setTableIndentLeft] = createSignal("");
32459
- const [tableWrapping, setTableWrapping] = createSignal("none");
32460
- const [floatingHorizontalAnchor, setFloatingHorizontalAnchor] = createSignal("margin");
32461
- const [floatingVerticalAnchor, setFloatingVerticalAnchor] = createSignal("text");
32462
- const [floatingX, setFloatingX] = createSignal("");
32463
- const [floatingY, setFloatingY] = createSignal("");
32464
- const [floatingXAlign, setFloatingXAlign] = createSignal("");
32465
- const [floatingYAlign, setFloatingYAlign] = createSignal("");
32466
- const [floatingDistanceTop, setFloatingDistanceTop] = createSignal("");
32467
- const [floatingDistanceRight, setFloatingDistanceRight] = createSignal("");
32468
- const [floatingDistanceBottom, setFloatingDistanceBottom] = createSignal("");
32469
- const [floatingDistanceLeft, setFloatingDistanceLeft] = createSignal("");
32470
- const [floatingOverlap, setFloatingOverlap] = createSignal("overlap");
32471
- const [rowHeight, setRowHeight] = createSignal("");
32472
- const [rowHeightRule, setRowHeightRule] = createSignal("");
32473
- const [repeatHeader, setRepeatHeader] = createSignal(false);
32474
- const [allowBreakAcrossPages, setAllowBreakAcrossPages] = createSignal(true);
32475
- const [hiddenRow, setHiddenRow] = createSignal(false);
32476
- const [columnWidth, setColumnWidth] = createSignal("");
32477
- const [cellWidth, setCellWidth] = createSignal("");
32478
- const [cellVerticalAlign, setCellVerticalAlign] = createSignal("");
32479
- const [cellTextDirection, setCellTextDirection] = createSignal("");
32480
- const [cellNoWrap, setCellNoWrap] = createSignal(false);
32481
- const [cellFitText, setCellFitText] = createSignal(false);
32482
- const [cellHideMark, setCellHideMark] = createSignal(false);
32483
- const [marginTop, setMarginTop] = createSignal("");
32484
- const [marginRight, setMarginRight] = createSignal("");
32485
- const [marginBottom, setMarginBottom] = createSignal("");
32486
- const [marginLeft, setMarginLeft] = createSignal("");
32487
- const [borderStyle, setBorderStyle] = createSignal("none");
32488
- const [borderWidth, setBorderWidth] = createSignal("");
32489
- const [borderColor, setBorderColor] = createSignal("");
32490
- const [borderTop, setBorderTop] = createSignal(false);
32491
- const [borderRight, setBorderRight] = createSignal(false);
32492
- const [borderBottom, setBorderBottom] = createSignal(false);
32493
- const [borderLeft, setBorderLeft] = createSignal(false);
32494
- const [borderStart, setBorderStart] = createSignal(false);
32495
- const [borderEnd, setBorderEnd] = createSignal(false);
32496
- const [borderTlBr, setBorderTlBr] = createSignal(false);
32497
- const [borderTrBl, setBorderTrBl] = createSignal(false);
32498
- const [shading, setShading] = createSignal("");
32499
- const [altTitle, setAltTitle] = createSignal("");
32500
- const [altDescription, setAltDescription] = createSignal("");
32501
- createEffect(() => {
32502
- if (!props.isOpen) return;
32503
- setActiveTab(props.initial.activeTab ?? "table");
32504
- setTableWidth(props.initial.tableWidth);
32505
- setTableWidthUnit(props.initial.tableWidthUnit);
32506
- setTableAlign(props.initial.tableAlign);
32507
- setTableIndentLeft(props.initial.tableIndentLeft);
32508
- setTableWrapping(props.initial.tableWrapping);
32509
- setFloatingHorizontalAnchor(props.initial.floatingHorizontalAnchor);
32510
- setFloatingVerticalAnchor(props.initial.floatingVerticalAnchor);
32511
- setFloatingX(props.initial.floatingX);
32512
- setFloatingY(props.initial.floatingY);
32513
- setFloatingXAlign(props.initial.floatingXAlign);
32514
- setFloatingYAlign(props.initial.floatingYAlign);
32515
- setFloatingDistanceTop(props.initial.floatingDistanceTop);
32516
- setFloatingDistanceRight(props.initial.floatingDistanceRight);
32517
- setFloatingDistanceBottom(props.initial.floatingDistanceBottom);
32518
- setFloatingDistanceLeft(props.initial.floatingDistanceLeft);
32519
- setFloatingOverlap(props.initial.floatingOverlap);
32520
- setRowHeight(props.initial.rowHeight);
32521
- setRowHeightRule(props.initial.rowHeightRule);
32522
- setRepeatHeader(props.initial.repeatHeader);
32523
- setAllowBreakAcrossPages(props.initial.allowBreakAcrossPages);
32524
- setHiddenRow(props.initial.hiddenRow);
32525
- setColumnWidth(props.initial.columnWidth);
32526
- setCellWidth(props.initial.cellWidth);
32527
- setCellVerticalAlign(props.initial.cellVerticalAlign);
32528
- setCellTextDirection(props.initial.cellTextDirection);
32529
- setCellNoWrap(props.initial.cellNoWrap);
32530
- setCellFitText(props.initial.cellFitText);
32531
- setCellHideMark(props.initial.cellHideMark);
32532
- setMarginTop(props.initial.marginTop);
32533
- setMarginRight(props.initial.marginRight);
32534
- setMarginBottom(props.initial.marginBottom);
32535
- setMarginLeft(props.initial.marginLeft);
32536
- setBorderStyle(props.initial.borderStyle);
32537
- setBorderWidth(props.initial.borderWidth);
32538
- setBorderColor(props.initial.borderColor);
32539
- setBorderTop(props.initial.borderTop);
32540
- setBorderRight(props.initial.borderRight);
32541
- setBorderBottom(props.initial.borderBottom);
32542
- setBorderLeft(props.initial.borderLeft);
32543
- setBorderStart(props.initial.borderStart);
32544
- setBorderEnd(props.initial.borderEnd);
32545
- setBorderTlBr(props.initial.borderTopLeftToBottomRight);
32546
- setBorderTrBl(props.initial.borderTopRightToBottomLeft);
32547
- setShading(props.initial.shading);
32548
- setAltTitle(props.initial.altTitle);
32549
- setAltDescription(props.initial.altDescription);
32550
- });
32551
32584
  const borderPreview = createMemo(() => {
32552
- const border = resolveBorder(borderStyle(), borderWidth(), borderColor());
32585
+ const border = resolveBorder(p.form.borderStyle, p.form.borderWidth, p.form.borderColor);
32553
32586
  const css = border ? `${border.width}pt ${border.type} ${border.color}` : void 0;
32554
32587
  return {
32555
- "background-color": shading().trim() || void 0,
32556
- "border-top": css && borderTop() ? css : "1px solid #dadce0",
32557
- "border-right": css && borderRight() ? css : "1px solid #dadce0",
32558
- "border-bottom": css && borderBottom() ? css : "1px solid #dadce0",
32559
- "border-left": css && borderLeft() ? css : "1px solid #dadce0"
32588
+ "background-color": p.form.shading.trim() || void 0,
32589
+ "border-top": css && p.form.borderTop ? css : "1px solid #dadce0",
32590
+ "border-right": css && p.form.borderRight ? css : "1px solid #dadce0",
32591
+ "border-bottom": css && p.form.borderBottom ? css : "1px solid #dadce0",
32592
+ "border-left": css && p.form.borderLeft ? css : "1px solid #dadce0"
32560
32593
  };
32561
32594
  });
32595
+ return (() => {
32596
+ var _el$58 = _tmpl$1(), _el$59 = _el$58.firstChild, _el$60 = _el$59.firstChild, _el$61 = _el$60.firstChild, _el$62 = _el$61.nextSibling, _el$63 = _el$62.firstChild, _el$64 = _el$63.nextSibling, _el$65 = _el$64.nextSibling, _el$66 = _el$65.nextSibling, _el$67 = _el$60.nextSibling, _el$68 = _el$67.firstChild, _el$69 = _el$68.nextSibling, _el$70 = _el$69.firstChild, _el$71 = _el$59.nextSibling, _el$72 = _el$71.firstChild, _el$73 = _el$72.nextSibling, _el$74 = _el$71.nextSibling, _el$75 = _el$74.firstChild, _el$76 = _el$75.nextSibling, _el$77 = _el$74.nextSibling, _el$78 = _el$77.firstChild, _el$79 = _el$78.nextSibling, _el$80 = _el$79.firstChild, _el$81 = _el$80.firstChild, _el$82 = _el$81.nextSibling, _el$83 = _el$82.firstChild, _el$84 = _el$83.nextSibling, _el$85 = _el$84.nextSibling, _el$86 = _el$85.nextSibling, _el$87 = _el$80.nextSibling, _el$88 = _el$87.firstChild, _el$89 = _el$88.nextSibling, _el$90 = _el$87.nextSibling, _el$91 = _el$90.firstChild, _el$92 = _el$91.nextSibling, _el$93 = _el$79.nextSibling, _el$94 = _el$93.nextSibling;
32597
+ insert(_el$59, () => numericInput(t("table.cellWidth"), () => p.form.cellWidth, (v) => p.set("cellWidth", v), "editor-table-properties-cell-width"), _el$60);
32598
+ insert(_el$61, () => t("table.verticalAlignment"));
32599
+ _el$62.addEventListener("change", (e) => p.set("cellVerticalAlign", e.currentTarget.value));
32600
+ insert(_el$63, () => t("table.inherit"));
32601
+ insert(_el$64, () => t("table.valignTop"));
32602
+ insert(_el$65, () => t("table.valignMiddle"));
32603
+ insert(_el$66, () => t("table.valignBottom"));
32604
+ insert(_el$68, () => t("table.textDirection"));
32605
+ _el$69.addEventListener("change", (e) => p.set("cellTextDirection", e.currentTarget.value));
32606
+ insert(_el$70, () => t("table.inherit"));
32607
+ insert(_el$72, () => t("table.options"));
32608
+ insert(_el$73, () => checkbox(t("table.noWrap"), () => p.form.cellNoWrap, (v) => p.set("cellNoWrap", v), "editor-table-properties-cell-nowrap"), null);
32609
+ insert(_el$73, () => checkbox(t("table.fitText"), () => p.form.cellFitText, (v) => p.set("cellFitText", v), "editor-table-properties-cell-fit-text"), null);
32610
+ insert(_el$73, () => checkbox(t("table.hideMark"), () => p.form.cellHideMark, (v) => p.set("cellHideMark", v), "editor-table-properties-cell-hide-mark"), null);
32611
+ insert(_el$75, () => t("table.cellMargins"));
32612
+ insert(_el$76, () => numericInput(t("paragraph.borderSideTop"), () => p.form.marginTop, (v) => p.set("marginTop", v), "editor-table-properties-margin-top"), null);
32613
+ insert(_el$76, () => numericInput(t("paragraph.borderSideRight"), () => p.form.marginRight, (v) => p.set("marginRight", v), "editor-table-properties-margin-right"), null);
32614
+ insert(_el$76, () => numericInput(t("paragraph.borderSideBottom"), () => p.form.marginBottom, (v) => p.set("marginBottom", v), "editor-table-properties-margin-bottom"), null);
32615
+ insert(_el$76, () => numericInput(t("paragraph.borderSideLeft"), () => p.form.marginLeft, (v) => p.set("marginLeft", v), "editor-table-properties-margin-left"), null);
32616
+ insert(_el$78, () => t("paragraph.bordersSection"));
32617
+ insert(_el$81, () => t("paragraph.borderStyleLabel"));
32618
+ _el$82.addEventListener("change", (e) => {
32619
+ const next = e.currentTarget.value;
32620
+ p.set("borderStyle", next);
32621
+ if (next === "none") {
32622
+ p.set("borderTop", false);
32623
+ p.set("borderRight", false);
32624
+ p.set("borderBottom", false);
32625
+ p.set("borderLeft", false);
32626
+ p.set("borderStart", false);
32627
+ p.set("borderEnd", false);
32628
+ p.set("borderTlBr", false);
32629
+ p.set("borderTrBl", false);
32630
+ } else if (!p.form.borderTop && !p.form.borderRight && !p.form.borderBottom && !p.form.borderLeft) {
32631
+ p.set("borderTop", true);
32632
+ p.set("borderRight", true);
32633
+ p.set("borderBottom", true);
32634
+ p.set("borderLeft", true);
32635
+ }
32636
+ });
32637
+ insert(_el$83, () => t("paragraph.borderNone"));
32638
+ insert(_el$84, () => t("paragraph.borderSolid"));
32639
+ insert(_el$85, () => t("paragraph.borderDashed"));
32640
+ insert(_el$86, () => t("paragraph.borderDotted"));
32641
+ insert(_el$79, () => numericInput(t("paragraph.borderWidthLabel"), () => p.form.borderWidth, (v) => p.set("borderWidth", v), "editor-table-properties-border-width", p.form.borderStyle === "none"), _el$87);
32642
+ insert(_el$88, () => t("paragraph.borderColorLabel"));
32643
+ _el$89.$$input = (e) => p.set("borderColor", e.currentTarget.value);
32644
+ insert(_el$91, () => t("paragraph.shadingLabel"));
32645
+ _el$92.$$input = (e) => p.set("shading", e.currentTarget.value);
32646
+ insert(_el$93, () => checkbox(t("paragraph.borderSideTop"), () => p.form.borderTop, (v) => p.set("borderTop", v), "editor-table-properties-border-top", p.form.borderStyle === "none"), null);
32647
+ insert(_el$93, () => checkbox(t("paragraph.borderSideRight"), () => p.form.borderRight, (v) => p.set("borderRight", v), "editor-table-properties-border-right", p.form.borderStyle === "none"), null);
32648
+ insert(_el$93, () => checkbox(t("paragraph.borderSideBottom"), () => p.form.borderBottom, (v) => p.set("borderBottom", v), "editor-table-properties-border-bottom", p.form.borderStyle === "none"), null);
32649
+ insert(_el$93, () => checkbox(t("paragraph.borderSideLeft"), () => p.form.borderLeft, (v) => p.set("borderLeft", v), "editor-table-properties-border-left", p.form.borderStyle === "none"), null);
32650
+ insert(_el$93, () => checkbox(t("table.borderStart"), () => p.form.borderStart, (v) => p.set("borderStart", v), "editor-table-properties-border-start", p.form.borderStyle === "none"), null);
32651
+ insert(_el$93, () => checkbox(t("table.borderEnd"), () => p.form.borderEnd, (v) => p.set("borderEnd", v), "editor-table-properties-border-end", p.form.borderStyle === "none"), null);
32652
+ insert(_el$93, () => checkbox(t("table.borderTlBr"), () => p.form.borderTlBr, (v) => p.set("borderTlBr", v), "editor-table-properties-border-tlbr", p.form.borderStyle === "none"), null);
32653
+ insert(_el$93, () => checkbox(t("table.borderTrBl"), () => p.form.borderTrBl, (v) => p.set("borderTrBl", v), "editor-table-properties-border-trbl", p.form.borderStyle === "none"), null);
32654
+ createRenderEffect((_p$) => {
32655
+ var _v$ = p.form.borderStyle === "none", _v$2 = borderPreview();
32656
+ _v$ !== _p$.e && (_el$89.disabled = _p$.e = _v$);
32657
+ _p$.t = style(_el$94, _v$2, _p$.t);
32658
+ return _p$;
32659
+ }, {
32660
+ e: void 0,
32661
+ t: void 0
32662
+ });
32663
+ createRenderEffect(() => _el$62.value = p.form.cellVerticalAlign);
32664
+ createRenderEffect(() => _el$69.value = p.form.cellTextDirection);
32665
+ createRenderEffect(() => _el$82.value = p.form.borderStyle);
32666
+ createRenderEffect(() => _el$89.value = p.form.borderColor || DEFAULT_BORDER_COLOR);
32667
+ createRenderEffect(() => _el$92.value = p.form.shading || "#ffffff");
32668
+ return _el$58;
32669
+ })();
32670
+ }
32671
+ function AltTextTabPanel(p) {
32672
+ const t = useI18n();
32673
+ return (() => {
32674
+ var _el$95 = _tmpl$10(), _el$96 = _el$95.firstChild, _el$97 = _el$96.firstChild, _el$98 = _el$97.nextSibling, _el$99 = _el$96.nextSibling, _el$100 = _el$99.firstChild, _el$101 = _el$100.nextSibling;
32675
+ insert(_el$97, () => t("table.altTitle"));
32676
+ _el$98.$$input = (e) => p.set("altTitle", e.currentTarget.value);
32677
+ insert(_el$100, () => t("table.altDescription"));
32678
+ _el$101.$$input = (e) => p.set("altDescription", e.currentTarget.value);
32679
+ createRenderEffect(() => _el$98.value = p.form.altTitle);
32680
+ createRenderEffect(() => _el$101.value = p.form.altDescription);
32681
+ return _el$95;
32682
+ })();
32683
+ }
32684
+ function TablePropertiesDialog(props) {
32685
+ const t = useI18n();
32686
+ const [form, setForm] = createStore({
32687
+ activeTab: "table",
32688
+ tableWidth: "",
32689
+ tableWidthUnit: "points",
32690
+ tableAlign: "",
32691
+ tableIndentLeft: "",
32692
+ tableWrapping: "none",
32693
+ floatingHorizontalAnchor: "margin",
32694
+ floatingVerticalAnchor: "text",
32695
+ floatingX: "",
32696
+ floatingY: "",
32697
+ floatingXAlign: "",
32698
+ floatingYAlign: "",
32699
+ floatingDistanceTop: "",
32700
+ floatingDistanceRight: "",
32701
+ floatingDistanceBottom: "",
32702
+ floatingDistanceLeft: "",
32703
+ floatingOverlap: "overlap",
32704
+ rowHeight: "",
32705
+ rowHeightRule: "",
32706
+ repeatHeader: false,
32707
+ allowBreakAcrossPages: true,
32708
+ hiddenRow: false,
32709
+ columnWidth: "",
32710
+ cellWidth: "",
32711
+ cellVerticalAlign: "",
32712
+ cellTextDirection: "",
32713
+ cellNoWrap: false,
32714
+ cellFitText: false,
32715
+ cellHideMark: false,
32716
+ marginTop: "",
32717
+ marginRight: "",
32718
+ marginBottom: "",
32719
+ marginLeft: "",
32720
+ borderStyle: "none",
32721
+ borderWidth: "",
32722
+ borderColor: "",
32723
+ borderTop: false,
32724
+ borderRight: false,
32725
+ borderBottom: false,
32726
+ borderLeft: false,
32727
+ borderStart: false,
32728
+ borderEnd: false,
32729
+ borderTlBr: false,
32730
+ borderTrBl: false,
32731
+ shading: "",
32732
+ altTitle: "",
32733
+ altDescription: ""
32734
+ });
32735
+ createEffect(() => {
32736
+ if (!props.isOpen) return;
32737
+ setForm(reconcile({
32738
+ activeTab: props.initial.activeTab ?? "table",
32739
+ tableWidth: props.initial.tableWidth,
32740
+ tableWidthUnit: props.initial.tableWidthUnit,
32741
+ tableAlign: props.initial.tableAlign,
32742
+ tableIndentLeft: props.initial.tableIndentLeft,
32743
+ tableWrapping: props.initial.tableWrapping,
32744
+ floatingHorizontalAnchor: props.initial.floatingHorizontalAnchor,
32745
+ floatingVerticalAnchor: props.initial.floatingVerticalAnchor,
32746
+ floatingX: props.initial.floatingX,
32747
+ floatingY: props.initial.floatingY,
32748
+ floatingXAlign: props.initial.floatingXAlign,
32749
+ floatingYAlign: props.initial.floatingYAlign,
32750
+ floatingDistanceTop: props.initial.floatingDistanceTop,
32751
+ floatingDistanceRight: props.initial.floatingDistanceRight,
32752
+ floatingDistanceBottom: props.initial.floatingDistanceBottom,
32753
+ floatingDistanceLeft: props.initial.floatingDistanceLeft,
32754
+ floatingOverlap: props.initial.floatingOverlap,
32755
+ rowHeight: props.initial.rowHeight,
32756
+ rowHeightRule: props.initial.rowHeightRule,
32757
+ repeatHeader: props.initial.repeatHeader,
32758
+ allowBreakAcrossPages: props.initial.allowBreakAcrossPages,
32759
+ hiddenRow: props.initial.hiddenRow,
32760
+ columnWidth: props.initial.columnWidth,
32761
+ cellWidth: props.initial.cellWidth,
32762
+ cellVerticalAlign: props.initial.cellVerticalAlign,
32763
+ cellTextDirection: props.initial.cellTextDirection,
32764
+ cellNoWrap: props.initial.cellNoWrap,
32765
+ cellFitText: props.initial.cellFitText,
32766
+ cellHideMark: props.initial.cellHideMark,
32767
+ marginTop: props.initial.marginTop,
32768
+ marginRight: props.initial.marginRight,
32769
+ marginBottom: props.initial.marginBottom,
32770
+ marginLeft: props.initial.marginLeft,
32771
+ borderStyle: props.initial.borderStyle,
32772
+ borderWidth: props.initial.borderWidth,
32773
+ borderColor: props.initial.borderColor,
32774
+ borderTop: props.initial.borderTop,
32775
+ borderRight: props.initial.borderRight,
32776
+ borderBottom: props.initial.borderBottom,
32777
+ borderLeft: props.initial.borderLeft,
32778
+ borderStart: props.initial.borderStart,
32779
+ borderEnd: props.initial.borderEnd,
32780
+ borderTlBr: props.initial.borderTopLeftToBottomRight,
32781
+ borderTrBl: props.initial.borderTopRightToBottomLeft,
32782
+ shading: props.initial.shading,
32783
+ altTitle: props.initial.altTitle,
32784
+ altDescription: props.initial.altDescription
32785
+ }));
32786
+ });
32562
32787
  const handleApply = () => {
32563
- const border = resolveBorder(borderStyle(), borderWidth(), borderColor());
32788
+ const border = resolveBorder(form.borderStyle, form.borderWidth, form.borderColor);
32564
32789
  props.onApply({
32565
- tableWidth: parseWidth(tableWidth(), tableWidthUnit()),
32566
- tableAlign: tableAlign() || null,
32567
- tableIndentLeft: parseWidth(tableIndentLeft(), "points"),
32568
- tableFloating: tableWrapping() === "around" ? {
32569
- horizontalAnchor: floatingHorizontalAnchor(),
32570
- verticalAnchor: floatingVerticalAnchor(),
32571
- ...floatingXAlign() ? {
32572
- xAlign: floatingXAlign()
32790
+ tableWidth: parseWidth(form.tableWidth, form.tableWidthUnit),
32791
+ tableAlign: form.tableAlign || null,
32792
+ tableIndentLeft: parseWidth(form.tableIndentLeft, "points"),
32793
+ tableFloating: form.tableWrapping === "around" ? {
32794
+ horizontalAnchor: form.floatingHorizontalAnchor,
32795
+ verticalAnchor: form.floatingVerticalAnchor,
32796
+ ...form.floatingXAlign ? {
32797
+ xAlign: form.floatingXAlign
32573
32798
  } : {
32574
- x: parseNumber(floatingX()) ?? 0
32799
+ x: parseNumber(form.floatingX) ?? 0
32575
32800
  },
32576
- ...floatingYAlign() ? {
32577
- yAlign: floatingYAlign()
32801
+ ...form.floatingYAlign ? {
32802
+ yAlign: form.floatingYAlign
32578
32803
  } : {
32579
- y: parseNumber(floatingY()) ?? 0
32804
+ y: parseNumber(form.floatingY) ?? 0
32580
32805
  },
32581
- distanceTop: parseNumber(floatingDistanceTop()) ?? 0,
32582
- distanceRight: parseNumber(floatingDistanceRight()) ?? 0,
32583
- distanceBottom: parseNumber(floatingDistanceBottom()) ?? 0,
32584
- distanceLeft: parseNumber(floatingDistanceLeft()) ?? 0
32806
+ distanceTop: parseNumber(form.floatingDistanceTop) ?? 0,
32807
+ distanceRight: parseNumber(form.floatingDistanceRight) ?? 0,
32808
+ distanceBottom: parseNumber(form.floatingDistanceBottom) ?? 0,
32809
+ distanceLeft: parseNumber(form.floatingDistanceLeft) ?? 0
32585
32810
  } : null,
32586
- tableOverlap: tableWrapping() === "around" ? floatingOverlap() : null,
32587
- rowHeight: parseWidth(rowHeight(), "points"),
32588
- rowHeightRule: rowHeightRule() || null,
32589
- repeatHeader: repeatHeader(),
32590
- cantSplit: !allowBreakAcrossPages(),
32591
- hiddenRow: hiddenRow(),
32592
- columnWidth: parseWidth(columnWidth(), "points"),
32593
- cellWidth: parseWidth(cellWidth(), "points"),
32594
- cellVerticalAlign: cellVerticalAlign() || null,
32595
- cellTextDirection: cellTextDirection() || null,
32596
- cellNoWrap: cellNoWrap(),
32597
- cellFitText: cellFitText(),
32598
- cellHideMark: cellHideMark(),
32811
+ tableOverlap: form.tableWrapping === "around" ? form.floatingOverlap : null,
32812
+ rowHeight: parseWidth(form.rowHeight, "points"),
32813
+ rowHeightRule: form.rowHeightRule || null,
32814
+ repeatHeader: form.repeatHeader,
32815
+ cantSplit: !form.allowBreakAcrossPages,
32816
+ hiddenRow: form.hiddenRow,
32817
+ columnWidth: parseWidth(form.columnWidth, "points"),
32818
+ cellWidth: parseWidth(form.cellWidth, "points"),
32819
+ cellVerticalAlign: form.cellVerticalAlign || null,
32820
+ cellTextDirection: form.cellTextDirection || null,
32821
+ cellNoWrap: form.cellNoWrap,
32822
+ cellFitText: form.cellFitText,
32823
+ cellHideMark: form.cellHideMark,
32599
32824
  margins: {
32600
- top: parseNumber(marginTop()),
32601
- right: parseNumber(marginRight()),
32602
- bottom: parseNumber(marginBottom()),
32603
- left: parseNumber(marginLeft())
32825
+ top: parseNumber(form.marginTop),
32826
+ right: parseNumber(form.marginRight),
32827
+ bottom: parseNumber(form.marginBottom),
32828
+ left: parseNumber(form.marginLeft)
32604
32829
  },
32605
32830
  borders: {
32606
- top: borderTop() ? border : null,
32607
- right: borderRight() ? border : null,
32608
- bottom: borderBottom() ? border : null,
32609
- left: borderLeft() ? border : null,
32610
- start: borderStart() ? border : null,
32611
- end: borderEnd() ? border : null,
32612
- topLeftToBottomRight: borderTlBr() ? border : null,
32613
- topRightToBottomLeft: borderTrBl() ? border : null
32831
+ top: form.borderTop ? border : null,
32832
+ right: form.borderRight ? border : null,
32833
+ bottom: form.borderBottom ? border : null,
32834
+ left: form.borderLeft ? border : null,
32835
+ start: form.borderStart ? border : null,
32836
+ end: form.borderEnd ? border : null,
32837
+ topLeftToBottomRight: form.borderTlBr ? border : null,
32838
+ topRightToBottomLeft: form.borderTrBl ? border : null
32614
32839
  },
32615
- shading: shading().trim() || null,
32616
- altTitle: altTitle().trim() || null,
32617
- altDescription: altDescription().trim() || null
32840
+ shading: form.shading.trim() || null,
32841
+ altTitle: form.altTitle.trim() || null,
32842
+ altDescription: form.altDescription.trim() || null
32618
32843
  }, props.initial);
32619
32844
  props.onClose();
32620
32845
  };
32621
- const numericInput = (label, value, setter, testId, disabled = false, allowNegative = false) => (() => {
32622
- var _el$ = _tmpl$$5(), _el$2 = _el$.firstChild, _el$3 = _el$2.nextSibling;
32623
- insert(_el$2, label);
32624
- _el$3.$$input = (e) => setter(e.currentTarget.value);
32625
- setAttribute(_el$3, "min", allowNegative ? void 0 : "0");
32626
- _el$3.disabled = disabled;
32627
- setAttribute(_el$3, "data-testid", testId);
32628
- createRenderEffect(() => _el$3.value = value());
32629
- return _el$;
32630
- })();
32631
- const checkbox = (label, checked, setter, testId, disabled = false) => (() => {
32632
- var _el$4 = _tmpl$2$1(), _el$5 = _el$4.firstChild;
32633
- _el$5.addEventListener("change", (e) => setter(e.currentTarget.checked));
32634
- _el$5.disabled = disabled;
32635
- setAttribute(_el$5, "data-testid", testId);
32636
- insert(_el$4, label, null);
32637
- createRenderEffect(() => _el$5.checked = checked());
32638
- return _el$4;
32639
- })();
32640
32846
  return createComponent(Dialog, {
32641
32847
  get isOpen() {
32642
32848
  return props.isOpen;
@@ -32669,9 +32875,9 @@ function TablePropertiesDialog(props) {
32669
32875
  get children() {
32670
32876
  return createComponent(Tabs, {
32671
32877
  get value() {
32672
- return activeTab();
32878
+ return form.activeTab;
32673
32879
  },
32674
- onChange: setActiveTab,
32880
+ onChange: (tab) => setForm("activeTab", tab),
32675
32881
  get ariaLabel() {
32676
32882
  return t("table.propertiesTitle");
32677
32883
  },
@@ -32681,205 +32887,42 @@ function TablePropertiesDialog(props) {
32681
32887
  id: "table",
32682
32888
  label: t("table.tabTable"),
32683
32889
  testId: "editor-table-properties-tab-table",
32684
- panel: (() => {
32685
- var _el$6 = _tmpl$6$1(), _el$7 = _el$6.firstChild, _el$8 = _el$7.firstChild, _el$9 = _el$8.nextSibling, _el$0 = _el$9.firstChild, _el$1 = _el$0.firstChild, _el$10 = _el$1.nextSibling, _el$11 = _el$10.firstChild, _el$12 = _el$11.nextSibling, _el$13 = _el$7.nextSibling, _el$14 = _el$13.firstChild, _el$15 = _el$14.nextSibling, _el$16 = _el$15.nextSibling, _el$17 = _el$13.nextSibling, _el$18 = _el$17.firstChild, _el$19 = _el$18.nextSibling;
32686
- insert(_el$8, () => t("table.sizeSection"));
32687
- insert(_el$9, () => numericInput(t("table.preferredWidth"), tableWidth, setTableWidth, "editor-table-properties-table-width"), _el$0);
32688
- insert(_el$1, () => t("table.measureIn"));
32689
- _el$10.addEventListener("change", (e) => setTableWidthUnit(e.currentTarget.value));
32690
- insert(_el$11, () => t("table.points"));
32691
- insert(_el$12, () => t("table.percent"));
32692
- insert(_el$14, () => t("table.alignmentSection"));
32693
- insert(_el$15, () => ["left", "center", "right"].map((align) => (() => {
32694
- var _el$43 = _tmpl$7(), _el$44 = _el$43.firstChild;
32695
- _el$44.addEventListener("change", () => setTableAlign(align));
32696
- setAttribute(_el$44, "data-testid", `editor-table-properties-align-${align}`);
32697
- insert(_el$43, () => t(`table.align${align[0].toUpperCase()}${align.slice(1)}`), null);
32698
- createRenderEffect(() => _el$44.checked = tableAlign() === align);
32699
- return _el$43;
32700
- })()));
32701
- insert(_el$16, () => numericInput(t("table.indentFromLeft"), tableIndentLeft, setTableIndentLeft, "editor-table-properties-indent-left"));
32702
- insert(_el$18, () => t("table.textWrappingSection"));
32703
- insert(_el$19, () => checkbox(t("table.wrapNone"), () => tableWrapping() === "none", () => setTableWrapping("none"), "editor-table-properties-wrap-none"), null);
32704
- insert(_el$19, () => checkbox(t("table.wrapAround"), () => tableWrapping() === "around", () => setTableWrapping("around"), "editor-table-properties-wrap-around"), null);
32705
- insert(_el$17, createComponent(Show, {
32706
- get when() {
32707
- return tableWrapping() === "around";
32708
- },
32709
- get children() {
32710
- return [(() => {
32711
- var _el$20 = _tmpl$3$1(), _el$21 = _el$20.firstChild, _el$22 = _el$21.firstChild, _el$23 = _el$22.nextSibling, _el$24 = _el$23.firstChild, _el$25 = _el$24.nextSibling, _el$26 = _el$25.nextSibling, _el$27 = _el$21.nextSibling, _el$28 = _el$27.firstChild, _el$29 = _el$28.nextSibling, _el$30 = _el$29.firstChild, _el$31 = _el$30.nextSibling, _el$32 = _el$31.nextSibling;
32712
- insert(_el$22, () => t("table.horizontalAnchor"));
32713
- _el$23.addEventListener("change", (e) => setFloatingHorizontalAnchor(e.currentTarget.value));
32714
- insert(_el$24, () => t("table.anchorMargin"));
32715
- insert(_el$25, () => t("table.anchorPage"));
32716
- insert(_el$26, () => t("table.anchorText"));
32717
- insert(_el$28, () => t("table.verticalAnchor"));
32718
- _el$29.addEventListener("change", (e) => setFloatingVerticalAnchor(e.currentTarget.value));
32719
- insert(_el$30, () => t("table.anchorMargin"));
32720
- insert(_el$31, () => t("table.anchorPage"));
32721
- insert(_el$32, () => t("table.anchorText"));
32722
- createRenderEffect(() => _el$23.value = floatingHorizontalAnchor());
32723
- createRenderEffect(() => _el$29.value = floatingVerticalAnchor());
32724
- return _el$20;
32725
- })(), (() => {
32726
- var _el$33 = _tmpl$4$1(), _el$34 = _el$33.firstChild, _el$35 = _el$34.firstChild, _el$36 = _el$35.nextSibling, _el$37 = _el$36.firstChild, _el$38 = _el$34.nextSibling, _el$39 = _el$38.firstChild, _el$40 = _el$39.nextSibling, _el$41 = _el$40.firstChild;
32727
- insert(_el$33, () => numericInput(t("table.positionX"), floatingX, setFloatingX, "editor-table-properties-floating-x", Boolean(floatingXAlign()), true), _el$34);
32728
- insert(_el$33, () => numericInput(t("table.positionY"), floatingY, setFloatingY, "editor-table-properties-floating-y", Boolean(floatingYAlign()), true), _el$34);
32729
- insert(_el$35, () => t("table.horizontalAlignment"));
32730
- _el$36.addEventListener("change", (e) => setFloatingXAlign(e.currentTarget.value));
32731
- insert(_el$37, () => t("table.explicitOffset"));
32732
- insert(_el$36, () => ["left", "center", "right", "inside", "outside"].map((value) => (() => {
32733
- var _el$45 = _tmpl$8();
32734
- _el$45.value = value;
32735
- insert(_el$45, value);
32736
- return _el$45;
32737
- })()), null);
32738
- insert(_el$39, () => t("table.verticalAlignment"));
32739
- _el$40.addEventListener("change", (e) => setFloatingYAlign(e.currentTarget.value));
32740
- insert(_el$41, () => t("table.explicitOffset"));
32741
- insert(_el$40, () => ["top", "center", "bottom", "inside", "outside"].map((value) => (() => {
32742
- var _el$46 = _tmpl$8();
32743
- _el$46.value = value;
32744
- insert(_el$46, value);
32745
- return _el$46;
32746
- })()), null);
32747
- createRenderEffect(() => _el$36.value = floatingXAlign());
32748
- createRenderEffect(() => _el$40.value = floatingYAlign());
32749
- return _el$33;
32750
- })(), (() => {
32751
- var _el$42 = _tmpl$5$1();
32752
- insert(_el$42, () => numericInput(t("table.distanceTop"), floatingDistanceTop, setFloatingDistanceTop, "editor-table-properties-floating-distance-top"), null);
32753
- insert(_el$42, () => numericInput(t("table.distanceRight"), floatingDistanceRight, setFloatingDistanceRight, "editor-table-properties-floating-distance-right"), null);
32754
- insert(_el$42, () => numericInput(t("table.distanceBottom"), floatingDistanceBottom, setFloatingDistanceBottom, "editor-table-properties-floating-distance-bottom"), null);
32755
- insert(_el$42, () => numericInput(t("table.distanceLeft"), floatingDistanceLeft, setFloatingDistanceLeft, "editor-table-properties-floating-distance-left"), null);
32756
- return _el$42;
32757
- })(), memo(() => checkbox(t("table.allowOverlap"), () => floatingOverlap() === "overlap", (value) => setFloatingOverlap(value ? "overlap" : "never"), "editor-table-properties-floating-overlap"))];
32758
- }
32759
- }), null);
32760
- createRenderEffect(() => _el$10.value = tableWidthUnit());
32761
- return _el$6;
32762
- })()
32890
+ panel: createComponent(TableTabPanel, {
32891
+ form,
32892
+ set: setForm
32893
+ })
32763
32894
  }, {
32764
32895
  id: "row",
32765
32896
  label: t("table.tabRow"),
32766
32897
  testId: "editor-table-properties-tab-row",
32767
- panel: (() => {
32768
- var _el$47 = _tmpl$9(), _el$48 = _el$47.firstChild, _el$49 = _el$48.firstChild, _el$50 = _el$49.firstChild, _el$51 = _el$50.nextSibling, _el$52 = _el$51.firstChild, _el$53 = _el$52.nextSibling, _el$54 = _el$53.nextSibling, _el$55 = _el$48.nextSibling;
32769
- insert(_el$48, () => numericInput(t("table.rowHeight"), rowHeight, setRowHeight, "editor-table-properties-row-height"), _el$49);
32770
- insert(_el$50, () => t("table.rowHeightRule"));
32771
- _el$51.addEventListener("change", (e) => setRowHeightRule(e.currentTarget.value));
32772
- insert(_el$52, () => t("table.rowAuto"));
32773
- insert(_el$53, () => t("table.rowAtLeast"));
32774
- insert(_el$54, () => t("table.rowExactly"));
32775
- insert(_el$55, () => checkbox(t("table.repeatHeader"), repeatHeader, setRepeatHeader, "editor-table-properties-repeat-header"), null);
32776
- insert(_el$55, () => checkbox(t("table.allowBreakAcrossPages"), allowBreakAcrossPages, setAllowBreakAcrossPages, "editor-table-properties-allow-break"), null);
32777
- insert(_el$55, () => checkbox(t("table.hiddenRow"), hiddenRow, setHiddenRow, "editor-table-properties-hidden-row"), null);
32778
- createRenderEffect(() => _el$51.value = rowHeightRule());
32779
- return _el$47;
32780
- })()
32898
+ panel: createComponent(RowTabPanel, {
32899
+ form,
32900
+ set: setForm
32901
+ })
32781
32902
  }, {
32782
32903
  id: "column",
32783
32904
  label: t("table.tabColumn"),
32784
32905
  testId: "editor-table-properties-tab-column",
32785
- panel: (() => {
32786
- var _el$56 = _tmpl$0(), _el$57 = _el$56.firstChild;
32787
- insert(_el$57, () => numericInput(t("table.columnWidth"), columnWidth, setColumnWidth, "editor-table-properties-column-width"));
32788
- return _el$56;
32789
- })()
32906
+ panel: createComponent(ColumnTabPanel, {
32907
+ form,
32908
+ set: setForm
32909
+ })
32790
32910
  }, {
32791
32911
  id: "cell",
32792
32912
  label: t("table.tabCell"),
32793
32913
  testId: "editor-table-properties-tab-cell",
32794
- panel: (() => {
32795
- var _el$58 = _tmpl$1(), _el$59 = _el$58.firstChild, _el$60 = _el$59.firstChild, _el$61 = _el$60.firstChild, _el$62 = _el$61.nextSibling, _el$63 = _el$62.firstChild, _el$64 = _el$63.nextSibling, _el$65 = _el$64.nextSibling, _el$66 = _el$65.nextSibling, _el$67 = _el$60.nextSibling, _el$68 = _el$67.firstChild, _el$69 = _el$68.nextSibling, _el$70 = _el$69.firstChild, _el$71 = _el$59.nextSibling, _el$72 = _el$71.firstChild, _el$73 = _el$72.nextSibling, _el$74 = _el$71.nextSibling, _el$75 = _el$74.firstChild, _el$76 = _el$75.nextSibling, _el$77 = _el$74.nextSibling, _el$78 = _el$77.firstChild, _el$79 = _el$78.nextSibling, _el$80 = _el$79.firstChild, _el$81 = _el$80.firstChild, _el$82 = _el$81.nextSibling, _el$83 = _el$82.firstChild, _el$84 = _el$83.nextSibling, _el$85 = _el$84.nextSibling, _el$86 = _el$85.nextSibling, _el$87 = _el$80.nextSibling, _el$88 = _el$87.firstChild, _el$89 = _el$88.nextSibling, _el$90 = _el$87.nextSibling, _el$91 = _el$90.firstChild, _el$92 = _el$91.nextSibling, _el$93 = _el$79.nextSibling, _el$94 = _el$93.nextSibling;
32796
- insert(_el$59, () => numericInput(t("table.cellWidth"), cellWidth, setCellWidth, "editor-table-properties-cell-width"), _el$60);
32797
- insert(_el$61, () => t("table.verticalAlignment"));
32798
- _el$62.addEventListener("change", (e) => setCellVerticalAlign(e.currentTarget.value));
32799
- insert(_el$63, () => t("table.inherit"));
32800
- insert(_el$64, () => t("table.valignTop"));
32801
- insert(_el$65, () => t("table.valignMiddle"));
32802
- insert(_el$66, () => t("table.valignBottom"));
32803
- insert(_el$68, () => t("table.textDirection"));
32804
- _el$69.addEventListener("change", (e) => setCellTextDirection(e.currentTarget.value));
32805
- insert(_el$70, () => t("table.inherit"));
32806
- insert(_el$72, () => t("table.options"));
32807
- insert(_el$73, () => checkbox(t("table.noWrap"), cellNoWrap, setCellNoWrap, "editor-table-properties-cell-nowrap"), null);
32808
- insert(_el$73, () => checkbox(t("table.fitText"), cellFitText, setCellFitText, "editor-table-properties-cell-fit-text"), null);
32809
- insert(_el$73, () => checkbox(t("table.hideMark"), cellHideMark, setCellHideMark, "editor-table-properties-cell-hide-mark"), null);
32810
- insert(_el$75, () => t("table.cellMargins"));
32811
- insert(_el$76, () => numericInput(t("paragraph.borderSideTop"), marginTop, setMarginTop, "editor-table-properties-margin-top"), null);
32812
- insert(_el$76, () => numericInput(t("paragraph.borderSideRight"), marginRight, setMarginRight, "editor-table-properties-margin-right"), null);
32813
- insert(_el$76, () => numericInput(t("paragraph.borderSideBottom"), marginBottom, setMarginBottom, "editor-table-properties-margin-bottom"), null);
32814
- insert(_el$76, () => numericInput(t("paragraph.borderSideLeft"), marginLeft, setMarginLeft, "editor-table-properties-margin-left"), null);
32815
- insert(_el$78, () => t("paragraph.bordersSection"));
32816
- insert(_el$81, () => t("paragraph.borderStyleLabel"));
32817
- _el$82.addEventListener("change", (e) => {
32818
- const next = e.currentTarget.value;
32819
- setBorderStyle(next);
32820
- if (next === "none") {
32821
- setBorderTop(false);
32822
- setBorderRight(false);
32823
- setBorderBottom(false);
32824
- setBorderLeft(false);
32825
- setBorderStart(false);
32826
- setBorderEnd(false);
32827
- setBorderTlBr(false);
32828
- setBorderTrBl(false);
32829
- } else if (!borderTop() && !borderRight() && !borderBottom() && !borderLeft()) {
32830
- setBorderTop(true);
32831
- setBorderRight(true);
32832
- setBorderBottom(true);
32833
- setBorderLeft(true);
32834
- }
32835
- });
32836
- insert(_el$83, () => t("paragraph.borderNone"));
32837
- insert(_el$84, () => t("paragraph.borderSolid"));
32838
- insert(_el$85, () => t("paragraph.borderDashed"));
32839
- insert(_el$86, () => t("paragraph.borderDotted"));
32840
- insert(_el$79, () => numericInput(t("paragraph.borderWidthLabel"), borderWidth, setBorderWidth, "editor-table-properties-border-width", borderStyle() === "none"), _el$87);
32841
- insert(_el$88, () => t("paragraph.borderColorLabel"));
32842
- _el$89.$$input = (e) => setBorderColor(e.currentTarget.value);
32843
- insert(_el$91, () => t("paragraph.shadingLabel"));
32844
- _el$92.$$input = (e) => setShading(e.currentTarget.value);
32845
- insert(_el$93, () => checkbox(t("paragraph.borderSideTop"), borderTop, setBorderTop, "editor-table-properties-border-top", borderStyle() === "none"), null);
32846
- insert(_el$93, () => checkbox(t("paragraph.borderSideRight"), borderRight, setBorderRight, "editor-table-properties-border-right", borderStyle() === "none"), null);
32847
- insert(_el$93, () => checkbox(t("paragraph.borderSideBottom"), borderBottom, setBorderBottom, "editor-table-properties-border-bottom", borderStyle() === "none"), null);
32848
- insert(_el$93, () => checkbox(t("paragraph.borderSideLeft"), borderLeft, setBorderLeft, "editor-table-properties-border-left", borderStyle() === "none"), null);
32849
- insert(_el$93, () => checkbox(t("table.borderStart"), borderStart, setBorderStart, "editor-table-properties-border-start", borderStyle() === "none"), null);
32850
- insert(_el$93, () => checkbox(t("table.borderEnd"), borderEnd, setBorderEnd, "editor-table-properties-border-end", borderStyle() === "none"), null);
32851
- insert(_el$93, () => checkbox(t("table.borderTlBr"), borderTlBr, setBorderTlBr, "editor-table-properties-border-tlbr", borderStyle() === "none"), null);
32852
- insert(_el$93, () => checkbox(t("table.borderTrBl"), borderTrBl, setBorderTrBl, "editor-table-properties-border-trbl", borderStyle() === "none"), null);
32853
- createRenderEffect((_p$) => {
32854
- var _v$ = borderStyle() === "none", _v$2 = borderPreview();
32855
- _v$ !== _p$.e && (_el$89.disabled = _p$.e = _v$);
32856
- _p$.t = style(_el$94, _v$2, _p$.t);
32857
- return _p$;
32858
- }, {
32859
- e: void 0,
32860
- t: void 0
32861
- });
32862
- createRenderEffect(() => _el$62.value = cellVerticalAlign());
32863
- createRenderEffect(() => _el$69.value = cellTextDirection());
32864
- createRenderEffect(() => _el$82.value = borderStyle());
32865
- createRenderEffect(() => _el$89.value = borderColor() || DEFAULT_BORDER_COLOR);
32866
- createRenderEffect(() => _el$92.value = shading() || "#ffffff");
32867
- return _el$58;
32868
- })()
32914
+ panel: createComponent(CellTabPanel, {
32915
+ form,
32916
+ set: setForm
32917
+ })
32869
32918
  }, {
32870
32919
  id: "altText",
32871
32920
  label: t("table.tabAltText"),
32872
32921
  testId: "editor-table-properties-tab-alt-text",
32873
- panel: (() => {
32874
- var _el$95 = _tmpl$10(), _el$96 = _el$95.firstChild, _el$97 = _el$96.firstChild, _el$98 = _el$97.nextSibling, _el$99 = _el$96.nextSibling, _el$100 = _el$99.firstChild, _el$101 = _el$100.nextSibling;
32875
- insert(_el$97, () => t("table.altTitle"));
32876
- _el$98.$$input = (e) => setAltTitle(e.currentTarget.value);
32877
- insert(_el$100, () => t("table.altDescription"));
32878
- _el$101.$$input = (e) => setAltDescription(e.currentTarget.value);
32879
- createRenderEffect(() => _el$98.value = altTitle());
32880
- createRenderEffect(() => _el$101.value = altDescription());
32881
- return _el$95;
32882
- })()
32922
+ panel: createComponent(AltTextTabPanel, {
32923
+ form,
32924
+ set: setForm
32925
+ })
32883
32926
  }];
32884
32927
  }
32885
32928
  });
@@ -36187,6 +36230,16 @@ function buildPartContext(blocks, numberingContext, state, document2) {
36187
36230
  hyperlinkMap
36188
36231
  };
36189
36232
  }
36233
+ function writeNotePart(zip, partName, part) {
36234
+ if (!part) return;
36235
+ zip.file(`word/${partName}.xml`, part.xml);
36236
+ if (part.partContext.images.length > 0 || part.partContext.hyperlinks.length > 0) {
36237
+ zip.file(
36238
+ `word/_rels/${partName}.xml.rels`,
36239
+ buildPartRelationshipsXml(part.partContext.images, part.partContext.hyperlinks)
36240
+ );
36241
+ }
36242
+ }
36190
36243
  async function exportEditorDocumentToDocx(document2) {
36191
36244
  var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
36192
36245
  document2 = renumberImageCaptionsInDocument(document2);
@@ -36204,18 +36257,23 @@ async function exportEditorDocumentToDocx(document2) {
36204
36257
  const referencedEndnotes = collectReferencedEndnotesForExport(document2);
36205
36258
  const endnoteIdMap = buildEndnoteIdMap(referencedEndnotes);
36206
36259
  const hasEndnotes = referencedEndnotes.length > 0;
36207
- const bodyContext = buildPartContext(
36208
- sections.flatMap((section) => section.blocks),
36209
- numberingContext,
36210
- buildState,
36211
- document2
36212
- );
36213
- bodyContext.footnoteIdMap = footnoteIdMap;
36214
- bodyContext.endnoteIdMap = endnoteIdMap;
36215
36260
  const bookmarkEvents = buildBookmarkExportPlan(document2);
36216
- bodyContext.bookmarkEventsByParagraph = bookmarkEvents;
36217
36261
  const commentPlan = buildCommentExportPlan(document2);
36218
- bodyContext.commentEventsByParagraph = commentPlan == null ? void 0 : commentPlan.eventsByParagraph;
36262
+ const annotateContext = (ctx) => {
36263
+ ctx.footnoteIdMap = footnoteIdMap;
36264
+ ctx.endnoteIdMap = endnoteIdMap;
36265
+ ctx.bookmarkEventsByParagraph = bookmarkEvents;
36266
+ ctx.commentEventsByParagraph = commentPlan == null ? void 0 : commentPlan.eventsByParagraph;
36267
+ return ctx;
36268
+ };
36269
+ const bodyContext = annotateContext(
36270
+ buildPartContext(
36271
+ sections.flatMap((section) => section.blocks),
36272
+ numberingContext,
36273
+ buildState,
36274
+ document2
36275
+ )
36276
+ );
36219
36277
  const hasComments = commentPlan !== void 0;
36220
36278
  const parts = [];
36221
36279
  const sectionReferences = sections.map(
@@ -36233,16 +36291,9 @@ async function exportEditorDocumentToDocx(document2) {
36233
36291
  const relPrefix = kind === "header" ? "Header" : "Footer";
36234
36292
  const path = `${kind}${partIndex}.xml`;
36235
36293
  const relId = `rId${relPrefix}${partIndex}`;
36236
- const context = buildPartContext(
36237
- blocks,
36238
- numberingContext,
36239
- buildState,
36240
- document2
36294
+ const context = annotateContext(
36295
+ buildPartContext(blocks, numberingContext, buildState, document2)
36241
36296
  );
36242
- context.footnoteIdMap = footnoteIdMap;
36243
- context.endnoteIdMap = endnoteIdMap;
36244
- context.bookmarkEventsByParagraph = bookmarkEvents;
36245
- context.commentEventsByParagraph = commentPlan == null ? void 0 : commentPlan.eventsByParagraph;
36246
36297
  parts.push({
36247
36298
  kind,
36248
36299
  type,
@@ -36391,30 +36442,8 @@ async function exportEditorDocumentToDocx(document2) {
36391
36442
  );
36392
36443
  }
36393
36444
  }
36394
- if (footnotesPart) {
36395
- zip.file("word/footnotes.xml", footnotesPart.xml);
36396
- if (footnotesPart.partContext.images.length > 0 || footnotesPart.partContext.hyperlinks.length > 0) {
36397
- zip.file(
36398
- "word/_rels/footnotes.xml.rels",
36399
- buildPartRelationshipsXml(
36400
- footnotesPart.partContext.images,
36401
- footnotesPart.partContext.hyperlinks
36402
- )
36403
- );
36404
- }
36405
- }
36406
- if (endnotesPart) {
36407
- zip.file("word/endnotes.xml", endnotesPart.xml);
36408
- if (endnotesPart.partContext.images.length > 0 || endnotesPart.partContext.hyperlinks.length > 0) {
36409
- zip.file(
36410
- "word/_rels/endnotes.xml.rels",
36411
- buildPartRelationshipsXml(
36412
- endnotesPart.partContext.images,
36413
- endnotesPart.partContext.hyperlinks
36414
- )
36415
- );
36416
- }
36417
- }
36445
+ writeNotePart(zip, "footnotes", footnotesPart);
36446
+ writeNotePart(zip, "endnotes", endnotesPart);
36418
36447
  if (commentPlan) {
36419
36448
  zip.file("word/comments.xml", buildCommentsPartXml(commentPlan));
36420
36449
  zip.file(
@@ -36854,45 +36883,27 @@ function blendColorWithWhite(hex, alpha) {
36854
36883
  255 + (rgb[2] - 255) * a
36855
36884
  );
36856
36885
  }
36857
- function drawFragmentHighlight(writer, pageIndex, line, fragment, originX, originY, styles) {
36858
- if (!styles.highlight) {
36859
- return;
36860
- }
36861
- const bounds = resolveFragmentBounds(
36862
- line,
36863
- fragment,
36864
- styles.fontSize ?? DEFAULT_FONT_SIZE_PX
36865
- );
36866
- if (!bounds) {
36867
- return;
36868
- }
36869
- writer.drawRect(pageIndex, {
36886
+ function fragmentRectPt(line, fragment, styles, originX, originY, yOffset, heightShrink) {
36887
+ const bounds = resolveFragmentBounds(line, fragment, styles.fontSize ?? DEFAULT_FONT_SIZE_PX);
36888
+ if (!bounds) return null;
36889
+ return {
36870
36890
  x: pxToPt$1(originX + bounds.left),
36871
- y: pxToPt$1(originY + line.top + 2),
36891
+ y: pxToPt$1(originY + line.top + yOffset),
36872
36892
  width: pxToPt$1(Math.max(0, bounds.right - bounds.left)),
36873
- height: pxToPt$1(Math.max(2, line.height - 4)),
36874
- fill: styles.highlight
36875
- });
36893
+ height: pxToPt$1(Math.max(2, line.height - heightShrink))
36894
+ };
36895
+ }
36896
+ function drawFragmentHighlight(writer, pageIndex, line, fragment, originX, originY, styles) {
36897
+ if (!styles.highlight) return;
36898
+ const rect = fragmentRectPt(line, fragment, styles, originX, originY, 2, 4);
36899
+ if (!rect) return;
36900
+ writer.drawRect(pageIndex, { ...rect, fill: styles.highlight });
36876
36901
  }
36877
36902
  function drawFragmentShading(writer, pageIndex, line, fragment, originX, originY, styles) {
36878
- if (!styles.shading) {
36879
- return;
36880
- }
36881
- const bounds = resolveFragmentBounds(
36882
- line,
36883
- fragment,
36884
- styles.fontSize ?? DEFAULT_FONT_SIZE_PX
36885
- );
36886
- if (!bounds) {
36887
- return;
36888
- }
36889
- writer.drawRect(pageIndex, {
36890
- x: pxToPt$1(originX + bounds.left),
36891
- y: pxToPt$1(originY + line.top + 2),
36892
- width: pxToPt$1(Math.max(0, bounds.right - bounds.left)),
36893
- height: pxToPt$1(Math.max(2, line.height - 4)),
36894
- fill: styles.shading
36895
- });
36903
+ if (!styles.shading) return;
36904
+ const rect = fragmentRectPt(line, fragment, styles, originX, originY, 2, 4);
36905
+ if (!rect) return;
36906
+ writer.drawRect(pageIndex, { ...rect, fill: styles.shading });
36896
36907
  }
36897
36908
  function resolveGradientShadingName(writer, pageIndex, line, fragment, originX, originY, styles) {
36898
36909
  const fill = styles.textFill;
@@ -36932,19 +36943,10 @@ function drawFragmentBorder(writer, pageIndex, line, fragment, originX, originY,
36932
36943
  if (!border || border.type === "none" || border.width <= 0) {
36933
36944
  return;
36934
36945
  }
36935
- const bounds = resolveFragmentBounds(
36936
- line,
36937
- fragment,
36938
- styles.fontSize ?? DEFAULT_FONT_SIZE_PX
36939
- );
36940
- if (!bounds) {
36941
- return;
36942
- }
36946
+ const rect = fragmentRectPt(line, fragment, styles, originX, originY, 1, 2);
36947
+ if (!rect) return;
36943
36948
  writer.drawRect(pageIndex, {
36944
- x: pxToPt$1(originX + bounds.left),
36945
- y: pxToPt$1(originY + line.top + 1),
36946
- width: pxToPt$1(Math.max(0, bounds.right - bounds.left)),
36947
- height: pxToPt$1(Math.max(2, line.height - 2)),
36949
+ ...rect,
36948
36950
  stroke: border.color,
36949
36951
  lineWidth: pxToPt$1(Math.max(0.5, border.width * PX_PER_POINT))
36950
36952
  });
@@ -37063,12 +37065,10 @@ function drawUnderlineWithStyle(writer, pageIndex, x1, x2, y, stroke, underlineS
37063
37065
  drawAt(y, underlineStyleDashArray(underlineStyle));
37064
37066
  }
37065
37067
  function drawWavyUnderline(writer, pageIndex, x1, x2, y, stroke, lineWidthPx) {
37066
- const wavelength = 4;
37067
- const amplitude = 1.5;
37068
37068
  let prevX = x1;
37069
37069
  let prevY = y;
37070
37070
  for (let x = x1; x <= x2; x += 1) {
37071
- const dy = Math.sin((x - x1) / wavelength * Math.PI) * amplitude;
37071
+ const dy = Math.sin((x - x1) / WAVY_UNDERLINE_WAVELENGTH_PX * Math.PI) * WAVY_UNDERLINE_AMPLITUDE_PX;
37072
37072
  const curY = y + dy;
37073
37073
  writer.drawLine(pageIndex, {
37074
37074
  x1: pxToPt$1(prevX),
@@ -37180,6 +37180,100 @@ async function drawInlineTextBoxFragment(writer, pageIndex, line, fragment, docu
37180
37180
  drawers
37181
37181
  );
37182
37182
  }
37183
+ function emitTextChunk(ctx, leftPx, text) {
37184
+ const {
37185
+ writer,
37186
+ pageIndex,
37187
+ baselineY,
37188
+ fontSizePt,
37189
+ mainColor,
37190
+ gradientShadingName,
37191
+ styles,
37192
+ baseTextOptions
37193
+ } = ctx;
37194
+ const offsetPt = pxToPt$1(1);
37195
+ if (styles.emboss || styles.imprint) {
37196
+ const dir = styles.imprint ? 1 : -1;
37197
+ writer.drawText(pageIndex, {
37198
+ ...baseTextOptions,
37199
+ x: pxToPt$1(leftPx) + offsetPt * dir,
37200
+ y: pxToPt$1(baselineY) + offsetPt * dir,
37201
+ text,
37202
+ color: "#BFBFBF"
37203
+ });
37204
+ }
37205
+ if (styles.glow) {
37206
+ const gl = styles.glow;
37207
+ const r = pxToPt$1(gl.radiusPt * PX_PER_POINT) * 0.5;
37208
+ const glowColor = blendColorWithWhite(gl.color, (gl.alpha ?? 0.5) * 0.4);
37209
+ const dirs = [
37210
+ [r, 0],
37211
+ [-r, 0],
37212
+ [0, r],
37213
+ [0, -r],
37214
+ [r * 0.7, r * 0.7],
37215
+ [-r * 0.7, r * 0.7],
37216
+ [r * 0.7, -r * 0.7],
37217
+ [-r * 0.7, -r * 0.7]
37218
+ ];
37219
+ for (const [dx, dy] of dirs) {
37220
+ writer.drawText(pageIndex, {
37221
+ ...baseTextOptions,
37222
+ x: pxToPt$1(leftPx) + dx,
37223
+ y: pxToPt$1(baselineY) + dy,
37224
+ text,
37225
+ color: glowColor
37226
+ });
37227
+ }
37228
+ }
37229
+ if (styles.textShadow) {
37230
+ const ts = styles.textShadow;
37231
+ const dirRad = ts.dirDeg * Math.PI / 180;
37232
+ const shadowOffsetPt = pxToPt$1(ts.distPt * PX_PER_POINT);
37233
+ writer.drawText(pageIndex, {
37234
+ ...baseTextOptions,
37235
+ x: pxToPt$1(leftPx) + Math.cos(dirRad) * shadowOffsetPt,
37236
+ y: pxToPt$1(baselineY) + Math.sin(dirRad) * shadowOffsetPt,
37237
+ text,
37238
+ color: ts.color
37239
+ });
37240
+ } else if (styles.shadow) {
37241
+ writer.drawText(pageIndex, {
37242
+ ...baseTextOptions,
37243
+ x: pxToPt$1(leftPx) + offsetPt,
37244
+ y: pxToPt$1(baselineY) + offsetPt,
37245
+ text,
37246
+ color: "#808080"
37247
+ });
37248
+ }
37249
+ if (styles.reflection) {
37250
+ const ref = styles.reflection;
37251
+ const avgAlpha = (ref.startAlpha + ref.endAlpha) / 2;
37252
+ const refColor = blendColorWithWhite(mainColor, avgAlpha * 0.6);
37253
+ writer.drawText(pageIndex, {
37254
+ ...baseTextOptions,
37255
+ x: pxToPt$1(leftPx),
37256
+ y: pxToPt$1(baselineY) + pxToPt$1(ref.distPt * PX_PER_POINT) + fontSizePt,
37257
+ text,
37258
+ color: refColor
37259
+ });
37260
+ }
37261
+ const textOutline = styles.textOutline;
37262
+ writer.drawText(pageIndex, {
37263
+ ...baseTextOptions,
37264
+ x: pxToPt$1(leftPx),
37265
+ y: pxToPt$1(baselineY),
37266
+ text,
37267
+ color: mainColor,
37268
+ // A gradient fill paints the glyphs via the shading clip; it supersedes
37269
+ // both the solid color and any outline/stroke render mode.
37270
+ ...gradientShadingName ? { gradientShadingName } : textOutline ? {
37271
+ renderMode: 2,
37272
+ strokeColor: textOutline.color ?? mainColor,
37273
+ strokeWidth: textOutline.widthPt
37274
+ } : { renderMode: styles.outline ? 1 : 0 }
37275
+ });
37276
+ }
37183
37277
  async function drawFragmentText(writer, pageIndex, paragraph, line, fragment, document2, originX, originY, fontRegistry, drawers) {
37184
37278
  var _a2, _b2, _c;
37185
37279
  if (fragment.image) {
@@ -37325,100 +37419,26 @@ async function drawFragmentText(writer, pageIndex, paragraph, line, fragment, do
37325
37419
  originY,
37326
37420
  styles
37327
37421
  );
37328
- const offsetPt = pxToPt$1(1);
37329
- const emitChunk = (leftPx, text2) => {
37330
- if (styles.emboss || styles.imprint) {
37331
- const dir = styles.imprint ? 1 : -1;
37332
- writer.drawText(pageIndex, {
37333
- ...baseTextOptions,
37334
- x: pxToPt$1(leftPx) + offsetPt * dir,
37335
- y: pxToPt$1(baselineY) + offsetPt * dir,
37336
- text: text2,
37337
- color: "#BFBFBF"
37338
- });
37339
- }
37340
- if (styles.glow) {
37341
- const gl = styles.glow;
37342
- const r = pxToPt$1(gl.radiusPt * PX_PER_POINT) * 0.5;
37343
- const glowColor = blendColorWithWhite(gl.color, (gl.alpha ?? 0.5) * 0.4);
37344
- const dirs = [
37345
- [r, 0],
37346
- [-r, 0],
37347
- [0, r],
37348
- [0, -r],
37349
- [r * 0.7, r * 0.7],
37350
- [-r * 0.7, r * 0.7],
37351
- [r * 0.7, -r * 0.7],
37352
- [-r * 0.7, -r * 0.7]
37353
- ];
37354
- for (const [dx, dy] of dirs) {
37355
- writer.drawText(pageIndex, {
37356
- ...baseTextOptions,
37357
- x: pxToPt$1(leftPx) + dx,
37358
- y: pxToPt$1(baselineY) + dy,
37359
- text: text2,
37360
- color: glowColor
37361
- });
37362
- }
37363
- }
37364
- if (styles.textShadow) {
37365
- const ts = styles.textShadow;
37366
- const dirRad = ts.dirDeg * Math.PI / 180;
37367
- const shadowOffsetPt = pxToPt$1(ts.distPt * PX_PER_POINT);
37368
- writer.drawText(pageIndex, {
37369
- ...baseTextOptions,
37370
- x: pxToPt$1(leftPx) + Math.cos(dirRad) * shadowOffsetPt,
37371
- y: pxToPt$1(baselineY) + Math.sin(dirRad) * shadowOffsetPt,
37372
- text: text2,
37373
- color: ts.color
37374
- });
37375
- } else if (styles.shadow) {
37376
- writer.drawText(pageIndex, {
37377
- ...baseTextOptions,
37378
- x: pxToPt$1(leftPx) + offsetPt,
37379
- y: pxToPt$1(baselineY) + offsetPt,
37380
- text: text2,
37381
- color: "#808080"
37382
- });
37383
- }
37384
- if (styles.reflection) {
37385
- const ref = styles.reflection;
37386
- const avgAlpha = (ref.startAlpha + ref.endAlpha) / 2;
37387
- const refColor = blendColorWithWhite(mainColor, avgAlpha * 0.6);
37388
- writer.drawText(pageIndex, {
37389
- ...baseTextOptions,
37390
- x: pxToPt$1(leftPx),
37391
- y: pxToPt$1(baselineY) + pxToPt$1(ref.distPt * PX_PER_POINT) + fontSizePt,
37392
- text: text2,
37393
- color: refColor
37394
- });
37395
- }
37396
- const textOutline = styles.textOutline;
37397
- writer.drawText(pageIndex, {
37398
- ...baseTextOptions,
37399
- x: pxToPt$1(leftPx),
37400
- y: pxToPt$1(baselineY),
37401
- text: text2,
37402
- color: mainColor,
37403
- // A gradient fill paints the glyphs via the shading clip; it supersedes
37404
- // both the solid color and any outline/stroke render mode.
37405
- ...gradientShadingName ? { gradientShadingName } : textOutline ? {
37406
- renderMode: 2,
37407
- strokeColor: textOutline.color ?? mainColor,
37408
- strokeWidth: textOutline.widthPt
37409
- } : { renderMode: styles.outline ? 1 : 0 }
37410
- });
37422
+ const chunkCtx = {
37423
+ writer,
37424
+ pageIndex,
37425
+ baselineY,
37426
+ fontSizePt,
37427
+ mainColor,
37428
+ gradientShadingName,
37429
+ styles,
37430
+ baseTextOptions
37411
37431
  };
37412
37432
  const chunks = paragraphAlign === "justify" ? groupSlotChunksByWhitespace(chars) : groupSlotChunksByOffsetGaps(chars);
37413
37433
  for (const chunk of chunks) {
37414
37434
  const chunkText = chunk.map((c) => styles.allCaps ? c.char.toUpperCase() : c.char).join("");
37415
37435
  if (chunkText.length === 0) continue;
37416
- emitChunk(originX + chunk[0].left, chunkText);
37436
+ emitTextChunk(chunkCtx, originX + chunk[0].left, chunkText);
37417
37437
  }
37418
37438
  if (line.trailingHyphen && fragment.endOffset >= line.endOffset) {
37419
37439
  const endSlot = line.slots.find((slot) => slot.offset === line.endOffset) ?? line.slots[line.slots.length - 1];
37420
37440
  if (endSlot) {
37421
- emitChunk(originX + endSlot.left, "-");
37441
+ emitTextChunk(chunkCtx, originX + endSlot.left, "-");
37422
37442
  }
37423
37443
  }
37424
37444
  if (styles.underline) {
@@ -38529,6 +38549,16 @@ class PdfContentStream {
38529
38549
  );
38530
38550
  }
38531
38551
  }
38552
+ function readU16Array(reader, count) {
38553
+ const array = new Array(count);
38554
+ for (let i = 0; i < count; i += 1) array[i] = reader.u16();
38555
+ return array;
38556
+ }
38557
+ function readU16OffsetArray(reader, count, baseOffset) {
38558
+ const array = new Array(count);
38559
+ for (let i = 0; i < count; i += 1) array[i] = baseOffset + reader.u16();
38560
+ return array;
38561
+ }
38532
38562
  function parseCoverage(reader, offset) {
38533
38563
  reader.seek(offset);
38534
38564
  const format = reader.u16();
@@ -38566,10 +38596,7 @@ function parseClassDef(reader, offset) {
38566
38596
  if (format === 1) {
38567
38597
  const startGlyph = reader.u16();
38568
38598
  const glyphCount = reader.u16();
38569
- const classes = new Array(glyphCount);
38570
- for (let i = 0; i < glyphCount; i += 1) {
38571
- classes[i] = reader.u16();
38572
- }
38599
+ const classes = readU16Array(reader, glyphCount);
38573
38600
  return (glyphId) => {
38574
38601
  const index = glyphId - startGlyph;
38575
38602
  return index >= 0 && index < glyphCount ? classes[index] : 0;
@@ -38608,10 +38635,7 @@ function parseFeatureList(reader, featureListOffset) {
38608
38635
  reader.seek(offset);
38609
38636
  reader.skip(2);
38610
38637
  const lookupIndexCount = reader.u16();
38611
- const lookupIndices = new Array(lookupIndexCount);
38612
- for (let i = 0; i < lookupIndexCount; i += 1) {
38613
- lookupIndices[i] = reader.u16();
38614
- }
38638
+ const lookupIndices = readU16Array(reader, lookupIndexCount);
38615
38639
  return { tag, lookupIndices };
38616
38640
  });
38617
38641
  }
@@ -38663,6 +38687,26 @@ function parseLayoutTableHeader(reader) {
38663
38687
  }
38664
38688
  return { featureToLookups, lookupListOffset };
38665
38689
  }
38690
+ function parseLookupList(reader, lookupListOffset, parseSubtable2) {
38691
+ reader.seek(lookupListOffset);
38692
+ const lookupCount = reader.u16();
38693
+ const lookupOffsets = readU16OffsetArray(reader, lookupCount, lookupListOffset);
38694
+ return lookupOffsets.map((lookupOffset) => {
38695
+ reader.seek(lookupOffset);
38696
+ const lookupType = reader.u16();
38697
+ reader.skip(2);
38698
+ const subtableOffsets = readU16OffsetArray(reader, reader.u16(), lookupOffset);
38699
+ const subtables = [];
38700
+ for (const subtableOffset of subtableOffsets) {
38701
+ try {
38702
+ const subtable = parseSubtable2(reader, subtableOffset, lookupType);
38703
+ if (subtable) subtables.push(subtable);
38704
+ } catch {
38705
+ }
38706
+ }
38707
+ return { lookupType, subtables };
38708
+ });
38709
+ }
38666
38710
  function collectLookupIndices(featureToLookups, tags) {
38667
38711
  const indices = /* @__PURE__ */ new Set();
38668
38712
  for (const tag of tags) {
@@ -38690,10 +38734,7 @@ function parseSingleSubst(reader, offset) {
38690
38734
  }
38691
38735
  if (format === 2) {
38692
38736
  const glyphCount = reader.u16();
38693
- const substitutes = new Array(glyphCount);
38694
- for (let i = 0; i < glyphCount; i += 1) {
38695
- substitutes[i] = reader.u16();
38696
- }
38737
+ const substitutes = readU16Array(reader, glyphCount);
38697
38738
  const coverage = parseCoverage(reader, coverageOffset);
38698
38739
  return {
38699
38740
  apply(glyphs, pos) {
@@ -38708,24 +38749,22 @@ function parseSingleSubst(reader, offset) {
38708
38749
  }
38709
38750
  return null;
38710
38751
  }
38711
- function parseMultipleSubst(reader, offset) {
38752
+ function parseGlyphSetArray(reader, offset) {
38712
38753
  reader.seek(offset);
38713
- const format = reader.u16();
38714
- if (format !== 1) return null;
38754
+ if (reader.u16() !== 1) return null;
38715
38755
  const coverageOffset = offset + reader.u16();
38716
- const sequenceCount = reader.u16();
38717
- const sequenceOffsets = new Array(sequenceCount);
38718
- for (let i = 0; i < sequenceCount; i += 1) {
38719
- sequenceOffsets[i] = offset + reader.u16();
38720
- }
38721
- const sequences = sequenceOffsets.map((seqOffset) => {
38722
- reader.seek(seqOffset);
38723
- const glyphCount = reader.u16();
38724
- const ids = new Array(glyphCount);
38725
- for (let i = 0; i < glyphCount; i += 1) ids[i] = reader.u16();
38726
- return ids;
38756
+ const count = reader.u16();
38757
+ const setOffsets = readU16OffsetArray(reader, count, offset);
38758
+ const sets = setOffsets.map((setOffset) => {
38759
+ reader.seek(setOffset);
38760
+ return readU16Array(reader, reader.u16());
38727
38761
  });
38728
- const coverage = parseCoverage(reader, coverageOffset);
38762
+ return { coverage: parseCoverage(reader, coverageOffset), sets };
38763
+ }
38764
+ function parseMultipleSubst(reader, offset) {
38765
+ const parsed = parseGlyphSetArray(reader, offset);
38766
+ if (!parsed) return null;
38767
+ const { coverage, sets: sequences } = parsed;
38729
38768
  return {
38730
38769
  apply(glyphs, pos) {
38731
38770
  const glyph = glyphs[pos];
@@ -38745,23 +38784,9 @@ function parseMultipleSubst(reader, offset) {
38745
38784
  };
38746
38785
  }
38747
38786
  function parseAlternateSubst(reader, offset) {
38748
- reader.seek(offset);
38749
- const format = reader.u16();
38750
- if (format !== 1) return null;
38751
- const coverageOffset = offset + reader.u16();
38752
- const altSetCount = reader.u16();
38753
- const altSetOffsets = new Array(altSetCount);
38754
- for (let i = 0; i < altSetCount; i += 1) {
38755
- altSetOffsets[i] = offset + reader.u16();
38756
- }
38757
- const altSets = altSetOffsets.map((setOffset) => {
38758
- reader.seek(setOffset);
38759
- const glyphCount = reader.u16();
38760
- const ids = new Array(glyphCount);
38761
- for (let i = 0; i < glyphCount; i += 1) ids[i] = reader.u16();
38762
- return ids;
38763
- });
38764
- const coverage = parseCoverage(reader, coverageOffset);
38787
+ const parsed = parseGlyphSetArray(reader, offset);
38788
+ if (!parsed) return null;
38789
+ const { coverage, sets: altSets } = parsed;
38765
38790
  return {
38766
38791
  apply(glyphs, pos) {
38767
38792
  const glyph = glyphs[pos];
@@ -38781,25 +38806,15 @@ function parseLigatureSubst(reader, offset) {
38781
38806
  if (format !== 1) return null;
38782
38807
  const coverageOffset = offset + reader.u16();
38783
38808
  const ligSetCount = reader.u16();
38784
- const ligSetOffsets = new Array(ligSetCount);
38785
- for (let i = 0; i < ligSetCount; i += 1) {
38786
- ligSetOffsets[i] = offset + reader.u16();
38787
- }
38809
+ const ligSetOffsets = readU16OffsetArray(reader, ligSetCount, offset);
38788
38810
  const ligatureSets = ligSetOffsets.map((setOffset) => {
38789
38811
  reader.seek(setOffset);
38790
- const ligCount = reader.u16();
38791
- const ligOffsets = new Array(ligCount);
38792
- for (let i = 0; i < ligCount; i += 1) {
38793
- ligOffsets[i] = setOffset + reader.u16();
38794
- }
38812
+ const ligOffsets = readU16OffsetArray(reader, reader.u16(), setOffset);
38795
38813
  return ligOffsets.map((ligOffset) => {
38796
38814
  reader.seek(ligOffset);
38797
38815
  const ligatureGlyph = reader.u16();
38798
38816
  const componentCount = reader.u16();
38799
- const components = new Array(Math.max(0, componentCount - 1));
38800
- for (let i = 0; i < components.length; i += 1) {
38801
- components[i] = reader.u16();
38802
- }
38817
+ const components = readU16Array(reader, Math.max(0, componentCount - 1));
38803
38818
  return { ligatureGlyph, components };
38804
38819
  });
38805
38820
  });
@@ -38858,21 +38873,9 @@ function parseChainContextSubst(reader, offset) {
38858
38873
  reader.seek(offset);
38859
38874
  const format = reader.u16();
38860
38875
  if (format === 3) {
38861
- const backtrackCount = reader.u16();
38862
- const backtrackCoverageOffsets = new Array(backtrackCount);
38863
- for (let i = 0; i < backtrackCount; i += 1) {
38864
- backtrackCoverageOffsets[i] = offset + reader.u16();
38865
- }
38866
- const inputCount = reader.u16();
38867
- const inputCoverageOffsets = new Array(inputCount);
38868
- for (let i = 0; i < inputCount; i += 1) {
38869
- inputCoverageOffsets[i] = offset + reader.u16();
38870
- }
38871
- const lookaheadCount = reader.u16();
38872
- const lookaheadCoverageOffsets = new Array(lookaheadCount);
38873
- for (let i = 0; i < lookaheadCount; i += 1) {
38874
- lookaheadCoverageOffsets[i] = offset + reader.u16();
38875
- }
38876
+ const backtrackCoverageOffsets = readU16OffsetArray(reader, reader.u16(), offset);
38877
+ const inputCoverageOffsets = readU16OffsetArray(reader, reader.u16(), offset);
38878
+ const lookaheadCoverageOffsets = readU16OffsetArray(reader, reader.u16(), offset);
38876
38879
  const substCount = reader.u16();
38877
38880
  const records = readSubstLookupRecords(reader, substCount);
38878
38881
  const backtrack = backtrackCoverageOffsets.map(
@@ -38905,10 +38908,7 @@ function parseChainContextSubst(reader, offset) {
38905
38908
  if (format === 1) {
38906
38909
  const coverageOffset = offset + reader.u16();
38907
38910
  const ruleSetCount = reader.u16();
38908
- const ruleSetOffsets = new Array(ruleSetCount);
38909
- for (let i = 0; i < ruleSetCount; i += 1) {
38910
- ruleSetOffsets[i] = offset + reader.u16();
38911
- }
38911
+ const ruleSetOffsets = readU16OffsetArray(reader, ruleSetCount, offset);
38912
38912
  const coverage = parseCoverage(reader, coverageOffset);
38913
38913
  const ruleSets = ruleSetOffsets.map(
38914
38914
  (setOffset) => parseChainRuleSet(reader, setOffset)
@@ -38962,23 +38962,13 @@ function parseChainContextSubst(reader, offset) {
38962
38962
  function parseChainRuleSet(reader, setOffset) {
38963
38963
  reader.seek(setOffset);
38964
38964
  const ruleCount = reader.u16();
38965
- const ruleOffsets = new Array(ruleCount);
38966
- for (let i = 0; i < ruleCount; i += 1) {
38967
- ruleOffsets[i] = setOffset + reader.u16();
38968
- }
38965
+ const ruleOffsets = readU16OffsetArray(reader, ruleCount, setOffset);
38969
38966
  return ruleOffsets.map((ruleOffset) => {
38970
38967
  reader.seek(ruleOffset);
38971
- const backtrackCount = reader.u16();
38972
- const backtrack = new Array(backtrackCount);
38973
- for (let i = 0; i < backtrackCount; i += 1) backtrack[i] = reader.u16();
38974
- const inputCount = reader.u16();
38975
- const input = new Array(Math.max(0, inputCount - 1));
38976
- for (let i = 0; i < input.length; i += 1) input[i] = reader.u16();
38977
- const lookaheadCount = reader.u16();
38978
- const lookahead = new Array(lookaheadCount);
38979
- for (let i = 0; i < lookaheadCount; i += 1) lookahead[i] = reader.u16();
38980
- const substCount = reader.u16();
38981
- const records = readSubstLookupRecords(reader, substCount);
38968
+ const backtrack = readU16Array(reader, reader.u16());
38969
+ const input = readU16Array(reader, Math.max(0, reader.u16() - 1));
38970
+ const lookahead = readU16Array(reader, reader.u16());
38971
+ const records = readSubstLookupRecords(reader, reader.u16());
38982
38972
  return { backtrack, input, lookahead, records };
38983
38973
  });
38984
38974
  }
@@ -39055,7 +39045,7 @@ class GsubTable {
39055
39045
  try {
39056
39046
  const reader = new BinaryReader(bytes);
39057
39047
  const { featureToLookups, lookupListOffset } = parseLayoutTableHeader(reader);
39058
- const lookups = parseLookupList$1(reader, lookupListOffset);
39048
+ const lookups = parseLookupList(reader, lookupListOffset, parseSubtable$1);
39059
39049
  return new GsubTable(lookups, featureToLookups);
39060
39050
  } catch {
39061
39051
  return null;
@@ -39096,33 +39086,6 @@ class GsubTable {
39096
39086
  }
39097
39087
  }
39098
39088
  }
39099
- function parseLookupList$1(reader, lookupListOffset) {
39100
- reader.seek(lookupListOffset);
39101
- const lookupCount = reader.u16();
39102
- const lookupOffsets = new Array(lookupCount);
39103
- for (let i = 0; i < lookupCount; i += 1) {
39104
- lookupOffsets[i] = lookupListOffset + reader.u16();
39105
- }
39106
- return lookupOffsets.map((lookupOffset) => {
39107
- reader.seek(lookupOffset);
39108
- const lookupType = reader.u16();
39109
- reader.skip(2);
39110
- const subTableCount = reader.u16();
39111
- const subtableOffsets = new Array(subTableCount);
39112
- for (let i = 0; i < subTableCount; i += 1) {
39113
- subtableOffsets[i] = lookupOffset + reader.u16();
39114
- }
39115
- const subtables = [];
39116
- for (const subtableOffset of subtableOffsets) {
39117
- try {
39118
- const subtable = parseSubtable$1(reader, subtableOffset, lookupType);
39119
- if (subtable) subtables.push(subtable);
39120
- } catch {
39121
- }
39122
- }
39123
- return { lookupType, subtables };
39124
- });
39125
- }
39126
39089
  const X_PLACEMENT = 1;
39127
39090
  const Y_PLACEMENT = 2;
39128
39091
  const X_ADVANCE = 4;
@@ -39200,10 +39163,7 @@ function parsePairPos(reader, offset) {
39200
39163
  const hasSecondAdjustment = (valueFormat2 & X_ADVANCE) !== 0;
39201
39164
  if (format === 1) {
39202
39165
  const pairSetCount = reader.u16();
39203
- const pairSetOffsets = new Array(pairSetCount);
39204
- for (let i = 0; i < pairSetCount; i += 1) {
39205
- pairSetOffsets[i] = offset + reader.u16();
39206
- }
39166
+ const pairSetOffsets = readU16OffsetArray(reader, pairSetCount, offset);
39207
39167
  const pairSets = pairSetOffsets.map(
39208
39168
  (setOffset) => {
39209
39169
  reader.seek(setOffset);
@@ -39305,33 +39265,6 @@ function parseSubtable(reader, offset, lookupType) {
39305
39265
  return null;
39306
39266
  }
39307
39267
  }
39308
- function parseLookupList(reader, lookupListOffset) {
39309
- reader.seek(lookupListOffset);
39310
- const lookupCount = reader.u16();
39311
- const lookupOffsets = new Array(lookupCount);
39312
- for (let i = 0; i < lookupCount; i += 1) {
39313
- lookupOffsets[i] = lookupListOffset + reader.u16();
39314
- }
39315
- return lookupOffsets.map((lookupOffset) => {
39316
- reader.seek(lookupOffset);
39317
- const lookupType = reader.u16();
39318
- reader.skip(2);
39319
- const subTableCount = reader.u16();
39320
- const subtableOffsets = new Array(subTableCount);
39321
- for (let i = 0; i < subTableCount; i += 1) {
39322
- subtableOffsets[i] = lookupOffset + reader.u16();
39323
- }
39324
- const subtables = [];
39325
- for (const subtableOffset of subtableOffsets) {
39326
- try {
39327
- const subtable = parseSubtable(reader, subtableOffset, lookupType);
39328
- if (subtable) subtables.push(subtable);
39329
- } catch {
39330
- }
39331
- }
39332
- return { lookupType, subtables };
39333
- });
39334
- }
39335
39268
  class GposTable {
39336
39269
  constructor(lookups, featureToLookups) {
39337
39270
  this.lookups = lookups;
@@ -39342,7 +39275,7 @@ class GposTable {
39342
39275
  try {
39343
39276
  const reader = new BinaryReader(bytes);
39344
39277
  const { featureToLookups, lookupListOffset } = parseLayoutTableHeader(reader);
39345
- const lookups = parseLookupList(reader, lookupListOffset);
39278
+ const lookups = parseLookupList(reader, lookupListOffset, parseSubtable);
39346
39279
  return new GposTable(lookups, featureToLookups);
39347
39280
  } catch {
39348
39281
  return null;
@@ -47086,6 +47019,111 @@ function createEditorSurfaceEvents(deps) {
47086
47019
  stopDragging();
47087
47020
  deps.focusInputAfterPointerSelection();
47088
47021
  };
47022
+ const handleZoneTransitionDown = (state, hit, clickDetail) => {
47023
+ if (clickDetail < 2) {
47024
+ dragAnchor = null;
47025
+ stopDragging();
47026
+ deps.focusInputAfterPointerSelection();
47027
+ return;
47028
+ }
47029
+ dragAnchor = null;
47030
+ if (hit.resolvedFromParagraph) {
47031
+ applyWithZone(
47032
+ state,
47033
+ hit.zone,
47034
+ {
47035
+ ...state,
47036
+ selection: { anchor: { ...hit.position }, focus: { ...hit.position } }
47037
+ },
47038
+ hit.position
47039
+ );
47040
+ } else {
47041
+ applyWithZone(state, hit.zone, state);
47042
+ }
47043
+ stopDragging();
47044
+ deps.focusInputAfterPointerSelection();
47045
+ };
47046
+ const handleTextBoxDown = (state, hit) => {
47047
+ const textBoxParagraph = deps.getParagraphById(
47048
+ state.document,
47049
+ hit.textBox.paragraphId
47050
+ );
47051
+ if (!textBoxParagraph) {
47052
+ deps.focusInputAfterPointerSelection();
47053
+ return;
47054
+ }
47055
+ dragAnchor = null;
47056
+ const start = paragraphOffsetToPosition(textBoxParagraph, hit.textBox.startOffset);
47057
+ const end = paragraphOffsetToPosition(textBoxParagraph, hit.textBox.endOffset);
47058
+ applyWithZone(state, hit.zone, setSelection(state, { anchor: start, focus: end }), start);
47059
+ stopDragging();
47060
+ deps.focusInputAfterPointerSelection();
47061
+ };
47062
+ const handleImageDown = (state, hit, event) => {
47063
+ const imageParagraph = deps.getParagraphById(
47064
+ state.document,
47065
+ hit.image.paragraphId
47066
+ );
47067
+ if (!imageParagraph) {
47068
+ deps.focusInputAfterPointerSelection();
47069
+ return;
47070
+ }
47071
+ dragAnchor = null;
47072
+ const start = paragraphOffsetToPosition(imageParagraph, hit.image.startOffset);
47073
+ const end = paragraphOffsetToPosition(imageParagraph, hit.image.endOffset);
47074
+ applyWithZone(state, hit.zone, setSelection(state, { anchor: start, focus: end }), start);
47075
+ stopDragging();
47076
+ deps.imageOps.startImageDrag(
47077
+ hit.image.paragraphId,
47078
+ hit.image.startOffset,
47079
+ event,
47080
+ {
47081
+ left: hit.image.left,
47082
+ top: hit.image.top,
47083
+ width: hit.image.width,
47084
+ height: hit.image.height
47085
+ }
47086
+ );
47087
+ deps.focusInputAfterPointerSelection();
47088
+ };
47089
+ const handleShiftClickDown = (state, hit) => {
47090
+ dragAnchor = state.selection.anchor;
47091
+ applyWithZone(
47092
+ state,
47093
+ hit.zone,
47094
+ setSelection(state, { anchor: state.selection.anchor, focus: hit.position }),
47095
+ hit.position
47096
+ );
47097
+ window.addEventListener("mousemove", handleWindowMouseMove);
47098
+ window.addEventListener("mouseup", handleWindowMouseUp);
47099
+ deps.focusInputAfterPointerSelection();
47100
+ };
47101
+ const handleTripleClickDown = (state, hit, paragraph) => {
47102
+ dragAnchor = null;
47103
+ const range = resolveTripleClickParagraphRange(state, paragraph, hit.zone);
47104
+ applyWithZone(
47105
+ state,
47106
+ hit.zone,
47107
+ setSelection(state, { anchor: range.start, focus: range.end }),
47108
+ range.start
47109
+ );
47110
+ stopDragging();
47111
+ deps.focusInputAfterPointerSelection();
47112
+ };
47113
+ const handleDoubleClickDown = (state, hit, paragraph) => {
47114
+ dragAnchor = null;
47115
+ const word = resolveWordSelection(getParagraphText(paragraph), hit.paragraphOffset);
47116
+ const startPos = paragraphOffsetToPosition(paragraph, word.start);
47117
+ const endPos = paragraphOffsetToPosition(paragraph, word.end);
47118
+ applyWithZone(
47119
+ state,
47120
+ hit.zone,
47121
+ setSelection(state, { anchor: startPos, focus: endPos }),
47122
+ startPos
47123
+ );
47124
+ stopDragging();
47125
+ deps.focusInputAfterPointerSelection();
47126
+ };
47089
47127
  const handleSurfaceMouseDown = (event) => {
47090
47128
  var _a2;
47091
47129
  if (event.button !== 0) {
@@ -47131,155 +47169,27 @@ function createEditorSurfaceEvents(deps) {
47131
47169
  const paragraph = deps.getParagraphById(state.document, hit.paragraphId);
47132
47170
  const isZoneTransition = hit.zone !== (state.activeZone ?? "main");
47133
47171
  if (isZoneTransition) {
47134
- if (clickDetail < 2) {
47135
- dragAnchor = null;
47136
- stopDragging();
47137
- deps.focusInputAfterPointerSelection();
47138
- return;
47139
- }
47140
- dragAnchor = null;
47141
- if (hit.resolvedFromParagraph) {
47142
- applyWithZone(
47143
- state,
47144
- hit.zone,
47145
- {
47146
- ...state,
47147
- selection: {
47148
- anchor: { ...hit.position },
47149
- focus: { ...hit.position }
47150
- }
47151
- },
47152
- hit.position
47153
- );
47154
- } else {
47155
- applyWithZone(state, hit.zone, state);
47156
- }
47157
- stopDragging();
47158
- deps.focusInputAfterPointerSelection();
47172
+ handleZoneTransitionDown(state, hit, clickDetail);
47159
47173
  return;
47160
47174
  }
47161
47175
  if (hit.textBox) {
47162
- const textBoxParagraph = deps.getParagraphById(
47163
- state.document,
47164
- hit.textBox.paragraphId
47165
- );
47166
- if (!textBoxParagraph) {
47167
- deps.focusInputAfterPointerSelection();
47168
- return;
47169
- }
47170
- dragAnchor = null;
47171
- const start = paragraphOffsetToPosition(
47172
- textBoxParagraph,
47173
- hit.textBox.startOffset
47174
- );
47175
- const end = paragraphOffsetToPosition(
47176
- textBoxParagraph,
47177
- hit.textBox.endOffset
47178
- );
47179
- applyWithZone(
47180
- state,
47181
- hit.zone,
47182
- setSelection(state, {
47183
- anchor: start,
47184
- focus: end
47185
- }),
47186
- start
47187
- );
47188
- stopDragging();
47189
- deps.focusInputAfterPointerSelection();
47176
+ handleTextBoxDown(state, hit);
47190
47177
  return;
47191
47178
  }
47192
47179
  if (hit.image) {
47193
- const imageParagraph = deps.getParagraphById(
47194
- state.document,
47195
- hit.image.paragraphId
47196
- );
47197
- if (!imageParagraph) {
47198
- deps.focusInputAfterPointerSelection();
47199
- return;
47200
- }
47201
- dragAnchor = null;
47202
- const start = paragraphOffsetToPosition(
47203
- imageParagraph,
47204
- hit.image.startOffset
47205
- );
47206
- const end = paragraphOffsetToPosition(
47207
- imageParagraph,
47208
- hit.image.endOffset
47209
- );
47210
- applyWithZone(
47211
- state,
47212
- hit.zone,
47213
- setSelection(state, {
47214
- anchor: start,
47215
- focus: end
47216
- }),
47217
- start
47218
- );
47219
- stopDragging();
47220
- deps.imageOps.startImageDrag(
47221
- hit.image.paragraphId,
47222
- hit.image.startOffset,
47223
- event,
47224
- {
47225
- left: hit.image.left,
47226
- top: hit.image.top,
47227
- width: hit.image.width,
47228
- height: hit.image.height
47229
- }
47230
- );
47231
- deps.focusInputAfterPointerSelection();
47180
+ handleImageDown(state, hit, event);
47232
47181
  return;
47233
47182
  }
47234
47183
  if (event.shiftKey && hit.resolvedFromParagraph) {
47235
- dragAnchor = state.selection.anchor;
47236
- applyWithZone(
47237
- state,
47238
- hit.zone,
47239
- setSelection(state, {
47240
- anchor: state.selection.anchor,
47241
- focus: hit.position
47242
- }),
47243
- hit.position
47244
- );
47245
- window.addEventListener("mousemove", handleWindowMouseMove);
47246
- window.addEventListener("mouseup", handleWindowMouseUp);
47247
- deps.focusInputAfterPointerSelection();
47184
+ handleShiftClickDown(state, hit);
47248
47185
  return;
47249
47186
  }
47250
47187
  if (clickDetail >= 3 && paragraph) {
47251
- dragAnchor = null;
47252
- const range = resolveTripleClickParagraphRange(
47253
- state,
47254
- paragraph,
47255
- hit.zone
47256
- );
47257
- applyWithZone(
47258
- state,
47259
- hit.zone,
47260
- setSelection(state, { anchor: range.start, focus: range.end }),
47261
- range.start
47262
- );
47263
- stopDragging();
47264
- deps.focusInputAfterPointerSelection();
47188
+ handleTripleClickDown(state, hit, paragraph);
47265
47189
  return;
47266
47190
  }
47267
47191
  if (clickDetail === 2 && paragraph) {
47268
- dragAnchor = null;
47269
- const word = resolveWordSelection(
47270
- getParagraphText(paragraph),
47271
- hit.paragraphOffset
47272
- );
47273
- const startPos = paragraphOffsetToPosition(paragraph, word.start);
47274
- const endPos = paragraphOffsetToPosition(paragraph, word.end);
47275
- applyWithZone(
47276
- state,
47277
- hit.zone,
47278
- setSelection(state, { anchor: startPos, focus: endPos }),
47279
- startPos
47280
- );
47281
- stopDragging();
47282
- deps.focusInputAfterPointerSelection();
47192
+ handleDoubleClickDown(state, hit, paragraph);
47283
47193
  return;
47284
47194
  }
47285
47195
  if (!hit.resolvedFromParagraph) {