@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.
Files changed (152) hide show
  1. package/dist/app.css +1 -1
  2. package/dist/assets/iconData.ts +93 -0
  3. package/dist/components/base/Alert.astro +1 -1
  4. package/dist/components/base/Button.astro +102 -91
  5. package/dist/components/base/Image.astro +1 -1
  6. package/dist/components/base/Link.astro +1 -1
  7. package/dist/components/containers/Container.astro +1 -1
  8. package/dist/components/containers/Main.astro +1 -1
  9. package/dist/components/containers/Section.astro +96 -94
  10. package/dist/components/data-display/Blog.astro +1 -1
  11. package/dist/components/data-display/ProductCard.astro +2 -4
  12. package/dist/components/data-display/Products.astro +2 -2
  13. package/dist/components/data-display/TeamMember.astro +2 -4
  14. package/dist/components/data-display/TeamMembers.astro +1 -1
  15. package/dist/components/display/Banner.astro +1 -1
  16. package/dist/components/display/Card.astro +1 -1
  17. package/dist/components/display/CodeBlock.astro +1 -1
  18. package/dist/components/display/CodeExample.astro +1 -1
  19. package/dist/components/display/Hero.astro +1 -1
  20. package/dist/components/display/Modal.astro +1 -1
  21. package/dist/components/layouts/AppLayout.astro +2 -6
  22. package/dist/components/layouts/BaseLayout.astro +1 -1
  23. package/dist/components/layouts/DashboardLayout.astro +1 -1
  24. package/dist/components/layouts/Footer.astro +2 -5
  25. package/dist/components/layouts/Grid.astro +1 -1
  26. package/dist/components/layouts/Header.astro +1 -1
  27. package/dist/components/layouts/NavItems.astro +1 -1
  28. package/dist/components/layouts/Sidebar.astro +2 -2
  29. package/dist/components/layouts/SidebarNav.astro +1 -1
  30. package/dist/components/layouts/Stack.astro +72 -70
  31. package/dist/components/navigation/LanguageSwitcher.astro +2 -2
  32. package/dist/components/navigation/TableOfContents.astro +1 -1
  33. package/dist/components/navigation/ThemeSwitcher.astro +2 -2
  34. package/dist/components/typography/Article.astro +2 -2
  35. package/dist/components/typography/Heading.astro +2 -2
  36. package/dist/components/typography/Text.astro +1 -1
  37. package/dist/icons/AlertTriangle.astro +24 -0
  38. package/dist/icons/AstroIcon.astro +46 -0
  39. package/dist/icons/CalendarIcon.astro +24 -0
  40. package/dist/icons/CheckCircle.astro +23 -0
  41. package/dist/icons/CheckIcon.astro +27 -0
  42. package/dist/{components/icons → icons}/ChevronDownIcon.astro +3 -13
  43. package/dist/icons/ClipboardIcon.astro +27 -0
  44. package/dist/icons/CloseIcon.astro +27 -0
  45. package/dist/icons/ErrorIcon.astro +24 -0
  46. package/dist/icons/GithubIcon.astro +24 -0
  47. package/dist/icons/InfoCircle.astro +24 -0
  48. package/dist/icons/InfoIcon.astro +26 -0
  49. package/dist/icons/LinkIcon.astro +27 -0
  50. package/dist/icons/LinkedinIcon.astro +23 -0
  51. package/dist/icons/MenuIcon.astro +27 -0
  52. package/dist/icons/SearchIcon.astro +23 -0
  53. package/dist/icons/SettingsIcon.astro +18 -0
  54. package/dist/{components/icons → icons}/SocialIcon.astro +14 -14
  55. package/dist/icons/SuccessIcon.astro +24 -0
  56. package/dist/icons/SunCloudyIcon.astro +23 -0
  57. package/dist/icons/TwitterIcon.astro +24 -0
  58. package/dist/icons/UserIcon.astro +24 -0
  59. package/dist/icons/WarningIcon.astro +27 -0
  60. package/dist/icons/XCircle.astro +24 -0
  61. package/dist/index.ts +1 -1
  62. package/dist/index_icons.ts +23 -0
  63. package/dist/index_vue.ts +41 -0
  64. package/dist/vue/{AlertDialog.vue → AlertDialog/AlertDialog.vue} +1 -1
  65. package/dist/vue/AlertDialog/Basic.vue +38 -0
  66. package/dist/vue/AlertDialog/Multilang.vue +48 -0
  67. package/dist/vue/AlertDialog/index.ts +58 -0
  68. package/dist/vue/BannerBox/BannerBox.vue +296 -0
  69. package/dist/vue/BannerBox/DownloadButton.vue +202 -0
  70. package/dist/vue/BannerBox/ExampleBasic.vue +32 -0
  71. package/dist/vue/BannerBox/ExampleCustomBg.vue +32 -0
  72. package/dist/vue/BannerBox/ExampleDisplayModeAlways.vue +34 -0
  73. package/dist/vue/BannerBox/ExampleDisplayModeHover.vue +34 -0
  74. package/dist/vue/BannerBox/ExampleDisplayModeNever.vue +34 -0
  75. package/dist/vue/BannerBox/ExampleImageExport.vue +37 -0
  76. package/dist/vue/BannerBox/ExampleSizePreset.vue +35 -0
  77. package/dist/vue/{FeatureCard.vue → BannerBox/FeatureCard.vue} +28 -47
  78. package/dist/vue/BannerBox/SmartBanner.vue +44 -0
  79. package/dist/vue/BannerBox/bgStyles.ts +55 -0
  80. package/dist/vue/BannerBox/index.ts +83 -0
  81. package/dist/vue/BannerBox/sizePresets.ts +23 -0
  82. package/dist/vue/FeatureButton.vue +25 -26
  83. package/dist/vue/Icons/AlertTriangleIcon.vue +30 -0
  84. package/dist/vue/Icons/CalendarIcon.vue +30 -0
  85. package/dist/vue/Icons/CheckCircleIcon.vue +30 -0
  86. package/dist/vue/Icons/CheckIcon.vue +30 -0
  87. package/dist/vue/Icons/ChevronDownIcon.vue +30 -0
  88. package/dist/vue/Icons/ClipboardIcon.vue +30 -0
  89. package/dist/vue/Icons/CloseIcon.vue +30 -0
  90. package/dist/vue/Icons/InfoCircleIcon.vue +30 -0
  91. package/dist/vue/Icons/InfoIcon.vue +30 -0
  92. package/dist/vue/Icons/LinkIcon.vue +30 -0
  93. package/dist/vue/Icons/MenuIcon.vue +30 -0
  94. package/dist/vue/Icons/SearchIcon.vue +30 -0
  95. package/dist/vue/Icons/SettingsIcon.vue +30 -0
  96. package/dist/vue/Icons/UserIcon.vue +30 -0
  97. package/dist/vue/Icons/VueIcon.vue +76 -0
  98. package/dist/vue/Icons/XCircleIcon.vue +30 -0
  99. package/dist/vue/MacWindow/Basic.vue +11 -0
  100. package/dist/vue/MacWindow/CustomHeight.vue +13 -0
  101. package/dist/vue/{MacWindow.vue → MacWindow/MacWindow.vue} +70 -38
  102. package/dist/vue/MacWindow/WithEvents.vue +34 -0
  103. package/dist/vue/MacWindow/WithSidebar.vue +21 -0
  104. package/dist/vue/MacWindow/WithTabs.vue +21 -0
  105. package/dist/vue/MacWindow/WithToolbar.vue +43 -0
  106. package/dist/vue/MacWindow/index.ts +50 -0
  107. package/dist/vue/SmartHero.vue +28 -34
  108. package/dist/vue/VueCounter.vue +29 -0
  109. package/dist/vue/iPhone/Basic.vue +33 -0
  110. package/dist/vue/iPhone/CustomBackground.vue +33 -0
  111. package/dist/vue/iPhone/NoFrame.vue +33 -0
  112. package/dist/vue/iPhone/WeatherApp.vue +97 -0
  113. package/dist/vue/iPhone/assets/iPhone 14 Pro - Deep Purple - Landscape.png +0 -0
  114. package/dist/vue/iPhone/assets/iPhone 14 Pro - Deep Purple - Portrait.png +0 -0
  115. package/dist/vue/iPhone/assets/iPhone 14 Pro - Gold - Landscape.png +0 -0
  116. package/dist/vue/iPhone/assets/iPhone 14 Pro - Gold - Portrait.png +0 -0
  117. package/dist/vue/iPhone/assets/iPhone 14 Pro - Silver - Landscape.png +0 -0
  118. package/dist/vue/iPhone/assets/iPhone 14 Pro - Silver - Portrait.png +0 -0
  119. package/dist/vue/iPhone/assets/iPhone 14 Pro - Space Black - Landscape.png +0 -0
  120. package/dist/vue/iPhone/assets/iPhone 14 Pro - Space Black - Portrait.png +0 -0
  121. package/dist/vue/{iPhoneWindow.vue → iPhone/iPhoneWindow.vue} +11 -7
  122. package/dist/vue/iPhone/index.ts +41 -0
  123. package/package.json +13 -12
  124. package/dist/components/icons/AlertTriangle.astro +0 -35
  125. package/dist/components/icons/CalendarIcon.astro +0 -38
  126. package/dist/components/icons/CheckCircle.astro +0 -36
  127. package/dist/components/icons/CheckIcon.astro +0 -38
  128. package/dist/components/icons/ClipboardIcon.astro +0 -39
  129. package/dist/components/icons/CloseIcon.astro +0 -38
  130. package/dist/components/icons/ErrorIcon.astro +0 -35
  131. package/dist/components/icons/GithubIcon.astro +0 -31
  132. package/dist/components/icons/InfoCircle.astro +0 -37
  133. package/dist/components/icons/InfoIcon.astro +0 -38
  134. package/dist/components/icons/LinkIcon.astro +0 -39
  135. package/dist/components/icons/LinkedinIcon.astro +0 -31
  136. package/dist/components/icons/MenuIcon.astro +0 -38
  137. package/dist/components/icons/SearchIcon.astro +0 -36
  138. package/dist/components/icons/SettingsIcon.astro +0 -36
  139. package/dist/components/icons/SuccessIcon.astro +0 -35
  140. package/dist/components/icons/SunCloudyIcon.astro +0 -41
  141. package/dist/components/icons/TwitterIcon.astro +0 -31
  142. package/dist/components/icons/UserIcon.astro +0 -35
  143. package/dist/components/icons/WarningIcon.astro +0 -38
  144. package/dist/components/icons/XCircle.astro +0 -37
  145. package/dist/entities/Banner.ts +0 -105
  146. package/dist/icons.ts +0 -22
  147. package/dist/vue/BannerBox.vue +0 -267
  148. package/dist/vue/FeatureGroup.vue +0 -22
  149. package/dist/vue/SmartBanner.vue +0 -45
  150. package/dist/vue/WildBanner.vue +0 -15
  151. package/dist/vue.ts +0 -14
  152. /package/dist/{collection.ts → index_collection.ts} +0 -0
@@ -0,0 +1,37 @@
1
+ <!--
2
+ @component BannerBox.ImageExport
3
+
4
+ @description
5
+ BannerBox 组件的导出为图片示例,展示如何使用图片导出功能。
6
+
7
+ @usage
8
+ ```vue
9
+ <BannerBoxExamples.ImageExport />
10
+ ```
11
+ -->
12
+
13
+ <script lang="ts">
14
+ import '../../app.css'
15
+ import { defineComponent } from 'vue'
16
+ import BannerBox from './BannerBox.vue'
17
+
18
+ export default defineComponent({
19
+ name: 'BannerBoxImageExportExample',
20
+ components: {
21
+ BannerBox
22
+ }
23
+ })
24
+ </script>
25
+
26
+ <template>
27
+ <div>
28
+ <p class="cosy:mb-4">悬停在左上角显示下载按钮,点击可下载当前内容为图片。</p>
29
+ <BannerBox :backgroundClassIndex="8">
30
+ <div
31
+ class="cosy:flex cosy:flex-col cosy:items-center cosy:justify-center cosy:min-h-[200px] cosy:p-8 cosy:text-center">
32
+ <h2 class="cosy:text-3xl cosy:font-bold cosy:mb-4">可导出为图片的内容</h2>
33
+ <p class="cosy:text-lg">适用于创建社交媒体分享图、营销材料等场景</p>
34
+ </div>
35
+ </BannerBox>
36
+ </div>
37
+ </template>
@@ -0,0 +1,35 @@
1
+ <!--
2
+ @component BannerBox.SizePreset
3
+
4
+ @description
5
+ BannerBox 组件的尺寸预设示例,展示如何使用尺寸选择功能。
6
+
7
+ @usage
8
+ ```vue
9
+ <BannerBoxExamples.SizePreset />
10
+ ```
11
+ -->
12
+
13
+ <script lang="ts">
14
+ import '../../app.css'
15
+ import { defineComponent } from 'vue'
16
+ import BannerBox from './BannerBox.vue'
17
+
18
+ export default defineComponent({
19
+ name: 'BannerBoxSizePresetExample',
20
+ components: {
21
+ BannerBox
22
+ }
23
+ })
24
+ </script>
25
+
26
+ <template>
27
+ <div>
28
+ <p class="cosy:mb-4">悬停在左上角显示下载按钮,点击可切换尺寸。尺寸会保存在浏览器中。</p>
29
+ <BannerBox>
30
+ <div class="cosy:flex cosy:items-center cosy:justify-center cosy:min-h-[200px]">
31
+ <h2 class="cosy:text-3xl cosy:font-bold">点击左上角按钮切换尺寸</h2>
32
+ </div>
33
+ </BannerBox>
34
+ </div>
35
+ </template>
@@ -1,49 +1,3 @@
1
- <template>
2
- <component
3
- :is="link ? 'a' : 'div'"
4
- :href="link || undefined"
5
- :target="link ? '_blank' : undefined"
6
- :rel="link ? 'noopener noreferrer' : undefined"
7
- :class="[
8
- 'card bg-base-100/10 backdrop-blur-lg p-8 transition-all duration-300 hover:-translate-y-1 shadow-lg',
9
- {
10
- 'hover:bg-primary/15 cursor-pointer': link,
11
- 'cursor-default': !link
12
- }
13
- ]"
14
- >
15
- <div class="card-body p-0">
16
- <div class="mb-4">
17
- <component
18
- :is="icon"
19
- v-if="icon"
20
- class="text-4xl text-base-content"
21
- />
22
- <component
23
- :is="getPresetIcon"
24
- v-else-if="presetIcon"
25
- class="text-4xl text-base-content"
26
- />
27
- <div
28
- v-else
29
- class="text-4xl text-base-content"
30
- >
31
- {{ emoji }}
32
- </div>
33
- </div>
34
- <h3 class="card-title text-lg font-medium text-base-content">
35
- {{ title }}
36
- </h3>
37
- <p
38
- v-if="description"
39
- class="text-base-content/70"
40
- >
41
- {{ description }}
42
- </p>
43
- </div>
44
- </component>
45
- </template>
46
-
47
1
  <script setup lang="ts">
48
2
  import { computed, type Component } from 'vue';
49
3
  import {
@@ -206,4 +160,31 @@ const getPresetIcon = computed(() => {
206
160
  if (!props.presetIcon) return null;
207
161
  return presetIcons[props.presetIcon];
208
162
  });
209
- </script>
163
+ </script>
164
+
165
+ <template>
166
+ <component :is="link ? 'a' : 'div'" :href="link || undefined" :target="link ? '_blank' : undefined"
167
+ :rel="link ? 'noopener noreferrer' : undefined" :class="[
168
+ 'cosy:card cosy:no-underline cosy:bg-base-100/10 cosy:backdrop-blur-lg cosy:p-8 cosy:transition-all cosy:duration-300 cosy:hover:-translate-y-1 cosy:shadow-lg',
169
+ {
170
+ 'cosy:hover:bg-primary/15 cosy:cursor-pointer': link,
171
+ 'cosy:cursor-default': !link
172
+ }
173
+ ]">
174
+ <div class="card-body cosy:p-0">
175
+ <div class="cosy:mb-4">
176
+ <component :is="icon" v-if="icon" class="cosy:text-4xl cosy:text-base-content" />
177
+ <component :is="getPresetIcon" v-else-if="presetIcon" class="cosy:text-4xl cosy:text-base-content" />
178
+ <div v-else class="cosy:text-4xl cosy:text-base-content">
179
+ {{ emoji }}
180
+ </div>
181
+ </div>
182
+ <h3 class="card-title cosy:text-lg cosy:font-medium cosy:text-base-content">
183
+ {{ title }}
184
+ </h3>
185
+ <p v-if="description" class="cosy:text-base-content/70">
186
+ {{ description }}
187
+ </p>
188
+ </div>
189
+ </component>
190
+ </template>
@@ -0,0 +1,44 @@
1
+ <!--
2
+ @component BannerBox.SmartBanner
3
+
4
+ @description
5
+ BannerBox 组件的智能横幅模式示例,展示如何通过 title、description 和 features 属性创建结构化内容。
6
+
7
+ @usage
8
+ ```vue
9
+ <BannerBoxExamples.SmartBanner />
10
+ ```
11
+ -->
12
+
13
+ <script lang="ts">
14
+ import '../../app.css'
15
+ import { defineComponent } from 'vue'
16
+ import BannerBox from './BannerBox.vue'
17
+
18
+ export default defineComponent({
19
+ name: 'BannerBoxSmartBannerExample',
20
+ components: {
21
+ BannerBox
22
+ }
23
+ })
24
+ </script>
25
+
26
+ <template>
27
+ <BannerBox title="我们的产品特性" description="探索产品提供的所有强大功能" :features="[
28
+ {
29
+ emoji: '⚡',
30
+ title: '快速响应',
31
+ link: '#speed'
32
+ },
33
+ {
34
+ emoji: '🔒',
35
+ title: '安全可靠',
36
+ link: '#security'
37
+ },
38
+ {
39
+ emoji: '🌐',
40
+ title: '全球支持',
41
+ link: '#global'
42
+ }
43
+ ]" />
44
+ </template>
@@ -0,0 +1,55 @@
1
+ /**
2
+ * BannerBox组件的背景样式类列表
3
+ * 包含多种渐变和纯色背景
4
+ */
5
+ export const bgClasses = [
6
+ // 半透明渐变背景
7
+ 'cosy:bg-gradient-to-b cosy:from-blue-100/50 cosy:to-blue-200/50 dark:cosy:from-blue-500/10 dark:cosy:to-blue-200/10',
8
+ 'cosy:bg-gradient-to-b cosy:from-blue-200/50 cosy:to-purple-200/50 dark:cosy:from-blue-500/10 dark:cosy:to-purple-200/10',
9
+ 'cosy:bg-gradient-to-b cosy:from-yellow-200/50 cosy:to-green-200/50 dark:cosy:from-yellow-500/10 dark:cosy:to-green-200/10',
10
+ 'cosy:bg-gradient-to-b cosy:from-teal-200/50 cosy:to-blue-200/50 dark:cosy:from-teal-500/10 dark:cosy:to-blue-200/10',
11
+ 'cosy:bg-gradient-to-b cosy:from-pink-200/50 cosy:to-indigo-200/20 dark:cosy:from-pink-500/10 dark:cosy:to-indigo-200/10',
12
+ 'cosy:bg-gradient-to-b cosy:from-red-200/50 cosy:to-orange-200/50 dark:cosy:from-red-500/10 dark:cosy:to-orange-200/10',
13
+ 'cosy:bg-gradient-to-b cosy:from-orange-200/50 cosy:to-yellow-200/50 dark:cosy:from-orange-500/10 dark:cosy:to-yellow-200/10',
14
+ 'cosy:bg-gradient-to-b cosy:from-green-200/50 cosy:to-teal-200/50 dark:cosy:from-green-500/10 dark:cosy:to-teal-200/10',
15
+
16
+ // 不透明的背景
17
+ 'cosy:bg-gradient-to-b cosy:from-blue-100 cosy:to-blue-200 dark:cosy:from-blue-500 dark:cosy:to-blue-200',
18
+ 'cosy:bg-gradient-to-b cosy:from-blue-200 cosy:to-purple-200 dark:cosy:from-blue-500 dark:cosy:to-purple-200',
19
+ 'cosy:bg-gradient-to-b cosy:from-yellow-200 cosy:to-green-200 dark:cosy:from-yellow-500 dark:cosy:to-green-200',
20
+ 'cosy:bg-gradient-to-b cosy:from-teal-200 cosy:to-blue-200 dark:cosy:from-teal-500 dark:cosy:to-blue-200',
21
+ 'cosy:bg-gradient-to-b cosy:from-pink-200 cosy:to-red-200 dark:cosy:from-pink-500 dark:cosy:to-red-200',
22
+ 'cosy:bg-gradient-to-b cosy:from-red-200 cosy:to-orange-200 dark:cosy:from-red-500 dark:cosy:to-orange-200',
23
+ 'cosy:bg-gradient-to-b cosy:from-orange-200 cosy:to-yellow-200 dark:cosy:from-orange-500 dark:cosy:to-yellow-200',
24
+ 'cosy:bg-gradient-to-b cosy:from-green-200 cosy:to-teal-200 dark:cosy:from-green-500 dark:cosy:to-teal-200',
25
+
26
+ // 不透明的深色背景
27
+ 'cosy:bg-gradient-to-b cosy:from-blue-900 cosy:to-blue-200 dark:cosy:from-blue-900 dark:cosy:to-blue-200',
28
+ 'cosy:bg-gradient-to-b cosy:from-blue-900 cosy:to-purple-200 dark:cosy:from-blue-900 dark:cosy:to-purple-200',
29
+ 'cosy:bg-gradient-to-b cosy:from-yellow-900 cosy:to-green-200 dark:cosy:from-yellow-900 dark:cosy:to-green-200',
30
+ 'cosy:bg-gradient-to-b cosy:from-teal-900 cosy:to-blue-200 dark:cosy:from-teal-900 dark:cosy:to-blue-200',
31
+ 'cosy:bg-gradient-to-b cosy:from-pink-900 cosy:to-red-200 dark:cosy:from-pink-900 dark:cosy:to-red-200',
32
+ 'cosy:bg-gradient-to-b cosy:from-red-900 cosy:to-orange-200 dark:cosy:from-red-900 dark:cosy:to-orange-200',
33
+ 'cosy:bg-gradient-to-b cosy:from-orange-900 cosy:to-yellow-200 dark:cosy:from-orange-900 dark:cosy:to-yellow-200',
34
+ 'cosy:bg-gradient-to-b cosy:from-green-900 cosy:to-teal-900 dark:cosy:from-green-900 dark:cosy:to-teal-900',
35
+
36
+ // 不透明的渐变背景
37
+ 'cosy:bg-gradient-to-br cosy:from-emerald-400 cosy:to-cyan-400 dark:cosy:from-emerald-600 dark:cosy:to-cyan-600',
38
+ 'cosy:bg-gradient-to-br cosy:from-violet-400 cosy:to-fuchsia-400 dark:cosy:from-violet-600 dark:cosy:to-fuchsia-600',
39
+ 'cosy:bg-gradient-to-br cosy:from-amber-400 cosy:to-orange-400 dark:cosy:from-amber-600 dark:cosy:to-orange-600',
40
+ 'cosy:bg-gradient-to-br cosy:from-rose-400 cosy:to-pink-400 dark:cosy:from-rose-600 dark:cosy:to-pink-600',
41
+ 'cosy:bg-gradient-to-br cosy:from-sky-400 cosy:to-indigo-400 dark:cosy:from-sky-600 dark:cosy:to-indigo-600',
42
+ 'cosy:bg-gradient-to-br cosy:from-lime-400 cosy:to-emerald-400 dark:cosy:from-lime-600 dark:cosy:to-emerald-600',
43
+ 'cosy:bg-gradient-to-br cosy:from-purple-400 cosy:to-indigo-400 dark:cosy:from-purple-600 dark:cosy:to-indigo-600',
44
+ 'cosy:bg-gradient-to-br cosy:from-blue-400 cosy:to-violet-400 dark:cosy:from-blue-600 dark:cosy:to-violet-600',
45
+
46
+ // 纯色背景
47
+ 'cosy:bg-emerald-400 dark:cosy:bg-emerald-600',
48
+ 'cosy:bg-violet-400 dark:cosy:bg-violet-600',
49
+ 'cosy:bg-amber-400 dark:cosy:bg-amber-600',
50
+ 'cosy:bg-rose-400 dark:cosy:bg-rose-600',
51
+ 'cosy:bg-sky-400 dark:cosy:bg-sky-600',
52
+ 'cosy:bg-lime-400 dark:cosy:bg-lime-600',
53
+ 'cosy:bg-purple-400 dark:cosy:bg-purple-600',
54
+ 'cosy:bg-blue-400 dark:cosy:bg-blue-600',
55
+ ];
@@ -0,0 +1,83 @@
1
+ import Basic from './ExampleBasic.vue';
2
+ import CustomBg from './ExampleCustomBg.vue';
3
+ import DisplayModeAlways from './ExampleDisplayModeAlways.vue';
4
+ import DisplayModeHover from './ExampleDisplayModeHover.vue';
5
+ import DisplayModeNever from './ExampleDisplayModeNever.vue';
6
+ import SmartBanner from './SmartBanner.vue';
7
+ import SizePreset from './ExampleSizePreset.vue';
8
+ import ImageExport from './ExampleImageExport.vue';
9
+ import BasicSource from './ExampleBasic.vue?raw';
10
+ import CustomBgSource from './ExampleCustomBg.vue?raw';
11
+ import DisplayModeAlwaysSource from './ExampleDisplayModeAlways.vue?raw';
12
+ import DisplayModeHoverSource from './ExampleDisplayModeHover.vue?raw';
13
+ import DisplayModeNeverSource from './ExampleDisplayModeNever.vue?raw';
14
+ import SmartBannerSource from './SmartBanner.vue?raw';
15
+ import SizePresetSource from './ExampleSizePreset.vue?raw';
16
+ import ImageExportSource from './ExampleImageExport.vue?raw';
17
+
18
+ // 提取简单示例源代码函数
19
+ function extractSimpleExample(source: string): string {
20
+ // 提取模板部分
21
+ const templateMatch = source.match(/<template>([\s\S]*)<\/template>/m);
22
+ const scriptMatch = source.match(/<script[\s\S]*?>([\s\S]*)<\/script>/m);
23
+
24
+ if (!templateMatch) {
25
+ return source;
26
+ }
27
+
28
+ let importSection = `<script setup>
29
+ import { BannerBox } from 'cosy-ui'
30
+ `;
31
+
32
+ // 从源码中提取导入语句(除了组件的导入和app.css)
33
+ if (scriptMatch && scriptMatch[1]) {
34
+ const importLines = scriptMatch[1]
35
+ .split('\n')
36
+ .filter(
37
+ (line) =>
38
+ line.includes('import') && !line.includes('../../app.css') && !line.includes('BannerBox')
39
+ );
40
+
41
+ if (importLines.length > 0) {
42
+ importSection += importLines.join('\n') + '\n';
43
+ }
44
+ }
45
+
46
+ importSection += '</script>\n\n';
47
+
48
+ // 提取模板内容,并替换组件路径
49
+ const templateContent = templateMatch[1].replace('../BannerBox.vue', 'BannerBox');
50
+
51
+ return importSection + '<template>' + templateContent + '</template>';
52
+ }
53
+
54
+ // 获取 BannerBox 和 FeatureCard 组件
55
+ export { default as BannerBox } from './BannerBox.vue';
56
+ export { default as FeatureCard } from './FeatureCard.vue';
57
+ export { default as DownloadButton } from './DownloadButton.vue';
58
+ export { bgClasses } from './bgStyles';
59
+ export { sizePresets, type SizePreset } from './sizePresets';
60
+
61
+ // 导出示例组件
62
+ export const BannerBoxExamples = {
63
+ Basic,
64
+ CustomBg,
65
+ DisplayModeAlways,
66
+ DisplayModeHover,
67
+ DisplayModeNever,
68
+ SmartBanner,
69
+ SizePreset,
70
+ ImageExport,
71
+ };
72
+
73
+ // 导出示例源代码
74
+ export const BannerBoxExampleCodes = {
75
+ Basic: extractSimpleExample(BasicSource),
76
+ CustomBg: extractSimpleExample(CustomBgSource),
77
+ DisplayModeAlways: extractSimpleExample(DisplayModeAlwaysSource),
78
+ DisplayModeHover: extractSimpleExample(DisplayModeHoverSource),
79
+ DisplayModeNever: extractSimpleExample(DisplayModeNeverSource),
80
+ SmartBanner: extractSimpleExample(SmartBannerSource),
81
+ SizePreset: extractSimpleExample(SizePresetSource),
82
+ ImageExport: extractSimpleExample(ImageExportSource),
83
+ };
@@ -0,0 +1,23 @@
1
+ /**
2
+ * BannerBox组件的尺寸预设列表
3
+ * 包含各种常用尺寸和比例
4
+ */
5
+
6
+ export interface SizePreset {
7
+ name: string;
8
+ width: string;
9
+ height: string;
10
+ }
11
+
12
+ export const sizePresets: SizePreset[] = [
13
+ { name: 'Default', width: 'cosy:w-full', height: 'cosy:h-full' },
14
+ { name: 'Square', width: 'cosy:w-[600px]', height: 'cosy:h-[600px]' },
15
+ { name: 'Landscape', width: 'cosy:w-[800px]', height: 'cosy:h-[450px]' },
16
+ { name: 'Portrait', width: 'cosy:w-[450px]', height: 'cosy:h-[800px]' },
17
+ { name: 'Wide', width: 'cosy:w-[1200px]', height: 'cosy:h-[675px]' },
18
+ { name: 'Banner', width: 'cosy:w-[1200px]', height: 'cosy:h-[300px]' },
19
+ { name: '1280 × 800', width: 'cosy:w-[1280px]', height: 'cosy:h-[800px]' },
20
+ { name: '1440 × 900', width: 'cosy:w-[1440px]', height: 'cosy:h-[900px]' },
21
+ { name: '2560 × 1600', width: 'cosy:w-[2560px]', height: 'cosy:h-[1600px]' },
22
+ { name: '2880 × 1800', width: 'cosy:w-[2880px]', height: 'cosy:h-[1800px]' },
23
+ ];
@@ -1,30 +1,23 @@
1
1
  <template>
2
- <div>
3
- <!-- Button with hover effects -->
4
- <button
5
- :class="[
6
- 'bg-cyan-500/20 p-4 rounded-2xl text-center backdrop-blur-lg text-2xl transition-all duration-300 hover:scale-105 hover:bg-cyan-500/30',
7
- props.size
8
- ]"
9
- @click="showPopup"
10
- >
11
- <slot />
12
- {{ props.title }}
13
- </button>
2
+ <div>
3
+ <!-- Button with hover effects -->
4
+ <button :class="[
5
+ 'bg-cyan-500/20 p-4 rounded-2xl text-center backdrop-blur-lg text-2xl transition-all duration-300 hover:scale-105 hover:bg-cyan-500/30',
6
+ props.size
7
+ ]" @click="showPopup">
8
+ <slot />
9
+ {{ props.title }}
10
+ </button>
14
11
 
15
- <!-- Popup message -->
16
- <Transition name="fade">
17
- <div
18
- v-if="isPopupVisible"
19
- class="fixed inset-0 flex items-center justify-center z-50"
20
- @click="hidePopup"
21
- >
22
- <div class="bg-black/80 backdrop-blur-sm p-6 rounded-xl text-white animate-popup">
23
- {{ lang === 'zh' ? '这是展示图,不支持操作' : 'This is a preview image, no operation is supported' }}
24
- </div>
25
- </div>
26
- </Transition>
27
- </div>
12
+ <!-- Popup message -->
13
+ <Transition name="fade">
14
+ <div v-if="isPopupVisible" class="fixed inset-0 flex items-center justify-center z-50" @click="hidePopup">
15
+ <div class="bg-black/80 backdrop-blur-sm p-6 rounded-xl text-white animate-popup">
16
+ {{ lang === 'zh' ? '这是展示图,不支持操作' : 'This is a preview image, no operation is supported' }}
17
+ </div>
18
+ </div>
19
+ </Transition>
20
+ </div>
28
21
  </template>
29
22
 
30
23
  <script setup lang="ts">
@@ -92,4 +85,10 @@ const hidePopup = () => {
92
85
  opacity: 1;
93
86
  }
94
87
  }
95
- </style>
88
+ </style>
89
+
90
+ <script lang="ts">
91
+ export default {
92
+ name: 'FeatureButton'
93
+ }
94
+ </script>
@@ -0,0 +1,30 @@
1
+ <script setup lang="ts">
2
+ import Icon from './VueIcon.vue';
3
+
4
+ interface Props {
5
+ /**
6
+ * 图标的大小
7
+ * @default "24px"
8
+ */
9
+ size?: string;
10
+ /**
11
+ * 图标的颜色
12
+ * @default "currentColor"
13
+ */
14
+ color?: string;
15
+ /**
16
+ * 自定义类名
17
+ */
18
+ class?: string;
19
+ }
20
+
21
+ const props = withDefaults(defineProps<Props>(), {
22
+ size: '24px',
23
+ color: 'currentColor',
24
+ class: ''
25
+ });
26
+ </script>
27
+
28
+ <template>
29
+ <Icon name="alertTriangle" :size="size" :color="color" :class="props.class" />
30
+ </template>
@@ -0,0 +1,30 @@
1
+ <script setup lang="ts">
2
+ import Icon from './VueIcon.vue';
3
+
4
+ interface Props {
5
+ /**
6
+ * 图标的大小
7
+ * @default "24px"
8
+ */
9
+ size?: string;
10
+ /**
11
+ * 图标的颜色
12
+ * @default "currentColor"
13
+ */
14
+ color?: string;
15
+ /**
16
+ * 自定义类名
17
+ */
18
+ class?: string;
19
+ }
20
+
21
+ const props = withDefaults(defineProps<Props>(), {
22
+ size: '24px',
23
+ color: 'currentColor',
24
+ class: ''
25
+ });
26
+ </script>
27
+
28
+ <template>
29
+ <Icon name="calendar" :size="size" :color="color" :class="props.class" />
30
+ </template>
@@ -0,0 +1,30 @@
1
+ <script setup lang="ts">
2
+ import Icon from './VueIcon.vue';
3
+
4
+ interface Props {
5
+ /**
6
+ * 图标的大小
7
+ * @default "24px"
8
+ */
9
+ size?: string;
10
+ /**
11
+ * 图标的颜色
12
+ * @default "currentColor"
13
+ */
14
+ color?: string;
15
+ /**
16
+ * 自定义类名
17
+ */
18
+ class?: string;
19
+ }
20
+
21
+ const props = withDefaults(defineProps<Props>(), {
22
+ size: '24px',
23
+ color: 'currentColor',
24
+ class: ''
25
+ });
26
+ </script>
27
+
28
+ <template>
29
+ <Icon name="checkCircle" :size="size" :color="color" :class="props.class" />
30
+ </template>
@@ -0,0 +1,30 @@
1
+ <script setup lang="ts">
2
+ import Icon from './VueIcon.vue';
3
+
4
+ interface Props {
5
+ /**
6
+ * 图标的大小
7
+ * @default "24px"
8
+ */
9
+ size?: string;
10
+ /**
11
+ * 图标的颜色
12
+ * @default "currentColor"
13
+ */
14
+ color?: string;
15
+ /**
16
+ * 自定义类名
17
+ */
18
+ class?: string;
19
+ }
20
+
21
+ const props = withDefaults(defineProps<Props>(), {
22
+ size: '24px',
23
+ color: 'currentColor',
24
+ class: ''
25
+ });
26
+ </script>
27
+
28
+ <template>
29
+ <Icon name="check" :size="size" :color="color" :class="props.class" />
30
+ </template>
@@ -0,0 +1,30 @@
1
+ <script setup lang="ts">
2
+ import Icon from './VueIcon.vue';
3
+
4
+ interface Props {
5
+ /**
6
+ * 图标的大小
7
+ * @default "24px"
8
+ */
9
+ size?: string;
10
+ /**
11
+ * 图标的颜色
12
+ * @default "currentColor"
13
+ */
14
+ color?: string;
15
+ /**
16
+ * 自定义类名
17
+ */
18
+ class?: string;
19
+ }
20
+
21
+ const props = withDefaults(defineProps<Props>(), {
22
+ size: '24px',
23
+ color: 'currentColor',
24
+ class: ''
25
+ });
26
+ </script>
27
+
28
+ <template>
29
+ <Icon name="chevronDown" :size="size" :color="color" :class="props.class" />
30
+ </template>
@@ -0,0 +1,30 @@
1
+ <script setup lang="ts">
2
+ import Icon from './VueIcon.vue';
3
+
4
+ interface Props {
5
+ /**
6
+ * 图标的大小
7
+ * @default "24px"
8
+ */
9
+ size?: string;
10
+ /**
11
+ * 图标的颜色
12
+ * @default "currentColor"
13
+ */
14
+ color?: string;
15
+ /**
16
+ * 自定义类名
17
+ */
18
+ class?: string;
19
+ }
20
+
21
+ const props = withDefaults(defineProps<Props>(), {
22
+ size: '24px',
23
+ color: 'currentColor',
24
+ class: ''
25
+ });
26
+ </script>
27
+
28
+ <template>
29
+ <Icon name="clipboard" :size="size" :color="color" :class="props.class" />
30
+ </template>
@@ -0,0 +1,30 @@
1
+ <script setup lang="ts">
2
+ import Icon from './VueIcon.vue';
3
+
4
+ interface Props {
5
+ /**
6
+ * 图标的大小
7
+ * @default "24px"
8
+ */
9
+ size?: string;
10
+ /**
11
+ * 图标的颜色
12
+ * @default "currentColor"
13
+ */
14
+ color?: string;
15
+ /**
16
+ * 自定义类名
17
+ */
18
+ class?: string;
19
+ }
20
+
21
+ const props = withDefaults(defineProps<Props>(), {
22
+ size: '24px',
23
+ color: 'currentColor',
24
+ class: ''
25
+ });
26
+ </script>
27
+
28
+ <template>
29
+ <Icon name="close" :size="size" :color="color" :class="props.class" />
30
+ </template>
@@ -0,0 +1,30 @@
1
+ <script setup lang="ts">
2
+ import Icon from './VueIcon.vue';
3
+
4
+ interface Props {
5
+ /**
6
+ * 图标的大小
7
+ * @default "24px"
8
+ */
9
+ size?: string;
10
+ /**
11
+ * 图标的颜色
12
+ * @default "currentColor"
13
+ */
14
+ color?: string;
15
+ /**
16
+ * 自定义类名
17
+ */
18
+ class?: string;
19
+ }
20
+
21
+ const props = withDefaults(defineProps<Props>(), {
22
+ size: '24px',
23
+ color: 'currentColor',
24
+ class: ''
25
+ });
26
+ </script>
27
+
28
+ <template>
29
+ <Icon name="infoCircle" :size="size" :color="color" :class="props.class" />
30
+ </template>