modern-canvas 0.27.7 → 0.27.9
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/dist/index.js
CHANGED
|
@@ -7580,7 +7580,29 @@ var X = class extends w {
|
|
|
7580
7580
|
_resolveThemeColor(e) {
|
|
7581
7581
|
return this._parent.tree?.resolveThemeColor(e) ?? e;
|
|
7582
7582
|
}
|
|
7583
|
+
_themeColorOrigins = /* @__PURE__ */ new WeakMap();
|
|
7584
|
+
_resolveBaseThemeColors() {
|
|
7585
|
+
if (!this._parent.tree) return;
|
|
7586
|
+
let e = (e, t) => {
|
|
7587
|
+
if (e) for (let n of t) {
|
|
7588
|
+
let t = this._themeColorOrigins.get(e), r = t?.[n] ?? e[n];
|
|
7589
|
+
if (!(typeof r != "string" || r.charCodeAt(0) !== 64)) {
|
|
7590
|
+
if (!t?.[n]) {
|
|
7591
|
+
let i = t ?? {};
|
|
7592
|
+
i[n] = r, this._themeColorOrigins.set(e, i);
|
|
7593
|
+
}
|
|
7594
|
+
e[n] = this._resolveThemeColor(r);
|
|
7595
|
+
}
|
|
7596
|
+
}
|
|
7597
|
+
}, t = (t) => e(t, ["color"]);
|
|
7598
|
+
e(this.base.computedStyle, ["backgroundColor", "color"]), t(this.base.computedFill), t(this.base.computedOutline);
|
|
7599
|
+
for (let n of this.base.paragraphs) {
|
|
7600
|
+
e(n.style, ["backgroundColor"]), e(n.computedStyle, ["backgroundColor", "color"]), t(n.computedFill), t(n.computedOutline);
|
|
7601
|
+
for (let r of n.fragments) e(r.style, ["backgroundColor"]), e(r.computedStyle, ["backgroundColor", "color"]), t(r.computedFill), t(r.computedOutline);
|
|
7602
|
+
}
|
|
7603
|
+
}
|
|
7583
7604
|
_rasterTexture() {
|
|
7605
|
+
this._resolveBaseThemeColors();
|
|
7584
7606
|
let e = Math.ceil(this.base.boundingBox.width), t = Math.ceil(this.base.boundingBox.height), n = ra, r = Math.floor((oa() - ia) / n);
|
|
7585
7607
|
if (e <= r && t <= r) {
|
|
7586
7608
|
this._releaseTiles();
|
|
@@ -48,6 +48,15 @@ export declare class Element2DText extends CoreObject implements NormalizedText
|
|
|
48
48
|
update(): void;
|
|
49
49
|
/** fragment 颜色的语义色 token(`@token`)→ 当前主题实际色;非 token 原样返回。 */
|
|
50
50
|
protected _resolveThemeColor<T = any>(value: T): T | string;
|
|
51
|
+
/**
|
|
52
|
+
* 派生结构上已就地解析过的 token 原值:key = 派生对象,value = { 属性名: '@token' }。
|
|
53
|
+
*
|
|
54
|
+
* 就地写入实际色会丢掉 token 本身,而布局可复用时(内容没变)这些派生对象**不会重建**,
|
|
55
|
+
* 于是主题切换后再跑本方法只看到实际色、认不出是 token,颜色就永远停在首次解析的那套主题
|
|
56
|
+
* (暗色下栅格过的文字,切回亮色仍是白字)。故记下原值,每次栅格都按当前主题重新解析。
|
|
57
|
+
*/
|
|
58
|
+
protected _themeColorOrigins: WeakMap<object, Record<string, string>>;
|
|
59
|
+
protected _resolveBaseThemeColors(): void;
|
|
51
60
|
protected _rasterTexture(): void;
|
|
52
61
|
protected _renderTiles(width: number, height: number, pixelRatio: number, maxTile: number): void;
|
|
53
62
|
protected _releaseTiles(): void;
|