ooxml-ui 0.21.0 → 0.23.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.
@@ -2250,7 +2250,7 @@ function clampFlyoutPosition(input) {
2250
2250
  }
2251
2251
 
2252
2252
  // raw-css:/home/runner/work/ooxml/ooxml/packages/ui/src/menu/context-menu.css?raw
2253
- var context_menu_default = ":host {\n display: contents;\n}\n:host([data-controlled]) {\n display: block;\n position: fixed;\n z-index: var(--office-z-popover);\n color: var(--office-popover-foreground);\n font: var(--office-font-size-sm) / var(--office-line-height) var(--office-font);\n}\n:host([data-controlled][hidden]) {\n display: none;\n}\n\n/* Children mode: a popover panel around the slotted menu items. */\n.panel {\n position: fixed;\n inset: auto;\n margin: 0;\n min-width: var(--office-context-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 font-family: var(--office-font);\n}\n.panel[hidden] {\n display: none;\n}\n\n/* Controlled mode: the host is the fixed box; rows are drawn here from `state`. */\n.menu {\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n min-width: var(--office-menu-min-width);\n max-height: calc(100vh - 2 * var(--office-space-2));\n overflow-y: auto;\n padding: var(--office-space-1-5) 0;\n border: var(--office-border-width) solid var(--office-border);\n border-radius: var(--office-radius-md);\n background: var(--office-popover);\n color: inherit;\n box-shadow: var(--office-shadow-lg);\n user-select: none;\n}\n.menu:focus {\n outline: none;\n}\n.item {\n box-sizing: border-box;\n display: flex;\n align-items: center;\n gap: var(--office-space-1-5);\n width: 100%;\n min-height: var(--office-field-height);\n padding: var(--office-space-1-5) var(--office-space-3);\n border: 0;\n background: transparent;\n color: inherit;\n font: inherit;\n text-align: start;\n white-space: nowrap;\n cursor: pointer;\n}\n.item:hover:not(:disabled),\n.item:focus:not(:disabled) {\n background: var(--office-selected);\n outline: none;\n}\n.item:focus-visible {\n outline: var(--office-focus-width) solid var(--office-ring);\n outline-offset: calc(-1 * var(--office-focus-width));\n}\n.item:disabled {\n opacity: 0.45;\n cursor: default;\n}\n.item.danger {\n color: var(--office-danger);\n}\n.item svg {\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}\n.check {\n flex: none;\n width: var(--office-icon-size);\n text-align: center;\n}\n.separator {\n height: var(--office-border-width);\n margin: var(--office-space-1) 0;\n background: var(--office-border);\n}\n.heading {\n padding: var(--office-space-1-5) var(--office-space-3) var(--office-space-0);\n color: var(--office-muted-foreground);\n font-size: var(--office-font-size-2xs);\n font-weight: var(--office-font-weight-bold);\n letter-spacing: 0.06em;\n text-transform: uppercase;\n}\n\n@media (pointer: coarse) {\n .item {\n min-height: var(--office-target-size-touch);\n }\n}\n@media (forced-colors: active) {\n .panel,\n .menu {\n border-color: CanvasText;\n background: Canvas;\n color: CanvasText;\n box-shadow: none;\n }\n .item,\n .item.danger {\n color: CanvasText;\n }\n .item:disabled {\n color: GrayText;\n opacity: 1;\n }\n .item:hover:not(:disabled),\n .item:focus:not(:disabled) {\n background: Highlight;\n color: HighlightText;\n }\n .separator {\n background: CanvasText;\n }\n .heading {\n color: CanvasText;\n }\n}\n";
2253
+ var context_menu_default = ":host {\n display: contents;\n}\n:host([data-controlled]) {\n display: block;\n position: fixed;\n z-index: var(--office-z-popover);\n color: var(--office-popover-foreground);\n font: var(--office-font-size-sm) / var(--office-line-height) var(--office-font);\n}\n:host([data-controlled][hidden]) {\n display: none;\n}\n\n/* Children mode: a popover panel around the slotted menu items. */\n.panel {\n position: fixed;\n inset: auto;\n margin: 0;\n min-width: var(--office-context-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 font-family: var(--office-font);\n}\n.panel[hidden] {\n display: none;\n}\n\n/* Controlled mode: the host is the fixed box; rows are drawn here from `state`. */\n.menu {\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n min-width: var(--office-menu-min-width);\n max-height: calc(100vh - 2 * var(--office-space-2));\n overflow-y: auto;\n padding: var(--office-space-1-5) 0;\n border: var(--office-border-width) solid var(--office-border);\n border-radius: var(--office-radius-md);\n background: var(--office-popover);\n color: inherit;\n box-shadow: var(--office-shadow-lg);\n user-select: none;\n}\n.menu:focus {\n outline: none;\n}\n.item {\n box-sizing: border-box;\n display: flex;\n align-items: center;\n gap: var(--office-space-1-5);\n width: 100%;\n min-height: var(--office-field-height);\n padding: var(--office-space-1-5) var(--office-space-3);\n border: 0;\n background: transparent;\n color: inherit;\n font: inherit;\n text-align: start;\n white-space: nowrap;\n cursor: pointer;\n}\n.item:hover:not(:disabled),\n.item:focus:not(:disabled) {\n background: var(--office-selected);\n outline: none;\n}\n.item:focus-visible {\n outline: var(--office-focus-width) solid var(--office-ring);\n outline-offset: calc(-1 * var(--office-focus-width));\n}\n.item:disabled {\n opacity: 0.45;\n cursor: default;\n}\n.item.danger {\n color: var(--office-danger);\n}\n.item svg {\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}\n.check {\n flex: none;\n width: var(--office-icon-size);\n text-align: center;\n}\n.shortcut {\n margin-inline-start: auto;\n padding-inline-start: var(--office-space-4);\n color: var(--office-muted-foreground);\n}\n.separator {\n height: var(--office-border-width);\n margin: var(--office-space-1) 0;\n background: var(--office-border);\n}\n.heading {\n padding: var(--office-space-1-5) var(--office-space-3) var(--office-space-0);\n color: var(--office-muted-foreground);\n font-size: var(--office-font-size-2xs);\n font-weight: var(--office-font-weight-bold);\n letter-spacing: 0.06em;\n text-transform: uppercase;\n}\n\n@media (pointer: coarse) {\n .item {\n min-height: var(--office-target-size-touch);\n }\n}\n@media (forced-colors: active) {\n .panel,\n .menu {\n border-color: CanvasText;\n background: Canvas;\n color: CanvasText;\n box-shadow: none;\n }\n .item,\n .item.danger {\n color: CanvasText;\n }\n .item:disabled {\n color: GrayText;\n opacity: 1;\n }\n .item:hover:not(:disabled),\n .item:focus:not(:disabled) {\n background: Highlight;\n color: HighlightText;\n }\n .separator {\n background: CanvasText;\n }\n .heading {\n color: CanvasText;\n }\n}\n";
2254
2254
 
2255
2255
  // src/menu/context-menu.ts
2256
2256
  var ITEMS = "office-ui-menu-item:not([disabled]):not([hidden])";
@@ -2536,13 +2536,15 @@ var OfficeUiContextMenu = class extends OfficeElement {
2536
2536
  type="button"
2537
2537
  class=${item.danger ? "item danger" : "item"}
2538
2538
  data-item-id=${item.id}
2539
+ title=${ifDefined(item.title)}
2540
+ aria-keyshortcuts=${ifDefined(item.shortcut)}
2539
2541
  role=${checkable ? "menuitemcheckbox" : "menuitem"}
2540
2542
  aria-checked=${ifDefined(checkable ? String(item.checked) : void 0)}
2541
2543
  aria-disabled=${ifDefined(item.disabled ? "true" : void 0)}
2542
2544
  tabindex=${index === this.active ? 0 : -1}
2543
2545
  ?disabled=${Boolean(item.disabled)}
2544
2546
  @click=${() => this.fire(this.config().requestEvent, { id: item.id })}
2545
- >${checkable ? html`<span class="check" aria-hidden="true">${item.checked ? "\u2713" : ""}</span>` : ""}${item.icon ? glyph(item.icon, "icon") : ""}${item.label}</button
2547
+ >${checkable ? html`<span class="check" aria-hidden="true">${item.checked ? "\u2713" : ""}</span>` : ""}${item.icon ? glyph(item.icon, "icon") : ""}${item.label}${item.shortcut ? html`<span class="shortcut" aria-hidden="true">${item.shortcut}</span>` : ""}</button
2546
2548
  >`;
2547
2549
  }
2548
2550
  /** Rows with their rules and headings; a heading opens a labelled group for the rows after it. */
@@ -4242,7 +4244,10 @@ var OfficeUiZoomSlider = class extends OfficeElement {
4242
4244
  step: { type: Number },
4243
4245
  disabled: flag,
4244
4246
  fit: { type: String, reflect: true },
4245
- label: { type: String }
4247
+ label: { type: String },
4248
+ outLabel: { type: String, attribute: "out-label" },
4249
+ inLabel: { type: String, attribute: "in-label" },
4250
+ sliderLabel: { type: String, attribute: "slider-label" }
4246
4251
  };
4247
4252
  requested = 100;
4248
4253
  constructor() {
@@ -4253,6 +4258,9 @@ var OfficeUiZoomSlider = class extends OfficeElement {
4253
4258
  this.disabled = false;
4254
4259
  this.fit = null;
4255
4260
  this.label = null;
4261
+ this.outLabel = null;
4262
+ this.inLabel = null;
4263
+ this.sliderLabel = null;
4256
4264
  }
4257
4265
  get value() {
4258
4266
  return clampTo(this.requested, this.low, this.high);
@@ -4292,18 +4300,20 @@ var OfficeUiZoomSlider = class extends OfficeElement {
4292
4300
  const { value } = this;
4293
4301
  const disabled = present(this.disabled);
4294
4302
  const fit = this.fit || "Fit";
4303
+ const out = this.outLabel || "Zoom out";
4304
+ const inn = this.inLabel || "Zoom in";
4295
4305
  return html`
4296
4306
  <button
4297
4307
  type="button"
4298
- aria-label="Zoom out"
4299
- title="Zoom out"
4308
+ aria-label=${out}
4309
+ title=${out}
4300
4310
  ?disabled=${disabled || value <= this.low}
4301
4311
  @click=${() => this.stepBy(-1)}
4302
4312
  >−</button
4303
4313
  >
4304
4314
  <input
4305
4315
  type="range"
4306
- aria-label="Zoom"
4316
+ aria-label=${this.sliderLabel || "Zoom"}
4307
4317
  aria-valuetext="${value}%"
4308
4318
  min=${this.low}
4309
4319
  max=${this.high}
@@ -4314,8 +4324,8 @@ var OfficeUiZoomSlider = class extends OfficeElement {
4314
4324
  />
4315
4325
  <button
4316
4326
  type="button"
4317
- aria-label="Zoom in"
4318
- title="Zoom in"
4327
+ aria-label=${inn}
4328
+ title=${inn}
4319
4329
  ?disabled=${disabled || value >= this.high}
4320
4330
  @click=${() => this.stepBy(1)}
4321
4331
  >+</button
package/dist/controls.js CHANGED
@@ -1,4 +1,4 @@
1
- export { CONTROL_DEFINERS, DEFAULT_OFFICE_PROFILE, EMPTY_MENU_STATE, OFFICE_AVATAR_SWATCHES, OFFICE_PROFILE_STORAGE_KEY, OFFICE_TITLE_BAR_SEARCH_LIMIT, OFFICE_TOAST_VISIBLE_LIMIT, attachKeyTips, clampFlyoutPosition, clampOptionNumber, clearOfficeProfile, 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, sanitizeOfficeProfile, typeAheadIndex, writeOfficeProfile } from './chunk-UTLCJKYC.js';
1
+ export { CONTROL_DEFINERS, DEFAULT_OFFICE_PROFILE, EMPTY_MENU_STATE, OFFICE_AVATAR_SWATCHES, OFFICE_PROFILE_STORAGE_KEY, OFFICE_TITLE_BAR_SEARCH_LIMIT, OFFICE_TOAST_VISIBLE_LIMIT, attachKeyTips, clampFlyoutPosition, clampOptionNumber, clearOfficeProfile, 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, sanitizeOfficeProfile, typeAheadIndex, writeOfficeProfile } from './chunk-7ZE4WHUW.js';
2
2
  import './chunk-HZ422LTR.js';
3
3
  import './chunk-E47762NY.js';
4
4
  import './chunk-5A4REH6T.js';
@@ -3,7 +3,9 @@ import { OfficeElement } from '../base.js';
3
3
  * Office status-bar zoom: zoom out, slider, zoom in, percentage and an optional fit button.
4
4
  * Attributes: `value` (percent, default 100), `min` (10), `max` (400), `step` (10, for the
5
5
  * buttons), `disabled`, `fit` (shows the fit button; its value is the button's name, e.g.
6
- * "Fit page to current window"), `label` (group name, default "Zoom").
6
+ * "Fit page to current window"), `label` (group name, default "Zoom"). `out-label`, `in-label` and
7
+ * `slider-label` name the zoom-out button, zoom-in button and slider (English by default), so a
8
+ * product can translate them.
7
9
  * User changes emit native `input` (slider drag) and `change` events with `value` updated;
8
10
  * the fit button emits `office-command` `{ command: 'zoom-fit' }`. Setting `value` never emits.
9
11
  */
@@ -39,6 +41,18 @@ export declare class OfficeUiZoomSlider extends OfficeElement {
39
41
  label: {
40
42
  type: StringConstructor;
41
43
  };
44
+ outLabel: {
45
+ type: StringConstructor;
46
+ attribute: string;
47
+ };
48
+ inLabel: {
49
+ type: StringConstructor;
50
+ attribute: string;
51
+ };
52
+ sliderLabel: {
53
+ type: StringConstructor;
54
+ attribute: string;
55
+ };
42
56
  };
43
57
  min: number;
44
58
  max: number;
@@ -46,6 +60,9 @@ export declare class OfficeUiZoomSlider extends OfficeElement {
46
60
  disabled: boolean;
47
61
  fit: string | null;
48
62
  label: string | null;
63
+ outLabel: string | null;
64
+ inLabel: string | null;
65
+ sliderLabel: string | null;
49
66
  private requested;
50
67
  constructor();
51
68
  get value(): number;
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { installOfficeUiTheme } from './chunk-2X6QYQ3Q.js';
2
2
  export { THEME_CSS, THEME_STYLE_ID, installOfficeUiTheme } from './chunk-2X6QYQ3Q.js';
3
- import { registerControls } from './chunk-UTLCJKYC.js';
4
- export { CONTROL_DEFINERS, DEFAULT_OFFICE_PROFILE, EMPTY_MENU_STATE, OFFICE_AVATAR_SWATCHES, OFFICE_PROFILE_STORAGE_KEY, OFFICE_TITLE_BAR_SEARCH_LIMIT, OFFICE_TOAST_VISIBLE_LIMIT, attachKeyTips, clampFlyoutPosition, clampOptionNumber, clearOfficeProfile, 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, glyph, nextEnabledIndex, parseSvgPreview, profileInitials, readOfficeProfile, registerControls, rulerDivisions, sanitizeOfficeProfile, typeAheadIndex, writeOfficeProfile } from './chunk-UTLCJKYC.js';
3
+ import { registerControls } from './chunk-7ZE4WHUW.js';
4
+ export { CONTROL_DEFINERS, DEFAULT_OFFICE_PROFILE, EMPTY_MENU_STATE, OFFICE_AVATAR_SWATCHES, OFFICE_PROFILE_STORAGE_KEY, OFFICE_TITLE_BAR_SEARCH_LIMIT, OFFICE_TOAST_VISIBLE_LIMIT, attachKeyTips, clampFlyoutPosition, clampOptionNumber, clearOfficeProfile, 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, glyph, nextEnabledIndex, parseSvgPreview, profileInitials, readOfficeProfile, registerControls, rulerDivisions, sanitizeOfficeProfile, typeAheadIndex, writeOfficeProfile } from './chunk-7ZE4WHUW.js';
5
5
  import { defineSmartArt } from './chunk-3MDKXKKQ.js';
6
6
  export { OfficeUiSmartArt, defineSmartArt, renderDiagramDrawing } from './chunk-3MDKXKKQ.js';
7
7
  import { TEAMS_TAGS, registerTeams } from './chunk-HNGJI5EZ.js';
@@ -20,6 +20,10 @@ export interface OfficeMenuItem {
20
20
  checked?: boolean;
21
21
  /** A registered icon drawn before the label. */
22
22
  icon?: string;
23
+ /** Tooltip, for example why a disabled row is unavailable. */
24
+ title?: string;
25
+ /** Shortcut hint shown at the trailing edge (Ctrl+C); also its `aria-keyshortcuts`. */
26
+ shortcut?: string;
23
27
  }
24
28
  /** Everything a controlled menu needs to draw. */
25
29
  export interface OfficeMenuState {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ooxml-ui",
3
- "version": "0.21.0",
3
+ "version": "0.23.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",