@impro.social/impro-plugin 0.0.14 → 0.0.16
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/main.js +32 -2
- package/package.json +1 -1
package/main.js
CHANGED
|
@@ -109,7 +109,9 @@ export class Menu {
|
|
|
109
109
|
return this.items.map((item) => {
|
|
110
110
|
const handlerId = uuid.create();
|
|
111
111
|
callHandlers.set(handlerId, item._callback);
|
|
112
|
-
|
|
112
|
+
const icon =
|
|
113
|
+
item.icon instanceof VirtualEl ? item.icon._serialize() : item.icon;
|
|
114
|
+
return { title: item.title, icon, handlerId };
|
|
113
115
|
});
|
|
114
116
|
}
|
|
115
117
|
}
|
|
@@ -309,7 +311,7 @@ export class Plugin {
|
|
|
309
311
|
self.postMessage({
|
|
310
312
|
type: "register",
|
|
311
313
|
target: "sidebarItem",
|
|
312
|
-
icon,
|
|
314
|
+
icon: icon instanceof VirtualEl ? icon._serialize() : icon,
|
|
313
315
|
title,
|
|
314
316
|
handlerId,
|
|
315
317
|
});
|
|
@@ -709,6 +711,28 @@ class IconComponent {
|
|
|
709
711
|
}
|
|
710
712
|
}
|
|
711
713
|
|
|
714
|
+
class BlobImageComponent {
|
|
715
|
+
constructor(containerEl) {
|
|
716
|
+
this.el = containerEl.createEl("plugin-blob-image");
|
|
717
|
+
}
|
|
718
|
+
setDid(did) {
|
|
719
|
+
this.el.setAttr("did", did);
|
|
720
|
+
return this;
|
|
721
|
+
}
|
|
722
|
+
setCid(cid) {
|
|
723
|
+
this.el.setAttr("cid", cid);
|
|
724
|
+
return this;
|
|
725
|
+
}
|
|
726
|
+
setAlt(alt) {
|
|
727
|
+
this.el.setAttr("alt", alt);
|
|
728
|
+
return this;
|
|
729
|
+
}
|
|
730
|
+
setCdnPrefix(prefix) {
|
|
731
|
+
this.el.setAttr("cdn-prefix", prefix);
|
|
732
|
+
return this;
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
|
|
712
736
|
class ProfilesListComponent {
|
|
713
737
|
constructor(containerEl) {
|
|
714
738
|
this.el = containerEl.createEl("plugin-profiles-list");
|
|
@@ -866,6 +890,12 @@ export class VirtualEl {
|
|
|
866
890
|
return component;
|
|
867
891
|
}
|
|
868
892
|
|
|
893
|
+
createBlobImage(callback) {
|
|
894
|
+
const component = new BlobImageComponent(this);
|
|
895
|
+
if (typeof callback === "function") callback(component);
|
|
896
|
+
return component;
|
|
897
|
+
}
|
|
898
|
+
|
|
869
899
|
_serialize() {
|
|
870
900
|
const serialized = {
|
|
871
901
|
type: "element",
|