apptify 0.5.1 → 0.5.4
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 +3 -0
- package/dist/apptify.css +1 -1
- package/dist/apptify.js +2298 -2140
- package/dist/components/AppleCard.vue.d.ts +76 -0
- package/dist/components/button.d.ts +3 -3
- package/dist/components/content.d.ts +0 -90
- package/dist/components/foundation.d.ts +201 -129
- package/dist/components/link.d.ts +31 -0
- package/dist/components/overlays.d.ts +8 -2
- package/dist/core/context.d.ts +11 -0
- package/dist/core/overlay-surface.d.ts +6 -0
- package/dist/core/popup-motion.d.ts +5 -5
- package/dist/core/popup-placement.d.ts +3 -2
- package/dist/index.d.ts +144 -79
- package/docs/COMPONENTS.md +23 -9
- package/docs/INPUT-WORKSHOP.md +59 -0
- package/docs/PLAYGROUND-TEMPLATE.md +9 -9
- package/package.json +5 -1
- package/templates/playground/README.md +4 -4
- package/templates/playground/index.html +1 -1
- package/templates/playground/package.json +6 -2
- package/templates/playground/source-snapshot.json +138 -53
- package/templates/playground/{playground → src}/App.vue +5 -4
- package/templates/playground/{playground → src}/ComponentDemo.vue +8 -9
- package/templates/playground/{playground → src}/catalog.ts +2 -3
- package/templates/playground/src/components/ComponentIndex.vue +43 -0
- package/templates/playground/src/components/DirectoryDialog.vue +20 -0
- package/templates/playground/src/components/PageFooter.vue +7 -0
- package/templates/playground/{playground → src}/components/UserMenu.vue +11 -11
- package/templates/playground/src/editor/AppleInputExample.vue +78 -0
- package/templates/playground/src/editor/AppleInputPreview.vue +82 -0
- package/templates/playground/src/editor/ComponentDocumentLink.vue +19 -0
- package/templates/playground/src/editor/ComponentWorkshop.vue +81 -0
- package/templates/playground/src/editor/ConfigurableEditor.vue +35 -0
- package/templates/playground/src/editor/LiveVueEditor.vue +133 -0
- package/templates/playground/src/editor/apple-input-source.ts +2 -0
- package/templates/playground/src/editor/apple-input.ts +48 -0
- package/templates/playground/src/editor/contract.ts +14 -0
- package/templates/playground/src/editor/documents.ts +20 -0
- package/templates/playground/src/editor/input-playground.ts +59 -0
- package/templates/playground/src/editor/runtime.ts +5 -0
- package/templates/playground/src/editor/sections.ts +10 -0
- package/templates/playground/{playground → src}/style.css +40 -39
- package/templates/playground/{playground → src}/views/[...all].vue +2 -2
- package/templates/playground/src/views/component-docs/[component].vue +162 -0
- package/templates/playground/src/views/components.vue +148 -0
- package/templates/playground/src/views/index.vue +73 -0
- package/templates/playground/src/views/settings.vue +225 -0
- package/templates/playground/tooling/playground-editor.mjs +114 -0
- package/templates/playground/tooling/prepare-input-source.mjs +38 -0
- package/templates/playground/tsconfig.json +2 -2
- package/templates/playground/vite.config.ts +3 -1
- package/tooling/playground-editor.mjs +114 -0
- package/tooling/prepare-input-source.mjs +38 -0
- package/tooling/prepare-playground.mjs +27 -14
- package/tooling/test-create-apptify.mjs +15 -5
- package/tooling/test-playground-package.mjs +13 -7
- package/templates/playground/playground/components/ComponentIndex.vue +0 -62
- package/templates/playground/playground/components/PageFooter.vue +0 -3
- package/templates/playground/playground/views/components.vue +0 -126
- package/templates/playground/playground/views/index.vue +0 -75
- package/templates/playground/playground/views/settings.vue +0 -98
- /package/templates/playground/{playground → src}/components/not-found-paper-scene.vue +0 -0
- /package/templates/playground/{playground → src}/components/not-found-paper-story.ts +0 -0
- /package/templates/playground/{playground → src}/env.d.ts +0 -0
- /package/templates/playground/{playground → src}/main.ts +0 -0
- /package/templates/playground/{playground → src}/router/index.ts +0 -0
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<main class="main-content settings-page">
|
|
3
|
-
<header class="page-heading"><div style="padding: 0 16px"><h1>设置</h1></div></header>
|
|
4
|
-
<section class="settings-section" aria-labelledby="theme-heading">
|
|
5
|
-
<div class="settings-section-heading"><Palette :size="21" aria-hidden="true" /><div><h2 id="theme-heading">主题</h2><p>应用于所有页面,并保存在这台设备上。</p></div></div>
|
|
6
|
-
<div class="theme-picker" role="group" aria-label="选择主题">
|
|
7
|
-
<apple-button v-for="theme in themes" variant="ghost" class="theme-choice" :key="theme.value" type="button" :aria-pressed="apple.theme.value.name === theme.value" :class="{ selected: apple.theme.value.name === theme.value }" @click="apple.theme.value.set(theme.value)">
|
|
8
|
-
<span aria-hidden="true" class="theme-swatch" :style="{ background: theme.background, color: theme.accent }"><i /><i /><i /></span>
|
|
9
|
-
<span class="theme-label">{{ theme.label }}<Check v-if="apple.theme.value.name === theme.value" :size="15" aria-hidden="true" /></span>
|
|
10
|
-
</apple-button>
|
|
11
|
-
</div>
|
|
12
|
-
</section>
|
|
13
|
-
<section class="settings-section" aria-labelledby="glass-heading">
|
|
14
|
-
<div class="settings-section-heading"><Layers :size="21" aria-hidden="true" /><div><h2 id="glass-heading">玻璃效果</h2><p>调整下拉浮层的底色与模糊程度,并保存在这台设备上。</p></div></div>
|
|
15
|
-
<div class="glass-controls">
|
|
16
|
-
<apple-slider :model-value="apple.glass.value.opacity" label="玻璃不透明度" :min="0" :max="100" :step="0.1" :format-value="formatOpacity" hint="0% 完全透明,100% 完全不透明。" @update:model-value="setGlassOpacity" />
|
|
17
|
-
<apple-slider :model-value="apple.glass.value.blur" label="玻璃模糊" :min="2" :max="22" :step="1" :format-value="formatBlur" hint="范围 2–22px,默认 12px。" @update:model-value="setGlassBlur" />
|
|
18
|
-
</div>
|
|
19
|
-
<div class="glass-preview" aria-label="玻璃效果实时预览">
|
|
20
|
-
<div class="glass-preview-backdrop" :style="{ backgroundImage: glassPreviewPattern }" aria-hidden="true" />
|
|
21
|
-
<apple-list class="glass-preview-panel" :items="glassPreviewItems" label="玻璃预览内容" />
|
|
22
|
-
</div>
|
|
23
|
-
<p class="glass-preview-note">细碎图案便于观察模糊程度,预览随滑块实时变化。账号菜单和登录对话框保持实底。</p>
|
|
24
|
-
<div class="glass-preview-select"><apple-select v-model="glassPreviewChoice" label="打开下拉查看实际效果" :items="glassPreviewItems" /></div>
|
|
25
|
-
</section>
|
|
26
|
-
<section class="settings-section" aria-labelledby="motion-heading">
|
|
27
|
-
<div class="settings-section-heading"><Waves :size="21" aria-hidden="true" /><div><h2 id="motion-heading">动效</h2><p>为页面切换和组件交互选择动效强度。</p></div></div>
|
|
28
|
-
<apple-segmented-control :model-value="apple.motion.value.mode" :items="motionOptions" label="全局动效" @update:model-value="setMotion" />
|
|
29
|
-
<p class="settings-note">{{ motionDescriptions[apple.motion.value.mode] }}<template v-if="apple.motion.value.reduced"> 系统已开启减少动态效果。</template></p>
|
|
30
|
-
<div class="motion-preview">
|
|
31
|
-
<div class="motion-preview-heading"><span>试试当前效果</span><apple-button variant="ghost" size="small" @click="expanded = !expanded">{{ expanded ? '收起预览' : '展开预览' }}</apple-button></div>
|
|
32
|
-
<apple-auto-size><div class="motion-preview-content"><apple-button @click="apple.notify('这就是当前的交互效果', { tone: 'success' })">轻点一下</apple-button><p v-if="expanded">舒适的颜色,自然的变化。每一个细节,都跟随你的偏好。</p></div></apple-auto-size>
|
|
33
|
-
</div>
|
|
34
|
-
</section>
|
|
35
|
-
<PageFooter />
|
|
36
|
-
</main>
|
|
37
|
-
</template>
|
|
38
|
-
|
|
39
|
-
<script setup lang="ts">
|
|
40
|
-
import { ref } from 'vue'
|
|
41
|
-
import { Check, Layers, Palette, Waves } from 'lucide-vue-next'
|
|
42
|
-
import { builtInThemes, useApple, type Motion } from 'apptify'
|
|
43
|
-
import PageFooter from '../components/PageFooter.vue'
|
|
44
|
-
|
|
45
|
-
const apple = useApple()
|
|
46
|
-
const expanded = ref(false)
|
|
47
|
-
const glassPreviewPattern = `url("data:image/svg+xml,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" width="176" height="144" viewBox="0 0 176 144"><g fill="none" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><g stroke="#7196ad"><path d="M12 12h15v10H12zM12 12l7.5 6 7.5-6"/><circle cx="64" cy="17" r="8"/><path d="M64 12v5l4 2M110 9l3 6 7 1-5 5 1 7-6-3-6 3 1-7-5-5 7-1zM148 10h12v15h-12zM152 14h5M152 18h5M152 22h3"/></g><g stroke="#bd856b"><path d="M12 48h12v11a5 5 0 0 1-5 5h-2a5 5 0 0 1-5-5zM24 50h3a4 4 0 0 1 0 8h-3M15 43v2M20 42v3M57 46l7-3 7 3v16l-7-3-7 3zM64 43v16M105 47l7-4 7 4v8l-7 4-7-4zM105 47l7 4 7-4M112 51v8M146 48h15v12h-15zM149 45v6M158 45v6M146 53h15M150 56h2M156 56h2"/></g><g stroke="#719281"><path d="M12 84c13-6 18 0 11 9-9 4-15 0-11-9zM12 94l12-11M62 80l-6 9 6 9 6-9zM61 89h3M105 82h13v13h-13zM108 85h7M108 88h7M108 91h4M147 83a7 7 0 0 1 14 0v6M147 85h3v7h-3zM158 85h3v7h-3z"/></g><g stroke="#a58cbb"><path d="M12 118l10-6 4 6-10 6zM12 118l-1 7 5-1M57 119c0-10 14-10 14 0M57 119v6h4v-6zM67 119v6h4v-6zM105 113h13v13h-13zM109 113v13M106 117h12M151 113h7v5l4 5-3 4h-9l-3-4 4-5zM151 118h7"/></g></g></svg>')}")`
|
|
48
|
-
const glassPreviewChoice = ref('profile')
|
|
49
|
-
const glassPreviewItems = [
|
|
50
|
-
{ label: '个人资料', value: 'profile', description: '姓名、头像和联系方式' },
|
|
51
|
-
{ label: '通知', value: 'notices', description: '推送和邮件偏好' },
|
|
52
|
-
{ label: '隐私与安全', value: 'privacy', description: '管理你的账户安全设置' },
|
|
53
|
-
]
|
|
54
|
-
function formatOpacity(value: number) { return `${Number(value.toFixed(1))}%` }
|
|
55
|
-
function formatBlur(value: number) { return `${value}px` }
|
|
56
|
-
function setGlassOpacity(opacity: number) { apple.glass.value.set({ opacity }) }
|
|
57
|
-
function setGlassBlur(blur: number) { apple.glass.value.set({ blur }) }
|
|
58
|
-
const themes = [
|
|
59
|
-
{ label: '跟随系统', value: 'system', background: 'linear-gradient(125deg, #f5f5f7 50%, #242426 50%)', accent: '#8a8a90' },
|
|
60
|
-
{ label: '浅色', value: 'light', background: '#f5f5f7', accent: builtInThemes.light.tokens.accent },
|
|
61
|
-
{ label: '深色', value: 'dark', background: '#242426', accent: builtInThemes.dark.tokens.accent },
|
|
62
|
-
{ label: '石墨', value: 'graphite', background: '#253334', accent: '#a6ceca' },
|
|
63
|
-
{ label: '玫瑰', value: 'rose', background: '#fff1f5', accent: '#a83b65' },
|
|
64
|
-
]
|
|
65
|
-
const motionOptions = [{ label: '自动', value: 'auto' }, { label: '完整', value: 'full' }, { label: '减弱', value: 'reduced' }, { label: '关闭', value: 'none' }]
|
|
66
|
-
const motionDescriptions: Record<string, string> = {
|
|
67
|
-
auto: '跟随系统的动态效果偏好,自动调整。',
|
|
68
|
-
full: '呈现完整的过渡与交互动效,同时尊重系统的减少动态效果设置。',
|
|
69
|
-
reduced: '缩短过渡、减少位移,保留必要的反馈。',
|
|
70
|
-
none: '立即呈现每次变化,关闭过渡动画。',
|
|
71
|
-
}
|
|
72
|
-
function setMotion(value: Motion) { apple.motion.value.set(value) }
|
|
73
|
-
function reset() {
|
|
74
|
-
apple.theme.value.set('light')
|
|
75
|
-
apple.motion.value.set('auto')
|
|
76
|
-
apple.glass.value.reset()
|
|
77
|
-
apple.notify('已恢复默认设置', { tone: 'success' })
|
|
78
|
-
}
|
|
79
|
-
</script>
|
|
80
|
-
|
|
81
|
-
<style scoped>
|
|
82
|
-
.theme-picker { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
|
|
83
|
-
.theme-choice { min-width: 0; padding: 7px; border: 1px solid var(--apple-border); border-radius: 8px; }
|
|
84
|
-
.theme-choice.selected { border-color: var(--apple-accent); outline: 1px solid var(--apple-accent); }
|
|
85
|
-
.theme-choice:focus-visible { outline: 3px solid color-mix(in srgb, var(--apple-accent) 65%, transparent); outline-offset: 3px; }
|
|
86
|
-
.theme-choice :deep(.apple-button__content) { flex-direction: column; width: 100%; gap: 12px; }
|
|
87
|
-
.theme-label { color: var(--apple-text); }
|
|
88
|
-
.glass-controls { display: grid; gap: 20px; margin-bottom: 24px; }
|
|
89
|
-
.glass-controls :deep(.apple-slider__value) { min-width: 58px; }
|
|
90
|
-
.glass-preview { position: relative; isolation: isolate; display: grid; place-items: center; min-height: 274px; padding: 24px; border-radius: 8px; background: var(--apple-surface-alt); }
|
|
91
|
-
.glass-preview-backdrop { position: absolute; inset: 0; z-index: -1; border-radius: inherit; background-color: var(--apple-surface-alt); background-size: 176px 144px; }
|
|
92
|
-
.glass-preview-panel { width: 100%; max-width: 340px; padding: 12px; border: 1px solid var(--apple-border); border-radius: 10px; background: rgb(var(--apple-glass-rgb, 255 255 255) / var(--apple-glass-opacity, 0.31372549)); -webkit-backdrop-filter: blur(var(--apple-glass-blur, 12px)) saturate(2); backdrop-filter: blur(var(--apple-glass-blur, 12px)) saturate(2); box-shadow: var(--apple-shadow); }
|
|
93
|
-
.glass-preview-note { font-size: 12px; line-height: 1.8; color: var(--apple-secondary); margin: 14px 0 20px; }
|
|
94
|
-
.glass-preview-select { max-width: 440px; }
|
|
95
|
-
@media (max-width: 600px) {
|
|
96
|
-
.theme-picker { grid-template-columns: repeat(3, minmax(0, 1fr)); }
|
|
97
|
-
}
|
|
98
|
-
</style>
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|