ooxml-ui 0.31.0 → 1.0.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 +14 -0
- package/custom-elements.json +10 -0
- package/dist/{chunk-RAZAJMHK.js → chunk-4QQASR5A.js} +2 -2
- package/dist/{chunk-HZ422LTR.js → chunk-BOX43CZD.js} +1 -0
- package/dist/{chunk-3GE2NHNG.js → chunk-FLHM5Q4O.js} +119 -81
- package/dist/{chunk-2QW4QE56.js → chunk-T3HB5LMH.js} +103 -68
- package/dist/controls.js +2 -2
- package/dist/docx/hard-break-command.d.ts +1 -3
- package/dist/docx/link-commands.d.ts +4 -15
- package/dist/docx/note-editor.d.ts +3 -2
- package/dist/docx/run-styles.d.ts +1 -1
- package/dist/docx/schema.d.ts +1 -1
- package/dist/docx/toggle-commands.d.ts +2 -8
- package/dist/docx.js +109 -302
- package/dist/form/gradient-direction-gallery.d.ts +19 -0
- package/dist/form/gradient-gallery-preview.d.ts +3 -0
- package/dist/form/gradient-preset-gallery.d.ts +16 -0
- package/dist/form/gradient-stop-track.d.ts +20 -0
- package/dist/form/number-range.d.ts +12 -0
- package/dist/icons.d.ts.map +1 -1
- package/dist/icons.js +1 -1
- package/dist/index.js +4 -4
- package/dist/menu/menu-button.d.ts +10 -0
- package/dist/menu/menu-button.d.ts.map +1 -1
- package/dist/pptx/{chart-3d-view-scene-IANLDFIE.mjs → chart-3d-view-scene-2KRQ5667.mjs} +2 -2
- package/dist/pptx/{chart-3d-view-scene-3DK5TUBZ.cjs → chart-3d-view-scene-36DMZWZ3.cjs} +37 -37
- package/dist/pptx/{chunk-C42ZL35K.mjs → chunk-ADOC5JLI.mjs} +1 -1
- package/dist/pptx/{chunk-QM4FGZG4.cjs → chunk-AIL3BNZS.cjs} +31 -131
- package/dist/pptx/{chunk-WLETAW3T.cjs → chunk-CJU4P5FT.cjs} +33 -13
- package/dist/pptx/{chunk-6SCK57RJ.cjs → chunk-FEFQTZDM.cjs} +158 -245
- package/dist/pptx/{chunk-EVGSFPUV.mjs → chunk-XWE5GSE7.mjs} +16 -109
- package/dist/pptx/{chunk-7JEMQW6R.mjs → chunk-YARCML7O.mjs} +11 -122
- package/dist/pptx/{chunk-OHE5UXST.cjs → chunk-YHA6XAB3.cjs} +1 -1
- package/dist/pptx/{chunk-X2F6PA2D.mjs → chunk-YOGDIDPB.mjs} +22 -3
- package/dist/pptx/dom/index.cjs +235 -235
- package/dist/pptx/dom/index.mjs +6 -6
- package/dist/pptx/export/html2canvas-clone.cjs +2 -2
- package/dist/pptx/export/html2canvas-clone.mjs +1 -1
- package/dist/pptx/index.cjs +2993 -2989
- package/dist/pptx/index.mjs +4 -4
- 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-manual-layout.d.ts +2 -20
- 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-svg-def-types.d.ts +6 -1
- package/dist/pptx/render/chart-svg-def-types.d.ts.map +1 -1
- package/dist/pptx/render/chart-view-model-dom-helpers.d.ts +1 -1
- package/dist/pptx/render/chart-view-model-dom-helpers.d.ts.map +1 -1
- package/dist/pptx/render/chart-view-model.cjs +41 -41
- 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/element-interaction.d.ts +1 -1
- package/dist/pptx/render/element-interaction.d.ts.map +1 -1
- package/dist/pptx/render/gradient-picker.d.ts.map +1 -1
- package/dist/pptx/render/index.d.ts +1 -0
- package/dist/pptx/render/index.d.ts.map +1 -1
- package/dist/pptx/render/path-gradient-rect.d.ts +1 -75
- package/dist/pptx/render/path-gradient-rect.d.ts.map +1 -1
- package/dist/pptx/render/rotate-handle-placement.d.ts +1 -27
- package/dist/pptx/render/rotate-handle-placement.d.ts.map +1 -1
- package/dist/pptx/render/rotation-drag.d.ts +1 -7
- package/dist/pptx/render/rotation-drag.d.ts.map +1 -1
- package/dist/teams/app/files-panel.d.ts +8 -3
- package/dist/teams/app/teams-app.d.ts +1 -0
- package/dist/teams/app/teams-settings.d.ts +6 -0
- package/dist/teams.js +3 -3
- package/dist/visio/render-fill.d.ts +2 -1
- package/dist/visio/render-svg.d.ts +2 -0
- package/dist/visio/ribbon-action.d.ts +8 -1
- package/dist/visio/ribbon-parts.d.ts +2 -1
- package/dist/visio/ribbon-router.d.ts +4 -2
- package/dist/visio/viewer-commands.d.ts +3 -3
- package/dist/visio/viewer-draw-tool.d.ts +16 -6
- package/dist/visio/viewer-handle-events.d.ts +19 -0
- package/dist/visio/viewer-line-endpoints.d.ts +14 -0
- package/dist/visio/viewer-rotation-handle.d.ts +14 -0
- package/dist/visio/viewer-rotation-preview.d.ts +7 -0
- package/dist/visio.js +734 -88
- package/dist/xlsx/chart-area-pane.d.ts +9 -0
- package/dist/xlsx/chart-fill-binding.d.ts +23 -0
- package/dist/xlsx/chart-gradient-preview.d.ts +8 -0
- package/dist/xlsx/chart-series-fill.d.ts +2 -1
- package/dist/xlsx/chart-series-gradient-type.d.ts +9 -0
- package/dist/xlsx/chart-series-gradient.d.ts +8 -0
- package/dist/xlsx/chart-series-pane.d.ts +2 -1
- package/dist/xlsx/chart-series-range-preview.d.ts +7 -0
- package/dist/xlsx/chart-series-transparency.d.ts +2 -1
- package/dist/xlsx/grid/measure.d.ts +5 -0
- package/dist/xlsx/grid/styles.d.ts +1 -1
- package/dist/xlsx.js +962 -102
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createIconSvg, paintIcon, getIcon } from './chunk-
|
|
1
|
+
import { createIconSvg, paintIcon, getIcon } from './chunk-BOX43CZD.js';
|
|
2
2
|
import { initialsOf } from './chunk-OXKWNNNJ.js';
|
|
3
3
|
import { OfficeElement, controlStyles, definer, valueOn, flag, present, triState, withTokens } from './chunk-ZV2Z4IWH.js';
|
|
4
4
|
import { tok, OFFICE_TOKENS } from './chunk-JFJXBYRD.js';
|
|
@@ -2924,11 +2924,75 @@ var OfficeUiMenuSeparator = class extends OfficeElement {
|
|
|
2924
2924
|
var defineMenuSeparator = definer("office-ui-menu-separator", () => OfficeUiMenuSeparator);
|
|
2925
2925
|
|
|
2926
2926
|
// raw-css:/home/runner/work/ooxml/ooxml/src/ui/src/menu/menu-button.css?raw
|
|
2927
|
-
var menu_button_default = ":host {\n display: inline-flex;\n vertical-align: middle;\n}\n.wrap {\n display: inline-flex;\n align-items: stretch;\n border: var(--office-border-width) solid transparent;\n border-radius: var(--office-radius);\n}\n:host([variant='stacked']) .wrap {\n flex-direction: column;\n}\nbutton {\n box-sizing: border-box;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: var(--office-space-1);\n min-width: var(--office-target-size);\n min-height: var(--office-target-size);\n padding: 0 var(--office-space-1-5);\n border: 0;\n border-radius: var(--office-radius);\n background: transparent;\n color: var(--office-foreground);\n font: inherit;\n font-size: var(--office-font-size-sm);\n cursor: pointer;\n white-space: nowrap;\n}\n:host([variant='stacked']) .main {\n flex-direction: column;\n padding: var(--office-space-1) var(--office-space-1-5) 0;\n}\n:host([variant='stacked']) .caret {\n min-height: var(--office-icon-size-md);\n padding: 0 var(--office-space-1-5) var(--office-space-0);\n}\n:host([variant='stacked']:not([command])) .main {\n padding-bottom: 0;\n}\n.wrap:hover:not(.disabled) {\n border-color: var(--office-border);\n}\nbutton:hover:not(:disabled) {\n background: var(--office-surface);\n}\nbutton:focus-visible {\n outline: var(--office-focus-width) solid var(--office-ring);\n outline-offset: calc(-1 * var(--office-focus-width));\n}\nbutton:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n}\nbutton[aria-expanded='true'] {\n background: var(--office-surface);\n}\n.caret svg {\n width: var(--office-icon-size-sm);\n height: var(--office-icon-size-sm);\n}\nsvg {\n width: var(--office-icon-size-ml);\n height: var(--office-icon-size-ml);\n fill: none;\n stroke: currentColor;\n stroke-width: var(--office-icon-stroke);\n stroke-linecap: round;\n stroke-linejoin: round;\n}\nsvg:not([data-painted]) {\n display: none;\n}\n.panel {\n position: fixed;\n inset: auto;\n margin: 0;\n min-width: var(--office-menu-min-width);\n padding: var(--office-space-1);\n box-sizing: border-box;\n background: var(--office-background);\n color: var(--office-foreground);\n border: var(--office-border-width) solid var(--office-border);\n border-radius: var(--office-radius);\n box-shadow: var(--office-shadow);\n}\n.panel[hidden] {\n display: none;\n}\n\n@media (forced-colors: active) {\n button {\n color: ButtonText;\n }\n button:disabled {\n color: GrayText;\n }\n .panel {\n border-color: CanvasText;\n background: Canvas;\n color: CanvasText;\n }\n}\n";
|
|
2927
|
+
var menu_button_default = ":host {\n display: inline-flex;\n vertical-align: middle;\n}\n:host([submenu]) {\n display: flex;\n}\n:host([submenu]) .wrap {\n width: 100%;\n}\n:host([submenu]) .main {\n flex: 1;\n justify-content: flex-start;\n padding-left: var(--office-space-6);\n}\n.wrap {\n display: inline-flex;\n align-items: stretch;\n border: var(--office-border-width) solid transparent;\n border-radius: var(--office-radius);\n}\n:host([variant='stacked']) .wrap {\n flex-direction: column;\n}\nbutton {\n box-sizing: border-box;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: var(--office-space-1);\n min-width: var(--office-target-size);\n min-height: var(--office-target-size);\n padding: 0 var(--office-space-1-5);\n border: 0;\n border-radius: var(--office-radius);\n background: transparent;\n color: var(--office-foreground);\n font: inherit;\n font-size: var(--office-font-size-sm);\n cursor: pointer;\n white-space: nowrap;\n}\n:host([variant='stacked']) .main {\n flex-direction: column;\n padding: var(--office-space-1) var(--office-space-1-5) 0;\n}\n:host([variant='stacked']) .caret {\n min-height: var(--office-icon-size-md);\n padding: 0 var(--office-space-1-5) var(--office-space-0);\n}\n:host([variant='stacked']:not([command])) .main {\n padding-bottom: 0;\n}\n.wrap:hover:not(.disabled) {\n border-color: var(--office-border);\n}\nbutton:hover:not(:disabled) {\n background: var(--office-surface);\n}\nbutton:focus-visible {\n outline: var(--office-focus-width) solid var(--office-ring);\n outline-offset: calc(-1 * var(--office-focus-width));\n}\nbutton:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n}\nbutton[aria-expanded='true'] {\n background: var(--office-surface);\n}\n.caret svg {\n width: var(--office-icon-size-sm);\n height: var(--office-icon-size-sm);\n}\nsvg {\n width: var(--office-icon-size-ml);\n height: var(--office-icon-size-ml);\n fill: none;\n stroke: currentColor;\n stroke-width: var(--office-icon-stroke);\n stroke-linecap: round;\n stroke-linejoin: round;\n}\nsvg:not([data-painted]) {\n display: none;\n}\n.panel {\n position: fixed;\n inset: auto;\n margin: 0;\n min-width: var(--office-menu-min-width);\n padding: var(--office-space-1);\n box-sizing: border-box;\n background: var(--office-background);\n color: var(--office-foreground);\n border: var(--office-border-width) solid var(--office-border);\n border-radius: var(--office-radius);\n box-shadow: var(--office-shadow);\n}\n.panel[hidden] {\n display: none;\n}\n\n@media (forced-colors: active) {\n button {\n color: ButtonText;\n }\n button:disabled {\n color: GrayText;\n }\n .panel {\n border-color: CanvasText;\n background: Canvas;\n color: CanvasText;\n }\n}\n";
|
|
2928
|
+
|
|
2929
|
+
// raw-css:/home/runner/work/ooxml/ooxml/src/ui/src/menu/menu-item.css?raw
|
|
2930
|
+
var menu_item_default = ":host {\n display: block;\n}\n:host([hidden]) {\n display: none;\n}\nbutton {\n box-sizing: border-box;\n display: flex;\n align-items: center;\n gap: var(--office-space-2);\n width: 100%;\n min-height: var(--office-target-size);\n padding: 0 var(--office-space-2-5) 0 var(--office-space-2);\n border: 0;\n border-radius: var(--office-radius-sm);\n background: transparent;\n color: inherit;\n font: inherit;\n font-size: var(--office-font-size-sm);\n text-align: start;\n cursor: pointer;\n}\nbutton:hover:not(:disabled),\nbutton:focus-visible {\n background: var(--office-surface);\n outline: none;\n}\nbutton:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n}\n.check {\n width: var(--office-icon-size);\n text-align: center;\n}\nsvg {\n width: var(--office-icon-size-md);\n height: var(--office-icon-size-md);\n flex: none;\n fill: none;\n stroke: currentColor;\n stroke-width: var(--office-icon-stroke);\n stroke-linecap: round;\n stroke-linejoin: round;\n}\nsvg:not([data-painted]) {\n visibility: hidden;\n}\n\n@media (forced-colors: active) {\n button:focus-visible {\n background: Highlight;\n color: HighlightText;\n }\n}\n";
|
|
2931
|
+
|
|
2932
|
+
// src/menu/menu-item.ts
|
|
2933
|
+
var OfficeUiMenuItem = class extends OfficeElement {
|
|
2934
|
+
static shadowRootOptions = { ...LitElement.shadowRootOptions, delegatesFocus: true };
|
|
2935
|
+
static styles = controlStyles(menu_item_default);
|
|
2936
|
+
static properties = {
|
|
2937
|
+
label: { type: String },
|
|
2938
|
+
icon: { type: String },
|
|
2939
|
+
command: { type: String },
|
|
2940
|
+
checked: { type: String },
|
|
2941
|
+
disabled: flag
|
|
2942
|
+
};
|
|
2943
|
+
/** `title` is a native attribute, so it is watched rather than declared as a property. */
|
|
2944
|
+
static get observedAttributes() {
|
|
2945
|
+
return [...super.observedAttributes, "title"];
|
|
2946
|
+
}
|
|
2947
|
+
constructor() {
|
|
2948
|
+
super();
|
|
2949
|
+
this.label = "";
|
|
2950
|
+
this.icon = null;
|
|
2951
|
+
this.command = null;
|
|
2952
|
+
this.checked = null;
|
|
2953
|
+
this.disabled = false;
|
|
2954
|
+
}
|
|
2955
|
+
attributeChangedCallback(name, old, value) {
|
|
2956
|
+
super.attributeChangedCallback(name, old, value);
|
|
2957
|
+
if (name === "title") this.requestUpdate();
|
|
2958
|
+
}
|
|
2959
|
+
/** Focus the menuitem itself, so arrow navigation never depends on delegatesFocus. */
|
|
2960
|
+
focus(options) {
|
|
2961
|
+
this.renderRoot.querySelector("button")?.focus(options);
|
|
2962
|
+
}
|
|
2963
|
+
onClick() {
|
|
2964
|
+
if (!present(this.disabled) && this.command)
|
|
2965
|
+
this.fire("office-command", { command: this.command });
|
|
2966
|
+
}
|
|
2967
|
+
render() {
|
|
2968
|
+
const checkable = this.checked !== null;
|
|
2969
|
+
const on = checkable && this.checked !== "false";
|
|
2970
|
+
return html`
|
|
2971
|
+
<button
|
|
2972
|
+
type="button"
|
|
2973
|
+
tabindex="-1"
|
|
2974
|
+
role=${checkable ? "menuitemcheckbox" : "menuitem"}
|
|
2975
|
+
aria-checked=${ifDefined(checkable ? String(on) : void 0)}
|
|
2976
|
+
title=${this.getAttribute("title") ?? ""}
|
|
2977
|
+
?disabled=${present(this.disabled)}
|
|
2978
|
+
@click=${this.onClick}
|
|
2979
|
+
>
|
|
2980
|
+
<span class="check" aria-hidden="true">${on ? "\u2713" : ""}</span>${glyph(this.icon)}<span
|
|
2981
|
+
>${this.label}</span
|
|
2982
|
+
>
|
|
2983
|
+
</button>
|
|
2984
|
+
`;
|
|
2985
|
+
}
|
|
2986
|
+
};
|
|
2987
|
+
var defineMenuItem = definer("office-ui-menu-item", () => OfficeUiMenuItem);
|
|
2928
2988
|
|
|
2929
2989
|
// src/menu/menu-button.ts
|
|
2930
|
-
|
|
2931
|
-
|
|
2990
|
+
function menuOwner(element) {
|
|
2991
|
+
for (let parent = element.parentElement; parent; parent = parent.parentElement)
|
|
2992
|
+
if (parent instanceof OfficeUiMenuButton) return parent;
|
|
2993
|
+
return void 0;
|
|
2994
|
+
}
|
|
2995
|
+
var OfficeUiMenuButton = class _OfficeUiMenuButton extends OfficeElement {
|
|
2932
2996
|
static styles = controlStyles(menu_button_default);
|
|
2933
2997
|
static properties = {
|
|
2934
2998
|
label: { type: String },
|
|
@@ -2936,6 +3000,7 @@ var OfficeUiMenuButton = class extends OfficeElement {
|
|
|
2936
3000
|
command: { type: String, reflect: true },
|
|
2937
3001
|
keyshortcuts: { type: String },
|
|
2938
3002
|
disabled: flag,
|
|
3003
|
+
submenu: flag,
|
|
2939
3004
|
iconOnly: { attribute: "icon-only", ...flag },
|
|
2940
3005
|
open: { state: true }
|
|
2941
3006
|
};
|
|
@@ -2951,6 +3016,7 @@ var OfficeUiMenuButton = class extends OfficeElement {
|
|
|
2951
3016
|
this.command = null;
|
|
2952
3017
|
this.keyshortcuts = null;
|
|
2953
3018
|
this.disabled = false;
|
|
3019
|
+
this.submenu = false;
|
|
2954
3020
|
this.iconOnly = false;
|
|
2955
3021
|
this.open = false;
|
|
2956
3022
|
this.addEventListener("office-command", (event) => {
|
|
@@ -2975,13 +3041,30 @@ var OfficeUiMenuButton = class extends OfficeElement {
|
|
|
2975
3041
|
return typeof (this.panel ?? HTMLElement.prototype).showPopover === "function";
|
|
2976
3042
|
}
|
|
2977
3043
|
items() {
|
|
2978
|
-
return [...this.querySelectorAll(
|
|
3044
|
+
return [...this.querySelectorAll("*")].filter(
|
|
3045
|
+
(item) => (item instanceof OfficeUiMenuItem || item instanceof _OfficeUiMenuButton && present(item.submenu)) && !present(item.disabled) && !item.hidden && menuOwner(item) === this
|
|
3046
|
+
);
|
|
3047
|
+
}
|
|
3048
|
+
focus(options) {
|
|
3049
|
+
this.renderRoot.querySelector(".main")?.focus(options);
|
|
2979
3050
|
}
|
|
2980
3051
|
toggle() {
|
|
3052
|
+
if (present(this.submenu)) {
|
|
3053
|
+
this.show(0);
|
|
3054
|
+
return;
|
|
3055
|
+
}
|
|
2981
3056
|
if (this.open) this.hide(true);
|
|
2982
3057
|
else this.show(0);
|
|
2983
3058
|
}
|
|
2984
3059
|
show(focusIndex) {
|
|
3060
|
+
if (present(this.disabled)) return;
|
|
3061
|
+
if (this.open) {
|
|
3062
|
+
this.items()[focusIndex]?.focus();
|
|
3063
|
+
return;
|
|
3064
|
+
}
|
|
3065
|
+
const parent = menuOwner(this);
|
|
3066
|
+
for (const sibling of parent?.items() ?? [])
|
|
3067
|
+
if (sibling !== this && sibling instanceof _OfficeUiMenuButton) sibling.hide(false);
|
|
2985
3068
|
const panel = this.panel;
|
|
2986
3069
|
const wrap = this.renderRoot.querySelector(".wrap");
|
|
2987
3070
|
if (!panel || !wrap) return;
|
|
@@ -3006,6 +3089,11 @@ var OfficeUiMenuButton = class extends OfficeElement {
|
|
|
3006
3089
|
const height = panel.offsetHeight;
|
|
3007
3090
|
if (!view || !width) return;
|
|
3008
3091
|
const maxLeft = view.innerWidth - width - 4;
|
|
3092
|
+
if (present(this.submenu)) {
|
|
3093
|
+
panel.style.left = `${Math.round(Math.max(4, Math.min(anchor.right + 2 + width > view.innerWidth ? anchor.left - width - 2 : anchor.right + 2, Math.max(4, maxLeft))))}px`;
|
|
3094
|
+
panel.style.top = `${Math.round(Math.max(4, Math.min(anchor.top, view.innerHeight - height - 4)))}px`;
|
|
3095
|
+
return;
|
|
3096
|
+
}
|
|
3009
3097
|
const left = anchor.left > maxLeft ? Math.max(4, anchor.right - width) : anchor.left;
|
|
3010
3098
|
const top = anchor.bottom + 2 + height > view.innerHeight && anchor.top - height - 2 > 0 ? anchor.top - height - 2 : anchor.bottom + 2;
|
|
3011
3099
|
panel.style.left = `${Math.round(Math.min(left, Math.max(4, maxLeft)))}px`;
|
|
@@ -3025,6 +3113,7 @@ var OfficeUiMenuButton = class extends OfficeElement {
|
|
|
3025
3113
|
this.renderRoot.querySelector(this.split ? ".caret" : ".main")?.focus();
|
|
3026
3114
|
}
|
|
3027
3115
|
closed() {
|
|
3116
|
+
for (const item of this.items()) if (item instanceof _OfficeUiMenuButton) item.hide(false);
|
|
3028
3117
|
if (this.outside) this.ownerDocument.removeEventListener("pointerdown", this.outside, true);
|
|
3029
3118
|
this.outside = void 0;
|
|
3030
3119
|
this.open = false;
|
|
@@ -3035,8 +3124,9 @@ var OfficeUiMenuButton = class extends OfficeElement {
|
|
|
3035
3124
|
else this.toggle();
|
|
3036
3125
|
}
|
|
3037
3126
|
onTriggerKey(event) {
|
|
3038
|
-
if (event.key === "ArrowDown" && !present(this.disabled)) {
|
|
3127
|
+
if ((event.key === "ArrowDown" || present(this.submenu) && event.key === "ArrowRight") && !present(this.disabled)) {
|
|
3039
3128
|
event.preventDefault();
|
|
3129
|
+
event.stopPropagation();
|
|
3040
3130
|
this.show(0);
|
|
3041
3131
|
}
|
|
3042
3132
|
}
|
|
@@ -3047,14 +3137,16 @@ var OfficeUiMenuButton = class extends OfficeElement {
|
|
|
3047
3137
|
);
|
|
3048
3138
|
const move = (index) => {
|
|
3049
3139
|
event.preventDefault();
|
|
3140
|
+
event.stopPropagation();
|
|
3050
3141
|
items[(index + items.length) % items.length]?.focus();
|
|
3051
3142
|
};
|
|
3052
3143
|
if (event.key === "ArrowDown") move(from + 1);
|
|
3053
3144
|
else if (event.key === "ArrowUp") move(from - 1);
|
|
3054
3145
|
else if (event.key === "Home") move(0);
|
|
3055
3146
|
else if (event.key === "End") move(items.length - 1);
|
|
3056
|
-
else if (event.key === "Escape") {
|
|
3147
|
+
else if (event.key === "Escape" || present(this.submenu) && event.key === "ArrowLeft") {
|
|
3057
3148
|
event.preventDefault();
|
|
3149
|
+
event.stopPropagation();
|
|
3058
3150
|
this.hide(true);
|
|
3059
3151
|
} else if (event.key === "Tab") this.hide(false);
|
|
3060
3152
|
}
|
|
@@ -3077,10 +3169,13 @@ var OfficeUiMenuButton = class extends OfficeElement {
|
|
|
3077
3169
|
aria-label=${ifDefined(iconOnly ? label : void 0)}
|
|
3078
3170
|
aria-keyshortcuts=${ifDefined(this.keyshortcuts || void 0)}
|
|
3079
3171
|
aria-haspopup=${ifDefined(split ? void 0 : "menu")}
|
|
3172
|
+
role=${ifDefined(present(this.submenu) ? "menuitem" : void 0)}
|
|
3173
|
+
tabindex=${present(this.submenu) ? -1 : 0}
|
|
3080
3174
|
aria-expanded=${ifDefined(split ? void 0 : String(open))}
|
|
3081
3175
|
?disabled=${disabled}
|
|
3082
3176
|
@click=${this.onMain}
|
|
3083
3177
|
@keydown=${this.onTriggerKey}
|
|
3178
|
+
@pointerenter=${() => present(this.submenu) && this.show(-1)}
|
|
3084
3179
|
>${glyph(this.icon)}<span class="text" ?hidden=${iconOnly}>${label}</span></button
|
|
3085
3180
|
>
|
|
3086
3181
|
<!-- Without a split command the caret is decoration on one control, not a second button. -->
|
|
@@ -3097,7 +3192,7 @@ var OfficeUiMenuButton = class extends OfficeElement {
|
|
|
3097
3192
|
?disabled=${disabled}
|
|
3098
3193
|
@click=${() => !disabled && this.toggle()}
|
|
3099
3194
|
@keydown=${this.onTriggerKey}
|
|
3100
|
-
>${glyph("chevronDown", "chevron")}</button
|
|
3195
|
+
>${glyph(present(this.submenu) ? "chevronRight" : "chevronDown", "chevron")}</button
|
|
3101
3196
|
>
|
|
3102
3197
|
</div>
|
|
3103
3198
|
<div
|
|
@@ -3115,66 +3210,6 @@ var OfficeUiMenuButton = class extends OfficeElement {
|
|
|
3115
3210
|
};
|
|
3116
3211
|
var defineMenuButton = definer("office-ui-menu-button", () => OfficeUiMenuButton);
|
|
3117
3212
|
|
|
3118
|
-
// raw-css:/home/runner/work/ooxml/ooxml/src/ui/src/menu/menu-item.css?raw
|
|
3119
|
-
var menu_item_default = ":host {\n display: block;\n}\n:host([hidden]) {\n display: none;\n}\nbutton {\n box-sizing: border-box;\n display: flex;\n align-items: center;\n gap: var(--office-space-2);\n width: 100%;\n min-height: var(--office-target-size);\n padding: 0 var(--office-space-2-5) 0 var(--office-space-2);\n border: 0;\n border-radius: var(--office-radius-sm);\n background: transparent;\n color: inherit;\n font: inherit;\n font-size: var(--office-font-size-sm);\n text-align: start;\n cursor: pointer;\n}\nbutton:hover:not(:disabled),\nbutton:focus-visible {\n background: var(--office-surface);\n outline: none;\n}\nbutton:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n}\n.check {\n width: var(--office-icon-size);\n text-align: center;\n}\nsvg {\n width: var(--office-icon-size-md);\n height: var(--office-icon-size-md);\n flex: none;\n fill: none;\n stroke: currentColor;\n stroke-width: var(--office-icon-stroke);\n stroke-linecap: round;\n stroke-linejoin: round;\n}\nsvg:not([data-painted]) {\n visibility: hidden;\n}\n\n@media (forced-colors: active) {\n button:focus-visible {\n background: Highlight;\n color: HighlightText;\n }\n}\n";
|
|
3120
|
-
|
|
3121
|
-
// src/menu/menu-item.ts
|
|
3122
|
-
var OfficeUiMenuItem = class extends OfficeElement {
|
|
3123
|
-
static shadowRootOptions = { ...LitElement.shadowRootOptions, delegatesFocus: true };
|
|
3124
|
-
static styles = controlStyles(menu_item_default);
|
|
3125
|
-
static properties = {
|
|
3126
|
-
label: { type: String },
|
|
3127
|
-
icon: { type: String },
|
|
3128
|
-
command: { type: String },
|
|
3129
|
-
checked: { type: String },
|
|
3130
|
-
disabled: flag
|
|
3131
|
-
};
|
|
3132
|
-
/** `title` is a native attribute, so it is watched rather than declared as a property. */
|
|
3133
|
-
static get observedAttributes() {
|
|
3134
|
-
return [...super.observedAttributes, "title"];
|
|
3135
|
-
}
|
|
3136
|
-
constructor() {
|
|
3137
|
-
super();
|
|
3138
|
-
this.label = "";
|
|
3139
|
-
this.icon = null;
|
|
3140
|
-
this.command = null;
|
|
3141
|
-
this.checked = null;
|
|
3142
|
-
this.disabled = false;
|
|
3143
|
-
}
|
|
3144
|
-
attributeChangedCallback(name, old, value) {
|
|
3145
|
-
super.attributeChangedCallback(name, old, value);
|
|
3146
|
-
if (name === "title") this.requestUpdate();
|
|
3147
|
-
}
|
|
3148
|
-
/** Focus the menuitem itself, so arrow navigation never depends on delegatesFocus. */
|
|
3149
|
-
focus(options) {
|
|
3150
|
-
this.renderRoot.querySelector("button")?.focus(options);
|
|
3151
|
-
}
|
|
3152
|
-
onClick() {
|
|
3153
|
-
if (!present(this.disabled) && this.command)
|
|
3154
|
-
this.fire("office-command", { command: this.command });
|
|
3155
|
-
}
|
|
3156
|
-
render() {
|
|
3157
|
-
const checkable = this.checked !== null;
|
|
3158
|
-
const on = checkable && this.checked !== "false";
|
|
3159
|
-
return html`
|
|
3160
|
-
<button
|
|
3161
|
-
type="button"
|
|
3162
|
-
tabindex="-1"
|
|
3163
|
-
role=${checkable ? "menuitemcheckbox" : "menuitem"}
|
|
3164
|
-
aria-checked=${ifDefined(checkable ? String(on) : void 0)}
|
|
3165
|
-
title=${this.getAttribute("title") ?? ""}
|
|
3166
|
-
?disabled=${present(this.disabled)}
|
|
3167
|
-
@click=${this.onClick}
|
|
3168
|
-
>
|
|
3169
|
-
<span class="check" aria-hidden="true">${on ? "\u2713" : ""}</span>${glyph(this.icon)}<span
|
|
3170
|
-
>${this.label}</span
|
|
3171
|
-
>
|
|
3172
|
-
</button>
|
|
3173
|
-
`;
|
|
3174
|
-
}
|
|
3175
|
-
};
|
|
3176
|
-
var defineMenuItem = definer("office-ui-menu-item", () => OfficeUiMenuItem);
|
|
3177
|
-
|
|
3178
3213
|
// raw-css:/home/runner/work/ooxml/ooxml/src/ui/src/dialog/options-dialog.css?raw
|
|
3179
3214
|
var options_dialog_default = ":host {\n display: contents;\n}\noffice-ui-dialog {\n --office-dialog-width: var(--office-options-width);\n --office-dialog-max-width: var(--office-options-width);\n}\n.layout {\n display: grid;\n grid-template-columns: var(--office-options-nav-width) minmax(0, 1fr);\n gap: 0;\n min-height: var(--office-options-min-height);\n margin: calc(-1 * var(--office-space-4));\n}\nnav {\n display: flex;\n flex-direction: column;\n padding: var(--office-space-2) 0;\n border-inline-end: var(--office-border-width) solid var(--office-border);\n background: var(--office-surface);\n overflow: auto;\n}\nnav button {\n min-height: var(--office-options-row-height);\n padding: var(--office-space-1) var(--office-space-3-5);\n border: 0;\n border-radius: 0;\n background: transparent;\n color: inherit;\n font: inherit;\n text-align: start;\n cursor: pointer;\n}\nnav button[aria-selected='true'] {\n background: var(--office-selected);\n font-weight: 600;\n box-shadow: inset var(--office-selection-bar-width) 0 0 var(--office-accent);\n}\nnav button:focus-visible {\n outline: var(--office-focus-width) solid var(--office-ring);\n outline-offset: calc(-1 * var(--office-focus-width));\n}\n[role='tabpanel'] {\n padding: var(--office-space-4) var(--office-space-5);\n overflow: auto;\n}\n.lead {\n margin: 0 0 var(--office-space-3);\n font-size: var(--office-font-size-md);\n}\n.unavailable {\n margin: 0 0 var(--office-space-3);\n color: var(--office-muted-foreground);\n}\nsection + section {\n margin-top: var(--office-space-4);\n}\nh3 {\n margin: 0 0 var(--office-space-2);\n padding-bottom: var(--office-space-1);\n border-bottom: var(--office-border-width) solid var(--office-border);\n font-size: var(--office-font-size);\n font-weight: 600;\n}\n.desc {\n margin: 0 0 var(--office-space-2);\n color: var(--office-muted-foreground);\n}\n.row {\n display: flex;\n align-items: center;\n gap: var(--office-space-2);\n min-height: var(--office-options-row-height);\n}\n.row.indent {\n padding-inline-start: var(--office-space-6);\n}\n.row.field > span:first-child {\n min-width: var(--office-options-label-width);\n}\n.row[data-disabled] {\n color: var(--office-muted-foreground);\n}\ninput[type='text'],\ninput[type='number'],\nselect {\n min-height: var(--office-input-height);\n box-sizing: border-box;\n font: inherit;\n border: var(--office-border-width) solid var(--office-border);\n border-radius: var(--office-radius-sm);\n background: var(--office-background);\n color: inherit;\n}\ninput[type='number'] {\n width: var(--office-options-number-width);\n}\n.info {\n display: inline-grid;\n place-items: center;\n width: var(--office-info-size);\n height: var(--office-info-size);\n border: var(--office-border-width) solid currentColor;\n border-radius: 50%;\n font-size: var(--office-font-size-2xs);\n color: var(--office-muted-foreground);\n cursor: help;\n}\n.actions {\n display: flex;\n gap: var(--office-space-2);\n}\n.actions button {\n min-width: var(--office-dialog-button-min-width);\n min-height: var(--office-control-height-md);\n font: inherit;\n cursor: pointer;\n}\n@media (max-width: 600px) {\n .layout {\n grid-template-columns: 1fr;\n }\n nav {\n flex-direction: row;\n border-inline-end: 0;\n border-bottom: var(--office-border-width) solid var(--office-border);\n }\n nav button {\n white-space: nowrap;\n }\n .row.field {\n flex-wrap: wrap;\n }\n}\n";
|
|
3180
3215
|
|
package/dist/controls.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { CONTROL_DEFINERS, DEFAULT_OFFICE_PROFILE, EMPTY_MENU_STATE, OFFICE_AVATAR_SWATCHES, OFFICE_COLOR_SWATCHES, OFFICE_COLOR_SWATCH_HEXES, OFFICE_PROFILE_STORAGE_KEY, OFFICE_TITLE_BAR_SEARCH_LIMIT, OFFICE_TOAST_VISIBLE_LIMIT, assignKeyTips, attachKeyTips, clampFlyoutPosition, clampOptionNumber, clearOfficeProfile, createRibbonOverflow, defineAccount, defineBackstage, defineButton, defineCheckbox, defineCommandSearch, defineContextMenu, defineDialog, defineDialogFooter, defineFindBar, defineGallery, defineIcon, defineMenuButton, defineMenuItem, defineMenuSeparator, defineOptionsDialog, definePasteOptions, definePrintPreview, defineRadio, defineReadOnlyBanner, defineRibbon, defineRibbonGroup, defineRibbonSection, defineRibbonStack, defineRibbonToggle, defineRuler, defineSearchField, defineSelect, defineStatusBar, defineStatusItem, defineSwitch, defineTabStrip, defineTitleBar, defineToasts, defineToolbar, defineZoomSlider, nextEnabledIndex, parseSvgPreview, profileInitials, readOfficeProfile, registerControls, rulerDivisions, runKeyTips, sanitizeOfficeProfile, typeAheadIndex, writeOfficeProfile } from './chunk-
|
|
2
|
-
import './chunk-
|
|
1
|
+
export { CONTROL_DEFINERS, DEFAULT_OFFICE_PROFILE, EMPTY_MENU_STATE, OFFICE_AVATAR_SWATCHES, OFFICE_COLOR_SWATCHES, OFFICE_COLOR_SWATCH_HEXES, OFFICE_PROFILE_STORAGE_KEY, OFFICE_TITLE_BAR_SEARCH_LIMIT, OFFICE_TOAST_VISIBLE_LIMIT, assignKeyTips, attachKeyTips, clampFlyoutPosition, clampOptionNumber, clearOfficeProfile, createRibbonOverflow, defineAccount, defineBackstage, defineButton, defineCheckbox, defineCommandSearch, defineContextMenu, defineDialog, defineDialogFooter, defineFindBar, defineGallery, defineIcon, defineMenuButton, defineMenuItem, defineMenuSeparator, defineOptionsDialog, definePasteOptions, definePrintPreview, defineRadio, defineReadOnlyBanner, defineRibbon, defineRibbonGroup, defineRibbonSection, defineRibbonStack, defineRibbonToggle, defineRuler, defineSearchField, defineSelect, defineStatusBar, defineStatusItem, defineSwitch, defineTabStrip, defineTitleBar, defineToasts, defineToolbar, defineZoomSlider, nextEnabledIndex, parseSvgPreview, profileInitials, readOfficeProfile, registerControls, rulerDivisions, runKeyTips, sanitizeOfficeProfile, typeAheadIndex, writeOfficeProfile } from './chunk-T3HB5LMH.js';
|
|
2
|
+
import './chunk-BOX43CZD.js';
|
|
3
3
|
import './chunk-OXKWNNNJ.js';
|
|
4
4
|
import './chunk-ZV2Z4IWH.js';
|
|
5
5
|
import './chunk-JFJXBYRD.js';
|
|
@@ -1,24 +1,13 @@
|
|
|
1
1
|
import type { EditorView } from 'prosemirror-view';
|
|
2
|
-
import type
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
anchor?: string;
|
|
6
|
-
tooltip?: string;
|
|
7
|
-
}
|
|
8
|
-
/** The contiguous range carrying the same link mark around `pos`, if the position is inside a link. */
|
|
9
|
-
export declare function linkRangeAt(view: EditorView, pos: number): {
|
|
2
|
+
import { type LinkTarget } from 'ooxml-core/docx/ui';
|
|
3
|
+
export type { LinkTarget } from 'ooxml-core/docx/ui';
|
|
4
|
+
export declare const linkRangeAt: (view: EditorView, pos: number) => {
|
|
10
5
|
from: number;
|
|
11
6
|
to: number;
|
|
12
|
-
mark: Mark;
|
|
7
|
+
mark: import("prosemirror-model").Mark;
|
|
13
8
|
} | undefined;
|
|
14
|
-
/** The link under the selection start, used to prefill the link dialog. */
|
|
15
9
|
export declare function linkAtSelection(view: EditorView): LinkTarget | undefined;
|
|
16
|
-
/**
|
|
17
|
-
* Applies a link to the selection. With an empty selection inside a link the whole link is
|
|
18
|
-
* retargeted; with an empty selection elsewhere `displayText` (or the address) is inserted as a link.
|
|
19
|
-
*/
|
|
20
10
|
export declare function applyLink(view: EditorView, target: LinkTarget, displayText?: string): boolean;
|
|
21
|
-
/** Removes the link from the selection, or from the whole link under an empty selection. */
|
|
22
11
|
export declare function removeLink(view: EditorView): boolean;
|
|
23
12
|
/** Scrolls to the paragraph whose bookmarks include `name`; returns whether one was found. */
|
|
24
13
|
export declare function goToBookmark(view: EditorView, name: string): boolean;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { Block, Note } from 'ooxml-core/docx';
|
|
2
2
|
import { type InlineEditorOptions } from './header-footer-editor.js';
|
|
3
|
+
import type { NoteKind } from './note-commands.js';
|
|
3
4
|
export interface NoteEditingOptions {
|
|
4
5
|
editor?: InlineEditorOptions;
|
|
5
|
-
note(id: string): Note | undefined;
|
|
6
|
-
change(id: string, blocks: Block[]): void;
|
|
6
|
+
note(kind: NoteKind, id: string): Note | undefined;
|
|
7
|
+
change(kind: NoteKind, id: string, blocks: Block[]): void;
|
|
7
8
|
editable(): boolean;
|
|
8
9
|
}
|
|
9
10
|
/** Double-click a footnote or endnote to edit its text in place. */
|
|
@@ -6,7 +6,7 @@ type Theme = NonNullable<DocumentModel['theme']>;
|
|
|
6
6
|
export declare function themeFontOf(formatting: RunFormatting, theme: Theme | undefined): string | undefined;
|
|
7
7
|
/** CSS for inherited run formatting; direct formatting still renders through the run's own marks. */
|
|
8
8
|
export declare function runFormattingCss(formatting: RunFormatting, theme?: Theme, direct?: RunFormatting): string;
|
|
9
|
-
/** The run
|
|
9
|
+
/** The run an inline node stands for, with its marks or attributes as direct formatting. */
|
|
10
10
|
export declare function runOf(node: ProseMirrorNode): TextRun | undefined;
|
|
11
11
|
/**
|
|
12
12
|
* Renders formatting a run inherits from document defaults, its paragraph style, its table's style
|
package/dist/docx/schema.d.ts
CHANGED
|
@@ -3,4 +3,4 @@ export { wordHighlightColors } from 'ooxml-core/docx/ui';
|
|
|
3
3
|
/** Single line spacing as a multiple of the font size, close to Calibri's and Arial's metrics. */
|
|
4
4
|
export declare const NATURAL_LINE_HEIGHT = 1.2;
|
|
5
5
|
export declare function paragraphStyle(attrs: Record<string, unknown>): string;
|
|
6
|
-
export declare const schema: Schema<"doc" | "equation" | "fieldMarker" | "hardBreak" | "image" | "nestedTablePreview" | "noteReference" | "pageBreak" | "paragraph" | "table" | "tableCell" | "tableRow" | "text", "bold" | "characterStyle" | "comment" | "deletion" | "field" | "font" | "highlight" | "insertion" | "italic" | "language" | "link" | "runProperties" | "runRtl" | "strike" | "underline" | "verticalAlign">;
|
|
6
|
+
export declare const schema: Schema<"doc" | "equation" | "fieldMarker" | "hardBreak" | "image" | "nestedTablePreview" | "noteReference" | "pageBreak" | "paragraph" | "table" | "tableCell" | "tableRow" | "text", "bold" | "characterStyle" | "comment" | "deletion" | "field" | "font" | "highlight" | "inlineCommentAnchors" | "insertion" | "italic" | "language" | "link" | "runProperties" | "runRtl" | "strike" | "underline" | "verticalAlign">;
|
|
@@ -1,8 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
/**
|
|
4
|
-
* Word's Bold/Italic/Underline/Strikethrough: toggles what the text shows, including formatting
|
|
5
|
-
* inherited from its styles. Turning off text that is on only through a style (a bold heading)
|
|
6
|
-
* writes an explicit off, as Word does; turning it on clears that off again.
|
|
7
|
-
*/
|
|
8
|
-
export declare function toggleFormat(key: ToggleKey): Command;
|
|
1
|
+
export type { ToggleKey } from 'ooxml-core/docx/ui';
|
|
2
|
+
export declare const toggleFormat: (key: import("ooxml-core/docx/ui").ToggleKey) => import("prosemirror-state").Command;
|