ooxml-ui 1.30.0 → 1.32.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 +10 -0
- package/custom-elements.json +4 -0
- package/dist/building-block-styles.d.ts +0 -1
- package/dist/chart/format-pane-3d.d.ts +0 -1
- package/dist/chart/format-pane-analysis.d.ts +0 -1
- package/dist/chart/format-pane-fill-line.d.ts +0 -1
- package/dist/chart/format-pane-text.d.ts +0 -1
- package/dist/{chunk-SBBFNAKM.js → chunk-32P252JS.js} +3 -3
- package/dist/{chunk-E4H3Y7M4.js → chunk-6TS7ASDJ.js} +1 -1
- package/dist/{chunk-BKHWBIXP.js → chunk-CALEXPBD.js} +132 -69
- package/dist/{chunk-SXVOXSTE.js → chunk-CDC5MAZS.js} +1 -1
- package/dist/chunk-DA57FPSN.js +54 -0
- package/dist/{chunk-HNREZW5U.js → chunk-KYXSQFDB.js} +484 -1
- package/dist/{chunk-IE6HKH4X.js → chunk-OKEFAQJT.js} +1 -1
- package/dist/controls.d.ts +6 -0
- package/dist/controls.d.ts.map +1 -1
- package/dist/controls.js +1 -1
- package/dist/dialog/dialog-session.d.ts +19 -0
- package/dist/dialog/dialog-session.d.ts.map +1 -0
- package/dist/docx/smartart-node-view.d.ts +1 -1
- package/dist/docx.js +36 -20
- package/dist/fonts/availability.d.ts +10 -0
- package/dist/fonts/availability.d.ts.map +1 -0
- package/dist/fonts/catalog.d.ts +63 -0
- package/dist/fonts/catalog.d.ts.map +1 -0
- package/dist/fonts/custom-fonts.d.ts +75 -0
- package/dist/fonts/custom-fonts.d.ts.map +1 -0
- package/dist/form/color-input/live-color-input.d.ts +93 -0
- package/dist/form/color-input/live-color-input.d.ts.map +1 -0
- package/dist/form/color-input/live-color-leaves.d.ts +34 -0
- package/dist/form/color-input/live-color-leaves.d.ts.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +6 -5
- package/dist/picture-effects.d.ts +6 -0
- package/dist/pptx/ai/host.cjs +41 -37
- package/dist/pptx/ai/host.d.ts +2 -0
- package/dist/pptx/ai/host.d.ts.map +1 -1
- package/dist/pptx/ai/host.mjs +2 -2
- package/dist/pptx/ai/index.cjs +47 -43
- package/dist/pptx/ai/index.d.ts +2 -0
- package/dist/pptx/ai/index.d.ts.map +1 -1
- package/dist/pptx/ai/index.mjs +3 -3
- package/dist/pptx/{chart-3d-view-scene-ZUGA3DKM.mjs → chart-3d-view-scene-HNL4NWJT.mjs} +2 -2
- package/dist/pptx/{chart-3d-view-scene-N7UQOYFI.cjs → chart-3d-view-scene-OPVBTZL5.cjs} +38 -38
- package/dist/pptx/chunk-3RIGT7H6.cjs +82 -0
- package/dist/pptx/{chunk-D7UYDESZ.mjs → chunk-7DT3UJQB.mjs} +3 -3
- package/dist/pptx/{chunk-KY75GY5O.mjs → chunk-7FXQHSPE.mjs} +6 -24
- package/dist/pptx/{chunk-45OYSCLD.mjs → chunk-CH4Z6H6C.mjs} +581 -230
- package/dist/pptx/{chunk-6KLPQQYP.cjs → chunk-D4LJJ7Z7.cjs} +77 -327
- package/dist/pptx/{chunk-MNSWEXYO.mjs → chunk-DACFW5LO.mjs} +26 -3
- package/dist/pptx/{chunk-IOOI63TH.cjs → chunk-FFWLDANS.cjs} +6 -24
- package/dist/pptx/{chunk-SMMEIEEJ.mjs → chunk-KGDMMWIY.mjs} +1 -1
- package/dist/pptx/{chunk-LXEMMWVI.mjs → chunk-LCCRLB7Q.mjs} +1 -1
- package/dist/pptx/{chunk-BMMTD6PB.cjs → chunk-M55PNMFQ.cjs} +2 -2
- package/dist/pptx/chunk-PM2SOLK3.mjs +79 -0
- package/dist/pptx/{chunk-QX6XPYVA.mjs → chunk-PTIGQSTY.mjs} +31 -14
- package/dist/pptx/{chunk-34LEUH5R.mjs → chunk-RZVEPTLN.mjs} +63 -316
- package/dist/pptx/{chunk-CQYWHRZE.cjs → chunk-S3L5NNCK.cjs} +1 -1
- package/dist/pptx/{chunk-H5IPNKX6.cjs → chunk-S5I64Y55.cjs} +12 -12
- package/dist/pptx/{chunk-WQA3KZRB.mjs → chunk-SPOECCPV.mjs} +1 -1
- package/dist/pptx/{chunk-YMWEU56T.cjs → chunk-TDIJHLS5.cjs} +927 -543
- package/dist/pptx/{chunk-QWF3PGUX.cjs → chunk-VEFFYJGG.cjs} +26 -2
- package/dist/pptx/{chunk-BSGCZ4JZ.cjs → chunk-WBGU7BWD.cjs} +31 -14
- package/dist/pptx/{chunk-2CBK46AW.cjs → chunk-ZS5EVODY.cjs} +48 -48
- package/dist/pptx/dom/index.cjs +431 -430
- package/dist/pptx/dom/index.mjs +15 -14
- package/dist/pptx/export/html2canvas-clone.cjs +6 -6
- package/dist/pptx/export/html2canvas-clone.mjs +1 -1
- package/dist/pptx/index.cjs +3423 -3355
- package/dist/pptx/index.mjs +8 -8
- package/dist/pptx/render/bullet-toggle-selection.d.ts +8 -4
- package/dist/pptx/render/bullet-toggle-selection.d.ts.map +1 -1
- package/dist/pptx/render/chart-box-whisker.d.ts.map +1 -1
- package/dist/pptx/render/chart-combo-stock.cjs +3 -3
- package/dist/pptx/render/chart-combo-stock.mjs +1 -1
- package/dist/pptx/render/chart-data-table-metrics.d.ts +1 -1
- package/dist/pptx/render/chart-data-table-metrics.d.ts.map +1 -1
- package/dist/pptx/render/chart-data-table-render.d.ts.map +1 -1
- package/dist/pptx/render/chart-date-axis.d.ts +1 -1
- package/dist/pptx/render/chart-date-axis.d.ts.map +1 -1
- package/dist/pptx/render/chart-date-format.d.ts +1 -30
- package/dist/pptx/render/chart-date-format.d.ts.map +1 -1
- package/dist/pptx/render/chart-funnel-sunburst.d.ts +1 -1
- package/dist/pptx/render/chart-funnel-sunburst.d.ts.map +1 -1
- package/dist/pptx/render/chart-line-path.d.ts +2 -26
- package/dist/pptx/render/chart-line-path.d.ts.map +1 -1
- package/dist/pptx/render/chart-manual-layout.d.ts +1 -1
- package/dist/pptx/render/chart-manual-layout.d.ts.map +1 -1
- package/dist/pptx/render/chart-overlays.cjs +7 -7
- package/dist/pptx/render/chart-overlays.mjs +1 -1
- package/dist/pptx/render/chart-surface-treemap.cjs +4 -4
- package/dist/pptx/render/chart-surface-treemap.mjs +1 -1
- package/dist/pptx/render/chart-view-model-layout.d.ts.map +1 -1
- package/dist/pptx/render/chart-view-model.cjs +44 -44
- package/dist/pptx/render/chart-view-model.mjs +1 -1
- package/dist/pptx/render/chart-waterfall-map.cjs +6 -6
- package/dist/pptx/render/chart-waterfall-map.mjs +1 -1
- package/dist/pptx/render/controller/ai-assistant.d.ts +73 -0
- package/dist/pptx/render/controller/ai-assistant.d.ts.map +1 -0
- package/dist/pptx/render/controller/autosave-controller.d.ts.map +1 -1
- package/dist/pptx/render/controller/collaboration-history.d.ts +25 -0
- package/dist/pptx/render/controller/collaboration-history.d.ts.map +1 -1
- package/dist/pptx/render/controller/history-controller.d.ts +9 -0
- package/dist/pptx/render/controller/history-controller.d.ts.map +1 -1
- package/dist/pptx/render/controller/index.d.ts +4 -0
- package/dist/pptx/render/controller/index.d.ts.map +1 -1
- package/dist/pptx/render/custom-fonts.cjs +9 -5
- package/dist/pptx/render/custom-fonts.d.ts +1 -64
- package/dist/pptx/render/custom-fonts.d.ts.map +1 -1
- package/dist/pptx/render/custom-fonts.mjs +1 -1
- package/dist/pptx/render/editor-geometry.d.ts +3 -15
- package/dist/pptx/render/editor-geometry.d.ts.map +1 -1
- package/dist/pptx/render/font-availability.d.ts +1 -9
- package/dist/pptx/render/font-availability.d.ts.map +1 -1
- package/dist/pptx/render/font-catalog.cjs +3 -3
- package/dist/pptx/render/font-catalog.d.ts +3 -61
- package/dist/pptx/render/font-catalog.d.ts.map +1 -1
- package/dist/pptx/render/font-catalog.mjs +1 -1
- package/dist/pptx/render/hyperlink-security.cjs +8 -8
- package/dist/pptx/render/hyperlink-security.d.ts +1 -27
- package/dist/pptx/render/hyperlink-security.d.ts.map +1 -1
- package/dist/pptx/render/hyperlink-security.mjs +1 -1
- package/dist/pptx/render/image-effects.d.ts.map +1 -1
- package/dist/pptx/render/index.d.ts +2 -0
- package/dist/pptx/render/index.d.ts.map +1 -1
- package/dist/pptx/render/inline-list-style.d.ts +2 -1
- package/dist/pptx/render/inline-list-style.d.ts.map +1 -1
- package/dist/pptx/render/live-color-input.d.ts +2 -92
- package/dist/pptx/render/live-color-input.d.ts.map +1 -1
- package/dist/pptx/render/live-color-leaves.d.ts +2 -33
- package/dist/pptx/render/live-color-leaves.d.ts.map +1 -1
- package/dist/pptx/render/options/autocorrect.d.ts +15 -2
- package/dist/pptx/render/options/autocorrect.d.ts.map +1 -1
- package/dist/pptx/render/picture-crop/crop-geometry.d.ts +2 -20
- package/dist/pptx/render/picture-crop/crop-geometry.d.ts.map +1 -1
- package/dist/pptx/render/slides-pane-model.d.ts +79 -0
- package/dist/pptx/render/slides-pane-model.d.ts.map +1 -0
- package/dist/pptx/render/table-cell-edit.d.ts +1 -1
- package/dist/pptx/render/table-cell-edit.d.ts.map +1 -1
- package/dist/pptx/render/text-list-style-update.d.ts +23 -2
- package/dist/pptx/render/text-list-style-update.d.ts.map +1 -1
- package/dist/pptx/render/text-script-fonts.d.ts +4 -72
- package/dist/pptx/render/text-script-fonts.d.ts.map +1 -1
- package/dist/pptx/render/text-warp-envelope-block.d.ts +10 -1
- package/dist/pptx/render/text-warp-envelope-block.d.ts.map +1 -1
- package/dist/pptx/render/text-warp-envelope-curves.d.ts +8 -0
- package/dist/pptx/render/text-warp-envelope-curves.d.ts.map +1 -1
- package/dist/pptx/render/text-warp-envelope-layout.d.ts +9 -3
- package/dist/pptx/render/text-warp-envelope-layout.d.ts.map +1 -1
- package/dist/pptx/render/text-warp-envelope-map.d.ts.map +1 -1
- package/dist/pptx/render/text-warp-envelope-wrap.d.ts +29 -0
- package/dist/pptx/render/text-warp-envelope-wrap.d.ts.map +1 -0
- package/dist/pptx/render/text-warp-preset-definitions.d.ts +13 -0
- package/dist/pptx/render/text-warp-preset-definitions.d.ts.map +1 -1
- package/dist/pptx/render/text-warp-preset-sampler.d.ts +12 -0
- package/dist/pptx/render/text-warp-preset-sampler.d.ts.map +1 -1
- package/dist/pptx/render/text-warp.d.ts +3 -2
- package/dist/pptx/render/text-warp.d.ts.map +1 -1
- package/dist/pptx/render/viewer-props-manifest.d.ts.map +1 -1
- package/dist/pptx/{smartart-insert-preview-SKFD7NCQ.mjs → smartart-insert-preview-RQUFRLSV.mjs} +9 -9
- package/dist/pptx/{smartart-insert-preview-7OL7VWEK.cjs → smartart-insert-preview-YKNB37GE.cjs} +10 -10
- package/dist/recovery-scheduler.d.ts +18 -0
- package/dist/recovery-scheduler.d.ts.map +1 -0
- package/dist/smartart/smartart-geometry.d.ts +1 -3
- package/dist/smartart/smartart-paint.d.ts +2 -1
- package/dist/smartart/smartart-picture.d.ts +7 -0
- package/dist/smartart/smartart-svg.d.ts +2 -1
- package/dist/smartart/smartart.d.ts +6 -0
- package/dist/smartart.js +1 -1
- package/dist/teams.js +2 -2
- package/dist/theme-bridge.d.ts +0 -1
- package/dist/theme.d.ts +0 -1
- package/dist/visio/controller.d.ts +2 -2
- package/dist/visio/viewer-autorecover.d.ts +0 -1
- package/dist/visio/viewer-commands.d.ts +1 -1
- package/dist/visio/viewer-guides.d.ts +2 -2
- package/dist/visio/viewer-pointer-gestures.d.ts +1 -1
- package/dist/visio/viewer-resize-frame.d.ts +2 -2
- package/dist/visio/viewer-resize-handles.d.ts +1 -1
- package/dist/visio.js +109 -62
- package/dist/xlsx/grid/smartart.d.ts +1 -1
- package/dist/xlsx.js +91 -62
- package/package.json +2 -2
- package/dist/pptx/chunk-WM5SW737.mjs +0 -27
- package/dist/pptx/chunk-Y6DO6SVT.cjs +0 -29
package/README.md
CHANGED
|
@@ -24,6 +24,16 @@ dependencies are `ooxml-core` (types and a few pure helpers) and `lit`, which ev
|
|
|
24
24
|
> package, which registers them for you. Importing `ooxml-ui` directly is for
|
|
25
25
|
> the viewer packages themselves and for people building their own Office-style UI.
|
|
26
26
|
|
|
27
|
+
Shared behavior helpers are also available to product hosts. `ooxml-ui/controls`
|
|
28
|
+
exports `createLiveColorInput` and its leaf helpers for target-aware preview/commit
|
|
29
|
+
transactions, plus `createDialogSession` for asynchronous submit and dismissal.
|
|
30
|
+
The package root exports font catalogue, availability and custom-font services
|
|
31
|
+
(`buildFontCatalog`, `scanAvailableFontFamilies`, `createFontFaceScope`) and
|
|
32
|
+
`createRecoveryScheduler`. Hosts retain their document model, undo, storage,
|
|
33
|
+
translation and focus-restoration policies. Dispose owned font scopes and sessions
|
|
34
|
+
when the host unmounts. Font selection and script segmentation are DOM-free APIs
|
|
35
|
+
in `ooxml-core/text`.
|
|
36
|
+
|
|
27
37
|
## How the elements are built
|
|
28
38
|
|
|
29
39
|
`office-ui-smartart` accepts `schemeFonts` (`major` and `minor` Latin typefaces)
|
package/custom-elements.json
CHANGED
|
@@ -2,4 +2,3 @@ export type OfficeUiBlockKind = 'toolbar' | 'formula-bar' | 'tabs' | 'inspector'
|
|
|
2
2
|
export type OfficeUiProduct = 'docx' | 'xlsx' | 'visio' | 'pptx';
|
|
3
3
|
/** Opt-in styles for native framework controls. They never target host-owned controls implicitly. */
|
|
4
4
|
export declare const BUILDING_BLOCKS_CSS: string;
|
|
5
|
-
//# sourceMappingURL=building-block-styles.d.ts.map
|
|
@@ -4,4 +4,3 @@ import type { ChartFormatThreeDView } from './format-pane-view.js';
|
|
|
4
4
|
export declare const CHART_BEVEL_TYPES: readonly ['circle', 'relaxedInset', 'cross', 'coolSlant', 'angle', 'softRound', 'convex', 'slope', 'divot', 'riblet', 'hardEdge', 'artDeco'];
|
|
5
5
|
/** The 3-D Format section for an element with `threeD` as its current 3-D settings. */
|
|
6
6
|
export declare function threeDSection(threeD: ChartFormatThreeDView): ChartFormatSection;
|
|
7
|
-
//# sourceMappingURL=format-pane-3d.d.ts.map
|
|
@@ -4,4 +4,3 @@ import type { ChartFormatSeriesOptionsView } from './format-pane-view.js';
|
|
|
4
4
|
export declare function chartAnalysisSections(series: ChartFormatSeriesOptionsView): ChartFormatSection[];
|
|
5
5
|
/** Converts only the selected analysis property, retaining other trendlines, bars and styles. */
|
|
6
6
|
export declare function chartAnalysisFieldIntent(series: ChartFormatSeriesOptionsView | undefined, target: ChartFormatTarget, field: string, value: ChartFormatFieldValue): ChartEditIntent | null | undefined;
|
|
7
|
-
//# sourceMappingURL=format-pane-analysis.d.ts.map
|
|
@@ -10,4 +10,3 @@ import type { ChartFormatElementView, ChartFormatSource } from './format-pane-vi
|
|
|
10
10
|
export declare const ARROWS: Array<[string, string]>;
|
|
11
11
|
/** The Fill & Line tab's sections. */
|
|
12
12
|
export declare function fillLineSections(view: ChartFormatElementView, target: ChartFormatTarget, source?: Pick<ChartFormatSource, 'patternPresets' | 'slots'>): ChartFormatSection[];
|
|
13
|
-
//# sourceMappingURL=format-pane-fill-line.d.ts.map
|
|
@@ -4,4 +4,3 @@ import type { ChartFormatTextView } from './format-pane-view.js';
|
|
|
4
4
|
export declare function chartTextTabs(): ChartFormatTab[];
|
|
5
5
|
/** The sections of Text Options tab `tab`. */
|
|
6
6
|
export declare function textOptionsSections(text: ChartFormatTextView, tab: 'textFill' | 'textEffects' | 'textBox'): ChartFormatSection[];
|
|
7
|
-
//# sourceMappingURL=format-pane-text.d.ts.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { defineSmartArt, defineSmartArtPicker, defineSmartArtTextPane } from './chunk-
|
|
2
|
-
import { TEAMS_TAGS, registerTeams } from './chunk-
|
|
1
|
+
import { defineSmartArt, defineSmartArtPicker, defineSmartArtTextPane } from './chunk-CALEXPBD.js';
|
|
2
|
+
import { TEAMS_TAGS, registerTeams } from './chunk-OKEFAQJT.js';
|
|
3
3
|
import { installOfficeUiTheme } from './chunk-T5ARELU2.js';
|
|
4
|
-
import { registerControls } from './chunk-
|
|
4
|
+
import { registerControls } from './chunk-KYXSQFDB.js';
|
|
5
5
|
import { definePresence } from './chunk-YZH2QS7J.js';
|
|
6
6
|
|
|
7
7
|
// src/index.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { chartSpaceFormatSource } from './chunk-
|
|
1
|
+
import { chartSpaceFormatSource } from './chunk-KYXSQFDB.js';
|
|
2
2
|
import { OfficeElement, controlStyles, flag, emit, definer } from './chunk-QLHCGV4C.js';
|
|
3
3
|
import { html, nothing } from 'lit';
|
|
4
4
|
import { live } from 'lit/directives/live.js';
|
|
@@ -3,56 +3,11 @@ import { OfficeElement, controlStyles, definer } from './chunk-QLHCGV4C.js';
|
|
|
3
3
|
import { html, nothing } from 'lit';
|
|
4
4
|
import { hexToRgbChannels } from 'ooxml-core/color';
|
|
5
5
|
import { resolveDrawingColor, buildRectPathGradientSvg, DIAGRAM_COLOR_SECTIONS, DIAGRAM_COLOR_ENTRIES, DIAGRAM_STYLE_ENTRIES, diagramDesignEdit, diagramNodeOutline } from 'ooxml-core/diagram';
|
|
6
|
-
import { evaluatePresetShape,
|
|
6
|
+
import { evaluatePresetShape, imageRectFromCrop } from 'ooxml-core/geometry';
|
|
7
|
+
import { drawingPathData, resolveDrawingOuterShadow, pictureLuminanceTransfer } from 'ooxml-core/drawingml';
|
|
7
8
|
import { wrapStyledRuns, designTextWidthEm } from 'ooxml-core/text';
|
|
8
|
-
import { resolveDrawingOuterShadow } from 'ooxml-core/drawingml';
|
|
9
9
|
|
|
10
10
|
var SVG_NS = "http://www.w3.org/2000/svg";
|
|
11
|
-
function drawingPathData(path, width, height) {
|
|
12
|
-
const sx = path.width ? width / path.width : 1;
|
|
13
|
-
const sy = path.height ? height / path.height : 1;
|
|
14
|
-
const out = [];
|
|
15
|
-
let px = 0;
|
|
16
|
-
let py = 0;
|
|
17
|
-
let startX = 0;
|
|
18
|
-
let startY = 0;
|
|
19
|
-
for (const command of path.commands) {
|
|
20
|
-
if (command.op === "A") {
|
|
21
|
-
const arc = ooxmlArcToSvg(
|
|
22
|
-
command.wR * sx,
|
|
23
|
-
command.hR * sy,
|
|
24
|
-
command.startAngle * 6e4,
|
|
25
|
-
command.swingAngle * 6e4,
|
|
26
|
-
px,
|
|
27
|
-
py
|
|
28
|
-
);
|
|
29
|
-
if (arc) {
|
|
30
|
-
out.push(arc.svg);
|
|
31
|
-
px = arc.endX;
|
|
32
|
-
py = arc.endY;
|
|
33
|
-
}
|
|
34
|
-
} else if (command.op === "Z") {
|
|
35
|
-
out.push("Z");
|
|
36
|
-
px = startX;
|
|
37
|
-
py = startY;
|
|
38
|
-
} else {
|
|
39
|
-
px = command.x * sx;
|
|
40
|
-
py = command.y * sy;
|
|
41
|
-
if (command.op === "M" || command.op === "L") {
|
|
42
|
-
out.push(`${command.op}${px} ${py}`);
|
|
43
|
-
if (command.op === "M") {
|
|
44
|
-
startX = px;
|
|
45
|
-
startY = py;
|
|
46
|
-
}
|
|
47
|
-
} else if (command.op === "C")
|
|
48
|
-
out.push(
|
|
49
|
-
`C${command.x1 * sx} ${command.y1 * sy} ${command.x2 * sx} ${command.y2 * sy} ${px} ${py}`
|
|
50
|
-
);
|
|
51
|
-
else if (command.op === "Q") out.push(`Q${command.x1 * sx} ${command.y1 * sy} ${px} ${py}`);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
return out.join(" ");
|
|
55
|
-
}
|
|
56
11
|
function diagramShapeElement(doc, shape, approximated) {
|
|
57
12
|
const width = shape.frame.width / 9525;
|
|
58
13
|
const height = shape.frame.height / 9525;
|
|
@@ -95,25 +50,117 @@ function diagramShapeElement(doc, shape, approximated) {
|
|
|
95
50
|
}
|
|
96
51
|
var NS = "http://www.w3.org/2000/svg";
|
|
97
52
|
var serial = 0;
|
|
98
|
-
function
|
|
53
|
+
function pictureEffectFilter(doc, defs, effects) {
|
|
54
|
+
const filter = doc.createElementNS(NS, "filter");
|
|
55
|
+
filter.id = `office-picture-effects-${++serial}`;
|
|
56
|
+
filter.setAttribute("color-interpolation-filters", "sRGB");
|
|
57
|
+
const unapplied = [];
|
|
58
|
+
for (const effect of effects) {
|
|
59
|
+
if (effect.kind === "unsupported") {
|
|
60
|
+
unapplied.push(effect.name);
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
if (effect.kind === "grayscale") {
|
|
64
|
+
const node = doc.createElementNS(NS, "feColorMatrix");
|
|
65
|
+
node.setAttribute("type", "saturate");
|
|
66
|
+
node.setAttribute("values", "0");
|
|
67
|
+
filter.append(node);
|
|
68
|
+
} else {
|
|
69
|
+
const transfer = doc.createElementNS(NS, "feComponentTransfer");
|
|
70
|
+
if (effect.kind === "alphaModFix") {
|
|
71
|
+
const channel = doc.createElementNS(NS, "feFuncA");
|
|
72
|
+
channel.setAttribute("type", "linear");
|
|
73
|
+
channel.setAttribute("slope", String(effect.amount));
|
|
74
|
+
transfer.append(channel);
|
|
75
|
+
} else {
|
|
76
|
+
const { slope, intercept } = pictureLuminanceTransfer(effect.brightness, effect.contrast);
|
|
77
|
+
for (const name of ["R", "G", "B"]) {
|
|
78
|
+
const channel = doc.createElementNS(NS, `feFunc${name}`);
|
|
79
|
+
channel.setAttribute("type", "linear");
|
|
80
|
+
channel.setAttribute("slope", String(slope));
|
|
81
|
+
channel.setAttribute("intercept", String(intercept));
|
|
82
|
+
transfer.append(channel);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
filter.append(transfer);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
if (!filter.childNodes.length) return { unapplied };
|
|
89
|
+
defs.append(filter);
|
|
90
|
+
return { filter: `url(#${filter.id})`, unapplied };
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// src/smartart/smartart-picture.ts
|
|
94
|
+
var NS2 = "http://www.w3.org/2000/svg";
|
|
95
|
+
var serial2 = 0;
|
|
96
|
+
function diagramPictureFill(doc, defs, fill, part, resolve, report) {
|
|
97
|
+
const fail = (reason) => {
|
|
98
|
+
const key = `picture:${reason}`;
|
|
99
|
+
if (!report.approximatedFills.includes(key)) report.approximatedFills.push(key);
|
|
100
|
+
return void 0;
|
|
101
|
+
};
|
|
102
|
+
if (fill.unsupportedPicture?.length) return fail(fill.unsupportedPicture.join(","));
|
|
103
|
+
if (fill.linkRelId && !fill.relId) return fail("external");
|
|
104
|
+
if (!part || !resolve) return fail("unresolved");
|
|
105
|
+
const url = resolve(part);
|
|
106
|
+
if (!url) return fail("missing-media");
|
|
107
|
+
const crop = { cropLeft: 0, cropTop: 0, cropRight: 0, cropBottom: 0, ...fill.crop };
|
|
108
|
+
if (1 - crop.cropLeft - crop.cropRight <= 0 || 1 - crop.cropTop - crop.cropBottom <= 0)
|
|
109
|
+
return fail("invalid-crop");
|
|
110
|
+
const rect2 = imageRectFromCrop({ x: 0, y: 0, width: 1, height: 1 }, crop);
|
|
111
|
+
const pattern = doc.createElementNS(NS2, "pattern");
|
|
112
|
+
pattern.id = `office-smartart-picture-${++serial2}`;
|
|
113
|
+
pattern.setAttribute("width", "1");
|
|
114
|
+
pattern.setAttribute("height", "1");
|
|
115
|
+
pattern.setAttribute("patternContentUnits", "objectBoundingBox");
|
|
116
|
+
const image = doc.createElementNS(NS2, "image");
|
|
117
|
+
for (const key of ["x", "y", "width", "height"])
|
|
118
|
+
image.setAttribute(key, String(rect2[key]));
|
|
119
|
+
image.setAttribute("href", url);
|
|
120
|
+
image.setAttribute("preserveAspectRatio", "none");
|
|
121
|
+
const effects = pictureEffectFilter(doc, defs, fill.effects ?? []);
|
|
122
|
+
if (effects.filter) image.setAttribute("filter", effects.filter);
|
|
123
|
+
if (effects.unapplied.length)
|
|
124
|
+
report.unappliedEffects = [
|
|
125
|
+
.../* @__PURE__ */ new Set([
|
|
126
|
+
...report.unappliedEffects ?? [],
|
|
127
|
+
...effects.unapplied.map((name) => `picture:${name}`)
|
|
128
|
+
])
|
|
129
|
+
];
|
|
130
|
+
pattern.append(image);
|
|
131
|
+
defs.append(pattern);
|
|
132
|
+
return `url(#${pattern.id})`;
|
|
133
|
+
}
|
|
134
|
+
var NS3 = "http://www.w3.org/2000/svg";
|
|
135
|
+
var serial3 = 0;
|
|
136
|
+
function diagramFill(doc, defs, fill, scheme, report, pictureParts = {}, resolvePicture) {
|
|
99
137
|
if (!fill || fill.kind === "none") return "none";
|
|
100
138
|
if (fill.kind === "solid") return colorToCss(fill.color, scheme, report) ?? "none";
|
|
139
|
+
if (fill.kind === "picture")
|
|
140
|
+
return diagramPictureFill(
|
|
141
|
+
doc,
|
|
142
|
+
defs,
|
|
143
|
+
fill,
|
|
144
|
+
fill.relId ? pictureParts[fill.relId] : void 0,
|
|
145
|
+
resolvePicture,
|
|
146
|
+
report
|
|
147
|
+
) ?? "#d1d5db";
|
|
101
148
|
if (fill.kind !== "gradient") {
|
|
102
149
|
if (!report.approximatedFills.includes(fill.kind)) report.approximatedFills.push(fill.kind);
|
|
103
150
|
return "#d1d5db";
|
|
104
151
|
}
|
|
105
|
-
const id = `office-smartart-paint-${++
|
|
152
|
+
const id = `office-smartart-paint-${++serial3}`;
|
|
106
153
|
if (fill.path === "rect") {
|
|
107
154
|
const stops = fill.stops.flatMap((stop) => {
|
|
108
155
|
const color = resolveDrawingColor(stop.color, { scheme: (name) => scheme[name] });
|
|
109
156
|
return color ? [{ position: stop.position, color: color.hex, opacity: color.alpha }] : [];
|
|
110
157
|
});
|
|
111
|
-
const pattern = doc.createElementNS(
|
|
158
|
+
const pattern = doc.createElementNS(NS3, "pattern");
|
|
112
159
|
pattern.id = id;
|
|
113
160
|
pattern.setAttribute("width", "1");
|
|
114
161
|
pattern.setAttribute("height", "1");
|
|
115
162
|
pattern.setAttribute("patternContentUnits", "objectBoundingBox");
|
|
116
|
-
const image = doc.createElementNS(
|
|
163
|
+
const image = doc.createElementNS(NS3, "image");
|
|
117
164
|
image.setAttribute("width", "1");
|
|
118
165
|
image.setAttribute("height", "1");
|
|
119
166
|
image.setAttribute("preserveAspectRatio", "none");
|
|
@@ -126,7 +173,7 @@ function diagramFill(doc, defs, fill, scheme, report) {
|
|
|
126
173
|
return `url(#${id})`;
|
|
127
174
|
}
|
|
128
175
|
const radial = Boolean(fill.path);
|
|
129
|
-
const gradient = doc.createElementNS(
|
|
176
|
+
const gradient = doc.createElementNS(NS3, radial ? "radialGradient" : "linearGradient");
|
|
130
177
|
gradient.id = id;
|
|
131
178
|
if (radial) {
|
|
132
179
|
const rect2 = fill.fillToRect;
|
|
@@ -145,7 +192,7 @@ function diagramFill(doc, defs, fill, scheme, report) {
|
|
|
145
192
|
gradient.setAttribute("y2", String(0.5 + dy));
|
|
146
193
|
}
|
|
147
194
|
for (const stop of fill.stops) {
|
|
148
|
-
const element = doc.createElementNS(
|
|
195
|
+
const element = doc.createElementNS(NS3, "stop");
|
|
149
196
|
element.setAttribute("offset", `${stop.position}%`);
|
|
150
197
|
element.setAttribute("stop-color", colorToCss(stop.color, scheme, report) ?? "#808080");
|
|
151
198
|
gradient.append(element);
|
|
@@ -153,7 +200,7 @@ function diagramFill(doc, defs, fill, scheme, report) {
|
|
|
153
200
|
defs.append(gradient);
|
|
154
201
|
return `url(#${id})`;
|
|
155
202
|
}
|
|
156
|
-
var
|
|
203
|
+
var NS4 = "http://www.w3.org/2000/svg";
|
|
157
204
|
function runStyle(element, run, fonts, scheme, report) {
|
|
158
205
|
if (run.sizePt !== void 0) element.setAttribute("font-size", String(run.sizePt * 96 / 72));
|
|
159
206
|
if (run.bold !== void 0) element.setAttribute("font-weight", run.bold ? "700" : "400");
|
|
@@ -211,7 +258,7 @@ function diagramTextElement(doc, shape, scheme, fonts, report) {
|
|
|
211
258
|
});
|
|
212
259
|
const first = paragraphs[0]?.runs[0];
|
|
213
260
|
const size = (first?.sizePt ?? 12) * 96 / 72;
|
|
214
|
-
const text = doc.createElementNS(
|
|
261
|
+
const text = doc.createElementNS(NS4, "text");
|
|
215
262
|
text.setAttribute("x", String(ox + w / 2));
|
|
216
263
|
text.setAttribute("y", String(oy + h / 2));
|
|
217
264
|
text.setAttribute("text-anchor", "middle");
|
|
@@ -226,6 +273,8 @@ function diagramTextElement(doc, shape, scheme, fonts, report) {
|
|
|
226
273
|
if (inherited) text.setAttribute("font-family", inherited);
|
|
227
274
|
if (first) runStyle(text, first, fonts, scheme, report);
|
|
228
275
|
const body = shape.body?.bodyProperties;
|
|
276
|
+
if (body?.scene3d || body?.shape3d)
|
|
277
|
+
report.approximatedText = [.../* @__PURE__ */ new Set([...report.approximatedText ?? [], "3d"])];
|
|
229
278
|
if (body && (body.vertical && body.vertical !== "horz" || body.rotation || (body.columnCount ?? 1) > 1))
|
|
230
279
|
report.approximatedText = [
|
|
231
280
|
.../* @__PURE__ */ new Set([...report.approximatedText ?? [], "vertical-or-multicolumn"])
|
|
@@ -251,7 +300,7 @@ function diagramTextElement(doc, shape, scheme, fonts, report) {
|
|
|
251
300
|
let y = anchor === "t" ? contentY : anchor === "b" ? contentY + contentHeight - totalHeight : contentY + (contentHeight - totalHeight) / 2;
|
|
252
301
|
paragraphs.forEach((paragraph, index) => {
|
|
253
302
|
if (paragraph.separatorBefore) text.append(doc.createTextNode(paragraph.separatorBefore));
|
|
254
|
-
const line2 = doc.createElementNS(
|
|
303
|
+
const line2 = doc.createElementNS(NS4, "tspan");
|
|
255
304
|
const align = paragraph.align;
|
|
256
305
|
const x = align === "l" ? contentX : align === "r" ? contentX + contentWidth : contentX + contentWidth / 2;
|
|
257
306
|
const height = heights[index] ?? { line: size, before: 0, after: 0 };
|
|
@@ -260,7 +309,7 @@ function diagramTextElement(doc, shape, scheme, fonts, report) {
|
|
|
260
309
|
line2.setAttribute("y", String(y + height.line / 2));
|
|
261
310
|
line2.setAttribute("text-anchor", align === "l" ? "start" : align === "r" ? "end" : "middle");
|
|
262
311
|
for (const run of paragraph.runs) {
|
|
263
|
-
const span = doc.createElementNS(
|
|
312
|
+
const span = doc.createElementNS(NS4, "tspan");
|
|
264
313
|
span.textContent = run.text;
|
|
265
314
|
runStyle(
|
|
266
315
|
span,
|
|
@@ -276,8 +325,8 @@ function diagramTextElement(doc, shape, scheme, fonts, report) {
|
|
|
276
325
|
});
|
|
277
326
|
return text;
|
|
278
327
|
}
|
|
279
|
-
var
|
|
280
|
-
var
|
|
328
|
+
var NS5 = "http://www.w3.org/2000/svg";
|
|
329
|
+
var serial4 = 0;
|
|
281
330
|
function diagramEffects(doc, defs, body, shape, scheme, report) {
|
|
282
331
|
for (const effect of shape.effects?.effects ?? []) {
|
|
283
332
|
const shadow = effect.kind === "outerShadow" ? resolveDrawingOuterShadow(effect, { scheme: (name) => scheme[name] }) : void 0;
|
|
@@ -285,8 +334,8 @@ function diagramEffects(doc, defs, body, shape, scheme, report) {
|
|
|
285
334
|
report.unappliedEffects = [.../* @__PURE__ */ new Set([...report.unappliedEffects ?? [], effect.kind])];
|
|
286
335
|
continue;
|
|
287
336
|
}
|
|
288
|
-
const filter = doc.createElementNS(
|
|
289
|
-
filter.id = `office-smartart-shadow-${++
|
|
337
|
+
const filter = doc.createElementNS(NS5, "filter");
|
|
338
|
+
filter.id = `office-smartart-shadow-${++serial4}`;
|
|
290
339
|
filter.setAttribute("filterUnits", "userSpaceOnUse");
|
|
291
340
|
const pad = Math.max(
|
|
292
341
|
shadow.blur * 3 + Math.abs(shadow.dx),
|
|
@@ -298,7 +347,7 @@ function diagramEffects(doc, defs, body, shape, scheme, report) {
|
|
|
298
347
|
filter.setAttribute("width", String(shape.frame.width / 9525 + pad * 2));
|
|
299
348
|
filter.setAttribute("height", String(shape.frame.height / 9525 + pad * 2));
|
|
300
349
|
filter.setAttribute("color-interpolation-filters", "sRGB");
|
|
301
|
-
const drop = doc.createElementNS(
|
|
350
|
+
const drop = doc.createElementNS(NS5, "feDropShadow");
|
|
302
351
|
drop.setAttribute("dx", String(shadow.dx));
|
|
303
352
|
drop.setAttribute("dy", String(shadow.dy));
|
|
304
353
|
drop.setAttribute("stdDeviation", String(shadow.blur / 2));
|
|
@@ -331,7 +380,7 @@ function colorToCss(color, scheme, report) {
|
|
|
331
380
|
if (color.kind === "system" && !color.fallback) return void 0;
|
|
332
381
|
return "#9ca3af";
|
|
333
382
|
}
|
|
334
|
-
function renderDiagramDrawing(doc, drawing, scheme = {}, fonts = {}) {
|
|
383
|
+
function renderDiagramDrawing(doc, drawing, scheme = {}, fonts = {}, resolvePicture) {
|
|
335
384
|
const report = {
|
|
336
385
|
shapeCount: drawing.shapes.length,
|
|
337
386
|
approximatedGeometries: [],
|
|
@@ -360,9 +409,20 @@ function renderDiagramDrawing(doc, drawing, scheme = {}, fonts = {}) {
|
|
|
360
409
|
}
|
|
361
410
|
group.setAttribute("transform", transform.join(" "));
|
|
362
411
|
const body = diagramShapeElement(doc, shape, report.approximatedGeometries);
|
|
363
|
-
body.setAttribute(
|
|
412
|
+
body.setAttribute(
|
|
413
|
+
"fill",
|
|
414
|
+
diagramFill(doc, defs, shape.fill, scheme, report, drawing.pictureParts, resolvePicture)
|
|
415
|
+
);
|
|
364
416
|
diagramEffects(doc, defs, body, shape, scheme, report);
|
|
365
|
-
const stroke = shape.line?.fill && shape.line.widthEmu !== 0 ? diagramFill(
|
|
417
|
+
const stroke = shape.line?.fill && shape.line.widthEmu !== 0 ? diagramFill(
|
|
418
|
+
doc,
|
|
419
|
+
defs,
|
|
420
|
+
shape.line.fill,
|
|
421
|
+
scheme,
|
|
422
|
+
report,
|
|
423
|
+
drawing.pictureParts,
|
|
424
|
+
resolvePicture
|
|
425
|
+
) : void 0;
|
|
366
426
|
body.setAttribute("stroke", stroke ?? "none");
|
|
367
427
|
if (stroke)
|
|
368
428
|
body.setAttribute(
|
|
@@ -392,6 +452,7 @@ var OfficeUiSmartArt = class extends OfficeElement {
|
|
|
392
452
|
drawing: { attribute: false },
|
|
393
453
|
schemeColors: { attribute: false },
|
|
394
454
|
schemeFonts: { attribute: false },
|
|
455
|
+
pictureResolver: { attribute: false },
|
|
395
456
|
label: { type: String }
|
|
396
457
|
};
|
|
397
458
|
figure;
|
|
@@ -401,6 +462,7 @@ var OfficeUiSmartArt = class extends OfficeElement {
|
|
|
401
462
|
this.drawing = void 0;
|
|
402
463
|
this.schemeColors = {};
|
|
403
464
|
this.schemeFonts = {};
|
|
465
|
+
this.pictureResolver = void 0;
|
|
404
466
|
this.label = null;
|
|
405
467
|
}
|
|
406
468
|
/** The report of the last render (undefined while empty). */
|
|
@@ -409,7 +471,7 @@ var OfficeUiSmartArt = class extends OfficeElement {
|
|
|
409
471
|
}
|
|
410
472
|
/** The SVG is rebuilt only when the drawing or the scheme colours change. */
|
|
411
473
|
willUpdate(changed) {
|
|
412
|
-
if (changed.has("drawing") || changed.has("schemeColors") || changed.has("schemeFonts")) {
|
|
474
|
+
if (changed.has("drawing") || changed.has("schemeColors") || changed.has("schemeFonts") || changed.has("pictureResolver")) {
|
|
413
475
|
if (!this.drawing || this.drawing.shapes.length === 0) {
|
|
414
476
|
this.figure = void 0;
|
|
415
477
|
this.lastReport = void 0;
|
|
@@ -418,7 +480,8 @@ var OfficeUiSmartArt = class extends OfficeElement {
|
|
|
418
480
|
this.ownerDocument,
|
|
419
481
|
this.drawing,
|
|
420
482
|
this.schemeColors,
|
|
421
|
-
this.schemeFonts
|
|
483
|
+
this.schemeFonts,
|
|
484
|
+
this.pictureResolver
|
|
422
485
|
);
|
|
423
486
|
svg.setAttribute("role", "img");
|
|
424
487
|
this.figure = svg;
|
|
@@ -428,7 +491,7 @@ var OfficeUiSmartArt = class extends OfficeElement {
|
|
|
428
491
|
this.figure?.setAttribute("aria-label", this.label ?? "Diagram");
|
|
429
492
|
}
|
|
430
493
|
updated(changed) {
|
|
431
|
-
if (this.lastReport && (changed.has("drawing") || changed.has("schemeColors") || changed.has("schemeFonts")))
|
|
494
|
+
if (this.lastReport && (changed.has("drawing") || changed.has("schemeColors") || changed.has("schemeFonts") || changed.has("pictureResolver")))
|
|
432
495
|
this.fire("office-smartart-render", this.lastReport);
|
|
433
496
|
}
|
|
434
497
|
render() {
|
|
@@ -1168,4 +1231,4 @@ var SmartArtTextPaneController = class {
|
|
|
1168
1231
|
}
|
|
1169
1232
|
};
|
|
1170
1233
|
|
|
1171
|
-
export { OfficeUiSmartArt, OfficeUiSmartArtPicker, OfficeUiSmartArtTextPane, SmartArtTextPaneController, defineSmartArt, defineSmartArtPicker, defineSmartArtTextPane, renderDiagramDrawing, safeColor, smartArtColorsGalleryState, smartArtLayoutTileSvg, smartArtStylesGalleryState, smartArtTileSvg, svgTile };
|
|
1234
|
+
export { OfficeUiSmartArt, OfficeUiSmartArtPicker, OfficeUiSmartArtTextPane, SmartArtTextPaneController, defineSmartArt, defineSmartArtPicker, defineSmartArtTextPane, pictureEffectFilter, renderDiagramDrawing, safeColor, smartArtColorsGalleryState, smartArtLayoutTileSvg, smartArtStylesGalleryState, smartArtTileSvg, svgTile };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineRibbonGroup, defineRibbonStack, defineButton, defineMenuItem, defineMenuButton } from './chunk-
|
|
1
|
+
import { defineRibbonGroup, defineRibbonStack, defineButton, defineMenuItem, defineMenuButton } from './chunk-KYXSQFDB.js';
|
|
2
2
|
import { acceptedRibbonAddIns, findRibbonAddInCommand, RIBBON_ADD_IN_EVENT } from 'ooxml-core/ribbon';
|
|
3
3
|
export { RIBBON_ADD_IN_EVENT } from 'ooxml-core/ribbon';
|
|
4
4
|
import { sameRenderer, sameRegionContext, hostBackstagePageId, acceptedHostBackstagePages, placeHostBackstagePages, hostBackstageItemId, withHostMenuCommands, isHostMenuEntry, resolveHostMenuCommands, withoutHiddenEntries, hostBackstageRegionId } from 'ooxml-core/embedding';
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// src/recovery-scheduler.ts
|
|
2
|
+
function createRecoveryScheduler(options) {
|
|
3
|
+
const timers = options.timers ?? {
|
|
4
|
+
set: (handler, ms) => setTimeout(handler, ms),
|
|
5
|
+
clear: (id) => clearTimeout(id)
|
|
6
|
+
};
|
|
7
|
+
let timer;
|
|
8
|
+
let armed = false;
|
|
9
|
+
let epoch = 0;
|
|
10
|
+
let disposed = false;
|
|
11
|
+
let inFlight;
|
|
12
|
+
const clear = () => {
|
|
13
|
+
++epoch;
|
|
14
|
+
if (armed) timers.clear(timer);
|
|
15
|
+
armed = false;
|
|
16
|
+
};
|
|
17
|
+
return {
|
|
18
|
+
clear,
|
|
19
|
+
arm(delayMs) {
|
|
20
|
+
clear();
|
|
21
|
+
if (disposed) return;
|
|
22
|
+
armed = true;
|
|
23
|
+
const generation = epoch;
|
|
24
|
+
timer = timers.set(() => {
|
|
25
|
+
if (disposed || epoch !== generation) return;
|
|
26
|
+
if (!options.repeating) armed = false;
|
|
27
|
+
options.tick();
|
|
28
|
+
}, delayMs);
|
|
29
|
+
},
|
|
30
|
+
/** Re-read live product state only once earlier writes have completed. */
|
|
31
|
+
async run(write) {
|
|
32
|
+
while (inFlight) {
|
|
33
|
+
try {
|
|
34
|
+
await inFlight;
|
|
35
|
+
} catch {
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
if (disposed) return;
|
|
39
|
+
const pending = write();
|
|
40
|
+
inFlight = pending;
|
|
41
|
+
try {
|
|
42
|
+
return await pending;
|
|
43
|
+
} finally {
|
|
44
|
+
inFlight = void 0;
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
dispose() {
|
|
48
|
+
disposed = true;
|
|
49
|
+
clear();
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export { createRecoveryScheduler };
|