@tbox.cn/app-miniapp-container-alipay 0.2.9 → 1.0.0-alpha.10

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 CHANGED
@@ -2,9 +2,19 @@
2
2
 
3
3
  tbox 组件化应用的**支付宝小程序容器**(壳):用一个全屏 `web-view` 承载智能体 H5(`apps/client`,dev 由 `apps/server` 直出),并把 H5 侧通过桥发来的 JSAPI 请求代理到小程序原生能力(选图、录音、定位、换码登录、支付……)。
4
4
 
5
- - 生成应用内经 `npx --yes @tbox.cn/app-cli miniapp-container init` 展开到 `apps/miniapp-container-alipay`;
5
+ - 生成应用内经 `pnpm exec tbox-app miniapp-container init` 展开到 `apps/miniapp-container-alipay`;
6
6
  - H5(浏览器)与壳里跑的是**同一份前端代码**——浏览器走 Web API,壳里走本桥的原生能力,业务无感知。
7
7
 
8
+ ## 内核要求(Chromium 105)
9
+
10
+ `app.json` 声明了 `"myweb": "force_enable"`,把安卓端 web-view 从旧内核(Chromium 69)切到 **MYWeb(基于 Chromium 105)**。
11
+
12
+ - **为什么必须**:H5 用 Tailwind v4 编译,产物含 `@layer`(Chromium 99+)、逻辑属性(87+)、`:where()`(88+)、独立变换(104+)、容器查询(105)。旧内核下 `@layer` 整层被丢弃 → **整页无样式**。
13
+ - **生效条件**:支付宝安卓客户端 **10.5.26+**、小程序 IDE 3.7.10+;低于此版本的客户端会忽略该配置(仍是 69)。发布前用 `my.ap.updateAlipayClient` 引导升级,或接受这部分设备的降级。
14
+ - **10.5.36–10.5.50 的已知问题**:切换后若未生效,需手动关闭并重开一次支付宝;10.5.55 起修复。
15
+ - **UA 不可靠**:官方明确 UA 反馈不准确,判断内核版本请用功能探测(在平台仓运行 `pnpm compat:probe` 生成探测页;容器与生成应用不含该脚本),不要读 UA。
16
+ - **基线口径**:Chromium 105 意味着 `dvh/svh/lvh`(108+)不受支持——H5 侧对 `dvh` 一律写 `vh` 回退 + `supports-[height:100dvh]:` 渐进增强;`color-mix` 由构建产物自带的 `@supports` 兜底降级为实色。
17
+
8
18
  ## 工作原理
9
19
 
10
20
  ```
@@ -125,10 +135,10 @@ const customResponse = await callCapability('app.callCloudFunction', {
125
135
 
126
136
  ```
127
137
  miniapp-container-alipay/
128
- app.json / app.ts / app.less 小程序入口与全局
129
- mini.project.json / tsconfig.json 编译配置(format 2 + less/typescript/component2)
138
+ app.json / app.ts / app.acss 小程序入口与全局(ACSS token 层)
139
+ mini.project.json / tsconfig.json 编译配置(format 2 + typescript/component2)
130
140
  pages/ai-agent/
131
- index.axml / index.less / index.json 全屏 web-view 页面
141
+ index.axml / index.acss / index.json 全屏 web-view 页面
132
142
  index.ts 完整演示容器入口:H5 URL、mock 路径与默认能力
133
143
  runtime-page.ts 共用桥页面工厂:门禁、执行、回执与生命周期
134
144
  bridge.ts 消息解析/处置门禁/回执构建(协议工具,勿改协议常量)
@@ -163,4 +173,4 @@ CLI integrate 将本包的共用页面工厂接入原生/Minifish 2 JS/TS 工程
163
173
 
164
174
  已有工程不携带 mock 页面或示例云环境,也不默认获取 RecorderManager。宿主可配置 capabilities、createCloudFunctionHandler/createCloudContainerHandler,以及 recorder 适配器;生命周期由页面实例持有。完整演示入口显式注册默认云能力与 mock 路径。源码中的桥协议常量继续由 SDK 一致性测试约束。
165
175
 
166
- 用户操作以 CLI 子命令 `--help` 与随 CLI 发布的流程知识(`npx --yes @tbox.cn/app-cli skills get miniapp-container`)为准;仓内配方见[接入或创建容器](../../docs/cookbook/miniapp-container.md)。
176
+ 用户操作以 CLI 子命令 `--help` 与随 CLI 发布的流程知识(`pnpm exec tbox-app skills get miniapp-container`)为准;仓内配方见[接入或创建容器](../../docs/cookbook/miniapp-container.md)。
package/app.acss ADDED
@@ -0,0 +1,19 @@
1
+ /**
2
+ * 容器级样式(原生支付宝小程序):ACSS + rpx,不走 Tailwind。
3
+ *
4
+ * 为什么不是工具类:小程序 AXML 没有浏览器样式管线——不支持 @layer / @property / :where(),
5
+ * 也没有 Tailwind 的类名转换步骤,工具类产物无法在 ACSS 里落地。故容器的「统一」落在**同一套语义色 token**:
6
+ * 下面六个变量与 web 主题契约同名同值(--tbox-primary / --tbox-text-primary 等),页面样式只消费变量。
7
+ * 浏览器模板(template-agent / -support / template-h5)与业务模块仍然只用 Tailwind 工具类。
8
+ */
9
+ page {
10
+ --tbox-primary: #096bfa;
11
+ --tbox-on-primary: #ffffff;
12
+ --tbox-text-primary: #0b0f17;
13
+ --tbox-text-secondary: #535b6c;
14
+ --tbox-bg-page: #fbfcfe;
15
+ --tbox-bg-card: #ffffff;
16
+ --tbox-border: #e1e5ec;
17
+
18
+ background: var(--tbox-bg-page);
19
+ }
package/app.json CHANGED
@@ -7,5 +7,6 @@
7
7
  "lazyCodeLoading": "renderedComponents",
8
8
  "window": {
9
9
  "defaultTitle": ""
10
- }
11
- }
10
+ },
11
+ "myweb": "force_enable"
12
+ }
package/mini.project.json CHANGED
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "format": 2,
3
3
  "compileOptions": {
4
- "less": true,
5
4
  "typescript": true,
6
5
  "component2": true
7
6
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tbox.cn/app-miniapp-container-alipay",
3
- "version": "0.2.9",
4
- "description": "tbox 支付宝小程序容器:web-view 承载智能体 H5 + JSAPI 桥代理(通用 my.xxx 透传 + 录音/媒体特殊处理)。tbox-app miniapp-container init 的展开源。",
3
+ "version": "1.0.0-alpha.10",
4
+ "description": "tbox 支付宝小程序容器:web-view 承载智能体 H5 + JSAPI 桥代理(通用 my.xxx 透传 + 录音/媒体特殊处理)。miniapp-container init 命令的展开源(tbox-app CLI)。",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -9,7 +9,7 @@
9
9
  "files": [
10
10
  "app.json",
11
11
  "app.ts",
12
- "app.less",
12
+ "app.acss",
13
13
  "mini.project.json",
14
14
  "tsconfig.json",
15
15
  "tsconfig.tests.json",
@@ -24,11 +24,11 @@
24
24
  "@mini-types/alipay": "^3.0.14",
25
25
  "typescript": "5.9.3",
26
26
  "vitest": "4.1.10",
27
- "@tbox.cn/app-sdk-client": "0.21.4",
28
- "@tbox.cn/app-sdk-server": "0.26.2"
27
+ "@tbox.cn/app-sdk-server": "1.0.0-alpha.10",
28
+ "@tbox.cn/app-sdk-client": "1.0.0-alpha.10"
29
29
  },
30
30
  "scripts": {
31
- "dev": "minidev dev --typescript --less --hmr",
31
+ "dev": "minidev dev --typescript --hmr",
32
32
  "typecheck": "tsc --noEmit -p tsconfig.json && tsc --noEmit -p tsconfig.tests.json",
33
33
  "test": "vitest run"
34
34
  }
@@ -1,3 +1,4 @@
1
+ /* 全屏 web-view 承载智能体 H5:页面自身只负责铺满 */
1
2
  .ai-agent-page {
2
3
  width: 100%;
3
4
  height: 100vh;
@@ -0,0 +1,68 @@
1
+ /* 模拟登录门禁页(本地桥闭环测试用):布局用 rpx,颜色只用容器级 --tbox-* 变量 */
2
+ .mock-enroll {
3
+ display: flex;
4
+ flex-direction: column;
5
+ align-items: center;
6
+ padding: 48rpx 32rpx;
7
+ min-height: 100vh;
8
+ background: var(--tbox-bg-page);
9
+ box-sizing: border-box;
10
+ }
11
+
12
+ .mock-enroll__head {
13
+ display: flex;
14
+ flex-direction: column;
15
+ align-items: center;
16
+ margin-bottom: 32rpx;
17
+ }
18
+
19
+ .mock-enroll__icon {
20
+ width: 120rpx;
21
+ height: 120rpx;
22
+ border-radius: 60rpx;
23
+ background: var(--tbox-primary);
24
+ color: var(--tbox-on-primary);
25
+ font-size: 64rpx;
26
+ line-height: 120rpx;
27
+ text-align: center;
28
+ margin-bottom: 16rpx;
29
+ }
30
+
31
+ .mock-enroll__title {
32
+ font-size: 36rpx;
33
+ font-weight: 600;
34
+ color: var(--tbox-text-primary);
35
+ }
36
+
37
+ .mock-enroll__sub {
38
+ font-size: 24rpx;
39
+ color: var(--tbox-text-secondary);
40
+ margin-top: 8rpx;
41
+ }
42
+
43
+ .mock-enroll__hint {
44
+ width: 100%;
45
+ font-size: 26rpx;
46
+ color: var(--tbox-text-secondary);
47
+ line-height: 1.6;
48
+ margin: 16rpx 8rpx 40rpx;
49
+ }
50
+
51
+ .mock-enroll__actions {
52
+ width: 100%;
53
+ display: flex;
54
+ flex-direction: column;
55
+ gap: 20rpx;
56
+ }
57
+
58
+ .mock-enroll__btn {
59
+ width: 100%;
60
+ height: 88rpx;
61
+ border-radius: 44rpx;
62
+ font-size: 30rpx;
63
+ }
64
+
65
+ .mock-enroll__btn--primary {
66
+ background: var(--tbox-primary);
67
+ color: var(--tbox-on-primary);
68
+ }
@@ -0,0 +1,91 @@
1
+ /* 模拟收银台(本地桥闭环测试用):布局用 rpx,颜色只用容器级 --tbox-* 变量 */
2
+ .mock-pay {
3
+ display: flex;
4
+ flex-direction: column;
5
+ align-items: center;
6
+ padding: 48rpx 32rpx;
7
+ min-height: 100vh;
8
+ background: var(--tbox-bg-page);
9
+ box-sizing: border-box;
10
+ }
11
+
12
+ .mock-pay__head {
13
+ display: flex;
14
+ flex-direction: column;
15
+ align-items: center;
16
+ margin-bottom: 32rpx;
17
+ }
18
+
19
+ .mock-pay__icon {
20
+ width: 120rpx;
21
+ height: 120rpx;
22
+ border-radius: 60rpx;
23
+ background: var(--tbox-primary);
24
+ color: var(--tbox-on-primary);
25
+ font-size: 64rpx;
26
+ line-height: 120rpx;
27
+ text-align: center;
28
+ margin-bottom: 16rpx;
29
+ }
30
+
31
+ .mock-pay__title {
32
+ font-size: 36rpx;
33
+ font-weight: 600;
34
+ color: var(--tbox-text-primary);
35
+ }
36
+
37
+ .mock-pay__sub {
38
+ font-size: 24rpx;
39
+ color: var(--tbox-text-secondary);
40
+ margin-top: 8rpx;
41
+ }
42
+
43
+ .mock-pay__row {
44
+ width: 100%;
45
+ display: flex;
46
+ justify-content: space-between;
47
+ padding: 24rpx 28rpx;
48
+ margin-bottom: 16rpx;
49
+ background: var(--tbox-bg-card);
50
+ border-radius: 16rpx;
51
+ }
52
+
53
+ .mock-pay__label {
54
+ font-size: 28rpx;
55
+ color: var(--tbox-text-secondary);
56
+ }
57
+
58
+ .mock-pay__value {
59
+ font-size: 28rpx;
60
+ color: var(--tbox-text-primary);
61
+ word-break: break-all;
62
+ text-align: right;
63
+ max-width: 420rpx;
64
+ }
65
+
66
+ .mock-pay__hint {
67
+ width: 100%;
68
+ font-size: 26rpx;
69
+ color: var(--tbox-text-secondary);
70
+ line-height: 1.6;
71
+ margin: 16rpx 8rpx 40rpx;
72
+ }
73
+
74
+ .mock-pay__actions {
75
+ width: 100%;
76
+ display: flex;
77
+ flex-direction: column;
78
+ gap: 20rpx;
79
+ }
80
+
81
+ .mock-pay__btn {
82
+ width: 100%;
83
+ height: 88rpx;
84
+ border-radius: 44rpx;
85
+ font-size: 30rpx;
86
+ }
87
+
88
+ .mock-pay__btn--primary {
89
+ background: var(--tbox-primary);
90
+ color: var(--tbox-on-primary);
91
+ }
package/app.less DELETED
@@ -1,3 +0,0 @@
1
- page {
2
- background: #f7f7f7;
3
- }
@@ -1,67 +0,0 @@
1
- .mock-enroll {
2
- display: flex;
3
- flex-direction: column;
4
- align-items: center;
5
- padding: 48rpx 32rpx;
6
- min-height: 100vh;
7
- background: #f5f6f8;
8
- box-sizing: border-box;
9
-
10
- &__head {
11
- display: flex;
12
- flex-direction: column;
13
- align-items: center;
14
- margin-bottom: 32rpx;
15
- }
16
-
17
- &__icon {
18
- width: 120rpx;
19
- height: 120rpx;
20
- border-radius: 60rpx;
21
- background: #1677ff;
22
- color: #fff;
23
- font-size: 64rpx;
24
- line-height: 120rpx;
25
- text-align: center;
26
- margin-bottom: 16rpx;
27
- }
28
-
29
- &__title {
30
- font-size: 36rpx;
31
- font-weight: 600;
32
- color: #1f2329;
33
- }
34
-
35
- &__sub {
36
- font-size: 24rpx;
37
- color: #8a9099;
38
- margin-top: 8rpx;
39
- }
40
-
41
- &__hint {
42
- width: 100%;
43
- font-size: 26rpx;
44
- color: #8a9099;
45
- line-height: 1.6;
46
- margin: 16rpx 8rpx 40rpx;
47
- }
48
-
49
- &__actions {
50
- width: 100%;
51
- display: flex;
52
- flex-direction: column;
53
- gap: 20rpx;
54
- }
55
-
56
- &__btn {
57
- width: 100%;
58
- height: 88rpx;
59
- border-radius: 44rpx;
60
- font-size: 30rpx;
61
-
62
- &--primary {
63
- background: #1677ff;
64
- color: #fff;
65
- }
66
- }
67
- }
@@ -1,90 +0,0 @@
1
- .mock-pay {
2
- display: flex;
3
- flex-direction: column;
4
- align-items: center;
5
- padding: 48rpx 32rpx;
6
- min-height: 100vh;
7
- background: #f5f6f8;
8
- box-sizing: border-box;
9
-
10
- &__head {
11
- display: flex;
12
- flex-direction: column;
13
- align-items: center;
14
- margin-bottom: 32rpx;
15
- }
16
-
17
- &__icon {
18
- width: 120rpx;
19
- height: 120rpx;
20
- border-radius: 60rpx;
21
- background: #1677ff;
22
- color: #fff;
23
- font-size: 64rpx;
24
- line-height: 120rpx;
25
- text-align: center;
26
- margin-bottom: 16rpx;
27
- }
28
-
29
- &__title {
30
- font-size: 36rpx;
31
- font-weight: 600;
32
- color: #1f2329;
33
- }
34
-
35
- &__sub {
36
- font-size: 24rpx;
37
- color: #8a9099;
38
- margin-top: 8rpx;
39
- }
40
-
41
- &__row {
42
- width: 100%;
43
- display: flex;
44
- justify-content: space-between;
45
- padding: 24rpx 28rpx;
46
- margin-bottom: 16rpx;
47
- background: #fff;
48
- border-radius: 16rpx;
49
- }
50
-
51
- &__label {
52
- font-size: 28rpx;
53
- color: #8a9099;
54
- }
55
-
56
- &__value {
57
- font-size: 28rpx;
58
- color: #1f2329;
59
- word-break: break-all;
60
- text-align: right;
61
- max-width: 420rpx;
62
- }
63
-
64
- &__hint {
65
- width: 100%;
66
- font-size: 26rpx;
67
- color: #8a9099;
68
- line-height: 1.6;
69
- margin: 16rpx 8rpx 40rpx;
70
- }
71
-
72
- &__actions {
73
- width: 100%;
74
- display: flex;
75
- flex-direction: column;
76
- gap: 20rpx;
77
- }
78
-
79
- &__btn {
80
- width: 100%;
81
- height: 88rpx;
82
- border-radius: 44rpx;
83
- font-size: 30rpx;
84
-
85
- &--primary {
86
- background: #1677ff;
87
- color: #fff;
88
- }
89
- }
90
- }