@mlightcad/ribbon 0.1.5 → 0.1.6

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 CHANGED
@@ -7,6 +7,7 @@ A Vue 3 + TypeScript Ribbon UI component library aligned with Syncfusion Ribbon
7
7
  [Live Demo](https://mlightcad.github.io/ribbon/)
8
8
 
9
9
  ## What This Project Provides
10
+
10
11
  - Ribbon container/state orchestration (`MlRibbon`)
11
12
  - Tabs, groups, collections, and item host composition
12
13
  - Advanced Ribbon-only items:
@@ -44,10 +45,12 @@ A Vue 3 + TypeScript Ribbon UI component library aligned with Syncfusion Ribbon
44
45
  - Custom ribbon controls can reuse `MlRibbonButton` and `MlRibbonDropdown` for consistent icon, label, dropdown, theme, and size behavior.
45
46
 
46
47
  ## Naming Conventions
48
+
47
49
  - Component names use `Ml` prefix.
48
50
  - CSS classes use `ml-` prefix.
49
51
 
50
52
  ## Tech Stack
53
+
51
54
  - Vue 3
52
55
  - TypeScript
53
56
  - Vite
@@ -56,6 +59,7 @@ A Vue 3 + TypeScript Ribbon UI component library aligned with Syncfusion Ribbon
56
59
  - Playwright
57
60
 
58
61
  ## Quick Start
62
+
59
63
  ```bash
60
64
  pnpm install
61
65
  pnpm dev
@@ -70,6 +74,7 @@ pnpm add vue element-plus @element-plus/icons-vue
70
74
  ## Component Usage
71
75
 
72
76
  ### 1. Import
77
+
73
78
  ```ts
74
79
  import { MlRibbon } from '@mlightcad/ribbon'
75
80
  import '@mlightcad/ribbon/style.css'
@@ -77,6 +82,7 @@ import type { RibbonTabModel } from '@mlightcad/ribbon'
77
82
  ```
78
83
 
79
84
  ### 2. Basic Example
85
+
80
86
  ```vue
81
87
  <script setup lang="ts">
82
88
  import { ref } from 'vue'
@@ -101,7 +107,13 @@ const tabs = ref<RibbonTabModel[]>([
101
107
  id: 'clipboard-actions',
102
108
  items: [
103
109
  { id: 'paste', type: 'button', label: 'Paste', size: 'large' },
104
- { id: 'copy', type: 'button', label: 'Copy', tooltip: 'Copy selection', size: 'small' },
110
+ {
111
+ id: 'copy',
112
+ type: 'button',
113
+ label: 'Copy',
114
+ tooltip: 'Copy selection',
115
+ size: 'small',
116
+ },
105
117
  {
106
118
  id: 'grid-snap',
107
119
  type: 'toggle',
@@ -122,7 +134,11 @@ const tabs = ref<RibbonTabModel[]>([
122
134
  },
123
135
  ])
124
136
 
125
- function handleItemClick(payload: { tabId: string; groupId: string; itemId: string }) {
137
+ function handleItemClick(payload: {
138
+ tabId: string
139
+ groupId: string
140
+ itemId: string
141
+ }) {
126
142
  console.log('Ribbon item clicked:', payload)
127
143
  }
128
144
  </script>
@@ -140,6 +156,7 @@ function handleItemClick(payload: { tabId: string; groupId: string; itemId: stri
140
156
  ```
141
157
 
142
158
  ### 3. Common Props
159
+
143
160
  - `tabs: RibbonTabModel[]` Ribbon data source (required)
144
161
  - `v-model:active-tab` active tab id
145
162
  - `v-model:layout` ribbon layout (`classic` | `simplified`)
@@ -157,6 +174,7 @@ function handleItemClick(payload: { tabId: string; groupId: string; itemId: stri
157
174
  - `tooltip-hide-after` global tooltip hide delay in milliseconds, default `0`
158
175
 
159
176
  ### 4. Common Events
177
+
160
178
  - `@tab-change="(tabId) => {}"` tab switched
161
179
  - `@layout-change="(layout) => {}"` layout switched
162
180
  - `@item-click="({ tabId, groupId, itemId }) => {}"` item clicked
@@ -165,6 +183,7 @@ function handleItemClick(payload: { tabId: string; groupId: string; itemId: stri
165
183
  - `@backstage-open` / `@backstage-close`
166
184
 
167
185
  ### 4.1 Tab-Right Custom Slot
186
+
168
187
  Use `#tabs-extra` to render custom controls at the far-right side of the ribbon header (for example language switchers).
169
188
  Slot props include `activeTab`, `layout`, `minimized`, and `disabled`.
170
189
 
@@ -177,13 +196,18 @@ Slot props include `activeTab`, `layout`, `minimized`, and `disabled`.
177
196
  ```
178
197
 
179
198
  Contextual tabs support two interaction modes through `RibbonTabModel.contextualMode`:
199
+
180
200
  - `selection` keeps regular tabs and their commands interactive while selection-specific UI is visible.
181
201
  - `exclusive` keeps tab headers selectable but disables command content in all non-exclusive contextual tabs, which is useful while creating or editing a modal object.
182
202
 
203
+ Optional `RibbonTabModel.contextualTitle`: when set to a non-empty string, a small label is shown above that contextual tab’s colored block; if omitted, only the tab strip (with `title`) is shown—there is no default block label.
204
+
183
205
  ### 4.2 Custom Backstage Slot (Recommended)
206
+
184
207
  Use `#backstage` to fully customize backstage content.
185
208
 
186
209
  Slot props:
210
+
187
211
  - `close`: close backstage panel
188
212
  - `open`: current backstage open state
189
213
  - `size`: current ribbon size (`large` | `default` | `small`)
@@ -202,7 +226,9 @@ Slot props:
202
226
  ```
203
227
 
204
228
  ### 4.3 Custom Vue Components Inside Groups
229
+
205
230
  Use `type: 'custom'` to mount a host component directly from your ribbon schema. The custom component receives:
231
+
206
232
  - `item`
207
233
  - `groupId`
208
234
  - `disabled`
@@ -246,6 +272,7 @@ const tabs = [
246
272
  ```
247
273
 
248
274
  ### 4.4 Dropdown option dividers
275
+
249
276
  `MlRibbonDropdown` / schema `type: 'dropdown'` items accept `props.options` entries shaped as `RibbonDropdownOption`. Set `divided: true` on an option to show a divider line above that item (same behavior as Element Plus `divided` on `el-dropdown-item`).
250
277
 
251
278
  ```ts
@@ -265,13 +292,16 @@ const tabs = [
265
292
  ```
266
293
 
267
294
  ### 5. Dynamic Runtime API (Component Ref)
295
+
268
296
  `MlRibbon` exposes `RibbonDynamicApi` via `ref`, allowing runtime mutations:
297
+
269
298
  - Tab operations: `addTab`, `removeTab`, `showTab`, `hideTab`, `selectTab`
270
299
  - Group operations: `addGroup`, `removeGroup`, `showGroup`, `hideGroup`
271
300
  - Item operations: `addItem`, `removeItem`, `updateItem`, `enableItem`, `disableItem`
272
301
  - Layout operations: `refreshLayout`, `minimize`, `toggleSimplified`
273
302
 
274
303
  ## Scripts
304
+
275
305
  ```bash
276
306
  pnpm dev
277
307
  pnpm build
@@ -286,6 +316,7 @@ pnpm preview
286
316
  - `pnpm build:demo`: demo app build from `index.html`.
287
317
 
288
318
  ## Project Structure
319
+
289
320
  ```text
290
321
  src/
291
322
  ribbon/
@@ -301,10 +332,12 @@ AGENTS.md
301
332
  ```
302
333
 
303
334
  ## Documentation
335
+
304
336
  - Requirements document: `docs/requirements.md`
305
337
  - Agent coding conventions: `AGENTS.md`
306
338
 
307
339
  ## Current Status
340
+
308
341
  - V1 baseline is implemented and buildable.
309
342
  - Core APIs and tests are available.
310
343
  - Key tips now support `Alt` activation, sequence matching, and command dispatch via `itemClick`.
@@ -9,7 +9,7 @@
9
9
  * @prop visible - Controls tab visibility. Defaults to `true`.
10
10
  * @prop contextual - Marks the tab as contextual.
11
11
  * @prop contextualColor - Accent color used by contextual tab blocks.
12
- * @prop contextualTitle - Group label shown above contextual tabs.
12
+ * @prop contextualTitle - Optional group label shown above contextual tabs when set.
13
13
  *
14
14
  * @slot default - Optional declarative content for custom tab authoring workflows.
15
15
  *