@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.
- package/README.md +40 -3
- package/dist/components/Ribbon.vue.d.ts +102 -0
- package/dist/components/RibbonCollection.vue.d.ts +41 -0
- package/dist/components/RibbonGroup.vue.d.ts +77 -0
- package/dist/components/RibbonGroupContent.vue.d.ts +39 -0
- package/dist/components/RibbonItemHost.vue.d.ts +52 -0
- package/dist/components/RibbonTab.vue.d.ts +47 -0
- package/dist/components/RibbonTabs.vue.d.ts +34 -0
- package/dist/composables/useRibbonState.d.ts +17 -0
- package/dist/context.d.ts +3 -0
- package/{src/ribbon/index.ts → dist/index.d.ts} +15 -43
- package/dist/items/RibbonGallery.vue.d.ts +48 -0
- package/dist/items/RibbonGroupButton.vue.d.ts +49 -0
- package/dist/items/RibbonTemplateItem.vue.d.ts +40 -0
- package/dist/ml-ribbon.css +2 -0
- package/dist/ml-ribbon.es.js +1431 -0
- package/dist/ml-ribbon.umd.js +1 -0
- package/dist/modules/RibbonBackstage.vue.d.ts +61 -0
- package/dist/modules/RibbonContextualTabs.vue.d.ts +41 -0
- package/dist/modules/RibbonFileMenu.vue.d.ts +44 -0
- package/dist/modules/RibbonKeyTips.vue.d.ts +39 -0
- package/dist/types.d.ts +130 -0
- package/package.json +25 -2
- package/.github/workflows/ci.yml +0 -110
- package/.vscode/extensions.json +0 -3
- package/AGENTS.md +0 -42
- package/docs/requirements.md +0 -96
- package/eslint.config.js +0 -41
- package/images/ribbon.jpg +0 -0
- package/index.html +0 -13
- package/playwright/ribbon.spec.ts +0 -6
- package/playwright.config.ts +0 -10
- package/public/favicon.svg +0 -1
- package/public/icons.svg +0 -24
- package/src/App.vue +0 -418
- package/src/assets/hero.png +0 -0
- package/src/assets/vite.svg +0 -1
- package/src/assets/vue.svg +0 -1
- package/src/components/HelloWorld.vue +0 -106
- package/src/main.ts +0 -9
- package/src/ribbon/components/Ribbon.vue +0 -844
- package/src/ribbon/components/RibbonCollection.vue +0 -51
- package/src/ribbon/components/RibbonGroup.vue +0 -327
- package/src/ribbon/components/RibbonGroupContent.vue +0 -61
- package/src/ribbon/components/RibbonItemHost.vue +0 -221
- package/src/ribbon/components/RibbonTab.vue +0 -44
- package/src/ribbon/components/RibbonTabs.vue +0 -49
- package/src/ribbon/composables/useRibbonState.ts +0 -272
- package/src/ribbon/context.ts +0 -4
- package/src/ribbon/items/RibbonGallery.vue +0 -78
- package/src/ribbon/items/RibbonGroupButton.vue +0 -85
- package/src/ribbon/items/RibbonTemplateItem.vue +0 -38
- package/src/ribbon/modules/RibbonBackstage.vue +0 -69
- package/src/ribbon/modules/RibbonContextualTabs.vue +0 -65
- package/src/ribbon/modules/RibbonFileMenu.vue +0 -88
- package/src/ribbon/modules/RibbonKeyTips.vue +0 -114
- package/src/ribbon/styles/ribbon.css +0 -925
- package/src/ribbon/types.ts +0 -162
- package/src/style.css +0 -328
- package/src/tests/ribbon.spec.ts +0 -830
- package/src/tests/setup.ts +0 -4
- package/tools/release.mjs +0 -107
- package/tsconfig.app.json +0 -14
- package/tsconfig.json +0 -7
- package/tsconfig.node.json +0 -24
- package/vite.config.ts +0 -38
package/README.md
CHANGED
|
@@ -21,6 +21,7 @@ A Vue 3 + TypeScript Ribbon UI component library aligned with Syncfusion Ribbon
|
|
|
21
21
|
- Internationalization-ready UI text model via `MlRibbon` `texts` prop (no built-in hard-coded visible strings in Ribbon components)
|
|
22
22
|
- Icon-only command rendering via `RibbonItemModel.hideLabel`
|
|
23
23
|
- Group footer command popover via `RibbonGroupModel.footerMenuItems`
|
|
24
|
+
- Customizable tab-right extension area via `MlRibbon` `#tabs-extra` slot
|
|
24
25
|
|
|
25
26
|
## Naming Conventions
|
|
26
27
|
- Component names use `Ml` prefix.
|
|
@@ -50,8 +51,9 @@ pnpm add vue element-plus @element-plus/icons-vue
|
|
|
50
51
|
|
|
51
52
|
### 1. Import
|
|
52
53
|
```ts
|
|
53
|
-
import { MlRibbon } from '
|
|
54
|
-
import
|
|
54
|
+
import { MlRibbon } from '@mlightcad/ribbon'
|
|
55
|
+
import '@mlightcad/ribbon/style.css'
|
|
56
|
+
import type { RibbonTabModel } from '@mlightcad/ribbon'
|
|
55
57
|
```
|
|
56
58
|
|
|
57
59
|
### 2. Basic Example
|
|
@@ -109,9 +111,12 @@ function handleItemClick(payload: { tabId: string; groupId: string; itemId: stri
|
|
|
109
111
|
- `v-model:layout` ribbon layout (`classic` | `simplified`)
|
|
110
112
|
- `v-model:minimized` minimize state
|
|
111
113
|
- `size` uses Element Plus size (`large` | `default` | `small`)
|
|
114
|
+
- `hide-layout-switcher` whether to hide layout switcher, default `false`
|
|
115
|
+
- `hide-minimize-button` whether to hide minimize button, default `false`
|
|
116
|
+
- `hide-key-tips-toggle` whether to hide key tips toggle, default `false`
|
|
112
117
|
- `show-file-menu` whether to show file menu, default `true`
|
|
118
|
+
- `show-open-backstage` whether to show `Open backstage` command in File menu, default `true`
|
|
113
119
|
- `file-menu-items` file menu item list
|
|
114
|
-
- `backstage-items` backstage item list
|
|
115
120
|
- `texts` localized UI text overrides
|
|
116
121
|
|
|
117
122
|
### 4. Common Events
|
|
@@ -122,6 +127,38 @@ function handleItemClick(payload: { tabId: string; groupId: string; itemId: stri
|
|
|
122
127
|
- `@overflow-open` / `@overflow-close`
|
|
123
128
|
- `@backstage-open` / `@backstage-close`
|
|
124
129
|
|
|
130
|
+
### 4.1 Tab-Right Custom Slot
|
|
131
|
+
Use `#tabs-extra` to render custom controls at the far-right side of the ribbon header (for example language switchers).
|
|
132
|
+
|
|
133
|
+
```vue
|
|
134
|
+
<MlRibbon :tabs="tabs">
|
|
135
|
+
<template #tabs-extra="{ activeTab, layout, minimized }">
|
|
136
|
+
<MyLanguageSwitcher />
|
|
137
|
+
</template>
|
|
138
|
+
</MlRibbon>
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### 4.2 Custom Backstage Slot (Recommended)
|
|
142
|
+
Use `#backstage` to fully customize backstage content.
|
|
143
|
+
|
|
144
|
+
Slot props:
|
|
145
|
+
- `close`: close backstage panel
|
|
146
|
+
- `open`: current backstage open state
|
|
147
|
+
- `size`: current ribbon size (`large` | `default` | `small`)
|
|
148
|
+
- `backLabel`, `title`, `description`: default backstage text data
|
|
149
|
+
|
|
150
|
+
```vue
|
|
151
|
+
<MlRibbon :tabs="tabs" :file-menu-items="fileMenuItems">
|
|
152
|
+
<template #backstage="{ close, size }">
|
|
153
|
+
<section :class="`ml-my-backstage ml-my-backstage--size-${size}`">
|
|
154
|
+
<button type="button" @click="close">Back</button>
|
|
155
|
+
<h2>My Backstage</h2>
|
|
156
|
+
<p>Render any custom UI here.</p>
|
|
157
|
+
</section>
|
|
158
|
+
</template>
|
|
159
|
+
</MlRibbon>
|
|
160
|
+
```
|
|
161
|
+
|
|
125
162
|
### 5. Dynamic Runtime API (Component Ref)
|
|
126
163
|
`MlRibbon` exposes `RibbonDynamicApi` via `ref`, allowing runtime mutations:
|
|
127
164
|
- Tab operations: `addTab`, `removeTab`, `showTab`, `hideTab`, `selectTab`
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import type { ComponentSize } from 'element-plus';
|
|
2
|
+
import type { RibbonDynamicApi, RibbonLayout, RibbonLocaleTexts, RibbonTabModel } from '../types';
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
id?: string;
|
|
5
|
+
tabs: RibbonTabModel[];
|
|
6
|
+
activeTab?: string;
|
|
7
|
+
activeLayout?: RibbonLayout | 'Classic' | 'Simplified';
|
|
8
|
+
layout?: RibbonLayout;
|
|
9
|
+
size?: ComponentSize;
|
|
10
|
+
minimized?: boolean;
|
|
11
|
+
hideLayoutSwitcher?: boolean;
|
|
12
|
+
hideMinimizeButton?: boolean;
|
|
13
|
+
hideKeyTipsToggle?: boolean;
|
|
14
|
+
showFileMenu?: boolean;
|
|
15
|
+
showOpenBackstage?: boolean;
|
|
16
|
+
fileMenuItems?: {
|
|
17
|
+
id: string;
|
|
18
|
+
label: string;
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
}[];
|
|
21
|
+
texts?: RibbonLocaleTexts;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Closes backstage panel.
|
|
25
|
+
*/
|
|
26
|
+
declare function closeBackstage(): void;
|
|
27
|
+
declare var __VLS_56: {
|
|
28
|
+
activeTab: string;
|
|
29
|
+
layout: RibbonLayout;
|
|
30
|
+
minimized: boolean;
|
|
31
|
+
}, __VLS_124: {
|
|
32
|
+
close: typeof closeBackstage;
|
|
33
|
+
open: boolean;
|
|
34
|
+
size: "large" | "small" | "default";
|
|
35
|
+
backLabel: string | undefined;
|
|
36
|
+
title: string | undefined;
|
|
37
|
+
description: string | undefined;
|
|
38
|
+
};
|
|
39
|
+
type __VLS_Slots = {} & {
|
|
40
|
+
'tabs-extra'?: (props: typeof __VLS_56) => any;
|
|
41
|
+
} & {
|
|
42
|
+
backstage?: (props: typeof __VLS_124) => any;
|
|
43
|
+
};
|
|
44
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, RibbonDynamicApi, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
45
|
+
itemClick: (payload: {
|
|
46
|
+
tabId: string;
|
|
47
|
+
groupId: string;
|
|
48
|
+
itemId: string;
|
|
49
|
+
}) => any;
|
|
50
|
+
"update:activeTab": (value: string) => any;
|
|
51
|
+
"update:layout": (value: RibbonLayout) => any;
|
|
52
|
+
"update:minimized": (value: boolean) => any;
|
|
53
|
+
tabChange: (value: string) => any;
|
|
54
|
+
layoutChange: (value: RibbonLayout) => any;
|
|
55
|
+
overflowOpen: () => any;
|
|
56
|
+
overflowClose: () => any;
|
|
57
|
+
backstageOpen: () => any;
|
|
58
|
+
backstageClose: () => any;
|
|
59
|
+
fileMenuSelect: (value: string) => any;
|
|
60
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
61
|
+
onItemClick?: ((payload: {
|
|
62
|
+
tabId: string;
|
|
63
|
+
groupId: string;
|
|
64
|
+
itemId: string;
|
|
65
|
+
}) => any) | undefined;
|
|
66
|
+
"onUpdate:activeTab"?: ((value: string) => any) | undefined;
|
|
67
|
+
"onUpdate:layout"?: ((value: RibbonLayout) => any) | undefined;
|
|
68
|
+
"onUpdate:minimized"?: ((value: boolean) => any) | undefined;
|
|
69
|
+
onTabChange?: ((value: string) => any) | undefined;
|
|
70
|
+
onLayoutChange?: ((value: RibbonLayout) => any) | undefined;
|
|
71
|
+
onOverflowOpen?: (() => any) | undefined;
|
|
72
|
+
onOverflowClose?: (() => any) | undefined;
|
|
73
|
+
onBackstageOpen?: (() => any) | undefined;
|
|
74
|
+
onBackstageClose?: (() => any) | undefined;
|
|
75
|
+
onFileMenuSelect?: ((value: string) => any) | undefined;
|
|
76
|
+
}>, {
|
|
77
|
+
id: string;
|
|
78
|
+
size: ComponentSize;
|
|
79
|
+
layout: RibbonLayout;
|
|
80
|
+
activeTab: string;
|
|
81
|
+
showOpenBackstage: boolean;
|
|
82
|
+
activeLayout: RibbonLayout | "Classic" | "Simplified";
|
|
83
|
+
minimized: boolean;
|
|
84
|
+
hideLayoutSwitcher: boolean;
|
|
85
|
+
hideMinimizeButton: boolean;
|
|
86
|
+
hideKeyTipsToggle: boolean;
|
|
87
|
+
showFileMenu: boolean;
|
|
88
|
+
fileMenuItems: {
|
|
89
|
+
id: string;
|
|
90
|
+
label: string;
|
|
91
|
+
disabled?: boolean;
|
|
92
|
+
}[];
|
|
93
|
+
texts: RibbonLocaleTexts;
|
|
94
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
95
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
96
|
+
declare const _default: typeof __VLS_export;
|
|
97
|
+
export default _default;
|
|
98
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
99
|
+
new (): {
|
|
100
|
+
$slots: S;
|
|
101
|
+
};
|
|
102
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { RibbonCollectionLayout } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* @component MlRibbonCollection
|
|
4
|
+
* @description
|
|
5
|
+
* Layout container for a group-level item collection. It controls row/column flow
|
|
6
|
+
* and exposes a CSS variable for row-based packing.
|
|
7
|
+
*
|
|
8
|
+
* @prop id - Unique collection identifier.
|
|
9
|
+
* @prop layout - Collection flow direction (`row` or `column`).
|
|
10
|
+
* @prop rows - Desired row count when the collection is rendered in grid-like modes.
|
|
11
|
+
*
|
|
12
|
+
* @slot default - Collection items, typically `MlRibbonItemHost` components.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```vue
|
|
16
|
+
* <MlRibbonCollection id="clipboard-right" layout="column" :rows="3">
|
|
17
|
+
* <MlRibbonItemHost ... />
|
|
18
|
+
* </MlRibbonCollection>
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
type __VLS_Props = {
|
|
22
|
+
id: string;
|
|
23
|
+
layout?: RibbonCollectionLayout;
|
|
24
|
+
rows?: number;
|
|
25
|
+
};
|
|
26
|
+
declare var __VLS_1: {};
|
|
27
|
+
type __VLS_Slots = {} & {
|
|
28
|
+
default?: (props: typeof __VLS_1) => any;
|
|
29
|
+
};
|
|
30
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
31
|
+
layout: RibbonCollectionLayout;
|
|
32
|
+
rows: number;
|
|
33
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
34
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
35
|
+
declare const _default: typeof __VLS_export;
|
|
36
|
+
export default _default;
|
|
37
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
38
|
+
new (): {
|
|
39
|
+
$slots: S;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import type { Component } from 'vue';
|
|
2
|
+
import type { RibbonGroupModel } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* @component MlRibbonGroup
|
|
5
|
+
* @description
|
|
6
|
+
* Visual wrapper for a ribbon group. It renders the group frame/title area and
|
|
7
|
+
* automatically moves clipped items into an overflow popover when space is limited.
|
|
8
|
+
*
|
|
9
|
+
* @prop id - Group identifier.
|
|
10
|
+
* @prop title - Group title shown in the footer.
|
|
11
|
+
* @prop icon - Optional Vue icon component for the group title area.
|
|
12
|
+
* @prop groupIconCss - Optional CSS marker used by host logic to map string icons.
|
|
13
|
+
* @prop orientation - Primary group layout direction.
|
|
14
|
+
* @prop autoWidth - Whether group width is auto-sized.
|
|
15
|
+
* @prop priority - Overflow priority hint (higher values overflow first).
|
|
16
|
+
* @prop launcher - Enables launcher affordance.
|
|
17
|
+
* @prop showLauncherIcon - Explicit launcher icon visibility override.
|
|
18
|
+
* @prop groupModel - Full group model used to construct overflow content.
|
|
19
|
+
* @prop overflowTriggerAriaLabel - Accessible label for overflow trigger button.
|
|
20
|
+
* @prop galleryPreviewFallback - Fallback text passed to nested gallery items.
|
|
21
|
+
*
|
|
22
|
+
* @event item-click - Emitted when an item click bubbles from group content.
|
|
23
|
+
* Payload includes `{ groupId, itemId }`.
|
|
24
|
+
*
|
|
25
|
+
* @slot default - Group body content, usually `MlRibbonGroupContent`.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```vue
|
|
29
|
+
* <MlRibbonGroup
|
|
30
|
+
* id="clipboard"
|
|
31
|
+
* title="Clipboard"
|
|
32
|
+
* :group-model="group"
|
|
33
|
+
* :priority="10"
|
|
34
|
+
* overflow-trigger-aria-label="Show hidden commands"
|
|
35
|
+
* @item-click="onItemClick"
|
|
36
|
+
* >
|
|
37
|
+
* <MlRibbonGroupContent :group="group" />
|
|
38
|
+
* </MlRibbonGroup>
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
type __VLS_Props = {
|
|
42
|
+
id: string;
|
|
43
|
+
title: string;
|
|
44
|
+
icon?: string | Component;
|
|
45
|
+
groupIconCss?: string;
|
|
46
|
+
orientation?: 'row' | 'column';
|
|
47
|
+
autoWidth?: boolean;
|
|
48
|
+
priority?: number;
|
|
49
|
+
launcher?: boolean;
|
|
50
|
+
showLauncherIcon?: boolean;
|
|
51
|
+
groupModel?: RibbonGroupModel;
|
|
52
|
+
overflowTriggerAriaLabel?: string;
|
|
53
|
+
galleryPreviewFallback?: string;
|
|
54
|
+
};
|
|
55
|
+
declare var __VLS_1: {};
|
|
56
|
+
type __VLS_Slots = {} & {
|
|
57
|
+
default?: (props: typeof __VLS_1) => any;
|
|
58
|
+
};
|
|
59
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
60
|
+
"item-click": (payload: {
|
|
61
|
+
groupId: string;
|
|
62
|
+
itemId: string;
|
|
63
|
+
}) => any;
|
|
64
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
65
|
+
"onItem-click"?: ((payload: {
|
|
66
|
+
groupId: string;
|
|
67
|
+
itemId: string;
|
|
68
|
+
}) => any) | undefined;
|
|
69
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
70
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
71
|
+
declare const _default: typeof __VLS_export;
|
|
72
|
+
export default _default;
|
|
73
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
74
|
+
new (): {
|
|
75
|
+
$slots: S;
|
|
76
|
+
};
|
|
77
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { RibbonGroupModel } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* @component MlRibbonGroupContent
|
|
4
|
+
* @description
|
|
5
|
+
* Internal renderer that expands a `RibbonGroupModel` into collections and concrete
|
|
6
|
+
* interactive items.
|
|
7
|
+
*
|
|
8
|
+
* @prop group - Group model with collections and items to render.
|
|
9
|
+
* @prop galleryPreviewFallback - Fallback text for gallery item previews.
|
|
10
|
+
*
|
|
11
|
+
* @event item-click - Emitted when any nested item is activated.
|
|
12
|
+
* Payload includes `{ groupId, itemId }`.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```vue
|
|
16
|
+
* <MlRibbonGroupContent
|
|
17
|
+
* :group="groupModel"
|
|
18
|
+
* gallery-preview-fallback="Preview"
|
|
19
|
+
* @item-click="onGroupItemClick"
|
|
20
|
+
* />
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
type __VLS_Props = {
|
|
24
|
+
group: RibbonGroupModel;
|
|
25
|
+
galleryPreviewFallback?: string;
|
|
26
|
+
};
|
|
27
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
28
|
+
"item-click": (payload: {
|
|
29
|
+
groupId: string;
|
|
30
|
+
itemId: string;
|
|
31
|
+
}) => any;
|
|
32
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
33
|
+
"onItem-click"?: ((payload: {
|
|
34
|
+
groupId: string;
|
|
35
|
+
itemId: string;
|
|
36
|
+
}) => any) | undefined;
|
|
37
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
38
|
+
declare const _default: typeof __VLS_export;
|
|
39
|
+
export default _default;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { RibbonItemModel } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* @component MlRibbonItemHost
|
|
4
|
+
* @description
|
|
5
|
+
* Type-aware item renderer. It maps `RibbonItemModel.type` to Element Plus controls
|
|
6
|
+
* or ribbon-specific item components and normalizes click/change emissions.
|
|
7
|
+
*
|
|
8
|
+
* @prop id - Item identifier.
|
|
9
|
+
* @prop item - Full item model, including type and item-specific props.
|
|
10
|
+
* @prop groupId - Parent group id used for telemetry and callbacks.
|
|
11
|
+
* @prop galleryPreviewFallback - Fallback label passed to `MlRibbonGallery`.
|
|
12
|
+
*
|
|
13
|
+
* @event item-click - Emitted when the hosted item is activated. Payload is item id.
|
|
14
|
+
*
|
|
15
|
+
* @slot template - Custom renderer slot for `template` item type.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```vue
|
|
19
|
+
* <MlRibbonItemHost
|
|
20
|
+
* id="font-family"
|
|
21
|
+
* :item="itemModel"
|
|
22
|
+
* group-id="font"
|
|
23
|
+
* gallery-preview-fallback="Preview"
|
|
24
|
+
* @item-click="onItemClick"
|
|
25
|
+
* />
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
type __VLS_Props = {
|
|
29
|
+
id: string;
|
|
30
|
+
item: RibbonItemModel;
|
|
31
|
+
groupId: string;
|
|
32
|
+
galleryPreviewFallback?: string;
|
|
33
|
+
};
|
|
34
|
+
declare var __VLS_21: {
|
|
35
|
+
item: RibbonItemModel;
|
|
36
|
+
};
|
|
37
|
+
type __VLS_Slots = {} & {
|
|
38
|
+
template?: (props: typeof __VLS_21) => any;
|
|
39
|
+
};
|
|
40
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
41
|
+
"item-click": (payload: string) => any;
|
|
42
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
43
|
+
"onItem-click"?: ((payload: string) => any) | undefined;
|
|
44
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
45
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
46
|
+
declare const _default: typeof __VLS_export;
|
|
47
|
+
export default _default;
|
|
48
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
49
|
+
new (): {
|
|
50
|
+
$slots: S;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @component MlRibbonTab
|
|
3
|
+
* @description
|
|
4
|
+
* Declarative tab definition component. It is primarily used as a structural marker
|
|
5
|
+
* and keeps tab metadata close to authored markup.
|
|
6
|
+
*
|
|
7
|
+
* @prop id - Unique tab identifier.
|
|
8
|
+
* @prop title - Display title in the tab strip.
|
|
9
|
+
* @prop visible - Controls tab visibility. Defaults to `true`.
|
|
10
|
+
* @prop contextual - Marks the tab as contextual.
|
|
11
|
+
* @prop contextualColor - Accent color used by contextual tab blocks.
|
|
12
|
+
* @prop contextualTitle - Group label shown above contextual tabs.
|
|
13
|
+
*
|
|
14
|
+
* @slot default - Optional declarative content for custom tab authoring workflows.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```vue
|
|
18
|
+
* <MlRibbonTab
|
|
19
|
+
* id="chart-tools"
|
|
20
|
+
* title="Chart Design"
|
|
21
|
+
* contextual
|
|
22
|
+
* contextual-title="Chart Tools"
|
|
23
|
+
* contextual-color="#eebe77"
|
|
24
|
+
* />
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
type __VLS_Props = {
|
|
28
|
+
id: string;
|
|
29
|
+
title: string;
|
|
30
|
+
visible?: boolean;
|
|
31
|
+
contextual?: boolean;
|
|
32
|
+
contextualColor?: string;
|
|
33
|
+
contextualTitle?: string;
|
|
34
|
+
};
|
|
35
|
+
declare var __VLS_1: {};
|
|
36
|
+
type __VLS_Slots = {} & {
|
|
37
|
+
default?: (props: typeof __VLS_1) => any;
|
|
38
|
+
};
|
|
39
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
40
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
41
|
+
declare const _default: typeof __VLS_export;
|
|
42
|
+
export default _default;
|
|
43
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
44
|
+
new (): {
|
|
45
|
+
$slots: S;
|
|
46
|
+
};
|
|
47
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @component MlRibbonTabs
|
|
3
|
+
* @description
|
|
4
|
+
* Renders the tab strip used by the ribbon header and emits selection changes.
|
|
5
|
+
*
|
|
6
|
+
* @prop tabs - Tab definitions to render. Tabs with `visible: false` are hidden.
|
|
7
|
+
* @prop activeTab - Currently active tab id.
|
|
8
|
+
*
|
|
9
|
+
* @event select - Emitted when a tab is clicked. Payload is the selected tab id.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```vue
|
|
13
|
+
* <MlRibbonTabs
|
|
14
|
+
* :tabs="[{ id: 'home', title: 'Home' }, { id: 'insert', title: 'Insert' }]"
|
|
15
|
+
* active-tab="home"
|
|
16
|
+
* @select="onTabSelect"
|
|
17
|
+
* />
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
type __VLS_Props = {
|
|
21
|
+
tabs: {
|
|
22
|
+
id: string;
|
|
23
|
+
title: string;
|
|
24
|
+
visible?: boolean;
|
|
25
|
+
}[];
|
|
26
|
+
activeTab: string;
|
|
27
|
+
};
|
|
28
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
29
|
+
select: (id: string) => any;
|
|
30
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
31
|
+
onSelect?: ((id: string) => any) | undefined;
|
|
32
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
33
|
+
declare const _default: typeof __VLS_export;
|
|
34
|
+
export default _default;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ComputedRef } from 'vue';
|
|
2
|
+
import type { RibbonContextValue, RibbonLayout, RibbonTabModel } from '../types';
|
|
3
|
+
interface UseRibbonStateResult {
|
|
4
|
+
context: RibbonContextValue;
|
|
5
|
+
visibleTabs: ComputedRef<RibbonTabModel[]>;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Creates the ribbon runtime state container and dynamic mutation API.
|
|
9
|
+
* @param ribbonId Ribbon instance id.
|
|
10
|
+
* @param initialTabs Initial tab schema.
|
|
11
|
+
* @param initialLayout Initial layout mode.
|
|
12
|
+
* @param initialMinimized Initial minimized state.
|
|
13
|
+
* @param initialActiveTab Initial active tab id.
|
|
14
|
+
* @returns Ribbon context plus computed visible tabs.
|
|
15
|
+
*/
|
|
16
|
+
export declare function useRibbonState(ribbonId: string, initialTabs: RibbonTabModel[], initialLayout: RibbonLayout, initialMinimized: boolean, initialActiveTab: string): UseRibbonStateResult;
|
|
17
|
+
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import './styles/ribbon.css';
|
|
1
2
|
/**
|
|
2
3
|
* @component MlRibbon
|
|
3
4
|
* @description Root ribbon orchestrator component.
|
|
@@ -6,94 +7,65 @@
|
|
|
6
7
|
* <MlRibbon :tabs="tabs" v-model:active-tab="activeTab" />
|
|
7
8
|
* ```
|
|
8
9
|
*/
|
|
9
|
-
export { default as MlRibbon } from './components/Ribbon.vue'
|
|
10
|
-
|
|
10
|
+
export { default as MlRibbon } from './components/Ribbon.vue';
|
|
11
11
|
/**
|
|
12
12
|
* @component MlRibbonTabs
|
|
13
13
|
* @description Basic tab strip renderer for ribbon headers.
|
|
14
14
|
*/
|
|
15
|
-
export { default as MlRibbonTabs } from './components/RibbonTabs.vue'
|
|
16
|
-
|
|
15
|
+
export { default as MlRibbonTabs } from './components/RibbonTabs.vue';
|
|
17
16
|
/**
|
|
18
17
|
* @component MlRibbonTab
|
|
19
18
|
* @description Declarative tab metadata component.
|
|
20
19
|
*/
|
|
21
|
-
export { default as MlRibbonTab } from './components/RibbonTab.vue'
|
|
22
|
-
|
|
20
|
+
export { default as MlRibbonTab } from './components/RibbonTab.vue';
|
|
23
21
|
/**
|
|
24
22
|
* @component MlRibbonGroup
|
|
25
23
|
* @description Group container with optional overflow handling.
|
|
26
24
|
*/
|
|
27
|
-
export { default as MlRibbonGroup } from './components/RibbonGroup.vue'
|
|
28
|
-
|
|
25
|
+
export { default as MlRibbonGroup } from './components/RibbonGroup.vue';
|
|
29
26
|
/**
|
|
30
27
|
* @component MlRibbonCollection
|
|
31
28
|
* @description Collection layout container inside a ribbon group.
|
|
32
29
|
*/
|
|
33
|
-
export { default as MlRibbonCollection } from './components/RibbonCollection.vue'
|
|
34
|
-
|
|
30
|
+
export { default as MlRibbonCollection } from './components/RibbonCollection.vue';
|
|
35
31
|
/**
|
|
36
32
|
* @component MlRibbonItemHost
|
|
37
33
|
* @description Type-driven ribbon item renderer.
|
|
38
34
|
*/
|
|
39
|
-
export { default as MlRibbonItemHost } from './components/RibbonItemHost.vue'
|
|
40
|
-
|
|
35
|
+
export { default as MlRibbonItemHost } from './components/RibbonItemHost.vue';
|
|
41
36
|
/**
|
|
42
37
|
* @component MlRibbonGroupButton
|
|
43
38
|
* @description Segmented group button ribbon item.
|
|
44
39
|
*/
|
|
45
|
-
export { default as MlRibbonGroupButton } from './items/RibbonGroupButton.vue'
|
|
46
|
-
|
|
40
|
+
export { default as MlRibbonGroupButton } from './items/RibbonGroupButton.vue';
|
|
47
41
|
/**
|
|
48
42
|
* @component MlRibbonGallery
|
|
49
43
|
* @description Categorized gallery selector ribbon item.
|
|
50
44
|
*/
|
|
51
|
-
export { default as MlRibbonGallery } from './items/RibbonGallery.vue'
|
|
52
|
-
|
|
45
|
+
export { default as MlRibbonGallery } from './items/RibbonGallery.vue';
|
|
53
46
|
/**
|
|
54
47
|
* @component MlRibbonTemplateItem
|
|
55
48
|
* @description Custom-template ribbon item wrapper.
|
|
56
49
|
*/
|
|
57
|
-
export { default as MlRibbonTemplateItem } from './items/RibbonTemplateItem.vue'
|
|
58
|
-
|
|
50
|
+
export { default as MlRibbonTemplateItem } from './items/RibbonTemplateItem.vue';
|
|
59
51
|
/**
|
|
60
52
|
* @component MlRibbonFileMenu
|
|
61
53
|
* @description File tab dropdown module.
|
|
62
54
|
*/
|
|
63
|
-
export { default as MlRibbonFileMenu } from './modules/RibbonFileMenu.vue'
|
|
64
|
-
|
|
55
|
+
export { default as MlRibbonFileMenu } from './modules/RibbonFileMenu.vue';
|
|
65
56
|
/**
|
|
66
57
|
* @component MlRibbonBackstage
|
|
67
58
|
* @description Full-screen backstage drawer module.
|
|
68
59
|
*/
|
|
69
|
-
export { default as MlRibbonBackstage } from './modules/RibbonBackstage.vue'
|
|
70
|
-
|
|
60
|
+
export { default as MlRibbonBackstage } from './modules/RibbonBackstage.vue';
|
|
71
61
|
/**
|
|
72
62
|
* @component MlRibbonKeyTips
|
|
73
63
|
* @description Keyboard key tips overlay module.
|
|
74
64
|
*/
|
|
75
|
-
export { default as MlRibbonKeyTips } from './modules/RibbonKeyTips.vue'
|
|
76
|
-
|
|
65
|
+
export { default as MlRibbonKeyTips } from './modules/RibbonKeyTips.vue';
|
|
77
66
|
/**
|
|
78
67
|
* @component MlRibbonContextualTabs
|
|
79
68
|
* @description Context-aware tab strip module.
|
|
80
69
|
*/
|
|
81
|
-
export { default as MlRibbonContextualTabs } from './modules/RibbonContextualTabs.vue'
|
|
82
|
-
|
|
83
|
-
export type {
|
|
84
|
-
RibbonLayout,
|
|
85
|
-
RibbonItemSize,
|
|
86
|
-
RibbonItemType,
|
|
87
|
-
RibbonCollectionLayout,
|
|
88
|
-
RibbonGroupOrientation,
|
|
89
|
-
RibbonComponentSize,
|
|
90
|
-
RibbonTabModel,
|
|
91
|
-
RibbonGroupModel,
|
|
92
|
-
RibbonCollectionModel,
|
|
93
|
-
RibbonItemModel,
|
|
94
|
-
RibbonDynamicApi,
|
|
95
|
-
KeyTipModel,
|
|
96
|
-
FileMenuItemModel,
|
|
97
|
-
BackstageItemModel,
|
|
98
|
-
RibbonLocaleTexts,
|
|
99
|
-
} from './types'
|
|
70
|
+
export { default as MlRibbonContextualTabs } from './modules/RibbonContextualTabs.vue';
|
|
71
|
+
export type { RibbonLayout, RibbonItemSize, RibbonItemType, RibbonCollectionLayout, RibbonGroupOrientation, RibbonComponentSize, RibbonTabModel, RibbonGroupModel, RibbonCollectionModel, RibbonItemModel, RibbonDynamicApi, KeyTipModel, FileMenuItemModel, RibbonLocaleTexts, } from './types';
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @component MlRibbonGallery
|
|
3
|
+
* @description
|
|
4
|
+
* Categorized gallery selector for previewable ribbon commands.
|
|
5
|
+
*
|
|
6
|
+
* @prop id - Gallery identifier.
|
|
7
|
+
* @prop label - Optional gallery title.
|
|
8
|
+
* @prop categories - Gallery categories and their selectable items.
|
|
9
|
+
* @prop disabled - Disables selection.
|
|
10
|
+
* @prop previewFallback - Fallback preview text when an item has no preview.
|
|
11
|
+
*
|
|
12
|
+
* @event select - Emitted with selected gallery item id.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```vue
|
|
16
|
+
* <MlRibbonGallery
|
|
17
|
+
* id="styles"
|
|
18
|
+
* label="Styles"
|
|
19
|
+
* :categories="styleCategories"
|
|
20
|
+
* preview-fallback="Preview"
|
|
21
|
+
* @select="onStylePick"
|
|
22
|
+
* />
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
type __VLS_Props = {
|
|
26
|
+
id: string;
|
|
27
|
+
label: string;
|
|
28
|
+
categories: {
|
|
29
|
+
id: string;
|
|
30
|
+
title: string;
|
|
31
|
+
items: {
|
|
32
|
+
id: string;
|
|
33
|
+
label: string;
|
|
34
|
+
preview?: string;
|
|
35
|
+
}[];
|
|
36
|
+
}[];
|
|
37
|
+
disabled?: boolean;
|
|
38
|
+
previewFallback?: string;
|
|
39
|
+
};
|
|
40
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
41
|
+
select: (id: string) => any;
|
|
42
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
43
|
+
onSelect?: ((id: string) => any) | undefined;
|
|
44
|
+
}>, {
|
|
45
|
+
disabled: boolean;
|
|
46
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
47
|
+
declare const _default: typeof __VLS_export;
|
|
48
|
+
export default _default;
|