modern-canvas 0.27.8 → 0.27.10
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,18 +7580,25 @@ 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();
|
|
7583
7584
|
_resolveBaseThemeColors() {
|
|
7584
7585
|
if (!this._parent.tree) return;
|
|
7585
7586
|
let e = (e, t) => {
|
|
7586
7587
|
if (e) for (let n of t) {
|
|
7587
|
-
let t = e[n];
|
|
7588
|
-
typeof
|
|
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
|
+
}
|
|
7589
7596
|
}
|
|
7590
|
-
};
|
|
7591
|
-
e(this.base.computedStyle, ["backgroundColor", "color"]);
|
|
7592
|
-
for (let
|
|
7593
|
-
e(
|
|
7594
|
-
for (let
|
|
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);
|
|
7595
7602
|
}
|
|
7596
7603
|
}
|
|
7597
7604
|
_rasterTexture() {
|
|
@@ -10002,7 +10009,10 @@ var co = class extends nr {
|
|
|
10002
10009
|
}
|
|
10003
10010
|
}, mo = class extends nr {
|
|
10004
10011
|
install(e) {
|
|
10005
|
-
return this.load = (t) => e.awaitBy(() =>
|
|
10012
|
+
return this.load = (t) => e.awaitBy(async () => {
|
|
10013
|
+
let n = await new wr(t).load();
|
|
10014
|
+
return e.emit("loaded", t, n), n;
|
|
10015
|
+
}), e.video = this, this;
|
|
10006
10016
|
}
|
|
10007
10017
|
}, ho = Object.entries({
|
|
10008
10018
|
"font/woff": ["woff"],
|
|
@@ -48,6 +48,14 @@ 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>>;
|
|
51
59
|
protected _resolveBaseThemeColors(): void;
|
|
52
60
|
protected _rasterTexture(): void;
|
|
53
61
|
protected _renderTiles(width: number, height: number, pixelRatio: number, maxTile: number): void;
|