ooxml-ui 1.45.0 → 1.47.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/chart/format-pane-effects.d.ts +0 -1
- package/dist/chart/format-pane-fill-kinds.d.ts +0 -1
- package/dist/chart/format-pane-space.d.ts +0 -1
- package/dist/chart/format-pane-targets.d.ts +0 -1
- package/dist/chunk-G5CALQUW.js +278 -0
- package/dist/{chunk-LPI7LT4B.js → chunk-J3ROBM74.js} +1 -1
- package/dist/docx/backstage-options.d.ts +4 -0
- package/dist/docx/backstage-trust.d.ts +11 -0
- package/dist/docx/docx-webfonts.d.ts +75 -0
- package/dist/docx/editor-core.d.ts +3 -0
- package/dist/docx/element-api.d.ts +14 -0
- package/dist/docx/font-downloads.d.ts +8 -0
- package/dist/docx/locales/en.d.ts +6 -0
- package/dist/docx/locales/options.d.ts +6 -0
- package/dist/docx/locales/trust.d.ts +15 -0
- package/dist/docx/localization-strings.d.ts +6 -0
- package/dist/docx/print-layout-view.d.ts +2 -0
- package/dist/docx.js +229 -14
- package/dist/fonts/font-download-policy.d.ts +23 -0
- package/dist/fonts/webfonts.d.ts +118 -0
- package/dist/fonts/webfonts.d.ts.map +1 -0
- package/dist/form/color-swatches.d.ts +0 -1
- package/dist/index.js +2 -2
- package/dist/picture-artistic-filters.d.ts +0 -1
- package/dist/pptx/{chunk-CWBVJ4DC.cjs → chunk-6XIUBQPL.cjs} +403 -2398
- package/dist/pptx/{chunk-HGT3CA36.mjs → chunk-BV24XNBQ.mjs} +301 -2351
- package/dist/pptx/{chunk-MZCAYJ7H.cjs → chunk-JHI42PNB.cjs} +42 -42
- package/dist/pptx/{chunk-6JTQ7AG6.mjs → chunk-XMAQ23WE.mjs} +1 -1
- package/dist/pptx/dom/index.cjs +372 -371
- package/dist/pptx/dom/index.mjs +6 -5
- package/dist/pptx/dom/load-presentation.d.ts +8 -1
- package/dist/pptx/dom/load-presentation.d.ts.map +1 -1
- package/dist/pptx/index.cjs +3086 -3058
- package/dist/pptx/index.mjs +1 -1
- package/dist/pptx/render/deck-webfont-readiness.d.ts +24 -10
- package/dist/pptx/render/deck-webfont-readiness.d.ts.map +1 -1
- package/dist/pptx/render/font-weight-names.d.ts +2 -65
- package/dist/pptx/render/font-weight-names.d.ts.map +1 -1
- package/dist/pptx/render/google-fonts-catalogue.d.ts +2 -13
- package/dist/pptx/render/google-fonts-catalogue.d.ts.map +1 -1
- package/dist/pptx/render/google-fonts-lookup.d.ts +2 -6
- package/dist/pptx/render/google-fonts-lookup.d.ts.map +1 -1
- package/dist/pptx/render/google-webfonts-link.d.ts +2 -2
- package/dist/pptx/render/google-webfonts-link.d.ts.map +1 -1
- package/dist/pptx/render/google-webfonts-metric-clones.d.ts +2 -16
- package/dist/pptx/render/google-webfonts-metric-clones.d.ts.map +1 -1
- package/dist/pptx/render/google-webfonts.d.ts +11 -107
- package/dist/pptx/render/google-webfonts.d.ts.map +1 -1
- package/dist/pptx/render/index.d.ts +3 -0
- package/dist/pptx/render/index.d.ts.map +1 -1
- package/dist/pptx/render/inline-list-dom.d.ts.map +1 -1
- package/dist/pptx/render/inline-text-paragraph-marker.d.ts +3 -0
- package/dist/pptx/render/inline-text-paragraph-marker.d.ts.map +1 -0
- package/dist/pptx/render/inline-text-seed.d.ts +25 -0
- package/dist/pptx/render/inline-text-seed.d.ts.map +1 -0
- package/dist/pptx/render/inline-trailing-space.d.ts +14 -0
- package/dist/pptx/render/inline-trailing-space.d.ts.map +1 -0
- package/dist/pptx/render/status-bar-state.d.ts +10 -0
- package/dist/pptx/render/status-bar-state.d.ts.map +1 -1
- package/dist/pptx/{smartart-insert-preview-R7USUBIX.cjs → smartart-insert-preview-GE47FXVT.cjs} +3 -3
- package/dist/pptx/{smartart-insert-preview-ZKVFXFSI.mjs → smartart-insert-preview-WY6DHSAJ.mjs} +2 -2
- package/dist/pptx/web-components/status-bar.d.ts.map +1 -1
- package/dist/teams.js +1 -1
- package/dist/theme-bridge.d.ts +0 -1
- package/dist/visio/controller.d.ts +12 -0
- package/dist/visio/font-stack.d.ts +11 -0
- package/dist/visio/locales/trust-center.d.ts +7 -0
- package/dist/visio/viewer-behaviour.d.ts +5 -0
- package/dist/visio/viewer-element.d.ts +16 -0
- package/dist/visio/viewer-options-categories.d.ts +6 -0
- package/dist/visio/viewer-options-trust.d.ts +10 -0
- package/dist/visio/viewer-options.d.ts +6 -0
- package/dist/visio/viewer-webfonts.d.ts +42 -0
- package/dist/visio.js +323 -21
- package/dist/xlsx/backstage/options-trust.d.ts +9 -0
- package/dist/xlsx/backstage/parts.d.ts +4 -0
- package/dist/xlsx/editor-core.d.ts +3 -0
- package/dist/xlsx/element-api.d.ts +15 -0
- package/dist/xlsx/font-downloads.d.ts +8 -0
- package/dist/xlsx/grid/drawings.d.ts +2 -0
- package/dist/xlsx/grid/measure.d.ts +2 -0
- package/dist/xlsx/page-views/page-layout-css.d.ts +1 -1
- package/dist/xlsx/print-cell.d.ts +1 -1
- package/dist/xlsx/webfonts.d.ts +70 -0
- package/dist/xlsx.js +259 -18
- package/package.json +2 -2
- package/dist/chunk-MWDG776V.js +0 -90
- /package/dist/{chunk-2YRHRV4H.js → chunk-MUY444GW.js} +0 -0
package/dist/xlsx.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { statusLayout, watchStatusWidth, defineChartExOptions } from './chunk-II43ALTT.js';
|
|
2
2
|
import { trackPointerGesture } from './chunk-GSXOZCAN.js';
|
|
3
|
-
import { attachShareDialog, chartExSpaceFormatSource, connectedServicesLabels } from './chunk-
|
|
4
|
-
import './chunk-
|
|
3
|
+
import { attachShareDialog, effectiveFontDownloads, fontDownloadLock, syncGoogleWebfontStylesheet, prefetchWebfonts, prepareWebfonts, chartExSpaceFormatSource, FONT_DOWNLOADS_DEFAULT, connectedServicesLabels } from './chunk-G5CALQUW.js';
|
|
4
|
+
import './chunk-J3ROBM74.js';
|
|
5
5
|
import './chunk-DA57FPSN.js';
|
|
6
6
|
import { createHostBackstagePages, syncRibbonAddIns, withHostMenuItems } from './chunk-ZTLP52FH.js';
|
|
7
7
|
export { RIBBON_ADD_IN_EVENT } from './chunk-ZTLP52FH.js';
|
|
8
8
|
import { needsPicturePixels, pictureSvg, pictureEffectFilter, SmartArtTextPaneController, defineSmartArt, defineSmartArtPicker, smartArtStylesGalleryState, smartArtColorsGalleryState, safeColor, svgTile } from './chunk-6FFZFH73.js';
|
|
9
|
-
import { withExtension, saveExtension, downloadBytes, emit, emitEvent, blobFor, announceFileCommand, pickFile } from './chunk-
|
|
10
|
-
export { XLSX_EDITOR_EVENTS } from './chunk-
|
|
9
|
+
import { withExtension, saveExtension, downloadBytes, emit, emitEvent, blobFor, announceFileCommand, pickFile } from './chunk-MUY444GW.js';
|
|
10
|
+
export { XLSX_EDITOR_EVENTS } from './chunk-MUY444GW.js';
|
|
11
11
|
import './chunk-4ZSZPUE5.js';
|
|
12
12
|
import './chunk-CDAXY5KC.js';
|
|
13
13
|
import './chunk-NDUD5JJB.js';
|
|
@@ -22,7 +22,7 @@ import { withTokens } from './chunk-FE5KE5TR.js';
|
|
|
22
22
|
import './chunk-6EOS74O4.js';
|
|
23
23
|
import { SPECIAL_CODES, FRACTION_CODES, translate, INSERT_CHART_TYPES, AUTOSUM_FUNCTIONS, ICON_ACCENTS, ICON_PATHS, normalizeEditorLocale, EXCEL_CAPABILITY_BACKSTAGE_PAGES, EXCEL_CAPABILITY_COMMANDS, normalizeThemeMode, applyThemeColors, parseSelectionRef, selectionRef, fontCommands, alignmentCommands, numberCommands, editBridge, FONT_SIZES, FONT_NAMES, style, activeRef, numberFormatOptions, selectionFormatting, DirtyState, createCommandRegistry, createDialogRegistry, createSelectionModel, SheetSelections, translator, initialSelection, sheetBaseName, historyOf, onRibbonTabsChange, activeChart, CellViewCache, QUADRANTS, columnHeaderHeight, rowHeaderWidth, GridGeometry, cellRange, scrollToReveal, buildItems, fitNumber, cssFont, clampAddress, selectCell, movingEnd, extendSelection, moveWithinSelection, rowsRange, colsRange, ALL_RANGE, onAuditChange, setErrorRules, ribbonTabs, isTabHidden, selectTab, setTabHidden, tabButton, searchCommands, formatNumber, target, activeSmartArt, isSingleCell, spanRange, selectionCellCount, auditState, setSelectionPane, addRange, TEMPLATES, createTemplateWorkbook, fillPaint, iconSvg, colSelected, rowSelected, rowHeaderMenu, columnHeaderMenu, cellMenu, isMenuSeparator, textDecoration, justify, alignItems, textAlign, hasBorders, edgeCss, diagonalSvg, registerRibbonTabs, installFormatPainter, SHEET_ICONS, clipboardCommands, cellCommands, editingCommands, pageLayoutCommands, pageBreakCommands, formulaCommands, dataCommands, whatIfCommands, contextualCommands, reviewTab, viewTab, helpTab, tabMenu, editing, icon, DATA_BAR_COLORS, dataBarRule, COLOR_SCALES, colorScaleRule, iconSetRule, tableAt, timelineSourceAt, slicerSourceAt, viewing, activeTable, removeWatch, setWatchWindowOpen, BORDER_PRESETS, ORIENTATIONS, ACCOUNTING_FORMATS, themePaletteItems, MARGIN_PRESETS, PAPER_SIZES, FUNCTION_MENUS, MORE_FUNCTION_CATEGORIES, functionsIn, activeSlicer, activeTimeline, activeStyle, selectSpecial, insertFunctionCall, guessHeader, regionOf, evaluateRef, editChart, suggestForecastEnd, FORECAST_AGGREGATIONS, createForecastSheet, ForecastError, forecastMessage, HIGHLIGHT_STYLES, addWatch, ICON_SETS, TABLE_STYLES, tableStylePreview, resolveNameBox, absoluteReference, nameForRange, recentFunctions, buildChart, createScenarioSummary, detectCategory, CATEGORIES, TIME_CODES, DATE_CODES, DEFAULT_OPTIONS, cellStyleItems, SYMBOLS, buildCode, UNSET, dxfCss, negativeCodes, iconCount, iconThresholds, rowsOf, colsOf } from 'ooxml-core/xlsx/ui';
|
|
24
24
|
export { EDITOR_LOCALES, EXCEL_CAPABILITY_IDS, THEME_KEYS, normalizeEditorLocale, registerRibbonTabs, themeToCssVars, darkTheme as xlsxDarkTheme, lightTheme as xlsxLightTheme } from 'ooxml-core/xlsx/ui';
|
|
25
|
-
import { createWorksheet, cellInputText, createEditSession, approximateMeasure, createWorkbook, MAX_ROW, MAX_COL, createGridMetrics, splitToPx, splitAtCell, mergeAt, splitVisible, visibleCells, getCell, FUNCTION_CATALOG, closeParens, isFormulaText, parseCellInput, formatAddress, referenceTarget, navigate, anchorToPixelBox, createRefEvaluator, chartView, renderChartSvg, CHART_FILL_PARTS, selectionOfPeriods, pixelBoxToAnchor, listValidationOptions, validationAt, getValue, hasFilterCriteria, resolvePasteOptions, ERROR_RULES, selectionStats, formatSelectionStat, chartSpaceOf, xlsxChartExDataSheet, pictureAnchorAt, nameAtCaret, functionMatches, callAtCaret, acceptsReference, formatRange, splice, translateFormula, slicerStyleColors, slicerGeometry, timelineGeometry, TIMELINE_PERIOD_WIDTH, TIMELINE_METRICS, controlStateIn, controlListItems, formControlSvg, shapeSvg, controlLinkCell, controlValueAtFraction, timelineView, slicerItems, selectionAfterClick, isCellError, filterMenuModel, displayText, layoutRemoteSelections, parseHtmlTable, CUT_MULTIPLE, toggleAbsolute, rangeContains, printRange, chartSeriesTransparencyPatch, chartSeriesTransparency, chartSeriesGradientPatch, chartSeriesSolidFillPatch, chartSeriesFillPatch, chartWithElementFills, chartElementTransparencyPatch, chartElementTransparency, chartElementGradientPatch, chartElementSolidFillPatch, chartElementFillPatch, chartElementFill, chartColorScheme, chartBarSpacing, columnLabel, coloredReferences, syntaxParams, activeParam, drawingSchemeColors, applyControlAction, checklistCriteria, pageBreakPreview, pxToSplit, pasteAreas, normalizeRange, currentRegion, autoFitColumnWidth, chartGradientStopTransparency, paginateWorksheet, colorFilterCriteria, clampSplitBar, resolveColor, DEFAULT_THEME, pageHeaderFooter, createPrintMergeIndex, cellView, pixelsToColumnWidth, renderHeaderFooterRuns, planBreakDrag, resizePrintArea, headerFooterPicture, nextSheetName, sheetByName, pivotGroupableFields, pivotGroupableDateFields, pivotSubtotalFields, DEFAULT_COL_WIDTH, pageViewLayout, formatValue, isDateFormat, selectedSparklineGroups, pivotTableAt, FormulaStepper, findErrors, adjacentIssue, withIgnoredError, parseNumberText, validateDefinedName, usedRange, pivotAxisChoices, parseAddress, PIVOT_DATE_UNITS, PIVOT_SUBTOTAL_ORDER, parseRange, decodeCondition, customFilter, topFilterCriteria, parseInputCell, serialToDate, styleAt, rangesIntersect, watchExists, describeWatch, watchValueText, chartStylePresetOf, chartTakesQuickLayout, SLICER_STYLE_NAMES, slicerStyleLabel, slicerStylePreview, pageViewCellRect, pageOfCell, validateSheetName, dateToSerial, IMAGE_EXTENSIONS, verifySheetPassword, verifyWorkbookPassword, quoteSheetName, pivotRowFields, pivotValuesIndex, pivotSourceData, defaultFieldGroup, defaultDateGroup, dateGroupDays, pivotIsoToSerial, fieldSubtotalFunctions, printTitles, formatPrintTitleSpan, parsePrintTitleSpan, parseBreakPositions, splitFixedWidth, splitDelimited, scenariosOf, parseSortList, PAGE_VIEW_GAP, pivotPageItems, pivotPageItemLabel, pivotSerialToIso, previewScenario, customViewsOf, BUILTIN_NUMBER_FORMATS, BUILT_IN_SORT_LISTS, sortChoices, validateTableName, pixelsToEmu, pageViewHit, resizedFrameAnchor, headerFooterKey, splitHeaderFooter, composeHeaderFooter } from 'ooxml-core/xlsx';
|
|
25
|
+
import { createWorksheet, cellInputText, createEditSession, approximateMeasure, workbookFontFamily, createWorkbook, MAX_ROW, MAX_COL, collectWorkbookWebfontRuns, createGridMetrics, splitToPx, splitAtCell, mergeAt, splitVisible, visibleCells, getCell, FUNCTION_CATALOG, closeParens, isFormulaText, parseCellInput, formatAddress, referenceTarget, navigate, anchorToPixelBox, createRefEvaluator, chartView, renderChartSvg, CHART_FILL_PARTS, selectionOfPeriods, pixelBoxToAnchor, listValidationOptions, validationAt, getValue, hasFilterCriteria, resolvePasteOptions, ERROR_RULES, selectionStats, formatSelectionStat, chartSpaceOf, xlsxChartExDataSheet, pictureAnchorAt, nameAtCaret, functionMatches, callAtCaret, acceptsReference, formatRange, splice, translateFormula, slicerStyleColors, slicerGeometry, timelineGeometry, TIMELINE_PERIOD_WIDTH, TIMELINE_METRICS, controlStateIn, controlListItems, formControlSvg, shapeSvg, controlLinkCell, controlValueAtFraction, timelineView, slicerItems, selectionAfterClick, isCellError, filterMenuModel, displayText, layoutRemoteSelections, parseHtmlTable, CUT_MULTIPLE, toggleAbsolute, rangeContains, printRange, chartSeriesTransparencyPatch, chartSeriesTransparency, chartSeriesGradientPatch, chartSeriesSolidFillPatch, chartSeriesFillPatch, chartWithElementFills, chartElementTransparencyPatch, chartElementTransparency, chartElementGradientPatch, chartElementSolidFillPatch, chartElementFillPatch, chartElementFill, chartColorScheme, chartBarSpacing, columnLabel, coloredReferences, syntaxParams, activeParam, drawingSchemeColors, applyControlAction, checklistCriteria, pageBreakPreview, pxToSplit, pasteAreas, normalizeRange, currentRegion, autoFitColumnWidth, chartGradientStopTransparency, paginateWorksheet, colorFilterCriteria, clampSplitBar, resolveColor, DEFAULT_THEME, pageHeaderFooter, createPrintMergeIndex, cellView, pixelsToColumnWidth, renderHeaderFooterRuns, planBreakDrag, resizePrintArea, headerFooterPicture, nextSheetName, sheetByName, pivotGroupableFields, pivotGroupableDateFields, pivotSubtotalFields, DEFAULT_COL_WIDTH, pageViewLayout, formatValue, isDateFormat, selectedSparklineGroups, pivotTableAt, FormulaStepper, findErrors, adjacentIssue, withIgnoredError, parseNumberText, validateDefinedName, usedRange, pivotAxisChoices, parseAddress, PIVOT_DATE_UNITS, PIVOT_SUBTOTAL_ORDER, parseRange, decodeCondition, customFilter, topFilterCriteria, parseInputCell, serialToDate, styleAt, rangesIntersect, watchExists, describeWatch, watchValueText, chartStylePresetOf, chartTakesQuickLayout, SLICER_STYLE_NAMES, slicerStyleLabel, slicerStylePreview, pageViewCellRect, pageOfCell, validateSheetName, dateToSerial, IMAGE_EXTENSIONS, verifySheetPassword, verifyWorkbookPassword, quoteSheetName, pivotRowFields, pivotValuesIndex, pivotSourceData, defaultFieldGroup, defaultDateGroup, dateGroupDays, pivotIsoToSerial, fieldSubtotalFunctions, printTitles, formatPrintTitleSpan, parsePrintTitleSpan, parseBreakPositions, splitFixedWidth, splitDelimited, scenariosOf, parseSortList, PAGE_VIEW_GAP, pivotPageItems, pivotPageItemLabel, pivotSerialToIso, previewScenario, customViewsOf, BUILTIN_NUMBER_FORMATS, BUILT_IN_SORT_LISTS, sortChoices, validateTableName, pixelsToEmu, pageViewHit, resizedFrameAnchor, headerFooterKey, splitHeaderFooter, composeHeaderFooter } from 'ooxml-core/xlsx';
|
|
26
26
|
import { isCapabilityEnabled, capabilityHiddenActions, saveToStorage, documentSaveMeta, withoutHiddenEntries } from 'ooxml-core/embedding';
|
|
27
27
|
import { hyperlinkPolicy } from 'ooxml-core/opc';
|
|
28
28
|
import { previewDiagramLayout, resolveDiagramDrawingStyles, DIAGRAM_INSERT_CATEGORIES, DIAGRAM_INSERT_PRESETS, RECT_GRADIENT_DIRECTIONS, OFFICE_GRADIENT_PRESETS, officeGradientPresetId, officeGradientPresetFill, resolveDrawingColor, drawingColorBrightness, drawingColorCss, rectGradientDirection, DIAGRAM_DESIGN_COMMANDS, DIAGRAM_COLOR_ENTRIES, DIAGRAM_STYLE_ENTRIES, DIAGRAM_ADD_SHAPE_LABEL, DIAGRAM_DESIGN_GROUPS, DIAGRAM_ADD_SHAPE_COMMANDS } from 'ooxml-core/diagram';
|
|
@@ -31,6 +31,7 @@ import { render } from 'lit';
|
|
|
31
31
|
import { normalizeLocale } from 'ooxml-core/i18n';
|
|
32
32
|
import { imageContentType } from 'ooxml-core/drawingml';
|
|
33
33
|
import { imageRectFromCrop, applyResize, applyDragDelta } from 'ooxml-core/geometry';
|
|
34
|
+
import { resolveGoogleFontsCss2Base } from 'ooxml-core/text';
|
|
34
35
|
|
|
35
36
|
// raw-css:/home/runner/work/ooxml/ooxml/src/ui/src/xlsx/theme/shell.css?raw
|
|
36
37
|
var shell_default = "/* Frame, title bar and status bar. Mirrors docx-viewer's chrome (styles/base.css,\n chrome-titlebar.css, status-dialogs.css) with --xve-* tokens. */\n:host {\n --xl: var(--xve-primary, var(--office-accent));\n --xl-strong: color-mix(in srgb, var(--xve-primary, var(--office-accent)) 70%, #000);\n --xl-soft: color-mix(in srgb, var(--xve-primary, var(--office-accent)) 12%, transparent);\n --accent-soft: var(--xl-soft);\n --ink: var(--xve-foreground, var(--office-foreground));\n --muted: var(--xve-muted-foreground, var(--office-muted-foreground));\n --line: var(--xve-border, var(--office-border));\n --surface: var(--xve-card, var(--office-surface));\n --chrome: var(--xve-background, var(--office-background));\n display: block;\n box-sizing: border-box;\n width: 100%;\n height: 100%;\n min-height: 0;\n color: var(--ink);\n font: var(--office-font-size, 13px)/var(--office-line-height, 1.4)\n var(--xve-font, var(--office-font, system-ui, sans-serif));\n}\n.xve-frame {\n position: relative;\n display: flex;\n box-sizing: border-box;\n width: 100%;\n height: 100%;\n min-height: 0;\n min-width: 0;\n flex-direction: column;\n overflow: hidden;\n background: var(--surface);\n}\n:focus-visible {\n outline: 2px solid var(--xve-ring, var(--office-ring));\n outline-offset: 1px;\n}\n[hidden],\n[data-xve-hidden] {\n display: none !important;\n}\n.xve-icon {\n flex: none;\n}\n.xve-icon-button {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n min-width: 28px;\n height: 28px;\n padding: 0 6px;\n border: 0;\n border-radius: 4px;\n background: none;\n color: inherit;\n font: inherit;\n cursor: pointer;\n}\n.xve-icon-button:hover:not(:disabled),\n.xve-icon-button[aria-pressed='true'] {\n background: var(--xl-soft);\n}\n.xve-icon-button:disabled {\n opacity: 0.4;\n cursor: default;\n}\n\n/* Workspace: formula bar, grid and sheet tabs between the ribbon and the status bar. */\n.xve-workspace {\n position: relative;\n display: flex;\n flex: 1;\n min-height: 0;\n min-width: 0;\n flex-direction: column;\n background: var(--xve-sheet-bg, var(--office-paper));\n}\n.xve-formula-row {\n flex: none;\n min-width: 0;\n border-bottom: 1px solid var(--line);\n background: var(--surface);\n}\n.xve-grid-host {\n position: relative;\n display: flex;\n flex: 1;\n min-height: 0;\n min-width: 0;\n overflow: hidden;\n background: var(--xve-sheet-bg, var(--office-paper));\n color-scheme: light;\n}\n.xve-grid-host > * {\n flex: 1;\n min-width: 0;\n}\n.xve-tabs-row {\n flex: none;\n min-width: 0;\n border-top: 1px solid var(--line);\n background: var(--chrome);\n}\n.xve-empty {\n position: absolute;\n z-index: 5;\n inset: 0;\n display: grid;\n place-items: center;\n color: var(--muted);\n background: var(--chrome);\n}\n:host([show-formula-bar='false']) .xve-formula-row,\n:host([show-toolbar='false']) .xve-ribbon {\n display: none;\n}\n\n/* Title bar: drawn by the shared office-ui-title-bar; the mark, background and borders come from its tokens. */\n.xve-titlebar {\n display: block;\n flex: none;\n --office-title-bar-background: var(--chrome);\n --office-title-bar-foreground: var(--ink);\n --office-title-bar-border: var(--line);\n --office-title-bar-mark-background: var(--xl);\n --office-title-bar-mark-foreground: var(\n --xve-primary-foreground,\n var(--office-accent-foreground)\n );\n}\n\n/* Status bar: drawn by the shared office-ui-status-bar; this places it and styles the slotted stats. */\n.xve-status {\n display: block;\n flex: none;\n min-width: 0;\n border-top: 1px solid var(--line);\n}\n.xve-status-stats {\n margin-inline-end: 10px;\n min-width: 0;\n overflow: hidden;\n color: var(--ink);\n font-size: 11px;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n";
|
|
@@ -435,14 +436,12 @@ function renderInfo(page) {
|
|
|
435
436
|
layout.append(left, right);
|
|
436
437
|
content.replaceChildren(heading(page, t("Info")), layout);
|
|
437
438
|
}
|
|
438
|
-
|
|
439
|
-
// src/xlsx/print-cell.ts
|
|
440
439
|
var escapeHtml = (text3) => text3.replace(/[&<>"']/g, (ch) => `&#${ch.charCodeAt(0)};`);
|
|
441
440
|
var edge = (view) => view ? `${view.style === "double" ? 3 : view.widthPx}px ${view.style} ${view.color}` : "none";
|
|
442
441
|
function cellCss(view) {
|
|
443
442
|
const { font } = view;
|
|
444
443
|
const parts = [
|
|
445
|
-
`font-family
|
|
444
|
+
`font-family:${workbookFontFamily(font.family.replace(/[;<>{}]/g, ""))}`,
|
|
446
445
|
`font-size:${font.sizePx}px`,
|
|
447
446
|
`color:${font.color}`,
|
|
448
447
|
`text-align:${view.hAlign === "centerContinuous" ? "center" : view.hAlign === "distributed" || view.hAlign === "fill" ? "justify" : view.hAlign}`,
|
|
@@ -518,7 +517,7 @@ function printPageHeaders(workbook, sheetIndex, layout, page, title, options) {
|
|
|
518
517
|
return `<img src="${escapeHtml(url)}" alt="" style="width:${width}px;height:${height}px;vertical-align:top">`;
|
|
519
518
|
}
|
|
520
519
|
const css2 = [
|
|
521
|
-
style2.font ? `font-family:${style2.font.replace(/[
|
|
520
|
+
style2.font ? `font-family:${workbookFontFamily(style2.font.replace(/[;<>{}]/g, ""))}` : "",
|
|
522
521
|
style2.size ? `font-size:${style2.size / 11 * size}px` : "",
|
|
523
522
|
style2.color ? `color:${style2.color}` : "",
|
|
524
523
|
`font-weight:${style2.bold ? 700 : 400}`,
|
|
@@ -579,7 +578,7 @@ function buildPrintHtml(workbook, sheetIndex, title, options = {}) {
|
|
|
579
578
|
}).join("");
|
|
580
579
|
return `<!doctype html><html><head><meta charset="utf-8"><title>${escapeHtml(title)}</title><style>
|
|
581
580
|
@page{size:${layout.paperWidth / 96}in ${layout.paperHeight / 96}in;margin:0}
|
|
582
|
-
body{margin:0;background:#e8eaed;font-family:Calibri,sans-serif}.xve-print-page{box-sizing:border-box;background:white;margin:16px auto;box-shadow:0 1px 5px #0003;overflow:hidden;break-after:page}.xve-print-content{position:relative;overflow:hidden}
|
|
581
|
+
body{margin:0;background:#e8eaed;font-family:"Calibri","Carlito",sans-serif}.xve-print-page{box-sizing:border-box;background:white;margin:16px auto;box-shadow:0 1px 5px #0003;overflow:hidden;break-after:page}.xve-print-content{position:relative;overflow:hidden}
|
|
583
582
|
table{border-collapse:collapse;table-layout:fixed}td{overflow:hidden;padding:0 3px;box-sizing:border-box;line-height:1.2}th{box-sizing:border-box;font-size:12px;font-weight:400;color:#444;border:1px solid #ccc;overflow:hidden}
|
|
584
583
|
@media print{body{background:white}.xve-print-page{margin:0;box-shadow:none}.xve-print-page:last-child{break-after:auto}}
|
|
585
584
|
</style></head><body>${pages}</body></html>`;
|
|
@@ -896,6 +895,37 @@ function renderCustomizeRibbon(pane, host) {
|
|
|
896
895
|
pane.replaceChildren(note, reset, ...sections);
|
|
897
896
|
}
|
|
898
897
|
|
|
898
|
+
// src/xlsx/backstage/options-trust.ts
|
|
899
|
+
var FONT_DOWNLOADS_OPTION = "allowFontDownloads";
|
|
900
|
+
function trustCategory(context, locked) {
|
|
901
|
+
const { t } = context;
|
|
902
|
+
return {
|
|
903
|
+
id: "trust",
|
|
904
|
+
label: t("Trust Center"),
|
|
905
|
+
description: t("Help keep your documents safe and secure."),
|
|
906
|
+
sections: [
|
|
907
|
+
{
|
|
908
|
+
id: "trustSettings",
|
|
909
|
+
title: t("Security settings"),
|
|
910
|
+
description: t(
|
|
911
|
+
"These settings help keep the content you open safe. We recommend the defaults."
|
|
912
|
+
),
|
|
913
|
+
controls: [
|
|
914
|
+
{
|
|
915
|
+
kind: "toggle",
|
|
916
|
+
key: FONT_DOWNLOADS_OPTION,
|
|
917
|
+
label: t("Download fonts that are not installed or embedded (Google Fonts)"),
|
|
918
|
+
info: t(
|
|
919
|
+
"When on, your browser contacts fonts.googleapis.com and fonts.gstatic.com (or the font server your organisation set up) to get missing fonts. When off, text uses installed, embedded or substitute fonts, so line breaks can differ from Excel."
|
|
920
|
+
),
|
|
921
|
+
...locked ? { disabled: t("This setting is managed by your organization") } : {}
|
|
922
|
+
}
|
|
923
|
+
]
|
|
924
|
+
}
|
|
925
|
+
]
|
|
926
|
+
};
|
|
927
|
+
}
|
|
928
|
+
|
|
899
929
|
// src/xlsx/backstage/options-dialog.ts
|
|
900
930
|
var LANGUAGES = [
|
|
901
931
|
["en", "English"],
|
|
@@ -918,7 +948,7 @@ var RULE_LABELS = {
|
|
|
918
948
|
};
|
|
919
949
|
var ruleKey = (rule2) => "rule:" + rule2;
|
|
920
950
|
var ITERATION_KEYS = ["iterate", "iterationCount", "iterationDelta"];
|
|
921
|
-
function excelCategories(context) {
|
|
951
|
+
function excelCategories(context, host) {
|
|
922
952
|
const { t } = context;
|
|
923
953
|
return [
|
|
924
954
|
{
|
|
@@ -1058,7 +1088,7 @@ function excelCategories(context) {
|
|
|
1058
1088
|
},
|
|
1059
1089
|
unavailableCategory(context, "qat"),
|
|
1060
1090
|
unavailableCategory(context, "addins"),
|
|
1061
|
-
|
|
1091
|
+
trustCategory(context, host.options().fontDownloadsLocked === true)
|
|
1062
1092
|
];
|
|
1063
1093
|
}
|
|
1064
1094
|
function dialogValues(host) {
|
|
@@ -1071,6 +1101,7 @@ function dialogValues(host) {
|
|
|
1071
1101
|
iterate: Boolean(current.iteration),
|
|
1072
1102
|
iterationCount: current.iteration?.count ?? DEFAULT_ITERATIONS,
|
|
1073
1103
|
iterationDelta: current.iteration?.delta ?? DEFAULT_MAX_CHANGE,
|
|
1104
|
+
[FONT_DOWNLOADS_OPTION]: current.allowFontDownloads ?? FONT_DOWNLOADS_DEFAULT,
|
|
1074
1105
|
...Object.fromEntries(
|
|
1075
1106
|
ERROR_RULES.map((rule2) => [ruleKey(rule2), auditState(host.ctx).rules.includes(rule2)])
|
|
1076
1107
|
)
|
|
@@ -1097,7 +1128,7 @@ function createExcelOptions(host) {
|
|
|
1097
1128
|
const build = () => {
|
|
1098
1129
|
element.setAttribute("heading", ctx.t("Options"));
|
|
1099
1130
|
element.labels = optionsLabels(context);
|
|
1100
|
-
element.categories = excelCategories(context);
|
|
1131
|
+
element.categories = excelCategories(context, host);
|
|
1101
1132
|
element.values = dialogValues(host);
|
|
1102
1133
|
element.defaults = {
|
|
1103
1134
|
theme: "auto",
|
|
@@ -1105,6 +1136,8 @@ function createExcelOptions(host) {
|
|
|
1105
1136
|
iterate: false,
|
|
1106
1137
|
iterationCount: DEFAULT_ITERATIONS,
|
|
1107
1138
|
iterationDelta: DEFAULT_MAX_CHANGE,
|
|
1139
|
+
// A host-locked toggle keeps the host's value.
|
|
1140
|
+
[FONT_DOWNLOADS_OPTION]: host.options().fontDownloadsLocked === true ? host.options().allowFontDownloads === true : FONT_DOWNLOADS_DEFAULT,
|
|
1108
1141
|
...Object.fromEntries(
|
|
1109
1142
|
ERROR_RULES.map((rule2) => [ruleKey(rule2), rule2 !== "empty-cell-reference"])
|
|
1110
1143
|
)
|
|
@@ -1121,6 +1154,8 @@ function createExcelOptions(host) {
|
|
|
1121
1154
|
);
|
|
1122
1155
|
if (changed.some((key) => ITERATION_KEYS.includes(key)))
|
|
1123
1156
|
host.setOption("iteration", iterationOf(values));
|
|
1157
|
+
if (changed.includes(FONT_DOWNLOADS_OPTION) && host.options().fontDownloadsLocked !== true)
|
|
1158
|
+
host.setOption("allowFontDownloads", values[FONT_DOWNLOADS_OPTION] === true);
|
|
1124
1159
|
build();
|
|
1125
1160
|
});
|
|
1126
1161
|
element.addEventListener("office-options-cancel", () => {
|
|
@@ -1776,6 +1811,7 @@ async function loadInto(core, bytes, fileName, chrome, cloud) {
|
|
|
1776
1811
|
core.loading = true;
|
|
1777
1812
|
core.requestRender();
|
|
1778
1813
|
try {
|
|
1814
|
+
core.webfonts.prefetch(bytes);
|
|
1779
1815
|
const { loadWorkbook, isOoxmlCryptoError } = await import('ooxml-core/xlsx/load');
|
|
1780
1816
|
let password;
|
|
1781
1817
|
let workbook;
|
|
@@ -1797,6 +1833,8 @@ async function loadInto(core, bytes, fileName, chrome, cloud) {
|
|
|
1797
1833
|
}
|
|
1798
1834
|
}
|
|
1799
1835
|
if (generation !== core.loadGeneration) return;
|
|
1836
|
+
await core.webfonts.prepare(workbook);
|
|
1837
|
+
if (generation !== core.loadGeneration) return;
|
|
1800
1838
|
showWorkbook(core, workbook, fileName || core.fileName || DEFAULT_FILE_NAME, chrome);
|
|
1801
1839
|
if (cloud) {
|
|
1802
1840
|
core.fileStorage = cloud.storage;
|
|
@@ -15454,6 +15492,10 @@ var DrawingLayer = class {
|
|
|
15454
15492
|
this.#cancelDrag?.();
|
|
15455
15493
|
this.#generation++;
|
|
15456
15494
|
}
|
|
15495
|
+
/** Redraws every drawing on the next paint (text measured again) without ending a drag. */
|
|
15496
|
+
redraw() {
|
|
15497
|
+
this.#generation++;
|
|
15498
|
+
}
|
|
15457
15499
|
#url(partName, contentType) {
|
|
15458
15500
|
const cached = this.#urls.get(partName);
|
|
15459
15501
|
if (cached) return cached;
|
|
@@ -17261,6 +17303,10 @@ function createTextMeasurer(doc) {
|
|
|
17261
17303
|
if (metricsCache.size > 1e4) metricsCache.clear();
|
|
17262
17304
|
metricsCache.set(font, metrics);
|
|
17263
17305
|
return metrics;
|
|
17306
|
+
},
|
|
17307
|
+
clear: () => {
|
|
17308
|
+
cache.clear();
|
|
17309
|
+
metricsCache.clear();
|
|
17264
17310
|
}
|
|
17265
17311
|
};
|
|
17266
17312
|
}
|
|
@@ -19283,6 +19329,11 @@ function mountGrid(ctx, container) {
|
|
|
19283
19329
|
cancelEdit: () => editor.cancel(),
|
|
19284
19330
|
isEditing: () => editor.editing,
|
|
19285
19331
|
measureText: (text3, font) => view.measurer.measure(text3, font),
|
|
19332
|
+
remeasure: () => {
|
|
19333
|
+
view.measurer.clear();
|
|
19334
|
+
drawings.redraw();
|
|
19335
|
+
view.invalidate();
|
|
19336
|
+
},
|
|
19286
19337
|
zoom: () => view.zoom(),
|
|
19287
19338
|
setZoom: (percent) => view.setZoom(percent),
|
|
19288
19339
|
splitAt: (active2) => view.splitAt(active2),
|
|
@@ -20179,7 +20230,7 @@ function renderBand(o, page, kind) {
|
|
|
20179
20230
|
const span = o.doc.createElement("span");
|
|
20180
20231
|
span.textContent = run.text;
|
|
20181
20232
|
const { style: style2 } = run;
|
|
20182
|
-
if (style2.font) span.style.fontFamily = style2.font;
|
|
20233
|
+
if (style2.font) span.style.fontFamily = workbookFontFamily(style2.font);
|
|
20183
20234
|
if (style2.size) span.style.fontSize = `${style2.size / 11 * size}px`;
|
|
20184
20235
|
if (style2.color) span.style.color = style2.color;
|
|
20185
20236
|
if (style2.bold) span.style.fontWeight = "700";
|
|
@@ -20282,7 +20333,7 @@ var PAGE_LAYOUT_CSS = `
|
|
|
20282
20333
|
.xpl-scaled{position:absolute;left:0;top:0;transform-origin:0 0}
|
|
20283
20334
|
.xpl-page{position:absolute;box-sizing:border-box;background:#fff;box-shadow:0 1px 5px rgba(0,0,0,.3)}
|
|
20284
20335
|
.xpl-content{position:absolute;overflow:hidden}
|
|
20285
|
-
.xpl-inner{position:absolute;left:0;top:0;transform-origin:0 0;font-family:Calibri,sans-serif}
|
|
20336
|
+
.xpl-inner{position:absolute;left:0;top:0;transform-origin:0 0;font-family:"Calibri","Carlito",sans-serif}
|
|
20286
20337
|
.xpl-inner table{border-collapse:collapse;table-layout:fixed}
|
|
20287
20338
|
.xpl-inner td{overflow:hidden;padding:0 3px;box-sizing:border-box;line-height:1.2}
|
|
20288
20339
|
.xpl-colhdr,.xpl-rowhdr{position:absolute;box-sizing:border-box;display:flex;align-items:center;justify-content:center;
|
|
@@ -20298,7 +20349,7 @@ var PAGE_LAYOUT_CSS = `
|
|
|
20298
20349
|
.xpl-shade{position:absolute;background:var(--xve-selection, color-mix(in srgb, var(--office-accent, #217346) 12%, transparent))}
|
|
20299
20350
|
.xpl-active{position:absolute;box-sizing:border-box;border:2px solid var(--xve-selection-border, var(--office-accent, #217346))}
|
|
20300
20351
|
.xpl-edit{position:absolute;box-sizing:border-box;z-index:5;border:2px solid var(--xve-selection-border, var(--office-accent, #217346));
|
|
20301
|
-
background:#fff;font-family:Calibri,sans-serif;padding:0 3px;margin:0;outline:none}
|
|
20352
|
+
background:#fff;font-family:"Calibri","Carlito",sans-serif;padding:0 3px;margin:0;outline:none}
|
|
20302
20353
|
.xpl-error{padding:24px;color:#a4262c}
|
|
20303
20354
|
`;
|
|
20304
20355
|
var EIGHTH = 96 / 8;
|
|
@@ -21630,10 +21681,17 @@ function buildShell(core) {
|
|
|
21630
21681
|
theme: core.theme,
|
|
21631
21682
|
author: core.authorName,
|
|
21632
21683
|
calculation: core.calculation,
|
|
21633
|
-
iteration: core.iteration
|
|
21684
|
+
iteration: core.iteration,
|
|
21685
|
+
allowFontDownloads: core.webfonts.allowed(),
|
|
21686
|
+
fontDownloadsLocked: core.webfonts.lock() !== void 0
|
|
21634
21687
|
}),
|
|
21635
21688
|
setOption(key, raw) {
|
|
21636
21689
|
if (key === "iteration") return core.setIterativeCalculation(raw);
|
|
21690
|
+
if (key === "allowFontDownloads") {
|
|
21691
|
+
if (core.webfonts.lock() === void 0) core.webfonts.setReaderAllows(raw === true);
|
|
21692
|
+
return;
|
|
21693
|
+
}
|
|
21694
|
+
if (key === "fontDownloadsLocked") return;
|
|
21637
21695
|
const value = String(raw);
|
|
21638
21696
|
if (key === "locale") element.locale = value;
|
|
21639
21697
|
else if (key === "theme")
|
|
@@ -21953,6 +22011,160 @@ var CalcPreparation = class {
|
|
|
21953
22011
|
}
|
|
21954
22012
|
};
|
|
21955
22013
|
|
|
22014
|
+
// src/xlsx/font-downloads.ts
|
|
22015
|
+
var FONT_DOWNLOADS_KEY = "ooxml.xlsx.allowFontDownloads";
|
|
22016
|
+
var memory2;
|
|
22017
|
+
function readerAllowsFontDownloads() {
|
|
22018
|
+
try {
|
|
22019
|
+
const raw = globalThis.localStorage?.getItem(FONT_DOWNLOADS_KEY);
|
|
22020
|
+
if (raw === "true") return true;
|
|
22021
|
+
if (raw === "false") return false;
|
|
22022
|
+
} catch {
|
|
22023
|
+
}
|
|
22024
|
+
return memory2 ?? FONT_DOWNLOADS_DEFAULT;
|
|
22025
|
+
}
|
|
22026
|
+
function setReaderAllowsFontDownloads(allow) {
|
|
22027
|
+
memory2 = allow;
|
|
22028
|
+
try {
|
|
22029
|
+
globalThis.localStorage?.setItem(FONT_DOWNLOADS_KEY, String(allow));
|
|
22030
|
+
} catch {
|
|
22031
|
+
}
|
|
22032
|
+
}
|
|
22033
|
+
|
|
22034
|
+
// src/xlsx/webfonts.ts
|
|
22035
|
+
var XLSX_WEBFONT_LINK_ID = "xlsx-editor-webfonts";
|
|
22036
|
+
var OFF = { href: null, families: [], unavailable: [], timedOut: false };
|
|
22037
|
+
var instances = 0;
|
|
22038
|
+
var XlsxWebfonts = class {
|
|
22039
|
+
/** The host's `googleFonts` value, as given. */
|
|
22040
|
+
option = void 0;
|
|
22041
|
+
/** This editor's managed `<link>` id (one per editor, so two editors never fight over it). */
|
|
22042
|
+
linkId;
|
|
22043
|
+
#owner;
|
|
22044
|
+
#prepared = /* @__PURE__ */ new WeakMap();
|
|
22045
|
+
#fonts;
|
|
22046
|
+
#queued = false;
|
|
22047
|
+
#onFonts = () => this.schedule();
|
|
22048
|
+
constructor(owner) {
|
|
22049
|
+
this.#owner = owner;
|
|
22050
|
+
instances += 1;
|
|
22051
|
+
this.linkId = instances === 1 ? XLSX_WEBFONT_LINK_ID : `${XLSX_WEBFONT_LINK_ID}-${instances}`;
|
|
22052
|
+
}
|
|
22053
|
+
/** The option the loader uses: the host's value when set, else the reader's choice. */
|
|
22054
|
+
effective() {
|
|
22055
|
+
return effectiveFontDownloads(this.option, readerAllowsFontDownloads());
|
|
22056
|
+
}
|
|
22057
|
+
/** The value the Trust Center toggle shows read-only, or `undefined` when the reader decides. */
|
|
22058
|
+
lock() {
|
|
22059
|
+
return fontDownloadLock(this.option);
|
|
22060
|
+
}
|
|
22061
|
+
/** Whether the Trust Center toggle is on: the host's locked value, else the reader's choice. */
|
|
22062
|
+
allowed() {
|
|
22063
|
+
return this.lock() ?? readerAllowsFontDownloads();
|
|
22064
|
+
}
|
|
22065
|
+
/** The reader's Trust Center choice: stored, and applied to the open workbook at once. */
|
|
22066
|
+
setReaderAllows(allow) {
|
|
22067
|
+
setReaderAllowsFontDownloads(allow);
|
|
22068
|
+
this.apply();
|
|
22069
|
+
}
|
|
22070
|
+
/** The CSS2 base the option requests, or `null` when the fallback is off (the default). */
|
|
22071
|
+
base() {
|
|
22072
|
+
return resolveGoogleFontsCss2Base(this.effective(), null, "xlsx-editor");
|
|
22073
|
+
}
|
|
22074
|
+
/**
|
|
22075
|
+
* After the host value or the reader's choice changed: on, prepare the open workbook's faces
|
|
22076
|
+
* and measure again; off, remove the stylesheets and repaint with installed or substitute fonts.
|
|
22077
|
+
*/
|
|
22078
|
+
apply() {
|
|
22079
|
+
if (this.base() !== null) {
|
|
22080
|
+
this.shown(this.#owner.workbook());
|
|
22081
|
+
return;
|
|
22082
|
+
}
|
|
22083
|
+
this.#off(this.#owner.host.ownerDocument);
|
|
22084
|
+
this.schedule();
|
|
22085
|
+
}
|
|
22086
|
+
/** Removes this editor's links and forgets the waits they served. */
|
|
22087
|
+
#off(doc) {
|
|
22088
|
+
syncGoogleWebfontStylesheet(doc, this.linkId, null);
|
|
22089
|
+
this.#prepared = /* @__PURE__ */ new WeakMap();
|
|
22090
|
+
}
|
|
22091
|
+
/**
|
|
22092
|
+
* Start downloading the faces the file declares before it is parsed (see `prefetchWebfonts`),
|
|
22093
|
+
* so they are usually ready when {@link prepare} waits. Never throws.
|
|
22094
|
+
*/
|
|
22095
|
+
prefetch(bytes) {
|
|
22096
|
+
const doc = this.#owner.host.ownerDocument;
|
|
22097
|
+
if (!doc?.head) return;
|
|
22098
|
+
prefetchWebfonts({ document: doc, linkId: this.linkId, bytes, base: this.base() });
|
|
22099
|
+
}
|
|
22100
|
+
/**
|
|
22101
|
+
* Injects the stylesheet for the workbook's missing fonts and waits (bounded) for their faces.
|
|
22102
|
+
* Off, it removes this editor's link. Never rejects; one wait per workbook and base.
|
|
22103
|
+
*/
|
|
22104
|
+
prepare(workbook) {
|
|
22105
|
+
const doc = this.#owner.host.ownerDocument;
|
|
22106
|
+
const base = this.base();
|
|
22107
|
+
if (base === null) {
|
|
22108
|
+
this.#off(doc);
|
|
22109
|
+
return Promise.resolve(OFF);
|
|
22110
|
+
}
|
|
22111
|
+
const cached = this.#prepared.get(workbook);
|
|
22112
|
+
if (cached?.base === base) return cached.promise;
|
|
22113
|
+
let runs;
|
|
22114
|
+
try {
|
|
22115
|
+
runs = collectWorkbookWebfontRuns(workbook);
|
|
22116
|
+
} catch {
|
|
22117
|
+
return Promise.resolve(OFF);
|
|
22118
|
+
}
|
|
22119
|
+
const entry = { base, settled: false, promise: Promise.resolve(OFF) };
|
|
22120
|
+
entry.promise = prepareWebfonts({ document: doc, linkId: this.linkId, runs, base }).catch(() => OFF).finally(() => {
|
|
22121
|
+
entry.settled = true;
|
|
22122
|
+
});
|
|
22123
|
+
this.#prepared.set(workbook, entry);
|
|
22124
|
+
return entry.promise;
|
|
22125
|
+
}
|
|
22126
|
+
/**
|
|
22127
|
+
* A workbook is on screen (opened, assigned, or the option changed): prepare its faces when
|
|
22128
|
+
* that has not happened yet, and measure again once they arrive.
|
|
22129
|
+
*/
|
|
22130
|
+
shown(workbook) {
|
|
22131
|
+
if (!workbook) {
|
|
22132
|
+
if (this.base() === null) this.#off(this.#owner.host.ownerDocument);
|
|
22133
|
+
return;
|
|
22134
|
+
}
|
|
22135
|
+
const waited = this.#prepared.get(workbook);
|
|
22136
|
+
const ready = waited?.settled === true && waited.base === this.base();
|
|
22137
|
+
void this.prepare(workbook).then((readiness) => {
|
|
22138
|
+
if (!ready && readiness.families.length && this.#owner.workbook() === workbook)
|
|
22139
|
+
this.schedule();
|
|
22140
|
+
});
|
|
22141
|
+
}
|
|
22142
|
+
/** Coalesces face arrivals into one remeasure per frame while connected. */
|
|
22143
|
+
schedule() {
|
|
22144
|
+
if (this.#queued || !this.#owner.host.isConnected) return;
|
|
22145
|
+
this.#queued = true;
|
|
22146
|
+
const view = this.#owner.host.ownerDocument.defaultView;
|
|
22147
|
+
const run = () => {
|
|
22148
|
+
this.#queued = false;
|
|
22149
|
+
if (this.#owner.host.isConnected && this.#owner.workbook()) this.#owner.remeasure();
|
|
22150
|
+
};
|
|
22151
|
+
if (view?.requestAnimationFrame) view.requestAnimationFrame(run);
|
|
22152
|
+
else setTimeout(run, 0);
|
|
22153
|
+
}
|
|
22154
|
+
/** Listens for faces that arrive after the bounded wait (any font the grid draws). */
|
|
22155
|
+
connect() {
|
|
22156
|
+
const fonts = this.#owner.host.ownerDocument.fonts;
|
|
22157
|
+
if (!fonts || typeof fonts.addEventListener !== "function" || this.#fonts === fonts) return;
|
|
22158
|
+
this.disconnect();
|
|
22159
|
+
this.#fonts = fonts;
|
|
22160
|
+
fonts.addEventListener("loadingdone", this.#onFonts);
|
|
22161
|
+
}
|
|
22162
|
+
disconnect() {
|
|
22163
|
+
this.#fonts?.removeEventListener("loadingdone", this.#onFonts);
|
|
22164
|
+
this.#fonts = void 0;
|
|
22165
|
+
}
|
|
22166
|
+
};
|
|
22167
|
+
|
|
21956
22168
|
// src/xlsx/collaboration-session.ts
|
|
21957
22169
|
function createRoomSession(collab, xlsx, options, defaultName) {
|
|
21958
22170
|
return collab.openCollaborationSession(options, {
|
|
@@ -22219,6 +22431,11 @@ var EditorCore = class {
|
|
|
22219
22431
|
});
|
|
22220
22432
|
this.collab = collaborationFor(this);
|
|
22221
22433
|
this.calcPreparation = new CalcPreparation(host, () => !!this.gridController?.isEditing());
|
|
22434
|
+
this.webfonts = new XlsxWebfonts({
|
|
22435
|
+
host,
|
|
22436
|
+
workbook: () => this.workbook,
|
|
22437
|
+
remeasure: () => this.gridController?.remeasure?.()
|
|
22438
|
+
});
|
|
22222
22439
|
}
|
|
22223
22440
|
host;
|
|
22224
22441
|
workbook;
|
|
@@ -22271,6 +22488,8 @@ var EditorCore = class {
|
|
|
22271
22488
|
collab;
|
|
22272
22489
|
/** Builds the formula graph in idle time after a workbook opens. */
|
|
22273
22490
|
calcPreparation;
|
|
22491
|
+
/** The `googleFonts` webfont fallback (off unless the host sets it). */
|
|
22492
|
+
webfonts;
|
|
22274
22493
|
gridController;
|
|
22275
22494
|
modelListeners = /* @__PURE__ */ new Set();
|
|
22276
22495
|
stopSession;
|
|
@@ -22392,6 +22611,7 @@ var EditorCore = class {
|
|
|
22392
22611
|
this.selection.set(initialSelection(this.activeSheet, workbook));
|
|
22393
22612
|
this.dirty.set(false);
|
|
22394
22613
|
this.notifyModel({ kind: "load" });
|
|
22614
|
+
this.webfonts.shown(workbook);
|
|
22395
22615
|
this.collab.resume();
|
|
22396
22616
|
}
|
|
22397
22617
|
createSession(workbook) {
|
|
@@ -22452,7 +22672,7 @@ var EditorCore = class {
|
|
|
22452
22672
|
measureText(text3, font) {
|
|
22453
22673
|
const grid = this.gridController;
|
|
22454
22674
|
if (!grid) return approximateMeasure(text3, font);
|
|
22455
|
-
const css2 = `${font.italic ? "italic " : ""}${font.bold ? "bold " : ""}${font.sizePx}px
|
|
22675
|
+
const css2 = `${font.italic ? "italic " : ""}${font.bold ? "bold " : ""}${font.sizePx}px ${workbookFontFamily(font.family)}`;
|
|
22456
22676
|
return grid.measureText(text3, css2);
|
|
22457
22677
|
}
|
|
22458
22678
|
/** Iterative calculation as the workbook stores it (`calcPr iterate`); undefined when off. */
|
|
@@ -22740,6 +22960,25 @@ var XlsxEditorApi = class extends HTMLElementBase {
|
|
|
22740
22960
|
set storage(value) {
|
|
22741
22961
|
this.core.storage = value ?? void 0;
|
|
22742
22962
|
}
|
|
22963
|
+
/**
|
|
22964
|
+
* Webfont fallback for workbook fonts the reader has neither installed nor embedded. Unset (the
|
|
22965
|
+
* default): the reader decides with File > Options > Trust Center > "Download fonts that are
|
|
22966
|
+
* not installed or embedded", which is off until they turn it on. Set, it is the host's
|
|
22967
|
+
* decision and that toggle is shown read-only: `false` is off (no request leaves the page;
|
|
22968
|
+
* text uses installed or substitute fonts), `{ baseUrl }` requests the fonts the workbook uses
|
|
22969
|
+
* that the bundled Google Fonts catalogue serves (or their metric-compatible clone, such as
|
|
22970
|
+
* Carlito for Calibri) from that CSS2 endpoint (`https://fonts.googleapis.com/css2` for Google,
|
|
22971
|
+
* or a self-hosted mirror) with one `<link>` in the document head, then the font files it
|
|
22972
|
+
* names. Only public catalogue family names are sent, never cell text; an invalid `baseUrl`
|
|
22973
|
+
* warns and stays off. Changing it applies to the open workbook.
|
|
22974
|
+
*/
|
|
22975
|
+
get googleFonts() {
|
|
22976
|
+
return this.core.webfonts.option;
|
|
22977
|
+
}
|
|
22978
|
+
set googleFonts(value) {
|
|
22979
|
+
this.core.webfonts.option = value ?? void 0;
|
|
22980
|
+
this.core.webfonts.apply();
|
|
22981
|
+
}
|
|
22743
22982
|
get loading() {
|
|
22744
22983
|
return this.core.loading;
|
|
22745
22984
|
}
|
|
@@ -22892,6 +23131,7 @@ var XlsxEditorElement = class extends XlsxEditorApi {
|
|
|
22892
23131
|
addIns = [];
|
|
22893
23132
|
connectedCallback() {
|
|
22894
23133
|
installOfficeUiThemeFor(this);
|
|
23134
|
+
this.core.webfonts.connect();
|
|
22895
23135
|
if (this.surfaceOnly) {
|
|
22896
23136
|
this.disposeSurface ??= buildSurface(this.core);
|
|
22897
23137
|
this.core.requestRender();
|
|
@@ -22909,6 +23149,7 @@ var XlsxEditorElement = class extends XlsxEditorApi {
|
|
|
22909
23149
|
if (isXlsxEditorAttribute(name)) applyAttribute(this, name, value);
|
|
22910
23150
|
}
|
|
22911
23151
|
disconnectedCallback() {
|
|
23152
|
+
this.core.webfonts.disconnect();
|
|
22912
23153
|
this.shell?.backstage.destroy();
|
|
22913
23154
|
if (this.disposeSurface) {
|
|
22914
23155
|
this.disposeSurface();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ooxml-ui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.47.0",
|
|
4
4
|
"description": "Shared, format-neutral web components and styles for the Office viewers (Word, PowerPoint, Excel)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"custom-elements",
|
|
@@ -176,7 +176,7 @@
|
|
|
176
176
|
"dompurify": "^3.4.17",
|
|
177
177
|
"emf-converter": "4.25.3",
|
|
178
178
|
"lit": "^3.3.3",
|
|
179
|
-
"ooxml-core": "^1.
|
|
179
|
+
"ooxml-core": "^1.44.0",
|
|
180
180
|
"opentype.js": "^2.0.0",
|
|
181
181
|
"prosemirror-collab": "^1.3.1",
|
|
182
182
|
"prosemirror-commands": "^1.7.2",
|
package/dist/chunk-MWDG776V.js
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import { defineShareDialog, chartSpaceFormatSource, shareDialogLabels } from './chunk-UEFVC6V4.js';
|
|
2
|
-
import { chartExStyleSpace } from 'ooxml-core/chart';
|
|
3
|
-
|
|
4
|
-
// src/dialog/share-controller.ts
|
|
5
|
-
var message = (cause) => cause instanceof Error ? cause.message : String(cause);
|
|
6
|
-
function attachShareDialog(setup) {
|
|
7
|
-
const doc = setup.container.ownerDocument ?? setup.container;
|
|
8
|
-
defineShareDialog(doc.defaultView?.customElements);
|
|
9
|
-
const element = doc.createElement("office-ui-share-dialog");
|
|
10
|
-
element.roomPrefix = setup.roomPrefix;
|
|
11
|
-
const relocalize = () => {
|
|
12
|
-
const locale = setup.locale?.();
|
|
13
|
-
const labels = shareDialogLabels(locale);
|
|
14
|
-
element.labels = labels;
|
|
15
|
-
element.note = setup.note?.(locale) ?? "";
|
|
16
|
-
};
|
|
17
|
-
const refresh = () => {
|
|
18
|
-
element.state = setup.host.state();
|
|
19
|
-
};
|
|
20
|
-
element.addEventListener("office-share-start", (event) => {
|
|
21
|
-
const { options } = event.detail;
|
|
22
|
-
element.error = "";
|
|
23
|
-
try {
|
|
24
|
-
Promise.resolve(setup.host.start(options)).then(refresh).catch((cause) => {
|
|
25
|
-
element.error = message(cause);
|
|
26
|
-
refresh();
|
|
27
|
-
});
|
|
28
|
-
} catch (cause) {
|
|
29
|
-
element.error = message(cause);
|
|
30
|
-
}
|
|
31
|
-
refresh();
|
|
32
|
-
});
|
|
33
|
-
element.addEventListener("office-share-stop", () => {
|
|
34
|
-
element.error = "";
|
|
35
|
-
try {
|
|
36
|
-
setup.host.stop();
|
|
37
|
-
} catch (cause) {
|
|
38
|
-
element.error = message(cause);
|
|
39
|
-
}
|
|
40
|
-
refresh();
|
|
41
|
-
});
|
|
42
|
-
setup.container.append(element);
|
|
43
|
-
relocalize();
|
|
44
|
-
refresh();
|
|
45
|
-
return {
|
|
46
|
-
element,
|
|
47
|
-
open(invitation = "") {
|
|
48
|
-
relocalize();
|
|
49
|
-
refresh();
|
|
50
|
-
element.defaults = setup.defaults?.() ?? {};
|
|
51
|
-
element.invitation = invitation;
|
|
52
|
-
element.error = "";
|
|
53
|
-
element.open = true;
|
|
54
|
-
},
|
|
55
|
-
refresh,
|
|
56
|
-
relocalize,
|
|
57
|
-
destroy() {
|
|
58
|
-
element.remove();
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
// src/files/connected-services-labels.ts
|
|
64
|
-
function connectedServicesLabels(t) {
|
|
65
|
-
return {
|
|
66
|
-
heading: t("Connected services"),
|
|
67
|
-
description: t("Link your storage to open and save files from every app."),
|
|
68
|
-
notConnected: t("Not connected"),
|
|
69
|
-
connect: t("Connect"),
|
|
70
|
-
disconnect: t("Disconnect"),
|
|
71
|
-
managed: t("Managed by your organization"),
|
|
72
|
-
failed: t("Could not update {provider}. Try again.")
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
function chartExSpaceFormatSource(space, theme) {
|
|
76
|
-
const source = chartSpaceFormatSource(chartExStyleSpace(space), {
|
|
77
|
-
...theme ? { theme } : {},
|
|
78
|
-
advanced: true
|
|
79
|
-
});
|
|
80
|
-
const { axisOptions: _axes, seriesOptions: _series, ...common } = source;
|
|
81
|
-
return {
|
|
82
|
-
...common,
|
|
83
|
-
element(target) {
|
|
84
|
-
const view = source.element(target);
|
|
85
|
-
return { ...view, support: { ...view.support, secondaryAxis: false } };
|
|
86
|
-
}
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
export { attachShareDialog, chartExSpaceFormatSource, connectedServicesLabels };
|
|
File without changes
|