UNPKG

aile-capacitor-aiff

Version:

AIFF WebView plugin for Capacitor with iframe-based web implementation

313 lines (273 loc) 5.93 kB
:root { --aiff-primary-color: #007bff; --aiff-secondary-color: #6c757d; --aiff-success-color: #28a745; --aiff-danger-color: #dc3545; --aiff-warning-color: #ffc107; --aiff-info-color: #17a2b8; --aiff-light-color: #f8f9fa; --aiff-dark-color: #343a40; --aiff-border-radius: 8px; --aiff-box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); --aiff-transition: all 0.3s ease; } /* 深色模式变量 */ @media (prefers-color-scheme: dark) { :root { --aiff-bg-color: #1a1a1a; --aiff-text-color: #ffffff; --aiff-border-color: #333333; --aiff-surface-color: #2d2d2d; } } /* 浅色模式变量 */ @media (prefers-color-scheme: light) { :root { --aiff-bg-color: #ffffff; --aiff-text-color: #333333; --aiff-border-color: #e0e0e0; --aiff-surface-color: #f8f9fa; } } /* 强制浅色模式 */ .aiff-theme-light { --aiff-bg-color: #ffffff !important; --aiff-text-color: #333333 !important; --aiff-border-color: #e0e0e0 !important; --aiff-surface-color: #f8f9fa !important; } /* 强制深色模式 */ .aiff-theme-dark { --aiff-bg-color: #1a1a1a !important; --aiff-text-color: #ffffff !important; --aiff-border-color: #333333 !important; --aiff-surface-color: #2d2d2d !important; } /* 基础样式 */ .aiff-webview-modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.5); z-index: 10000; display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity 300ms ease-in-out; } .aiff-webview-container { width: 90%; height: 80%; max-width: 1200px; background: var(--aiff-bg-color); border: 1px solid var(--aiff-border-color); border-radius: var(--aiff-border-radius); overflow: hidden; display: flex; flex-direction: column; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3); transform: scale(0.9); transition: transform 300ms ease-in-out; } .aiff-webview-toolbar { height: 44px; background: var(--aiff-surface-color); border-bottom: 1px solid var(--aiff-border-color); display: flex; align-items: center; justify-content: space-between; padding: 0 16px; flex-shrink: 0; } .aiff-webview-toolbar button { background: none; border: none; color: var(--aiff-text-color); cursor: pointer; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: 4px; transition: var(--aiff-transition); } .aiff-webview-toolbar button:hover { background: rgba(0, 0, 0, 0.1); } .aiff-theme-dark .aiff-webview-toolbar button:hover { background: rgba(255, 255, 255, 0.1); } .aiff-webview-toolbar .close-btn { font-size: 24px; font-weight: bold; } .aiff-webview-toolbar .reload-btn { font-size: 16px; } .aiff-webview-title { font-size: 16px; font-weight: 600; color: var(--aiff-text-color); flex: 1; text-align: center; margin: 0 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .aiff-webview-iframe { flex: 1; width: 100%; border: none; background: var(--aiff-bg-color); } /* 响应式设计 */ @media (max-width: 768px) { .aiff-webview-container { width: 95%; height: 85%; border-radius: 12px; } .aiff-webview-toolbar { height: 48px; padding: 0 12px; } .aiff-webview-title { font-size: 14px; } } @media (max-width: 480px) { .aiff-webview-container { width: 100%; height: 100%; max-width: none; border-radius: 0; margin: 0; } .aiff-webview-modal { align-items: flex-end; } .aiff-webview-container { transform: translateY(100%); border-radius: 16px 16px 0 0; } .aiff-webview-modal.show .aiff-webview-container { transform: translateY(0); } } /* 动画效果 */ @keyframes aiff-fade-in { from { opacity: 0; } to { opacity: 1; } } @keyframes aiff-scale-in { from { transform: scale(0.9); } to { transform: scale(1); } } .aiff-webview-modal.show { opacity: 1; } .aiff-webview-modal.show .aiff-webview-container { transform: scale(1); } /* 加载状态 */ .aiff-loading { display: flex; align-items: center; justify-content: center; height: 100%; color: var(--aiff-text-color); } .aiff-spinner { border: 3px solid var(--aiff-border-color); border-top: 3px solid var(--aiff-primary-color); border-radius: 50%; width: 40px; height: 40px; animation: aiff-spin 1s linear infinite; } @keyframes aiff-spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } } /* 错误状态 */ .aiff-error { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; color: var(--aiff-danger-color); text-align: center; padding: 20px; } .aiff-error-icon { font-size: 48px; margin-bottom: 16px; } .aiff-error-message { font-size: 16px; margin-bottom: 8px; } .aiff-error-submessage { font-size: 14px; color: var(--aiff-secondary-color); } /* 工具提示 */ .aiff-tooltip { position: relative; display: inline-block; } .aiff-tooltip .aiff-tooltiptext { visibility: hidden; width: 120px; background-color: var(--aiff-dark-color); color: #fff; text-align: center; border-radius: 4px; padding: 5px; position: absolute; z-index: 1; bottom: 125%; left: 50%; margin-left: -60px; opacity: 0; transition: opacity 0.3s; font-size: 12px; } .aiff-tooltip:hover .aiff-tooltiptext { visibility: visible; opacity: 1; } /* 无障碍支持 */ @media (prefers-reduced-motion: reduce) { .aiff-webview-modal, .aiff-webview-container, .aiff-webview-toolbar button { transition: none; } .aiff-spinner { animation: none; } } /* 高对比度模式 */ @media (prefers-contrast: high) { .aiff-webview-container { border: 2px solid var(--aiff-text-color); } .aiff-webview-toolbar button:hover { border: 1px solid var(--aiff-text-color); } }