@mlightcad/ui-components 0.0.8 → 0.0.10
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 +21 -3
- package/dist/ui-components.es.js +416 -318
- package/dist/ui-components.umd.js +2 -2
- package/lib/index.d.ts +2 -1
- package/lib/index.js +3 -1
- package/package.json +1 -1
- package/src/components/MlCollapse.vue +11 -5
- package/src/components/MlStatusBar.vue +43 -0
- package/src/components/MlToolPalette.vue +41 -30
- package/src/{composable → composables}/types.ts +10 -0
- package/src/composables/useAutoOpen.ts +77 -0
- package/src/composables/useBoundingRect.ts +161 -0
- package/src/composables/useDrag.ts +176 -0
- package/src/{composable → composables}/useDragEx.ts +16 -6
- package/src/{composable → composables}/useInitialRect.ts +13 -13
- package/src/composables/useLastPosAndSize.ts +43 -0
- package/src/composables/useLeftPosAndWidth.ts +47 -0
- package/src/{composable → composables}/useResize.ts +36 -28
- package/src/{composable → composables}/useTransition.ts +31 -24
- package/src/index.ts +10 -1
- package/lib/MlDropdown.vue.d.ts +0 -59
- package/lib/MlDropdown.vue.js +0 -106
- package/lib/MlLanguage.vue.d.ts +0 -29
- package/lib/MlLanguage.vue.js +0 -67
- package/lib/MlToolPalette.vue.d.ts +0 -2
- package/lib/MlToolPalette.vue.js +0 -149
- package/lib/MlToolbar.vue.d.ts +0 -74
- package/lib/MlToolbar.vue.js +0 -129
- package/src/composable/useBoundingRect.ts +0 -87
- package/src/composable/useDrag.ts +0 -157
- package/src/composable/useRect.ts +0 -23
- /package/src/{composable → composables}/useWindowSize.ts +0 -0
- /package/src/{svg → svgs}/arrow-left.svg +0 -0
- /package/src/{svg → svgs}/arrow-right.svg +0 -0
- /package/src/{svg → svgs}/svg.d.ts +0 -0
package/lib/MlDropdown.vue.js
DELETED
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import { computed } from 'vue';
|
|
2
|
-
let __VLS_typeProps;
|
|
3
|
-
const props = withDefaults(defineProps(), {
|
|
4
|
-
current: undefined
|
|
5
|
-
});
|
|
6
|
-
const emit = defineEmits({
|
|
7
|
-
click: null
|
|
8
|
-
});
|
|
9
|
-
// Filter out the current item
|
|
10
|
-
const filteredItems = computed(() => {
|
|
11
|
-
return props.items.filter(item => item.name !== props.current);
|
|
12
|
-
});
|
|
13
|
-
const handleCommand = (command) => {
|
|
14
|
-
emit('click', command);
|
|
15
|
-
};
|
|
16
|
-
const __VLS_withDefaultsArg = (function (t) { return t; })({
|
|
17
|
-
current: undefined
|
|
18
|
-
});
|
|
19
|
-
const __VLS_fnComponent = (await import('vue')).defineComponent({
|
|
20
|
-
emits: {},
|
|
21
|
-
});
|
|
22
|
-
;
|
|
23
|
-
let __VLS_functionalComponentProps;
|
|
24
|
-
const __VLS_ctxBase = {};
|
|
25
|
-
const __VLS_ctx = __VLS_ctxBase;
|
|
26
|
-
let __VLS_name;
|
|
27
|
-
const __VLS_localComponents = {
|
|
28
|
-
...{},
|
|
29
|
-
...{},
|
|
30
|
-
...__VLS_ctxBase,
|
|
31
|
-
};
|
|
32
|
-
let __VLS_components;
|
|
33
|
-
let __VLS_styleScopedClasses;
|
|
34
|
-
__VLS_styleScopedClasses['ml-dropdown-icon'];
|
|
35
|
-
// CSS variable injection
|
|
36
|
-
// CSS variable injection end
|
|
37
|
-
let __VLS_resolvedLocalAndGlobalComponents;
|
|
38
|
-
const __VLS_0 = __VLS_resolvedLocalAndGlobalComponents.ElDropdown;
|
|
39
|
-
/** @type { [typeof __VLS_components.ElDropdown, typeof __VLS_components.elDropdown, typeof __VLS_components.ElDropdown, typeof __VLS_components.elDropdown, ] } */
|
|
40
|
-
// @ts-ignore
|
|
41
|
-
const __VLS_1 = __VLS_asFunctionalComponent(__VLS_0, new __VLS_0({ ...{ 'onCommand': {} }, }));
|
|
42
|
-
const __VLS_2 = __VLS_1({ ...{ 'onCommand': {} }, }, ...__VLS_functionalComponentArgsRest(__VLS_1));
|
|
43
|
-
let __VLS_6;
|
|
44
|
-
const __VLS_7 = {
|
|
45
|
-
onCommand: (__VLS_ctx.handleCommand)
|
|
46
|
-
};
|
|
47
|
-
let __VLS_3;
|
|
48
|
-
let __VLS_4;
|
|
49
|
-
const __VLS_8 = __VLS_resolvedLocalAndGlobalComponents.ElIcon;
|
|
50
|
-
/** @type { [typeof __VLS_components.ElIcon, typeof __VLS_components.elIcon, typeof __VLS_components.ElIcon, typeof __VLS_components.elIcon, ] } */
|
|
51
|
-
// @ts-ignore
|
|
52
|
-
const __VLS_9 = __VLS_asFunctionalComponent(__VLS_8, new __VLS_8({ size: ("30"), ...{ class: ("ml-dropdown-icon") }, }));
|
|
53
|
-
const __VLS_10 = __VLS_9({ size: ("30"), ...{ class: ("ml-dropdown-icon") }, }, ...__VLS_functionalComponentArgsRest(__VLS_9));
|
|
54
|
-
__VLS_elementAsFunction(__VLS_intrinsicElements.svg, __VLS_intrinsicElements.svg)({ preserveAspectRatio: ("xMidYMid meet"), viewBox: ("0 0 24 24"), width: ("1.2em"), height: ("1.2em"), "data-v-63d067da": (""), });
|
|
55
|
-
__VLS_elementAsFunction(__VLS_intrinsicElements.path, __VLS_intrinsicElements.path)({ fill: ("currentColor"), d: ("m18.5 10l4.4 11h-2.155l-1.201-3h-4.09l-1.199 3h-2.154L16.5 10h2zM10 2v2h6v2h-1.968a18.222 18.222 0 0 1-3.62 6.301a14.864 14.864 0 0 0 2.336 1.707l-.751 1.878A17.015 17.015 0 0 1 9 13.725a16.676 16.676 0 0 1-6.201 3.548l-.536-1.929a14.7 14.7 0 0 0 5.327-3.042A18.078 18.078 0 0 1 4.767 8h2.24A16.032 16.032 0 0 0 9 10.877a16.165 16.165 0 0 0 2.91-4.876L2 6V4h6V2h2zm7.5 10.885L16.253 16h2.492L17.5 12.885z"), });
|
|
56
|
-
__VLS_nonNullable(__VLS_13.slots).default;
|
|
57
|
-
const __VLS_13 = __VLS_pickFunctionalComponentCtx(__VLS_8, __VLS_10);
|
|
58
|
-
__VLS_elementAsFunction(__VLS_intrinsicElements.template, __VLS_intrinsicElements.template)({});
|
|
59
|
-
{
|
|
60
|
-
const { dropdown: __VLS_thisSlot } = __VLS_nonNullable(__VLS_5.slots);
|
|
61
|
-
const __VLS_14 = __VLS_resolvedLocalAndGlobalComponents.ElDropdownMenu;
|
|
62
|
-
/** @type { [typeof __VLS_components.ElDropdownMenu, typeof __VLS_components.elDropdownMenu, typeof __VLS_components.ElDropdownMenu, typeof __VLS_components.elDropdownMenu, ] } */
|
|
63
|
-
// @ts-ignore
|
|
64
|
-
const __VLS_15 = __VLS_asFunctionalComponent(__VLS_14, new __VLS_14({}));
|
|
65
|
-
const __VLS_16 = __VLS_15({}, ...__VLS_functionalComponentArgsRest(__VLS_15));
|
|
66
|
-
for (const [item] of __VLS_getVForSourceType((__VLS_ctx.filteredItems))) {
|
|
67
|
-
const __VLS_20 = __VLS_resolvedLocalAndGlobalComponents.ElDropdownItem;
|
|
68
|
-
/** @type { [typeof __VLS_components.ElDropdownItem, typeof __VLS_components.elDropdownItem, typeof __VLS_components.ElDropdownItem, typeof __VLS_components.elDropdownItem, ] } */
|
|
69
|
-
// @ts-ignore
|
|
70
|
-
const __VLS_21 = __VLS_asFunctionalComponent(__VLS_20, new __VLS_20({ key: ((item.text)), command: ((item.name)), }));
|
|
71
|
-
const __VLS_22 = __VLS_21({ key: ((item.text)), command: ((item.name)), }, ...__VLS_functionalComponentArgsRest(__VLS_21));
|
|
72
|
-
(item.text);
|
|
73
|
-
__VLS_nonNullable(__VLS_25.slots).default;
|
|
74
|
-
const __VLS_25 = __VLS_pickFunctionalComponentCtx(__VLS_20, __VLS_22);
|
|
75
|
-
}
|
|
76
|
-
__VLS_nonNullable(__VLS_19.slots).default;
|
|
77
|
-
const __VLS_19 = __VLS_pickFunctionalComponentCtx(__VLS_14, __VLS_16);
|
|
78
|
-
}
|
|
79
|
-
const __VLS_5 = __VLS_pickFunctionalComponentCtx(__VLS_0, __VLS_2);
|
|
80
|
-
__VLS_styleScopedClasses['ml-dropdown-icon'];
|
|
81
|
-
var __VLS_slots;
|
|
82
|
-
var __VLS_inheritedAttrs;
|
|
83
|
-
const __VLS_refs = {};
|
|
84
|
-
const __VLS_templateResult = { slots: __VLS_slots,
|
|
85
|
-
refs: $refs,
|
|
86
|
-
attrs: {},
|
|
87
|
-
};
|
|
88
|
-
const __VLS_internalComponent = (await import('vue')).defineComponent({
|
|
89
|
-
setup() {
|
|
90
|
-
return {
|
|
91
|
-
filteredItems: filteredItems,
|
|
92
|
-
handleCommand: handleCommand,
|
|
93
|
-
};
|
|
94
|
-
},
|
|
95
|
-
emits: {},
|
|
96
|
-
props: {},
|
|
97
|
-
});
|
|
98
|
-
export default (await import('vue')).defineComponent({
|
|
99
|
-
setup() {
|
|
100
|
-
return {};
|
|
101
|
-
},
|
|
102
|
-
emits: {},
|
|
103
|
-
props: {},
|
|
104
|
-
});
|
|
105
|
-
;
|
|
106
|
-
//# sourceMappingURL=MlDropdown.vue.js.map
|
package/lib/MlLanguage.vue.d.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { MlDropdownMenuItem } from './MlDropdown.vue';
|
|
2
|
-
/**
|
|
3
|
-
* Properties of MlLanguage component
|
|
4
|
-
*/
|
|
5
|
-
interface Props {
|
|
6
|
-
/**
|
|
7
|
-
* An array of avaiable languages
|
|
8
|
-
*/
|
|
9
|
-
languages: MlDropdownMenuItem[];
|
|
10
|
-
/**
|
|
11
|
-
* Key of the current language
|
|
12
|
-
*/
|
|
13
|
-
current: string;
|
|
14
|
-
}
|
|
15
|
-
declare const _default: import("vue").DefineComponent<__VLS_TypePropsToOption<Props>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
16
|
-
click: (...args: any[]) => void;
|
|
17
|
-
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<Props>>> & {
|
|
18
|
-
onClick?: ((...args: any[]) => any) | undefined;
|
|
19
|
-
}, {}, {}>;
|
|
20
|
-
export default _default;
|
|
21
|
-
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
22
|
-
type __VLS_TypePropsToOption<T> = {
|
|
23
|
-
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
24
|
-
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
25
|
-
} : {
|
|
26
|
-
type: import('vue').PropType<T[K]>;
|
|
27
|
-
required: true;
|
|
28
|
-
};
|
|
29
|
-
};
|
package/lib/MlLanguage.vue.js
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import MlDropdown from './MlDropdown.vue';
|
|
2
|
-
const svg = '<svg preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24" width="1.2em" height="1.2em" data-v-63d067da=""><path fill="currentColor" d="m18.5 10l4.4 11h-2.155l-1.201-3h-4.09l-1.199 3h-2.154L16.5 10h2zM10 2v2h6v2h-1.968a18.222 18.222 0 0 1-3.62 6.301a14.864 14.864 0 0 0 2.336 1.707l-.751 1.878A17.015 17.015 0 0 1 9 13.725a16.676 16.676 0 0 1-6.201 3.548l-.536-1.929a14.7 14.7 0 0 0 5.327-3.042A18.078 18.078 0 0 1 4.767 8h2.24A16.032 16.032 0 0 0 9 10.877a16.165 16.165 0 0 0 2.91-4.876L2 6V4h6V2h2zm7.5 10.885L16.253 16h2.492L17.5 12.885z"></path></svg>';
|
|
3
|
-
let __VLS_typeProps;
|
|
4
|
-
const props = defineProps();
|
|
5
|
-
const emit = defineEmits({
|
|
6
|
-
click: null
|
|
7
|
-
});
|
|
8
|
-
const handleClick = (command) => {
|
|
9
|
-
emit('click', command);
|
|
10
|
-
};
|
|
11
|
-
const __VLS_fnComponent = (await import('vue')).defineComponent({
|
|
12
|
-
emits: {},
|
|
13
|
-
});
|
|
14
|
-
;
|
|
15
|
-
let __VLS_functionalComponentProps;
|
|
16
|
-
const __VLS_ctxBase = {};
|
|
17
|
-
const __VLS_ctx = __VLS_ctxBase;
|
|
18
|
-
let __VLS_name;
|
|
19
|
-
const __VLS_localComponents = {
|
|
20
|
-
...{},
|
|
21
|
-
...{},
|
|
22
|
-
...__VLS_ctxBase,
|
|
23
|
-
};
|
|
24
|
-
let __VLS_components;
|
|
25
|
-
let __VLS_styleScopedClasses;
|
|
26
|
-
// CSS variable injection
|
|
27
|
-
// CSS variable injection end
|
|
28
|
-
let __VLS_resolvedLocalAndGlobalComponents;
|
|
29
|
-
// @ts-ignore
|
|
30
|
-
[MlDropdown,];
|
|
31
|
-
// @ts-ignore
|
|
32
|
-
const __VLS_0 = __VLS_asFunctionalComponent(MlDropdown, new MlDropdown({ ...{ 'onClick': {} }, icon: ((__VLS_ctx.svg)), items: ((props.languages)), current: ((props.current)), }));
|
|
33
|
-
const __VLS_1 = __VLS_0({ ...{ 'onClick': {} }, icon: ((__VLS_ctx.svg)), items: ((props.languages)), current: ((props.current)), }, ...__VLS_functionalComponentArgsRest(__VLS_0));
|
|
34
|
-
let __VLS_5;
|
|
35
|
-
const __VLS_6 = {
|
|
36
|
-
onClick: (__VLS_ctx.handleClick)
|
|
37
|
-
};
|
|
38
|
-
let __VLS_2;
|
|
39
|
-
let __VLS_3;
|
|
40
|
-
const __VLS_4 = __VLS_pickFunctionalComponentCtx(MlDropdown, __VLS_1);
|
|
41
|
-
var __VLS_slots;
|
|
42
|
-
var __VLS_inheritedAttrs;
|
|
43
|
-
const __VLS_refs = {};
|
|
44
|
-
const __VLS_templateResult = { slots: __VLS_slots,
|
|
45
|
-
refs: $refs,
|
|
46
|
-
attrs: {},
|
|
47
|
-
};
|
|
48
|
-
const __VLS_internalComponent = (await import('vue')).defineComponent({
|
|
49
|
-
setup() {
|
|
50
|
-
return {
|
|
51
|
-
MlDropdown: MlDropdown,
|
|
52
|
-
svg: svg,
|
|
53
|
-
handleClick: handleClick,
|
|
54
|
-
};
|
|
55
|
-
},
|
|
56
|
-
emits: {},
|
|
57
|
-
props: {},
|
|
58
|
-
});
|
|
59
|
-
export default (await import('vue')).defineComponent({
|
|
60
|
-
setup() {
|
|
61
|
-
return {};
|
|
62
|
-
},
|
|
63
|
-
emits: {},
|
|
64
|
-
props: {},
|
|
65
|
-
});
|
|
66
|
-
;
|
|
67
|
-
//# sourceMappingURL=MlLanguage.vue.js.map
|
package/lib/MlToolPalette.vue.js
DELETED
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
import { computed, ref } from 'vue';
|
|
2
|
-
// States for dialog visibility, collapse, and dock direction
|
|
3
|
-
const dialogVisible = ref(true);
|
|
4
|
-
const isCollapsed = ref(false);
|
|
5
|
-
const dockDirection = ref('left');
|
|
6
|
-
// Styles for collapsed and expanded dialog
|
|
7
|
-
const dialogStyle = computed(() => {
|
|
8
|
-
const collapsedWidth = '50px'; // Width of the dialog when collapsed
|
|
9
|
-
const expandedWidth = '300px'; // Width of the dialog when expanded
|
|
10
|
-
// Adjust position and transition for collapsing/expanding
|
|
11
|
-
return isCollapsed.value
|
|
12
|
-
? {
|
|
13
|
-
width: collapsedWidth,
|
|
14
|
-
height: '100%',
|
|
15
|
-
transition: 'width 0.3s',
|
|
16
|
-
[dockDirection.value]: '0',
|
|
17
|
-
}
|
|
18
|
-
: {
|
|
19
|
-
width: expandedWidth,
|
|
20
|
-
height: '100%',
|
|
21
|
-
transition: 'width 0.3s',
|
|
22
|
-
[dockDirection.value]: '0',
|
|
23
|
-
};
|
|
24
|
-
});
|
|
25
|
-
// Methods for folding and unfolding the dialog
|
|
26
|
-
const fold = (direction) => {
|
|
27
|
-
dockDirection.value = direction;
|
|
28
|
-
isCollapsed.value = true;
|
|
29
|
-
};
|
|
30
|
-
const unfold = () => {
|
|
31
|
-
isCollapsed.value = false;
|
|
32
|
-
};
|
|
33
|
-
const __VLS_fnComponent = (await import('vue')).defineComponent({});
|
|
34
|
-
;
|
|
35
|
-
let __VLS_functionalComponentProps;
|
|
36
|
-
const __VLS_ctxBase = {};
|
|
37
|
-
const __VLS_ctx = __VLS_ctxBase;
|
|
38
|
-
let __VLS_name;
|
|
39
|
-
const __VLS_localComponents = {
|
|
40
|
-
...{},
|
|
41
|
-
...{},
|
|
42
|
-
...__VLS_ctxBase,
|
|
43
|
-
};
|
|
44
|
-
let __VLS_components;
|
|
45
|
-
let __VLS_styleScopedClasses;
|
|
46
|
-
// CSS variable injection
|
|
47
|
-
// CSS variable injection end
|
|
48
|
-
let __VLS_resolvedLocalAndGlobalComponents;
|
|
49
|
-
__VLS_elementAsFunction(__VLS_intrinsicElements.div, __VLS_intrinsicElements.div)({ ...{ class: ("parent-container") }, });
|
|
50
|
-
const __VLS_0 = __VLS_resolvedLocalAndGlobalComponents.ElDialog;
|
|
51
|
-
/** @type { [typeof __VLS_components.ElDialog, typeof __VLS_components.elDialog, typeof __VLS_components.ElDialog, typeof __VLS_components.elDialog, ] } */
|
|
52
|
-
// @ts-ignore
|
|
53
|
-
const __VLS_1 = __VLS_asFunctionalComponent(__VLS_0, new __VLS_0({ modelValue: ((__VLS_ctx.dialogVisible)), ...{ style: ((__VLS_ctx.dialogStyle)) }, ...{ class: ("foldable-dialog") }, draggable: ((true)), modal: ((false)), appendToBody: (true), }));
|
|
54
|
-
const __VLS_2 = __VLS_1({ modelValue: ((__VLS_ctx.dialogVisible)), ...{ style: ((__VLS_ctx.dialogStyle)) }, ...{ class: ("foldable-dialog") }, draggable: ((true)), modal: ((false)), appendToBody: (true), }, ...__VLS_functionalComponentArgsRest(__VLS_1));
|
|
55
|
-
__VLS_elementAsFunction(__VLS_intrinsicElements.template, __VLS_intrinsicElements.template)({});
|
|
56
|
-
{
|
|
57
|
-
const { title: __VLS_thisSlot } = __VLS_nonNullable(__VLS_5.slots);
|
|
58
|
-
__VLS_elementAsFunction(__VLS_intrinsicElements.div, __VLS_intrinsicElements.div)({ ...{ class: ((['dialog-header', __VLS_ctx.isCollapsed ? 'collapsed-title' : ''])) }, });
|
|
59
|
-
if (!__VLS_ctx.isCollapsed) {
|
|
60
|
-
__VLS_elementAsFunction(__VLS_intrinsicElements.span, __VLS_intrinsicElements.span)({});
|
|
61
|
-
}
|
|
62
|
-
if (!__VLS_ctx.isCollapsed) {
|
|
63
|
-
const __VLS_6 = __VLS_resolvedLocalAndGlobalComponents.ElButton;
|
|
64
|
-
/** @type { [typeof __VLS_components.ElButton, typeof __VLS_components.elButton, typeof __VLS_components.ElButton, typeof __VLS_components.elButton, ] } */
|
|
65
|
-
// @ts-ignore
|
|
66
|
-
const __VLS_7 = __VLS_asFunctionalComponent(__VLS_6, new __VLS_6({ ...{ 'onClick': {} }, size: ("mini"), }));
|
|
67
|
-
const __VLS_8 = __VLS_7({ ...{ 'onClick': {} }, size: ("mini"), }, ...__VLS_functionalComponentArgsRest(__VLS_7));
|
|
68
|
-
let __VLS_12;
|
|
69
|
-
const __VLS_13 = {
|
|
70
|
-
onClick: (...[$event]) => {
|
|
71
|
-
if (!((!__VLS_ctx.isCollapsed)))
|
|
72
|
-
return;
|
|
73
|
-
__VLS_ctx.fold('left');
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
let __VLS_9;
|
|
77
|
-
let __VLS_10;
|
|
78
|
-
__VLS_nonNullable(__VLS_11.slots).default;
|
|
79
|
-
const __VLS_11 = __VLS_pickFunctionalComponentCtx(__VLS_6, __VLS_8);
|
|
80
|
-
}
|
|
81
|
-
if (!__VLS_ctx.isCollapsed) {
|
|
82
|
-
const __VLS_14 = __VLS_resolvedLocalAndGlobalComponents.ElButton;
|
|
83
|
-
/** @type { [typeof __VLS_components.ElButton, typeof __VLS_components.elButton, typeof __VLS_components.ElButton, typeof __VLS_components.elButton, ] } */
|
|
84
|
-
// @ts-ignore
|
|
85
|
-
const __VLS_15 = __VLS_asFunctionalComponent(__VLS_14, new __VLS_14({ ...{ 'onClick': {} }, size: ("mini"), }));
|
|
86
|
-
const __VLS_16 = __VLS_15({ ...{ 'onClick': {} }, size: ("mini"), }, ...__VLS_functionalComponentArgsRest(__VLS_15));
|
|
87
|
-
let __VLS_20;
|
|
88
|
-
const __VLS_21 = {
|
|
89
|
-
onClick: (...[$event]) => {
|
|
90
|
-
if (!((!__VLS_ctx.isCollapsed)))
|
|
91
|
-
return;
|
|
92
|
-
__VLS_ctx.fold('right');
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
let __VLS_17;
|
|
96
|
-
let __VLS_18;
|
|
97
|
-
__VLS_nonNullable(__VLS_19.slots).default;
|
|
98
|
-
const __VLS_19 = __VLS_pickFunctionalComponentCtx(__VLS_14, __VLS_16);
|
|
99
|
-
}
|
|
100
|
-
else {
|
|
101
|
-
const __VLS_22 = __VLS_resolvedLocalAndGlobalComponents.ElButton;
|
|
102
|
-
/** @type { [typeof __VLS_components.ElButton, typeof __VLS_components.elButton, typeof __VLS_components.ElButton, typeof __VLS_components.elButton, ] } */
|
|
103
|
-
// @ts-ignore
|
|
104
|
-
const __VLS_23 = __VLS_asFunctionalComponent(__VLS_22, new __VLS_22({ ...{ 'onClick': {} }, size: ("mini"), ...{ class: ("unfold-button") }, }));
|
|
105
|
-
const __VLS_24 = __VLS_23({ ...{ 'onClick': {} }, size: ("mini"), ...{ class: ("unfold-button") }, }, ...__VLS_functionalComponentArgsRest(__VLS_23));
|
|
106
|
-
let __VLS_28;
|
|
107
|
-
const __VLS_29 = {
|
|
108
|
-
onClick: (__VLS_ctx.unfold)
|
|
109
|
-
};
|
|
110
|
-
let __VLS_25;
|
|
111
|
-
let __VLS_26;
|
|
112
|
-
__VLS_nonNullable(__VLS_27.slots).default;
|
|
113
|
-
const __VLS_27 = __VLS_pickFunctionalComponentCtx(__VLS_22, __VLS_24);
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
if (!__VLS_ctx.isCollapsed) {
|
|
117
|
-
__VLS_elementAsFunction(__VLS_intrinsicElements.div, __VLS_intrinsicElements.div)({ ...{ class: ("dialog-content") }, });
|
|
118
|
-
}
|
|
119
|
-
const __VLS_5 = __VLS_pickFunctionalComponentCtx(__VLS_0, __VLS_2);
|
|
120
|
-
__VLS_styleScopedClasses['parent-container'];
|
|
121
|
-
__VLS_styleScopedClasses['foldable-dialog'];
|
|
122
|
-
__VLS_styleScopedClasses['dialog-header'];
|
|
123
|
-
__VLS_styleScopedClasses['unfold-button'];
|
|
124
|
-
__VLS_styleScopedClasses['dialog-content'];
|
|
125
|
-
var __VLS_slots;
|
|
126
|
-
var __VLS_inheritedAttrs;
|
|
127
|
-
const __VLS_refs = {};
|
|
128
|
-
const __VLS_templateResult = { slots: __VLS_slots,
|
|
129
|
-
refs: $refs,
|
|
130
|
-
attrs: {},
|
|
131
|
-
};
|
|
132
|
-
const __VLS_internalComponent = (await import('vue')).defineComponent({
|
|
133
|
-
setup() {
|
|
134
|
-
return {
|
|
135
|
-
dialogVisible: dialogVisible,
|
|
136
|
-
isCollapsed: isCollapsed,
|
|
137
|
-
dialogStyle: dialogStyle,
|
|
138
|
-
fold: fold,
|
|
139
|
-
unfold: unfold,
|
|
140
|
-
};
|
|
141
|
-
},
|
|
142
|
-
});
|
|
143
|
-
export default (await import('vue')).defineComponent({
|
|
144
|
-
setup() {
|
|
145
|
-
return {};
|
|
146
|
-
},
|
|
147
|
-
});
|
|
148
|
-
;
|
|
149
|
-
//# sourceMappingURL=MlToolPalette.vue.js.map
|
package/lib/MlToolbar.vue.d.ts
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Data to descibe button appearance
|
|
3
|
-
*/
|
|
4
|
-
export interface MlButtonData {
|
|
5
|
-
/**
|
|
6
|
-
* Icon represented by one SVG string
|
|
7
|
-
*/
|
|
8
|
-
icon: string;
|
|
9
|
-
/**
|
|
10
|
-
* Text shown below icon
|
|
11
|
-
*/
|
|
12
|
-
text: string;
|
|
13
|
-
/**
|
|
14
|
-
* Command string which will be passed to click event as event arguments
|
|
15
|
-
*/
|
|
16
|
-
command: string;
|
|
17
|
-
/**
|
|
18
|
-
* Tooltips content when hover
|
|
19
|
-
*/
|
|
20
|
-
description?: string;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Properties of MlToolbar component
|
|
24
|
-
*/
|
|
25
|
-
interface Props {
|
|
26
|
-
/**
|
|
27
|
-
* An array of button data
|
|
28
|
-
*/
|
|
29
|
-
items: MlButtonData[];
|
|
30
|
-
/**
|
|
31
|
-
* Button size.
|
|
32
|
-
* - small: 30px
|
|
33
|
-
* - medium: 50px
|
|
34
|
-
* - large: 70px
|
|
35
|
-
*/
|
|
36
|
-
size?: 'small' | 'medium' | 'large';
|
|
37
|
-
/**
|
|
38
|
-
* Layout type.
|
|
39
|
-
* - vertical: arrange button vertically
|
|
40
|
-
* - horizontal: arrange button horizontally
|
|
41
|
-
*/
|
|
42
|
-
direction?: 'vertical' | 'horizontal';
|
|
43
|
-
}
|
|
44
|
-
declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToOption<Props>, {
|
|
45
|
-
size: string;
|
|
46
|
-
layout: string;
|
|
47
|
-
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
48
|
-
click: (...args: any[]) => void;
|
|
49
|
-
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<Props>, {
|
|
50
|
-
size: string;
|
|
51
|
-
layout: string;
|
|
52
|
-
}>>> & {
|
|
53
|
-
onClick?: ((...args: any[]) => any) | undefined;
|
|
54
|
-
}, {
|
|
55
|
-
size: "small" | "medium" | "large";
|
|
56
|
-
}, {}>;
|
|
57
|
-
export default _default;
|
|
58
|
-
type __VLS_WithDefaults<P, D> = {
|
|
59
|
-
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_PrettifyLocal<P[K] & {
|
|
60
|
-
default: D[K];
|
|
61
|
-
}> : P[K];
|
|
62
|
-
};
|
|
63
|
-
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
64
|
-
type __VLS_TypePropsToOption<T> = {
|
|
65
|
-
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
66
|
-
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
67
|
-
} : {
|
|
68
|
-
type: import('vue').PropType<T[K]>;
|
|
69
|
-
required: true;
|
|
70
|
-
};
|
|
71
|
-
};
|
|
72
|
-
type __VLS_PrettifyLocal<T> = {
|
|
73
|
-
[K in keyof T]: T[K];
|
|
74
|
-
} & {};
|
package/lib/MlToolbar.vue.js
DELETED
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
import { computed } from 'vue';
|
|
2
|
-
let __VLS_typeProps;
|
|
3
|
-
const props = withDefaults(defineProps(), {
|
|
4
|
-
size: 'large',
|
|
5
|
-
layout: 'horizontal'
|
|
6
|
-
});
|
|
7
|
-
const emit = defineEmits({
|
|
8
|
-
click: null
|
|
9
|
-
});
|
|
10
|
-
const buttonGroupClass = computed(() => {
|
|
11
|
-
return props.direction === 'vertical' ? 'ml-vertical-toolbar-button-group' : 'ml-horizontal-toolbar-button-group';
|
|
12
|
-
});
|
|
13
|
-
const buttonIconSize = computed(() => {
|
|
14
|
-
return (props.size === 'small') ? 20 : 30;
|
|
15
|
-
});
|
|
16
|
-
const buttonSize = computed(() => {
|
|
17
|
-
switch (props.size) {
|
|
18
|
-
case 'small':
|
|
19
|
-
return 30;
|
|
20
|
-
case 'medium':
|
|
21
|
-
return 50;
|
|
22
|
-
}
|
|
23
|
-
return 70;
|
|
24
|
-
});
|
|
25
|
-
const buttonTooltip = (item) => {
|
|
26
|
-
return item.description ? item.description : item.text;
|
|
27
|
-
};
|
|
28
|
-
const isShowButtonText = computed(() => {
|
|
29
|
-
return (props.size === 'large');
|
|
30
|
-
});
|
|
31
|
-
const handleCommand = (command) => {
|
|
32
|
-
emit('click', command);
|
|
33
|
-
};
|
|
34
|
-
const __VLS_withDefaultsArg = (function (t) { return t; })({
|
|
35
|
-
size: 'large',
|
|
36
|
-
layout: 'horizontal'
|
|
37
|
-
});
|
|
38
|
-
const __VLS_fnComponent = (await import('vue')).defineComponent({
|
|
39
|
-
emits: {},
|
|
40
|
-
});
|
|
41
|
-
;
|
|
42
|
-
let __VLS_functionalComponentProps;
|
|
43
|
-
const __VLS_ctxBase = {};
|
|
44
|
-
const __VLS_ctx = __VLS_ctxBase;
|
|
45
|
-
let __VLS_name;
|
|
46
|
-
const __VLS_localComponents = {
|
|
47
|
-
...{},
|
|
48
|
-
...{},
|
|
49
|
-
...__VLS_ctxBase,
|
|
50
|
-
};
|
|
51
|
-
let __VLS_components;
|
|
52
|
-
let __VLS_styleScopedClasses;
|
|
53
|
-
// CSS variable injection
|
|
54
|
-
// CSS variable injection end
|
|
55
|
-
let __VLS_resolvedLocalAndGlobalComponents;
|
|
56
|
-
const __VLS_0 = __VLS_resolvedLocalAndGlobalComponents.ElButtonGroup;
|
|
57
|
-
/** @type { [typeof __VLS_components.ElButtonGroup, typeof __VLS_components.elButtonGroup, typeof __VLS_components.ElButtonGroup, typeof __VLS_components.elButtonGroup, ] } */
|
|
58
|
-
// @ts-ignore
|
|
59
|
-
const __VLS_1 = __VLS_asFunctionalComponent(__VLS_0, new __VLS_0({ ...{ class: ((__VLS_ctx.buttonGroupClass)) }, }));
|
|
60
|
-
const __VLS_2 = __VLS_1({ ...{ class: ((__VLS_ctx.buttonGroupClass)) }, }, ...__VLS_functionalComponentArgsRest(__VLS_1));
|
|
61
|
-
for (const [item, index] of __VLS_getVForSourceType((__VLS_ctx.items))) {
|
|
62
|
-
const __VLS_6 = __VLS_resolvedLocalAndGlobalComponents.ElTooltip;
|
|
63
|
-
/** @type { [typeof __VLS_components.ElTooltip, typeof __VLS_components.elTooltip, typeof __VLS_components.ElTooltip, typeof __VLS_components.elTooltip, ] } */
|
|
64
|
-
// @ts-ignore
|
|
65
|
-
const __VLS_7 = __VLS_asFunctionalComponent(__VLS_6, new __VLS_6({ key: ((item.text)), content: ((__VLS_ctx.buttonTooltip(item))), hideAfter: ((0)), }));
|
|
66
|
-
const __VLS_8 = __VLS_7({ key: ((item.text)), content: ((__VLS_ctx.buttonTooltip(item))), hideAfter: ((0)), }, ...__VLS_functionalComponentArgsRest(__VLS_7));
|
|
67
|
-
const __VLS_12 = __VLS_resolvedLocalAndGlobalComponents.ElButton;
|
|
68
|
-
/** @type { [typeof __VLS_components.ElButton, typeof __VLS_components.elButton, typeof __VLS_components.ElButton, typeof __VLS_components.elButton, ] } */
|
|
69
|
-
// @ts-ignore
|
|
70
|
-
const __VLS_13 = __VLS_asFunctionalComponent(__VLS_12, new __VLS_12({ ...{ 'onClick': {} }, ...{ class: ("ml-toolbar-button") }, ...{ style: (({ width: __VLS_ctx.buttonSize + 'px', height: __VLS_ctx.buttonSize + 'px' })) }, key: ((index)), }));
|
|
71
|
-
const __VLS_14 = __VLS_13({ ...{ 'onClick': {} }, ...{ class: ("ml-toolbar-button") }, ...{ style: (({ width: __VLS_ctx.buttonSize + 'px', height: __VLS_ctx.buttonSize + 'px' })) }, key: ((index)), }, ...__VLS_functionalComponentArgsRest(__VLS_13));
|
|
72
|
-
let __VLS_18;
|
|
73
|
-
const __VLS_19 = {
|
|
74
|
-
onClick: (...[$event]) => {
|
|
75
|
-
__VLS_ctx.handleCommand(item.command);
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
let __VLS_15;
|
|
79
|
-
let __VLS_16;
|
|
80
|
-
__VLS_elementAsFunction(__VLS_intrinsicElements.div, __VLS_intrinsicElements.div)({});
|
|
81
|
-
const __VLS_20 = __VLS_resolvedLocalAndGlobalComponents.ElIcon;
|
|
82
|
-
/** @type { [typeof __VLS_components.ElIcon, typeof __VLS_components.elIcon, ] } */
|
|
83
|
-
// @ts-ignore
|
|
84
|
-
const __VLS_21 = __VLS_asFunctionalComponent(__VLS_20, new __VLS_20({ size: ((__VLS_ctx.buttonIconSize)), }));
|
|
85
|
-
const __VLS_22 = __VLS_21({ size: ((__VLS_ctx.buttonIconSize)), }, ...__VLS_functionalComponentArgsRest(__VLS_21));
|
|
86
|
-
__VLS_directiveAsFunction(__VLS_ctx.vHtml)(null, { ...__VLS_directiveBindingRestFields, value: (item.icon) }, null, null);
|
|
87
|
-
if (__VLS_ctx.isShowButtonText) {
|
|
88
|
-
__VLS_elementAsFunction(__VLS_intrinsicElements.div, __VLS_intrinsicElements.div)({ ...{ class: ("ml-toolbar-button-text") }, });
|
|
89
|
-
(item.text);
|
|
90
|
-
}
|
|
91
|
-
__VLS_nonNullable(__VLS_17.slots).default;
|
|
92
|
-
const __VLS_17 = __VLS_pickFunctionalComponentCtx(__VLS_12, __VLS_14);
|
|
93
|
-
__VLS_nonNullable(__VLS_11.slots).default;
|
|
94
|
-
const __VLS_11 = __VLS_pickFunctionalComponentCtx(__VLS_6, __VLS_8);
|
|
95
|
-
}
|
|
96
|
-
__VLS_nonNullable(__VLS_5.slots).default;
|
|
97
|
-
const __VLS_5 = __VLS_pickFunctionalComponentCtx(__VLS_0, __VLS_2);
|
|
98
|
-
__VLS_styleScopedClasses['ml-toolbar-button'];
|
|
99
|
-
__VLS_styleScopedClasses['ml-toolbar-button-text'];
|
|
100
|
-
var __VLS_slots;
|
|
101
|
-
var __VLS_inheritedAttrs;
|
|
102
|
-
const __VLS_refs = {};
|
|
103
|
-
const __VLS_templateResult = { slots: __VLS_slots,
|
|
104
|
-
refs: $refs,
|
|
105
|
-
attrs: {},
|
|
106
|
-
};
|
|
107
|
-
const __VLS_internalComponent = (await import('vue')).defineComponent({
|
|
108
|
-
setup() {
|
|
109
|
-
return {
|
|
110
|
-
buttonGroupClass: buttonGroupClass,
|
|
111
|
-
buttonIconSize: buttonIconSize,
|
|
112
|
-
buttonSize: buttonSize,
|
|
113
|
-
buttonTooltip: buttonTooltip,
|
|
114
|
-
isShowButtonText: isShowButtonText,
|
|
115
|
-
handleCommand: handleCommand,
|
|
116
|
-
};
|
|
117
|
-
},
|
|
118
|
-
emits: {},
|
|
119
|
-
props: {},
|
|
120
|
-
});
|
|
121
|
-
export default (await import('vue')).defineComponent({
|
|
122
|
-
setup() {
|
|
123
|
-
return {};
|
|
124
|
-
},
|
|
125
|
-
emits: {},
|
|
126
|
-
props: {},
|
|
127
|
-
});
|
|
128
|
-
;
|
|
129
|
-
//# sourceMappingURL=MlToolbar.vue.js.map
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import { computed, onMounted, onUnmounted, Ref, ref, watch } from 'vue'
|
|
2
|
-
|
|
3
|
-
import { Position, WIDTH_OF_TITLE_BAR } from './types'
|
|
4
|
-
import { useInitialRect } from './useInitialRect'
|
|
5
|
-
import { useResize } from './useResize'
|
|
6
|
-
import { useTransition } from './useTransition'
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Get the bounding rect of the tool palette.
|
|
10
|
-
* - If it is the first time to show the tool palette, return the initial size and position from CSS
|
|
11
|
-
* - Otherwise, return the size and postion after resized
|
|
12
|
-
* @param targetRef Input the tool palette HTML element to get its bounding rect
|
|
13
|
-
* @param reversed Input flag whether to reverse cllapse icon
|
|
14
|
-
* @param collapsed Input flag to indicate whether the tool palette is collapsed
|
|
15
|
-
* @param movement Input dragging movement
|
|
16
|
-
* @returns Return the bounding rect of the tool palette
|
|
17
|
-
*/
|
|
18
|
-
export function useBoundingRect(
|
|
19
|
-
targetRef: Ref<HTMLElement | null>,
|
|
20
|
-
reversed: Ref<boolean>,
|
|
21
|
-
collapsed: Ref<boolean>,
|
|
22
|
-
movement: Ref<Position>
|
|
23
|
-
) {
|
|
24
|
-
const windowWidth = ref(window.innerWidth)
|
|
25
|
-
const windowHeight = ref(window.innerHeight)
|
|
26
|
-
const { initialRect } = useInitialRect(targetRef)
|
|
27
|
-
const { rect: resizedRect } = useResize(targetRef, reversed)
|
|
28
|
-
useTransition(targetRef, reversed, collapsed)
|
|
29
|
-
|
|
30
|
-
const rect = computed(() => {
|
|
31
|
-
return resizedRect.value.width && resizedRect.value.height
|
|
32
|
-
? resizedRect.value
|
|
33
|
-
: initialRect.value
|
|
34
|
-
})
|
|
35
|
-
|
|
36
|
-
// Modify the position of this tool palette according to current orientation
|
|
37
|
-
const setTargetPos = (xDelta: number) => {
|
|
38
|
-
if (targetRef.value && reversed.value) {
|
|
39
|
-
const rect = targetRef.value.getBoundingClientRect()
|
|
40
|
-
targetRef.value.style.left = (rect.left + xDelta) + 'px'
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
const updateWindowSize = () => {
|
|
45
|
-
const xDelta = window.innerWidth - windowWidth.value
|
|
46
|
-
windowWidth.value = window.innerWidth
|
|
47
|
-
windowHeight.value = window.innerHeight
|
|
48
|
-
setTargetPos(xDelta)
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
onMounted(() => {
|
|
52
|
-
window.addEventListener('resize', updateWindowSize)
|
|
53
|
-
})
|
|
54
|
-
|
|
55
|
-
onUnmounted(() => {
|
|
56
|
-
window.removeEventListener('resize', updateWindowSize)
|
|
57
|
-
})
|
|
58
|
-
|
|
59
|
-
// Watch collapsed state. If it is collapsed, store the old width in order to reuse it when expanding the tool palette
|
|
60
|
-
let oldWidth: number | null | undefined = null
|
|
61
|
-
watch(collapsed, newVal => {
|
|
62
|
-
if (newVal) {
|
|
63
|
-
oldWidth = rect.value.width
|
|
64
|
-
rect.value.width = WIDTH_OF_TITLE_BAR
|
|
65
|
-
if (reversed.value && rect.value.left && oldWidth) {
|
|
66
|
-
rect.value.left = rect.value.left + oldWidth - WIDTH_OF_TITLE_BAR
|
|
67
|
-
}
|
|
68
|
-
} else {
|
|
69
|
-
rect.value.width = oldWidth
|
|
70
|
-
if (reversed.value && rect.value.left && oldWidth) {
|
|
71
|
-
rect.value.left = rect.value.left - oldWidth + WIDTH_OF_TITLE_BAR
|
|
72
|
-
}
|
|
73
|
-
oldWidth = null
|
|
74
|
-
}
|
|
75
|
-
})
|
|
76
|
-
|
|
77
|
-
watch(movement, newVal => {
|
|
78
|
-
if (newVal && targetRef.value) {
|
|
79
|
-
const element = targetRef.value as HTMLElement
|
|
80
|
-
const temp = element.getBoundingClientRect()
|
|
81
|
-
rect.value.left = temp.left
|
|
82
|
-
rect.value.top = temp.top
|
|
83
|
-
}
|
|
84
|
-
})
|
|
85
|
-
|
|
86
|
-
return { rect }
|
|
87
|
-
}
|