reflex-capacitor 0.3.2__tar.gz

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.
Files changed (41) hide show
  1. reflex_capacitor-0.3.2/.gitignore +59 -0
  2. reflex_capacitor-0.3.2/CHANGELOG.md +115 -0
  3. reflex_capacitor-0.3.2/LICENSE +21 -0
  4. reflex_capacitor-0.3.2/PKG-INFO +126 -0
  5. reflex_capacitor-0.3.2/README.md +107 -0
  6. reflex_capacitor-0.3.2/docs/README.md +43 -0
  7. reflex_capacitor-0.3.2/docs/guide/00-getting-started.md +111 -0
  8. reflex_capacitor-0.3.2/docs/guide/02-native-bridge.md +240 -0
  9. reflex_capacitor-0.3.2/docs/guide/android-build.md +91 -0
  10. reflex_capacitor-0.3.2/docs/guide/ci.md +98 -0
  11. reflex_capacitor-0.3.2/docs/guide/cli.md +91 -0
  12. reflex_capacitor-0.3.2/docs/guide/configuration.md +103 -0
  13. reflex_capacitor-0.3.2/docs/guide/debug.md +78 -0
  14. reflex_capacitor-0.3.2/docs/guide/dev-reload.md +114 -0
  15. reflex_capacitor-0.3.2/docs/guide/faq.md +82 -0
  16. reflex_capacitor-0.3.2/docs/guide/install.md +193 -0
  17. reflex_capacitor-0.3.2/docs/guide/publishing.md +128 -0
  18. reflex_capacitor-0.3.2/pyproject.toml +70 -0
  19. reflex_capacitor-0.3.2/src/reflex_capacitor/__init__.py +8 -0
  20. reflex_capacitor-0.3.2/src/reflex_capacitor/android_signing.py +166 -0
  21. reflex_capacitor-0.3.2/src/reflex_capacitor/bridge/__init__.py +34 -0
  22. reflex_capacitor-0.3.2/src/reflex_capacitor/bridge/_script.py +48 -0
  23. reflex_capacitor-0.3.2/src/reflex_capacitor/bridge/api.py +359 -0
  24. reflex_capacitor-0.3.2/src/reflex_capacitor/bridge/api.pyi +60 -0
  25. reflex_capacitor-0.3.2/src/reflex_capacitor/bridge/assets/bridge.js +805 -0
  26. reflex_capacitor-0.3.2/src/reflex_capacitor/bridge/assets/image-editor.js +614 -0
  27. reflex_capacitor-0.3.2/src/reflex_capacitor/bridge/inject.py +88 -0
  28. reflex_capacitor-0.3.2/src/reflex_capacitor/bridge/ios_plist.py +112 -0
  29. reflex_capacitor-0.3.2/src/reflex_capacitor/bridge/log.py +60 -0
  30. reflex_capacitor-0.3.2/src/reflex_capacitor/bridge/plugins.py +259 -0
  31. reflex_capacitor-0.3.2/src/reflex_capacitor/cli.py +793 -0
  32. reflex_capacitor-0.3.2/src/reflex_capacitor/components/__init__.py +5 -0
  33. reflex_capacitor-0.3.2/src/reflex_capacitor/components/image_editor.py +92 -0
  34. reflex_capacitor-0.3.2/src/reflex_capacitor/config.py +50 -0
  35. reflex_capacitor-0.3.2/src/reflex_capacitor/dev_util.py +59 -0
  36. reflex_capacitor-0.3.2/src/reflex_capacitor/network_env.py +86 -0
  37. reflex_capacitor-0.3.2/src/reflex_capacitor/plugin.py +392 -0
  38. reflex_capacitor-0.3.2/src/reflex_capacitor/preflight.py +394 -0
  39. reflex_capacitor-0.3.2/src/reflex_capacitor/scaffold/.gitignore +8 -0
  40. reflex_capacitor-0.3.2/src/reflex_capacitor/scaffold/capacitor.config.json +8 -0
  41. reflex_capacitor-0.3.2/src/reflex_capacitor/scaffold/package.json +13 -0
@@ -0,0 +1,59 @@
1
+ *.py[cod]
2
+ .states
3
+ .web
4
+ *.db
5
+ assets/external/
6
+
7
+ # Python-generated files
8
+ __pycache__/
9
+ *.py[oc]
10
+ build/
11
+ dist/
12
+ wheels/
13
+ *.egg-info
14
+ .pytest_cache/
15
+ .ruff_cache/
16
+ .mypy_cache/
17
+ .coverage
18
+ htmlcov/
19
+
20
+ # Virtual environments
21
+ .venv
22
+ venv/
23
+
24
+ # Secrets & local env (never commit)
25
+ .env
26
+ .env.*
27
+ !.env.example
28
+ *.pem
29
+ *.p12
30
+
31
+ # Android / iOS signing & vendor push config
32
+ *.keystore
33
+ *.jks
34
+ keystore.properties
35
+ google-services.json
36
+ GoogleService-Info.plist
37
+
38
+ # Android SDK path (machine-specific)
39
+ local.properties
40
+ **/local.properties
41
+
42
+ # Capacitor project (generated by reflex-capacitor init/sync)
43
+ capacitor/
44
+ node_modules/
45
+
46
+ # Mobile build outputs (if copied outside capacitor/)
47
+ *.apk
48
+ *.aab
49
+ *.ipa
50
+
51
+ # Reflex export artifacts
52
+ frontend.zip
53
+ *.zip
54
+
55
+ # IDE / editor (optional local)
56
+ .idea/
57
+ .vscode/
58
+ *.swp
59
+ .cursor/
@@ -0,0 +1,115 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project are documented here.
4
+
5
+ ## [0.3.2] — 2026-08-25
6
+
7
+ ### Fixes
8
+
9
+ - `project.urls` must be absolute HTTPS links for PyPI (relative `docs/README.md` caused upload 400)
10
+
11
+ ## [0.3.1] — 2026-08-25
12
+
13
+ ### Fixes
14
+
15
+ - Hatch wheel: drop redundant `force-include` for `bridge/assets` (already packaged via `packages`), which caused duplicate `bridge.js` and failed `python -m build`
16
+
17
+ ## [0.3.0] — 2026-08-25
18
+
19
+ Phase 5 features for PyPI, plus a Python 3.12 compatibility fix for Android manifest permission patching.
20
+
21
+ ### Fixes
22
+
23
+ - Android `uses-permission` insert: use positional `str.replace(..., 1)` (Python 3.12 rejects `count=` keyword)
24
+
25
+ ### Deep linking
26
+
27
+ - [docs/guide/deep-linking.md](docs/guide/deep-linking.md) — Android / iOS URL scheme 配置与 Reflex 事件处理
28
+ - Demo:`appUrlOpen` 展示、`on_app_load` 自动轮询原生事件
29
+
30
+ ### Push notifications
31
+
32
+ - `PHASE5_PLUGIN_IDS` — optional `push-notifications` plugin tier
33
+ - `mobile.push_register()` / `push_check_permissions()` / `push_request_permissions()`
34
+ - Bridge push listeners → `pushRegistration`, `pushNotificationReceived`, etc.
35
+ - [docs/guide/push-notifications.md](docs/guide/push-notifications.md) — FCM / APNs 接入说明
36
+ - Documented as **opt-in** for PyPI consumers (not in default `ALL_PLUGIN_IDS`)
37
+
38
+ ### CLI proxy (npm / Gradle)
39
+
40
+ - `--proxy URL` on `init` / `sync` / `run` / `build` / `dev` (env: `REFLEX_CAPACITOR_PROXY`)
41
+ - Default: **no proxy**; ambient `http_proxy` / `HTTPS_PROXY` are stripped for child processes
42
+
43
+ ### Host dependency checks
44
+
45
+ - Stronger `doctor` / alias `check`: Reflex, Node, npm, JDK 17+, Android SDK platforms & build-tools
46
+ - `init` / `build` / `run` / `dev` fail fast with an explicit missing list (no auto-install of host SDKs)
47
+ - `--device` requires `adb` for run/dev
48
+
49
+ ### PyPI publish CI
50
+
51
+ - [`.github/workflows/publish-pypi.yml`](.github/workflows/publish-pypi.yml) — on GitHub Release `published`; secret `PYPI_API_TOKEN`
52
+ - Verifies wheel includes `bridge.js` + scaffold; tag `vX.Y.Z` must match `pyproject.toml` version
53
+
54
+ ### Docs restructure (2026-08-25)
55
+
56
+ - [docs/README.md](docs/README.md) — hub; docs split into **`guide/`** (howto) + **`design/`** (architecture & plan)
57
+ - New howto: [cli](docs/guide/cli.md), [configuration](docs/guide/configuration.md), [android-build](docs/guide/android-build.md), [install](docs/guide/install.md), [faq](docs/guide/faq.md)
58
+ - New design: [packaging](docs/design/packaging.md), [security-network](docs/design/security-network.md)
59
+ - Slim [getting-started](docs/guide/00-getting-started.md); [roadmap](docs/design/04-roadmap.md); [ADR](docs/design/03-development-plan.md)
60
+ - Docs split: `guide/` (user) + `design/` (maintainer); merged plan/ADR; PyPI sdist ships core guide only
61
+
62
+ ### L1 integration tests
63
+
64
+ - `tests/test_integration_scaffold.py` — offline scaffold / post_build / finalize_bridge / Manifest
65
+ - `tests/conftest.py` — fixtures
66
+ - `tests/helpers.py` — fake export / node_modules helpers
67
+ - Run: `pytest tests/ -m integration`
68
+
69
+ ### L3 device smoke
70
+
71
+ - `scripts/device-smoke.sh` — adb install, launch, logcat bridge check, optional deep link
72
+ - `tests/test_device_smoke.py` — `-m device` (skips without adb)
73
+ - [docs/guide/testing.md](docs/guide/testing.md)
74
+
75
+ ### iOS platform compatibility
76
+
77
+ - `bridge/ios_plist.py` — Info.plist usage descriptions on `finalize_bridge`
78
+ - `mobile.platform_info()` + bridge `isAndroid` / `isIos` / `platformInfo`
79
+ - [docs/guide/platform.md](docs/guide/platform.md)
80
+
81
+ ## [0.2.0] — 2026-08-24
82
+
83
+ Phase 1–4 core complete. See [docs/guide/00-getting-started.md](docs/guide/00-getting-started.md) for the full workflow.
84
+
85
+ ### Phase 4 — Release builds
86
+
87
+ - `reflex-capacitor build android|ios` — release/debug APK/AAB via Gradle
88
+ - Android signing via `REFLEX_CAPACITOR_KEYSTORE_*` env vars or CLI flags
89
+ - [docs/guide/publishing.md](docs/guide/publishing.md) — keystore, Play Store, iOS notes
90
+ - GitHub Actions workflow `android-release-aab.yml` (manual, production secrets)
91
+
92
+ ### Phase 3 — P1 + dev experience
93
+
94
+ - P1 bridge APIs: camera, geolocation, preferences, filesystem, keyboard, browser, `invoke`
95
+ - Built-in image editor (free crop, pinch zoom) — [docs/guide/image-editor.md](docs/guide/image-editor.md)
96
+ - `reflex-capacitor dev android` — LAN device development — [docs/guide/dev-reload.md](docs/guide/dev-reload.md)
97
+ - Native reverse events: `setup_native_listeners`, `poll_native_events`
98
+ - Camera/geolocation Android fixes (permissions, feedback toasts)
99
+
100
+ ### Phase 2 — Native bridge P0
101
+
102
+ - `window.__REFLEX_CAPACITOR__` + `mobile.*` Python API
103
+ - P0: notify, toast, haptics, share, clipboard, device, network, etc.
104
+ - Demo native tab + CI Environment matrix (lan / staging / production)
105
+ - [docs/guide/permissions.md](docs/guide/permissions.md), [docs/guide/debug.md](docs/guide/debug.md)
106
+
107
+ ### Phase 1 — Shell + remote backend
108
+
109
+ - `CapacitorPlugin`, CLI (`init`, `sync`, `run`, `open`, `doctor`)
110
+ - HTTP LAN backend support (`cleartext`, `androidScheme: http`)
111
+ - GitHub Actions debug APK — [docs/guide/ci.md](docs/guide/ci.md)
112
+
113
+ ## [0.1.0] — Initial
114
+
115
+ - Project scaffold, remote Capacitor shell concept
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 0x7eQiChen
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,126 @@
1
+ Metadata-Version: 2.5
2
+ Name: reflex-capacitor
3
+ Version: 0.3.2
4
+ Summary: Package a Reflex app as a Capacitor mobile app (remote backend).
5
+ Project-URL: Homepage, https://github.com/JiaLiangChen99/reflex_capacitor
6
+ Project-URL: Documentation, https://github.com/JiaLiangChen99/reflex_capacitor/blob/main/docs/README.md
7
+ Project-URL: Changelog, https://github.com/JiaLiangChen99/reflex_capacitor/blob/main/CHANGELOG.md
8
+ Project-URL: Repository, https://github.com/JiaLiangChen99/reflex_capacitor
9
+ Project-URL: Issues, https://github.com/JiaLiangChen99/reflex_capacitor/issues
10
+ License-Expression: Apache-2.0
11
+ License-File: LICENSE
12
+ Keywords: android,capacitor,ios,mobile,packaging,reflex
13
+ Requires-Python: >=3.10
14
+ Requires-Dist: click>=8.1.0
15
+ Requires-Dist: reflex>=0.9.0
16
+ Provides-Extra: dev
17
+ Requires-Dist: pytest>=8.0; extra == 'dev'
18
+ Description-Content-Type: text/markdown
19
+
20
+ # Package a Reflex app as a Capacitor mobile app
21
+
22
+ Ship the same Reflex frontend into an iOS / Android WebView via
23
+ [Capacitor](https://capacitorjs.com), talking to a **hosted** Reflex backend over HTTPS/WSS.
24
+
25
+ **Docs (Chinese howto / design / roadmap):** [`docs/README.md`](docs/README.md) ·
26
+ **Start here:** [`docs/guide/00-getting-started.md`](docs/guide/00-getting-started.md) ·
27
+ [FAQ](docs/guide/faq.md) · [Install & PyPI](docs/guide/install.md) · [CHANGELOG](CHANGELOG.md)
28
+
29
+ ```bash
30
+ pip install reflex-capacitor # or: pip install -e .
31
+ reflex-capacitor check --android
32
+ reflex-capacitor init --platform android
33
+ # set CapacitorPlugin(backend_url=...) in rxconfig.py
34
+ reflex-capacitor sync
35
+ reflex-capacitor run android # device / emulator
36
+ reflex-capacitor build android --debug # APK
37
+ ```
38
+
39
+ Host toolchains (Node / JDK / Android SDK / Xcode) are **detected, never auto-installed**.
40
+ See [`docs/guide/cli.md`](docs/guide/cli.md) and [`docs/guide/install.md`](docs/guide/install.md).
41
+
42
+ ## Configure
43
+
44
+ ```python
45
+ # rxconfig.py
46
+ import reflex as rx
47
+ from reflex_capacitor import CapacitorPlugin
48
+ from reflex_capacitor.bridge.plugins import ALL_PLUGIN_IDS
49
+
50
+ config = rx.Config(
51
+ app_name="demo",
52
+ cors_allowed_origins=["*"], # tighten in production
53
+ plugins=[
54
+ CapacitorPlugin(
55
+ backend_url="https://api.example.com",
56
+ app_id="com.example.myapp",
57
+ app_name="My App",
58
+ plugins=ALL_PLUGIN_IDS, # default in code is CORE only; ALL recommended
59
+ ),
60
+ ],
61
+ )
62
+ ```
63
+
64
+ Push notifications are **opt-in** (`PHASE5_PLUGIN_IDS`). Details:
65
+ [`docs/guide/configuration.md`](docs/guide/configuration.md),
66
+ [`docs/guide/push-notifications.md`](docs/guide/push-notifications.md).
67
+
68
+ ## Commands
69
+
70
+ | Command | Purpose |
71
+ |---------|---------|
72
+ | `doctor` / `check` | Host dependency report (`--android`, `--device`, `--ios`) |
73
+ | `init` | Scaffold `capacitor/`, `npm install`, `cap add` |
74
+ | `sync` | `reflex export` → `www/` → `npx cap sync` |
75
+ | `run` / `dev` | Sync + launch (dev: LAN backend helper) |
76
+ | `build` | Release/debug APK, AAB, or iOS archive |
77
+ | `open` | Open Android Studio / Xcode |
78
+
79
+ Proxy for npm/Gradle (off by default): `--proxy URL` or `REFLEX_CAPACITOR_PROXY`.
80
+
81
+ Full CLI: [`docs/guide/cli.md`](docs/guide/cli.md) · Dev reload: [`docs/guide/dev-reload.md`](docs/guide/dev-reload.md) ·
82
+ Store signing: [`docs/guide/publishing.md`](docs/guide/publishing.md)
83
+
84
+ ## Python API
85
+
86
+ ```python
87
+ from reflex_capacitor import mobile
88
+
89
+ mobile.notify("Hello", "From Reflex")
90
+ mobile.get_current_position(State.on_gps)
91
+ mobile.setup_native_listeners(back_button="emit")
92
+ mobile.poll_native_events(State.on_native_events)
93
+ ```
94
+
95
+ API map: [`docs/guide/02-native-bridge.md`](docs/guide/02-native-bridge.md)
96
+
97
+ ## Backend URL
98
+
99
+ | Environment | URL | Notes |
100
+ |-------------|-----|-------|
101
+ | Production | `https://…` | WSS; required for store builds |
102
+ | LAN | `http://192.168.x.x:port` | cleartext + `androidScheme: http` (automatic) |
103
+ | Emulator → host | `http://10.0.2.2:8000` | Android emulator loopback |
104
+
105
+ Network & CORS: [`docs/guide/configuration.md`](docs/guide/configuration.md)
106
+
107
+ ## Layout
108
+
109
+ | Path | Role |
110
+ |------|------|
111
+ | `src/reflex_capacitor/` | Library (`CapacitorPlugin`, CLI, bridge) |
112
+ | `demo/` | Sample app |
113
+ | `capacitor/` | Generated Capacitor project (after `init`) |
114
+ | `docs/` | Docs hub: [`docs/README.md`](docs/README.md) (`guide/` + `design/`) |
115
+
116
+ ## CI
117
+
118
+ - Debug APK — [`docs/guide/ci.md`](docs/guide/ci.md)
119
+ - Release AAB — [`docs/guide/publishing.md`](docs/guide/publishing.md)
120
+
121
+ ## Limitations
122
+
123
+ - **Remote backend only** — no embedded Python on device
124
+ - **Not a mobile UI kit** — Reflex UI + `mobile.*` bridge
125
+ - **Android-first** — iOS needs macOS; no iOS CI in this repo yet
126
+ - Host SDKs checked by `check`, never installed by this tool
@@ -0,0 +1,107 @@
1
+ # Package a Reflex app as a Capacitor mobile app
2
+
3
+ Ship the same Reflex frontend into an iOS / Android WebView via
4
+ [Capacitor](https://capacitorjs.com), talking to a **hosted** Reflex backend over HTTPS/WSS.
5
+
6
+ **Docs (Chinese howto / design / roadmap):** [`docs/README.md`](docs/README.md) ·
7
+ **Start here:** [`docs/guide/00-getting-started.md`](docs/guide/00-getting-started.md) ·
8
+ [FAQ](docs/guide/faq.md) · [Install & PyPI](docs/guide/install.md) · [CHANGELOG](CHANGELOG.md)
9
+
10
+ ```bash
11
+ pip install reflex-capacitor # or: pip install -e .
12
+ reflex-capacitor check --android
13
+ reflex-capacitor init --platform android
14
+ # set CapacitorPlugin(backend_url=...) in rxconfig.py
15
+ reflex-capacitor sync
16
+ reflex-capacitor run android # device / emulator
17
+ reflex-capacitor build android --debug # APK
18
+ ```
19
+
20
+ Host toolchains (Node / JDK / Android SDK / Xcode) are **detected, never auto-installed**.
21
+ See [`docs/guide/cli.md`](docs/guide/cli.md) and [`docs/guide/install.md`](docs/guide/install.md).
22
+
23
+ ## Configure
24
+
25
+ ```python
26
+ # rxconfig.py
27
+ import reflex as rx
28
+ from reflex_capacitor import CapacitorPlugin
29
+ from reflex_capacitor.bridge.plugins import ALL_PLUGIN_IDS
30
+
31
+ config = rx.Config(
32
+ app_name="demo",
33
+ cors_allowed_origins=["*"], # tighten in production
34
+ plugins=[
35
+ CapacitorPlugin(
36
+ backend_url="https://api.example.com",
37
+ app_id="com.example.myapp",
38
+ app_name="My App",
39
+ plugins=ALL_PLUGIN_IDS, # default in code is CORE only; ALL recommended
40
+ ),
41
+ ],
42
+ )
43
+ ```
44
+
45
+ Push notifications are **opt-in** (`PHASE5_PLUGIN_IDS`). Details:
46
+ [`docs/guide/configuration.md`](docs/guide/configuration.md),
47
+ [`docs/guide/push-notifications.md`](docs/guide/push-notifications.md).
48
+
49
+ ## Commands
50
+
51
+ | Command | Purpose |
52
+ |---------|---------|
53
+ | `doctor` / `check` | Host dependency report (`--android`, `--device`, `--ios`) |
54
+ | `init` | Scaffold `capacitor/`, `npm install`, `cap add` |
55
+ | `sync` | `reflex export` → `www/` → `npx cap sync` |
56
+ | `run` / `dev` | Sync + launch (dev: LAN backend helper) |
57
+ | `build` | Release/debug APK, AAB, or iOS archive |
58
+ | `open` | Open Android Studio / Xcode |
59
+
60
+ Proxy for npm/Gradle (off by default): `--proxy URL` or `REFLEX_CAPACITOR_PROXY`.
61
+
62
+ Full CLI: [`docs/guide/cli.md`](docs/guide/cli.md) · Dev reload: [`docs/guide/dev-reload.md`](docs/guide/dev-reload.md) ·
63
+ Store signing: [`docs/guide/publishing.md`](docs/guide/publishing.md)
64
+
65
+ ## Python API
66
+
67
+ ```python
68
+ from reflex_capacitor import mobile
69
+
70
+ mobile.notify("Hello", "From Reflex")
71
+ mobile.get_current_position(State.on_gps)
72
+ mobile.setup_native_listeners(back_button="emit")
73
+ mobile.poll_native_events(State.on_native_events)
74
+ ```
75
+
76
+ API map: [`docs/guide/02-native-bridge.md`](docs/guide/02-native-bridge.md)
77
+
78
+ ## Backend URL
79
+
80
+ | Environment | URL | Notes |
81
+ |-------------|-----|-------|
82
+ | Production | `https://…` | WSS; required for store builds |
83
+ | LAN | `http://192.168.x.x:port` | cleartext + `androidScheme: http` (automatic) |
84
+ | Emulator → host | `http://10.0.2.2:8000` | Android emulator loopback |
85
+
86
+ Network & CORS: [`docs/guide/configuration.md`](docs/guide/configuration.md)
87
+
88
+ ## Layout
89
+
90
+ | Path | Role |
91
+ |------|------|
92
+ | `src/reflex_capacitor/` | Library (`CapacitorPlugin`, CLI, bridge) |
93
+ | `demo/` | Sample app |
94
+ | `capacitor/` | Generated Capacitor project (after `init`) |
95
+ | `docs/` | Docs hub: [`docs/README.md`](docs/README.md) (`guide/` + `design/`) |
96
+
97
+ ## CI
98
+
99
+ - Debug APK — [`docs/guide/ci.md`](docs/guide/ci.md)
100
+ - Release AAB — [`docs/guide/publishing.md`](docs/guide/publishing.md)
101
+
102
+ ## Limitations
103
+
104
+ - **Remote backend only** — no embedded Python on device
105
+ - **Not a mobile UI kit** — Reflex UI + `mobile.*` bridge
106
+ - **Android-first** — iOS needs macOS; no iOS CI in this repo yet
107
+ - Host SDKs checked by `check`, never installed by this tool
@@ -0,0 +1,43 @@
1
+ # reflex-capacitor 文档
2
+
3
+ **remote** 模式:Reflex 静态前端进 Capacitor 壳,连远端 Python 后端。
4
+
5
+ | 目录 | 读者 | 说明 |
6
+ |------|------|------|
7
+ | **[guide/](guide/)** | 使用者 | 安装、配置、CLI、打包、API、调试 |
8
+ | **[design/](design/)** | 维护者 | 架构、打包原理、规划、测试(**不进 PyPI 包**) |
9
+
10
+ 👉 首读:[guide/00-getting-started.md](guide/00-getting-started.md) · [guide/faq.md](guide/faq.md)
11
+
12
+ ---
13
+
14
+ ## guide/ — 用户文档(推荐)
15
+
16
+ | 文档 | 用途 |
17
+ |------|------|
18
+ | [00-getting-started.md](guide/00-getting-started.md) | 快速上手 |
19
+ | [install.md](guide/install.md) | pip / 依赖 / PyPI / 推送 GitHub 前检查 |
20
+ | [faq.md](guide/faq.md) | 常见问题 |
21
+ | [cli.md](guide/cli.md) | 命令行 |
22
+ | [configuration.md](guide/configuration.md) | `CapacitorPlugin`、CORS、平台 |
23
+ | [android-build.md](guide/android-build.md) | 本机打 APK |
24
+ | [02-native-bridge.md](guide/02-native-bridge.md) | `mobile.*` API |
25
+ | [dev-reload.md](guide/dev-reload.md) | 真机开发 |
26
+ | [debug.md](guide/debug.md) | 排障 |
27
+ | [publishing.md](guide/publishing.md) | 签名与上架 |
28
+ | [ci.md](guide/ci.md) | GitHub Actions 打 APK |
29
+
30
+ **按需阅读**(可选能力):[permissions.md](guide/permissions.md) · [deep-linking.md](guide/deep-linking.md) · [push-notifications.md](guide/push-notifications.md)
31
+
32
+ ---
33
+
34
+ ## design/ — 架构与规划(仓库内)
35
+
36
+ | 文档 | 用途 |
37
+ |------|------|
38
+ | [01-architecture.md](design/01-architecture.md) | 三层架构 |
39
+ | [packaging.md](design/packaging.md) | export → sync 数据流 |
40
+ | [plan.md](design/plan.md) | ADR + 路线图 |
41
+ | [testing.md](design/testing.md) | L1/L3 测试 |
42
+
43
+ [CHANGELOG.md](../CHANGELOG.md) · [README.md](../README.md)
@@ -0,0 +1,111 @@
1
+ # 快速上手
2
+
3
+ > 最后更新:2026-08-25
4
+ > 平台:**Android**(Windows/Linux 可开发);**iOS** 需 Mac。
5
+
6
+ 最短路径:装好依赖 → 配 `backend_url` → `init` / `sync` → 真机或 CI 出包。细节见专题文档;总索引见 [README.md](../README.md)。
7
+
8
+ ---
9
+
10
+ ## 1. 安装与检查
11
+
12
+ ```bash
13
+ pip install reflex-capacitor # 或本仓库: pip install -e .
14
+ reflex-capacitor check --android
15
+ ```
16
+
17
+ - 缺什么会逐条列出;**本 CLI 不代装** Node / JDK / Android SDK。
18
+ - 安装与 PyPI 发布说明 → [install.md](install.md)
19
+ - 仅同步前端:`check`(不必 `--android`)。
20
+ - 真机运行:`check --android --device`(要求 `adb`)。
21
+
22
+ 环境说明 → [android-build.md](android-build.md) · 命令全集 → [cli.md](cli.md)
23
+
24
+ ---
25
+
26
+ ## 2. 最小配置
27
+
28
+ ```python
29
+ import reflex as rx
30
+ from reflex_capacitor import CapacitorPlugin
31
+ from reflex_capacitor.bridge.plugins import ALL_PLUGIN_IDS
32
+
33
+ config = rx.Config(
34
+ app_name="demo",
35
+ cors_allowed_origins=["*"], # 生产请收紧
36
+ plugins=[
37
+ CapacitorPlugin(
38
+ backend_url="http://192.168.1.56:8001", # 生产用 https://
39
+ app_id="dev.reflex.myapp",
40
+ app_name="My App",
41
+ plugins=ALL_PLUGIN_IDS, # 推送等见 configuration.md
42
+ ),
43
+ ],
44
+ )
45
+ ```
46
+
47
+ | 环境 | `backend_url` |
48
+ |------|----------------|
49
+ | 局域网调试 | `http://<PC局域网IP>:端口`(自动 cleartext) |
50
+ | 生产 | `https://api.example.com` |
51
+
52
+ 完整配置 → [configuration.md](configuration.md)
53
+
54
+ ---
55
+
56
+ ## 3. 首次出包
57
+
58
+ ```bash
59
+ reflex-capacitor init --platform android
60
+ reflex-capacitor sync
61
+ reflex-capacitor run android # 需设备/模拟器
62
+ # 或只打 APK:
63
+ reflex-capacitor build android --debug
64
+ ```
65
+
66
+ 下载慢时显式代理(默认**不用**代理):
67
+
68
+ ```bash
69
+ reflex-capacitor sync --proxy http://127.0.0.1:7890
70
+ ```
71
+
72
+ 无本机 SDK → [ci.md](ci.md)。后端需 `0.0.0.0`,手机与 PC 同网。
73
+
74
+ 日常开发 → [dev-reload.md](dev-reload.md) · 调试 → [debug.md](debug.md)
75
+
76
+ ---
77
+
78
+ ## 4. 原生 API(摘录)
79
+
80
+ ```python
81
+ from reflex_capacitor import mobile
82
+
83
+ mobile.notify("标题", "正文")
84
+ mobile.get_current_position(State.on_gps)
85
+ mobile.setup_native_listeners(back_button="emit")
86
+ mobile.poll_native_events(State.on_native_events)
87
+ ```
88
+
89
+ 完整表 → [02-native-bridge.md](02-native-bridge.md) · 权限 → [permissions.md](permissions.md)
90
+
91
+ ---
92
+
93
+ ## 5. 发布
94
+
95
+ ```bash
96
+ reflex-capacitor build android # release APK
97
+ reflex-capacitor build android --format aab
98
+ ```
99
+
100
+ 签名与上架 → [publishing.md](publishing.md)
101
+
102
+ ---
103
+
104
+ ## 6. 已知限制
105
+
106
+ - **仅 remote 后端**(设备上不跑 Python)
107
+ - **推送可选**(`PHASE5_PLUGIN_IDS`)→ [push-notifications.md](push-notifications.md)
108
+ - **iOS** 需 Mac;本仓库 CI 未跑 iOS
109
+ - 定位等机型差异 → [debug.md](debug.md)
110
+
111
+ 变更记录 → [CHANGELOG.md](../../CHANGELOG.md) · 常见问题 → [faq.md](faq.md)