@mlightcad/ribbon 0.0.1 → 0.0.2

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.
Files changed (66) hide show
  1. package/README.md +40 -3
  2. package/dist/components/Ribbon.vue.d.ts +102 -0
  3. package/dist/components/RibbonCollection.vue.d.ts +41 -0
  4. package/dist/components/RibbonGroup.vue.d.ts +77 -0
  5. package/dist/components/RibbonGroupContent.vue.d.ts +39 -0
  6. package/dist/components/RibbonItemHost.vue.d.ts +52 -0
  7. package/dist/components/RibbonTab.vue.d.ts +47 -0
  8. package/dist/components/RibbonTabs.vue.d.ts +34 -0
  9. package/dist/composables/useRibbonState.d.ts +17 -0
  10. package/dist/context.d.ts +3 -0
  11. package/{src/ribbon/index.ts → dist/index.d.ts} +15 -43
  12. package/dist/items/RibbonGallery.vue.d.ts +48 -0
  13. package/dist/items/RibbonGroupButton.vue.d.ts +49 -0
  14. package/dist/items/RibbonTemplateItem.vue.d.ts +40 -0
  15. package/dist/ml-ribbon.css +2 -0
  16. package/dist/ml-ribbon.es.js +1431 -0
  17. package/dist/ml-ribbon.umd.js +1 -0
  18. package/dist/modules/RibbonBackstage.vue.d.ts +61 -0
  19. package/dist/modules/RibbonContextualTabs.vue.d.ts +41 -0
  20. package/dist/modules/RibbonFileMenu.vue.d.ts +44 -0
  21. package/dist/modules/RibbonKeyTips.vue.d.ts +39 -0
  22. package/dist/types.d.ts +130 -0
  23. package/package.json +25 -2
  24. package/.github/workflows/ci.yml +0 -110
  25. package/.vscode/extensions.json +0 -3
  26. package/AGENTS.md +0 -42
  27. package/docs/requirements.md +0 -96
  28. package/eslint.config.js +0 -41
  29. package/images/ribbon.jpg +0 -0
  30. package/index.html +0 -13
  31. package/playwright/ribbon.spec.ts +0 -6
  32. package/playwright.config.ts +0 -10
  33. package/public/favicon.svg +0 -1
  34. package/public/icons.svg +0 -24
  35. package/src/App.vue +0 -418
  36. package/src/assets/hero.png +0 -0
  37. package/src/assets/vite.svg +0 -1
  38. package/src/assets/vue.svg +0 -1
  39. package/src/components/HelloWorld.vue +0 -106
  40. package/src/main.ts +0 -9
  41. package/src/ribbon/components/Ribbon.vue +0 -844
  42. package/src/ribbon/components/RibbonCollection.vue +0 -51
  43. package/src/ribbon/components/RibbonGroup.vue +0 -327
  44. package/src/ribbon/components/RibbonGroupContent.vue +0 -61
  45. package/src/ribbon/components/RibbonItemHost.vue +0 -221
  46. package/src/ribbon/components/RibbonTab.vue +0 -44
  47. package/src/ribbon/components/RibbonTabs.vue +0 -49
  48. package/src/ribbon/composables/useRibbonState.ts +0 -272
  49. package/src/ribbon/context.ts +0 -4
  50. package/src/ribbon/items/RibbonGallery.vue +0 -78
  51. package/src/ribbon/items/RibbonGroupButton.vue +0 -85
  52. package/src/ribbon/items/RibbonTemplateItem.vue +0 -38
  53. package/src/ribbon/modules/RibbonBackstage.vue +0 -69
  54. package/src/ribbon/modules/RibbonContextualTabs.vue +0 -65
  55. package/src/ribbon/modules/RibbonFileMenu.vue +0 -88
  56. package/src/ribbon/modules/RibbonKeyTips.vue +0 -114
  57. package/src/ribbon/styles/ribbon.css +0 -925
  58. package/src/ribbon/types.ts +0 -162
  59. package/src/style.css +0 -328
  60. package/src/tests/ribbon.spec.ts +0 -830
  61. package/src/tests/setup.ts +0 -4
  62. package/tools/release.mjs +0 -107
  63. package/tsconfig.app.json +0 -14
  64. package/tsconfig.json +0 -7
  65. package/tsconfig.node.json +0 -24
  66. package/vite.config.ts +0 -38
@@ -0,0 +1,1431 @@
1
+ import { Fragment as e, computed as t, createBlock as n, createCommentVNode as r, createElementBlock as i, createElementVNode as a, createSlots as o, createTextVNode as s, createVNode as c, defineComponent as l, inject as u, markRaw as d, nextTick as f, normalizeClass as p, normalizeStyle as m, onMounted as h, onUnmounted as g, openBlock as _, provide as v, ref as y, renderList as b, renderSlot as x, resolveDynamicComponent as S, toDisplayString as C, toRaw as w, unref as T, watch as E, withCtx as D } from "vue";
2
+ import { ElButton as O, ElButtonGroup as k, ElCheckbox as ee, ElColorPicker as te, ElConfigProvider as A, ElDrawer as j, ElDropdown as M, ElDropdownItem as N, ElDropdownMenu as P, ElIcon as F, ElOption as I, ElPopover as L, ElSelect as R, ElSwitch as z, ElTooltip as B, useGlobalConfig as ne } from "element-plus";
3
+ import { ArrowDown as V, ArrowDownBold as H, ArrowUp as U, ArrowUpBold as re, Grid as ie, Menu as ae, Promotion as W } from "@element-plus/icons-vue";
4
+ //#region src/ribbon/context.ts
5
+ var oe = Symbol("RibbonContext");
6
+ //#endregion
7
+ //#region src/ribbon/composables/useRibbonState.ts
8
+ function G(e) {
9
+ return e == null || typeof e == "string" ? e : typeof e == "object" || typeof e == "function" ? d(w(e)) : e;
10
+ }
11
+ function K(e) {
12
+ if (!e) return;
13
+ let t = { ...e };
14
+ return "icon" in t && (t.icon = G(t.icon)), Array.isArray(t.options) && (t.options = t.options.map((e) => {
15
+ if (!e || typeof e != "object") return e;
16
+ let t = e;
17
+ return "icon" in t ? {
18
+ ...t,
19
+ icon: G(t.icon)
20
+ } : t;
21
+ })), t;
22
+ }
23
+ function se(e) {
24
+ return {
25
+ ...e,
26
+ icon: G(e.icon),
27
+ props: K(e.props)
28
+ };
29
+ }
30
+ function q(e) {
31
+ return {
32
+ ...e,
33
+ icon: G(e.icon),
34
+ footerMenuItems: e.footerMenuItems?.map(se),
35
+ collections: e.collections?.map((e) => ({
36
+ ...e,
37
+ items: e.items.map(se)
38
+ }))
39
+ };
40
+ }
41
+ function J(e) {
42
+ return {
43
+ ...e,
44
+ groups: e.groups?.map(q)
45
+ };
46
+ }
47
+ function Y(e) {
48
+ return e.map(J);
49
+ }
50
+ function X(e) {
51
+ (!e.collections || e.collections.length === 0) && (e.collections = [{
52
+ id: `${e.id}-collection-1`,
53
+ items: []
54
+ }]);
55
+ }
56
+ function ce(e, t, n, r, i) {
57
+ let a = e.find((e) => e.id === t);
58
+ if (!a?.groups) return;
59
+ let o = a.groups.find((e) => e.id === n);
60
+ if (!o?.collections) return;
61
+ let s = o.collections.find((e) => e.id === r);
62
+ s && i(s.items);
63
+ }
64
+ function le(e, n, r, i, a) {
65
+ let o = y(r), s = y(i), c = y(a), l = y(Y(n)), u = y(!1), d = y(!1), f = y(!1), p = y([]), m = y(""), h = t(() => l.value.filter((e) => e.visible !== !1)), g = {
66
+ addTab(e) {
67
+ l.value.push(J(e)), c.value ||= e.id;
68
+ },
69
+ removeTab(e) {
70
+ l.value = l.value.filter((t) => t.id !== e), c.value === e && (c.value = h.value[0]?.id ?? "");
71
+ },
72
+ showTab(e) {
73
+ let t = l.value.find((t) => t.id === e);
74
+ t && (t.visible = !0);
75
+ },
76
+ hideTab(e) {
77
+ let t = l.value.find((t) => t.id === e);
78
+ t && (t.visible = !1);
79
+ },
80
+ selectTab(e) {
81
+ c.value = e;
82
+ },
83
+ addGroup(e, t) {
84
+ let n = l.value.find((t) => t.id === e);
85
+ n && (n.groups ??= [], X(t), n.groups.push(q(t)));
86
+ },
87
+ removeGroup(e, t) {
88
+ let n = l.value.find((t) => t.id === e);
89
+ n?.groups && (n.groups = n.groups.filter((e) => e.id !== t));
90
+ },
91
+ showGroup(e, t) {
92
+ let n = l.value.find((t) => t.id === e)?.groups?.find((e) => e.id === t);
93
+ n && (n.visible = !0);
94
+ },
95
+ hideGroup(e, t) {
96
+ let n = l.value.find((t) => t.id === e)?.groups?.find((e) => e.id === t);
97
+ n && (n.visible = !1);
98
+ },
99
+ addItem(e, t, n, r) {
100
+ ce(l.value, e, t, n, (e) => e.push(se(r)));
101
+ },
102
+ removeItem(e, t, n, r) {
103
+ ce(l.value, e, t, n, (e) => {
104
+ let t = e.findIndex((e) => e.id === r);
105
+ t >= 0 && e.splice(t, 1);
106
+ });
107
+ },
108
+ updateItem(e, t, n, r, i) {
109
+ ce(l.value, e, t, n, (e) => {
110
+ let t = e.find((e) => e.id === r);
111
+ t && Object.assign(t, i);
112
+ });
113
+ },
114
+ enableItem(e, t, n, r) {
115
+ g.updateItem(e, t, n, r, { disabled: !1 });
116
+ },
117
+ disableItem(e, t, n, r) {
118
+ g.updateItem(e, t, n, r, { disabled: !0 });
119
+ },
120
+ refreshLayout() {
121
+ u.value = !1;
122
+ },
123
+ minimize(e) {
124
+ s.value = e;
125
+ },
126
+ toggleSimplified() {
127
+ o.value = o.value === "classic" ? "simplified" : "classic";
128
+ }
129
+ };
130
+ return {
131
+ context: {
132
+ id: e,
133
+ layout: o,
134
+ minimized: s,
135
+ activeTab: c,
136
+ tabs: l,
137
+ overflowOpen: u,
138
+ backdropOpen: d,
139
+ keyTipsOpen: f,
140
+ keyTips: p,
141
+ keyTipsSequence: m,
142
+ registerKeyTip: (e) => {
143
+ p.value.some((t) => t.id === e.id) || p.value.push(e);
144
+ },
145
+ unregisterKeyTip: (e) => {
146
+ p.value = p.value.filter((t) => t.id !== e);
147
+ },
148
+ api: g
149
+ },
150
+ visibleTabs: h
151
+ };
152
+ }
153
+ //#endregion
154
+ //#region src/ribbon/modules/RibbonBackstage.vue?vue&type=script&setup=true&lang.ts
155
+ var ue = { class: "ml-ribbon-backstage__nav" }, de = { class: "ml-ribbon-backstage__content" }, fe = { key: 0 }, pe = { key: 1 }, me = /* @__PURE__ */ l({
156
+ __name: "RibbonBackstage",
157
+ props: {
158
+ open: { type: Boolean },
159
+ backLabel: {},
160
+ title: {},
161
+ description: {},
162
+ size: { default: "default" }
163
+ },
164
+ emits: ["close"],
165
+ setup(t, { emit: o }) {
166
+ let l = t, u = o;
167
+ function d() {
168
+ u("close");
169
+ }
170
+ return (t, o) => (_(), n(T(j), {
171
+ "model-value": l.open,
172
+ size: "100%",
173
+ "with-header": !1,
174
+ direction: "ltr",
175
+ onClose: d
176
+ }, {
177
+ default: D(() => [a("div", { class: p(["ml-ribbon-backstage", `ml-ribbon-backstage--size-${l.size || "default"}`]) }, [t.$slots.default ? x(t.$slots, "default", {
178
+ key: 0,
179
+ close: d,
180
+ backLabel: l.backLabel,
181
+ title: l.title,
182
+ description: l.description,
183
+ size: l.size
184
+ }) : (_(), i(e, { key: 1 }, [a("aside", ue, [c(T(O), {
185
+ type: "primary",
186
+ onClick: d
187
+ }, {
188
+ default: D(() => [s(C(l.backLabel), 1)]),
189
+ _: 1
190
+ })]), a("section", de, [l.title ? (_(), i("h2", fe, C(l.title), 1)) : r("", !0), l.description ? (_(), i("p", pe, C(l.description), 1)) : r("", !0)])], 64))], 2)]),
191
+ _: 3
192
+ }, 8, ["model-value"]));
193
+ }
194
+ }), he = {
195
+ class: "ml-ribbon-tabs",
196
+ role: "tablist"
197
+ }, ge = ["aria-selected", "onClick"], _e = /* @__PURE__ */ l({
198
+ __name: "RibbonTabs",
199
+ props: {
200
+ tabs: {},
201
+ activeTab: {}
202
+ },
203
+ emits: ["select"],
204
+ setup(n, { emit: r }) {
205
+ let a = n, o = r, s = t(() => a.tabs.filter((e) => e.visible !== !1));
206
+ return (t, r) => (_(), i("div", he, [(_(!0), i(e, null, b(s.value, (e) => (_(), i("button", {
207
+ key: e.id,
208
+ type: "button",
209
+ class: p(["ml-ribbon-tab", { "is-active": n.activeTab === e.id }]),
210
+ role: "tab",
211
+ "aria-selected": n.activeTab === e.id,
212
+ onClick: (t) => o("select", e.id)
213
+ }, C(e.title), 11, ge))), 128))]));
214
+ }
215
+ }), ve = { class: "ml-ribbon-contextual-tabs" }, ye = { class: "ml-ribbon-contextual-tabs__normal" }, be = { class: "ml-ribbon-contextual-tabs__ctx" }, xe = /* @__PURE__ */ l({
216
+ __name: "RibbonContextualTabs",
217
+ props: {
218
+ tabs: {},
219
+ activeTab: {},
220
+ defaultContextualTitle: {}
221
+ },
222
+ emits: ["select"],
223
+ setup(t, { emit: n }) {
224
+ let r = t, o = n;
225
+ return (n, s) => (_(), i("div", ve, [a("div", ye, [c(_e, {
226
+ tabs: r.tabs.filter((e) => !e.contextual),
227
+ "active-tab": t.activeTab,
228
+ onSelect: s[0] ||= (e) => o("select", e)
229
+ }, null, 8, ["tabs", "active-tab"])]), a("div", be, [(_(!0), i(e, null, b(r.tabs.filter((e) => e.contextual), (e) => (_(), i("section", {
230
+ key: e.id,
231
+ class: "ml-ribbon-contextual-tabs__block",
232
+ style: m({ "--ctx-color": e.contextualColor || "#67c23a" })
233
+ }, [a("small", null, C(e.contextualTitle || r.defaultContextualTitle), 1), c(_e, {
234
+ tabs: [e],
235
+ "active-tab": t.activeTab,
236
+ onSelect: s[1] ||= (e) => o("select", e)
237
+ }, null, 8, ["tabs", "active-tab"])], 4))), 128))])]));
238
+ }
239
+ }), Se = /* @__PURE__ */ l({
240
+ __name: "RibbonFileMenu",
241
+ props: {
242
+ items: {},
243
+ label: {},
244
+ openBackstageLabel: {},
245
+ showOpenBackstage: { type: Boolean }
246
+ },
247
+ emits: ["select", "open-backstage"],
248
+ setup(o, { emit: l }) {
249
+ let u = l, d = y(!1), f = ne("size", ""), m = t(() => f.value || "default"), h = t(() => `ml-ribbon-file-menu-dropdown ml-ribbon-popper ml-ribbon-popper--size-${m.value}`);
250
+ function g(e) {
251
+ d.value = e;
252
+ }
253
+ function v(e) {
254
+ if (e === "__backstage") {
255
+ u("open-backstage");
256
+ return;
257
+ }
258
+ u("select", e);
259
+ }
260
+ return (t, l) => (_(), n(T(M), {
261
+ trigger: "click",
262
+ "popper-class": h.value,
263
+ onCommand: v,
264
+ onVisibleChange: g
265
+ }, {
266
+ dropdown: D(() => [c(T(P), null, {
267
+ default: D(() => [o.showOpenBackstage === !1 ? r("", !0) : (_(), n(T(N), {
268
+ key: 0,
269
+ command: "__backstage"
270
+ }, {
271
+ default: D(() => [s(C(o.openBackstageLabel), 1)]),
272
+ _: 1
273
+ })), (_(!0), i(e, null, b(o.items, (e, t) => (_(), n(T(N), {
274
+ key: e.id,
275
+ divided: o.showOpenBackstage !== !1 && t === 0,
276
+ command: e.id,
277
+ disabled: e.disabled
278
+ }, {
279
+ default: D(() => [s(C(e.label), 1)]),
280
+ _: 2
281
+ }, 1032, [
282
+ "divided",
283
+ "command",
284
+ "disabled"
285
+ ]))), 128))]),
286
+ _: 1
287
+ })]),
288
+ default: D(() => [a("button", {
289
+ type: "button",
290
+ class: p(["ml-ribbon-tab ml-ribbon-tab--file", { "is-active": d.value }])
291
+ }, C(o.label), 3)]),
292
+ _: 1
293
+ }, 8, ["popper-class"]));
294
+ }
295
+ }), Ce = /* @__PURE__ */ l({
296
+ __name: "RibbonCollection",
297
+ props: {
298
+ id: {},
299
+ layout: { default: "row" },
300
+ rows: { default: 3 }
301
+ },
302
+ setup(e) {
303
+ let n = e, r = t(() => ({ "--ml-ribbon-collection-rows": String(n.rows) }));
304
+ return (e, t) => (_(), i("div", {
305
+ class: p(["ml-ribbon-collection", [`ml-ribbon-collection--${n.layout}`]]),
306
+ style: m(r.value)
307
+ }, [x(e.$slots, "default")], 6));
308
+ }
309
+ }), we = {
310
+ key: 0,
311
+ class: "ml-ribbon-gallery__title"
312
+ }, Te = { class: "ml-ribbon-gallery__categories" }, Ee = { class: "ml-ribbon-gallery__category-title" }, De = { class: "ml-ribbon-gallery__grid" }, Z = ["disabled", "onClick"], Oe = { class: "ml-ribbon-gallery__preview" }, ke = { class: "ml-ribbon-gallery__label" }, Ae = /* @__PURE__ */ l({
313
+ __name: "RibbonGallery",
314
+ props: {
315
+ id: {},
316
+ label: {},
317
+ categories: {},
318
+ disabled: {
319
+ type: Boolean,
320
+ default: !1
321
+ },
322
+ previewFallback: {}
323
+ },
324
+ emits: ["select"],
325
+ setup(t, { emit: n }) {
326
+ let o = t, s = n, c = y("");
327
+ function l(e) {
328
+ o.disabled || (c.value = e, s("select", e));
329
+ }
330
+ return (n, s) => (_(), i("div", { class: p(["ml-ribbon-gallery", { "is-disabled": t.disabled }]) }, [t.label ? (_(), i("div", we, C(t.label), 1)) : r("", !0), a("div", Te, [(_(!0), i(e, null, b(t.categories, (n) => (_(), i("section", {
331
+ key: n.id,
332
+ class: "ml-ribbon-gallery__category"
333
+ }, [a("h4", Ee, C(n.title), 1), a("div", De, [(_(!0), i(e, null, b(n.items, (e) => (_(), i("button", {
334
+ key: e.id,
335
+ type: "button",
336
+ class: p(["ml-ribbon-gallery__item", { "is-selected": c.value === e.id }]),
337
+ disabled: t.disabled,
338
+ onClick: (t) => l(e.id)
339
+ }, [a("div", Oe, C(e.preview ?? o.previewFallback), 1), a("div", ke, C(e.label), 1)], 10, Z))), 128))])]))), 128))])], 2));
340
+ }
341
+ }), Q = ["data-id"], je = { class: "ml-ribbon-group-button__label" }, Me = /* @__PURE__ */ l({
342
+ __name: "RibbonGroupButton",
343
+ props: {
344
+ id: {},
345
+ label: {},
346
+ options: {},
347
+ multiple: {
348
+ type: Boolean,
349
+ default: !1
350
+ },
351
+ disabled: {
352
+ type: Boolean,
353
+ default: !1
354
+ }
355
+ },
356
+ emits: ["change"],
357
+ setup(t, { emit: o }) {
358
+ let l = t, u = o, d = y([]);
359
+ function f(e) {
360
+ if (!l.disabled) {
361
+ if (l.multiple) {
362
+ d.value.includes(e) ? d.value = d.value.filter((t) => t !== e) : d.value = [...d.value, e], u("change", d.value);
363
+ return;
364
+ }
365
+ d.value = [e], u("change", e);
366
+ }
367
+ }
368
+ return (o, l) => (_(), i("div", {
369
+ class: "ml-ribbon-group-button",
370
+ "data-id": t.id
371
+ }, [a("div", je, C(t.label), 1), c(T(k), null, {
372
+ default: D(() => [(_(!0), i(e, null, b(t.options, (e) => (_(), n(T(O), {
373
+ key: e.value,
374
+ disabled: t.disabled,
375
+ type: d.value.includes(e.value) ? "primary" : "default",
376
+ onClick: (t) => f(e.value)
377
+ }, {
378
+ default: D(() => [e.icon ? (_(), n(T(F), {
379
+ key: 0,
380
+ class: "ml-ribbon-item-host__icon"
381
+ }, {
382
+ default: D(() => [(_(), n(S(e.icon)))]),
383
+ _: 2
384
+ }, 1024)) : r("", !0), s(" " + C(e.label), 1)]),
385
+ _: 2
386
+ }, 1032, [
387
+ "disabled",
388
+ "type",
389
+ "onClick"
390
+ ]))), 128))]),
391
+ _: 1
392
+ })], 8, Q));
393
+ }
394
+ }), $ = ["data-template-id"], Ne = /* @__PURE__ */ l({
395
+ __name: "RibbonTemplateItem",
396
+ props: {
397
+ id: {},
398
+ item: {}
399
+ },
400
+ setup(e) {
401
+ return (t, n) => (_(), i("div", {
402
+ class: "ml-ribbon-template-item",
403
+ "data-template-id": e.id
404
+ }, [x(t.$slots, "default", { item: e.item }, () => [a("span", null, C(e.item.label ?? e.item.id), 1)])], 8, $));
405
+ }
406
+ }), Pe = ["data-item-id"], Fe = {
407
+ key: 0,
408
+ class: "ml-ribbon-item-host__keytip"
409
+ }, Ie = { class: "ml-ribbon-item-host__content" }, Le = { class: "ml-ribbon-item-host__text-row" }, Re = {
410
+ key: 0,
411
+ class: "ml-ribbon-item-host__label"
412
+ }, ze = { class: "ml-ribbon-dropdown-item__content" }, Be = { class: "ml-ribbon-dropdown-item__label" }, Ve = {
413
+ key: 1,
414
+ class: "ml-ribbon-item-host__label"
415
+ }, He = /* @__PURE__ */ l({
416
+ __name: "RibbonItemHost",
417
+ props: {
418
+ id: {},
419
+ item: {},
420
+ groupId: {},
421
+ galleryPreviewFallback: {}
422
+ },
423
+ emits: ["item-click"],
424
+ setup(o, { emit: l }) {
425
+ let d = o, f = l, m = u(oe, null), h = t(() => Array.isArray(d.item.props?.options) ? d.item.props.options : []), g = ne("size", ""), v = t(() => g.value || "default"), w = t(() => `ml-ribbon-dropdown-menu ml-ribbon-popper ml-ribbon-popper--size-${v.value}`), E = t(() => `ml-ribbon-select-dropdown ml-ribbon-popper ml-ribbon-popper--size-${v.value}`), k = t(() => d.item.props?.icon || (typeof d.item.icon == "string" || !d.item.icon ? null : d.item.icon)), A = t(() => d.item.hideLabel !== !0), j = t(() => d.item.label || d.item.id), L = t(() => d.item.keyTip?.trim().toUpperCase() ?? ""), z = y(!1), B = t(() => {
426
+ if (!m?.keyTipsOpen.value || !L.value) return !1;
427
+ let e = m.keyTipsSequence.value.toLowerCase();
428
+ return e ? L.value.toLowerCase().startsWith(e) : !0;
429
+ });
430
+ function H() {
431
+ f("item-click", d.id);
432
+ }
433
+ function re(e) {
434
+ z.value = e;
435
+ }
436
+ function ie() {
437
+ z.value = !z.value;
438
+ }
439
+ function ae() {
440
+ H(), z.value = !1;
441
+ }
442
+ function W(e) {
443
+ if (!e || typeof e != "object") return null;
444
+ let t = e.icon;
445
+ return !t || typeof t == "string" ? null : t;
446
+ }
447
+ function G(e) {
448
+ if (!e || typeof e != "object") return null;
449
+ let t = e.icon;
450
+ return typeof t != "string" || t.trim().length === 0 ? null : t;
451
+ }
452
+ return (t, l) => (_(), i("div", {
453
+ class: p(["ml-ribbon-item-host", [
454
+ `is-${o.item.size ?? "medium"}`,
455
+ `type-${o.item.type}`,
456
+ { "is-label-hidden": o.item.hideLabel === !0 }
457
+ ]]),
458
+ "data-item-id": o.id,
459
+ role: "group"
460
+ }, [B.value ? (_(), i("span", Fe, C(L.value), 1)) : r("", !0), o.item.type === "groupButton" ? (_(), n(Me, {
461
+ key: 1,
462
+ id: o.item.id,
463
+ label: o.item.label ?? "",
464
+ options: o.item.props?.options ?? [],
465
+ multiple: !!o.item.props?.multiple,
466
+ disabled: o.item.disabled,
467
+ onChange: H
468
+ }, null, 8, [
469
+ "id",
470
+ "label",
471
+ "options",
472
+ "multiple",
473
+ "disabled"
474
+ ])) : o.item.type === "gallery" ? (_(), n(Ae, {
475
+ key: 2,
476
+ id: o.item.id,
477
+ label: o.item.label ?? "",
478
+ categories: o.item.props?.categories ?? [],
479
+ "preview-fallback": d.galleryPreviewFallback,
480
+ disabled: o.item.disabled,
481
+ onSelect: H
482
+ }, null, 8, [
483
+ "id",
484
+ "label",
485
+ "categories",
486
+ "preview-fallback",
487
+ "disabled"
488
+ ])) : o.item.type === "template" ? (_(), n(Ne, {
489
+ key: 3,
490
+ id: o.item.id,
491
+ item: o.item
492
+ }, {
493
+ default: D(() => [x(t.$slots, "template", { item: o.item })]),
494
+ _: 3
495
+ }, 8, ["id", "item"])) : o.item.type === "dropdown" ? (_(), n(T(M), {
496
+ key: 4,
497
+ trigger: "click",
498
+ disabled: o.item.disabled,
499
+ "popper-class": w.value,
500
+ onVisibleChange: re,
501
+ onCommand: ae
502
+ }, {
503
+ dropdown: D(() => [c(T(P), null, {
504
+ default: D(() => [(_(!0), i(e, null, b(h.value, (e) => (_(), n(T(N), {
505
+ key: String(e.value),
506
+ command: e.value
507
+ }, {
508
+ default: D(() => [a("span", ze, [W(e) ? (_(), n(T(F), {
509
+ key: 0,
510
+ class: "ml-ribbon-dropdown-item__icon"
511
+ }, {
512
+ default: D(() => [(_(), n(S(W(e))))]),
513
+ _: 2
514
+ }, 1024)) : G(e) ? (_(), i("i", {
515
+ key: 1,
516
+ class: p(["ml-ribbon-dropdown-item__icon ml-ribbon-dropdown-item__icon--class", G(e)]),
517
+ "aria-hidden": "true"
518
+ }, null, 2)) : r("", !0), a("span", Be, C(e.label), 1)])]),
519
+ _: 2
520
+ }, 1032, ["command"]))), 128))]),
521
+ _: 1
522
+ })]),
523
+ default: D(() => [c(T(O), {
524
+ type: "default",
525
+ "aria-label": j.value,
526
+ onClick: ie
527
+ }, {
528
+ default: D(() => [a("span", Ie, [k.value ? (_(), n(T(F), {
529
+ key: 0,
530
+ class: "ml-ribbon-item-host__icon"
531
+ }, {
532
+ default: D(() => [(_(), n(S(k.value)))]),
533
+ _: 1
534
+ })) : r("", !0), a("span", Le, [A.value ? (_(), i("span", Re, C(o.item.label), 1)) : r("", !0), c(T(F), { class: p(["ml-ribbon-item-host__dropdown-arrow", { "is-open": z.value }]) }, {
535
+ default: D(() => [(_(), n(S(z.value ? T(U) : T(V))))]),
536
+ _: 1
537
+ }, 8, ["class"])])])]),
538
+ _: 1
539
+ }, 8, ["aria-label"])]),
540
+ _: 1
541
+ }, 8, ["disabled", "popper-class"])) : o.item.type === "checkbox" ? (_(), n(T(ee), {
542
+ key: 5,
543
+ disabled: o.item.disabled,
544
+ onChange: H
545
+ }, {
546
+ default: D(() => [s(C(o.item.label), 1)]),
547
+ _: 1
548
+ }, 8, ["disabled"])) : o.item.type === "colorPicker" ? (_(), n(T(te), {
549
+ key: 6,
550
+ disabled: o.item.disabled,
551
+ onChange: H
552
+ }, null, 8, ["disabled"])) : o.item.type === "comboBox" ? (_(), n(T(R), {
553
+ key: 7,
554
+ disabled: o.item.disabled,
555
+ "popper-class": E.value,
556
+ style: { width: "92px" },
557
+ onChange: H
558
+ }, {
559
+ default: D(() => [(_(!0), i(e, null, b(h.value, (e) => (_(), n(T(I), {
560
+ key: String(e.value),
561
+ label: String(e.label),
562
+ value: e.value
563
+ }, null, 8, ["label", "value"]))), 128))]),
564
+ _: 1
565
+ }, 8, ["disabled", "popper-class"])) : (_(), n(T(O), {
566
+ key: 8,
567
+ disabled: o.item.disabled,
568
+ "aria-label": j.value,
569
+ onClick: H
570
+ }, {
571
+ default: D(() => [k.value ? (_(), n(T(F), {
572
+ key: 0,
573
+ class: "ml-ribbon-item-host__icon"
574
+ }, {
575
+ default: D(() => [(_(), n(S(k.value)))]),
576
+ _: 1
577
+ })) : r("", !0), A.value ? (_(), i("span", Ve, C(o.item.label ?? o.item.id), 1)) : r("", !0)]),
578
+ _: 1
579
+ }, 8, ["disabled", "aria-label"]))], 10, Pe));
580
+ }
581
+ }), Ue = /* @__PURE__ */ l({
582
+ __name: "RibbonGroupContent",
583
+ props: {
584
+ group: {},
585
+ galleryPreviewFallback: {}
586
+ },
587
+ emits: ["item-click"],
588
+ setup(t, { emit: r }) {
589
+ let a = t, o = r;
590
+ return (t, r) => (_(), i("div", { class: p(["ml-ribbon-group__content", [`ml-ribbon-group__content--${a.group.orientation ?? "column"}`]]) }, [(_(!0), i(e, null, b(a.group.collections ?? [], (t) => (_(), n(Ce, {
591
+ id: t.id,
592
+ key: t.id,
593
+ layout: t.layout ?? (a.group.orientation === "row" ? "row" : "column"),
594
+ rows: t.rows
595
+ }, {
596
+ default: D(() => [(_(!0), i(e, null, b(t.items, (e) => (_(), n(He, {
597
+ id: e.id,
598
+ key: e.id,
599
+ item: e,
600
+ "group-id": a.group.id,
601
+ "gallery-preview-fallback": a.galleryPreviewFallback,
602
+ onItemClick: (t) => o("item-click", {
603
+ groupId: a.group.id,
604
+ itemId: e.id
605
+ })
606
+ }, null, 8, [
607
+ "id",
608
+ "item",
609
+ "group-id",
610
+ "gallery-preview-fallback",
611
+ "onItemClick"
612
+ ]))), 128))]),
613
+ _: 2
614
+ }, 1032, [
615
+ "id",
616
+ "layout",
617
+ "rows"
618
+ ]))), 128))], 2));
619
+ }
620
+ }), We = ["data-priority"], Ge = { class: "ml-ribbon-group__body" }, Ke = { class: "ml-ribbon-group__footer" }, qe = { class: "ml-ribbon-group__title" }, Je = ["aria-label", "aria-expanded"], Ye = { class: "ml-ribbon-group__overflow-content" }, Xe = ["aria-label", "aria-expanded"], Ze = { class: "ml-ribbon-group__overflow-content" }, Qe = /* @__PURE__ */ l({
621
+ __name: "RibbonGroup",
622
+ props: {
623
+ id: {},
624
+ title: {},
625
+ icon: {},
626
+ groupIconCss: {},
627
+ orientation: {},
628
+ autoWidth: { type: Boolean },
629
+ priority: {},
630
+ launcher: { type: Boolean },
631
+ showLauncherIcon: { type: Boolean },
632
+ groupModel: {},
633
+ overflowTriggerAriaLabel: {},
634
+ galleryPreviewFallback: {}
635
+ },
636
+ emits: ["item-click"],
637
+ setup(e, { emit: o }) {
638
+ let s = e, l = o, u = t(() => s.autoWidth !== !1), d = y(null), m = y([]), v = y(null), b = y(null), w = y(0), k = y(0), ee = ne("size", ""), te = t(() => ee.value || "default"), A = t(() => `ml-ribbon-group__overflow-popover ml-ribbon-group__overflow-popover--size-${te.value}`), j = t(() => ({ modifiers: [{
639
+ name: "offset",
640
+ options: { offset: [w.value, 8] }
641
+ }] })), M = t(() => ({ modifiers: [{
642
+ name: "offset",
643
+ options: { offset: [k.value, 8] }
644
+ }] })), N = t(() => !s.icon || typeof s.icon == "string" ? null : s.icon), P = t(() => m.value.length > 0), I = t(() => (s.groupModel?.footerMenuItems?.length ?? 0) > 0), R = y(!1), z = y(!1), B = t(() => {
645
+ if (!s.groupModel || !m.value.length) return null;
646
+ let e = new Set(m.value), t = s.groupModel.collections?.map((t) => ({
647
+ ...t,
648
+ items: t.items.filter((t) => e.has(t.id))
649
+ })).filter((e) => e.items.length > 0) ?? [];
650
+ return t.length ? {
651
+ ...s.groupModel,
652
+ collections: t
653
+ } : null;
654
+ }), H = t(() => s.groupModel?.footerMenuItems?.length ? {
655
+ id: `${s.groupModel.id}-footer-menu`,
656
+ title: "",
657
+ orientation: "row",
658
+ collections: [{
659
+ id: `${s.groupModel.id}-footer-menu-collection`,
660
+ layout: "row",
661
+ items: s.groupModel.footerMenuItems
662
+ }]
663
+ } : null);
664
+ function re() {
665
+ let e = d.value?.querySelector(".ml-ribbon-group__content");
666
+ if (!e) {
667
+ m.value.length > 0 && (m.value = []);
668
+ return;
669
+ }
670
+ let t = e.getBoundingClientRect();
671
+ if (t.width <= 0 || t.height <= 0) {
672
+ m.value.length > 0 && (m.value = []);
673
+ return;
674
+ }
675
+ let n = [];
676
+ e.querySelectorAll(".ml-ribbon-item-host[data-item-id]").forEach((e) => {
677
+ let r = e.dataset.itemId;
678
+ if (!r) return;
679
+ let i = e.getBoundingClientRect();
680
+ (i.right - t.right > .5 || i.bottom - t.bottom > .5 || t.left - i.left > .5 || t.top - i.top > .5) && n.push(r);
681
+ }), m.value.length === n.length && m.value.every((e, t) => e === n[t]) || (m.value = n);
682
+ }
683
+ function ie() {
684
+ f(() => {
685
+ X(), ae(), oe(), re();
686
+ });
687
+ }
688
+ function ae() {
689
+ let e = d.value?.getBoundingClientRect(), t = v.value?.getBoundingClientRect();
690
+ if (!e || !t) {
691
+ w.value !== 0 && (w.value = 0);
692
+ return;
693
+ }
694
+ let n = Math.round(e.left - t.left);
695
+ w.value !== n && (w.value = n);
696
+ }
697
+ function oe() {
698
+ let e = d.value?.getBoundingClientRect(), t = b.value?.getBoundingClientRect();
699
+ if (!e || !t) {
700
+ k.value !== 0 && (k.value = 0);
701
+ return;
702
+ }
703
+ let n = Math.round(e.left - t.left);
704
+ k.value !== n && (k.value = n);
705
+ }
706
+ function G(e) {
707
+ R.value = e;
708
+ }
709
+ function K(e) {
710
+ z.value = e;
711
+ }
712
+ function se() {
713
+ R.value = !R.value;
714
+ }
715
+ function q() {
716
+ z.value = !z.value;
717
+ }
718
+ let J = null, Y = null;
719
+ function X() {
720
+ if (!J) return;
721
+ let e = d.value?.querySelector(".ml-ribbon-group__content") ?? null;
722
+ Y !== e && (Y && J.unobserve(Y), e && J.observe(e), Y = e);
723
+ }
724
+ return E(() => s.groupModel, () => {
725
+ ie();
726
+ }, { deep: !0 }), h(() => {
727
+ typeof ResizeObserver < "u" && (J = new ResizeObserver(() => {
728
+ ae(), oe(), re();
729
+ }), d.value && J.observe(d.value), X()), ie();
730
+ }), g(() => {
731
+ J?.disconnect();
732
+ }), (t, o) => (_(), i("section", {
733
+ ref_key: "groupSectionRef",
734
+ ref: d,
735
+ class: p(["ml-ribbon-group", { "ml-ribbon-group--auto-width": u.value }]),
736
+ "data-priority": e.priority ?? 100
737
+ }, [a("div", Ge, [x(t.$slots, "default")]), a("footer", Ke, [
738
+ N.value ? (_(), n(T(F), {
739
+ key: 0,
740
+ class: "ml-ribbon-group__icon"
741
+ }, {
742
+ default: D(() => [(_(), n(S(N.value)))]),
743
+ _: 1
744
+ })) : r("", !0),
745
+ a("span", qe, C(e.title), 1),
746
+ I.value && H.value ? (_(), n(T(L), {
747
+ key: 1,
748
+ trigger: "click",
749
+ placement: "bottom-start",
750
+ "popper-class": A.value,
751
+ "popper-options": M.value,
752
+ onShow: o[1] ||= (e) => G(!0),
753
+ onHide: o[2] ||= (e) => G(!1)
754
+ }, {
755
+ reference: D(() => [a("button", {
756
+ ref_key: "footerTriggerRef",
757
+ ref: b,
758
+ type: "button",
759
+ class: p(["ml-ribbon-group__footer-trigger", { "is-open": R.value }]),
760
+ "aria-label": e.overflowTriggerAriaLabel,
761
+ "aria-expanded": R.value,
762
+ onClick: se
763
+ }, [c(T(F), null, {
764
+ default: D(() => [(_(), n(S(R.value ? T(U) : T(V))))]),
765
+ _: 1
766
+ })], 10, Je)]),
767
+ default: D(() => [a("div", Ye, [c(Ue, {
768
+ group: H.value,
769
+ "gallery-preview-fallback": e.galleryPreviewFallback,
770
+ onItemClick: o[0] ||= (e) => l("item-click", e)
771
+ }, null, 8, ["group", "gallery-preview-fallback"])])]),
772
+ _: 1
773
+ }, 8, ["popper-class", "popper-options"])) : r("", !0),
774
+ P.value && B.value ? (_(), n(T(L), {
775
+ key: 2,
776
+ trigger: "click",
777
+ placement: "bottom-start",
778
+ "popper-class": A.value,
779
+ "popper-options": j.value,
780
+ onShow: o[4] ||= (e) => K(!0),
781
+ onHide: o[5] ||= (e) => K(!1)
782
+ }, {
783
+ reference: D(() => [a("button", {
784
+ ref_key: "overflowTriggerRef",
785
+ ref: v,
786
+ type: "button",
787
+ class: p(["ml-ribbon-group__overflow-trigger", { "is-open": z.value }]),
788
+ "aria-label": e.overflowTriggerAriaLabel,
789
+ "aria-expanded": z.value,
790
+ onClick: q
791
+ }, [c(T(F), null, {
792
+ default: D(() => [(_(), n(S(z.value ? T(U) : T(V))))]),
793
+ _: 1
794
+ })], 10, Xe)]),
795
+ default: D(() => [a("div", Ze, [c(Ue, {
796
+ group: B.value,
797
+ "gallery-preview-fallback": e.galleryPreviewFallback,
798
+ onItemClick: o[3] ||= (e) => l("item-click", e)
799
+ }, null, 8, ["group", "gallery-preview-fallback"])])]),
800
+ _: 1
801
+ }, 8, ["popper-class", "popper-options"])) : r("", !0),
802
+ e.showLauncherIcon ?? e.launcher ? (_(), n(T(O), {
803
+ key: 3,
804
+ link: "",
805
+ class: "ml-ribbon-group__launcher"
806
+ }, {
807
+ default: D(() => [c(T(F), null, {
808
+ default: D(() => [c(T(W))]),
809
+ _: 1
810
+ })]),
811
+ _: 1
812
+ })) : r("", !0)
813
+ ])], 10, We));
814
+ }
815
+ }), $e = { class: "ml-ribbon__header" }, et = { class: "ml-ribbon__head-left" }, tt = { class: "ml-ribbon__head-right" }, nt = {
816
+ key: 2,
817
+ class: "ml-ribbon__tabs-extra"
818
+ }, rt = ["data-active-tab"], it = {
819
+ key: 0,
820
+ class: "ml-ribbon-group ml-ribbon-group--overflow"
821
+ }, at = { class: "ml-ribbon-group__body ml-ribbon-group__body--overflow" }, ot = ["aria-label"], st = { class: "ml-ribbon-overflow-list" }, ct = { class: "ml-ribbon-overflow-group__header" }, lt = ["data-active-tab"], ut = {
822
+ class: "ml-ribbon-simplified-group",
823
+ type: "button"
824
+ }, dt = { class: "ml-ribbon-simplified-group__panel" }, ft = 40, pt = /* @__PURE__ */ l({
825
+ __name: "Ribbon",
826
+ props: {
827
+ id: { default: "ml-ribbon-root" },
828
+ tabs: {},
829
+ activeTab: { default: "" },
830
+ activeLayout: { default: void 0 },
831
+ layout: { default: "classic" },
832
+ size: { default: void 0 },
833
+ minimized: {
834
+ type: Boolean,
835
+ default: !1
836
+ },
837
+ hideLayoutSwitcher: {
838
+ type: Boolean,
839
+ default: !1
840
+ },
841
+ hideMinimizeButton: {
842
+ type: Boolean,
843
+ default: !1
844
+ },
845
+ hideKeyTipsToggle: {
846
+ type: Boolean,
847
+ default: !1
848
+ },
849
+ showFileMenu: {
850
+ type: Boolean,
851
+ default: !0
852
+ },
853
+ showOpenBackstage: {
854
+ type: Boolean,
855
+ default: !0
856
+ },
857
+ fileMenuItems: { default: () => [] },
858
+ texts: { default: () => ({}) }
859
+ },
860
+ emits: [
861
+ "update:activeTab",
862
+ "update:layout",
863
+ "update:minimized",
864
+ "tabChange",
865
+ "layoutChange",
866
+ "itemClick",
867
+ "overflowOpen",
868
+ "overflowClose",
869
+ "backstageOpen",
870
+ "backstageClose",
871
+ "fileMenuSelect"
872
+ ],
873
+ setup(s, { expose: l, emit: u }) {
874
+ function m(e) {
875
+ return e == null || typeof e == "string" ? e : typeof e == "object" || typeof e == "function" ? d(w(e)) : e;
876
+ }
877
+ function k(e) {
878
+ if (!e) return;
879
+ let t = { ...e };
880
+ return "icon" in t && (t.icon = m(t.icon)), Array.isArray(t.options) && (t.options = t.options.map((e) => {
881
+ if (!e || typeof e != "object") return e;
882
+ let t = e;
883
+ return "icon" in t ? {
884
+ ...t,
885
+ icon: m(t.icon)
886
+ } : t;
887
+ })), t;
888
+ }
889
+ function ee(e) {
890
+ return {
891
+ ...e,
892
+ icon: m(e.icon),
893
+ props: k(e.props)
894
+ };
895
+ }
896
+ function te(e) {
897
+ return {
898
+ ...e,
899
+ icon: m(e.icon),
900
+ footerMenuItems: e.footerMenuItems?.map(ee),
901
+ collections: e.collections?.map((e) => ({
902
+ ...e,
903
+ items: e.items?.map(ee)
904
+ }))
905
+ };
906
+ }
907
+ function j(e) {
908
+ return e.map((e) => ({
909
+ ...e,
910
+ groups: e.groups?.map(te)
911
+ }));
912
+ }
913
+ let M = {
914
+ layoutSwitcherTooltip: "Switch ribbon layout",
915
+ minimizeTooltip: "Minimize ribbon",
916
+ keyTipsToggleText: "Key Tips",
917
+ overflowTriggerAriaLabel: "Open overflow groups",
918
+ groupOverflowTriggerAriaLabel: "Open group menu",
919
+ fileMenuLabel: "File",
920
+ fileMenuOpenBackstageLabel: "Open backstage",
921
+ backstageBackLabel: "Back",
922
+ backstageTitle: "Backstage",
923
+ backstageDescription: "Manage your document and settings here.",
924
+ keyTipsSequencePrefix: "Sequence:",
925
+ keyTipsEmptySequence: "No key sequence",
926
+ contextualTabDefaultTitle: "Contextual",
927
+ galleryPreviewFallback: "Preview unavailable"
928
+ }, N = s, P = u, { context: I, visibleTabs: R } = le(N.id, N.tabs, N.activeLayout ? String(N.activeLayout).toLowerCase() === "simplified" ? "simplified" : "classic" : N.layout, N.minimized, N.activeTab || N.tabs[0]?.id || "");
929
+ v(oe, I), E(() => N.tabs, (e) => {
930
+ I.tabs.value = j(e), I.tabs.value.some((e) => e.id === I.activeTab.value) || (I.activeTab.value = I.tabs.value[0]?.id || "");
931
+ }, { deep: !0 }), E(() => N.layout, (e) => {
932
+ e !== I.layout.value && (I.layout.value = e);
933
+ }), E(() => N.activeLayout, (e) => {
934
+ if (!e) return;
935
+ let t = String(e).toLowerCase() === "simplified" ? "simplified" : "classic";
936
+ t !== I.layout.value && (I.layout.value = t);
937
+ }), E(() => N.minimized, (e) => {
938
+ e !== I.minimized.value && (I.minimized.value = e);
939
+ }), E(() => N.activeTab, (e) => {
940
+ e && e !== I.activeTab.value && (I.activeTab.value = e);
941
+ }), E(I.activeTab, (e) => {
942
+ P("update:activeTab", e), P("tabChange", e);
943
+ }), E(I.layout, (e) => {
944
+ P("update:layout", e), P("layoutChange", e);
945
+ }), E(I.minimized, (e) => P("update:minimized", e)), E(I.overflowOpen, (e) => {
946
+ P(e ? "overflowOpen" : "overflowClose");
947
+ }), E(I.backdropOpen, (e) => {
948
+ P(e ? "backstageOpen" : "backstageClose");
949
+ });
950
+ let V = t(() => R.value.find((e) => e.id === I.activeTab.value)), U = t(() => V.value?.groups?.filter((e) => e.visible !== !1) ?? []), W = y(null), G = y(/* @__PURE__ */ new Set()), K = y({}), se = ne("size", ""), q = t(() => N.size || se.value || "default"), J = t(() => `ml-ribbon-group-popover ml-ribbon-group-popover--size-${q.value}`), Y = t(() => `ml-ribbon-overflow-popover ml-ribbon-overflow-popover--size-${q.value}`), X = t(() => ({
951
+ layoutSwitcherTooltip: N.texts.layoutSwitcherTooltip || M.layoutSwitcherTooltip,
952
+ minimizeTooltip: N.texts.minimizeTooltip || M.minimizeTooltip,
953
+ keyTipsToggleText: N.texts.keyTipsToggleText || M.keyTipsToggleText,
954
+ overflowTriggerAriaLabel: N.texts.overflowTriggerAriaLabel || M.overflowTriggerAriaLabel,
955
+ groupOverflowTriggerAriaLabel: N.texts.groupOverflowTriggerAriaLabel || M.groupOverflowTriggerAriaLabel,
956
+ fileMenuLabel: N.texts.fileMenuLabel || M.fileMenuLabel,
957
+ fileMenuOpenBackstageLabel: N.texts.fileMenuOpenBackstageLabel || M.fileMenuOpenBackstageLabel,
958
+ backstageBackLabel: N.texts.backstageBackLabel || M.backstageBackLabel,
959
+ backstageTitle: N.texts.backstageTitle || M.backstageTitle,
960
+ backstageDescription: N.texts.backstageDescription || M.backstageDescription,
961
+ keyTipsSequencePrefix: N.texts.keyTipsSequencePrefix || M.keyTipsSequencePrefix,
962
+ keyTipsEmptySequence: N.texts.keyTipsEmptySequence || M.keyTipsEmptySequence,
963
+ contextualTabDefaultTitle: N.texts.contextualTabDefaultTitle || M.contextualTabDefaultTitle,
964
+ galleryPreviewFallback: N.texts.galleryPreviewFallback || M.galleryPreviewFallback
965
+ })), ce = t(() => I.minimized.value ? re : H), ue = t(() => U.value.filter((e) => !G.value.has(e.id))), de = t(() => U.value.filter((e) => G.value.has(e.id))), fe = t(() => {
966
+ if (!de.value.length) return 220;
967
+ let e = de.value.reduce((e, t) => {
968
+ let n = K.value[t.id] ?? ge(t);
969
+ return Math.max(e, n);
970
+ }, 0), t = Math.ceil(e + 40);
971
+ return Math.max(220, Math.min(720, t));
972
+ });
973
+ function pe(e) {
974
+ let t = (e.collections ?? []).flatMap((e) => (e.items ?? []).map((e) => ({
975
+ ...ee(e),
976
+ size: "medium"
977
+ })));
978
+ return {
979
+ ...e,
980
+ orientation: "row",
981
+ collections: [{
982
+ id: `${e.id}-simplified`,
983
+ layout: "row",
984
+ items: t
985
+ }]
986
+ };
987
+ }
988
+ function he(e) {
989
+ return e.priority ?? 100;
990
+ }
991
+ function ge(e) {
992
+ return e.autoWidth === !1 ? 190 : 140;
993
+ }
994
+ function _e(e) {
995
+ let t = {};
996
+ return e.querySelectorAll(".ml-ribbon-group").forEach((e) => {
997
+ let n = e.dataset.groupId;
998
+ if (!n) return;
999
+ let r = e.getBoundingClientRect().width;
1000
+ r > 0 && (t[n] = r);
1001
+ }), t;
1002
+ }
1003
+ function ve(e) {
1004
+ let t = Number.parseFloat(getComputedStyle(e).getPropertyValue("--ml-rb-overflow-slot-width"));
1005
+ return Number.isFinite(t) && t > 0 ? t : ft;
1006
+ }
1007
+ function ye() {
1008
+ if (I.layout.value !== "classic") {
1009
+ G.value = /* @__PURE__ */ new Set();
1010
+ return;
1011
+ }
1012
+ let e = W.value;
1013
+ if (!e) return;
1014
+ let t = U.value;
1015
+ if (!t.length) {
1016
+ G.value = /* @__PURE__ */ new Set();
1017
+ return;
1018
+ }
1019
+ let n = Math.round(e.getBoundingClientRect().width), r = ve(e), i = _e(e);
1020
+ K.value = {
1021
+ ...K.value,
1022
+ ...i
1023
+ };
1024
+ let a = t.filter((e) => e.enableGroupOverflow === !1), o = t.filter((e) => e.enableGroupOverflow !== !1).map((e, t) => ({
1025
+ group: e,
1026
+ index: t
1027
+ })), s = /* @__PURE__ */ new Set(), c = [...o].sort((e, t) => {
1028
+ let n = he(t.group) - he(e.group);
1029
+ return n === 0 ? t.index - e.index : n;
1030
+ }), l = (e) => i[e.id] ?? ge(e), u = a.reduce((e, t) => e + l(t), 0), d = (e) => o.filter(({ group: t }) => !e.has(t.id)).reduce((e, { group: t }) => e + l(t), 0), f = (e) => u + d(e) + (e.size > 0 ? r : 0), p = 0;
1031
+ for (; f(s) > n && p < c.length;) {
1032
+ let e = c[p].group;
1033
+ s.add(e.id), p += 1;
1034
+ }
1035
+ G.value = s;
1036
+ }
1037
+ function be() {
1038
+ f(() => {
1039
+ if (I.layout.value !== "classic" || I.minimized.value) {
1040
+ ye();
1041
+ return;
1042
+ }
1043
+ if (G.value.size === 0) {
1044
+ ye();
1045
+ return;
1046
+ }
1047
+ G.value = /* @__PURE__ */ new Set(), f(() => {
1048
+ ye();
1049
+ });
1050
+ });
1051
+ }
1052
+ function Ce(e) {
1053
+ I.activeTab.value = e;
1054
+ }
1055
+ function we() {
1056
+ I.api.toggleSimplified();
1057
+ }
1058
+ function Te() {
1059
+ I.minimized.value = !I.minimized.value;
1060
+ }
1061
+ function Ee(e) {
1062
+ P("fileMenuSelect", e);
1063
+ }
1064
+ function De() {
1065
+ I.backdropOpen.value = !1;
1066
+ }
1067
+ function Z(e, t) {
1068
+ P("itemClick", {
1069
+ tabId: I.activeTab.value,
1070
+ groupId: e,
1071
+ itemId: t
1072
+ });
1073
+ }
1074
+ function Oe(e) {
1075
+ if (!(e instanceof HTMLElement)) return !1;
1076
+ if (e.isContentEditable) return !0;
1077
+ let t = e.tagName;
1078
+ return t === "INPUT" || t === "TEXTAREA" || t === "SELECT";
1079
+ }
1080
+ function ke() {
1081
+ let e = V.value;
1082
+ if (!e?.groups?.length) {
1083
+ I.keyTips.value = [];
1084
+ return;
1085
+ }
1086
+ let t = e.groups.filter((e) => e.visible !== !1).flatMap((t) => (t.collections ?? []).flatMap((n) => n.items.filter((e) => e.keyTip && e.disabled !== !0).map((n) => {
1087
+ let r = n.keyTip?.trim().toUpperCase();
1088
+ return r ? {
1089
+ id: `${e.id}:${t.id}:${n.id}`,
1090
+ key: r,
1091
+ targetId: n.id,
1092
+ sequence: r.split(""),
1093
+ scope: "item"
1094
+ } : null;
1095
+ }).filter((e) => !!e)));
1096
+ I.keyTips.value = t;
1097
+ }
1098
+ function Ae(e) {
1099
+ let t = V.value;
1100
+ if (t?.groups?.length) {
1101
+ for (let n of t.groups) if (n.visible !== !1) for (let t of n.collections ?? []) {
1102
+ let r = t.items.find((t) => t.id === e.targetId && t.disabled !== !0);
1103
+ if (r) {
1104
+ Z(n.id, r.id), I.keyTipsOpen.value = !1, I.keyTipsSequence.value = "";
1105
+ return;
1106
+ }
1107
+ }
1108
+ }
1109
+ }
1110
+ function Q() {
1111
+ I.keyTipsSequence.value = "";
1112
+ }
1113
+ function je(e) {
1114
+ if (!Oe(e.target)) {
1115
+ if (e.altKey && !e.ctrlKey && !e.metaKey && e.key === "Alt") {
1116
+ e.preventDefault(), I.keyTipsOpen.value = !I.keyTipsOpen.value, I.keyTipsOpen.value || Q();
1117
+ return;
1118
+ }
1119
+ if (I.keyTipsOpen.value && !(e.altKey || e.ctrlKey || e.metaKey)) {
1120
+ if (e.key === "Escape") {
1121
+ e.preventDefault(), I.keyTipsOpen.value = !1, Q();
1122
+ return;
1123
+ }
1124
+ if (e.key === "Backspace") {
1125
+ e.preventDefault(), I.keyTipsSequence.value = I.keyTipsSequence.value.slice(0, -1);
1126
+ return;
1127
+ }
1128
+ if (/^[a-z0-9]$/i.test(e.key)) {
1129
+ e.preventDefault();
1130
+ let t = `${I.keyTipsSequence.value}${e.key.toUpperCase()}`;
1131
+ I.keyTipsSequence.value = t;
1132
+ let n = t.toLowerCase(), r = I.keyTips.value.find((e) => e.key.toLowerCase() === n);
1133
+ if (r) {
1134
+ Ae(r);
1135
+ return;
1136
+ }
1137
+ I.keyTips.value.some((e) => e.key.toLowerCase().startsWith(n)) || Q();
1138
+ }
1139
+ }
1140
+ }
1141
+ }
1142
+ function Me(e) {
1143
+ return e.icon && typeof e.icon != "string" ? e.icon : e.groupIconCss ? ie : null;
1144
+ }
1145
+ E([
1146
+ U,
1147
+ () => I.layout.value,
1148
+ () => I.minimized.value
1149
+ ], () => {
1150
+ be();
1151
+ }), E([V, () => I.tabs.value], () => {
1152
+ ke(), Q();
1153
+ }, {
1154
+ deep: !0,
1155
+ immediate: !0
1156
+ }), E(() => I.keyTipsOpen.value, (e) => {
1157
+ e || Q();
1158
+ }), E(W, (e, t) => {
1159
+ t && $ && $.unobserve(t), e && $ && $.observe(e);
1160
+ }, { flush: "post" });
1161
+ let $ = null;
1162
+ return h(() => {
1163
+ window.addEventListener("keydown", je), typeof ResizeObserver < "u" && ($ = new ResizeObserver(() => {
1164
+ be();
1165
+ }), W.value && $.observe(W.value)), be();
1166
+ }), g(() => {
1167
+ window.removeEventListener("keydown", je), $?.disconnect();
1168
+ }), l(I.api), (t, l) => (_(), n(T(A), { size: N.size }, {
1169
+ default: D(() => [a("section", { class: p(["ml-ribbon", [
1170
+ `ml-ribbon--${T(I).layout.value}`,
1171
+ `ml-ribbon--size-${q.value}`,
1172
+ {
1173
+ "ml-ribbon--minimized": T(I).minimized.value,
1174
+ "ml-ribbon--keytips-open": T(I).keyTipsOpen.value
1175
+ }
1176
+ ]]) }, [
1177
+ a("header", $e, [a("div", et, [
1178
+ s.showFileMenu ? (_(), n(Se, {
1179
+ key: 0,
1180
+ items: s.fileMenuItems,
1181
+ label: X.value.fileMenuLabel,
1182
+ "open-backstage-label": X.value.fileMenuOpenBackstageLabel,
1183
+ "show-open-backstage": s.showOpenBackstage,
1184
+ onSelect: Ee,
1185
+ onOpenBackstage: l[0] ||= (e) => T(I).backdropOpen.value = !0
1186
+ }, null, 8, [
1187
+ "items",
1188
+ "label",
1189
+ "open-backstage-label",
1190
+ "show-open-backstage"
1191
+ ])) : r("", !0),
1192
+ c(xe, {
1193
+ tabs: T(R),
1194
+ "active-tab": T(I).activeTab.value,
1195
+ "default-contextual-title": X.value.contextualTabDefaultTitle,
1196
+ onSelect: Ce
1197
+ }, null, 8, [
1198
+ "tabs",
1199
+ "active-tab",
1200
+ "default-contextual-title"
1201
+ ]),
1202
+ N.hideMinimizeButton ? r("", !0) : (_(), n(T(B), {
1203
+ key: 1,
1204
+ content: X.value.minimizeTooltip
1205
+ }, {
1206
+ default: D(() => [c(T(O), {
1207
+ class: p([
1208
+ "ml-ribbon__control",
1209
+ "ml-ribbon__control--minimize",
1210
+ T(I).minimized.value ? "ml-ribbon__control--minimize-up" : "ml-ribbon__control--minimize-down"
1211
+ ]),
1212
+ icon: ce.value,
1213
+ onClick: Te
1214
+ }, null, 8, ["class", "icon"])]),
1215
+ _: 1
1216
+ }, 8, ["content"]))
1217
+ ]), a("div", tt, [
1218
+ N.hideLayoutSwitcher ? r("", !0) : (_(), n(T(B), {
1219
+ key: 0,
1220
+ content: X.value.layoutSwitcherTooltip
1221
+ }, {
1222
+ default: D(() => [c(T(O), {
1223
+ circle: "",
1224
+ class: "ml-ribbon__control ml-ribbon__control--layout",
1225
+ icon: T(ae),
1226
+ onClick: we
1227
+ }, null, 8, ["icon"])]),
1228
+ _: 1
1229
+ }, 8, ["content"])),
1230
+ N.hideKeyTipsToggle ? r("", !0) : (_(), n(T(z), {
1231
+ key: 1,
1232
+ "inline-prompt": "",
1233
+ class: "ml-ribbon__control ml-ribbon__control--keytips",
1234
+ "active-text": X.value.keyTipsToggleText,
1235
+ "inactive-text": X.value.keyTipsToggleText,
1236
+ "model-value": T(I).keyTipsOpen.value,
1237
+ onChange: l[1] ||= (e) => T(I).keyTipsOpen.value = !T(I).keyTipsOpen.value
1238
+ }, null, 8, [
1239
+ "active-text",
1240
+ "inactive-text",
1241
+ "model-value"
1242
+ ])),
1243
+ t.$slots["tabs-extra"] ? (_(), i("div", nt, [x(t.$slots, "tabs-extra", {
1244
+ activeTab: T(I).activeTab.value,
1245
+ layout: T(I).layout.value,
1246
+ minimized: T(I).minimized.value
1247
+ })])) : r("", !0)
1248
+ ])]),
1249
+ !T(I).minimized.value && V.value && T(I).layout.value === "classic" ? (_(), i("main", {
1250
+ key: 0,
1251
+ class: "ml-ribbon__panel",
1252
+ "data-active-tab": V.value.id,
1253
+ ref_key: "classicPanelRef",
1254
+ ref: W
1255
+ }, [(_(!0), i(e, null, b(ue.value, (e) => (_(), n(Qe, {
1256
+ id: e.id,
1257
+ key: e.id,
1258
+ "data-group-id": e.id,
1259
+ title: e.title,
1260
+ icon: e.icon,
1261
+ "group-icon-css": e.groupIconCss,
1262
+ orientation: e.orientation,
1263
+ "auto-width": e.autoWidth,
1264
+ priority: e.priority ?? 100,
1265
+ launcher: e.launcher,
1266
+ "show-launcher-icon": e.showLauncherIcon,
1267
+ "group-model": e,
1268
+ "overflow-trigger-aria-label": X.value.groupOverflowTriggerAriaLabel,
1269
+ "gallery-preview-fallback": X.value.galleryPreviewFallback,
1270
+ onItemClick: l[3] ||= (e) => Z(e.groupId, e.itemId)
1271
+ }, {
1272
+ default: D(() => [c(Ue, {
1273
+ group: e,
1274
+ "gallery-preview-fallback": X.value.galleryPreviewFallback,
1275
+ onItemClick: l[2] ||= (e) => Z(e.groupId, e.itemId)
1276
+ }, null, 8, ["group", "gallery-preview-fallback"])]),
1277
+ _: 2
1278
+ }, 1032, [
1279
+ "id",
1280
+ "data-group-id",
1281
+ "title",
1282
+ "icon",
1283
+ "group-icon-css",
1284
+ "orientation",
1285
+ "auto-width",
1286
+ "priority",
1287
+ "launcher",
1288
+ "show-launcher-icon",
1289
+ "group-model",
1290
+ "overflow-trigger-aria-label",
1291
+ "gallery-preview-fallback"
1292
+ ]))), 128)), de.value.length ? (_(), i("section", it, [a("div", at, [c(T(L), {
1293
+ trigger: "click",
1294
+ placement: "bottom-end",
1295
+ width: fe.value,
1296
+ "popper-class": Y.value,
1297
+ onShow: l[5] ||= (e) => T(I).overflowOpen.value = !0,
1298
+ onHide: l[6] ||= (e) => T(I).overflowOpen.value = !1
1299
+ }, {
1300
+ reference: D(() => [a("button", {
1301
+ type: "button",
1302
+ class: "ml-ribbon-overflow-trigger",
1303
+ "aria-label": X.value.overflowTriggerAriaLabel
1304
+ }, [...l[8] ||= [a("span", { class: "ml-ribbon-overflow-trigger__dots" }, "...", -1)]], 8, ot)]),
1305
+ default: D(() => [a("div", st, [(_(!0), i(e, null, b(de.value, (e) => (_(), i("section", {
1306
+ key: e.id,
1307
+ class: "ml-ribbon-overflow-group"
1308
+ }, [a("header", ct, C(e.title), 1), c(Ue, {
1309
+ group: e,
1310
+ "gallery-preview-fallback": X.value.galleryPreviewFallback,
1311
+ onItemClick: l[4] ||= (e) => Z(e.groupId, e.itemId)
1312
+ }, null, 8, ["group", "gallery-preview-fallback"])]))), 128))])]),
1313
+ _: 1
1314
+ }, 8, ["width", "popper-class"])]), l[9] ||= a("footer", { class: "ml-ribbon-group__footer ml-ribbon-group__footer--overflow" }, null, -1)])) : r("", !0)], 8, rt)) : r("", !0),
1315
+ !T(I).minimized.value && V.value && T(I).layout.value === "simplified" ? (_(), i("main", {
1316
+ key: 1,
1317
+ class: "ml-ribbon__panel ml-ribbon__panel--simplified",
1318
+ "data-active-tab": V.value.id
1319
+ }, [(_(!0), i(e, null, b(U.value, (e) => (_(), n(T(L), {
1320
+ key: e.id,
1321
+ trigger: "click",
1322
+ placement: "bottom-start",
1323
+ width: 340,
1324
+ "popper-class": J.value
1325
+ }, {
1326
+ reference: D(() => [a("button", ut, [Me(e) ? (_(), n(T(F), {
1327
+ key: 0,
1328
+ class: "ml-ribbon-simplified-group__icon"
1329
+ }, {
1330
+ default: D(() => [(_(), n(S(Me(e))))]),
1331
+ _: 2
1332
+ }, 1024)) : r("", !0), a("span", null, C(e.title), 1)])]),
1333
+ default: D(() => [a("div", dt, [c(Ue, {
1334
+ group: pe(e),
1335
+ "gallery-preview-fallback": X.value.galleryPreviewFallback,
1336
+ onItemClick: l[7] ||= (e) => Z(e.groupId, e.itemId)
1337
+ }, null, 8, ["group", "gallery-preview-fallback"])])]),
1338
+ _: 2
1339
+ }, 1032, ["popper-class"]))), 128))], 8, lt)) : r("", !0),
1340
+ c(me, {
1341
+ open: T(I).backdropOpen.value,
1342
+ size: q.value,
1343
+ "back-label": X.value.backstageBackLabel,
1344
+ title: X.value.backstageTitle,
1345
+ description: X.value.backstageDescription,
1346
+ onClose: De
1347
+ }, o({ _: 2 }, [t.$slots.backstage ? {
1348
+ name: "default",
1349
+ fn: D(() => [x(t.$slots, "backstage", {
1350
+ close: De,
1351
+ open: T(I).backdropOpen.value,
1352
+ size: q.value,
1353
+ backLabel: X.value.backstageBackLabel,
1354
+ title: X.value.backstageTitle,
1355
+ description: X.value.backstageDescription
1356
+ })]),
1357
+ key: "0"
1358
+ } : void 0]), 1032, [
1359
+ "open",
1360
+ "size",
1361
+ "back-label",
1362
+ "title",
1363
+ "description"
1364
+ ])
1365
+ ], 2)]),
1366
+ _: 3
1367
+ }, 8, ["size"]));
1368
+ }
1369
+ }), mt = {
1370
+ class: "ml-ribbon-tab-definition",
1371
+ hidden: ""
1372
+ }, ht = /* @__PURE__ */ l({
1373
+ __name: "RibbonTab",
1374
+ props: {
1375
+ id: {},
1376
+ title: {},
1377
+ visible: { type: Boolean },
1378
+ contextual: { type: Boolean },
1379
+ contextualColor: {},
1380
+ contextualTitle: {}
1381
+ },
1382
+ setup(e) {
1383
+ return (e, t) => (_(), i("div", mt, [x(e.$slots, "default")]));
1384
+ }
1385
+ }), gt = {
1386
+ key: 0,
1387
+ class: "ml-ribbon-keytips",
1388
+ "aria-live": "polite"
1389
+ }, _t = { class: "ml-ribbon-keytips__hint" }, vt = /* @__PURE__ */ l({
1390
+ __name: "RibbonKeyTips",
1391
+ props: {
1392
+ open: { type: Boolean },
1393
+ tips: { default: () => [] },
1394
+ sequencePrefix: {},
1395
+ emptySequenceText: {}
1396
+ },
1397
+ emits: ["activate", "close"],
1398
+ setup(n, { emit: o }) {
1399
+ let s = n, c = o, l = y(""), u = t(() => l.value ? s.tips.filter((e) => e.key.toLowerCase().startsWith(l.value.toLowerCase())) : s.tips), d = t(() => l.value || s.emptySequenceText || ""), f = t(() => s.sequencePrefix ? `${s.sequencePrefix}${d.value}` : d.value), p = t(() => l.value.toLowerCase()), m = t(() => s.tips.filter((e) => e.key.toLowerCase() === p.value)), v = t(() => s.tips.some((e) => e.key.toLowerCase().startsWith(p.value)));
1400
+ function x() {
1401
+ l.value = "";
1402
+ }
1403
+ function S(e) {
1404
+ if (s.open && !(e.altKey || e.ctrlKey || e.metaKey)) {
1405
+ if (e.key === "Escape") {
1406
+ e.preventDefault(), x(), c("close");
1407
+ return;
1408
+ }
1409
+ if (e.key === "Backspace") {
1410
+ e.preventDefault(), l.value = l.value.slice(0, -1);
1411
+ return;
1412
+ }
1413
+ if (/^[a-z0-9]$/i.test(e.key)) {
1414
+ if (e.preventDefault(), l.value += e.key.toUpperCase(), m.value.length > 0) {
1415
+ c("activate", m.value[0]), x();
1416
+ return;
1417
+ }
1418
+ v.value || x();
1419
+ }
1420
+ }
1421
+ }
1422
+ return h(() => window.addEventListener("keydown", S)), g(() => window.removeEventListener("keydown", S)), E(() => s.open, (e) => {
1423
+ e || x();
1424
+ }), (t, o) => n.open ? (_(), i("div", gt, [a("div", _t, C(f.value), 1), (_(!0), i(e, null, b(u.value, (e) => (_(), i("span", {
1425
+ key: e.id,
1426
+ class: "ml-ribbon-keytip"
1427
+ }, C(e.key), 1))), 128))])) : r("", !0);
1428
+ }
1429
+ });
1430
+ //#endregion
1431
+ export { pt as MlRibbon, me as MlRibbonBackstage, Ce as MlRibbonCollection, xe as MlRibbonContextualTabs, Se as MlRibbonFileMenu, Ae as MlRibbonGallery, Qe as MlRibbonGroup, Me as MlRibbonGroupButton, He as MlRibbonItemHost, vt as MlRibbonKeyTips, ht as MlRibbonTab, _e as MlRibbonTabs, Ne as MlRibbonTemplateItem };