morphicons 2.0.0 → 2.0.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/dist/dom.js +5 -1
- package/dist/element.js +3 -1
- package/package.json +1 -1
package/dist/dom.js
CHANGED
|
@@ -173,6 +173,7 @@ const paintAttrs = (p) => p === "stroke" ? {
|
|
|
173
173
|
"fill-rule": "nonzero"
|
|
174
174
|
};
|
|
175
175
|
const looks = /* @__PURE__ */ new WeakMap();
|
|
176
|
+
const paintedEls = /* @__PURE__ */ new WeakSet();
|
|
176
177
|
function restLook(icon) {
|
|
177
178
|
if (typeof icon === "string" || paintOf(icon) === "stroke") return "stroke";
|
|
178
179
|
let look = looks.get(icon);
|
|
@@ -249,13 +250,16 @@ function createMorph(el, icon, options) {
|
|
|
249
250
|
let drawn = false;
|
|
250
251
|
let pending = null;
|
|
251
252
|
let paint = "stroke";
|
|
253
|
+
let known = !paintedEls.has(el);
|
|
252
254
|
let split = 0;
|
|
253
255
|
let popFrom = "stroke";
|
|
254
256
|
let popBase = null;
|
|
255
257
|
const paintAs = (p) => {
|
|
256
|
-
if (p === paint) return;
|
|
258
|
+
if (p === paint && known) return;
|
|
257
259
|
for (const [k, v] of Object.entries(paintAttrs(p))) el.setAttribute(k, v);
|
|
258
260
|
paint = p;
|
|
261
|
+
known = true;
|
|
262
|
+
paintedEls.add(el);
|
|
259
263
|
};
|
|
260
264
|
const paintRest = (ic) => {
|
|
261
265
|
const r = regionMod && paintOf(ic) === "fill" ? regionMod.regionOf(ic, strokeWidth) : ic;
|
package/dist/element.js
CHANGED
|
@@ -34,6 +34,7 @@ var MorphIconElement = class extends Base {
|
|
|
34
34
|
#props = {};
|
|
35
35
|
#ctrl = null;
|
|
36
36
|
#path = null;
|
|
37
|
+
#target = null;
|
|
37
38
|
#adopted = false;
|
|
38
39
|
#preConnectDirty = false;
|
|
39
40
|
#size = "24";
|
|
@@ -114,12 +115,13 @@ var MorphIconElement = class extends Base {
|
|
|
114
115
|
const gated = { setAttribute(name, value) {
|
|
115
116
|
if (armed) path.setAttribute(name, value);
|
|
116
117
|
} };
|
|
118
|
+
this.#target = gated;
|
|
117
119
|
try {
|
|
118
120
|
this.#ctrl.mount(gated, this.#props);
|
|
119
121
|
} finally {
|
|
120
122
|
armed = true;
|
|
121
123
|
}
|
|
122
|
-
} else this.#ctrl.mount(path, this.#props);
|
|
124
|
+
} else this.#ctrl.mount(this.#target ?? path, this.#props);
|
|
123
125
|
}
|
|
124
126
|
}
|
|
125
127
|
disconnectedCallback() {
|
package/package.json
CHANGED