Skip to content

Conversation

@Gaubee
Copy link
Contributor

@Gaubee Gaubee commented Jan 20, 2026

Summary

  • Introduce ContainerManager interface following SOLID principles
  • Implement IframeContainerManager (extracted from iframe-manager)
  • Implement WujieContainerManager (using wujie library)
  • Refactor launchApp to use container factory based on manifest.runtime

Architecture

src/services/miniapp-runtime/
├── container/
│   ├── types.ts              # ContainerManager, ContainerHandle interfaces
│   ├── iframe-container.ts   # IframeContainerManager implementation
│   ├── wujie-container.ts    # WujieContainerManager implementation
│   └── index.ts              # Factory: createContainer(type, options)
├── index.ts                  # launchApp uses factory
└── types.ts                  # MiniappInstance with containerHandle

SOLID Compliance

  • S: Each container manager has single responsibility
  • O: New runtime types can be added without modifying existing code
  • L: Both managers implement same ContainerHandle interface
  • I: ContainerHandle interface is minimal and focused
  • D: launchApp depends on abstraction (ContainerManager), not concrete implementations

Testing

  • pnpm typecheck passes
  • Manual testing: dev server, iframe mode works
  • Manual testing: build mode with wujie runtime

Breaking Changes

  • MiniappInstance.iframeRef is deprecated, use containerHandle.element instead

…compliance

- Create ContainerManager interface with ContainerHandle
- Implement IframeContainerManager (extracted from iframe-manager)
- Implement WujieContainerManager (using wujie library)
- Create container factory for runtime type switching
- Refactor launchApp to use container factory based on manifest.runtime
- Update activateApp/deactivateApp to use containerHandle methods
- Update finalizeCloseApp to properly destroy containers
- Add containerType and containerHandle to MiniappInstance
- Deprecate iframeRef in favor of containerHandle.element

BREAKING CHANGE: MiniappInstance now uses containerHandle instead of iframeRef
- Add destroyed state check to IframeContainerHandle methods
- Add destroyed state check to WujieContainerHandle moveToBackground/Foreground
- Remove deprecated iframe-manager.ts (replaced by container/iframe-container.ts)
- Add wujie package (required by wujie-container)
- Add container unit tests (10 tests for IframeContainerManager)
- Fix iframe.sandbox compatibility for jsdom test environment
- Support headless mode in dev.ts for non-TTY environments (CI)
- Add sendKeyAppContext() to broadcast keyapp:context-update after container attach
- Calculate capsule safe area dynamically (top margin + capsule height + padding)
- Enable miniapps to receive context via window message listener
- Update rwa-hub to listen for context and apply --f7-safe-area-top CSS variable
- Update white-book docs with CSS guidelines and container architecture
@Gaubee Gaubee force-pushed the feat/wujie-container-refactor branch from 20c9de9 to bb4e8dd Compare January 21, 2026 06:59
@Gaubee Gaubee merged commit 5788a5a into main Jan 21, 2026
5 checks passed
@Gaubee Gaubee deleted the feat/wujie-container-refactor branch January 21, 2026 07:03
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