ooxml-ui 0.18.1 → 0.19.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 +1 -0
- package/dist/{chunk-OCLDEX4X.js → chunk-6DZC4M2H.js} +128 -23
- package/dist/{chunk-HRWP3FWD.js → chunk-GWAPPX66.js} +7 -2
- package/dist/controls.d.ts +4 -2
- package/dist/controls.js +2 -2
- package/dist/icons.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +4 -3
- package/dist/ribbon-section.d.ts +36 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -90,6 +90,7 @@ with an incompatible build of this package.
|
|
|
90
90
|
| `office-ui-read-only-banner` | `state` `{ kind, message, passwordPromptOpen?, passwordError?, checkingPassword?, labels? }` | `office-read-only-request` (Edit anyway, Dismiss, password submit or cancel) |
|
|
91
91
|
| `office-ui-paste-options` | `state` `{ left, top, options: [{ id, label }], label? }`; fixed 4px past the pasted object | `office-paste-options-request` `{ format }`, `office-paste-options-dismiss` |
|
|
92
92
|
| `office-ui-title-bar` | `state` `{ appMark?, fileName, status?, tone?, autosave?, quickAccess?: { label, items, showLabels? }, search? }`, `placement` (`titleBar`, `belowRibbon`); slots `collaboration`, `account`; tokens `--office-title-bar-*` | `office-autosave-toggle`, `office-command` `{ command }`, `office-command-search` `{ query, command? }` |
|
|
93
|
+
| `office-ui-ribbon-section` | `groups` `[{ id, label, commands: [{ id, label, icon, title?, size?, badge?, disabled?, active?, compact?, hidden?, caret?, pressed?, expanded?, column? }] }]`; keyed groups and commands in the light DOM | the commands' own events (`office-command`) |
|
|
93
94
|
| `office-ui-presence` | `participants`, `max`, `label` | `office-presence-select` `{ id }` |
|
|
94
95
|
| `office-ui-smartart` | `drawing` (core `DiagramDrawing`), `schemeColors`, `label` | `office-smartart-render` (render report) |
|
|
95
96
|
| `office-ui-icon` | `name`, `label` | none |
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createIconSvg, paintIcon, defineIcon } from './chunk-
|
|
1
|
+
import { createIconSvg, paintIcon, defineIcon } from './chunk-GWAPPX66.js';
|
|
2
2
|
import { initialsOf } from './chunk-DECL6RNI.js';
|
|
3
3
|
import { definer, attachStyles, controlCss, present, emit } from './chunk-UYPH4ESZ.js';
|
|
4
4
|
import { tok, FOCUS_RING, COMPACT, OFFICE_TOKENS } from './chunk-A3QNC6VS.js';
|
|
@@ -1486,8 +1486,112 @@ var defineRibbon = definer("office-ui-ribbon", () => {
|
|
|
1486
1486
|
return OfficeUiRibbon;
|
|
1487
1487
|
});
|
|
1488
1488
|
|
|
1489
|
-
// src/
|
|
1489
|
+
// src/ribbon-section.ts
|
|
1490
1490
|
var CSS8 = `
|
|
1491
|
+
:host { display: inline-flex; align-items: stretch; }
|
|
1492
|
+
::slotted(*) { flex: none; }
|
|
1493
|
+
`;
|
|
1494
|
+
var COLUMN_STYLE = { display: "flex", flexDirection: "column", gap: tok("--office-space-0") };
|
|
1495
|
+
function setOptional(el, name, value) {
|
|
1496
|
+
if (value === void 0) el.removeAttribute(name);
|
|
1497
|
+
else el.setAttribute(name, String(value));
|
|
1498
|
+
}
|
|
1499
|
+
function syncCommand(el, command, idAttribute) {
|
|
1500
|
+
el.setAttribute(idAttribute, command.id);
|
|
1501
|
+
el.setAttribute("label", command.label);
|
|
1502
|
+
el.setAttribute("title", command.title ?? command.label);
|
|
1503
|
+
el.setAttribute("icon", command.icon);
|
|
1504
|
+
if (command.badge) el.setAttribute("badge", String(command.badge));
|
|
1505
|
+
else el.removeAttribute("badge");
|
|
1506
|
+
if (command.size) el.setAttribute("size", command.size);
|
|
1507
|
+
for (const name of ["disabled", "active", "compact", "hidden", "caret"])
|
|
1508
|
+
el.toggleAttribute(name, command[name] === true);
|
|
1509
|
+
setOptional(el, "pressed", command.pressed);
|
|
1510
|
+
setOptional(el, "expanded", command.expanded);
|
|
1511
|
+
}
|
|
1512
|
+
var defineRibbonSection = definer("office-ui-ribbon-section", () => {
|
|
1513
|
+
class OfficeUiRibbonSection extends HTMLElement {
|
|
1514
|
+
static groupTag = "office-ui-ribbon-group";
|
|
1515
|
+
static commandTag = "office-ui-button";
|
|
1516
|
+
static groupIdAttribute = "data-ribbon-group";
|
|
1517
|
+
static commandIdAttribute = "command";
|
|
1518
|
+
#groups = [];
|
|
1519
|
+
#groupNodes = /* @__PURE__ */ new Map();
|
|
1520
|
+
#commandNodes = /* @__PURE__ */ new Map();
|
|
1521
|
+
constructor() {
|
|
1522
|
+
super();
|
|
1523
|
+
const root = this.attachShadow({ mode: "open" });
|
|
1524
|
+
attachStyles(root, controlCss(CSS8));
|
|
1525
|
+
root.append(this.ownerDocument.createElement("slot"));
|
|
1526
|
+
}
|
|
1527
|
+
get groups() {
|
|
1528
|
+
return this.#groups;
|
|
1529
|
+
}
|
|
1530
|
+
set groups(value) {
|
|
1531
|
+
this.#groups = value ?? [];
|
|
1532
|
+
this.#render();
|
|
1533
|
+
}
|
|
1534
|
+
connectedCallback() {
|
|
1535
|
+
this.#render();
|
|
1536
|
+
}
|
|
1537
|
+
#render() {
|
|
1538
|
+
const statics = this.constructor;
|
|
1539
|
+
const doc = this.ownerDocument;
|
|
1540
|
+
const model = this.#groups;
|
|
1541
|
+
const wantedGroups = new Set(model.map((group) => group.id));
|
|
1542
|
+
const wantedCommands = new Set(model.flatMap((g) => g.commands.map((c) => c.id)));
|
|
1543
|
+
for (const [id, el] of this.#commandNodes)
|
|
1544
|
+
if (!wantedCommands.has(id)) {
|
|
1545
|
+
el.remove();
|
|
1546
|
+
this.#commandNodes.delete(id);
|
|
1547
|
+
}
|
|
1548
|
+
for (const [id, group] of this.#groupNodes)
|
|
1549
|
+
if (!wantedGroups.has(id)) {
|
|
1550
|
+
group.el.remove();
|
|
1551
|
+
this.#groupNodes.delete(id);
|
|
1552
|
+
}
|
|
1553
|
+
for (const [index, group] of model.entries()) {
|
|
1554
|
+
let node = this.#groupNodes.get(group.id);
|
|
1555
|
+
if (!node) {
|
|
1556
|
+
node = { el: doc.createElement(statics.groupTag), columns: /* @__PURE__ */ new Map() };
|
|
1557
|
+
this.#groupNodes.set(group.id, node);
|
|
1558
|
+
}
|
|
1559
|
+
node.el.setAttribute(statics.groupIdAttribute, group.id);
|
|
1560
|
+
node.el.setAttribute("label", group.label);
|
|
1561
|
+
if (this.children[index] !== node.el)
|
|
1562
|
+
this.insertBefore(node.el, this.children[index] ?? null);
|
|
1563
|
+
const offsets = /* @__PURE__ */ new Map();
|
|
1564
|
+
for (const command of group.commands) {
|
|
1565
|
+
let parent = node.el;
|
|
1566
|
+
if (command.column !== void 0) {
|
|
1567
|
+
let column = node.columns.get(command.column);
|
|
1568
|
+
if (!column) {
|
|
1569
|
+
column = doc.createElement("div");
|
|
1570
|
+
Object.assign(column.style, COLUMN_STYLE);
|
|
1571
|
+
node.columns.set(command.column, column);
|
|
1572
|
+
node.el.append(column);
|
|
1573
|
+
}
|
|
1574
|
+
parent = column;
|
|
1575
|
+
}
|
|
1576
|
+
let el = this.#commandNodes.get(command.id);
|
|
1577
|
+
if (!el) {
|
|
1578
|
+
el = doc.createElement(statics.commandTag);
|
|
1579
|
+
this.#commandNodes.set(command.id, el);
|
|
1580
|
+
}
|
|
1581
|
+
syncCommand(el, command, statics.commandIdAttribute);
|
|
1582
|
+
const offset = offsets.get(parent) ?? 0;
|
|
1583
|
+
if (parent.children[offset] !== el)
|
|
1584
|
+
parent.insertBefore(el, parent.children[offset] ?? null);
|
|
1585
|
+
offsets.set(parent, offset + 1);
|
|
1586
|
+
}
|
|
1587
|
+
}
|
|
1588
|
+
}
|
|
1589
|
+
}
|
|
1590
|
+
return OfficeUiRibbonSection;
|
|
1591
|
+
});
|
|
1592
|
+
|
|
1593
|
+
// src/ruler.ts
|
|
1594
|
+
var CSS9 = `
|
|
1491
1595
|
:host { display: block; box-sizing: border-box; background: ${tok("--office-background")};
|
|
1492
1596
|
color: ${tok("--office-muted-foreground")}; overflow: hidden;
|
|
1493
1597
|
font-size: ${tok("--office-font-size-3xs")}; font-family: ${tok("--office-font")}; }
|
|
@@ -1507,7 +1611,7 @@ var defineRuler = definer("office-ui-ruler", () => {
|
|
|
1507
1611
|
constructor() {
|
|
1508
1612
|
super();
|
|
1509
1613
|
const root = this.attachShadow({ mode: "open" });
|
|
1510
|
-
attachStyles(root, controlCss(
|
|
1614
|
+
attachStyles(root, controlCss(CSS9));
|
|
1511
1615
|
this.#canvas = this.ownerDocument.createElement("canvas");
|
|
1512
1616
|
root.append(this.#canvas);
|
|
1513
1617
|
}
|
|
@@ -1644,7 +1748,7 @@ function clearOfficeProfile(storage = defaultStorage(), key = OFFICE_PROFILE_STO
|
|
|
1644
1748
|
} catch {
|
|
1645
1749
|
}
|
|
1646
1750
|
}
|
|
1647
|
-
var
|
|
1751
|
+
var CSS10 = `
|
|
1648
1752
|
:host { display: block; font-family: ${tok("--office-font")}; font-size: ${tok("--office-font-size")}; }
|
|
1649
1753
|
h2 { margin: 0 0 ${tok("--office-space-3")}; font-size: ${tok("--office-font-size-lg")}; font-weight: 600; }
|
|
1650
1754
|
.who { display: flex; align-items: center; gap: ${tok("--office-space-3")}; margin-bottom: ${tok("--office-space-3")}; }
|
|
@@ -1674,7 +1778,7 @@ var defineAccount = definer("office-ui-account", () => {
|
|
|
1674
1778
|
super();
|
|
1675
1779
|
const doc = this.ownerDocument;
|
|
1676
1780
|
const root = this.attachShadow({ mode: "open" });
|
|
1677
|
-
attachStyles(root, controlCss(
|
|
1781
|
+
attachStyles(root, controlCss(CSS10));
|
|
1678
1782
|
const heading = doc.createElement("h2");
|
|
1679
1783
|
heading.textContent = "User Information";
|
|
1680
1784
|
const who = doc.createElement("div");
|
|
@@ -1775,7 +1879,7 @@ var defineAccount = definer("office-ui-account", () => {
|
|
|
1775
1879
|
});
|
|
1776
1880
|
|
|
1777
1881
|
// src/button.ts
|
|
1778
|
-
var
|
|
1882
|
+
var CSS11 = `
|
|
1779
1883
|
:host { display: inline-flex; vertical-align: middle; }
|
|
1780
1884
|
button { box-sizing: border-box; position: relative; display: inline-flex; align-items: center; justify-content: center;
|
|
1781
1885
|
gap: ${tok("--office-space-1-5")}; min-width: ${tok("--office-target-size")}; min-height: ${tok("--office-target-size")};
|
|
@@ -1854,7 +1958,7 @@ var defineButton = definer("office-ui-button", () => {
|
|
|
1854
1958
|
super();
|
|
1855
1959
|
const doc = this.ownerDocument;
|
|
1856
1960
|
const root = this.attachShadow({ mode: "open", delegatesFocus: true });
|
|
1857
|
-
attachStyles(root, controlCss(
|
|
1961
|
+
attachStyles(root, controlCss(CSS11));
|
|
1858
1962
|
this.button = doc.createElement("button");
|
|
1859
1963
|
this.button.type = "button";
|
|
1860
1964
|
this.button.setAttribute("part", "button");
|
|
@@ -2083,7 +2187,7 @@ var defineCheckbox = definer(
|
|
|
2083
2187
|
var defineSwitch = definer("office-ui-switch", makeCheckable("switch", SWITCH_CSS));
|
|
2084
2188
|
|
|
2085
2189
|
// src/dialog.ts
|
|
2086
|
-
var
|
|
2190
|
+
var CSS12 = `
|
|
2087
2191
|
:host { display: none; position: fixed; inset: 0; z-index: 1000; align-items: center; justify-content: center; }
|
|
2088
2192
|
:host([open]) { display: flex; }
|
|
2089
2193
|
.backdrop { position: absolute; inset: 0; background: ${tok("--office-overlay")}; }
|
|
@@ -2116,7 +2220,7 @@ var defineDialog = definer("office-ui-dialog", () => {
|
|
|
2116
2220
|
super();
|
|
2117
2221
|
const doc = this.ownerDocument;
|
|
2118
2222
|
const root = this.attachShadow({ mode: "open" });
|
|
2119
|
-
attachStyles(root, controlCss(
|
|
2223
|
+
attachStyles(root, controlCss(CSS12));
|
|
2120
2224
|
const backdrop = doc.createElement("div");
|
|
2121
2225
|
backdrop.className = "backdrop";
|
|
2122
2226
|
this.box = doc.createElement("div");
|
|
@@ -2219,7 +2323,7 @@ var defineDialog = definer("office-ui-dialog", () => {
|
|
|
2219
2323
|
});
|
|
2220
2324
|
|
|
2221
2325
|
// src/command-search.ts
|
|
2222
|
-
var
|
|
2326
|
+
var CSS13 = `
|
|
2223
2327
|
:host { display: inline-flex; align-items: center; min-width: 0; font-family: ${tok("--office-font")}; }
|
|
2224
2328
|
.field { display: flex; align-items: center; gap: ${tok("--office-space-1-5")}; width: 100%; min-width: 0; height: ${tok("--office-target-size")};
|
|
2225
2329
|
padding: 0 ${tok("--office-space-2")}; box-sizing: border-box; border: ${tok("--office-border-width")} solid transparent; border-radius: ${tok("--office-radius")};
|
|
@@ -2259,7 +2363,7 @@ var defineCommandSearch = definer("office-ui-command-search", () => {
|
|
|
2259
2363
|
super();
|
|
2260
2364
|
const doc = this.ownerDocument;
|
|
2261
2365
|
const root = this.attachShadow({ mode: "open", delegatesFocus: true });
|
|
2262
|
-
attachStyles(root, controlCss(
|
|
2366
|
+
attachStyles(root, controlCss(CSS13));
|
|
2263
2367
|
const field = doc.createElement("div");
|
|
2264
2368
|
field.className = "field";
|
|
2265
2369
|
const glass = createIconSvg(doc);
|
|
@@ -2448,7 +2552,7 @@ function clampFlyoutPosition(input) {
|
|
|
2448
2552
|
}
|
|
2449
2553
|
|
|
2450
2554
|
// src/context-menu.ts
|
|
2451
|
-
var
|
|
2555
|
+
var CSS14 = `
|
|
2452
2556
|
:host { display: contents; }
|
|
2453
2557
|
:host([data-controlled]) { display: block; position: fixed; z-index: ${tok("--office-z-popover")};
|
|
2454
2558
|
color: ${tok("--office-popover-foreground")}; font: ${tok("--office-font-size-sm")}/${tok("--office-line-height")} ${tok("--office-font")}; }
|
|
@@ -2531,7 +2635,7 @@ var defineContextMenu = definer("office-ui-context-menu", () => {
|
|
|
2531
2635
|
super();
|
|
2532
2636
|
const doc = this.ownerDocument;
|
|
2533
2637
|
const root = this.attachShadow({ mode: "open" });
|
|
2534
|
-
attachStyles(root, controlCss(
|
|
2638
|
+
attachStyles(root, controlCss(CSS14));
|
|
2535
2639
|
this.panel = doc.createElement("div");
|
|
2536
2640
|
this.panel.className = "panel";
|
|
2537
2641
|
this.panel.setAttribute("role", "menu");
|
|
@@ -3182,7 +3286,7 @@ function clampOptionNumber(raw, min, max) {
|
|
|
3182
3286
|
const parsed = Number(raw);
|
|
3183
3287
|
return Number.isFinite(parsed) && raw.trim() !== "" ? Math.min(max, Math.max(min, parsed)) : void 0;
|
|
3184
3288
|
}
|
|
3185
|
-
var
|
|
3289
|
+
var CSS15 = `
|
|
3186
3290
|
:host { display: contents; }
|
|
3187
3291
|
office-ui-dialog { --office-dialog-width: ${tok("--office-options-width")}; --office-dialog-max-width: ${tok("--office-options-width")}; }
|
|
3188
3292
|
.layout { display: grid; grid-template-columns: ${tok("--office-options-nav-width")} minmax(0, 1fr); gap: 0; min-height: ${tok("--office-options-min-height")}; margin: calc(-1 * ${tok("--office-space-4")}); }
|
|
@@ -3231,7 +3335,7 @@ var defineOptionsDialog = definer("office-ui-options-dialog", () => {
|
|
|
3231
3335
|
super();
|
|
3232
3336
|
const doc = this.ownerDocument;
|
|
3233
3337
|
const root = this.attachShadow({ mode: "open" });
|
|
3234
|
-
attachStyles(root, controlCss(
|
|
3338
|
+
attachStyles(root, controlCss(CSS15));
|
|
3235
3339
|
this.#dialog = doc.createElement("office-ui-dialog");
|
|
3236
3340
|
const layout = doc.createElement("div");
|
|
3237
3341
|
layout.className = "layout";
|
|
@@ -4488,7 +4592,7 @@ var defineStatusItem = definer("office-ui-status-item", () => {
|
|
|
4488
4592
|
});
|
|
4489
4593
|
|
|
4490
4594
|
// src/tab-strip.ts
|
|
4491
|
-
var
|
|
4595
|
+
var CSS16 = `
|
|
4492
4596
|
:host { display: flex; align-items: stretch; min-width: 0; min-height: ${tok("--office-tab-height")}; gap: ${tok("--office-space-0")}; padding: 0 ${tok("--office-space-1-5")};
|
|
4493
4597
|
background: ${tok("--office-surface")}; color: ${tok("--office-muted-foreground")};
|
|
4494
4598
|
border-top: ${tok("--office-border-width")} solid ${tok("--office-border")}; font-size: ${tok("--office-font-size-sm")};
|
|
@@ -4535,7 +4639,7 @@ var defineTabStrip = definer("office-ui-tab-strip", () => {
|
|
|
4535
4639
|
super();
|
|
4536
4640
|
const doc = this.ownerDocument;
|
|
4537
4641
|
const root = this.attachShadow({ mode: "open" });
|
|
4538
|
-
attachStyles(root, controlCss(
|
|
4642
|
+
attachStyles(root, controlCss(CSS16));
|
|
4539
4643
|
const step = (name, icon2) => {
|
|
4540
4644
|
const button = doc.createElement("button");
|
|
4541
4645
|
button.type = "button";
|
|
@@ -4900,7 +5004,7 @@ function createTitleBarSearch(doc, fieldTag, request) {
|
|
|
4900
5004
|
}
|
|
4901
5005
|
|
|
4902
5006
|
// src/title-bar.ts
|
|
4903
|
-
var
|
|
5007
|
+
var CSS17 = `
|
|
4904
5008
|
:host { display: block; flex: none; }
|
|
4905
5009
|
:host([data-empty]) { display: none !important; }
|
|
4906
5010
|
[hidden] { display: none !important; }
|
|
@@ -5002,7 +5106,7 @@ var defineTitleBar = definer("office-ui-title-bar", () => {
|
|
|
5002
5106
|
const doc = this.ownerDocument;
|
|
5003
5107
|
const statics = this.constructor;
|
|
5004
5108
|
const root = this.attachShadow({ mode: "open" });
|
|
5005
|
-
attachStyles(root, controlCss(
|
|
5109
|
+
attachStyles(root, controlCss(CSS17));
|
|
5006
5110
|
const el = (tag, className) => {
|
|
5007
5111
|
const node = doc.createElement(tag);
|
|
5008
5112
|
node.className = className;
|
|
@@ -5137,7 +5241,7 @@ var defineTitleBar = definer("office-ui-title-bar", () => {
|
|
|
5137
5241
|
});
|
|
5138
5242
|
|
|
5139
5243
|
// src/zoom-slider.ts
|
|
5140
|
-
var
|
|
5244
|
+
var CSS18 = `
|
|
5141
5245
|
:host { display: inline-flex; align-items: center; gap: ${tok("--office-space-0")}; font-size: ${tok("--office-font-size-xs")};
|
|
5142
5246
|
color: ${tok("--office-foreground")}; font-family: ${tok("--office-font")}; }
|
|
5143
5247
|
button { box-sizing: border-box; display: inline-grid; place-items: center; min-width: ${tok("--office-target-size")};
|
|
@@ -5173,7 +5277,7 @@ var defineZoomSlider = definer("office-ui-zoom-slider", () => {
|
|
|
5173
5277
|
super();
|
|
5174
5278
|
const doc = this.ownerDocument;
|
|
5175
5279
|
const root = this.attachShadow({ mode: "open" });
|
|
5176
|
-
attachStyles(root, controlCss(
|
|
5280
|
+
attachStyles(root, controlCss(CSS18));
|
|
5177
5281
|
const button = (name, text2) => {
|
|
5178
5282
|
const element = doc.createElement("button");
|
|
5179
5283
|
element.type = "button";
|
|
@@ -5448,10 +5552,11 @@ var CONTROL_DEFINERS = [
|
|
|
5448
5552
|
defineToasts,
|
|
5449
5553
|
defineReadOnlyBanner,
|
|
5450
5554
|
definePasteOptions,
|
|
5451
|
-
defineTitleBar
|
|
5555
|
+
defineTitleBar,
|
|
5556
|
+
defineRibbonSection
|
|
5452
5557
|
];
|
|
5453
5558
|
function registerControls(registry) {
|
|
5454
5559
|
for (const define of CONTROL_DEFINERS) define(registry);
|
|
5455
5560
|
}
|
|
5456
5561
|
|
|
5457
|
-
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, defineMenuButton, defineMenuItem, defineMenuSeparator, defineOptionsDialog, definePasteOptions, definePrintPreview, defineRadio, defineReadOnlyBanner, defineRibbon, defineRibbonGroup, defineRibbonStack, defineRibbonToggle, defineRuler, defineSearchField, defineSelect, defineStatusBar, defineStatusItem, defineSwitch, defineTabStrip, defineTitleBar, defineToasts, defineToolbar, defineZoomSlider, nextEnabledIndex, profileInitials, readOfficeProfile, registerControls, rulerDivisions, sanitizeOfficeProfile, typeAheadIndex, writeOfficeProfile };
|
|
5562
|
+
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, 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, profileInitials, readOfficeProfile, registerControls, rulerDivisions, sanitizeOfficeProfile, typeAheadIndex, writeOfficeProfile };
|
|
@@ -92,11 +92,16 @@ function createIconSvg(doc) {
|
|
|
92
92
|
}
|
|
93
93
|
function paintIcon(svg, name) {
|
|
94
94
|
const icon = getIcon(name);
|
|
95
|
-
|
|
95
|
+
const d = icon?.d ?? "";
|
|
96
|
+
const viewBox = icon?.viewBox ?? "0 0 20 20";
|
|
97
|
+
const current = svg.firstElementChild;
|
|
98
|
+
if (svg.getAttribute("viewBox") === viewBox && (icon ? svg.childElementCount === 1 && current?.getAttribute("d") === d : !current))
|
|
99
|
+
return Boolean(icon);
|
|
100
|
+
svg.setAttribute("viewBox", viewBox);
|
|
96
101
|
svg.replaceChildren();
|
|
97
102
|
if (!icon) return false;
|
|
98
103
|
const path = svg.ownerDocument.createElementNS(SVG_NS, "path");
|
|
99
|
-
path.setAttribute("d",
|
|
104
|
+
path.setAttribute("d", d);
|
|
100
105
|
svg.append(path);
|
|
101
106
|
return true;
|
|
102
107
|
}
|
package/dist/controls.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ import { defineBackstage } from './backstage.js';
|
|
|
7
7
|
import { defineFindBar } from './find-bar.js';
|
|
8
8
|
import { definePrintPreview } from './print-preview.js';
|
|
9
9
|
import { defineRibbon } from './ribbon-tabs.js';
|
|
10
|
+
import { defineRibbonSection } from './ribbon-section.js';
|
|
10
11
|
import { defineRuler } from './ruler.js';
|
|
11
12
|
import { defineAccount } from './account.js';
|
|
12
13
|
import { defineButton } from './button.js';
|
|
@@ -23,7 +24,7 @@ import { defineStatusBar, defineStatusItem } from './status-bar.js';
|
|
|
23
24
|
import { defineTabStrip } from './tab-strip.js';
|
|
24
25
|
import { defineTitleBar } from './title-bar.js';
|
|
25
26
|
import { defineZoomSlider } from './zoom-slider.js';
|
|
26
|
-
export { defineAccount, defineDialogFooter, definePasteOptions, defineRadio, defineReadOnlyBanner, defineRibbonToggle, defineSearchField, defineToasts, defineBackstage, defineFindBar, definePrintPreview, defineRibbon, defineRuler, defineButton, defineCheckbox, defineCommandSearch, defineContextMenu, defineDialog, defineIcon, defineMenuButton, defineMenuItem, defineMenuSeparator, defineOptionsDialog, defineRibbonGroup, defineRibbonStack, defineSelect, defineStatusBar, defineStatusItem, defineSwitch, defineTabStrip, defineTitleBar, defineToolbar, defineZoomSlider, };
|
|
27
|
+
export { defineAccount, defineDialogFooter, definePasteOptions, defineRadio, defineReadOnlyBanner, defineRibbonToggle, defineSearchField, defineToasts, defineBackstage, defineFindBar, definePrintPreview, defineRibbon, defineRuler, defineButton, defineCheckbox, defineCommandSearch, defineContextMenu, defineDialog, defineIcon, defineMenuButton, defineMenuItem, defineMenuSeparator, defineOptionsDialog, defineRibbonGroup, defineRibbonSection, defineRibbonStack, defineSelect, defineStatusBar, defineStatusItem, defineSwitch, defineTabStrip, defineTitleBar, defineToolbar, defineZoomSlider, };
|
|
27
28
|
export type { OfficeCommandEvent } from './button.js';
|
|
28
29
|
export type { OfficeDialogCloseEvent, OfficeDialogCloseReason } from './dialog.js';
|
|
29
30
|
export type { OfficeSelectOption } from './select.js';
|
|
@@ -36,6 +37,7 @@ export type { OfficeBackstageCloseEvent, OfficeBackstageItem, OfficeBackstageSel
|
|
|
36
37
|
export type { OfficeFindInputEvent, OfficeFindStepEvent } from './find-bar.js';
|
|
37
38
|
export type { OfficePrintPreviewPageEvent } from './print-preview.js';
|
|
38
39
|
export type { OfficeRibbonSelectEvent } from './ribbon-tabs.js';
|
|
40
|
+
export type { OfficeRibbonCommandView, OfficeRibbonGroupView } from './ribbon-section.js';
|
|
39
41
|
export { rulerDivisions } from './ruler.js';
|
|
40
42
|
export { clampFlyoutPosition, EMPTY_MENU_STATE, nextEnabledIndex, typeAheadIndex, type FlyoutPositionInput, type OfficeMenuCloseReason, type OfficeMenuItem, type OfficeMenuState, } from './menu-model.js';
|
|
41
43
|
export { OFFICE_TOAST_VISIBLE_LIMIT, type OfficeDialogFooterAction, type OfficeDialogFooterState, type OfficeDialogFooterVariant, type OfficeToast, type OfficeToastsState, } from './chrome-controls.js';
|
|
@@ -43,6 +45,6 @@ export type { OfficePasteOption, OfficePasteOptionsState, OfficeReadOnlyBannerIn
|
|
|
43
45
|
export { clearOfficeProfile, DEFAULT_OFFICE_PROFILE, OFFICE_AVATAR_SWATCHES, OFFICE_PROFILE_STORAGE_KEY, profileInitials, readOfficeProfile, sanitizeOfficeProfile, writeOfficeProfile, type OfficeProfile, type OfficeProfileChangeEvent, } from './account.js';
|
|
44
46
|
export { clampOptionNumber, type OfficeOptionCategory, type OfficeOptionChoice, type OfficeOptionControl, type OfficeOptionSection, type OfficeOptionsChangeEvent, type OfficeOptionValue, type OfficeOptionValues, } from './options.js';
|
|
45
47
|
/** Every control of this entry. */
|
|
46
|
-
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, 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];
|
|
48
|
+
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, 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];
|
|
47
49
|
/** Idempotent, SSR-safe (no-op without a DOM). */
|
|
48
50
|
export declare function registerControls(registry?: CustomElementRegistry): void;
|
package/dist/controls.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
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, defineMenuButton, defineMenuItem, defineMenuSeparator, defineOptionsDialog, definePasteOptions, definePrintPreview, defineRadio, defineReadOnlyBanner, defineRibbon, defineRibbonGroup, defineRibbonStack, defineRibbonToggle, defineRuler, defineSearchField, defineSelect, defineStatusBar, defineStatusItem, defineSwitch, defineTabStrip, defineTitleBar, defineToasts, defineToolbar, defineZoomSlider, nextEnabledIndex, profileInitials, readOfficeProfile, registerControls, rulerDivisions, sanitizeOfficeProfile, typeAheadIndex, writeOfficeProfile } from './chunk-
|
|
2
|
-
export { defineIcon } from './chunk-
|
|
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, 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, profileInitials, readOfficeProfile, registerControls, rulerDivisions, sanitizeOfficeProfile, typeAheadIndex, writeOfficeProfile } from './chunk-6DZC4M2H.js';
|
|
2
|
+
export { defineIcon } from './chunk-GWAPPX66.js';
|
|
3
3
|
import './chunk-DECL6RNI.js';
|
|
4
4
|
import './chunk-UYPH4ESZ.js';
|
|
5
5
|
import './chunk-A3QNC6VS.js';
|
package/dist/icons.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { ICON_CSS, createIconSvg, defineIcon, getIcon, listIcons, paintIcon, registerIcon } from './chunk-
|
|
1
|
+
export { ICON_CSS, createIconSvg, defineIcon, getIcon, listIcons, paintIcon, registerIcon } from './chunk-GWAPPX66.js';
|
|
2
2
|
import './chunk-UYPH4ESZ.js';
|
|
3
3
|
import './chunk-A3QNC6VS.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-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-options-dialog", "office-ui-account", "office-ui-ribbon", "office-ui-find-bar", "office-ui-ruler", "office-ui-backstage", "office-ui-print-preview", "office-ui-radio", "office-ui-search", "office-ui-ribbon-toggle", "office-ui-dialog-footer", "office-ui-toasts", "office-ui-read-only-banner", "office-ui-paste-options", "office-ui-title-bar", "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-options-dialog", "office-ui-account", "office-ui-ribbon", "office-ui-find-bar", "office-ui-ruler", "office-ui-backstage", "office-ui-print-preview", "office-ui-radio", "office-ui-search", "office-ui-ribbon-toggle", "office-ui-dialog-footer", "office-ui-toasts", "office-ui-read-only-banner", "office-ui-paste-options", "office-ui-title-bar", "office-ui-ribbon-section", "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-5L3NYLAW.js';
|
|
2
2
|
export { THEME_CSS, THEME_STYLE_ID, installOfficeUiTheme } from './chunk-5L3NYLAW.js';
|
|
3
|
-
import { registerControls } from './chunk-
|
|
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, defineMenuButton, defineMenuItem, defineMenuSeparator, defineOptionsDialog, definePasteOptions, definePrintPreview, defineRadio, defineReadOnlyBanner, defineRibbon, defineRibbonGroup, defineRibbonStack, defineRibbonToggle, defineRuler, defineSearchField, defineSelect, defineStatusBar, defineStatusItem, defineSwitch, defineTabStrip, defineTitleBar, defineToasts, defineToolbar, defineZoomSlider, nextEnabledIndex, profileInitials, readOfficeProfile, registerControls, rulerDivisions, sanitizeOfficeProfile, typeAheadIndex, writeOfficeProfile } from './chunk-
|
|
5
|
-
export { ICON_CSS, createIconSvg, defineIcon, getIcon, listIcons, paintIcon, registerIcon } from './chunk-
|
|
3
|
+
import { registerControls } from './chunk-6DZC4M2H.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, 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, profileInitials, readOfficeProfile, registerControls, rulerDivisions, sanitizeOfficeProfile, typeAheadIndex, writeOfficeProfile } from './chunk-6DZC4M2H.js';
|
|
5
|
+
export { ICON_CSS, createIconSvg, defineIcon, getIcon, listIcons, paintIcon, registerIcon } from './chunk-GWAPPX66.js';
|
|
6
6
|
import { definePresence } from './chunk-DECL6RNI.js';
|
|
7
7
|
export { definePresence, initialsOf, participantsFromAwareness } from './chunk-DECL6RNI.js';
|
|
8
8
|
import { defineSmartArt } from './chunk-OAGGHX23.js';
|
|
@@ -45,6 +45,7 @@ var OFFICE_UI_TAGS = [
|
|
|
45
45
|
"office-ui-read-only-banner",
|
|
46
46
|
"office-ui-paste-options",
|
|
47
47
|
"office-ui-title-bar",
|
|
48
|
+
"office-ui-ribbon-section",
|
|
48
49
|
"office-ui-presence",
|
|
49
50
|
"office-ui-smartart"
|
|
50
51
|
];
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/** One ribbon command, translated. Booleans map to the command element's attributes. */
|
|
2
|
+
export interface OfficeRibbonCommandView {
|
|
3
|
+
id: string;
|
|
4
|
+
label: string;
|
|
5
|
+
/** ScreenTip; defaults to `label`. */
|
|
6
|
+
title?: string | undefined;
|
|
7
|
+
icon: string;
|
|
8
|
+
badge?: string | number | undefined;
|
|
9
|
+
/** `large`, `small` or `icon`; omitted leaves the command element's default. */
|
|
10
|
+
size?: string | undefined;
|
|
11
|
+
disabled?: boolean | undefined;
|
|
12
|
+
active?: boolean | undefined;
|
|
13
|
+
compact?: boolean | undefined;
|
|
14
|
+
hidden?: boolean | undefined;
|
|
15
|
+
caret?: boolean | undefined;
|
|
16
|
+
/** Toggle state; undefined means not a toggle. */
|
|
17
|
+
pressed?: boolean | undefined;
|
|
18
|
+
/** Menu state; undefined means no menu. */
|
|
19
|
+
expanded?: boolean | undefined;
|
|
20
|
+
/** Stack commands with the same column number vertically. */
|
|
21
|
+
column?: number | undefined;
|
|
22
|
+
}
|
|
23
|
+
export interface OfficeRibbonGroupView {
|
|
24
|
+
id: string;
|
|
25
|
+
label: string;
|
|
26
|
+
commands: readonly OfficeRibbonCommandView[];
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* `<office-ui-ribbon-section>`: a run of ribbon groups from data. Set `groups`
|
|
30
|
+
* (`OfficeRibbonGroupView[]`); groups and commands are keyed by id and patched in place, so a
|
|
31
|
+
* focused command and every customization id survive updates. Commands with a `column` stack
|
|
32
|
+
* vertically. Children are real `office-ui-ribbon-group` and `office-ui-button` elements in the
|
|
33
|
+
* light DOM, so their events (`office-command` and so on) bubble as usual. Static `groupTag`,
|
|
34
|
+
* `commandTag`, `groupIdAttribute` and `commandIdAttribute` let a product keep its aliases.
|
|
35
|
+
*/
|
|
36
|
+
export declare const defineRibbonSection: import("./registry.js").Definer;
|