@coffic/cosy-ui 0.6.12 → 0.6.14
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 +435 -0
- package/dist/vue/BannerBox/Basic.vue +32 -0
- package/dist/vue/BannerBox/CustomBg.vue +32 -0
- package/dist/vue/BannerBox/CustomComponent.vue +60 -0
- package/dist/vue/BannerBox/DisplayMode.vue +49 -0
- package/dist/vue/{FeatureCard.vue → BannerBox/FeatureCard.vue} +23 -42
- package/dist/vue/BannerBox/ImageExport.vue +37 -0
- package/dist/vue/BannerBox/SizePreset.vue +35 -0
- package/dist/vue/BannerBox/SmartBanner.vue +44 -0
- package/dist/vue/BannerBox/index.ts +76 -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/dist/vue/shims-vue.d.ts +5 -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
@@ -0,0 +1,29 @@
|
|
1
|
+
<!-- 简单的Vue计数器组件 -->
|
2
|
+
<script setup lang="ts">
|
3
|
+
import { ref } from 'vue';
|
4
|
+
|
5
|
+
const count = ref(0);
|
6
|
+
|
7
|
+
const increment = () => {
|
8
|
+
count.value++;
|
9
|
+
};
|
10
|
+
|
11
|
+
const decrement = () => {
|
12
|
+
count.value--;
|
13
|
+
};
|
14
|
+
</script>
|
15
|
+
|
16
|
+
<template>
|
17
|
+
<div class="cosy:p-4 cosy:bg-base-200 cosy:rounded-lg cosy:shadow-md cosy:max-w-xs cosy:mx-auto">
|
18
|
+
<h2 class="cosy:text-xl cosy:font-bold cosy:mb-4 cosy:text-center">Vue 计数器测试</h2>
|
19
|
+
<div class="cosy:flex cosy:items-center cosy:justify-center cosy:gap-4">
|
20
|
+
<button @click="decrement" class="cosy:btn cosy:btn-primary">
|
21
|
+
-
|
22
|
+
</button>
|
23
|
+
<span class="cosy:text-2xl cosy:font-bold">{{ count }}</span>
|
24
|
+
<button @click="increment" class="cosy:btn cosy:btn-primary">
|
25
|
+
+
|
26
|
+
</button>
|
27
|
+
</div>
|
28
|
+
</div>
|
29
|
+
</template>
|
@@ -0,0 +1,33 @@
|
|
1
|
+
<!--
|
2
|
+
@component iPhoneWindow.Basic
|
3
|
+
|
4
|
+
@description
|
5
|
+
iPhoneWindow 组件的基础示例,展示最基本的 iPhone 窗口外观。
|
6
|
+
|
7
|
+
@usage
|
8
|
+
```vue
|
9
|
+
<iPhoneWindowExamples.Basic />
|
10
|
+
```
|
11
|
+
-->
|
12
|
+
|
13
|
+
<script lang="ts">
|
14
|
+
import '../../app.css'
|
15
|
+
import { defineComponent } from 'vue'
|
16
|
+
import iPhoneWindow from './iPhoneWindow.vue'
|
17
|
+
|
18
|
+
export default defineComponent({
|
19
|
+
name: 'iPhoneWindowBasicExample',
|
20
|
+
components: {
|
21
|
+
iPhoneWindow
|
22
|
+
}
|
23
|
+
})
|
24
|
+
</script>
|
25
|
+
|
26
|
+
<template>
|
27
|
+
<iPhoneWindow>
|
28
|
+
<div class="cosy:p-4 cosy:text-center">
|
29
|
+
<h2 class="cosy:text-xl cosy:font-bold cosy:mb-2">我的应用</h2>
|
30
|
+
<p>这是一个 iPhone 风格的应用界面</p>
|
31
|
+
</div>
|
32
|
+
</iPhoneWindow>
|
33
|
+
</template>
|
@@ -0,0 +1,33 @@
|
|
1
|
+
<!--
|
2
|
+
@component iPhoneWindow.CustomBackground
|
3
|
+
|
4
|
+
@description
|
5
|
+
自定义背景色的 iPhone 窗口示例,展示如何设置不同的背景色。
|
6
|
+
|
7
|
+
@usage
|
8
|
+
```vue
|
9
|
+
<iPhoneWindowExamples.CustomBackground />
|
10
|
+
```
|
11
|
+
-->
|
12
|
+
|
13
|
+
<script lang="ts">
|
14
|
+
import '../../app.css'
|
15
|
+
import { defineComponent } from 'vue'
|
16
|
+
import iPhoneWindow from './iPhoneWindow.vue'
|
17
|
+
|
18
|
+
export default defineComponent({
|
19
|
+
name: 'iPhoneWindowCustomBackgroundExample',
|
20
|
+
components: {
|
21
|
+
iPhoneWindow
|
22
|
+
}
|
23
|
+
})
|
24
|
+
</script>
|
25
|
+
|
26
|
+
<template>
|
27
|
+
<iPhoneWindow backgroundColor="cosy:bg-blue-50">
|
28
|
+
<div class="cosy:p-4 cosy:text-center">
|
29
|
+
<h2 class="cosy:text-xl cosy:font-bold cosy:mb-2 cosy:text-blue-800">蓝色主题</h2>
|
30
|
+
<p class="cosy:text-blue-600">自定义背景色的应用界面</p>
|
31
|
+
</div>
|
32
|
+
</iPhoneWindow>
|
33
|
+
</template>
|
@@ -0,0 +1,33 @@
|
|
1
|
+
<!--
|
2
|
+
@component iPhoneWindow.NoFrame
|
3
|
+
|
4
|
+
@description
|
5
|
+
不显示边框的 iPhone 窗口示例,只展示内容区域。
|
6
|
+
|
7
|
+
@usage
|
8
|
+
```vue
|
9
|
+
<iPhoneWindowExamples.NoFrame />
|
10
|
+
```
|
11
|
+
-->
|
12
|
+
|
13
|
+
<script lang="ts">
|
14
|
+
import '../../app.css'
|
15
|
+
import { defineComponent } from 'vue'
|
16
|
+
import iPhoneWindow from './iPhoneWindow.vue'
|
17
|
+
|
18
|
+
export default defineComponent({
|
19
|
+
name: 'iPhoneWindowNoFrameExample',
|
20
|
+
components: {
|
21
|
+
iPhoneWindow
|
22
|
+
}
|
23
|
+
})
|
24
|
+
</script>
|
25
|
+
|
26
|
+
<template>
|
27
|
+
<iPhoneWindow :showFrame="false">
|
28
|
+
<div class="cosy:p-4 cosy:text-center">
|
29
|
+
<h2 class="cosy:text-xl cosy:font-bold cosy:mb-2">纯界面模式</h2>
|
30
|
+
<p>不显示 iPhone 边框,只展示内容</p>
|
31
|
+
</div>
|
32
|
+
</iPhoneWindow>
|
33
|
+
</template>
|
@@ -0,0 +1,97 @@
|
|
1
|
+
<!--
|
2
|
+
@component iPhoneWindow.WeatherApp
|
3
|
+
|
4
|
+
@description
|
5
|
+
天气应用示例,展示一个更复杂的 iPhone 应用界面,包含标题栏、主内容区和底部导航。
|
6
|
+
|
7
|
+
@usage
|
8
|
+
```vue
|
9
|
+
<iPhoneWindowExamples.WeatherApp />
|
10
|
+
```
|
11
|
+
-->
|
12
|
+
|
13
|
+
<script lang="ts">
|
14
|
+
import '../../app.css'
|
15
|
+
import { defineComponent } from 'vue'
|
16
|
+
import iPhoneWindow from './iPhoneWindow.vue'
|
17
|
+
|
18
|
+
export default defineComponent({
|
19
|
+
name: 'iPhoneWindowWeatherAppExample',
|
20
|
+
components: {
|
21
|
+
iPhoneWindow
|
22
|
+
}
|
23
|
+
})
|
24
|
+
</script>
|
25
|
+
|
26
|
+
<template>
|
27
|
+
<iPhoneWindow>
|
28
|
+
<div class="cosy:flex cosy:flex-col cosy:h-full">
|
29
|
+
<!-- 应用标题栏 -->
|
30
|
+
<div
|
31
|
+
class="cosy:bg-primary cosy:text-white cosy:px-4 cosy:py-3 cosy:flex cosy:items-center cosy:justify-between">
|
32
|
+
<h2 class="cosy:font-medium">天气预报</h2>
|
33
|
+
<button class="cosy:btn cosy:btn-ghost cosy:btn-sm cosy:p-1">
|
34
|
+
<svg xmlns="http://www.w3.org/2000/svg" class="cosy:h-5 cosy:w-5" viewBox="0 0 20 20"
|
35
|
+
fill="currentColor">
|
36
|
+
<path fill-rule="evenodd"
|
37
|
+
d="M3 5a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zm0 5a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zm0 5a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1z"
|
38
|
+
clip-rule="evenodd" />
|
39
|
+
</svg>
|
40
|
+
</button>
|
41
|
+
</div>
|
42
|
+
|
43
|
+
<!-- 主要内容 -->
|
44
|
+
<div class="cosy:flex-1 cosy:p-4 cosy:bg-gradient-to-b cosy:from-blue-400 cosy:to-blue-600">
|
45
|
+
<div class="cosy:text-center cosy:text-white">
|
46
|
+
<div class="cosy:text-5xl cosy:font-light cosy:mb-2">23°</div>
|
47
|
+
<div class="cosy:text-xl cosy:mb-4">晴朗</div>
|
48
|
+
<div class="cosy:text-sm cosy:opacity-90">上海市,今天</div>
|
49
|
+
</div>
|
50
|
+
|
51
|
+
<div class="cosy:mt-8 cosy:bg-white/20 cosy:backdrop-blur-sm cosy:rounded-xl cosy:p-4">
|
52
|
+
<div class="cosy:grid cosy:grid-cols-3 cosy:gap-4 cosy:text-center cosy:text-white">
|
53
|
+
<div>
|
54
|
+
<div class="cosy:text-sm cosy:opacity-80">湿度</div>
|
55
|
+
<div class="cosy:font-medium">68%</div>
|
56
|
+
</div>
|
57
|
+
<div>
|
58
|
+
<div class="cosy:text-sm cosy:opacity-80">风速</div>
|
59
|
+
<div class="cosy:font-medium">8 km/h</div>
|
60
|
+
</div>
|
61
|
+
<div>
|
62
|
+
<div class="cosy:text-sm cosy:opacity-80">能见度</div>
|
63
|
+
<div class="cosy:font-medium">10 km</div>
|
64
|
+
</div>
|
65
|
+
</div>
|
66
|
+
</div>
|
67
|
+
</div>
|
68
|
+
|
69
|
+
<!-- 底部导航 -->
|
70
|
+
<div class="cosy:bg-white cosy:border-t cosy:border-gray-200 cosy:flex cosy:justify-around cosy:py-2">
|
71
|
+
<button class="cosy:p-2 cosy:text-primary">
|
72
|
+
<svg xmlns="http://www.w3.org/2000/svg" class="cosy:h-6 cosy:w-6" fill="none" viewBox="0 0 24 24"
|
73
|
+
stroke="currentColor">
|
74
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
75
|
+
d="M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6" />
|
76
|
+
</svg>
|
77
|
+
</button>
|
78
|
+
<button class="cosy:p-2">
|
79
|
+
<svg xmlns="http://www.w3.org/2000/svg" class="cosy:h-6 cosy:w-6" fill="none" viewBox="0 0 24 24"
|
80
|
+
stroke="currentColor">
|
81
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
82
|
+
d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
|
83
|
+
</svg>
|
84
|
+
</button>
|
85
|
+
<button class="cosy:p-2">
|
86
|
+
<svg xmlns="http://www.w3.org/2000/svg" class="cosy:h-6 cosy:w-6" fill="none" viewBox="0 0 24 24"
|
87
|
+
stroke="currentColor">
|
88
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
89
|
+
d="M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z" />
|
90
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
91
|
+
d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" />
|
92
|
+
</svg>
|
93
|
+
</button>
|
94
|
+
</div>
|
95
|
+
</div>
|
96
|
+
</iPhoneWindow>
|
97
|
+
</template>
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -41,9 +41,11 @@ iPhoneWindow 组件模拟 iPhone 设备的外观,包含状态栏、时间显
|
|
41
41
|
@emits
|
42
42
|
-->
|
43
43
|
<script lang="ts">
|
44
|
-
import '
|
45
|
-
import AlertDialog from '
|
44
|
+
import '../../style.ts'
|
45
|
+
import { AlertDialog } from '../../index_vue'
|
46
46
|
import { ref, onMounted, onUnmounted, defineComponent } from 'vue'
|
47
|
+
// 导入内部图片资源
|
48
|
+
import iphoneFrame from './assets/iPhone 14 Pro - Deep Purple - Portrait.png'
|
47
49
|
|
48
50
|
export default defineComponent({
|
49
51
|
name: 'iPhoneWindow',
|
@@ -79,9 +81,11 @@ export default defineComponent({
|
|
79
81
|
setup() {
|
80
82
|
const showAlertDialog = ref(false)
|
81
83
|
const alertMessage = ref('')
|
82
|
-
|
83
84
|
const currentTime = ref('12:00')
|
84
85
|
|
86
|
+
// 获取图片URL
|
87
|
+
const frameSrc = typeof iphoneFrame === 'string' ? iphoneFrame : iphoneFrame.src
|
88
|
+
|
85
89
|
// 更新时间的函数
|
86
90
|
const updateTime = () => {
|
87
91
|
const now = new Date()
|
@@ -106,7 +110,8 @@ export default defineComponent({
|
|
106
110
|
return {
|
107
111
|
showAlertDialog,
|
108
112
|
alertMessage,
|
109
|
-
currentTime
|
113
|
+
currentTime,
|
114
|
+
frameSrc
|
110
115
|
}
|
111
116
|
}
|
112
117
|
})
|
@@ -116,9 +121,8 @@ export default defineComponent({
|
|
116
121
|
<div class="cosy:relative cosy:w-full">
|
117
122
|
<div class="cosy:relative cosy:aspect-[9/19.5]">
|
118
123
|
<!-- iPhone 边框 (放在最底层) -->
|
119
|
-
<img v-if="showFrame"
|
120
|
-
|
121
|
-
alt="iPhone frame" class="cosy:absolute cosy:inset-0 cosy:w-full cosy:h-full cosy:object-contain">
|
124
|
+
<img v-if="showFrame" :src="frameSrc" alt="iPhone frame"
|
125
|
+
class="cosy:absolute cosy:inset-0 cosy:w-full cosy:h-full cosy:object-contain">
|
122
126
|
|
123
127
|
<!-- 内容区域 -->
|
124
128
|
<div :class="[
|
@@ -0,0 +1,41 @@
|
|
1
|
+
import Basic from './Basic.vue';
|
2
|
+
import WeatherApp from './WeatherApp.vue';
|
3
|
+
import NoFrame from './NoFrame.vue';
|
4
|
+
import CustomBackground from './CustomBackground.vue';
|
5
|
+
import BasicSource from './Basic.vue?raw';
|
6
|
+
import NoFrameSource from './NoFrame.vue?raw';
|
7
|
+
import CustomBackgroundSource from './CustomBackground.vue?raw';
|
8
|
+
import WeatherAppSource from './WeatherApp.vue?raw';
|
9
|
+
|
10
|
+
// 转换Vue SFC组件为简化的示例代码(只保留template和setup script)
|
11
|
+
function extractSimpleExample(source: string): string {
|
12
|
+
// 提取模板部分
|
13
|
+
const templateMatch = source.match(/<template>([\s\S]*?)<\/template>/);
|
14
|
+
const template = templateMatch ? templateMatch[1].trim() : '';
|
15
|
+
|
16
|
+
// 创建简化版本的代码
|
17
|
+
return `<template>${template}</template>
|
18
|
+
|
19
|
+
<script setup>
|
20
|
+
import { iPhoneWindow } from 'cosy-ui';
|
21
|
+
</script>`;
|
22
|
+
}
|
23
|
+
|
24
|
+
// 导出主组件
|
25
|
+
export { default as iPhoneWindow } from './iPhoneWindow.vue';
|
26
|
+
|
27
|
+
// 将示例组件整合为一个对象导出
|
28
|
+
export const iPhoneWindowExamples = {
|
29
|
+
Basic,
|
30
|
+
WeatherApp,
|
31
|
+
NoFrame,
|
32
|
+
CustomBackground,
|
33
|
+
};
|
34
|
+
|
35
|
+
// 导出示例组件的源代码(简化版本)
|
36
|
+
export const iPhoneWindowExampleCodes = {
|
37
|
+
Basic: extractSimpleExample(BasicSource),
|
38
|
+
NoFrame: extractSimpleExample(NoFrameSource),
|
39
|
+
CustomBackground: extractSimpleExample(CustomBackgroundSource),
|
40
|
+
WeatherApp: extractSimpleExample(WeatherAppSource),
|
41
|
+
};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@coffic/cosy-ui",
|
3
|
-
"version": "0.6.
|
3
|
+
"version": "0.6.14",
|
4
4
|
"description": "An astro component library",
|
5
5
|
"author": {
|
6
6
|
"name": "nookery",
|
@@ -25,9 +25,9 @@
|
|
25
25
|
"main": "./dist/index.js",
|
26
26
|
"exports": {
|
27
27
|
".": "./dist/index.js",
|
28
|
-
"./collection": "./dist/
|
29
|
-
"./icons": "./dist/
|
30
|
-
"./vue": "./dist/
|
28
|
+
"./collection": "./dist/index_collection.js",
|
29
|
+
"./icons": "./dist/index_icons.js",
|
30
|
+
"./vue": "./dist/index_vue.js"
|
31
31
|
},
|
32
32
|
"files": [
|
33
33
|
"dist",
|
@@ -37,7 +37,8 @@
|
|
37
37
|
"dev": "astro dev --host 0.0.0.0 --port 6677",
|
38
38
|
"preview:docs": "astro preview --host 0.0.0.0 --port 4330 --outDir dist-docs",
|
39
39
|
"preview": "npm run preview:docs",
|
40
|
-
"build": "
|
40
|
+
"build": "npm run build:cosy && npm run build:docs",
|
41
|
+
"build:cosy": "vite build && tsx scripts/post-build.ts",
|
41
42
|
"build:docs": "astro build",
|
42
43
|
"check": "astro check",
|
43
44
|
"lint": "eslint ."
|
@@ -59,15 +60,15 @@
|
|
59
60
|
"@astrojs/vue": "^5.0.13",
|
60
61
|
"@eslint/js": "^9.26.0",
|
61
62
|
"@tailwindcss/typography": "^0.5.16",
|
62
|
-
"@tailwindcss/vite": "^4.1.
|
63
|
+
"@tailwindcss/vite": "^4.1.6",
|
63
64
|
"@types/chai": "^5.2.2",
|
64
65
|
"@types/eslint": "^9.6.1",
|
65
66
|
"@types/fs-extra": "^11.0.4",
|
66
67
|
"@types/mocha": "^10.0.10",
|
67
|
-
"@types/node": "^22.15.
|
68
|
-
"@types/react": "^19.1.
|
69
|
-
"@typescript-eslint/parser": "^8.32.
|
70
|
-
"astro": "^5.7.
|
68
|
+
"@types/node": "^22.15.18",
|
69
|
+
"@types/react": "^19.1.4",
|
70
|
+
"@typescript-eslint/parser": "^8.32.1",
|
71
|
+
"astro": "^5.7.13",
|
71
72
|
"chai": "^4.5.0",
|
72
73
|
"daisyui": "^5.0.35",
|
73
74
|
"eslint": "^9.26.0",
|
@@ -78,10 +79,10 @@
|
|
78
79
|
"prettier-plugin-astro": "^0.14.1",
|
79
80
|
"rollup-plugin-copy": "^3.5.0",
|
80
81
|
"sharp": "^0.33.5",
|
81
|
-
"tailwindcss": "^4.1.
|
82
|
+
"tailwindcss": "^4.1.6",
|
82
83
|
"tsx": "^4.19.4",
|
83
84
|
"typescript": "^5.8.3",
|
84
|
-
"typescript-eslint": "^8.32.
|
85
|
+
"typescript-eslint": "^8.32.1",
|
85
86
|
"vite": "^6.3.5",
|
86
87
|
"vue": "^3.5.13",
|
87
88
|
"vue-eslint-parser": "^10.1.3"
|
@@ -1,35 +0,0 @@
|
|
1
|
-
---
|
2
|
-
interface Props {
|
3
|
-
/**
|
4
|
-
* 图标的大小
|
5
|
-
* @default "24px"
|
6
|
-
*/
|
7
|
-
size?: string;
|
8
|
-
/**
|
9
|
-
* 图标的颜色
|
10
|
-
* @default "currentColor"
|
11
|
-
*/
|
12
|
-
color?: string;
|
13
|
-
/**
|
14
|
-
* 自定义类名
|
15
|
-
*/
|
16
|
-
class?: string;
|
17
|
-
}
|
18
|
-
|
19
|
-
const { size = '24px', color = 'currentColor', class: className = '' } = Astro.props;
|
20
|
-
---
|
21
|
-
|
22
|
-
<svg
|
23
|
-
xmlns="http://www.w3.org/2000/svg"
|
24
|
-
width={size}
|
25
|
-
height={size}
|
26
|
-
viewBox="0 0 24 24"
|
27
|
-
fill="none"
|
28
|
-
stroke={color}
|
29
|
-
stroke-width="2"
|
30
|
-
stroke-linecap="round"
|
31
|
-
stroke-linejoin="round"
|
32
|
-
class={className}
|
33
|
-
>
|
34
|
-
<path d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z" />
|
35
|
-
</svg>
|
@@ -1,38 +0,0 @@
|
|
1
|
-
---
|
2
|
-
interface Props {
|
3
|
-
/**
|
4
|
-
* 图标的大小
|
5
|
-
* @default "24px"
|
6
|
-
*/
|
7
|
-
size?: string;
|
8
|
-
/**
|
9
|
-
* 图标的颜色
|
10
|
-
* @default "currentColor"
|
11
|
-
*/
|
12
|
-
color?: string;
|
13
|
-
/**
|
14
|
-
* 自定义类名
|
15
|
-
*/
|
16
|
-
class?: string;
|
17
|
-
}
|
18
|
-
|
19
|
-
const { size = '24px', color = 'currentColor', class: className = '' } = Astro.props;
|
20
|
-
---
|
21
|
-
|
22
|
-
<svg
|
23
|
-
xmlns="http://www.w3.org/2000/svg"
|
24
|
-
width={size}
|
25
|
-
height={size}
|
26
|
-
viewBox="0 0 24 24"
|
27
|
-
fill="none"
|
28
|
-
stroke={color}
|
29
|
-
stroke-width="2"
|
30
|
-
stroke-linecap="round"
|
31
|
-
stroke-linejoin="round"
|
32
|
-
class={className}
|
33
|
-
>
|
34
|
-
<rect x="3" y="4" width="18" height="18" rx="2" ry="2"></rect>
|
35
|
-
<line x1="16" y1="2" x2="16" y2="6"></line>
|
36
|
-
<line x1="8" y1="2" x2="8" y2="6"></line>
|
37
|
-
<line x1="3" y1="10" x2="21" y2="10"></line>
|
38
|
-
</svg>
|
@@ -1,36 +0,0 @@
|
|
1
|
-
---
|
2
|
-
interface Props {
|
3
|
-
/**
|
4
|
-
* 图标的大小
|
5
|
-
* @default "24px"
|
6
|
-
*/
|
7
|
-
size?: string;
|
8
|
-
/**
|
9
|
-
* 图标的颜色
|
10
|
-
* @default "currentColor"
|
11
|
-
*/
|
12
|
-
color?: string;
|
13
|
-
/**
|
14
|
-
* 自定义类名
|
15
|
-
*/
|
16
|
-
class?: string;
|
17
|
-
}
|
18
|
-
|
19
|
-
const { size = '24px', color = 'currentColor', class: className = '' } = Astro.props;
|
20
|
-
---
|
21
|
-
|
22
|
-
<svg
|
23
|
-
xmlns="http://www.w3.org/2000/svg"
|
24
|
-
width={size}
|
25
|
-
height={size}
|
26
|
-
viewBox="0 0 24 24"
|
27
|
-
fill="none"
|
28
|
-
stroke={color}
|
29
|
-
stroke-width="2"
|
30
|
-
stroke-linecap="round"
|
31
|
-
stroke-linejoin="round"
|
32
|
-
class={className}
|
33
|
-
>
|
34
|
-
<path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"></path>
|
35
|
-
<polyline points="22 4 12 14.01 9 11.01"></polyline>
|
36
|
-
</svg>
|
@@ -1,38 +0,0 @@
|
|
1
|
-
---
|
2
|
-
/**
|
3
|
-
* 检查图标组件
|
4
|
-
*/
|
5
|
-
interface Props {
|
6
|
-
/**
|
7
|
-
* 图标的大小
|
8
|
-
* @default "24px"
|
9
|
-
*/
|
10
|
-
size?: string;
|
11
|
-
/**
|
12
|
-
* 图标的颜色
|
13
|
-
* @default "currentColor"
|
14
|
-
*/
|
15
|
-
color?: string;
|
16
|
-
/**
|
17
|
-
* 自定义类名
|
18
|
-
*/
|
19
|
-
class?: string;
|
20
|
-
}
|
21
|
-
|
22
|
-
const { size = '24px', color = 'currentColor', class: className = '' } = Astro.props;
|
23
|
-
---
|
24
|
-
|
25
|
-
<svg
|
26
|
-
xmlns="http://www.w3.org/2000/svg"
|
27
|
-
width={size}
|
28
|
-
height={size}
|
29
|
-
viewBox="0 0 24 24"
|
30
|
-
fill="none"
|
31
|
-
stroke={color}
|
32
|
-
stroke-width="2"
|
33
|
-
stroke-linecap="round"
|
34
|
-
stroke-linejoin="round"
|
35
|
-
class={className}
|
36
|
-
>
|
37
|
-
<polyline points="20 6 9 17 4 12"></polyline>
|
38
|
-
</svg>
|
@@ -1,39 +0,0 @@
|
|
1
|
-
---
|
2
|
-
/**
|
3
|
-
* 剪贴板图标组件
|
4
|
-
*/
|
5
|
-
interface Props {
|
6
|
-
/**
|
7
|
-
* 图标的大小
|
8
|
-
* @default "24px"
|
9
|
-
*/
|
10
|
-
size?: string;
|
11
|
-
/**
|
12
|
-
* 图标的颜色
|
13
|
-
* @default "currentColor"
|
14
|
-
*/
|
15
|
-
color?: string;
|
16
|
-
/**
|
17
|
-
* 自定义类名
|
18
|
-
*/
|
19
|
-
class?: string;
|
20
|
-
}
|
21
|
-
|
22
|
-
const { size = '24px', color = 'currentColor', class: className = '' } = Astro.props;
|
23
|
-
---
|
24
|
-
|
25
|
-
<svg
|
26
|
-
xmlns="http://www.w3.org/2000/svg"
|
27
|
-
width={size}
|
28
|
-
height={size}
|
29
|
-
viewBox="0 0 24 24"
|
30
|
-
fill="none"
|
31
|
-
stroke={color}
|
32
|
-
stroke-width="2"
|
33
|
-
stroke-linecap="round"
|
34
|
-
stroke-linejoin="round"
|
35
|
-
class={className}
|
36
|
-
>
|
37
|
-
<rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect>
|
38
|
-
<path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path>
|
39
|
-
</svg>
|
@@ -1,38 +0,0 @@
|
|
1
|
-
---
|
2
|
-
/**
|
3
|
-
* 关闭图标组件
|
4
|
-
*/
|
5
|
-
interface Props {
|
6
|
-
/**
|
7
|
-
* 图标的大小
|
8
|
-
* @default "16px"
|
9
|
-
*/
|
10
|
-
size?: string;
|
11
|
-
/**
|
12
|
-
* 图标的颜色
|
13
|
-
* @default "currentColor"
|
14
|
-
*/
|
15
|
-
color?: string;
|
16
|
-
/**
|
17
|
-
* 自定义类名
|
18
|
-
*/
|
19
|
-
class?: string;
|
20
|
-
}
|
21
|
-
|
22
|
-
const { size = '16px', color = 'currentColor', class: className = '' } = Astro.props;
|
23
|
-
---
|
24
|
-
|
25
|
-
<svg
|
26
|
-
xmlns="http://www.w3.org/2000/svg"
|
27
|
-
width={size}
|
28
|
-
height={size}
|
29
|
-
viewBox="0 0 24 24"
|
30
|
-
fill="none"
|
31
|
-
stroke={color}
|
32
|
-
stroke-width="2"
|
33
|
-
stroke-linecap="round"
|
34
|
-
stroke-linejoin="round"
|
35
|
-
class={className}
|
36
|
-
>
|
37
|
-
<path d="M6 18L18 6M6 6l12 12" />
|
38
|
-
</svg>
|