Skip to content

Commit

Permalink
chore(main): release 1.0.10 (#335)
Browse files Browse the repository at this point in the history
  • Loading branch information
smithoo authored Feb 19, 2025
1 parent e1db794 commit cc008cd
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 11 deletions.
6 changes: 5 additions & 1 deletion packages/vlossom/src/components/vs-message/VsMessage.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div :class="['vs-message', colorClass, { 'vs-dense': dense }]">
<vs-icon class="vs-message-icon" :icon="icon" :size="dense ? '1.4rem' : '1.6rem'" />
<vs-icon v-if="icon" class="vs-message-icon" :icon="icon" :size="dense ? '1.4rem' : '1.6rem'" />
<span class="vs-message-text">{{ message.text }}</span>
</div>
</template>
Expand Down Expand Up @@ -41,6 +41,10 @@ export default defineComponent({
});
const icon = computed(() => {
if (!message.value.state) {
return null;
}
if (message.value.state === 'idle') {
return 'message';
}
Expand Down
4 changes: 2 additions & 2 deletions packages/vlossom/src/components/vs-modal/VsModalView.scss
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
.modal-leave-active .vs-modal-dimmed,
.modal-enter-active .vs-modal-wrap,
.modal-leave-active .vs-modal-wrap {
transition: all 0.2s;
transition: all 0.3s;
}

.modal-enter-from .vs-modal-dimmed,
Expand All @@ -26,6 +26,6 @@

.modal-enter-from .vs-modal-wrap,
.modal-leave-to .vs-modal-wrap {
transform: translate(-50%, -50%) scale(0.95);
transform: translate(-50%, -50%) scale(0.75);
opacity: 0;
}
1 change: 1 addition & 0 deletions packages/vlossom/src/components/vs-modal/VsModalView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import VsContentRenderer from '@/components/vs-content-renderer/VsContentRendere
import { MODAL_DURATION } from '@/declaration';
export default defineComponent({
name: 'VsModalView',
props: {
container: { type: String, required: true, default: 'body' },
},
Expand Down
2 changes: 1 addition & 1 deletion packages/vlossom/src/declaration/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const LAYOUT_Z_INDEX = 100;

export const APP_LAYOUT_Z_INDEX = 1000;

export const SCROLLBAR_WIDTH = '0.38rem';
export const SCROLLBAR_WIDTH = '0.6rem';

export const MODAL_DURATION = 300;

Expand Down
2 changes: 2 additions & 0 deletions packages/vlossom/src/plugins/modal-plugin/modal-plugin.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { h, render } from 'vue';
import { ModalPlugin } from './types';
import { getApp } from '@/vlossom-framework';
import { utils } from '@/utils';
import { store } from '@/stores';
import { VsModalView, VsModalOptions } from '@/components';
Expand All @@ -14,6 +15,7 @@ export const modalPlugin: ModalPlugin = {
}

const modalView = h(VsModalView, { container });
modalView.appContext = getApp()._context;
render(modalView, containerElement);

store.modal.push({ ...options, id });
Expand Down
2 changes: 2 additions & 0 deletions packages/vlossom/src/plugins/toast-plugin/toast-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { store } from '@/stores';
import { getToastInfo } from '@/models';
import { utils } from '@/utils';
import { DEFAULT_TOAST_TIMEOUT } from '@/declaration';
import { getApp } from '@/vlossom-framework';
import VsToastView from '@/components/vs-toast/VsToastView.vue';

import type { ToastPlugin } from './types';
Expand All @@ -17,6 +18,7 @@ function renderToastView(toastInfo: VsToastInfo) {
}

const toastView = h(VsToastView, { container });
toastView.appContext = getApp()._context;
render(toastView, containerElement);

store.toast.push(toastInfo);
Expand Down
21 changes: 14 additions & 7 deletions packages/vlossom/src/vlossom-framework.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,33 +98,40 @@ export class Vlossom {
public modal: ModalPlugin = modalPlugin;
}

let vlossom: Vlossom;
let _vlossom: Vlossom;
let _app: App;

function registerComponents(app: App, components: VsComponent[] = []) {
const modules: Record<string, any> = import.meta.glob('./components/**/*.vue', { eager: true });
Object.values(modules).forEach((module) => {
Object.entries(modules).forEach(([path, module]) => {
const component = module.default;
if (components.length && !components.includes(component.name as VsComponent)) {
return;
}
app.component(component.name, component);
const componentName = component.name || (path.split('/').pop() || '').replace(/\.\w+$/, '');
app.component(componentName, component);
});
}

function createVlossom(options?: VlossomOptions): any {
return {
install(app: App) {
vlossom = new Vlossom(options);
_app = app;
_vlossom = new Vlossom(options);

app.config.globalProperties.$vs = vlossom;
app.config.globalProperties.$vs = _vlossom;

registerComponents(app, options?.components);
},
};
}

function useVlossom() {
return vlossom;
return _vlossom;
}

export { createVlossom, useVlossom };
function getApp() {
return _app;
}

export { createVlossom, registerComponents, useVlossom, getApp };

0 comments on commit cc008cd

Please sign in to comment.