ooxml-ui 0.2.0 → 0.4.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 +16 -14
- package/dist/{chunk-Y4YIYNUZ.js → chunk-PCSUQPMC.js} +35 -1
- package/dist/{chunk-Q2FH3CZQ.js → chunk-RYUUWQ7F.js} +367 -8
- package/dist/controls.d.ts +4 -3
- package/dist/controls.js +2 -2
- package/dist/icons.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +6 -3
- package/dist/menu.d.ts +15 -0
- package/dist/ribbon.d.ts +10 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -58,20 +58,22 @@ with an incompatible build of this package.
|
|
|
58
58
|
|
|
59
59
|
## Features: elements
|
|
60
60
|
|
|
61
|
-
| Tag | Attributes / properties
|
|
62
|
-
| ---------------------------------------- |
|
|
63
|
-
| `office-ui-button` | `label`, `icon`, `command`, `disabled`, `pressed`, `expanded`, `icon-only`, `variant="stacked"`, `keyshortcuts`
|
|
64
|
-
| `office-ui-checkbox`, `office-ui-switch` | `checked`, `disabled`, `value`, `aria-label`; form-associated
|
|
65
|
-
| `office-ui-select` | `options` `[{ value, label, disabled? }]`, `value`, `selectedIndex`, `disabled`
|
|
66
|
-
| `office-ui-ribbon-group` | `label`; default slot
|
|
67
|
-
| `office-ui-
|
|
68
|
-
| `office-ui-
|
|
69
|
-
| `office-ui-
|
|
70
|
-
| `office-ui-
|
|
71
|
-
| `office-ui-
|
|
72
|
-
| `office-ui-
|
|
73
|
-
| `office-ui-
|
|
74
|
-
| `office-ui-
|
|
61
|
+
| Tag | Attributes / properties | Events (all bubble, composed) |
|
|
62
|
+
| ---------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------ |
|
|
63
|
+
| `office-ui-button` | `label`, `icon`, `command`, `disabled`, `pressed`, `expanded`, `icon-only`, `variant="stacked"`, `keyshortcuts` | `office-command` `{ command }` |
|
|
64
|
+
| `office-ui-checkbox`, `office-ui-switch` | `checked`, `disabled`, `value`, `aria-label`; form-associated | `input`, `change` |
|
|
65
|
+
| `office-ui-select` | `options` `[{ value, label, disabled? }]`, `value`, `selectedIndex`, `disabled` | `input`, `change` |
|
|
66
|
+
| `office-ui-ribbon-group` | `label`, `launcher` (dialog launcher command), `launcher-disabled`; default slot | launcher: `office-command` `{ command }` |
|
|
67
|
+
| `office-ui-ribbon-stack` | `orientation="horizontal"`; default slot (three-row column of small commands by default) | none |
|
|
68
|
+
| `office-ui-menu-button` / `-menu-item` | button: `label`, `icon`, `command` (split button), `variant`, `disabled`, `keyshortcuts`; item: `command`, `label`, `icon`, `disabled`, `checked` | item choice: `office-command` `{ command }` |
|
|
69
|
+
| `office-ui-toolbar` | `aria-label`, `aria-orientation`; arrow-key focus movement | none |
|
|
70
|
+
| `office-ui-dialog` | `open`, `heading`, `dismissible="false"`, `show()`, `close()`; slots default, `footer` | `office-dialog-close` `{ reason }` (cancelable) |
|
|
71
|
+
| `office-ui-status-bar` / `-status-item` | `label`, `value`, `interactive`, `id` | `office-status-activate` `{ id }` |
|
|
72
|
+
| `office-ui-zoom-slider` | `value` (percent), `min`, `max`, `step`, `disabled`, `fit` (fit button name), `label` | `input`, `change`; fit: `office-command` `{ command: 'zoom-fit' }` |
|
|
73
|
+
| `office-ui-tab-strip` | `tabs` `[{ id, label, title? }]`, `selected`, `label`, `disabled` | `office-tab-select` `{ id }` (cancelable) |
|
|
74
|
+
| `office-ui-presence` | `participants`, `max`, `label` | `office-presence-select` `{ id }` |
|
|
75
|
+
| `office-ui-smartart` | `drawing` (core `DiagramDrawing`), `schemeColors`, `label` | `office-smartart-render` (render report) |
|
|
76
|
+
| `office-ui-icon` | `name`, `label` | none |
|
|
75
77
|
|
|
76
78
|
Setting a property never emits an event; only user activation does. Controls honour
|
|
77
79
|
`prefers-color-scheme`, `forced-colors: active` (system colours and a visible focus ring) and
|
|
@@ -28,7 +28,41 @@ var BUILT_IN = {
|
|
|
28
28
|
fitPage: "M6.5 6.5h7v7h-7ZM2.5 6V2.5H6M14 2.5h3.5V6M17.5 14v3.5H14M6 17.5H2.5V14",
|
|
29
29
|
pageWidth: "M5.5 3.5h9v13h-9ZM1.5 10h17M4 8l-2.5 2L4 12M16 8l2.5 2-2.5 2",
|
|
30
30
|
zoomIn: "M3 8.5a5.5 5.5 0 1 0 11 0 5.5 5.5 0 1 0-11 0M13 13l4 4M6 8.5h5M8.5 6v5",
|
|
31
|
-
zoomOut: "M3 8.5a5.5 5.5 0 1 0 11 0 5.5 5.5 0 1 0-11 0M13 13l4 4M6 8.5h5"
|
|
31
|
+
zoomOut: "M3 8.5a5.5 5.5 0 1 0 11 0 5.5 5.5 0 1 0-11 0M13 13l4 4M6 8.5h5",
|
|
32
|
+
cut: "M7 3l7 10M13 3 6 13M3 15.5a2 2 0 1 0 4 0 2 2 0 1 0-4 0M13 15.5a2 2 0 1 0 4 0 2 2 0 1 0-4 0",
|
|
33
|
+
paste: "M7 3.5h6v2.5H7ZM7 4.5H4.5v13h11v-13H13",
|
|
34
|
+
formatPainter: "M4 3h10v4H4ZM14 5h2.5v4.5H9.5V12M8.5 12h2v5h-2Z",
|
|
35
|
+
bold: "M6 3.5h4.5a3 3 0 0 1 0 6H6ZM6 9.5h5.5a3.5 3.5 0 0 1 0 7H6Z",
|
|
36
|
+
italic: "M9 3.5h6M5 16.5h6M12 3.5 8 16.5",
|
|
37
|
+
underline: "M6 3v6a4 4 0 0 0 8 0V3M5 17h10",
|
|
38
|
+
strikethrough: "M3.5 10h13M13.5 5.5C13 4.3 11.7 3.5 10 3.5c-2 0-3.5 1-3.5 2.6 0 1.4 1.2 2.2 3.5 2.8M6.5 13.8c.5 1.6 1.9 2.7 3.8 2.7 2 0 3.5-1.1 3.5-2.8",
|
|
39
|
+
fontColor: "M5.5 13 10 3l4.5 10M7.2 9.3h5.6M3 17h14",
|
|
40
|
+
growFont: "M2.5 16 6.5 6l4 10M4 12.3h5M13 8.5l2-3 2 3M15 5.5V12",
|
|
41
|
+
shrinkFont: "M2.5 16 6.5 6l4 10M4 12.3h5M13 9l2 3 2-3M15 12V5.5",
|
|
42
|
+
changeCase: "M2 15 5.5 5 9 15M3.2 11.7h4.6M15.5 9.5v5.5M15.5 12.2a2.3 2.3 0 1 1-4.6 0 2.3 2.3 0 1 1 4.6 0",
|
|
43
|
+
alignLeft: "M3 4.5h14M3 8.5h9M3 12.5h14M3 16.5h9",
|
|
44
|
+
alignCenter: "M3 4.5h14M5.5 8.5h9M3 12.5h14M5.5 16.5h9",
|
|
45
|
+
alignRight: "M3 4.5h14M8 8.5h9M3 12.5h14M8 16.5h9",
|
|
46
|
+
justify: "M3 4.5h14M3 8.5h14M3 12.5h14M3 16.5h14",
|
|
47
|
+
alignTop: "M3 3.5h14M6 7h8M6 10.5h8",
|
|
48
|
+
alignMiddle: "M3 10h2M15 10h2M6 6.5h8M6 13.5h8M6 10h8",
|
|
49
|
+
alignBottom: "M3 16.5h14M6 9.5h8M6 13h8",
|
|
50
|
+
bullets: "M8 5h9M8 10h9M8 15h9M3.5 5h1M3.5 10h1M3.5 15h1",
|
|
51
|
+
indentIncrease: "M3 4h14M9 8h8M9 12h8M3 16h14M3 7.5 6 10l-3 2.5",
|
|
52
|
+
indentDecrease: "M3 4h14M9 8h8M9 12h8M3 16h14M6 7.5 3 10l3 2.5",
|
|
53
|
+
fill: "M3.5 10 9 4.5l6 6L9.5 16ZM9 4.5 7 2.5M16.5 12.5s1.5 2 1.5 3a1.5 1.5 0 0 1-3 0c0-1 1.5-3 1.5-3",
|
|
54
|
+
line: "M3.5 16.5 16.5 3.5",
|
|
55
|
+
effects: "M10 2.5l1.9 4.6 4.6 1.9-4.6 1.9L10 15.5l-1.9-4.6L3.5 9l4.6-1.9Z",
|
|
56
|
+
quickStyles: "M10 3a7 7 0 1 0 0 14c1 0 1.5-.7 1.5-1.5S11 14 11 13s.8-1.5 2-1.5h2a2 2 0 0 0 2-2A7 7 0 0 0 10 3ZM6.5 9.5h.1M8.5 6.2h.1M12.5 6.5h.1",
|
|
57
|
+
bringToFront: "M7.5 7.5h9v9h-9ZM12.5 7.5v-4h-9v9h4",
|
|
58
|
+
sendToBack: "M3.5 3.5h9v9h-9ZM12.5 7.5h4v9h-9v-4",
|
|
59
|
+
group: "M3 3h5v5H3ZM12 12h5v5h-5ZM2 2h1M17 2h1M2 18h1M17 18h1",
|
|
60
|
+
alignObjects: "M3 2.5v15M6 5h8v4H6ZM6 11h11v4H6Z",
|
|
61
|
+
position: "M10 2.5v15M2.5 10h15M7.5 5 10 2.5 12.5 5M7.5 15l2.5 2.5 2.5-2.5M5 7.5 2.5 10 5 12.5M15 7.5l2.5 2.5-2.5 2.5",
|
|
62
|
+
connector: "M3.5 15.5h5v-11h8M14.5 2.5l2 2-2 2M2.5 13.5v4",
|
|
63
|
+
textBox: "M3 3h14v14H3ZM6.5 6.5h7M10 6.5v7",
|
|
64
|
+
ruler: "M2 7h16v6H2ZM5 7v3M8 7v2M11 7v3M14 7v2",
|
|
65
|
+
launcher: "M5 15 15 5M9 5h6v6"
|
|
32
66
|
};
|
|
33
67
|
for (const [name, d] of Object.entries(BUILT_IN)) registry.set(name, { d });
|
|
34
68
|
function registerIcon(name, icon) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createIconSvg, paintIcon, defineIcon } from './chunk-
|
|
1
|
+
import { createIconSvg, paintIcon, defineIcon } from './chunk-PCSUQPMC.js';
|
|
2
2
|
import { definer, attachStyles, controlCss, emit } from './chunk-EY266IK3.js';
|
|
3
3
|
|
|
4
4
|
// src/button.ts
|
|
@@ -353,6 +353,317 @@ var defineDialog = definer("office-ui-dialog", () => {
|
|
|
353
353
|
return OfficeUiDialog;
|
|
354
354
|
});
|
|
355
355
|
|
|
356
|
+
// src/menu.ts
|
|
357
|
+
var BUTTON_CSS = `
|
|
358
|
+
:host { display: inline-flex; vertical-align: middle; }
|
|
359
|
+
.wrap { display: inline-flex; align-items: stretch; border: 1px solid transparent; border-radius: var(--office-radius, 4px); }
|
|
360
|
+
:host([variant="stacked"]) .wrap { flex-direction: column; }
|
|
361
|
+
button { box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center; gap: 4px;
|
|
362
|
+
min-width: var(--office-target-size, 28px); min-height: var(--office-target-size, 28px); padding: 0 6px;
|
|
363
|
+
border: 0; border-radius: var(--office-radius, 4px); background: transparent; color: var(--office-foreground, #1f2937);
|
|
364
|
+
font: inherit; font-size: 12px; cursor: pointer; white-space: nowrap; }
|
|
365
|
+
:host([variant="stacked"]) .main { flex-direction: column; padding: 4px 6px 0; }
|
|
366
|
+
:host([variant="stacked"]) .caret { min-height: 16px; padding: 0 6px 2px; }
|
|
367
|
+
:host([variant="stacked"]:not([command])) .main { padding-bottom: 0; }
|
|
368
|
+
.wrap:hover:not(.disabled) { border-color: var(--office-border, #d1d5db); }
|
|
369
|
+
button:hover:not(:disabled) { background: var(--office-surface, #f3f4f6); }
|
|
370
|
+
button:focus-visible { outline: 2px solid var(--office-ring, #2563eb); outline-offset: -2px; }
|
|
371
|
+
button:disabled { opacity: .5; cursor: not-allowed; }
|
|
372
|
+
button[aria-expanded="true"] { background: var(--office-surface, #f3f4f6); }
|
|
373
|
+
.caret svg { width: 12px; height: 12px; }
|
|
374
|
+
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.5;
|
|
375
|
+
stroke-linecap: round; stroke-linejoin: round; }
|
|
376
|
+
svg:not([data-painted]) { display: none; }
|
|
377
|
+
.panel { position: fixed; inset: auto; margin: 0; min-width: 180px; padding: 4px; box-sizing: border-box;
|
|
378
|
+
background: var(--office-background, #fff); color: var(--office-foreground, #1f2937);
|
|
379
|
+
border: 1px solid var(--office-border, #d1d5db); border-radius: var(--office-radius, 4px);
|
|
380
|
+
box-shadow: 0 8px 24px rgb(0 0 0 / 18%); }
|
|
381
|
+
.panel[hidden] { display: none; }
|
|
382
|
+
@media (forced-colors: active) {
|
|
383
|
+
button { color: ButtonText; } button:disabled { color: GrayText; }
|
|
384
|
+
.panel { border-color: CanvasText; background: Canvas; color: CanvasText; }
|
|
385
|
+
}
|
|
386
|
+
`;
|
|
387
|
+
var ITEM_CSS = `
|
|
388
|
+
:host { display: block; }
|
|
389
|
+
:host([hidden]) { display: none; }
|
|
390
|
+
button { box-sizing: border-box; display: flex; align-items: center; gap: 8px; width: 100%;
|
|
391
|
+
min-height: var(--office-target-size, 28px); padding: 0 10px 0 8px; border: 0; border-radius: 3px;
|
|
392
|
+
background: transparent; color: inherit; font: inherit; font-size: 12px; text-align: start; cursor: pointer; }
|
|
393
|
+
button:hover:not(:disabled), button:focus-visible { background: var(--office-surface, #f3f4f6); outline: none; }
|
|
394
|
+
button:disabled { opacity: .5; cursor: not-allowed; }
|
|
395
|
+
.check { width: 14px; text-align: center; }
|
|
396
|
+
svg { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5;
|
|
397
|
+
stroke-linecap: round; stroke-linejoin: round; }
|
|
398
|
+
svg:not([data-painted]) { visibility: hidden; }
|
|
399
|
+
@media (forced-colors: active) { button:focus-visible { background: Highlight; color: HighlightText; } }
|
|
400
|
+
`;
|
|
401
|
+
var ENABLED_ITEMS = "office-ui-menu-item:not([disabled]):not([hidden])";
|
|
402
|
+
var defineMenuItem = definer("office-ui-menu-item", () => {
|
|
403
|
+
class OfficeUiMenuItem extends HTMLElement {
|
|
404
|
+
static observedAttributes = ["label", "icon", "command", "disabled", "checked", "title"];
|
|
405
|
+
button;
|
|
406
|
+
svg;
|
|
407
|
+
text;
|
|
408
|
+
mark;
|
|
409
|
+
constructor() {
|
|
410
|
+
super();
|
|
411
|
+
const doc = this.ownerDocument;
|
|
412
|
+
const root = this.attachShadow({ mode: "open", delegatesFocus: true });
|
|
413
|
+
attachStyles(root, controlCss(ITEM_CSS));
|
|
414
|
+
this.button = doc.createElement("button");
|
|
415
|
+
this.button.type = "button";
|
|
416
|
+
this.button.tabIndex = -1;
|
|
417
|
+
this.mark = doc.createElement("span");
|
|
418
|
+
this.mark.className = "check";
|
|
419
|
+
this.mark.setAttribute("aria-hidden", "true");
|
|
420
|
+
this.svg = createIconSvg(doc);
|
|
421
|
+
this.text = doc.createElement("span");
|
|
422
|
+
this.button.append(this.mark, this.svg, this.text);
|
|
423
|
+
root.append(this.button);
|
|
424
|
+
this.button.addEventListener("click", () => {
|
|
425
|
+
const command = this.getAttribute("command");
|
|
426
|
+
if (!this.button.disabled && command) emit(this, "office-command", { command });
|
|
427
|
+
});
|
|
428
|
+
}
|
|
429
|
+
connectedCallback() {
|
|
430
|
+
this.sync();
|
|
431
|
+
}
|
|
432
|
+
attributeChangedCallback() {
|
|
433
|
+
this.sync();
|
|
434
|
+
}
|
|
435
|
+
get disabled() {
|
|
436
|
+
return this.hasAttribute("disabled");
|
|
437
|
+
}
|
|
438
|
+
set disabled(value) {
|
|
439
|
+
this.toggleAttribute("disabled", Boolean(value));
|
|
440
|
+
}
|
|
441
|
+
/** Focus the menuitem itself, so arrow navigation never depends on delegatesFocus. */
|
|
442
|
+
focus(options) {
|
|
443
|
+
this.button.focus(options);
|
|
444
|
+
}
|
|
445
|
+
sync() {
|
|
446
|
+
const checked = this.getAttribute("checked");
|
|
447
|
+
this.button.setAttribute("role", checked === null ? "menuitem" : "menuitemcheckbox");
|
|
448
|
+
if (checked === null) this.button.removeAttribute("aria-checked");
|
|
449
|
+
else this.button.setAttribute("aria-checked", String(checked !== "false"));
|
|
450
|
+
this.mark.textContent = checked !== null && checked !== "false" ? "\u2713" : "";
|
|
451
|
+
this.text.textContent = this.getAttribute("label") ?? "";
|
|
452
|
+
this.button.title = this.getAttribute("title") ?? "";
|
|
453
|
+
this.button.disabled = this.disabled;
|
|
454
|
+
if (paintIcon(this.svg, this.getAttribute("icon"))) this.svg.setAttribute("data-painted", "");
|
|
455
|
+
else this.svg.removeAttribute("data-painted");
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
return OfficeUiMenuItem;
|
|
459
|
+
});
|
|
460
|
+
var defineMenuButton = definer("office-ui-menu-button", () => {
|
|
461
|
+
class OfficeUiMenuButton extends HTMLElement {
|
|
462
|
+
static observedAttributes = [
|
|
463
|
+
"label",
|
|
464
|
+
"icon",
|
|
465
|
+
"command",
|
|
466
|
+
"disabled",
|
|
467
|
+
"title",
|
|
468
|
+
"keyshortcuts",
|
|
469
|
+
"icon-only"
|
|
470
|
+
];
|
|
471
|
+
wrap;
|
|
472
|
+
main;
|
|
473
|
+
caret;
|
|
474
|
+
svg;
|
|
475
|
+
text;
|
|
476
|
+
panel;
|
|
477
|
+
outside;
|
|
478
|
+
constructor() {
|
|
479
|
+
super();
|
|
480
|
+
const doc = this.ownerDocument;
|
|
481
|
+
const root = this.attachShadow({ mode: "open" });
|
|
482
|
+
attachStyles(root, controlCss(BUTTON_CSS));
|
|
483
|
+
this.wrap = doc.createElement("div");
|
|
484
|
+
this.wrap.className = "wrap";
|
|
485
|
+
this.main = doc.createElement("button");
|
|
486
|
+
this.main.type = "button";
|
|
487
|
+
this.main.className = "main";
|
|
488
|
+
this.main.setAttribute("part", "button");
|
|
489
|
+
this.svg = createIconSvg(doc);
|
|
490
|
+
this.text = doc.createElement("span");
|
|
491
|
+
this.main.append(this.svg, this.text);
|
|
492
|
+
this.caret = doc.createElement("button");
|
|
493
|
+
this.caret.type = "button";
|
|
494
|
+
this.caret.className = "caret";
|
|
495
|
+
this.caret.setAttribute("aria-haspopup", "menu");
|
|
496
|
+
this.caret.setAttribute("aria-expanded", "false");
|
|
497
|
+
const chevron = createIconSvg(doc);
|
|
498
|
+
paintIcon(chevron, "chevronDown");
|
|
499
|
+
chevron.setAttribute("data-painted", "");
|
|
500
|
+
this.caret.append(chevron);
|
|
501
|
+
this.panel = doc.createElement("div");
|
|
502
|
+
this.panel.className = "panel";
|
|
503
|
+
this.panel.setAttribute("role", "menu");
|
|
504
|
+
if (typeof this.panel.showPopover === "function")
|
|
505
|
+
this.panel.setAttribute("popover", "auto");
|
|
506
|
+
else this.panel.hidden = true;
|
|
507
|
+
this.panel.append(doc.createElement("slot"));
|
|
508
|
+
this.wrap.append(this.main, this.caret);
|
|
509
|
+
root.append(this.wrap, this.panel);
|
|
510
|
+
this.main.addEventListener("click", () => {
|
|
511
|
+
const command = this.getAttribute("command");
|
|
512
|
+
if (this.disabled) return;
|
|
513
|
+
if (command) emit(this, "office-command", { command });
|
|
514
|
+
else this.toggle();
|
|
515
|
+
});
|
|
516
|
+
this.caret.addEventListener("click", () => {
|
|
517
|
+
if (!this.disabled) this.toggle();
|
|
518
|
+
});
|
|
519
|
+
for (const trigger of [this.main, this.caret])
|
|
520
|
+
trigger.addEventListener("keydown", (event) => {
|
|
521
|
+
if (event.key === "ArrowDown" && !this.disabled) {
|
|
522
|
+
event.preventDefault();
|
|
523
|
+
this.show(0);
|
|
524
|
+
}
|
|
525
|
+
});
|
|
526
|
+
this.panel.addEventListener("toggle", (event) => {
|
|
527
|
+
if (event.newState === "closed") this.closed();
|
|
528
|
+
});
|
|
529
|
+
this.panel.addEventListener("keydown", (event) => this.onMenuKey(event));
|
|
530
|
+
this.addEventListener("office-command", (event) => {
|
|
531
|
+
if (event.target !== this) this.hide(true);
|
|
532
|
+
});
|
|
533
|
+
}
|
|
534
|
+
connectedCallback() {
|
|
535
|
+
this.sync();
|
|
536
|
+
}
|
|
537
|
+
disconnectedCallback() {
|
|
538
|
+
this.hide(false);
|
|
539
|
+
}
|
|
540
|
+
attributeChangedCallback() {
|
|
541
|
+
this.sync();
|
|
542
|
+
}
|
|
543
|
+
get disabled() {
|
|
544
|
+
return this.hasAttribute("disabled");
|
|
545
|
+
}
|
|
546
|
+
set disabled(value) {
|
|
547
|
+
this.toggleAttribute("disabled", Boolean(value));
|
|
548
|
+
}
|
|
549
|
+
get open() {
|
|
550
|
+
return this.caret.getAttribute("aria-expanded") === "true";
|
|
551
|
+
}
|
|
552
|
+
items() {
|
|
553
|
+
return [...this.querySelectorAll(ENABLED_ITEMS)];
|
|
554
|
+
}
|
|
555
|
+
toggle() {
|
|
556
|
+
if (this.open) this.hide(true);
|
|
557
|
+
else this.show(0);
|
|
558
|
+
}
|
|
559
|
+
show(focusIndex) {
|
|
560
|
+
const anchor = this.wrap.getBoundingClientRect();
|
|
561
|
+
this.panel.style.left = `${Math.round(anchor.left)}px`;
|
|
562
|
+
this.panel.style.top = `${Math.round(anchor.bottom + 2)}px`;
|
|
563
|
+
if (this.panel.hasAttribute("popover")) this.panel.showPopover?.();
|
|
564
|
+
else {
|
|
565
|
+
this.panel.hidden = false;
|
|
566
|
+
this.outside = (event) => {
|
|
567
|
+
if (!event.composedPath().includes(this)) this.hide(false);
|
|
568
|
+
};
|
|
569
|
+
this.ownerDocument.addEventListener("pointerdown", this.outside, true);
|
|
570
|
+
}
|
|
571
|
+
this.setExpanded(true);
|
|
572
|
+
this.place(anchor);
|
|
573
|
+
this.items()[focusIndex]?.focus();
|
|
574
|
+
}
|
|
575
|
+
/** Keep the open menu inside the viewport: flip left of the trigger's right edge if needed. */
|
|
576
|
+
place(anchor) {
|
|
577
|
+
const view = this.ownerDocument.defaultView;
|
|
578
|
+
const width = this.panel.offsetWidth;
|
|
579
|
+
const height = this.panel.offsetHeight;
|
|
580
|
+
if (!view || !width) return;
|
|
581
|
+
const maxLeft = view.innerWidth - width - 4;
|
|
582
|
+
const left = anchor.left > maxLeft ? Math.max(4, anchor.right - width) : anchor.left;
|
|
583
|
+
const top = anchor.bottom + 2 + height > view.innerHeight && anchor.top - height - 2 > 0 ? anchor.top - height - 2 : anchor.bottom + 2;
|
|
584
|
+
this.panel.style.left = `${Math.round(Math.min(left, Math.max(4, maxLeft)))}px`;
|
|
585
|
+
this.panel.style.top = `${Math.round(top)}px`;
|
|
586
|
+
}
|
|
587
|
+
hide(restoreFocus) {
|
|
588
|
+
if (!this.open) return;
|
|
589
|
+
if (this.panel.hasAttribute("popover")) {
|
|
590
|
+
try {
|
|
591
|
+
this.panel.hidePopover?.();
|
|
592
|
+
} catch {
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
this.closed();
|
|
596
|
+
if (restoreFocus) (this.getAttribute("command") ? this.caret : this.main).focus();
|
|
597
|
+
}
|
|
598
|
+
closed() {
|
|
599
|
+
if (!this.panel.hasAttribute("popover")) this.panel.hidden = true;
|
|
600
|
+
if (this.outside) this.ownerDocument.removeEventListener("pointerdown", this.outside, true);
|
|
601
|
+
this.outside = void 0;
|
|
602
|
+
this.setExpanded(false);
|
|
603
|
+
}
|
|
604
|
+
setExpanded(open) {
|
|
605
|
+
this.caret.setAttribute("aria-expanded", String(open));
|
|
606
|
+
if (this.hasAttribute("command")) this.main.removeAttribute("aria-expanded");
|
|
607
|
+
else this.main.setAttribute("aria-expanded", String(open));
|
|
608
|
+
}
|
|
609
|
+
onMenuKey(event) {
|
|
610
|
+
const items = this.items();
|
|
611
|
+
const from = items.findIndex(
|
|
612
|
+
(item) => item === event.target || item.contains(event.target)
|
|
613
|
+
);
|
|
614
|
+
const move = (index) => {
|
|
615
|
+
event.preventDefault();
|
|
616
|
+
items[(index + items.length) % items.length]?.focus();
|
|
617
|
+
};
|
|
618
|
+
if (event.key === "ArrowDown") move(from + 1);
|
|
619
|
+
else if (event.key === "ArrowUp") move(from - 1);
|
|
620
|
+
else if (event.key === "Home") move(0);
|
|
621
|
+
else if (event.key === "End") move(items.length - 1);
|
|
622
|
+
else if (event.key === "Escape") {
|
|
623
|
+
event.preventDefault();
|
|
624
|
+
this.hide(true);
|
|
625
|
+
} else if (event.key === "Tab") this.hide(false);
|
|
626
|
+
}
|
|
627
|
+
sync() {
|
|
628
|
+
const label = this.getAttribute("label") ?? "";
|
|
629
|
+
const split = this.hasAttribute("command");
|
|
630
|
+
const iconOnly = this.hasAttribute("icon-only");
|
|
631
|
+
this.text.textContent = label;
|
|
632
|
+
this.text.hidden = iconOnly;
|
|
633
|
+
if (iconOnly) this.main.setAttribute("aria-label", label);
|
|
634
|
+
else this.main.removeAttribute("aria-label");
|
|
635
|
+
const title = this.getAttribute("title") ?? label;
|
|
636
|
+
this.main.title = title;
|
|
637
|
+
this.caret.title = split ? `${label} options` : title;
|
|
638
|
+
if (split) {
|
|
639
|
+
this.caret.setAttribute("aria-label", `${label} options`);
|
|
640
|
+
this.caret.removeAttribute("aria-hidden");
|
|
641
|
+
} else {
|
|
642
|
+
this.caret.removeAttribute("aria-label");
|
|
643
|
+
this.caret.setAttribute("aria-hidden", "true");
|
|
644
|
+
}
|
|
645
|
+
if (split) {
|
|
646
|
+
this.main.removeAttribute("aria-haspopup");
|
|
647
|
+
this.main.removeAttribute("aria-expanded");
|
|
648
|
+
this.caret.tabIndex = 0;
|
|
649
|
+
} else {
|
|
650
|
+
this.main.setAttribute("aria-haspopup", "menu");
|
|
651
|
+
this.main.setAttribute("aria-expanded", String(this.open));
|
|
652
|
+
this.caret.tabIndex = -1;
|
|
653
|
+
}
|
|
654
|
+
const shortcuts = this.getAttribute("keyshortcuts");
|
|
655
|
+
if (shortcuts) this.main.setAttribute("aria-keyshortcuts", shortcuts);
|
|
656
|
+
else this.main.removeAttribute("aria-keyshortcuts");
|
|
657
|
+
this.main.disabled = this.caret.disabled = this.disabled;
|
|
658
|
+
this.wrap.classList.toggle("disabled", this.disabled);
|
|
659
|
+
if (this.disabled) this.hide(false);
|
|
660
|
+
if (paintIcon(this.svg, this.getAttribute("icon"))) this.svg.setAttribute("data-painted", "");
|
|
661
|
+
else this.svg.removeAttribute("data-painted");
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
return OfficeUiMenuButton;
|
|
665
|
+
});
|
|
666
|
+
|
|
356
667
|
// src/ribbon.ts
|
|
357
668
|
var GROUP_CSS = `
|
|
358
669
|
:host { display: inline-flex; flex: none; align-self: stretch; }
|
|
@@ -362,14 +673,25 @@ var GROUP_CSS = `
|
|
|
362
673
|
:host(:last-child) .group { border-inline-end: 0; }
|
|
363
674
|
.row { display: flex; align-items: flex-start; gap: 4px; }
|
|
364
675
|
::slotted(*) { flex-shrink: 0; }
|
|
365
|
-
.
|
|
676
|
+
.foot { position: relative; display: flex; justify-content: center; padding-top: 2px; }
|
|
677
|
+
.caption { color: var(--office-muted-foreground, #6b7280); font-size: 10px;
|
|
366
678
|
line-height: 12px; text-align: center; white-space: nowrap; }
|
|
679
|
+
.launcher { position: absolute; inset-inline-end: -6px; bottom: -1px; display: inline-grid; place-items: center;
|
|
680
|
+
width: 16px; height: 14px; padding: 0; border: 0; border-radius: 2px; background: transparent;
|
|
681
|
+
color: var(--office-muted-foreground, #6b7280); cursor: pointer; }
|
|
682
|
+
.launcher:hover:not(:disabled) { background: var(--office-surface, #f3f4f6); }
|
|
683
|
+
.launcher:focus-visible { outline: 2px solid var(--office-ring, #2563eb); }
|
|
684
|
+
.launcher:disabled { opacity: .45; cursor: not-allowed; }
|
|
685
|
+
.launcher[hidden] { display: none; }
|
|
686
|
+
.launcher svg { width: 10px; height: 10px; fill: none; stroke: currentColor; stroke-width: 1.6;
|
|
687
|
+
stroke-linecap: round; stroke-linejoin: round; }
|
|
367
688
|
@media (forced-colors: active) { .group { border-inline-end-color: CanvasText; } .caption { color: CanvasText; } }
|
|
368
689
|
`;
|
|
369
690
|
var defineRibbonGroup = definer("office-ui-ribbon-group", () => {
|
|
370
691
|
class OfficeUiRibbonGroup extends HTMLElement {
|
|
371
|
-
static observedAttributes = ["label"];
|
|
692
|
+
static observedAttributes = ["label", "launcher", "launcher-disabled"];
|
|
372
693
|
caption;
|
|
694
|
+
launcher;
|
|
373
695
|
constructor() {
|
|
374
696
|
super();
|
|
375
697
|
const doc = this.ownerDocument;
|
|
@@ -382,7 +704,20 @@ var defineRibbonGroup = definer("office-ui-ribbon-group", () => {
|
|
|
382
704
|
row.append(doc.createElement("slot"));
|
|
383
705
|
this.caption = doc.createElement("span");
|
|
384
706
|
this.caption.className = "caption";
|
|
385
|
-
|
|
707
|
+
this.launcher = doc.createElement("button");
|
|
708
|
+
this.launcher.type = "button";
|
|
709
|
+
this.launcher.className = "launcher";
|
|
710
|
+
const glyph = createIconSvg(doc);
|
|
711
|
+
paintIcon(glyph, "launcher");
|
|
712
|
+
this.launcher.append(glyph);
|
|
713
|
+
this.launcher.addEventListener("click", () => {
|
|
714
|
+
const command = this.getAttribute("launcher");
|
|
715
|
+
if (command && !this.launcher.disabled) emit(this, "office-command", { command });
|
|
716
|
+
});
|
|
717
|
+
const foot = doc.createElement("div");
|
|
718
|
+
foot.className = "foot";
|
|
719
|
+
foot.append(this.caption, this.launcher);
|
|
720
|
+
group.append(row, foot);
|
|
386
721
|
root.append(group);
|
|
387
722
|
}
|
|
388
723
|
connectedCallback() {
|
|
@@ -396,6 +731,10 @@ var defineRibbonGroup = definer("office-ui-ribbon-group", () => {
|
|
|
396
731
|
const label = this.getAttribute("label") ?? "";
|
|
397
732
|
this.caption.textContent = label;
|
|
398
733
|
this.setAttribute("aria-label", label);
|
|
734
|
+
this.launcher.hidden = !this.getAttribute("launcher");
|
|
735
|
+
this.launcher.disabled = this.hasAttribute("launcher-disabled");
|
|
736
|
+
this.launcher.setAttribute("aria-label", `${label} options`);
|
|
737
|
+
this.launcher.title = `${label} options`;
|
|
399
738
|
}
|
|
400
739
|
}
|
|
401
740
|
return OfficeUiRibbonGroup;
|
|
@@ -405,7 +744,24 @@ var TOOLBAR_CSS = `
|
|
|
405
744
|
background: var(--office-surface, #f3f4f6); border-bottom: 1px solid var(--office-border, #d1d5db); }
|
|
406
745
|
@media (forced-colors: active) { :host { border-bottom-color: CanvasText; background: Canvas; } }
|
|
407
746
|
`;
|
|
408
|
-
var
|
|
747
|
+
var STACK_CSS = `
|
|
748
|
+
:host { display: inline-flex; flex-direction: column; align-items: flex-start; justify-content: flex-start;
|
|
749
|
+
gap: 1px; align-self: stretch; }
|
|
750
|
+
:host([orientation="horizontal"]) { flex-direction: row; align-items: center; gap: 2px; align-self: auto; }
|
|
751
|
+
::slotted(*) { flex-shrink: 0; }
|
|
752
|
+
`;
|
|
753
|
+
var defineRibbonStack = definer("office-ui-ribbon-stack", () => {
|
|
754
|
+
class OfficeUiRibbonStack extends HTMLElement {
|
|
755
|
+
constructor() {
|
|
756
|
+
super();
|
|
757
|
+
const root = this.attachShadow({ mode: "open" });
|
|
758
|
+
attachStyles(root, controlCss(STACK_CSS));
|
|
759
|
+
root.append(this.ownerDocument.createElement("slot"));
|
|
760
|
+
}
|
|
761
|
+
}
|
|
762
|
+
return OfficeUiRibbonStack;
|
|
763
|
+
});
|
|
764
|
+
var ITEM = "office-ui-button, office-ui-menu-button, office-ui-select, office-ui-checkbox, office-ui-switch";
|
|
409
765
|
var defineToolbar = definer("office-ui-toolbar", () => {
|
|
410
766
|
class OfficeUiToolbar extends HTMLElement {
|
|
411
767
|
constructor() {
|
|
@@ -664,7 +1020,7 @@ var defineStatusBar = definer("office-ui-status-bar", () => {
|
|
|
664
1020
|
}
|
|
665
1021
|
return OfficeUiStatusBar;
|
|
666
1022
|
});
|
|
667
|
-
var
|
|
1023
|
+
var ITEM_CSS2 = `
|
|
668
1024
|
:host { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
|
|
669
1025
|
.label { color: var(--office-muted-foreground, #6b7280); }
|
|
670
1026
|
button { all: unset; display: inline-flex; gap: 4px; align-items: center; cursor: pointer; padding: 0 4px;
|
|
@@ -680,7 +1036,7 @@ var defineStatusItem = definer("office-ui-status-item", () => {
|
|
|
680
1036
|
constructor() {
|
|
681
1037
|
super();
|
|
682
1038
|
this.root = this.attachShadow({ mode: "open", delegatesFocus: true });
|
|
683
|
-
attachStyles(this.root, controlCss(
|
|
1039
|
+
attachStyles(this.root, controlCss(ITEM_CSS2));
|
|
684
1040
|
}
|
|
685
1041
|
connectedCallback() {
|
|
686
1042
|
this.render();
|
|
@@ -1033,6 +1389,9 @@ var CONTROL_DEFINERS = [
|
|
|
1033
1389
|
defineSwitch,
|
|
1034
1390
|
defineSelect,
|
|
1035
1391
|
defineRibbonGroup,
|
|
1392
|
+
defineRibbonStack,
|
|
1393
|
+
defineMenuItem,
|
|
1394
|
+
defineMenuButton,
|
|
1036
1395
|
defineToolbar,
|
|
1037
1396
|
defineDialog,
|
|
1038
1397
|
defineStatusBar,
|
|
@@ -1044,4 +1403,4 @@ function registerControls(registry) {
|
|
|
1044
1403
|
for (const define of CONTROL_DEFINERS) define(registry);
|
|
1045
1404
|
}
|
|
1046
1405
|
|
|
1047
|
-
export { CONTROL_DEFINERS, defineButton, defineCheckbox, defineDialog, defineRibbonGroup, defineSelect, defineStatusBar, defineStatusItem, defineSwitch, defineTabStrip, defineToolbar, defineZoomSlider, registerControls };
|
|
1406
|
+
export { CONTROL_DEFINERS, defineButton, defineCheckbox, defineDialog, defineMenuButton, defineMenuItem, defineRibbonGroup, defineRibbonStack, defineSelect, defineStatusBar, defineStatusItem, defineSwitch, defineTabStrip, defineToolbar, defineZoomSlider, registerControls };
|
package/dist/controls.d.ts
CHANGED
|
@@ -2,18 +2,19 @@ import { defineButton } from './button.js';
|
|
|
2
2
|
import { defineCheckbox, defineSwitch } from './checkable.js';
|
|
3
3
|
import { defineDialog } from './dialog.js';
|
|
4
4
|
import { defineIcon } from './icons.js';
|
|
5
|
-
import {
|
|
5
|
+
import { defineMenuButton, defineMenuItem } from './menu.js';
|
|
6
|
+
import { defineRibbonGroup, defineRibbonStack, defineToolbar } from './ribbon.js';
|
|
6
7
|
import { defineSelect } from './select.js';
|
|
7
8
|
import { defineStatusBar, defineStatusItem } from './status-bar.js';
|
|
8
9
|
import { defineTabStrip } from './tab-strip.js';
|
|
9
10
|
import { defineZoomSlider } from './zoom-slider.js';
|
|
10
|
-
export { defineButton, defineCheckbox, defineDialog, defineIcon, defineRibbonGroup, defineSelect, defineStatusBar, defineStatusItem, defineSwitch, defineTabStrip, defineToolbar, defineZoomSlider, };
|
|
11
|
+
export { defineButton, defineCheckbox, defineDialog, defineIcon, defineMenuButton, defineMenuItem, defineRibbonGroup, defineRibbonStack, defineSelect, defineStatusBar, defineStatusItem, defineSwitch, defineTabStrip, defineToolbar, defineZoomSlider, };
|
|
11
12
|
export type { OfficeCommandEvent } from './button.js';
|
|
12
13
|
export type { OfficeDialogCloseEvent, OfficeDialogCloseReason } from './dialog.js';
|
|
13
14
|
export type { OfficeSelectOption } from './select.js';
|
|
14
15
|
export type { OfficeStatusActivateEvent } from './status-bar.js';
|
|
15
16
|
export type { OfficeTab, OfficeTabSelectEvent } from './tab-strip.js';
|
|
16
17
|
/** Every control of this entry. */
|
|
17
|
-
export declare const CONTROL_DEFINERS: readonly [import("./registry.js").Definer, import("./registry.js").Definer, import("./registry.js").Definer, import("./registry.js").Definer, import("./registry.js").Definer, import("./registry.js").Definer, import("./registry.js").Definer, import("./registry.js").Definer, import("./registry.js").Definer, import("./registry.js").Definer, import("./registry.js").Definer, import("./registry.js").Definer];
|
|
18
|
+
export declare const CONTROL_DEFINERS: readonly [import("./registry.js").Definer, import("./registry.js").Definer, import("./registry.js").Definer, import("./registry.js").Definer, import("./registry.js").Definer, import("./registry.js").Definer, import("./registry.js").Definer, import("./registry.js").Definer, import("./registry.js").Definer, import("./registry.js").Definer, import("./registry.js").Definer, import("./registry.js").Definer, import("./registry.js").Definer, import("./registry.js").Definer, import("./registry.js").Definer];
|
|
18
19
|
/** Idempotent, SSR-safe (no-op without a DOM). */
|
|
19
20
|
export declare function registerControls(registry?: CustomElementRegistry): void;
|
package/dist/controls.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { CONTROL_DEFINERS, defineButton, defineCheckbox, defineDialog, defineRibbonGroup, defineSelect, defineStatusBar, defineStatusItem, defineSwitch, defineTabStrip, defineToolbar, defineZoomSlider, registerControls } from './chunk-
|
|
2
|
-
export { defineIcon } from './chunk-
|
|
1
|
+
export { CONTROL_DEFINERS, defineButton, defineCheckbox, defineDialog, defineMenuButton, defineMenuItem, defineRibbonGroup, defineRibbonStack, defineSelect, defineStatusBar, defineStatusItem, defineSwitch, defineTabStrip, defineToolbar, defineZoomSlider, registerControls } from './chunk-RYUUWQ7F.js';
|
|
2
|
+
export { defineIcon } from './chunk-PCSUQPMC.js';
|
|
3
3
|
import './chunk-EY266IK3.js';
|
package/dist/icons.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { ICON_CSS, createIconSvg, defineIcon, getIcon, listIcons, paintIcon, registerIcon } from './chunk-
|
|
1
|
+
export { ICON_CSS, createIconSvg, defineIcon, getIcon, listIcons, paintIcon, registerIcon } from './chunk-PCSUQPMC.js';
|
|
2
2
|
import './chunk-EY266IK3.js';
|
package/dist/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export * from './smartart.js';
|
|
|
5
5
|
export * from './theme.js';
|
|
6
6
|
export { CONTRACT_REVISION, type Definer } from './registry.js';
|
|
7
7
|
/** Every ooxml-ui tag this package defines, in registration order. */
|
|
8
|
-
export declare const OFFICE_UI_TAGS: readonly ["office-ui-icon", "office-ui-button", "office-ui-checkbox", "office-ui-switch", "office-ui-select", "office-ui-ribbon-group", "office-ui-toolbar", "office-ui-dialog", "office-ui-status-bar", "office-ui-status-item", "office-ui-zoom-slider", "office-ui-tab-strip", "office-ui-presence", "office-ui-smartart"];
|
|
8
|
+
export declare const OFFICE_UI_TAGS: readonly ["office-ui-icon", "office-ui-button", "office-ui-checkbox", "office-ui-switch", "office-ui-select", "office-ui-ribbon-group", "office-ui-ribbon-stack", "office-ui-menu-item", "office-ui-menu-button", "office-ui-toolbar", "office-ui-dialog", "office-ui-status-bar", "office-ui-status-item", "office-ui-zoom-slider", "office-ui-tab-strip", "office-ui-presence", "office-ui-smartart"];
|
|
9
9
|
/**
|
|
10
10
|
* Install the theme tokens and define every element. Idempotent and safe to call from every
|
|
11
11
|
* viewer binding; a no-op where there is no DOM (SSR).
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { installOfficeUiTheme } from './chunk-H4KFVIGT.js';
|
|
2
2
|
export { THEME_CSS, THEME_STYLE_ID, installOfficeUiTheme } from './chunk-H4KFVIGT.js';
|
|
3
|
-
import { registerControls } from './chunk-
|
|
4
|
-
export { CONTROL_DEFINERS, defineButton, defineCheckbox, defineDialog, defineRibbonGroup, defineSelect, defineStatusBar, defineStatusItem, defineSwitch, defineTabStrip, defineToolbar, defineZoomSlider, registerControls } from './chunk-
|
|
5
|
-
export { ICON_CSS, createIconSvg, defineIcon, getIcon, listIcons, paintIcon, registerIcon } from './chunk-
|
|
3
|
+
import { registerControls } from './chunk-RYUUWQ7F.js';
|
|
4
|
+
export { CONTROL_DEFINERS, defineButton, defineCheckbox, defineDialog, defineMenuButton, defineMenuItem, defineRibbonGroup, defineRibbonStack, defineSelect, defineStatusBar, defineStatusItem, defineSwitch, defineTabStrip, defineToolbar, defineZoomSlider, registerControls } from './chunk-RYUUWQ7F.js';
|
|
5
|
+
export { ICON_CSS, createIconSvg, defineIcon, getIcon, listIcons, paintIcon, registerIcon } from './chunk-PCSUQPMC.js';
|
|
6
6
|
import { definePresence } from './chunk-RLPL7Q6J.js';
|
|
7
7
|
export { definePresence, initialsOf, participantsFromAwareness } from './chunk-RLPL7Q6J.js';
|
|
8
8
|
import { defineSmartArt } from './chunk-KJV76AB7.js';
|
|
@@ -17,6 +17,9 @@ var OFFICE_UI_TAGS = [
|
|
|
17
17
|
"office-ui-switch",
|
|
18
18
|
"office-ui-select",
|
|
19
19
|
"office-ui-ribbon-group",
|
|
20
|
+
"office-ui-ribbon-stack",
|
|
21
|
+
"office-ui-menu-item",
|
|
22
|
+
"office-ui-menu-button",
|
|
20
23
|
"office-ui-toolbar",
|
|
21
24
|
"office-ui-dialog",
|
|
22
25
|
"office-ui-status-bar",
|
package/dist/menu.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One menu entry: `command`, `label`, `icon`, `disabled`, `checked` (renders a
|
|
3
|
+
* `menuitemcheckbox`), `title`. Activation emits `office-command` `{ command }`.
|
|
4
|
+
*/
|
|
5
|
+
export declare const defineMenuItem: import("./registry.js").Definer;
|
|
6
|
+
/**
|
|
7
|
+
* Dropdown command with a menu of `office-ui-menu-item` children (Office's Find, Layers,
|
|
8
|
+
* Align). With a `command` attribute it is a split button: the main part emits that command
|
|
9
|
+
* and the caret opens the menu. Attributes: `label`, `icon`, `command`, `variant="stacked"`, `icon-only`,
|
|
10
|
+
* `disabled`, `title`, `keyshortcuts`. The menu uses the top layer (`popover`) so ribbon
|
|
11
|
+
* overflow never clips it. Keyboard: Enter, Space or ArrowDown open; arrows, Home and End move;
|
|
12
|
+
* Escape and Tab close; focus returns to the trigger. Choosing an item closes the menu; its
|
|
13
|
+
* `office-command` bubbles to the host.
|
|
14
|
+
*/
|
|
15
|
+
export declare const defineMenuButton: import("./registry.js").Definer;
|
package/dist/ribbon.d.ts
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* Labelled group of ribbon commands: `role="group"`, `label` attribute is caption and name.
|
|
3
|
+
* `launcher="<command>"` adds Office's corner dialog launcher, which emits `office-command`
|
|
4
|
+
* `{ command }`; `launcher-disabled` disables it.
|
|
5
|
+
*/
|
|
2
6
|
export declare const defineRibbonGroup: import("./registry.js").Definer;
|
|
7
|
+
/**
|
|
8
|
+
* Layout for small ribbon commands: a column (Office's three-row stack of Cut, Copy and Format
|
|
9
|
+
* Painter) or, with `orientation="horizontal"`, a row (Bold, Italic, Underline). Not a group.
|
|
10
|
+
*/
|
|
11
|
+
export declare const defineRibbonStack: import("./registry.js").Definer;
|
|
3
12
|
/**
|
|
4
13
|
* `role="toolbar"` container. Left/Right/Home/End move focus between enabled direct or
|
|
5
14
|
* group-nested controls (Up/Down instead when `aria-orientation="vertical"`).
|