@binblink/wasmnest-plugin-sdk-mobile 0.0.0-stage → 0.0.1
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 +363 -2
- package/README_en.md +353 -0
- package/bin/build.js +269 -0
- package/bin/cli.js +96 -0
- package/bin/lib.js +349 -0
- package/bin/manifest-gen.js +324 -0
- package/bin/package.js +150 -0
- package/bin/scaffold.js +285 -0
- package/dev-shell/README.md +151 -0
- package/dev-shell/index.html +27 -0
- package/dev-shell/package.json +27 -0
- package/dev-shell/pnpm-workspace.yaml +9 -0
- package/dev-shell/postcss.config.js +6 -0
- package/dev-shell/src/App.vue +90 -0
- package/dev-shell/src/apps/mock-terminal/MockTerminalSlotCard.vue +51 -0
- package/dev-shell/src/apps/mock-terminal/MockTerminalView.vue +168 -0
- package/dev-shell/src/apps/mock-terminal/index.ts +50 -0
- package/dev-shell/src/components/DevToolbar.vue +100 -0
- package/dev-shell/src/components/DialogHost.vue +119 -0
- package/dev-shell/src/components/LogPanel.vue +80 -0
- package/dev-shell/src/i18n.ts +22 -0
- package/dev-shell/src/loader.ts +239 -0
- package/dev-shell/src/locale.ts +29 -0
- package/dev-shell/src/locales/en-shell.ts +328 -0
- package/dev-shell/src/locales/index.ts +70 -0
- package/dev-shell/src/locales/shell.ts +328 -0
- package/dev-shell/src/main.ts +58 -0
- package/dev-shell/src/mock/dialog-service.ts +58 -0
- package/dev-shell/src/mock/file-transfer.ts +390 -0
- package/dev-shell/src/mock/mobile-api.ts +369 -0
- package/dev-shell/src/mock/preset-tasks.ts +186 -0
- package/dev-shell/src/mock/session.ts +121 -0
- package/dev-shell/src/mock-context.ts +351 -0
- package/dev-shell/src/registry.ts +151 -0
- package/dev-shell/src/shared-runtime.ts +44 -0
- package/dev-shell/src/shell/ShellView.vue +52 -0
- package/dev-shell/src/shell/adapters/devAppSource.ts +155 -0
- package/dev-shell/src/shell/components/PluginContextHost.vue +40 -0
- package/dev-shell/src/shell/components/ShellAppCell.vue +75 -0
- package/dev-shell/src/shell/components/ShellAppIcon.vue +111 -0
- package/dev-shell/src/shell/components/ShellAppSurface.vue +46 -0
- package/dev-shell/src/shell/components/ShellBrandTile.vue +27 -0
- package/dev-shell/src/shell/components/ShellCapsuleMenu.vue +123 -0
- package/dev-shell/src/shell/components/ShellChip.vue +49 -0
- package/dev-shell/src/shell/components/ShellGroupCard.vue +17 -0
- package/dev-shell/src/shell/components/ShellHost.vue +75 -0
- package/dev-shell/src/shell/components/ShellNotificationShade.vue +496 -0
- package/dev-shell/src/shell/components/ShellPermissionPrompt.vue +127 -0
- package/dev-shell/src/shell/components/ShellPlaceholderSurface.vue +33 -0
- package/dev-shell/src/shell/components/ShellSection.vue +27 -0
- package/dev-shell/src/shell/components/ShellSheet.vue +74 -0
- package/dev-shell/src/shell/components/ShellStatusbar.vue +84 -0
- package/dev-shell/src/shell/components/screens/PluginRoutePage.vue +98 -0
- package/dev-shell/src/shell/components/screens/ShellAppDetailScreen.vue +378 -0
- package/dev-shell/src/shell/components/screens/ShellAppRunScreen.vue +90 -0
- package/dev-shell/src/shell/components/screens/ShellAppsScreen.vue +195 -0
- package/dev-shell/src/shell/components/screens/ShellHomeScreen.vue +316 -0
- package/dev-shell/src/shell/components/screens/ShellPermissionsScreen.vue +376 -0
- package/dev-shell/src/shell/components/screens/ShellSettingsScreen.vue +240 -0
- package/dev-shell/src/shell/components/screens/ShellSwitcherScreen.vue +559 -0
- package/dev-shell/src/shell/components/ui/ConfirmDialog.vue +137 -0
- package/dev-shell/src/shell/components/ui/Toggle.vue +53 -0
- package/dev-shell/src/shell/composables/useShellApps.ts +415 -0
- package/dev-shell/src/shell/composables/useShellNavigation.ts +197 -0
- package/dev-shell/src/shell/composables/useShellNotifications.ts +115 -0
- package/dev-shell/src/shell/composables/useShellOpen.ts +35 -0
- package/dev-shell/src/shell/composables/useShellOverlays.ts +101 -0
- package/dev-shell/src/shell/composables/useShellPreferences.ts +143 -0
- package/dev-shell/src/shell/composables/useShellRecent.ts +84 -0
- package/dev-shell/src/shell/composables/useToast.ts +33 -0
- package/dev-shell/src/shell/index.ts +88 -0
- package/dev-shell/src/shell/logger.ts +45 -0
- package/dev-shell/src/shell/permissions.ts +145 -0
- package/dev-shell/src/shell/registry.ts +220 -0
- package/dev-shell/src/shell/styles/shell.css +841 -0
- package/dev-shell/src/shell/types.ts +137 -0
- package/dev-shell/src/shell/utils.ts +54 -0
- package/dev-shell/src/styles/main.css +153 -0
- package/dev-shell/src/styles/mobile.css +884 -0
- package/dev-shell/src/styles/wallpaper.css +130 -0
- package/dev-shell/src/theme.ts +71 -0
- package/dev-shell/src/vite-env.d.ts +20 -0
- package/dev-shell/tailwind.config.js +101 -0
- package/dev-shell/tsconfig.json +16 -0
- package/dev-shell/vite.config.ts +130 -0
- package/dist/index.d.ts +84 -0
- package/dist/index.js +161 -0
- package/dist/types.d.ts +637 -0
- package/dist/types.js +0 -0
- package/dist/vite-plugin.d.ts +16 -0
- package/dist/vite-plugin.js +95 -0
- package/package.json +80 -3
- package/src/constants.ts +6 -0
- package/src/global-dialog.ts +168 -0
- package/src/index.ts +87 -0
- package/src/runtime.ts +44 -0
- package/src/types.ts +715 -0
- package/src/ui/PluginGlobalDialog.vue +388 -0
- package/src/ui/Select.d.ts +37 -0
- package/src/ui/Select.vue +307 -0
- package/src/ui/plugin-global-dialog.d.ts +11 -0
- package/src/ui/useSwipeTabs.d.ts +20 -0
- package/src/ui/useSwipeTabs.ts +53 -0
- package/src/vite-plugin.ts +132 -0
- package/template/.gitignore +4 -0
- package/template/README.md +46 -0
- package/template/package.json +23 -0
- package/template/plugin.json +13 -0
- package/template/rust/Cargo.toml +19 -0
- package/template/rust/src/lib.rs +33 -0
- package/template/src/env.d.ts +24 -0
- package/template/src/index.ts +37 -0
- package/template/tsconfig.json +17 -0
- package/template/vite.config.ts +21 -0
|
@@ -0,0 +1,388 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Teleport to="body">
|
|
3
|
+
<Transition name="pgd">
|
|
4
|
+
<div
|
|
5
|
+
v-if="entry"
|
|
6
|
+
class="pgd-overlay mobile-ui"
|
|
7
|
+
role="dialog"
|
|
8
|
+
aria-modal="true"
|
|
9
|
+
@click.self="onBackdrop"
|
|
10
|
+
>
|
|
11
|
+
<div class="pgd-card" :class="entry.widthClass ?? 'max-w-md'">
|
|
12
|
+
<!-- 预设模式:标题 + 倒计时 + 正文 + 动作按钮 -->
|
|
13
|
+
<template v-if="!entry.content">
|
|
14
|
+
<div class="pgd-head px-5 pt-5" :class="{ 'pgd-head--closable': entry.closable !== false }">
|
|
15
|
+
<span class="pgd-title">{{ entry.title }}</span>
|
|
16
|
+
<span
|
|
17
|
+
v-if="countdownText"
|
|
18
|
+
class="pgd-countdown"
|
|
19
|
+
:class="{ 'pgd-countdown--urgent': countdownSeconds !== null && countdownSeconds <= 10 }"
|
|
20
|
+
>
|
|
21
|
+
{{ countdownText }}
|
|
22
|
+
</span>
|
|
23
|
+
</div>
|
|
24
|
+
<div class="px-5 py-3">
|
|
25
|
+
<div v-if="entry.message" class="pgd-message whitespace-pre-line">{{ entry.message }}</div>
|
|
26
|
+
<div
|
|
27
|
+
v-else-if="!entry.actions?.length && !countdownText"
|
|
28
|
+
class="pgd-message pgd-message--empty"
|
|
29
|
+
>
|
|
30
|
+
{{ '' }}
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
<div v-if="entry.actions?.length" class="pgd-actions px-5 pb-5">
|
|
34
|
+
<button
|
|
35
|
+
v-for="(action, i) in entry.actions"
|
|
36
|
+
:key="i"
|
|
37
|
+
class="pgd-btn"
|
|
38
|
+
:class="`pgd-btn--${action.kind ?? 'default'}`"
|
|
39
|
+
:disabled="action.disabled"
|
|
40
|
+
@click="onAction(action)"
|
|
41
|
+
>
|
|
42
|
+
{{ action.label }}
|
|
43
|
+
</button>
|
|
44
|
+
</div>
|
|
45
|
+
</template>
|
|
46
|
+
|
|
47
|
+
<!-- 组件模式:任意插件组件 + pluginContext -->
|
|
48
|
+
<content-shell v-else :entry="entry" :class="entry.bodyClass ?? 'p-0'" />
|
|
49
|
+
|
|
50
|
+
<!-- 关闭按钮(closable 时) -->
|
|
51
|
+
<button
|
|
52
|
+
v-if="entry.closable !== false"
|
|
53
|
+
class="pgd-close"
|
|
54
|
+
:aria-label="''"
|
|
55
|
+
@click="closeCurrent"
|
|
56
|
+
>
|
|
57
|
+
<svg fill="none" stroke="currentColor" viewBox="0 0 24 24" class="pgd-close-ico">
|
|
58
|
+
<path
|
|
59
|
+
stroke-linecap="round"
|
|
60
|
+
stroke-linejoin="round"
|
|
61
|
+
stroke-width="2"
|
|
62
|
+
d="M6 18L18 6M6 6l12 12"
|
|
63
|
+
/>
|
|
64
|
+
</svg>
|
|
65
|
+
</button>
|
|
66
|
+
</div>
|
|
67
|
+
</div>
|
|
68
|
+
</Transition>
|
|
69
|
+
</Teleport>
|
|
70
|
+
</template>
|
|
71
|
+
|
|
72
|
+
<script setup lang="ts">
|
|
73
|
+
/**
|
|
74
|
+
* PluginGlobalDialog — 移动端宿主全局弹窗(通用能力,宿主 + dev-shell 共用)
|
|
75
|
+
*
|
|
76
|
+
* 与桌面端同构:
|
|
77
|
+
* - 预设模式:title / message / icon / actions
|
|
78
|
+
* - 组件模式:content 任意 Vue 组件(provide('pluginContext'))
|
|
79
|
+
* - FIFO 排队(global-dialog 控制器)、可选定时自动关闭 + 倒计时
|
|
80
|
+
*
|
|
81
|
+
* 移动端样式适配:使用 --mobile-* design token,卡片圆角 16px,适配安全区,
|
|
82
|
+
* 按钮触摸目标 44px,文案换行 whitespace-pre-line 支持指纹等多行提示。
|
|
83
|
+
*
|
|
84
|
+
* 主题作用域:浅色 token 定义在 `html:not(.dark) .mobile-ui`(mobile.css),
|
|
85
|
+
* 而本组件 Teleport 到 body(逃逸 .mobile-ui 布局根),故 overlay 根元素必须
|
|
86
|
+
* 挂 `mobile-ui` 类才能吃到浅色/色板 token——与 FsAuthDialog 同模式;
|
|
87
|
+
* 深色为 :root 默认值不受影响。按钮随 --mobile-accent 深浅翻转(跟随主题色)。
|
|
88
|
+
*
|
|
89
|
+
* 渲染完全由 getGlobalDialog / subscribeGlobalDialog 驱动。
|
|
90
|
+
*/
|
|
91
|
+
import { computed, defineComponent, h, onBeforeUnmount, onMounted, provide, ref, watch } from 'vue'
|
|
92
|
+
import {
|
|
93
|
+
closeGlobalDialog,
|
|
94
|
+
getGlobalDialog,
|
|
95
|
+
resolveDialogDeadline,
|
|
96
|
+
subscribeGlobalDialog,
|
|
97
|
+
type GlobalDialogEntry,
|
|
98
|
+
} from '../global-dialog'
|
|
99
|
+
import { getRouter } from '../runtime'
|
|
100
|
+
import type { PluginDialogAction } from '../types'
|
|
101
|
+
|
|
102
|
+
const entry = ref<GlobalDialogEntry | null>(getGlobalDialog())
|
|
103
|
+
let unsubscribe: (() => void) | null = null
|
|
104
|
+
|
|
105
|
+
const now = ref(Date.now())
|
|
106
|
+
let tickTimer: ReturnType<typeof setInterval> | null = null
|
|
107
|
+
|
|
108
|
+
const countdownSeconds = computed<number | null>(() => {
|
|
109
|
+
const e = entry.value
|
|
110
|
+
if (!e) return null
|
|
111
|
+
const deadline = resolveDialogDeadline(e)
|
|
112
|
+
if (deadline == null) return null
|
|
113
|
+
return Math.max(0, Math.ceil((deadline - now.value) / 1000))
|
|
114
|
+
})
|
|
115
|
+
|
|
116
|
+
const countdownText = computed<string>(() => {
|
|
117
|
+
const e = entry.value
|
|
118
|
+
const seconds = countdownSeconds.value
|
|
119
|
+
// 倒计时可用判定:标签须含 {seconds} 占位符且秒数可计算,否则整行提示不渲染
|
|
120
|
+
// (无占位符的静态文案会与正文重复;秒数不可用说明无 deadline,无倒计时可言)
|
|
121
|
+
if (!e?.countdownLabel || !e.countdownLabel.includes('{seconds}') || seconds == null) return ''
|
|
122
|
+
return e.countdownLabel.replace('{seconds}', String(seconds))
|
|
123
|
+
})
|
|
124
|
+
|
|
125
|
+
function startTicking(): void {
|
|
126
|
+
stopTicking()
|
|
127
|
+
now.value = Date.now()
|
|
128
|
+
tickTimer = setInterval(() => {
|
|
129
|
+
now.value = Date.now()
|
|
130
|
+
}, 500)
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function stopTicking(): void {
|
|
134
|
+
if (tickTimer) {
|
|
135
|
+
clearInterval(tickTimer)
|
|
136
|
+
tickTimer = null
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
function closeCurrent(): void {
|
|
141
|
+
const e = entry.value
|
|
142
|
+
if (!e) return
|
|
143
|
+
closeGlobalDialog(e._id)
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
function onBackdrop(): void {
|
|
147
|
+
const e = entry.value
|
|
148
|
+
if (!e || e.closable === false || e.closeOnBackdrop === false) return
|
|
149
|
+
closeGlobalDialog(e._id)
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
function onKeydown(ev: KeyboardEvent): void {
|
|
153
|
+
if (ev.key !== 'Escape') return
|
|
154
|
+
const e = entry.value
|
|
155
|
+
if (!e || e.closable === false) return
|
|
156
|
+
closeGlobalDialog(e._id)
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
async function onAction(action: PluginDialogAction): Promise<void> {
|
|
160
|
+
try {
|
|
161
|
+
await action.onClick?.()
|
|
162
|
+
} catch (err) {
|
|
163
|
+
console.error('[PluginDialog] action failed, dialog kept open:', err)
|
|
164
|
+
return
|
|
165
|
+
}
|
|
166
|
+
closeCurrent()
|
|
167
|
+
if (action.navigateTo) {
|
|
168
|
+
try {
|
|
169
|
+
getRouter()?.push(action.navigateTo)
|
|
170
|
+
} catch (err) {
|
|
171
|
+
console.warn('[PluginDialog] navigate failed:', err)
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
const ContentShell = defineComponent({
|
|
177
|
+
name: 'PluginDialogContentShell',
|
|
178
|
+
props: {
|
|
179
|
+
entry: { type: Object, required: true },
|
|
180
|
+
},
|
|
181
|
+
setup(props) {
|
|
182
|
+
provide('pluginContext', (props.entry as GlobalDialogEntry).pluginContext)
|
|
183
|
+
const content = () =>
|
|
184
|
+
h(
|
|
185
|
+
(props.entry as GlobalDialogEntry).content,
|
|
186
|
+
{ ...(props.entry as GlobalDialogEntry).props, onClose: () => closeCurrent() },
|
|
187
|
+
)
|
|
188
|
+
return content
|
|
189
|
+
},
|
|
190
|
+
})
|
|
191
|
+
|
|
192
|
+
onMounted(() => {
|
|
193
|
+
unsubscribe = subscribeGlobalDialog((e) => {
|
|
194
|
+
entry.value = e
|
|
195
|
+
if (e) startTicking()
|
|
196
|
+
else stopTicking()
|
|
197
|
+
})
|
|
198
|
+
window.addEventListener('keydown', onKeydown)
|
|
199
|
+
})
|
|
200
|
+
|
|
201
|
+
watch(
|
|
202
|
+
() => entry.value?._id,
|
|
203
|
+
() => {
|
|
204
|
+
now.value = Date.now()
|
|
205
|
+
},
|
|
206
|
+
)
|
|
207
|
+
|
|
208
|
+
onBeforeUnmount(() => {
|
|
209
|
+
unsubscribe?.()
|
|
210
|
+
unsubscribe = null
|
|
211
|
+
stopTicking()
|
|
212
|
+
window.removeEventListener('keydown', onKeydown)
|
|
213
|
+
})
|
|
214
|
+
</script>
|
|
215
|
+
|
|
216
|
+
<style scoped>
|
|
217
|
+
.pgd-overlay {
|
|
218
|
+
position: fixed;
|
|
219
|
+
inset: 0;
|
|
220
|
+
z-index: 100;
|
|
221
|
+
display: flex;
|
|
222
|
+
align-items: center;
|
|
223
|
+
justify-content: center;
|
|
224
|
+
padding: 24px;
|
|
225
|
+
padding-bottom: calc(24px + var(--safe-area-bottom, 0px));
|
|
226
|
+
background: var(--mobile-overlay-heavy, rgba(0, 0, 0, 0.5));
|
|
227
|
+
backdrop-filter: blur(4px);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
.pgd-card {
|
|
231
|
+
position: relative;
|
|
232
|
+
width: 100%;
|
|
233
|
+
display: flex;
|
|
234
|
+
flex-direction: column;
|
|
235
|
+
max-height: 85vh;
|
|
236
|
+
overflow: auto;
|
|
237
|
+
background: var(--mobile-bg-card);
|
|
238
|
+
border: 1px solid var(--mobile-border);
|
|
239
|
+
border-radius: 16px;
|
|
240
|
+
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
.pgd-head {
|
|
244
|
+
display: flex;
|
|
245
|
+
align-items: baseline;
|
|
246
|
+
justify-content: space-between;
|
|
247
|
+
gap: 12px;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
/* 有关闭按钮(closable)时给标题行右侧让位:绝对定位的 .pgd-close 占右上角
|
|
251
|
+
(top 12px + 右 12px + 28px 宽),否则倒计时/长标题会与 X 重叠 */
|
|
252
|
+
.pgd-head--closable {
|
|
253
|
+
padding-right: 44px;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
.pgd-title {
|
|
257
|
+
font-size: 16px;
|
|
258
|
+
font-weight: 600;
|
|
259
|
+
color: var(--mobile-text-primary);
|
|
260
|
+
line-height: 1.4;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
.pgd-countdown {
|
|
264
|
+
font-size: 12px;
|
|
265
|
+
color: var(--mobile-text-secondary);
|
|
266
|
+
flex-shrink: 0;
|
|
267
|
+
white-space: nowrap;
|
|
268
|
+
transition: color 0.2s ease;
|
|
269
|
+
font-variant-numeric: tabular-nums;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
.pgd-countdown--urgent {
|
|
273
|
+
color: var(--mobile-danger-color, #ef4444);
|
|
274
|
+
font-weight: 600;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
.pgd-message {
|
|
278
|
+
margin: 0;
|
|
279
|
+
font-size: 14px;
|
|
280
|
+
line-height: 1.55;
|
|
281
|
+
color: var(--mobile-text-secondary);
|
|
282
|
+
overflow-wrap: anywhere;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
.pgd-actions {
|
|
286
|
+
display: flex;
|
|
287
|
+
justify-content: flex-end;
|
|
288
|
+
gap: 8px;
|
|
289
|
+
margin-top: 4px;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
.pgd-btn {
|
|
293
|
+
display: inline-flex;
|
|
294
|
+
align-items: center;
|
|
295
|
+
justify-content: center;
|
|
296
|
+
gap: 6px;
|
|
297
|
+
min-height: 44px;
|
|
298
|
+
padding: 8px 16px;
|
|
299
|
+
background: var(--mobile-bg-primary, #f3f4f6);
|
|
300
|
+
color: var(--mobile-text-primary);
|
|
301
|
+
border: 1px solid var(--mobile-border);
|
|
302
|
+
border-radius: 12px;
|
|
303
|
+
font-size: 14px;
|
|
304
|
+
font-weight: 500;
|
|
305
|
+
cursor: pointer;
|
|
306
|
+
transition: border-color 0.2s ease, background-color 0.2s ease, opacity 0.2s ease;
|
|
307
|
+
flex-shrink: 0;
|
|
308
|
+
flex: 1;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
.pgd-btn:hover {
|
|
312
|
+
border-color: var(--mobile-accent);
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
.pgd-btn:disabled {
|
|
316
|
+
opacity: 0.5;
|
|
317
|
+
cursor: not-allowed;
|
|
318
|
+
border-color: var(--mobile-border);
|
|
319
|
+
background: var(--mobile-bg-primary);
|
|
320
|
+
color: var(--mobile-text-secondary);
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
.pgd-btn--primary {
|
|
324
|
+
background: var(--mobile-accent);
|
|
325
|
+
border-color: var(--mobile-accent);
|
|
326
|
+
color: var(--mobile-text-on-accent, #fff);
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
.pgd-btn--primary:hover {
|
|
330
|
+
filter: brightness(0.95);
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
.pgd-btn--danger {
|
|
334
|
+
background: var(--mobile-danger-color, #ef4444);
|
|
335
|
+
border-color: var(--mobile-danger-color, #ef4444);
|
|
336
|
+
color: #fff;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
.pgd-btn--ghost {
|
|
340
|
+
border-color: transparent;
|
|
341
|
+
background: transparent;
|
|
342
|
+
opacity: 0.65;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
.pgd-close {
|
|
346
|
+
position: absolute;
|
|
347
|
+
top: 12px;
|
|
348
|
+
right: 12px;
|
|
349
|
+
padding: 6px;
|
|
350
|
+
border: none;
|
|
351
|
+
background: transparent;
|
|
352
|
+
color: var(--mobile-text-muted);
|
|
353
|
+
border-radius: 8px;
|
|
354
|
+
cursor: pointer;
|
|
355
|
+
transition: color 0.2s ease, background-color 0.2s ease;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
.pgd-close:hover {
|
|
359
|
+
color: var(--mobile-text-primary);
|
|
360
|
+
background: var(--mobile-bg-primary);
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
.pgd-close-ico {
|
|
364
|
+
width: 16px;
|
|
365
|
+
height: 16px;
|
|
366
|
+
display: block;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
.pgd-enter-active,
|
|
370
|
+
.pgd-leave-active {
|
|
371
|
+
transition: opacity 0.2s ease;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
.pgd-enter-active .pgd-card,
|
|
375
|
+
.pgd-leave-active .pgd-card {
|
|
376
|
+
transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
.pgd-enter-from,
|
|
380
|
+
.pgd-leave-to {
|
|
381
|
+
opacity: 0;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
.pgd-enter-from .pgd-card,
|
|
385
|
+
.pgd-leave-to .pgd-card {
|
|
386
|
+
transform: translateY(8px) scale(0.98);
|
|
387
|
+
}
|
|
388
|
+
</style>
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { DefineComponent } from 'vue'
|
|
2
|
+
|
|
3
|
+
/** 下拉选项(value 同时作为 v-model 绑定值) */
|
|
4
|
+
export interface SelectOption {
|
|
5
|
+
value: string | number
|
|
6
|
+
label: string
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/** Select 组件 props */
|
|
10
|
+
export interface SelectProps {
|
|
11
|
+
modelValue: string | number
|
|
12
|
+
/** 顶部标签文本(可选) */
|
|
13
|
+
label?: string
|
|
14
|
+
options: SelectOption[]
|
|
15
|
+
/** 未选中时的占位文本;设置后下拉顶部出现"清除选择"行 */
|
|
16
|
+
placeholder?: string
|
|
17
|
+
disabled?: boolean
|
|
18
|
+
required?: boolean
|
|
19
|
+
error?: string
|
|
20
|
+
/** md:宿主表单默认(44px/14px 触摸目标);sm:插件紧凑布局(36px/12px) */
|
|
21
|
+
size?: 'md' | 'sm'
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* 移动端共享下拉选择组件(替代原生 <select>)
|
|
26
|
+
*
|
|
27
|
+
* 用法:
|
|
28
|
+
* ```vue
|
|
29
|
+
* <Select v-model="value" :options="options" size="sm" @open="refresh" />
|
|
30
|
+
* ```
|
|
31
|
+
* - 触发 `update:modelValue`(选中/清除)
|
|
32
|
+
* - 触发 `open`(下拉展开时,可用于静默刷新选项)
|
|
33
|
+
* - 面板 Teleport 到 body,safe-stack overlay 层,样式由 --mobile-* token 驱动
|
|
34
|
+
*/
|
|
35
|
+
export declare const Select: DefineComponent<SelectProps>
|
|
36
|
+
|
|
37
|
+
export default Select
|