ooxml-ui 0.5.0 → 0.7.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 +18 -17
- package/dist/{chunk-7NLQECYW.js → chunk-LCHYMVBZ.js} +209 -11
- package/dist/command-search.d.ts +18 -0
- package/dist/controls.d.ts +4 -2
- package/dist/controls.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -58,23 +58,24 @@ 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`, `launcher` (dialog launcher command), `launcher-disabled`; default slot
|
|
67
|
-
| `office-ui-ribbon-stack` | `orientation="horizontal"`; default slot (three-row column of small commands by default)
|
|
68
|
-
| `office-ui-menu-button` / `-menu-item` | button: `label`, `icon`, `command` (split button), `variant`, `disabled`, `keyshortcuts`; item: `command`, `label`, `icon`, `disabled`, `checked`
|
|
69
|
-
| `office-ui-toolbar` | `aria-label`, `aria-orientation`; arrow-key focus movement
|
|
70
|
-
| `office-ui-dialog` | `open`, `heading`, `dismissible="false"`, `show()`, `close()`; slots default, `footer`
|
|
71
|
-
| `office-ui-status-bar` / `-status-item` | `label`, `value`, `interactive`, `id`
|
|
72
|
-
| `office-ui-zoom-slider` | `value` (percent), `min`, `max`, `step`, `disabled`, `fit` (fit button name), `label`
|
|
73
|
-
| `office-ui-tab-strip` | `tabs` `[{ id, label, title? }]`, `selected`, `label`, `previous-label`, `next-label`, `add-label`, `add-disabled`, `add-title`, `disabled`
|
|
74
|
-
| `office-ui-context-menu` / `office-ui-menu-separator` | `label`; `openAt(x, y)`, `close()`, `open`; `office-ui-menu-item` and separator children
|
|
75
|
-
| `office-ui-
|
|
76
|
-
| `office-ui-
|
|
77
|
-
| `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`, `previous-label`, `next-label`, `add-label`, `add-disabled`, `add-title`, `disabled` | `office-tab-select` `{ id }` (cancelable); add: `office-command` `{ command: 'tab-add' }` |
|
|
74
|
+
| `office-ui-context-menu` / `office-ui-menu-separator` | `label`; `openAt(x, y)`, `close()`, `open`; `office-ui-menu-item` and separator children | item choice: `office-command` `{ command }` |
|
|
75
|
+
| `office-ui-command-search` | `commands` `[{ id, label, keywords?, description?, disabled?, title? }]`, `placeholder`, `label`, `limit` (Office's "Tell me what you want to do") | choice: `office-command` `{ command }` |
|
|
76
|
+
| `office-ui-presence` | `participants`, `max`, `label` | `office-presence-select` `{ id }` |
|
|
77
|
+
| `office-ui-smartart` | `drawing` (core `DiagramDrawing`), `schemeColors`, `label` | `office-smartart-render` (render report) |
|
|
78
|
+
| `office-ui-icon` | `name`, `label` | none |
|
|
78
79
|
|
|
79
80
|
Setting a property never emits an event; only user activation does. Controls honour
|
|
80
81
|
`prefers-color-scheme`, `forced-colors: active` (system colours and a visible focus ring) and
|
|
@@ -353,8 +353,205 @@ var defineDialog = definer("office-ui-dialog", () => {
|
|
|
353
353
|
return OfficeUiDialog;
|
|
354
354
|
});
|
|
355
355
|
|
|
356
|
-
// src/
|
|
356
|
+
// src/command-search.ts
|
|
357
357
|
var CSS3 = `
|
|
358
|
+
:host { display: inline-flex; align-items: center; min-width: 0; font-family: var(--office-font, system-ui, sans-serif); }
|
|
359
|
+
.field { display: flex; align-items: center; gap: 6px; width: 100%; min-width: 0; height: var(--office-target-size, 28px);
|
|
360
|
+
padding: 0 8px; box-sizing: border-box; border: 1px solid transparent; border-radius: var(--office-radius, 4px);
|
|
361
|
+
color: var(--office-muted-foreground, #6b7280); }
|
|
362
|
+
.field:hover, .field:focus-within { border-color: var(--office-border, #d1d5db); background: var(--office-background, #fff); }
|
|
363
|
+
input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--office-foreground, #1f2937);
|
|
364
|
+
font: inherit; font-size: 13px; }
|
|
365
|
+
svg { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5;
|
|
366
|
+
stroke-linecap: round; stroke-linejoin: round; }
|
|
367
|
+
ul { position: fixed; inset: auto; margin: 0; padding: 4px; min-width: 240px; max-height: 320px; overflow: auto;
|
|
368
|
+
box-sizing: border-box; list-style: none; background: var(--office-background, #fff); color: var(--office-foreground, #1f2937);
|
|
369
|
+
border: 1px solid var(--office-border, #d1d5db); border-radius: var(--office-radius, 4px);
|
|
370
|
+
box-shadow: 0 8px 24px rgb(0 0 0 / 18%); font-size: 12px; }
|
|
371
|
+
ul[hidden] { display: none; }
|
|
372
|
+
li { display: flex; flex-direction: column; justify-content: center; min-height: var(--office-target-size, 28px);
|
|
373
|
+
padding: 2px 10px; border-radius: 3px; cursor: pointer; }
|
|
374
|
+
li[data-active] { background: var(--office-surface, #f3f4f6); }
|
|
375
|
+
li[aria-disabled="true"] { cursor: not-allowed; color: var(--office-muted-foreground, #6b7280); }
|
|
376
|
+
li small { color: var(--office-muted-foreground, #6b7280); font-size: 11px; }
|
|
377
|
+
li.empty { cursor: default; color: var(--office-muted-foreground, #6b7280); }
|
|
378
|
+
@media (forced-colors: active) {
|
|
379
|
+
.field, ul { border-color: CanvasText; background: Canvas; color: CanvasText; }
|
|
380
|
+
li[data-active] { background: Highlight; color: HighlightText; }
|
|
381
|
+
}
|
|
382
|
+
`;
|
|
383
|
+
var uid = 0;
|
|
384
|
+
var defineCommandSearch = definer("office-ui-command-search", () => {
|
|
385
|
+
class OfficeUiCommandSearch extends HTMLElement {
|
|
386
|
+
static observedAttributes = ["placeholder", "label"];
|
|
387
|
+
items = [];
|
|
388
|
+
found = [];
|
|
389
|
+
active = -1;
|
|
390
|
+
input;
|
|
391
|
+
list;
|
|
392
|
+
uid = `office-command-search-${++uid}`;
|
|
393
|
+
constructor() {
|
|
394
|
+
super();
|
|
395
|
+
const doc = this.ownerDocument;
|
|
396
|
+
const root = this.attachShadow({ mode: "open", delegatesFocus: true });
|
|
397
|
+
attachStyles(root, controlCss(CSS3));
|
|
398
|
+
const field = doc.createElement("div");
|
|
399
|
+
field.className = "field";
|
|
400
|
+
const glass = createIconSvg(doc);
|
|
401
|
+
paintIcon(glass, "search");
|
|
402
|
+
glass.setAttribute("data-painted", "");
|
|
403
|
+
this.input = doc.createElement("input");
|
|
404
|
+
this.input.type = "search";
|
|
405
|
+
this.input.autocomplete = "off";
|
|
406
|
+
this.input.spellcheck = false;
|
|
407
|
+
this.input.setAttribute("role", "combobox");
|
|
408
|
+
this.input.setAttribute("aria-autocomplete", "list");
|
|
409
|
+
this.input.setAttribute("aria-expanded", "false");
|
|
410
|
+
this.input.setAttribute("aria-controls", `${this.uid}-list`);
|
|
411
|
+
this.list = doc.createElement("ul");
|
|
412
|
+
this.list.id = `${this.uid}-list`;
|
|
413
|
+
this.list.setAttribute("role", "listbox");
|
|
414
|
+
if (typeof this.list.showPopover === "function")
|
|
415
|
+
this.list.setAttribute("popover", "manual");
|
|
416
|
+
else this.list.hidden = true;
|
|
417
|
+
field.append(glass, this.input);
|
|
418
|
+
root.append(field, this.list);
|
|
419
|
+
this.input.addEventListener("input", () => this.update());
|
|
420
|
+
this.input.addEventListener("keydown", (event) => this.onKey(event));
|
|
421
|
+
this.input.addEventListener("blur", () => this.hide());
|
|
422
|
+
this.list.addEventListener("pointerdown", (event) => event.preventDefault());
|
|
423
|
+
this.list.addEventListener("click", (event) => {
|
|
424
|
+
const item = event.target.closest("li[data-index]");
|
|
425
|
+
if (item) this.choose(Number(item.dataset.index));
|
|
426
|
+
});
|
|
427
|
+
}
|
|
428
|
+
connectedCallback() {
|
|
429
|
+
this.sync();
|
|
430
|
+
}
|
|
431
|
+
disconnectedCallback() {
|
|
432
|
+
this.hide();
|
|
433
|
+
}
|
|
434
|
+
attributeChangedCallback() {
|
|
435
|
+
this.sync();
|
|
436
|
+
}
|
|
437
|
+
get commands() {
|
|
438
|
+
return this.items.map((item) => ({ ...item }));
|
|
439
|
+
}
|
|
440
|
+
set commands(value) {
|
|
441
|
+
this.items = (Array.isArray(value) ? value : []).filter((item) => item && typeof item.id === "string").map((item) => ({ ...item, label: String(item.label ?? "") }));
|
|
442
|
+
if (this.isOpen) this.update();
|
|
443
|
+
}
|
|
444
|
+
get isOpen() {
|
|
445
|
+
return this.input.getAttribute("aria-expanded") === "true";
|
|
446
|
+
}
|
|
447
|
+
sync() {
|
|
448
|
+
this.input.placeholder = this.getAttribute("placeholder") ?? "Tell me what you want to do";
|
|
449
|
+
this.input.setAttribute("aria-label", this.getAttribute("label") ?? this.input.placeholder);
|
|
450
|
+
}
|
|
451
|
+
update() {
|
|
452
|
+
const query = this.input.value.trim().toLowerCase();
|
|
453
|
+
if (!query) return this.hide();
|
|
454
|
+
const limit = Math.max(1, Number(this.getAttribute("limit")) || 8);
|
|
455
|
+
const rank = (item) => (item.disabled ? 2 : 0) + (item.label.toLowerCase().startsWith(query) ? 0 : 1);
|
|
456
|
+
this.found = this.items.map((item, order) => ({ item, order })).filter(
|
|
457
|
+
({ item }) => `${item.label} ${item.keywords ?? ""} ${item.description ?? ""}`.toLowerCase().includes(query)
|
|
458
|
+
).sort((a, b) => rank(a.item) - rank(b.item) || a.order - b.order).map(({ item }) => item).slice(0, limit);
|
|
459
|
+
this.active = this.found.findIndex((item) => !item.disabled);
|
|
460
|
+
this.render();
|
|
461
|
+
this.show();
|
|
462
|
+
}
|
|
463
|
+
render() {
|
|
464
|
+
const doc = this.ownerDocument;
|
|
465
|
+
if (!this.found.length) {
|
|
466
|
+
const empty = doc.createElement("li");
|
|
467
|
+
empty.className = "empty";
|
|
468
|
+
empty.setAttribute("role", "option");
|
|
469
|
+
empty.setAttribute("aria-disabled", "true");
|
|
470
|
+
empty.textContent = "No matching commands";
|
|
471
|
+
this.list.replaceChildren(empty);
|
|
472
|
+
this.input.removeAttribute("aria-activedescendant");
|
|
473
|
+
return;
|
|
474
|
+
}
|
|
475
|
+
this.list.replaceChildren(
|
|
476
|
+
...this.found.map((item, index) => {
|
|
477
|
+
const option = doc.createElement("li");
|
|
478
|
+
option.id = `${this.uid}-${index}`;
|
|
479
|
+
option.dataset.index = String(index);
|
|
480
|
+
option.setAttribute("role", "option");
|
|
481
|
+
option.setAttribute("aria-selected", String(index === this.active));
|
|
482
|
+
if (index === this.active) option.setAttribute("data-active", "");
|
|
483
|
+
const label = doc.createElement("span");
|
|
484
|
+
label.textContent = item.label;
|
|
485
|
+
option.append(label);
|
|
486
|
+
if (item.disabled) option.setAttribute("aria-disabled", "true");
|
|
487
|
+
const detail = item.disabled ? item.title ?? "Not available" : item.description;
|
|
488
|
+
if (detail) {
|
|
489
|
+
const line = doc.createElement("small");
|
|
490
|
+
line.textContent = detail;
|
|
491
|
+
option.append(line);
|
|
492
|
+
}
|
|
493
|
+
return option;
|
|
494
|
+
})
|
|
495
|
+
);
|
|
496
|
+
if (this.active >= 0)
|
|
497
|
+
this.input.setAttribute("aria-activedescendant", `${this.uid}-${this.active}`);
|
|
498
|
+
else this.input.removeAttribute("aria-activedescendant");
|
|
499
|
+
}
|
|
500
|
+
show() {
|
|
501
|
+
const box = this.input.getBoundingClientRect();
|
|
502
|
+
this.list.style.left = `${Math.round(box.left)}px`;
|
|
503
|
+
this.list.style.top = `${Math.round(box.bottom + 4)}px`;
|
|
504
|
+
if (this.list.hasAttribute("popover")) {
|
|
505
|
+
if (!this.isOpen) this.list.showPopover?.();
|
|
506
|
+
} else this.list.hidden = false;
|
|
507
|
+
this.input.setAttribute("aria-expanded", "true");
|
|
508
|
+
}
|
|
509
|
+
hide() {
|
|
510
|
+
if (!this.isOpen) return;
|
|
511
|
+
if (this.list.hasAttribute("popover")) {
|
|
512
|
+
try {
|
|
513
|
+
this.list.hidePopover?.();
|
|
514
|
+
} catch {
|
|
515
|
+
}
|
|
516
|
+
} else this.list.hidden = true;
|
|
517
|
+
this.input.setAttribute("aria-expanded", "false");
|
|
518
|
+
this.input.removeAttribute("aria-activedescendant");
|
|
519
|
+
}
|
|
520
|
+
move(step) {
|
|
521
|
+
const enabled = this.found.map((item, index) => item.disabled ? -1 : index).filter((i) => i >= 0);
|
|
522
|
+
if (!enabled.length) return;
|
|
523
|
+
const at = enabled.indexOf(this.active);
|
|
524
|
+
this.active = enabled[(at + step + enabled.length) % enabled.length];
|
|
525
|
+
this.render();
|
|
526
|
+
}
|
|
527
|
+
choose(index) {
|
|
528
|
+
const item = this.found[index];
|
|
529
|
+
if (!item || item.disabled) return;
|
|
530
|
+
this.input.value = "";
|
|
531
|
+
this.hide();
|
|
532
|
+
emit(this, "office-command", { command: item.id });
|
|
533
|
+
}
|
|
534
|
+
onKey(event) {
|
|
535
|
+
if (event.key === "ArrowDown" || event.key === "ArrowUp") {
|
|
536
|
+
event.preventDefault();
|
|
537
|
+
if (!this.isOpen) this.update();
|
|
538
|
+
else this.move(event.key === "ArrowDown" ? 1 : -1);
|
|
539
|
+
} else if (event.key === "Enter") {
|
|
540
|
+
event.preventDefault();
|
|
541
|
+
this.choose(this.active);
|
|
542
|
+
} else if (event.key === "Escape") {
|
|
543
|
+
event.preventDefault();
|
|
544
|
+
event.stopPropagation();
|
|
545
|
+
if (this.isOpen) this.hide();
|
|
546
|
+
else this.input.value = "";
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
return OfficeUiCommandSearch;
|
|
551
|
+
});
|
|
552
|
+
|
|
553
|
+
// src/context-menu.ts
|
|
554
|
+
var CSS4 = `
|
|
358
555
|
:host { display: contents; }
|
|
359
556
|
.panel { position: fixed; inset: auto; margin: 0; min-width: 200px; padding: 4px; box-sizing: border-box;
|
|
360
557
|
background: var(--office-background, #fff); color: var(--office-foreground, #1f2937);
|
|
@@ -390,7 +587,7 @@ var defineContextMenu = definer("office-ui-context-menu", () => {
|
|
|
390
587
|
super();
|
|
391
588
|
const doc = this.ownerDocument;
|
|
392
589
|
const root = this.attachShadow({ mode: "open" });
|
|
393
|
-
attachStyles(root, controlCss(
|
|
590
|
+
attachStyles(root, controlCss(CSS4));
|
|
394
591
|
this.panel = doc.createElement("div");
|
|
395
592
|
this.panel.className = "panel";
|
|
396
593
|
this.panel.setAttribute("role", "menu");
|
|
@@ -929,7 +1126,7 @@ var defineToolbar = definer("office-ui-toolbar", () => {
|
|
|
929
1126
|
});
|
|
930
1127
|
|
|
931
1128
|
// src/select.ts
|
|
932
|
-
var
|
|
1129
|
+
var CSS5 = `
|
|
933
1130
|
:host { display: inline-block; position: relative; vertical-align: middle; }
|
|
934
1131
|
button { box-sizing: border-box; display: flex; align-items: center; justify-content: space-between; gap: 8px;
|
|
935
1132
|
width: 100%; min-height: var(--office-target-size, 28px); padding: 0 8px; font: inherit; font-size: 12px;
|
|
@@ -951,7 +1148,7 @@ li[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
|
|
|
951
1148
|
li[data-active] { background: Highlight; color: HighlightText; }
|
|
952
1149
|
}
|
|
953
1150
|
`;
|
|
954
|
-
var
|
|
1151
|
+
var uid2 = 0;
|
|
955
1152
|
var defineSelect = definer("office-ui-select", () => {
|
|
956
1153
|
class OfficeUiSelect extends HTMLElement {
|
|
957
1154
|
static observedAttributes = ["value", "disabled", "aria-label"];
|
|
@@ -963,12 +1160,12 @@ var defineSelect = definer("office-ui-select", () => {
|
|
|
963
1160
|
trigger;
|
|
964
1161
|
list;
|
|
965
1162
|
label;
|
|
966
|
-
domId = `office-ui-select-${++
|
|
1163
|
+
domId = `office-ui-select-${++uid2}`;
|
|
967
1164
|
constructor() {
|
|
968
1165
|
super();
|
|
969
1166
|
const doc = this.ownerDocument;
|
|
970
1167
|
const root = this.attachShadow({ mode: "open", delegatesFocus: true });
|
|
971
|
-
attachStyles(root, controlCss(
|
|
1168
|
+
attachStyles(root, controlCss(CSS5));
|
|
972
1169
|
this.trigger = doc.createElement("button");
|
|
973
1170
|
this.trigger.type = "button";
|
|
974
1171
|
this.trigger.setAttribute("role", "combobox");
|
|
@@ -1219,7 +1416,7 @@ var defineStatusItem = definer("office-ui-status-item", () => {
|
|
|
1219
1416
|
});
|
|
1220
1417
|
|
|
1221
1418
|
// src/tab-strip.ts
|
|
1222
|
-
var
|
|
1419
|
+
var CSS6 = `
|
|
1223
1420
|
:host { display: flex; align-items: stretch; min-width: 0; min-height: 28px; gap: 2px; padding: 0 6px;
|
|
1224
1421
|
background: var(--office-surface, #f3f4f6); color: var(--office-muted-foreground, #6b7280);
|
|
1225
1422
|
border-top: 1px solid var(--office-border, #d1d5db); font-size: 12px;
|
|
@@ -1266,7 +1463,7 @@ var defineTabStrip = definer("office-ui-tab-strip", () => {
|
|
|
1266
1463
|
super();
|
|
1267
1464
|
const doc = this.ownerDocument;
|
|
1268
1465
|
const root = this.attachShadow({ mode: "open" });
|
|
1269
|
-
attachStyles(root, controlCss(
|
|
1466
|
+
attachStyles(root, controlCss(CSS6));
|
|
1270
1467
|
const step = (name, icon) => {
|
|
1271
1468
|
const button = doc.createElement("button");
|
|
1272
1469
|
button.type = "button";
|
|
@@ -1405,7 +1602,7 @@ var defineTabStrip = definer("office-ui-tab-strip", () => {
|
|
|
1405
1602
|
});
|
|
1406
1603
|
|
|
1407
1604
|
// src/zoom-slider.ts
|
|
1408
|
-
var
|
|
1605
|
+
var CSS7 = `
|
|
1409
1606
|
:host { display: inline-flex; align-items: center; gap: 2px; font-size: 11px;
|
|
1410
1607
|
color: var(--office-foreground, #1f2937); font-family: var(--office-font, system-ui, sans-serif); }
|
|
1411
1608
|
button { box-sizing: border-box; display: inline-grid; place-items: center; min-width: var(--office-target-size, 24px);
|
|
@@ -1441,7 +1638,7 @@ var defineZoomSlider = definer("office-ui-zoom-slider", () => {
|
|
|
1441
1638
|
super();
|
|
1442
1639
|
const doc = this.ownerDocument;
|
|
1443
1640
|
const root = this.attachShadow({ mode: "open" });
|
|
1444
|
-
attachStyles(root, controlCss(
|
|
1641
|
+
attachStyles(root, controlCss(CSS7));
|
|
1445
1642
|
const button = (name, text) => {
|
|
1446
1643
|
const element = doc.createElement("button");
|
|
1447
1644
|
element.type = "button";
|
|
@@ -1548,6 +1745,7 @@ var CONTROL_DEFINERS = [
|
|
|
1548
1745
|
defineMenuSeparator,
|
|
1549
1746
|
defineMenuButton,
|
|
1550
1747
|
defineContextMenu,
|
|
1748
|
+
defineCommandSearch,
|
|
1551
1749
|
defineToolbar,
|
|
1552
1750
|
defineDialog,
|
|
1553
1751
|
defineStatusBar,
|
|
@@ -1559,4 +1757,4 @@ function registerControls(registry) {
|
|
|
1559
1757
|
for (const define of CONTROL_DEFINERS) define(registry);
|
|
1560
1758
|
}
|
|
1561
1759
|
|
|
1562
|
-
export { CONTROL_DEFINERS, defineButton, defineCheckbox, defineContextMenu, defineDialog, defineMenuButton, defineMenuItem, defineMenuSeparator, defineRibbonGroup, defineRibbonStack, defineSelect, defineStatusBar, defineStatusItem, defineSwitch, defineTabStrip, defineToolbar, defineZoomSlider, registerControls };
|
|
1760
|
+
export { CONTROL_DEFINERS, defineButton, defineCheckbox, defineCommandSearch, defineContextMenu, defineDialog, defineMenuButton, defineMenuItem, defineMenuSeparator, defineRibbonGroup, defineRibbonStack, defineSelect, defineStatusBar, defineStatusItem, defineSwitch, defineTabStrip, defineToolbar, defineZoomSlider, registerControls };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** One searchable command: label and optional keywords; disabled commands show their reason. */
|
|
2
|
+
export interface OfficeSearchCommand {
|
|
3
|
+
id: string;
|
|
4
|
+
label: string;
|
|
5
|
+
keywords?: string;
|
|
6
|
+
/** Where the command lives, shown under the label (for example "Home › Paragraph"). */
|
|
7
|
+
description?: string;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
title?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Office's "Tell me what you want to do" box. Set `commands` (`OfficeSearchCommand[]`); typing
|
|
13
|
+
* lists up to `limit` (default 8) matches by label or keywords in a top-layer listbox.
|
|
14
|
+
* ArrowUp/Down move, Enter or click run an enabled match (`office-command` `{ command }`),
|
|
15
|
+
* Escape closes then clears. Disabled matches stay visible with their reason. Attributes:
|
|
16
|
+
* `placeholder`, `label` (accessible name), `limit`. Setting `commands` never emits.
|
|
17
|
+
*/
|
|
18
|
+
export declare const defineCommandSearch: import("./registry.js").Definer;
|
package/dist/controls.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ 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 { defineCommandSearch } from './command-search.js';
|
|
5
6
|
import { defineContextMenu, defineMenuSeparator } from './context-menu.js';
|
|
6
7
|
import { defineMenuButton, defineMenuItem } from './menu.js';
|
|
7
8
|
import { defineRibbonGroup, defineRibbonStack, defineToolbar } from './ribbon.js';
|
|
@@ -9,13 +10,14 @@ import { defineSelect } from './select.js';
|
|
|
9
10
|
import { defineStatusBar, defineStatusItem } from './status-bar.js';
|
|
10
11
|
import { defineTabStrip } from './tab-strip.js';
|
|
11
12
|
import { defineZoomSlider } from './zoom-slider.js';
|
|
12
|
-
export { defineButton, defineCheckbox, defineContextMenu, defineDialog, defineIcon, defineMenuButton, defineMenuItem, defineMenuSeparator, defineRibbonGroup, defineRibbonStack, defineSelect, defineStatusBar, defineStatusItem, defineSwitch, defineTabStrip, defineToolbar, defineZoomSlider, };
|
|
13
|
+
export { defineButton, defineCheckbox, defineCommandSearch, defineContextMenu, defineDialog, defineIcon, defineMenuButton, defineMenuItem, defineMenuSeparator, defineRibbonGroup, defineRibbonStack, defineSelect, defineStatusBar, defineStatusItem, defineSwitch, defineTabStrip, defineToolbar, defineZoomSlider, };
|
|
13
14
|
export type { OfficeCommandEvent } from './button.js';
|
|
14
15
|
export type { OfficeDialogCloseEvent, OfficeDialogCloseReason } from './dialog.js';
|
|
15
16
|
export type { OfficeSelectOption } from './select.js';
|
|
16
17
|
export type { OfficeStatusActivateEvent } from './status-bar.js';
|
|
17
18
|
export type { OfficeTab, OfficeTabSelectEvent } from './tab-strip.js';
|
|
19
|
+
export type { OfficeSearchCommand } from './command-search.js';
|
|
18
20
|
/** Every control of this entry. */
|
|
19
|
-
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, import("./registry.js").Definer, import("./registry.js").Definer];
|
|
21
|
+
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, import("./registry.js").Definer, import("./registry.js").Definer, import("./registry.js").Definer];
|
|
20
22
|
/** Idempotent, SSR-safe (no-op without a DOM). */
|
|
21
23
|
export declare function registerControls(registry?: CustomElementRegistry): void;
|
package/dist/controls.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { CONTROL_DEFINERS, defineButton, defineCheckbox, defineContextMenu, defineDialog, defineMenuButton, defineMenuItem, defineMenuSeparator, defineRibbonGroup, defineRibbonStack, defineSelect, defineStatusBar, defineStatusItem, defineSwitch, defineTabStrip, defineToolbar, defineZoomSlider, registerControls } from './chunk-
|
|
1
|
+
export { CONTROL_DEFINERS, defineButton, defineCheckbox, defineCommandSearch, defineContextMenu, defineDialog, defineMenuButton, defineMenuItem, defineMenuSeparator, defineRibbonGroup, defineRibbonStack, defineSelect, defineStatusBar, defineStatusItem, defineSwitch, defineTabStrip, defineToolbar, defineZoomSlider, registerControls } from './chunk-LCHYMVBZ.js';
|
|
2
2
|
export { defineIcon } from './chunk-PCSUQPMC.js';
|
|
3
3
|
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-ribbon-stack", "office-ui-menu-item", "office-ui-menu-button", "office-ui-menu-separator", "office-ui-context-menu", "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-menu-separator", "office-ui-context-menu", "office-ui-command-search", "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,7 +1,7 @@
|
|
|
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, defineContextMenu, defineDialog, defineMenuButton, defineMenuItem, defineMenuSeparator, defineRibbonGroup, defineRibbonStack, defineSelect, defineStatusBar, defineStatusItem, defineSwitch, defineTabStrip, defineToolbar, defineZoomSlider, registerControls } from './chunk-
|
|
3
|
+
import { registerControls } from './chunk-LCHYMVBZ.js';
|
|
4
|
+
export { CONTROL_DEFINERS, defineButton, defineCheckbox, defineCommandSearch, defineContextMenu, defineDialog, defineMenuButton, defineMenuItem, defineMenuSeparator, defineRibbonGroup, defineRibbonStack, defineSelect, defineStatusBar, defineStatusItem, defineSwitch, defineTabStrip, defineToolbar, defineZoomSlider, registerControls } from './chunk-LCHYMVBZ.js';
|
|
5
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';
|
|
@@ -22,6 +22,7 @@ var OFFICE_UI_TAGS = [
|
|
|
22
22
|
"office-ui-menu-button",
|
|
23
23
|
"office-ui-menu-separator",
|
|
24
24
|
"office-ui-context-menu",
|
|
25
|
+
"office-ui-command-search",
|
|
25
26
|
"office-ui-toolbar",
|
|
26
27
|
"office-ui-dialog",
|
|
27
28
|
"office-ui-status-bar",
|