@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
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import MlRibbonTabs from '../components/RibbonTabs.vue'
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* @component MlRibbonContextualTabs
|
|
6
|
-
* @description
|
|
7
|
-
* Composite tab strip that renders regular tabs and contextual tab blocks with
|
|
8
|
-
* accent colors and contextual section labels.
|
|
9
|
-
*
|
|
10
|
-
* @prop tabs - Full tab list (regular and contextual tabs).
|
|
11
|
-
* @prop activeTab - Currently active tab id.
|
|
12
|
-
* @prop defaultContextualTitle - Fallback title for contextual tab blocks.
|
|
13
|
-
*
|
|
14
|
-
* @event select - Emitted when any tab is selected.
|
|
15
|
-
*
|
|
16
|
-
* @example
|
|
17
|
-
* ```vue
|
|
18
|
-
* <MlRibbonContextualTabs
|
|
19
|
-
* :tabs="tabs"
|
|
20
|
-
* :active-tab="activeTab"
|
|
21
|
-
* default-contextual-title="Context"
|
|
22
|
-
* @select="activeTab = $event"
|
|
23
|
-
* />
|
|
24
|
-
* ```
|
|
25
|
-
*/
|
|
26
|
-
const props = defineProps<{
|
|
27
|
-
tabs: {
|
|
28
|
-
id: string
|
|
29
|
-
title: string
|
|
30
|
-
contextual?: boolean
|
|
31
|
-
contextualColor?: string
|
|
32
|
-
contextualTitle?: string
|
|
33
|
-
visible?: boolean
|
|
34
|
-
}[]
|
|
35
|
-
activeTab: string
|
|
36
|
-
defaultContextualTitle?: string
|
|
37
|
-
}>()
|
|
38
|
-
|
|
39
|
-
const emit = defineEmits<{ (e: 'select', id: string): void }>()
|
|
40
|
-
</script>
|
|
41
|
-
|
|
42
|
-
<template>
|
|
43
|
-
<div class="ml-ribbon-contextual-tabs">
|
|
44
|
-
<div class="ml-ribbon-contextual-tabs__normal">
|
|
45
|
-
<MlRibbonTabs
|
|
46
|
-
:tabs="props.tabs.filter((x) => !x.contextual)"
|
|
47
|
-
:active-tab="activeTab"
|
|
48
|
-
@select="emit('select', $event)"
|
|
49
|
-
/>
|
|
50
|
-
</div>
|
|
51
|
-
<div class="ml-ribbon-contextual-tabs__ctx">
|
|
52
|
-
<section
|
|
53
|
-
v-for="ctx in props.tabs.filter((x) => x.contextual)"
|
|
54
|
-
:key="ctx.id"
|
|
55
|
-
class="ml-ribbon-contextual-tabs__block"
|
|
56
|
-
:style="{ '--ctx-color': ctx.contextualColor || '#67c23a' }"
|
|
57
|
-
>
|
|
58
|
-
<small>{{ ctx.contextualTitle || props.defaultContextualTitle }}</small>
|
|
59
|
-
<MlRibbonTabs :tabs="[ctx]" :active-tab="activeTab" @select="emit('select', $event)" />
|
|
60
|
-
</section>
|
|
61
|
-
</div>
|
|
62
|
-
</div>
|
|
63
|
-
</template>
|
|
64
|
-
|
|
65
|
-
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { computed, ref } from 'vue'
|
|
3
|
-
import { ElDropdown, ElDropdownItem, ElDropdownMenu, useGlobalConfig } from 'element-plus'
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* @component MlRibbonFileMenu
|
|
7
|
-
* @description
|
|
8
|
-
* File menu tab entry that opens a dropdown list with quick commands and a
|
|
9
|
-
* dedicated action to open the backstage view.
|
|
10
|
-
*
|
|
11
|
-
* @prop items - File menu command list.
|
|
12
|
-
* @prop label - File tab label text.
|
|
13
|
-
* @prop openBackstageLabel - Label for the backstage opener row.
|
|
14
|
-
*
|
|
15
|
-
* @event select - Emitted when a regular file menu command is selected.
|
|
16
|
-
* @event open-backstage - Emitted when the backstage command is selected.
|
|
17
|
-
*
|
|
18
|
-
* @example
|
|
19
|
-
* ```vue
|
|
20
|
-
* <MlRibbonFileMenu
|
|
21
|
-
* :items="[{ id: 'new', label: 'New' }, { id: 'open', label: 'Open' }]"
|
|
22
|
-
* label="File"
|
|
23
|
-
* open-backstage-label="Open Backstage"
|
|
24
|
-
* @select="onFileCommand"
|
|
25
|
-
* @open-backstage="showBackstage = true"
|
|
26
|
-
* />
|
|
27
|
-
* ```
|
|
28
|
-
*/
|
|
29
|
-
defineProps<{
|
|
30
|
-
items: { id: string; label: string; disabled?: boolean }[]
|
|
31
|
-
label?: string
|
|
32
|
-
openBackstageLabel?: string
|
|
33
|
-
}>()
|
|
34
|
-
const emit = defineEmits<{ (e: 'select', id: string): void; (e: 'open-backstage'): void }>()
|
|
35
|
-
const opened = ref(false)
|
|
36
|
-
const globalSize = useGlobalConfig('size', '')
|
|
37
|
-
const resolvedSize = computed(() => globalSize.value || 'default')
|
|
38
|
-
const popperClass = computed(() => `ml-ribbon-file-menu-dropdown ml-ribbon-popper ml-ribbon-popper--size-${resolvedSize.value}`)
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Tracks dropdown visibility to style the File tab active state.
|
|
42
|
-
* @param value Current dropdown open state.
|
|
43
|
-
*/
|
|
44
|
-
function onVisibleChange(value: boolean) {
|
|
45
|
-
opened.value = value
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Routes dropdown command either to backstage action or standard file command.
|
|
50
|
-
* @param value Dropdown command id.
|
|
51
|
-
*/
|
|
52
|
-
function onCommand(value: string) {
|
|
53
|
-
if (value === '__backstage') {
|
|
54
|
-
emit('open-backstage')
|
|
55
|
-
return
|
|
56
|
-
}
|
|
57
|
-
emit('select', value)
|
|
58
|
-
}
|
|
59
|
-
</script>
|
|
60
|
-
|
|
61
|
-
<template>
|
|
62
|
-
<ElDropdown
|
|
63
|
-
trigger="click"
|
|
64
|
-
:popper-class="popperClass"
|
|
65
|
-
@command="onCommand"
|
|
66
|
-
@visible-change="onVisibleChange"
|
|
67
|
-
>
|
|
68
|
-
<button type="button" class="ml-ribbon-tab ml-ribbon-tab--file" :class="{ 'is-active': opened }">
|
|
69
|
-
{{ label }}
|
|
70
|
-
</button>
|
|
71
|
-
<template #dropdown>
|
|
72
|
-
<ElDropdownMenu>
|
|
73
|
-
<ElDropdownItem command="__backstage">{{ openBackstageLabel }}</ElDropdownItem>
|
|
74
|
-
<ElDropdownItem
|
|
75
|
-
v-for="(item, index) in items"
|
|
76
|
-
:key="item.id"
|
|
77
|
-
:divided="index === 0"
|
|
78
|
-
:command="item.id"
|
|
79
|
-
:disabled="item.disabled"
|
|
80
|
-
>
|
|
81
|
-
{{ item.label }}
|
|
82
|
-
</ElDropdownItem>
|
|
83
|
-
</ElDropdownMenu>
|
|
84
|
-
</template>
|
|
85
|
-
</ElDropdown>
|
|
86
|
-
</template>
|
|
87
|
-
|
|
88
|
-
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { computed, onMounted, onUnmounted, ref, watch } from 'vue'
|
|
3
|
-
import type { KeyTipModel } from '../types'
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* @component MlRibbonKeyTips
|
|
7
|
-
* @description
|
|
8
|
-
* Keyboard hint overlay that displays available key tips and supports incremental
|
|
9
|
-
* key-sequence input while the overlay is open.
|
|
10
|
-
*
|
|
11
|
-
* @prop open - Controls key tips overlay visibility.
|
|
12
|
-
* @prop tips - Registered key tip models for the current ribbon scope.
|
|
13
|
-
* @prop sequencePrefix - Optional prefix label rendered before current sequence.
|
|
14
|
-
* @prop emptySequenceText - Placeholder text when no key sequence is entered.
|
|
15
|
-
*
|
|
16
|
-
* @example
|
|
17
|
-
* ```vue
|
|
18
|
-
* <MlRibbonKeyTips
|
|
19
|
-
* :open="keyTipsOpen"
|
|
20
|
-
* :tips="registeredTips"
|
|
21
|
-
* sequence-prefix="Key sequence: "
|
|
22
|
-
* empty-sequence-text="(none)"
|
|
23
|
-
* />
|
|
24
|
-
* ```
|
|
25
|
-
*/
|
|
26
|
-
const props = withDefaults(
|
|
27
|
-
defineProps<{
|
|
28
|
-
open: boolean
|
|
29
|
-
tips: KeyTipModel[]
|
|
30
|
-
sequencePrefix?: string
|
|
31
|
-
emptySequenceText?: string
|
|
32
|
-
}>(),
|
|
33
|
-
{ tips: () => [] },
|
|
34
|
-
)
|
|
35
|
-
const emit = defineEmits<{
|
|
36
|
-
(e: 'activate', tip: KeyTipModel): void
|
|
37
|
-
(e: 'close'): void
|
|
38
|
-
}>()
|
|
39
|
-
|
|
40
|
-
const input = ref('')
|
|
41
|
-
const matched = computed(() => {
|
|
42
|
-
if (!input.value) return props.tips
|
|
43
|
-
return props.tips.filter((tip) => tip.key.toLowerCase().startsWith(input.value.toLowerCase()))
|
|
44
|
-
})
|
|
45
|
-
const displaySequence = computed(() => input.value || props.emptySequenceText || '')
|
|
46
|
-
const hintText = computed(() => {
|
|
47
|
-
if (!props.sequencePrefix) return displaySequence.value
|
|
48
|
-
return `${props.sequencePrefix}${displaySequence.value}`
|
|
49
|
-
})
|
|
50
|
-
const normalizedInput = computed(() => input.value.toLowerCase())
|
|
51
|
-
const exactMatches = computed(() =>
|
|
52
|
-
props.tips.filter((tip) => tip.key.toLowerCase() === normalizedInput.value),
|
|
53
|
-
)
|
|
54
|
-
const hasPrefixMatches = computed(() =>
|
|
55
|
-
props.tips.some((tip) => tip.key.toLowerCase().startsWith(normalizedInput.value)),
|
|
56
|
-
)
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Resets currently entered key-tip input sequence.
|
|
60
|
-
*/
|
|
61
|
-
function resetInput() {
|
|
62
|
-
input.value = ''
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Handles incremental key-tip sequence input while overlay is open.
|
|
67
|
-
* @param event Keyboard event from window listener.
|
|
68
|
-
*/
|
|
69
|
-
function onKeydown(event: KeyboardEvent) {
|
|
70
|
-
if (!props.open) return
|
|
71
|
-
if (event.altKey || event.ctrlKey || event.metaKey) return
|
|
72
|
-
if (event.key === 'Escape') {
|
|
73
|
-
event.preventDefault()
|
|
74
|
-
resetInput()
|
|
75
|
-
emit('close')
|
|
76
|
-
return
|
|
77
|
-
}
|
|
78
|
-
if (event.key === 'Backspace') {
|
|
79
|
-
event.preventDefault()
|
|
80
|
-
input.value = input.value.slice(0, -1)
|
|
81
|
-
return
|
|
82
|
-
}
|
|
83
|
-
if (/^[a-z0-9]$/i.test(event.key)) {
|
|
84
|
-
event.preventDefault()
|
|
85
|
-
input.value += event.key.toUpperCase()
|
|
86
|
-
if (exactMatches.value.length > 0) {
|
|
87
|
-
emit('activate', exactMatches.value[0])
|
|
88
|
-
resetInput()
|
|
89
|
-
return
|
|
90
|
-
}
|
|
91
|
-
if (!hasPrefixMatches.value) {
|
|
92
|
-
resetInput()
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
onMounted(() => window.addEventListener('keydown', onKeydown))
|
|
98
|
-
onUnmounted(() => window.removeEventListener('keydown', onKeydown))
|
|
99
|
-
watch(
|
|
100
|
-
() => props.open,
|
|
101
|
-
(open) => {
|
|
102
|
-
if (!open) resetInput()
|
|
103
|
-
},
|
|
104
|
-
)
|
|
105
|
-
</script>
|
|
106
|
-
|
|
107
|
-
<template>
|
|
108
|
-
<div v-if="open" class="ml-ribbon-keytips" aria-live="polite">
|
|
109
|
-
<div class="ml-ribbon-keytips__hint">{{ hintText }}</div>
|
|
110
|
-
<span v-for="tip in matched" :key="tip.id" class="ml-ribbon-keytip">{{ tip.key }}</span>
|
|
111
|
-
</div>
|
|
112
|
-
</template>
|
|
113
|
-
|
|
114
|
-
|