feat(rules): 建立共享排版契约并收束 WebKit 与 Unicode 基线

This commit is contained in:
2026-09-04 21:44:11 +08:00
parent 8ee9895247
commit 993cf576c6
42 changed files with 8511 additions and 1422 deletions
+17
View File
@@ -1,6 +1,23 @@
import type { LangClass } from "./locale.js";
/** CJK 表意文字/假名/注音等範圍(沿用並擴充 v1 之 PANGU_CJK)。 */
export declare const CJK: string;
/** Unicode variation selector 字元類片段;僅可作緊隨 base 的後綴。 */
export declare const VARIATION_SELECTORS = "\\uFE00-\\uFE0F\\u{E0100}-\\u{E01EF}";
/** 取 UTF-16 offset 處的完整 Unicode code point;越界時回空字串。 */
export declare function codePointAtUtf16(text: string, offset: number): string;
/** 回傳 `offset` 之前一個 code point 的 UTF-16 起始位置。 */
export declare function previousCodePointStart(text: string, offset: number): number;
/** 是否為 Unicode variation selector(BMP VS1–VS16 或補充 VS17–VS256)。 */
export declare function isVariationSelector(ch: string): boolean;
/**
* 取 UTF-16 offset 處之邏輯字元:一個 base code point,加上緊隨的單一 VS。
* 孤立 VS 只回自身,不反向吞併;回傳字串長度仍是 UTF-16 code units。
*/
export declare function variationSequenceAtUtf16(text: string, offset: number): string;
/** 回傳 `offset` 之前一個 base+optional-VS 邏輯字元的 UTF-16 起點。 */
export declare function previousVariationSequenceStart(text: string, offset: number): number;
/** 以 base+optional-VS 為單位切分字串;孤立 VS 仍是單獨單位。 */
export declare function splitVariationSequences(text: string): string[];
/** 西文字母與數字。 */
export declare const ALNUM = "A-Za-z0-9";
/** 西文字母。 */