Skip to content

Commit b92badc

Browse files
author
zimyuan
committed
feat: npm publish to test
1 parent 44ca2e1 commit b92badc

File tree

14 files changed

+7057
-6256
lines changed

14 files changed

+7057
-6256
lines changed

demos/noengine/engine.js

Lines changed: 429 additions & 150 deletions
Large diffs are not rendered by default.

demos/noengine/sub/engine.js

Lines changed: 429 additions & 150 deletions
Large diffs are not rendered by default.

dist/index.d.ts

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,42 @@ interface IStyle {
8888
* 也就是支持任意数量的阴影效果,每个阴影效果由四个值指定,分别是 shadowOffsetX, shadowOffsetY, shadowBlur, shadowColor
8989
*/
9090
textShadow?: string;
91+
/**
92+
* 属性用于设置如何处理元素内的空白字符,这个属性指定了两件事:空白字符是否合并,以及如何合并。是否换行,以及如何换行
93+
* 详细的规则可参考:
94+
* https://developer.mozilla.org/zh-CN/docs/Web/CSS/white-space
95+
*
96+
* normal: 连续的空白符会被合并。源码中的换行符会被当作空白符来处理。并根据填充行框盒子的需要来换行。
97+
* nowrap: 和 normal 一样合并空白符,但阻止源码中的文本换行。
98+
* pre: 连续的空白符会被保留。仅在遇到换行符时才会换行。
99+
* pre-wrap: 连续的空白符会被保留。在遇到换行符时根据填充行框盒子的需要换行。
100+
* pre-line: 连续的空白符会被合并。在遇到换行符时根据填充行框盒子的需要换行。
101+
*/
102+
/**
103+
* white-space 属性对空白符和换行的处理规则:
104+
*
105+
* | 属性值 | 换行符 | 空格/制表符 | 文本换行 | 行末空格 |
106+
* |------------|--------|------------ |---------|---------|
107+
* | normal | 合并 | 合并 | 换行 | 移除 |
108+
* | nowrap | 合并 | 合并 | 不换行 | 移除 |
109+
* | pre | 保留 | 保留 | 不换行 | 保留 |
110+
* | pre-wrap | 保留 | 保留 | 换行 | 挂起 |
111+
* | pre-line | 保留 | 合并 | 换行 | 移除 |
112+
*
113+
* 术语说明:
114+
* - "合并":连续空白符合并为单个空格
115+
* - "保留":保留原始空白符(包括换行和空格)
116+
* - "移除":删除行末的空格
117+
*
118+
* 请注意 break-spaces 不支持
119+
*/
120+
whiteSpace?: 'normal' | 'nowrap' | 'pre' | 'pre-wrap' | 'pre-line';
121+
/**
122+
* wordBreak 指定了怎样在单词内断行
123+
* normal: 使用默认的断行规则。
124+
* break-all: 对于 non-CJK (CJK 指中文/日文/韩文) 文本,可在任意字符间断行。
125+
*/
126+
wordBreak?: 'normal' | 'break-all';
91127
':active'?: IStyle;
92128
}
93129

@@ -425,7 +461,8 @@ interface ITextProps extends IElementOptions {
425461
}
426462
declare class Text extends Element {
427463
private valuesrc;
428-
private originStyleWidth;
464+
private parsedValue;
465+
private originSomeStyleInfo;
429466
fontSize?: number;
430467
textBaseline: CanvasTextBaseline;
431468
font: string;
@@ -434,10 +471,8 @@ declare class Text extends Element {
434471
protected renderForLayout: ITextRenderForLayout;
435472
constructor({ style, idName, className, value, dataset, }: ITextProps);
436473
styleChangeHandler(prop: string, styleOpType: StyleOpType, val?: any): void;
437-
private parseTextShadow;
438474
get value(): string;
439475
set value(newValue: string);
440-
toCanvasData(): void;
441476
repaint(): void;
442477
destroySelf(): void;
443478
insert(ctx: CanvasRenderingContext2D, needRender: boolean): void;

0 commit comments

Comments
 (0)