@nutui/nutui-react-taro 4.0.0-beta.1 → 4.0.0-beta.2

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/CHANGELOG.md CHANGED
@@ -1,24 +1,29 @@
1
- # v4.0.0-beta.1
2
- `2026-06-05`
1
+ # v4.0.0-beta.2
2
+ `2026-06-08`
3
+
4
+ * :bug: fix: 移除jmfe桥接方式 (#3479)
3
5
 
4
6
 
5
- * 🤖 ci: add strict error handling and exit codes to issue resolver agent
6
- * 📖 docs: 修订文档
7
- * :sparkles: feat(agents): add local issue watcher daemon script
8
- * :sparkles: feat(toast): 适配v16,增加升级v4版本的文档 (#3471)
9
- * :sparkles: feat: inputnumber暗黑适配 (#3470)
10
- * :sparkles: feat: inputnumber更新 (#3466)
11
- * :sparkles: feat(checkbox): 适配v16并补充主题相关文档 (#3469)
12
- * :sparkles: feat(radio): 适配V16 (#3468)
13
- * :sparkles: feat(test): 单测处理 (#3467)
14
- * :sparkles: feat(button): v16 重构+无障碍支持 (#3465)
15
- * :bug: fix(swipe): resolve infinite re-render loop causing page freeze
16
- * :bug: fix(datepicker): 解决时间解析为 Invalid Date 的 Bug (#3472)
17
- * :bug: fix: conflicts
18
- * 🪵 refactor: 添加手动触发 (#3474)
19
- * 🪵 refactor: 添加GitHub Actions 自动化的 workflow 配置文件 (#3473)
20
- * 💡 test(swipe): add touch interaction tests for coverage
7
+ # v4.0.0-beta.1
8
+
9
+ `2026-06-05`
21
10
 
11
+ - 🤖 ci: add strict error handling and exit codes to issue resolver agent
12
+ - 📖 docs: 修订文档
13
+ - :sparkles: feat(agents): add local issue watcher daemon script
14
+ - :sparkles: feat(toast): 适配v16,增加升级v4版本的文档 (#3471)
15
+ - :sparkles: feat: inputnumber暗黑适配 (#3470)
16
+ - :sparkles: feat: inputnumber更新 (#3466)
17
+ - :sparkles: feat(checkbox): 适配v16并补充主题相关文档 (#3469)
18
+ - :sparkles: feat(radio): 适配V16 (#3468)
19
+ - :sparkles: feat(test): 单测处理 (#3467)
20
+ - :sparkles: feat(button): v16 重构+无障碍支持 (#3465)
21
+ - :bug: fix(swipe): resolve infinite re-render loop causing page freeze
22
+ - :bug: fix(datepicker): 解决时间解析为 Invalid Date 的 Bug (#3472)
23
+ - :bug: fix: conflicts
24
+ - 🪵 refactor: 添加手动触发 (#3474)
25
+ - 🪵 refactor: 添加GitHub Actions 自动化的 workflow 配置文件 (#3473)
26
+ - 💡 test(swipe): add touch interaction tests for coverage
22
27
 
23
28
  # v3.0.20
24
29
 
@@ -1,20 +1,3 @@
1
- /** 原生 DongScreenAdapterPlugin.getScale 的典型返回结构 */
2
- type NativeScaleResponse = {
3
- status?: string;
4
- data?: {
5
- scale?: number | string;
6
- };
7
- };
8
- /** jmfe 通用 callNative 签名 */
9
- type NativeCaller = (plugin: string, method: string, params: string, extra: string) => Promise<NativeScaleResponse>;
10
- /** 站内容器的 jmfe 桥接方法(可选) */
11
- declare global {
12
- interface Window {
13
- jmfe?: {
14
- callNative?: NativeCaller;
15
- };
16
- }
17
- }
18
1
  /** 字体档位:标准、大字、老年 */
19
2
  export type ScaleProfile = 'standard' | 'large' | 'elderly';
20
3
  /** 不同场景可选用不同放大比例(layout 等默认可不额外放大) */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * 响应式缩放系数(--nut-scale-f):结合京东站内原生桥与站外视口规则,
2
+ * 响应式缩放系数(--nut-scale-f):按视口宽度计算,
3
3
  * 写入根节点 CSS 变量(--nut-scale-f / --nut-scale-font / --nut-scale-icon),
4
4
  * 供布局/字号/icon 等按比例换算(见 calcByProfile)。H5 与 Taro WebView 共用此实现。
5
5
  */ "use strict";
@@ -20,10 +20,8 @@ _export(exports, {
20
20
  return initScaleF;
21
21
  }
22
22
  });
23
- var _async_to_generator = require("@swc/helpers/_/_async_to_generator");
24
- var _ts_generator = require("@swc/helpers/_/_ts_generator");
25
23
  var _canusedom = require("./can-use-dom");
26
- /** 当前基准缩放(来自原生或视口计算) */ var scale = 1;
24
+ /** 当前基准缩放(来自视口计算) */ var scale = 1;
27
25
  /** 大字模式下仅 font 场景的相对倍率 */ var LARGE_FONT_RATIO = 1.15;
28
26
  /** 老年模式下 font/icon/lego 场景的相对倍率 */ var ELDERLY_RATIO = 1.3;
29
27
  /** 全局当前档位,与 scale 共同参与 calcByProfile */ var profile = 'standard';
@@ -67,7 +65,7 @@ var _canusedom = require("./can-use-dom");
67
65
  }
68
66
  return Math.round(value);
69
67
  }
70
- /** 无原生桥时按屏宽推算 scale(含平板与 375 基准窄屏区间) */ function getScaleByViewport() {
68
+ /** 按屏宽推算 scale(含平板与 375 基准窄屏区间) */ function getScaleByViewport() {
71
69
  if (!_canusedom.canUseDom) return 1;
72
70
  var deviceWidth = window.innerWidth;
73
71
  if (!deviceWidth) return 1;
@@ -80,81 +78,8 @@ var _canusedom = require("./can-use-dom");
80
78
  }
81
79
  return 1;
82
80
  }
83
- /** 通过 jmfe.callNative 拉取 DongScreenAdapterPlugin;失败返回 null */ function getScaleByNative() {
84
- return (0, _async_to_generator._)(function() {
85
- var _window_jmfe, _res_data, res, parsed, e;
86
- return (0, _ts_generator._)(this, function(_state) {
87
- switch(_state.label){
88
- case 0:
89
- if (!_canusedom.canUseDom || !((_window_jmfe = window.jmfe) === null || _window_jmfe === void 0 ? void 0 : _window_jmfe.callNative)) return [
90
- 2,
91
- null
92
- ];
93
- _state.label = 1;
94
- case 1:
95
- _state.trys.push([
96
- 1,
97
- 3,
98
- ,
99
- 4
100
- ]);
101
- return [
102
- 4,
103
- window.jmfe.callNative('DongScreenAdapterPlugin', 'getScale', JSON.stringify({}), '')
104
- ];
105
- case 2:
106
- res = _state.sent();
107
- if ((res === null || res === void 0 ? void 0 : res.status) === '0' && ((_res_data = res.data) === null || _res_data === void 0 ? void 0 : _res_data.scale) !== undefined) {
108
- parsed = Number(res.data.scale);
109
- if (Number.isFinite(parsed) && parsed > 0) {
110
- return [
111
- 2,
112
- parsed
113
- ];
114
- }
115
- }
116
- return [
117
- 3,
118
- 4
119
- ];
120
- case 3:
121
- e = _state.sent();
122
- return [
123
- 3,
124
- 4
125
- ];
126
- case 4:
127
- return [
128
- 2,
129
- null
130
- ];
131
- }
132
- });
133
- })();
134
- }
135
- /** 统一获取缩放:站内原生优先,失败则用视口规则 */ function getScaleF() {
136
- return (0, _async_to_generator._)(function() {
137
- var nativeScale;
138
- return (0, _ts_generator._)(this, function(_state) {
139
- switch(_state.label){
140
- case 0:
141
- return [
142
- 4,
143
- getScaleByNative()
144
- ];
145
- case 1:
146
- nativeScale = _state.sent();
147
- if (nativeScale) return [
148
- 2,
149
- nativeScale
150
- ];
151
- return [
152
- 2,
153
- getScaleByViewport()
154
- ];
155
- }
156
- });
157
- })();
81
+ /** 统一获取缩放:按视口规则计算 */ function getScaleF() {
82
+ return getScaleByViewport();
158
83
  }
159
84
  /** 校验后更新内存中的 scale,并写入 --nut-scale-f */ function setScaleF(nextScale) {
160
85
  var validScale = Number.isFinite(nextScale) && nextScale > 0 ? nextScale : 1;
@@ -162,31 +87,15 @@ var _canusedom = require("./can-use-dom");
162
87
  applyScaleCssVars(validScale);
163
88
  return scale;
164
89
  }
165
- /** 重新拉取缩放;可选同时切换 profile,避免与当前值相同时重复写 DOM */ function refreshScaleF(nextProfile) {
166
- return (0, _async_to_generator._)(function() {
167
- var nextScale;
168
- return (0, _ts_generator._)(this, function(_state) {
169
- switch(_state.label){
170
- case 0:
171
- if (nextProfile) {
172
- setScaleProfile(nextProfile);
173
- }
174
- return [
175
- 4,
176
- getScaleF()
177
- ];
178
- case 1:
179
- nextScale = _state.sent();
180
- if (!scale || nextScale !== scale) {
181
- setScaleF(nextScale);
182
- }
183
- return [
184
- 2,
185
- scale
186
- ];
187
- }
188
- });
189
- })();
90
+ /** 重新计算缩放;可选同时切换 profile,避免与当前值相同时重复写 DOM */ function refreshScaleF(nextProfile) {
91
+ if (nextProfile) {
92
+ setScaleProfile(nextProfile);
93
+ }
94
+ var nextScale = getScaleF();
95
+ if (!scale || nextScale !== scale) {
96
+ setScaleF(nextScale);
97
+ }
98
+ return scale;
190
99
  }
191
100
  function initScaleF(nextProfile) {
192
101
  if (!_canusedom.canUseDom) return function() {};
@@ -1,20 +1,3 @@
1
- /** 原生 DongScreenAdapterPlugin.getScale 的典型返回结构 */
2
- type NativeScaleResponse = {
3
- status?: string;
4
- data?: {
5
- scale?: number | string;
6
- };
7
- };
8
- /** jmfe 通用 callNative 签名 */
9
- type NativeCaller = (plugin: string, method: string, params: string, extra: string) => Promise<NativeScaleResponse>;
10
- /** 站内容器的 jmfe 桥接方法(可选) */
11
- declare global {
12
- interface Window {
13
- jmfe?: {
14
- callNative?: NativeCaller;
15
- };
16
- }
17
- }
18
1
  /** 字体档位:标准、大字、老年 */
19
2
  export type ScaleProfile = 'standard' | 'large' | 'elderly';
20
3
  /** 不同场景可选用不同放大比例(layout 等默认可不额外放大) */
@@ -1,11 +1,9 @@
1
1
  /**
2
- * 响应式缩放系数(--nut-scale-f):结合京东站内原生桥与站外视口规则,
2
+ * 响应式缩放系数(--nut-scale-f):按视口宽度计算,
3
3
  * 写入根节点 CSS 变量(--nut-scale-f / --nut-scale-font / --nut-scale-icon),
4
4
  * 供布局/字号/icon 等按比例换算(见 calcByProfile)。H5 与 Taro WebView 共用此实现。
5
- */ import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
6
- import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
7
- import { canUseDom } from "./can-use-dom";
8
- /** 当前基准缩放(来自原生或视口计算) */ var scale = 1;
5
+ */ import { canUseDom } from "./can-use-dom";
6
+ /** 当前基准缩放(来自视口计算) */ var scale = 1;
9
7
  /** 大字模式下仅 font 场景的相对倍率 */ var LARGE_FONT_RATIO = 1.15;
10
8
  /** 老年模式下 font/icon/lego 场景的相对倍率 */ var ELDERLY_RATIO = 1.3;
11
9
  /** 全局当前档位,与 scale 共同参与 calcByProfile */ var profile = 'standard';
@@ -49,7 +47,7 @@ import { canUseDom } from "./can-use-dom";
49
47
  }
50
48
  return Math.round(value);
51
49
  }
52
- /** 无原生桥时按屏宽推算 scale(含平板与 375 基准窄屏区间) */ function getScaleByViewport() {
50
+ /** 按屏宽推算 scale(含平板与 375 基准窄屏区间) */ function getScaleByViewport() {
53
51
  if (!canUseDom) return 1;
54
52
  var deviceWidth = window.innerWidth;
55
53
  if (!deviceWidth) return 1;
@@ -62,81 +60,8 @@ import { canUseDom } from "./can-use-dom";
62
60
  }
63
61
  return 1;
64
62
  }
65
- /** 通过 jmfe.callNative 拉取 DongScreenAdapterPlugin;失败返回 null */ function getScaleByNative() {
66
- return _async_to_generator(function() {
67
- var _window_jmfe, _res_data, res, parsed, e;
68
- return _ts_generator(this, function(_state) {
69
- switch(_state.label){
70
- case 0:
71
- if (!canUseDom || !((_window_jmfe = window.jmfe) === null || _window_jmfe === void 0 ? void 0 : _window_jmfe.callNative)) return [
72
- 2,
73
- null
74
- ];
75
- _state.label = 1;
76
- case 1:
77
- _state.trys.push([
78
- 1,
79
- 3,
80
- ,
81
- 4
82
- ]);
83
- return [
84
- 4,
85
- window.jmfe.callNative('DongScreenAdapterPlugin', 'getScale', JSON.stringify({}), '')
86
- ];
87
- case 2:
88
- res = _state.sent();
89
- if ((res === null || res === void 0 ? void 0 : res.status) === '0' && ((_res_data = res.data) === null || _res_data === void 0 ? void 0 : _res_data.scale) !== undefined) {
90
- parsed = Number(res.data.scale);
91
- if (Number.isFinite(parsed) && parsed > 0) {
92
- return [
93
- 2,
94
- parsed
95
- ];
96
- }
97
- }
98
- return [
99
- 3,
100
- 4
101
- ];
102
- case 3:
103
- e = _state.sent();
104
- return [
105
- 3,
106
- 4
107
- ];
108
- case 4:
109
- return [
110
- 2,
111
- null
112
- ];
113
- }
114
- });
115
- })();
116
- }
117
- /** 统一获取缩放:站内原生优先,失败则用视口规则 */ function getScaleF() {
118
- return _async_to_generator(function() {
119
- var nativeScale;
120
- return _ts_generator(this, function(_state) {
121
- switch(_state.label){
122
- case 0:
123
- return [
124
- 4,
125
- getScaleByNative()
126
- ];
127
- case 1:
128
- nativeScale = _state.sent();
129
- if (nativeScale) return [
130
- 2,
131
- nativeScale
132
- ];
133
- return [
134
- 2,
135
- getScaleByViewport()
136
- ];
137
- }
138
- });
139
- })();
63
+ /** 统一获取缩放:按视口规则计算 */ function getScaleF() {
64
+ return getScaleByViewport();
140
65
  }
141
66
  /** 校验后更新内存中的 scale,并写入 --nut-scale-f */ function setScaleF(nextScale) {
142
67
  var validScale = Number.isFinite(nextScale) && nextScale > 0 ? nextScale : 1;
@@ -144,31 +69,15 @@ import { canUseDom } from "./can-use-dom";
144
69
  applyScaleCssVars(validScale);
145
70
  return scale;
146
71
  }
147
- /** 重新拉取缩放;可选同时切换 profile,避免与当前值相同时重复写 DOM */ function refreshScaleF(nextProfile) {
148
- return _async_to_generator(function() {
149
- var nextScale;
150
- return _ts_generator(this, function(_state) {
151
- switch(_state.label){
152
- case 0:
153
- if (nextProfile) {
154
- setScaleProfile(nextProfile);
155
- }
156
- return [
157
- 4,
158
- getScaleF()
159
- ];
160
- case 1:
161
- nextScale = _state.sent();
162
- if (!scale || nextScale !== scale) {
163
- setScaleF(nextScale);
164
- }
165
- return [
166
- 2,
167
- scale
168
- ];
169
- }
170
- });
171
- })();
72
+ /** 重新计算缩放;可选同时切换 profile,避免与当前值相同时重复写 DOM */ function refreshScaleF(nextProfile) {
73
+ if (nextProfile) {
74
+ setScaleProfile(nextProfile);
75
+ }
76
+ var nextScale = getScaleF();
77
+ if (!scale || nextScale !== scale) {
78
+ setScaleF(nextScale);
79
+ }
80
+ return scale;
172
81
  }
173
82
  /** 首次计算缩放并订阅 resize;返回卸载函数(SSR 下为空函数) */ export function initScaleF(nextProfile) {
174
83
  if (!canUseDom) return function() {};
@@ -4294,81 +4294,8 @@
4294
4294
  }
4295
4295
  return 1;
4296
4296
  }
4297
- function getScaleByNative() {
4298
- return _async_to_generator(function() {
4299
- var _window_jmfe, _res_data, res, parsed;
4300
- return __generator(this, function(_state) {
4301
- switch (_state.label) {
4302
- case 0:
4303
- if (!canUseDom || !((_window_jmfe = window.jmfe) === null || _window_jmfe === void 0 ? void 0 : _window_jmfe.callNative)) return [
4304
- 2,
4305
- null
4306
- ];
4307
- _state.label = 1;
4308
- case 1:
4309
- _state.trys.push([
4310
- 1,
4311
- 3,
4312
- ,
4313
- 4
4314
- ]);
4315
- return [
4316
- 4,
4317
- window.jmfe.callNative("DongScreenAdapterPlugin", "getScale", JSON.stringify({}), "")
4318
- ];
4319
- case 2:
4320
- res = _state.sent();
4321
- if ((res === null || res === void 0 ? void 0 : res.status) === "0" && ((_res_data = res.data) === null || _res_data === void 0 ? void 0 : _res_data.scale) !== void 0) {
4322
- parsed = Number(res.data.scale);
4323
- if (Number.isFinite(parsed) && parsed > 0) {
4324
- return [
4325
- 2,
4326
- parsed
4327
- ];
4328
- }
4329
- }
4330
- return [
4331
- 3,
4332
- 4
4333
- ];
4334
- case 3:
4335
- _state.sent();
4336
- return [
4337
- 3,
4338
- 4
4339
- ];
4340
- case 4:
4341
- return [
4342
- 2,
4343
- null
4344
- ];
4345
- }
4346
- });
4347
- })();
4348
- }
4349
4297
  function getScaleF() {
4350
- return _async_to_generator(function() {
4351
- var nativeScale;
4352
- return __generator(this, function(_state) {
4353
- switch (_state.label) {
4354
- case 0:
4355
- return [
4356
- 4,
4357
- getScaleByNative()
4358
- ];
4359
- case 1:
4360
- nativeScale = _state.sent();
4361
- if (nativeScale) return [
4362
- 2,
4363
- nativeScale
4364
- ];
4365
- return [
4366
- 2,
4367
- getScaleByViewport()
4368
- ];
4369
- }
4370
- });
4371
- })();
4298
+ return getScaleByViewport();
4372
4299
  }
4373
4300
  function setScaleF(nextScale) {
4374
4301
  var validScale = Number.isFinite(nextScale) && nextScale > 0 ? nextScale : 1;
@@ -4377,27 +4304,11 @@
4377
4304
  return scale;
4378
4305
  }
4379
4306
  function refreshScaleF(nextProfile) {
4380
- return _async_to_generator(function() {
4381
- var nextScale;
4382
- return __generator(this, function(_state) {
4383
- switch (_state.label) {
4384
- case 0:
4385
- return [
4386
- 4,
4387
- getScaleF()
4388
- ];
4389
- case 1:
4390
- nextScale = _state.sent();
4391
- if (!scale || nextScale !== scale) {
4392
- setScaleF(nextScale);
4393
- }
4394
- return [
4395
- 2,
4396
- scale
4397
- ];
4398
- }
4399
- });
4400
- })();
4307
+ var nextScale = getScaleF();
4308
+ if (!scale || nextScale !== scale) {
4309
+ setScaleF(nextScale);
4310
+ }
4311
+ return scale;
4401
4312
  }
4402
4313
  function initScaleF(nextProfile) {
4403
4314
  if (!canUseDom) return function() {