@coffic/cosy-ui 0.6.12 → 0.6.16
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/dist/app.css +1 -1
- package/dist/assets/iconData.ts +93 -0
- package/dist/components/base/Alert.astro +1 -1
- package/dist/components/base/Button.astro +102 -91
- package/dist/components/base/Image.astro +1 -1
- package/dist/components/base/Link.astro +1 -1
- package/dist/components/containers/Container.astro +1 -1
- package/dist/components/containers/Main.astro +1 -1
- package/dist/components/containers/Section.astro +96 -94
- package/dist/components/data-display/Blog.astro +1 -1
- package/dist/components/data-display/ProductCard.astro +2 -4
- package/dist/components/data-display/Products.astro +2 -2
- package/dist/components/data-display/TeamMember.astro +2 -4
- package/dist/components/data-display/TeamMembers.astro +1 -1
- package/dist/components/display/Banner.astro +1 -1
- package/dist/components/display/Card.astro +1 -1
- package/dist/components/display/CodeBlock.astro +1 -1
- package/dist/components/display/CodeExample.astro +1 -1
- package/dist/components/display/Hero.astro +1 -1
- package/dist/components/display/Modal.astro +1 -1
- package/dist/components/layouts/AppLayout.astro +2 -6
- package/dist/components/layouts/BaseLayout.astro +1 -1
- package/dist/components/layouts/DashboardLayout.astro +1 -1
- package/dist/components/layouts/Footer.astro +2 -5
- package/dist/components/layouts/Grid.astro +1 -1
- package/dist/components/layouts/Header.astro +1 -1
- package/dist/components/layouts/NavItems.astro +1 -1
- package/dist/components/layouts/Sidebar.astro +2 -2
- package/dist/components/layouts/SidebarNav.astro +1 -1
- package/dist/components/layouts/Stack.astro +72 -70
- package/dist/components/navigation/LanguageSwitcher.astro +2 -2
- package/dist/components/navigation/TableOfContents.astro +1 -1
- package/dist/components/navigation/ThemeSwitcher.astro +2 -2
- package/dist/components/typography/Article.astro +2 -2
- package/dist/components/typography/Heading.astro +2 -2
- package/dist/components/typography/Text.astro +1 -1
- package/dist/icons/AlertTriangle.astro +24 -0
- package/dist/icons/AstroIcon.astro +46 -0
- package/dist/icons/CalendarIcon.astro +24 -0
- package/dist/icons/CheckCircle.astro +23 -0
- package/dist/icons/CheckIcon.astro +27 -0
- package/dist/{components/icons → icons}/ChevronDownIcon.astro +3 -13
- package/dist/icons/ClipboardIcon.astro +27 -0
- package/dist/icons/CloseIcon.astro +27 -0
- package/dist/icons/ErrorIcon.astro +24 -0
- package/dist/icons/GithubIcon.astro +24 -0
- package/dist/icons/InfoCircle.astro +24 -0
- package/dist/icons/InfoIcon.astro +26 -0
- package/dist/icons/LinkIcon.astro +27 -0
- package/dist/icons/LinkedinIcon.astro +23 -0
- package/dist/icons/MenuIcon.astro +27 -0
- package/dist/icons/SearchIcon.astro +23 -0
- package/dist/icons/SettingsIcon.astro +18 -0
- package/dist/{components/icons → icons}/SocialIcon.astro +14 -14
- package/dist/icons/SuccessIcon.astro +24 -0
- package/dist/icons/SunCloudyIcon.astro +23 -0
- package/dist/icons/TwitterIcon.astro +24 -0
- package/dist/icons/UserIcon.astro +24 -0
- package/dist/icons/WarningIcon.astro +27 -0
- package/dist/icons/XCircle.astro +24 -0
- package/dist/index.ts +1 -1
- package/dist/index_icons.ts +23 -0
- package/dist/index_vue.ts +41 -0
- package/dist/vue/{AlertDialog.vue → AlertDialog/AlertDialog.vue} +1 -1
- package/dist/vue/AlertDialog/Basic.vue +38 -0
- package/dist/vue/AlertDialog/Multilang.vue +48 -0
- package/dist/vue/AlertDialog/index.ts +58 -0
- package/dist/vue/BannerBox/BannerBox.vue +296 -0
- package/dist/vue/BannerBox/DownloadButton.vue +202 -0
- package/dist/vue/BannerBox/ExampleBasic.vue +32 -0
- package/dist/vue/BannerBox/ExampleCustomBg.vue +32 -0
- package/dist/vue/BannerBox/ExampleDisplayModeAlways.vue +34 -0
- package/dist/vue/BannerBox/ExampleDisplayModeHover.vue +34 -0
- package/dist/vue/BannerBox/ExampleDisplayModeNever.vue +34 -0
- package/dist/vue/BannerBox/ExampleImageExport.vue +37 -0
- package/dist/vue/BannerBox/ExampleSizePreset.vue +35 -0
- package/dist/vue/{FeatureCard.vue → BannerBox/FeatureCard.vue} +28 -47
- package/dist/vue/BannerBox/SmartBanner.vue +44 -0
- package/dist/vue/BannerBox/bgStyles.ts +55 -0
- package/dist/vue/BannerBox/index.ts +83 -0
- package/dist/vue/BannerBox/sizePresets.ts +23 -0
- package/dist/vue/FeatureButton.vue +25 -26
- package/dist/vue/Icons/AlertTriangleIcon.vue +30 -0
- package/dist/vue/Icons/CalendarIcon.vue +30 -0
- package/dist/vue/Icons/CheckCircleIcon.vue +30 -0
- package/dist/vue/Icons/CheckIcon.vue +30 -0
- package/dist/vue/Icons/ChevronDownIcon.vue +30 -0
- package/dist/vue/Icons/ClipboardIcon.vue +30 -0
- package/dist/vue/Icons/CloseIcon.vue +30 -0
- package/dist/vue/Icons/InfoCircleIcon.vue +30 -0
- package/dist/vue/Icons/InfoIcon.vue +30 -0
- package/dist/vue/Icons/LinkIcon.vue +30 -0
- package/dist/vue/Icons/MenuIcon.vue +30 -0
- package/dist/vue/Icons/SearchIcon.vue +30 -0
- package/dist/vue/Icons/SettingsIcon.vue +30 -0
- package/dist/vue/Icons/UserIcon.vue +30 -0
- package/dist/vue/Icons/VueIcon.vue +76 -0
- package/dist/vue/Icons/XCircleIcon.vue +30 -0
- package/dist/vue/MacWindow/Basic.vue +11 -0
- package/dist/vue/MacWindow/CustomHeight.vue +13 -0
- package/dist/vue/{MacWindow.vue → MacWindow/MacWindow.vue} +70 -38
- package/dist/vue/MacWindow/WithEvents.vue +34 -0
- package/dist/vue/MacWindow/WithSidebar.vue +21 -0
- package/dist/vue/MacWindow/WithTabs.vue +21 -0
- package/dist/vue/MacWindow/WithToolbar.vue +43 -0
- package/dist/vue/MacWindow/index.ts +50 -0
- package/dist/vue/SmartHero.vue +28 -34
- package/dist/vue/VueCounter.vue +29 -0
- package/dist/vue/iPhone/Basic.vue +33 -0
- package/dist/vue/iPhone/CustomBackground.vue +33 -0
- package/dist/vue/iPhone/NoFrame.vue +33 -0
- package/dist/vue/iPhone/WeatherApp.vue +97 -0
- package/dist/vue/iPhone/assets/iPhone 14 Pro - Deep Purple - Landscape.png +0 -0
- package/dist/vue/iPhone/assets/iPhone 14 Pro - Deep Purple - Portrait.png +0 -0
- package/dist/vue/iPhone/assets/iPhone 14 Pro - Gold - Landscape.png +0 -0
- package/dist/vue/iPhone/assets/iPhone 14 Pro - Gold - Portrait.png +0 -0
- package/dist/vue/iPhone/assets/iPhone 14 Pro - Silver - Landscape.png +0 -0
- package/dist/vue/iPhone/assets/iPhone 14 Pro - Silver - Portrait.png +0 -0
- package/dist/vue/iPhone/assets/iPhone 14 Pro - Space Black - Landscape.png +0 -0
- package/dist/vue/iPhone/assets/iPhone 14 Pro - Space Black - Portrait.png +0 -0
- package/dist/vue/{iPhoneWindow.vue → iPhone/iPhoneWindow.vue} +11 -7
- package/dist/vue/iPhone/index.ts +41 -0
- package/package.json +13 -12
- package/dist/components/icons/AlertTriangle.astro +0 -35
- package/dist/components/icons/CalendarIcon.astro +0 -38
- package/dist/components/icons/CheckCircle.astro +0 -36
- package/dist/components/icons/CheckIcon.astro +0 -38
- package/dist/components/icons/ClipboardIcon.astro +0 -39
- package/dist/components/icons/CloseIcon.astro +0 -38
- package/dist/components/icons/ErrorIcon.astro +0 -35
- package/dist/components/icons/GithubIcon.astro +0 -31
- package/dist/components/icons/InfoCircle.astro +0 -37
- package/dist/components/icons/InfoIcon.astro +0 -38
- package/dist/components/icons/LinkIcon.astro +0 -39
- package/dist/components/icons/LinkedinIcon.astro +0 -31
- package/dist/components/icons/MenuIcon.astro +0 -38
- package/dist/components/icons/SearchIcon.astro +0 -36
- package/dist/components/icons/SettingsIcon.astro +0 -36
- package/dist/components/icons/SuccessIcon.astro +0 -35
- package/dist/components/icons/SunCloudyIcon.astro +0 -41
- package/dist/components/icons/TwitterIcon.astro +0 -31
- package/dist/components/icons/UserIcon.astro +0 -35
- package/dist/components/icons/WarningIcon.astro +0 -38
- package/dist/components/icons/XCircle.astro +0 -37
- package/dist/entities/Banner.ts +0 -105
- package/dist/icons.ts +0 -22
- package/dist/vue/BannerBox.vue +0 -267
- package/dist/vue/FeatureGroup.vue +0 -22
- package/dist/vue/SmartBanner.vue +0 -45
- package/dist/vue/WildBanner.vue +0 -15
- package/dist/vue.ts +0 -14
- /package/dist/{collection.ts → index_collection.ts} +0 -0
package/dist/entities/Banner.ts
DELETED
@@ -1,105 +0,0 @@
|
|
1
|
-
import Feature from './Feature';
|
2
|
-
import type { Component } from 'vue';
|
3
|
-
|
4
|
-
class Banner {
|
5
|
-
private translations: Map<string, {
|
6
|
-
title: string,
|
7
|
-
description: string
|
8
|
-
}>;
|
9
|
-
private features: Feature[];
|
10
|
-
private component: Component | null;
|
11
|
-
private componentProps: Record<string, unknown>;
|
12
|
-
|
13
|
-
constructor() {
|
14
|
-
this.translations = new Map();
|
15
|
-
this.features = [];
|
16
|
-
this.component = null;
|
17
|
-
this.componentProps = {};
|
18
|
-
// Initialize empty entries for both languages
|
19
|
-
this.translations.set('zh-cn', { title: '', description: '' });
|
20
|
-
this.translations.set('en', { title: '', description: '' });
|
21
|
-
}
|
22
|
-
|
23
|
-
static create(): Banner {
|
24
|
-
return new Banner();
|
25
|
-
}
|
26
|
-
|
27
|
-
public setZhTitle(title: string): Banner {
|
28
|
-
const current = this.translations.get('zh-cn') || { title: '', description: '' };
|
29
|
-
this.translations.set('zh-cn', { ...current, title });
|
30
|
-
return this;
|
31
|
-
}
|
32
|
-
|
33
|
-
public setEnTitle(title: string): Banner {
|
34
|
-
const current = this.translations.get('en') || { title: '', description: '' };
|
35
|
-
this.translations.set('en', { ...current, title });
|
36
|
-
return this;
|
37
|
-
}
|
38
|
-
|
39
|
-
public setZhDescription(description: string): Banner {
|
40
|
-
const current = this.translations.get('zh-cn') || { title: '', description: '' };
|
41
|
-
this.translations.set('zh-cn', { ...current, description });
|
42
|
-
return this;
|
43
|
-
}
|
44
|
-
|
45
|
-
public setEnDescription(description: string): Banner {
|
46
|
-
const current = this.translations.get('en') || { title: '', description: '' };
|
47
|
-
this.translations.set('en', { ...current, description });
|
48
|
-
return this;
|
49
|
-
}
|
50
|
-
|
51
|
-
public appendFeature(feature: Feature): Banner {
|
52
|
-
this.features.push(feature);
|
53
|
-
return this;
|
54
|
-
}
|
55
|
-
|
56
|
-
public withFeatures(features: Feature[]): Banner {
|
57
|
-
this.features.push(...features);
|
58
|
-
return this;
|
59
|
-
}
|
60
|
-
|
61
|
-
// 获取指定语言的标题
|
62
|
-
public getTitle(lang: string): string {
|
63
|
-
return this.translations.get(lang)?.title || '';
|
64
|
-
}
|
65
|
-
|
66
|
-
// 获取指定语言的描述
|
67
|
-
public getDescription(lang: string): string {
|
68
|
-
return this.translations.get(lang)?.description || '';
|
69
|
-
}
|
70
|
-
|
71
|
-
// 获取指定语言的特性列表
|
72
|
-
public getFeatures(): Feature[] {
|
73
|
-
return this.features;
|
74
|
-
}
|
75
|
-
|
76
|
-
// 检查是否支持某种语言
|
77
|
-
public hasLanguage(lang: string): boolean {
|
78
|
-
return this.translations.has(lang);
|
79
|
-
}
|
80
|
-
|
81
|
-
// 获取所有支持的语言
|
82
|
-
public getSupportedLanguages(): string[] {
|
83
|
-
return Array.from(this.translations.keys());
|
84
|
-
}
|
85
|
-
|
86
|
-
public setComponent(component: Component): Banner {
|
87
|
-
this.component = component;
|
88
|
-
return this;
|
89
|
-
}
|
90
|
-
|
91
|
-
public getComponent(): Component | null {
|
92
|
-
return this.component;
|
93
|
-
}
|
94
|
-
|
95
|
-
public setComponentProps(props: Record<string, unknown>): Banner {
|
96
|
-
this.componentProps = props;
|
97
|
-
return this;
|
98
|
-
}
|
99
|
-
|
100
|
-
public getComponentProps(): Record<string, unknown> {
|
101
|
-
return this.componentProps;
|
102
|
-
}
|
103
|
-
}
|
104
|
-
|
105
|
-
export default Banner;
|
package/dist/icons.ts
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
export { default as SocialIcon } from './components/icons/SocialIcon.astro';
|
2
|
-
export { default as TwitterIcon } from './components/icons/TwitterIcon.astro';
|
3
|
-
export { default as UserIcon } from './components/icons/UserIcon.astro';
|
4
|
-
export { default as WarningIcon } from './components/icons/WarningIcon.astro';
|
5
|
-
export { default as XCircle } from './components/icons/XCircle.astro';
|
6
|
-
export { default as InfoIcon } from './components/icons/InfoIcon.astro';
|
7
|
-
export { default as LinkIcon } from './components/icons/LinkIcon.astro';
|
8
|
-
export { default as LinkedinIcon } from './components/icons/LinkedinIcon.astro';
|
9
|
-
export { default as MenuIcon } from './components/icons/MenuIcon.astro';
|
10
|
-
export { default as SearchIcon } from './components/icons/SearchIcon.astro';
|
11
|
-
export { default as SuccessIcon } from './components/icons/SuccessIcon.astro';
|
12
|
-
export { default as SunCloudyIcon } from './components/icons/SunCloudyIcon.astro';
|
13
|
-
export { default as AlertTriangle } from './components/icons/AlertTriangle.astro';
|
14
|
-
export { default as CalendarIcon } from './components/icons/CalendarIcon.astro';
|
15
|
-
export { default as CheckCircle } from './components/icons/CheckCircle.astro';
|
16
|
-
export { default as CheckIcon } from './components/icons/CheckIcon.astro';
|
17
|
-
export { default as ClipboardIcon } from './components/icons/ClipboardIcon.astro';
|
18
|
-
export { default as CloseIcon } from './components/icons/CloseIcon.astro';
|
19
|
-
export { default as ErrorIcon } from './components/icons/ErrorIcon.astro';
|
20
|
-
export { default as GithubIcon } from './components/icons/GithubIcon.astro';
|
21
|
-
export { default as InfoCircle } from './components/icons/InfoCircle.astro';
|
22
|
-
export { default as SettingsIcon } from './components/icons/SettingsIcon.astro';
|
package/dist/vue/BannerBox.vue
DELETED
@@ -1,267 +0,0 @@
|
|
1
|
-
<script setup lang="ts">
|
2
|
-
import { ref, onMounted, watch, onUnmounted } from 'vue';
|
3
|
-
import { RiDownloadLine } from '@remixicon/vue';
|
4
|
-
import { toPng } from 'html-to-image';
|
5
|
-
|
6
|
-
const props = defineProps({
|
7
|
-
showDownloadButton: {
|
8
|
-
type: Boolean,
|
9
|
-
default: true
|
10
|
-
},
|
11
|
-
backgroundClassIndex: {
|
12
|
-
type: Number,
|
13
|
-
default: 0
|
14
|
-
}
|
15
|
-
})
|
16
|
-
|
17
|
-
const componentRef = ref<HTMLElement | null>(null);
|
18
|
-
|
19
|
-
const isDropdownOpen = ref(false);
|
20
|
-
|
21
|
-
const sizePresets = [
|
22
|
-
{ name: 'Default', width: 'w-full', height: 'h-full' },
|
23
|
-
{ name: 'Square', width: 'w-[600px]', height: 'h-[600px]' },
|
24
|
-
{ name: 'Landscape', width: 'w-[800px]', height: 'h-[450px]' },
|
25
|
-
{ name: 'Portrait', width: 'w-[450px]', height: 'h-[800px]' },
|
26
|
-
{ name: 'Wide', width: 'w-[1200px]', height: 'h-[675px]' },
|
27
|
-
{ name: 'Banner', width: 'w-[1200px]', height: 'h-[300px]' },
|
28
|
-
{ name: '1280 × 800', width: 'w-[1280px]', height: 'h-[800px]' },
|
29
|
-
{ name: '1440 × 900', width: 'w-[1440px]', height: 'h-[900px]' },
|
30
|
-
{ name: '2560 × 1600', width: 'w-[2560px]', height: 'h-[1600px]' },
|
31
|
-
{ name: '2880 × 1800', width: 'w-[2880px]', height: 'h-[1800px]' },
|
32
|
-
];
|
33
|
-
|
34
|
-
const selectedSize = ref(sizePresets[0]);
|
35
|
-
|
36
|
-
const toggleDropdown = () => {
|
37
|
-
isDropdownOpen.value = !isDropdownOpen.value;
|
38
|
-
};
|
39
|
-
|
40
|
-
// Add new ref for tracking if size was loaded from storage
|
41
|
-
const isLoadedFromStorage = ref(false);
|
42
|
-
|
43
|
-
// 监听尺寸变化并保存到 localStorage
|
44
|
-
watch(selectedSize, (newSize) => {
|
45
|
-
localStorage.setItem('bannerBoxSize', JSON.stringify(newSize));
|
46
|
-
// 当尺寸改变时,发出事件通知其他组件
|
47
|
-
window.dispatchEvent(new CustomEvent('bannerBoxSizeChange', {
|
48
|
-
detail: newSize
|
49
|
-
}));
|
50
|
-
// 设置为已加载状态,显示尺寸标签
|
51
|
-
isLoadedFromStorage.value = true;
|
52
|
-
});
|
53
|
-
|
54
|
-
// 创建自定义事件处理函数
|
55
|
-
const handleSizeClear = () => {
|
56
|
-
selectedSize.value = sizePresets[0];
|
57
|
-
isLoadedFromStorage.value = false;
|
58
|
-
};
|
59
|
-
|
60
|
-
// 处理尺寸变化的事件
|
61
|
-
const handleSizeChange = (event: Event) => {
|
62
|
-
const customEvent = event as CustomEvent;
|
63
|
-
selectedSize.value = customEvent.detail;
|
64
|
-
isLoadedFromStorage.value = true;
|
65
|
-
};
|
66
|
-
|
67
|
-
onMounted(() => {
|
68
|
-
const savedSize = localStorage.getItem('bannerBoxSize');
|
69
|
-
if (savedSize) {
|
70
|
-
const parsed = JSON.parse(savedSize);
|
71
|
-
const found = sizePresets.find(preset => preset.name === parsed.name);
|
72
|
-
if (found) {
|
73
|
-
selectedSize.value = found;
|
74
|
-
isLoadedFromStorage.value = true;
|
75
|
-
}
|
76
|
-
}
|
77
|
-
|
78
|
-
// 添加事件监听
|
79
|
-
window.addEventListener('bannerBoxClear', handleSizeClear);
|
80
|
-
window.addEventListener('bannerBoxSizeChange', handleSizeChange);
|
81
|
-
|
82
|
-
document.addEventListener('click', (event) => {
|
83
|
-
const target = event.target as HTMLElement;
|
84
|
-
if (!target.closest('.relative')) {
|
85
|
-
isDropdownOpen.value = false;
|
86
|
-
}
|
87
|
-
});
|
88
|
-
});
|
89
|
-
|
90
|
-
// Update downloadAsImage function to accept scale parameter
|
91
|
-
const downloadAsImage = async () => {
|
92
|
-
try {
|
93
|
-
const element = componentRef.value;
|
94
|
-
if (!element) {
|
95
|
-
console.error('Component reference is null');
|
96
|
-
return;
|
97
|
-
}
|
98
|
-
|
99
|
-
const dataUrl = await toPng(element, {
|
100
|
-
backgroundColor: undefined,
|
101
|
-
style: {
|
102
|
-
transform: 'scale(1)',
|
103
|
-
transformOrigin: 'top left'
|
104
|
-
}
|
105
|
-
});
|
106
|
-
|
107
|
-
const link = document.createElement('a');
|
108
|
-
const fileName = `feature-${element.offsetWidth}x${element.offsetHeight}.png`;
|
109
|
-
link.download = fileName;
|
110
|
-
link.href = dataUrl;
|
111
|
-
link.click();
|
112
|
-
isDropdownOpen.value = false;
|
113
|
-
} catch (error) {
|
114
|
-
console.error('Failed to download image:', error);
|
115
|
-
}
|
116
|
-
};
|
117
|
-
|
118
|
-
const bgClasses = [
|
119
|
-
'bg-gradient-to-b from-blue-100/50 to-blue-200/50 dark:from-blue-500/10 dark:to-blue-200/10',
|
120
|
-
'bg-gradient-to-b from-blue-200/50 to-purple-200/50 dark:from-blue-500/10 dark:to-purple-200/10',
|
121
|
-
'bg-gradient-to-b from-yellow-200/50 to-green-200/50 dark:from-yellow-500/10 dark:to-green-200/10',
|
122
|
-
'bg-gradient-to-b from-teal-200/50 to-blue-200/50 dark:from-teal-500/10 dark:to-blue-200/10',
|
123
|
-
'bg-gradient-to-b from-pink-200/50 to-indigo-200/20 dark:from-pink-500/10 dark:to-indigo-200/10',
|
124
|
-
'bg-gradient-to-b from-red-200/50 to-orange-200/50 dark:from-red-500/10 dark:to-orange-200/10',
|
125
|
-
'bg-gradient-to-b from-orange-200/50 to-yellow-200/50 dark:from-orange-500/10 dark:to-yellow-200/10',
|
126
|
-
'bg-gradient-to-b from-green-200/50 to-teal-200/50 dark:from-green-500/10 dark:to-teal-200/10',
|
127
|
-
|
128
|
-
// 不透明的背景
|
129
|
-
'bg-gradient-to-b from-blue-100 to-blue-200 dark:from-blue-500 dark:to-blue-200',
|
130
|
-
'bg-gradient-to-b from-blue-200 to-purple-200 dark:from-blue-500 dark:to-purple-200',
|
131
|
-
'bg-gradient-to-b from-yellow-200 to-green-200 dark:from-yellow-500 dark:to-green-200',
|
132
|
-
'bg-gradient-to-b from-teal-200 to-blue-200 dark:from-teal-500 dark:to-blue-200',
|
133
|
-
'bg-gradient-to-b from-pink-200 to-red-200 dark:from-pink-500 dark:to-red-200',
|
134
|
-
'bg-gradient-to-b from-red-200 to-orange-200 dark:from-red-500 dark:to-orange-200',
|
135
|
-
'bg-gradient-to-b from-orange-200 to-yellow-200 dark:from-orange-500 dark:to-yellow-200',
|
136
|
-
'bg-gradient-to-b from-green-200 to-teal-200 dark:from-green-500 dark:to-teal-200',
|
137
|
-
|
138
|
-
// 不透明的深色背景
|
139
|
-
'bg-gradient-to-b from-blue-900 to-blue-200 dark:from-blue-900 dark:to-blue-200',
|
140
|
-
'bg-gradient-to-b from-blue-900 to-purple-200 dark:from-blue-900 dark:to-purple-200',
|
141
|
-
'bg-gradient-to-b from-yellow-900 to-green-200 dark:from-yellow-900 dark:to-green-200',
|
142
|
-
'bg-gradient-to-b from-teal-900 to-blue-200 dark:from-teal-900 dark:to-blue-200',
|
143
|
-
'bg-gradient-to-b from-pink-900 to-red-200 dark:from-pink-900 dark:to-red-200',
|
144
|
-
'bg-gradient-to-b from-red-900 to-orange-200 dark:from-red-900 dark:to-orange-200',
|
145
|
-
'bg-gradient-to-b from-orange-900 to-yellow-200 dark:from-orange-900 dark:to-yellow-200',
|
146
|
-
'bg-gradient-to-b from-green-900 to-teal-900 dark:from-green-900 dark:to-teal-900',
|
147
|
-
// 不透明的渐变背景
|
148
|
-
'bg-gradient-to-br from-emerald-400 to-cyan-400 dark:from-emerald-600 dark:to-cyan-600',
|
149
|
-
'bg-gradient-to-br from-violet-400 to-fuchsia-400 dark:from-violet-600 dark:to-fuchsia-600',
|
150
|
-
'bg-gradient-to-br from-amber-400 to-orange-400 dark:from-amber-600 dark:to-orange-600',
|
151
|
-
'bg-gradient-to-br from-rose-400 to-pink-400 dark:from-rose-600 dark:to-pink-600',
|
152
|
-
'bg-gradient-to-br from-sky-400 to-indigo-400 dark:from-sky-600 dark:to-indigo-600',
|
153
|
-
'bg-gradient-to-br from-lime-400 to-emerald-400 dark:from-lime-600 dark:to-emerald-600',
|
154
|
-
'bg-gradient-to-br from-purple-400 to-indigo-400 dark:from-purple-600 dark:to-indigo-600',
|
155
|
-
'bg-gradient-to-br from-blue-400 to-violet-400 dark:from-blue-600 dark:to-violet-600',
|
156
|
-
|
157
|
-
// 纯色背景
|
158
|
-
'bg-emerald-400 dark:bg-emerald-600',
|
159
|
-
'bg-violet-400 dark:bg-violet-600',
|
160
|
-
'bg-amber-400 dark:bg-amber-600',
|
161
|
-
'bg-rose-400 dark:bg-rose-600',
|
162
|
-
'bg-sky-400 dark:bg-sky-600',
|
163
|
-
'bg-lime-400 dark:bg-lime-600',
|
164
|
-
'bg-purple-400 dark:bg-purple-600',
|
165
|
-
'bg-blue-400 dark:bg-blue-600'
|
166
|
-
|
167
|
-
]
|
168
|
-
|
169
|
-
const selectedBgIndex = ref(props.backgroundClassIndex);
|
170
|
-
|
171
|
-
const getBackgroundClass = (): string => {
|
172
|
-
return bgClasses[selectedBgIndex.value % bgClasses.length];
|
173
|
-
}
|
174
|
-
|
175
|
-
const clearStoredSize = () => {
|
176
|
-
localStorage.removeItem('bannerBoxSize');
|
177
|
-
// 触发自定义事件
|
178
|
-
window.dispatchEvent(new CustomEvent('bannerBoxClear'));
|
179
|
-
isDropdownOpen.value = false;
|
180
|
-
};
|
181
|
-
|
182
|
-
// 清理事件监听
|
183
|
-
onUnmounted(() => {
|
184
|
-
window.removeEventListener('bannerBoxClear', handleSizeClear);
|
185
|
-
window.removeEventListener('bannerBoxSizeChange', handleSizeChange);
|
186
|
-
});
|
187
|
-
</script>
|
188
|
-
|
189
|
-
<template>
|
190
|
-
<div class="relative w-full rounded-2xl max-w-7xl mx-auto">
|
191
|
-
<!-- Add size indicator -->
|
192
|
-
<div v-if="isLoadedFromStorage"
|
193
|
-
class="absolute top-4 right-4 bg-yellow-500/30 backdrop-blur-sm px-3 py-1 rounded-lg text-sm text-white">
|
194
|
-
{{ selectedSize.name }}
|
195
|
-
</div>
|
196
|
-
|
197
|
-
<!-- Download button with dropdown menu -->
|
198
|
-
<div v-if="showDownloadButton" class="absolute top-4 left-4 opacity-0 hover:opacity-100 transition-opacity">
|
199
|
-
<div class="relative">
|
200
|
-
<button class="bg-yellow-500/30 backdrop-blur-sm p-2 rounded-lg hover:bg-yellow-500/40"
|
201
|
-
@click="toggleDropdown">
|
202
|
-
<RiDownloadLine class="w-6 h-6 text-white" />
|
203
|
-
</button>
|
204
|
-
<!-- Size selection dropdown -->
|
205
|
-
<div v-if="isDropdownOpen"
|
206
|
-
class="absolute left-0 mt-2 w-96 bg-white dark:bg-gray-800 rounded-lg shadow-lg py-2 z-50">
|
207
|
-
<!-- Component size presets -->
|
208
|
-
<div class="px-4 py-2 border-b border-gray-200 dark:border-gray-700">
|
209
|
-
<div class="grid grid-cols-3 gap-2">
|
210
|
-
<button v-for="preset in sizePresets" :key="preset.name" :class="[
|
211
|
-
'p-2 text-left rounded text-sm',
|
212
|
-
selectedSize.name === preset.name
|
213
|
-
? 'bg-yellow-500/30 text-yellow-900 dark:text-yellow-100'
|
214
|
-
: 'hover:bg-gray-100 dark:hover:bg-gray-700'
|
215
|
-
]" @click="selectedSize = preset">
|
216
|
-
<div class="flex flex-col">
|
217
|
-
<span class="font-medium">{{ preset.name }}</span>
|
218
|
-
<span class="text-xs text-gray-500 dark:text-gray-400">
|
219
|
-
{{ preset.width.replace('w-[', '').replace(']', '') }}
|
220
|
-
</span>
|
221
|
-
</div>
|
222
|
-
</button>
|
223
|
-
<!-- Clear size button -->
|
224
|
-
<button class="p-2 text-left rounded text-sm hover:bg-gray-100 dark:hover:bg-gray-700"
|
225
|
-
@click="clearStoredSize">
|
226
|
-
<div class="flex flex-col">
|
227
|
-
<span class="font-medium text-red-600 dark:text-red-400">清除记住的尺寸</span>
|
228
|
-
<span class="text-xs text-gray-500 dark:text-gray-400">重置为默认尺寸</span>
|
229
|
-
</div>
|
230
|
-
</button>
|
231
|
-
</div>
|
232
|
-
</div>
|
233
|
-
<!-- Background settings -->
|
234
|
-
<div class="px-4 py-2 border-b border-gray-200 dark:border-gray-700">
|
235
|
-
<div class="mt-2">
|
236
|
-
<div class="grid grid-cols-8 gap-2">
|
237
|
-
<button v-for="(_, index) in bgClasses" :key="index" :class="[
|
238
|
-
bgClasses[index],
|
239
|
-
'w-8 h-8 rounded-lg border-2',
|
240
|
-
selectedBgIndex === index ? 'border-yellow-500' : 'border-transparent'
|
241
|
-
]" @click="selectedBgIndex = index" />
|
242
|
-
</div>
|
243
|
-
</div>
|
244
|
-
</div>
|
245
|
-
<!-- Size options -->
|
246
|
-
<div class="p-4">
|
247
|
-
<button class="w-full p-2 text-center rounded hover:bg-gray-100 dark:hover:bg-gray-700"
|
248
|
-
@click="downloadAsImage()">
|
249
|
-
<div class="flex items-center justify-center gap-2">
|
250
|
-
<RiDownloadLine class="w-4 h-4" />
|
251
|
-
<span class="font-medium">下载图片</span>
|
252
|
-
</div>
|
253
|
-
</button>
|
254
|
-
</div>
|
255
|
-
</div>
|
256
|
-
</div>
|
257
|
-
</div>
|
258
|
-
|
259
|
-
<div ref="componentRef" class="flex p-8 rounded-2xl shadow" :class="[
|
260
|
-
getBackgroundClass(),
|
261
|
-
selectedSize.width,
|
262
|
-
selectedSize.height
|
263
|
-
]">
|
264
|
-
<slot />
|
265
|
-
</div>
|
266
|
-
</div>
|
267
|
-
</template>
|
@@ -1,22 +0,0 @@
|
|
1
|
-
<template>
|
2
|
-
<div
|
3
|
-
data-type="feature-group"
|
4
|
-
class="flex mt-8 flex-col items-center container mx-auto justify-center my-2 gap-24 w-full"
|
5
|
-
>
|
6
|
-
<div
|
7
|
-
v-for="(component, index) in $slots.default?.() || []"
|
8
|
-
:key="index"
|
9
|
-
class="w-full relative group"
|
10
|
-
>
|
11
|
-
<div class="relative">
|
12
|
-
<BaseFeature :background-class-index="index">
|
13
|
-
<component :is="component" />
|
14
|
-
</BaseFeature>
|
15
|
-
</div>
|
16
|
-
</div>
|
17
|
-
</div>
|
18
|
-
</template>
|
19
|
-
|
20
|
-
<script setup>
|
21
|
-
import BaseFeature from './BannerBox.vue'
|
22
|
-
</script>
|
package/dist/vue/SmartBanner.vue
DELETED
@@ -1,45 +0,0 @@
|
|
1
|
-
<script setup lang="ts">
|
2
|
-
import Banner from '../entities/Banner';
|
3
|
-
import BannerBox from './BannerBox.vue';
|
4
|
-
import FeatureCard from './FeatureCard.vue';
|
5
|
-
|
6
|
-
defineProps({
|
7
|
-
lang: {
|
8
|
-
type: String,
|
9
|
-
default: 'en',
|
10
|
-
validator: (value: string) => ['en', 'zh-cn'].includes(value)
|
11
|
-
},
|
12
|
-
banner: {
|
13
|
-
type: Banner,
|
14
|
-
required: true
|
15
|
-
},
|
16
|
-
backgroundClassIndex: {
|
17
|
-
type: Number,
|
18
|
-
default: 0
|
19
|
-
}
|
20
|
-
})
|
21
|
-
</script>
|
22
|
-
|
23
|
-
<template>
|
24
|
-
<BannerBox :background-class-index="backgroundClassIndex">
|
25
|
-
<div class="py-16 px-8 text-center w-full rounded-2xl" data-type="smart-banner">
|
26
|
-
<h2 class="text-4xl mb-4">
|
27
|
-
{{ banner.getTitle(lang) }}
|
28
|
-
</h2>
|
29
|
-
|
30
|
-
<p v-if="banner.getDescription(lang).length > 0" class="text-lg text-center max-w-2xl mx-auto">
|
31
|
-
{{ banner.getDescription(lang) }}
|
32
|
-
</p>
|
33
|
-
|
34
|
-
<div class="flex flex-row justify-center gap-8 mx-auto w-full mt-24">
|
35
|
-
<FeatureCard v-for="feature in banner.getFeatures()" :key="feature.getTitle(lang)"
|
36
|
-
:emoji="feature.emoji" :title="feature.getTitle(lang)" :link="feature.link" />
|
37
|
-
</div>
|
38
|
-
|
39
|
-
<div class="mt-12">
|
40
|
-
<component :is="banner.getComponent()" v-if="banner.getComponent()"
|
41
|
-
v-bind="banner.getComponentProps()" />
|
42
|
-
</div>
|
43
|
-
</div>
|
44
|
-
</BannerBox>
|
45
|
-
</template>
|
package/dist/vue/WildBanner.vue
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
<template>
|
2
|
-
<div class="w-full px-8 z-50 mx-auto">
|
3
|
-
<div
|
4
|
-
class="mt-0 hero p-4 rounded-2xl bg-base-300/50 dark:bg-base-200/50 backdrop-blur-xl hover:shadow-2xl transform duration-100"
|
5
|
-
>
|
6
|
-
<div class="text-center hero-content">
|
7
|
-
<div class="max-w-md flex flex-row justify-center items-center mx-auto">
|
8
|
-
<p class="text-2xl md:text-3xl font-bold text-base-content">
|
9
|
-
<slot />
|
10
|
-
</p>
|
11
|
-
</div>
|
12
|
-
</div>
|
13
|
-
</div>
|
14
|
-
</div>
|
15
|
-
</template>
|
package/dist/vue.ts
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
export * from './vue/TagList.vue';
|
2
|
-
export { default as AlertDialog } from './vue/AlertDialog.vue';
|
3
|
-
export * from './vue/BannerBox.vue';
|
4
|
-
export * from './vue/SmartHero.vue';
|
5
|
-
export * from './vue/ConfirmDialog.vue';
|
6
|
-
export * from './vue/FeatureButton.vue';
|
7
|
-
export * from './vue/FeatureCard.vue';
|
8
|
-
export * from './vue/FeatureGroup.vue';
|
9
|
-
export { default as iPhoneWindow } from './vue/iPhoneWindow.vue';
|
10
|
-
export * from './vue/ListItem.vue';
|
11
|
-
export { default as MacWindow } from './vue/MacWindow.vue';
|
12
|
-
export * from './vue/SmartBanner.vue';
|
13
|
-
export * from './vue/SmartLink.vue';
|
14
|
-
export * from './vue/WildBanner.vue';
|
File without changes
|