Skip to content

Conversation

@Gaubee
Copy link
Contributor

@Gaubee Gaubee commented Dec 30, 2025

概述

重构小程序启动体验,实现类 macOS/iOS 的应用启动动画,引入「应用堆栈」机制支持多应用管理。

主要变更

1. 启动屏幕组件 (MiniappSplashScreen)

  • 基于 themeColor 生成三层光晕渐变(主色 + hue±30° 邻近色)
  • 支持 hex/rgb/oklch/hue 多种颜色格式
  • 17 个单元测试 + Storybook stories

2. miniapp-runtime Service

  • 微型操作系统内核,管理应用生命周期
  • TanStack Store 状态管理
  • FLIP 动画帧计算 + Web Animations API
  • iframe 生命周期管理(前台 1 + 后台 4)

3. EcosystemTab 三页布局

  • 发现 / 我的 / 应用堆栈 三页 Swiper
  • Parallax 共享壁纸(-38.2% 视差)
  • 无运行应用时禁用第三页

4. 小程序窗口重设计

  • MiniappWindow 全局 Popover 层(不覆盖 TabBar)
  • MiniappCapsule 胶囊按钮(更多 + 关闭)
  • FLIP 启动/关闭动画

5. 层叠视图

  • MiniappStackCard 卡片 + 上滑关闭手势
  • MiniappStackView Swiper EffectCards
  • TabBar 生态按钮上滑触发

6. Tab 指示器

  • EcosystemTabIndicator 双向绑定
  • 图标 crossfade 动画
  • 点指示器状态同步

7. 白皮书更新

  • CSS Modules 最佳实践

新增组件

组件 文件
MiniappSplashScreen miniapp-splash-screen.tsx + .module.css
MiniappWindow miniapp-window.tsx + .module.css
MiniappCapsule miniapp-capsule.tsx + .module.css
MiniappStackCard miniapp-stack-card.tsx + .module.css
MiniappStackView miniapp-stack-view.tsx + .module.css
EcosystemTabIndicator ecosystem-tab-indicator.tsx + .module.css
AppStackPage app-stack-page.tsx

新增服务

  • src/services/miniapp-runtime/ - 应用运行时服务

测试

  • ✅ 单元测试:9 tasks passed
  • ✅ Storybook:75 files, 405 tests passed
  • ✅ E2E:ecosystem-miniapp.mock (54) + miniapp-ui.mock (16)

提交记录

b12b1ce Phase 1: MiniappSplashScreen 光晕组件
679b223 Phase 2: miniapp-runtime Service
807665c Phase 3: 三页布局 + Parallax 壁纸
9136fe9 Phase 4: MiniappWindow + FLIP 动画
4d5d1eb Phase 5: 胶囊按钮 + 窗口不覆盖 TabBar
3822bed Phase 6: MiniappStackCard + MiniappStackView
fd1e446 Phase 7: EcosystemTabIndicator 双向绑定
5e12f22 docs: CSS Modules 最佳实践
0eb52e1 fix(e2e): 更新 E2E 测试适配 Swiper 导航

- Create MiniappSplashScreen component with theme-based glow rendering
- Use CSS module for component styles (new convention)
- Support themeColor extraction from hex/rgb/oklch/hsl formats
- Generate analogous colors for three-layer glow effect
- Add comprehensive unit tests (17 tests)
- Add Storybook stories with real DOM tests
- Include accessibility attributes (role, aria-label)
- Create types.ts with MiniappInstance, FlipFrames, and runtime state types
- Create flip-animator.ts for FLIP animation calculations
- Create iframe-manager.ts for iframe lifecycle (4 max background)
- Create index.ts with store, actions, and selectors
- Support launch/activate/deactivate/close app lifecycle
- Support DOM ref registration for icons and window
- Add FLIP animation playback with Web Animations API
- Add gesture-controlled animation support
- Add unit tests for flip-animator
- Update EcosystemSubPage type to include 'stack'
- Add ECOSYSTEM_SUBPAGE_INDEX and ECOSYSTEM_INDEX_SUBPAGE mappings
- Create AppStackPage component as third page background
- Refactor EcosystemTab with Swiper Parallax module
- Share IOSWallpaper across all three pages with -38.2% parallax
- Disable sliding to stack page when no running apps
- Remove IOSWallpaper from MyAppsPage (now provided by Parallax)
- Create MiniappWindow component as global popover layer
- Add miniapp-window.module.css for window styles
- Register icon refs in IOSDesktopIcon for FLIP animation
- Integrate MiniappWindow in StackflowApp
- Update EcosystemTab to use launchApp instead of push Activity
- Auto-slide to stack page when launching app
- Export MiniappRuntimeEvent type from service
- Create MiniappCapsule component (IconDots + close button)
- Update MiniappWindow to not cover bottom TabBar
- Use CSS variable --tab-bar-height for layout
- Update flip-animator to calculate TabBar height
- Replace temporary close button with capsule
- Add miniapp-capsule.module.css with backdrop blur styling
- Create MiniappStackCard with swipe-up-to-close gesture
- Create MiniappStackView container with Swiper EffectCards
- Add swipe-up gesture detection on TabBar ecosystem button
- Show running apps indicator (red dot) on ecosystem tab
- Integrate stack view in StackflowApp
- Export new components from index
- Create EcosystemTabIndicator component with crossfade animation
- Show current page icon with dot indicators
- Support click to switch pages
- Bidirectional sync with Swiper slides
- Position above TabBar
- Hide stack page when no running apps
- Add guidance on when to use CSS Modules vs Tailwind
- Document naming convention: component-name.module.css
- Add swipeToMyAppsPage helper for Swiper page navigation
- Replace button clicks with swipe gestures
- Add data-testid to IOSDesktopIcon for app icon selection
- Update TabBar ecosystem icon logic (IconAppWindowFilled when running apps)
- Update E2E screenshots for new UI layout
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants