@impro.social/impro-plugin 0.0.16 → 0.0.18

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.
Files changed (2) hide show
  1. package/main.js +34 -0
  2. package/package.json +1 -1
package/main.js CHANGED
@@ -325,6 +325,18 @@ export class Plugin {
325
325
  await hostCall("saveData", { data });
326
326
  }
327
327
 
328
+ // Device-local counterpart to loadData/saveData: never synced through the
329
+ // user's account preferences, so it's the right place for anything that
330
+ // shouldn't silently follow the plugin to another device (e.g. a locally
331
+ // held secret key). Cleared on uninstall, same as loadData/saveData.
332
+ async loadLocalData() {
333
+ return hostCall("loadLocalData");
334
+ }
335
+
336
+ async saveLocalData(data) {
337
+ await hostCall("saveLocalData", { data });
338
+ }
339
+
328
340
  addSettingTab(tab) {
329
341
  tab.plugin = this;
330
342
  const displayHandlerId = uuid.create();
@@ -404,6 +416,13 @@ export class Plugin {
404
416
  });
405
417
  }
406
418
 
419
+ // Makes every mounted <plugin-slot name=...> re-invoke this plugin's
420
+ // registered callbacks for that slot. Useful when a slot's content depends
421
+ // on data that resolves asynchronously after the initial render.
422
+ refreshSlot(name) {
423
+ return hostCall("refreshSlot", { name });
424
+ }
425
+
407
426
  onload() {}
408
427
  onunload() {}
409
428
 
@@ -516,6 +535,21 @@ export class Modal {
516
535
  });
517
536
  }
518
537
 
538
+ update() {
539
+ if (!openModals.has(this._modalId)) return;
540
+ self.postMessage({
541
+ type: "hostCall",
542
+ method: "updateModal",
543
+ args: [
544
+ {
545
+ modalId: this._modalId,
546
+ title: this.titleEl._serialize(),
547
+ content: this.contentEl._serialize(),
548
+ },
549
+ ],
550
+ });
551
+ }
552
+
519
553
  close() {
520
554
  if (!openModals.has(this._modalId)) return;
521
555
  openModals.delete(this._modalId);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@impro.social/impro-plugin",
3
- "version": "0.0.16",
3
+ "version": "0.0.18",
4
4
  "type": "module",
5
5
  "main": "main.js",
6
6
  "license": "0BSD",