a-calc 3.0.0-beta.20260124.4 → 3.0.0-beta.20260128.1
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/a-calc.versions.js +3 -3
- package/browser/index.js +2 -2
- package/calc.d.ts +10 -10
- package/cjs/index.js +2 -2
- package/es/index.js +2 -2
- package/mcp-server/src/index.js +3 -3
- package/package.json +127 -127
package/calc.d.ts
CHANGED
|
@@ -78,7 +78,7 @@ type CalcRuntimeOptions<Fmt extends string, Err> =
|
|
|
78
78
|
_debug?: boolean;
|
|
79
79
|
_on_debug?: (info: any) => void;
|
|
80
80
|
_angle_unit?: 'deg' | 'rad';
|
|
81
|
-
|
|
81
|
+
_compact_symbols?: string[];
|
|
82
82
|
_compact_step?: number | number[];
|
|
83
83
|
_thousands?: Record<string, ThousandsPreset>;
|
|
84
84
|
/** 多路取值时视为空值的值数组(仅运行时选项) */
|
|
@@ -121,8 +121,8 @@ export type CalcSum = <const Expr extends string | number, const Fmt extends str
|
|
|
121
121
|
export interface FmtOptions {
|
|
122
122
|
_error?: any;
|
|
123
123
|
_fmt?: string;
|
|
124
|
-
/**
|
|
125
|
-
|
|
124
|
+
/** 紧凑格式符号数组(仅选项,临时覆盖) */
|
|
125
|
+
_compact_symbols?: string[];
|
|
126
126
|
/** 紧凑格式阶梯值(仅选项,临时覆盖) */
|
|
127
127
|
_compact_step?: number | number[];
|
|
128
128
|
/** 紧凑格式预设配置(仅选项) */
|
|
@@ -441,7 +441,7 @@ export type UnitConvertRule =
|
|
|
441
441
|
fn?: (value: number, input_unit: string, output_unit: string) => number;
|
|
442
442
|
_position?: 'before' | 'after' | 'middle';
|
|
443
443
|
_thousands?: string;
|
|
444
|
-
|
|
444
|
+
_compact?: string;
|
|
445
445
|
};
|
|
446
446
|
|
|
447
447
|
/**
|
|
@@ -450,7 +450,7 @@ export type UnitConvertRule =
|
|
|
450
450
|
export type UnitConvertOut = Record<string, Record<string, UnitConvertRule> & {
|
|
451
451
|
_position?: 'before' | 'after' | 'middle';
|
|
452
452
|
_thousands?: string;
|
|
453
|
-
|
|
453
|
+
_compact?: string;
|
|
454
454
|
}>;
|
|
455
455
|
|
|
456
456
|
/**
|
|
@@ -460,7 +460,7 @@ export type UnitConvertIn = Record<string, Record<string, UnitConvertRule>>;
|
|
|
460
460
|
|
|
461
461
|
/**
|
|
462
462
|
* 千分位预设名称(系统内置)
|
|
463
|
-
* -
|
|
463
|
+
* - en: 英文/国际标准 (1,234,567.89)
|
|
464
464
|
* - eu: 欧洲大陆格式 (1.234.567,89)
|
|
465
465
|
* - swiss: 瑞士格式 (1'234'567.89)
|
|
466
466
|
* - space: 空格分隔/ISO标准 (1 234 567.89)
|
|
@@ -468,7 +468,7 @@ export type UnitConvertIn = Record<string, Record<string, UnitConvertRule>>;
|
|
|
468
468
|
* - indian: 印度格式 (12,34,567.89)
|
|
469
469
|
* - wan: 万进制/东亚格式 (123,4567.89)
|
|
470
470
|
*/
|
|
471
|
-
export type ThousandsPresetName = '
|
|
471
|
+
export type ThousandsPresetName = 'en' | 'eu' | 'swiss' | 'space' | 'fr' | 'indian' | 'wan';
|
|
472
472
|
|
|
473
473
|
/**
|
|
474
474
|
* 紧凑格式预设名称(系统内置)
|
|
@@ -502,9 +502,9 @@ export interface ThousandsPreset {
|
|
|
502
502
|
* 紧凑格式预设配置类型
|
|
503
503
|
*/
|
|
504
504
|
export type CompactPreset =
|
|
505
|
-
| string[] //
|
|
506
|
-
| { // 完整形式:包含
|
|
507
|
-
|
|
505
|
+
| string[] // 简写形式:只有符号数组,step 默认 1000
|
|
506
|
+
| { // 完整形式:包含 symbols 和 step
|
|
507
|
+
symbols: string[];
|
|
508
508
|
step?: number | number[];
|
|
509
509
|
}
|
|
510
510
|
| ((num_str: string, context: { // 自定义函数形式
|