@clipbus/plugin-sdk 0.9.9 → 0.10.0

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 (49) hide show
  1. package/API.md +94 -27
  2. package/CHANGELOG.md +84 -0
  3. package/README.md +11 -3
  4. package/SPECIFICATION.md +3 -2
  5. package/dist/dom/index.cjs +29 -34
  6. package/dist/dom/index.js +29 -34
  7. package/dist/dom/topicAdapter.d.ts +1 -1
  8. package/dist/generated/capabilities.generated.d.ts +355 -0
  9. package/dist/generated/data.generated.d.ts +33 -0
  10. package/dist/generated/hostClients.generated.d.ts +8 -5
  11. package/dist/generated/hostEvents.generated.d.ts +68 -0
  12. package/dist/generated/nodeIPC.generated.d.ts +106 -0
  13. package/dist/generated/{runtime.definePlugin.generated.d.ts → runtime.registry.generated.d.ts} +2 -2
  14. package/dist/generated/ui.clipbus.generated.d.ts +19 -20
  15. package/dist/generated/wireConstants.generated.d.ts +21 -0
  16. package/dist/internal/capabilities.d.ts +1 -1
  17. package/dist/internal/hostEvents.d.ts +15 -0
  18. package/dist/internal/pluginCall.d.ts +11 -0
  19. package/dist/internal/pluginContext.d.ts +6 -0
  20. package/dist/preview/index.cjs +41 -48
  21. package/dist/preview/index.js +41 -48
  22. package/dist/preview/wire.d.ts +2 -2
  23. package/dist/runtime/defineMessage.d.ts +1 -1
  24. package/dist/runtime/definePlugin.d.ts +2 -0
  25. package/dist/runtime/index.cjs +10 -82
  26. package/dist/runtime/index.d.cts +7 -1
  27. package/dist/runtime/index.d.ts +7 -1
  28. package/dist/runtime/index.js +9 -80
  29. package/dist/ui/index.cjs +107 -169
  30. package/dist/ui/index.d.cts +5 -1
  31. package/dist/ui/index.d.ts +5 -1
  32. package/dist/ui/index.js +107 -169
  33. package/dist/validate/index.d.cts +5 -4
  34. package/dist/validate/index.d.ts +5 -4
  35. package/docs/authoring.md +1 -1
  36. package/docs/capability-detection.md +2 -2
  37. package/docs/entry.md +4 -3
  38. package/docs/item-context.md +5 -3
  39. package/docs/permissions.md +1 -1
  40. package/package.json +6 -4
  41. package/dist/generated/INDEX.runtime.generated.d.ts +0 -6
  42. package/dist/generated/INDEX.ui.generated.d.ts +0 -4
  43. package/dist/generated/capabilityClients.generated.d.ts +0 -231
  44. package/dist/generated/hostBootstrap.generated.d.ts +0 -23
  45. package/dist/generated/runtime.host.generated.d.ts +0 -39
  46. package/dist/generated/topicSubscribers.generated.d.ts +0 -39
  47. package/dist/generated/ui.bootstrap.generated.d.ts +0 -17
  48. package/dist/internal/ipcBus.d.ts +0 -48
  49. package/dist/internal/runtimeInvokeClient.d.ts +0 -3
@@ -1,76 +1,9 @@
1
- // src/internal/internalConsole.ts
2
- function pick(method) {
3
- if (typeof globalThis === "undefined") return () => {
4
- };
5
- const g = globalThis;
6
- const fn = g.console?.[method];
7
- if (typeof fn !== "function") return () => {
8
- };
9
- return fn.bind(g.console);
10
- }
11
- var internalConsole = Object.freeze({
12
- log: pick("log"),
13
- warn: pick("warn"),
14
- error: pick("error")
15
- });
16
-
17
- // src/internal/ipcBus.ts
18
- var _instance = null;
19
- var ipcBus = new Proxy({}, {
20
- get(_target, prop) {
21
- if (!_instance) {
22
- throw new Error("[clipbus-plugin] ipcBus accessed before configureIpcBus() was called.");
23
- }
24
- return _instance[prop];
25
- }
26
- });
27
-
28
- // src/generated/runtime.host.generated.ts
29
- var host = {
30
- item: {
31
- setTags: (payload) => ipcBus.request("item.setTags", payload),
32
- addTags: (payload) => ipcBus.request("item.addTags", payload),
33
- removeTags: (payload) => ipcBus.request("item.removeTags", payload),
34
- setPinned: (payload) => ipcBus.request("item.setPinned", payload),
35
- setAttachments: (payload) => ipcBus.request("item.setAttachments", payload),
36
- setSearchExtension: (payload) => ipcBus.request("item.setSearchExtension", payload),
37
- materializeImagePath: () => ipcBus.request("item.materializeImagePath", {}),
38
- readAttachment: (payload) => ipcBus.request("item.readAttachment", payload)
39
- },
40
- asset: {
41
- registerImage: (payload) => ipcBus.request("asset.registerImage", payload)
42
- },
43
- clipboard: {
44
- copyText: (payload) => ipcBus.request("clipboard.copyText", payload)
45
- },
46
- navigation: {
47
- openUrl: (payload) => ipcBus.request("navigation.openUrl", payload),
48
- revealInFinder: (payload) => ipcBus.request("navigation.revealInFinder", payload),
49
- openFilePath: (payload) => ipcBus.request("navigation.openFilePath", payload)
50
- },
51
- action: {
52
- allocateImageTempPath: (payload) => ipcBus.request("action.allocateImageTempPath", payload),
53
- materializeInputImagePath: () => ipcBus.request("action.materializeInputImagePath", {}),
54
- allocateOutputFilePath: (payload) => ipcBus.request("action.allocateOutputFilePath", payload)
55
- },
56
- settings: {
57
- get: (payload) => ipcBus.request("settings.get", payload),
58
- getAll: () => ipcBus.request("settings.getAll", {})
59
- },
60
- console: {
61
- log: (payload) => ipcBus.request("console.log", payload)
62
- },
63
- locale: {
64
- get: () => ipcBus.request("locale.get", {})
65
- }
66
- };
67
-
68
- // src/generated/runtime.definePlugin.generated.ts
1
+ // src/runtime/definePlugin.ts
69
2
  function definePlugin(definition) {
70
3
  if ("setup" in definition) {
71
4
  return {
72
- setup() {
73
- const registry = definition.setup();
5
+ setup(context) {
6
+ const registry = definition.setup(context);
74
7
  validateRegistry(registry);
75
8
  return registry;
76
9
  }
@@ -82,14 +15,11 @@ function definePlugin(definition) {
82
15
  } };
83
16
  }
84
17
  function validateRegistry(registry) {
85
- for (const [id, handler] of Object.entries(registry.attachmentRenderers ?? {})) {
86
- if (handler && typeof handler === "object" && "invokeOperation" in handler) {
87
- throw new Error(`attachmentRenderers["${id}"]: invokeOperation has been removed.`);
88
- }
89
- }
90
- for (const [id, handler] of Object.entries(registry.actions ?? {})) {
91
- if (handler && typeof handler === "object" && "invokeOperation" in handler) {
92
- throw new Error(`actions["${id}"]: invokeOperation has been removed.`);
18
+ for (const key of ["attachmentRenderers", "actions"]) {
19
+ for (const [id, handler] of Object.entries(registry[key] ?? {})) {
20
+ if (handler && typeof handler === "object" && "invokeOperation" in handler) {
21
+ throw new Error(`${key}["${id}"]: invokeOperation has been removed.`);
22
+ }
93
23
  }
94
24
  }
95
25
  }
@@ -136,6 +66,5 @@ export {
136
66
  CapabilityUnsupportedError,
137
67
  actionResult,
138
68
  defineMessage,
139
- definePlugin,
140
- host
69
+ definePlugin
141
70
  };
package/dist/ui/index.cjs CHANGED
@@ -31,6 +31,14 @@ module.exports = __toCommonJS(index_exports);
31
31
  var STRUCTURED_ERROR_PREFIX = "__clipbus_structured_error__:";
32
32
  var CAPABILITIES_GLOBAL = "__CLIPBUS_PLUGIN_CAPABILITIES__";
33
33
  var CAPABILITY_UNSUPPORTED_ERROR_NAME = "PluginCapabilityUnsupported";
34
+ var PLUGIN_CALL_HANDLER_NAME = "clipbusPluginCall";
35
+ var WIRE_ERROR_NAMES = {
36
+ methodNotFound: "PluginRuntimeMethodNotFound",
37
+ handlerNotFound: "PluginRuntimeHandlerNotFound",
38
+ invocationExpired: "PluginRuntimeInvocationExpired",
39
+ hostCallLimitExceeded: "PluginRuntimeHostCallLimitExceeded",
40
+ hostBridgeUnavailable: "PluginHostBridgeUnavailable"
41
+ };
34
42
 
35
43
  // src/internal/capabilities.ts
36
44
  var CapabilityUnsupportedError = class extends Error {
@@ -65,35 +73,36 @@ function mapToCapabilityError(err, unsupportedName) {
65
73
  return err;
66
74
  }
67
75
 
68
- // src/internal/runtimeInvokeClient.ts
69
- var HANDLER_NAME = "clipbusPluginCall";
70
- async function callRuntimeInvokeStrict(payload) {
71
- const handler = globalThis.webkit?.messageHandlers?.[HANDLER_NAME];
76
+ // src/internal/pluginCall.ts
77
+ async function callPluginMethod(method, payload) {
78
+ const handler = globalThis.webkit?.messageHandlers?.[PLUGIN_CALL_HANDLER_NAME];
72
79
  if (!handler) {
73
- throw new Error("runtime.invoke is only available inside a Clipbus plugin WebView");
80
+ const err = new Error("clipbus." + method + " is only available inside a Clipbus plugin WebView");
81
+ err.name = WIRE_ERROR_NAMES.hostBridgeUnavailable;
82
+ throw err;
74
83
  }
75
84
  const normalized = JSON.parse(JSON.stringify(payload));
76
- let reply;
77
85
  try {
78
- reply = await handler.postMessage({ method: "runtime.invoke", payload: normalized });
86
+ return await handler.postMessage({ method, payload: normalized });
79
87
  } catch (err) {
80
88
  throw parseReplyError(err);
81
89
  }
90
+ }
91
+ async function callRuntimeInvoke(payload) {
92
+ if (!globalThis.webkit?.messageHandlers?.[PLUGIN_CALL_HANDLER_NAME]) {
93
+ throw new Error("runtime.invoke is only available inside a Clipbus plugin WebView");
94
+ }
95
+ const reply = await callPluginMethod("runtime.invoke", payload);
82
96
  return reply?.response;
83
97
  }
84
98
  function parseReplyError(raw) {
85
99
  const message = extractMessage(raw);
86
100
  if (message.startsWith(STRUCTURED_ERROR_PREFIX)) {
87
- const json = message.slice(STRUCTURED_ERROR_PREFIX.length);
88
101
  try {
89
- const parsed = JSON.parse(json);
102
+ const parsed = JSON.parse(message.slice(STRUCTURED_ERROR_PREFIX.length));
90
103
  const err = new Error(typeof parsed.message === "string" ? parsed.message : "");
91
- if (typeof parsed.name === "string" && parsed.name.length > 0) {
92
- err.name = parsed.name;
93
- }
94
- if (parsed.data !== void 0) {
95
- err.data = parsed.data;
96
- }
104
+ if (typeof parsed.name === "string" && parsed.name.length > 0) err.name = parsed.name;
105
+ if (parsed.data !== void 0) err.data = parsed.data;
97
106
  return mapToCapabilityError(err, CAPABILITY_UNSUPPORTED_ERROR_NAME);
98
107
  } catch {
99
108
  return new Error(message);
@@ -111,44 +120,20 @@ function extractMessage(raw) {
111
120
  return String(raw);
112
121
  }
113
122
 
114
- // src/generated/capabilityClients.generated.ts
115
- var HANDLER_NAME2 = "clipbusPluginCall";
116
- async function callPluginMethod(method, payload) {
117
- const handler = globalThis.webkit?.messageHandlers?.[HANDLER_NAME2];
118
- if (!handler) {
119
- const err = new Error("clipbus." + method + " is only available inside a Clipbus plugin WebView");
120
- err.name = "PluginHostBridgeUnavailable";
121
- throw err;
122
- }
123
- const normalized = JSON.parse(JSON.stringify(payload));
124
- let reply;
125
- try {
126
- reply = await handler.postMessage({ method, payload: normalized });
127
- } catch (err) {
128
- throw parseReplyError(err);
129
- }
130
- return reply;
131
- }
132
- var callItemReadAttachment = (payload) => callPluginMethod("item.readAttachment", payload);
133
- var callAssetCurrentItemImageUrl = () => callPluginMethod("asset.currentItemImageUrl", {});
134
- var callAssetPathReferenceImageUrl = (payload) => callPluginMethod("asset.pathReferenceImageUrl", payload);
135
- var callAssetCurrentActionInputImageUrl = () => callPluginMethod("asset.currentActionInputImageUrl", {});
136
- var callAssetCurrentActionInputPathReferenceImageUrl = (payload) => callPluginMethod("asset.currentActionInputPathReferenceImageUrl", payload);
137
- var callClipboardCopyText = (payload) => callPluginMethod("clipboard.copyText", payload);
138
- var callNavigationOpenUrl = (payload) => callPluginMethod("navigation.openUrl", payload);
139
- var callNavigationRevealInFinder = (payload) => callPluginMethod("navigation.revealInFinder", payload);
140
- var callNavigationOpenFilePath = (payload) => callPluginMethod("navigation.openFilePath", payload);
141
- var callActionSetButtons = (payload) => callPluginMethod("action.setButtons", payload);
142
- var callActionComplete = (payload) => callPluginMethod("action.complete", payload);
143
- var callAttachmentRendererSetButtons = (payload) => callPluginMethod("attachmentRenderer.setButtons", payload);
144
- var callWindowSetHeight = (payload) => callPluginMethod("window.setHeight", payload);
145
- var callWindowAutoFit = () => callPluginMethod("window.autoFit", {});
146
- var callInfoPanelOpen = (payload) => callPluginMethod("infoPanel.open", payload);
147
- var callInfoPanelClose = (payload) => callPluginMethod("infoPanel.close", payload);
148
- var callSettingsGet = (payload) => callPluginMethod("settings.get", payload);
149
- var callSettingsGetAll = () => callPluginMethod("settings.getAll", {});
150
- var callConsoleLog = (payload) => callPluginMethod("console.log", payload);
151
- var callTextInputStateChanged = (payload) => callPluginMethod("textInput.stateChanged", payload);
123
+ // src/generated/hostEvents.generated.ts
124
+ var HOST_EVENT_WINDOW_GLOBALS = {
125
+ "clipbus-plugin-context": "__CLIPBUS_PLUGIN_CONTEXT__",
126
+ "clipbus-plugin-item": "__CLIPBUS_PLUGIN_ITEM__",
127
+ "clipbus-plugin-attachment": "__CLIPBUS_PLUGIN_ATTACHMENT__",
128
+ "clipbus-plugin-draft": "__CLIPBUS_PLUGIN_DRAFT__",
129
+ "clipbus-plugin-action-input": "__CLIPBUS_PLUGIN_ACTION_INPUT__",
130
+ "clipbus-plugin-theme": "__CLIPBUS_PLUGIN_THEME__",
131
+ "clipbus-plugin-attachment-host-invoke": null,
132
+ "clipbus-plugin-action-host-invoke": null,
133
+ "clipbus-plugin-info-panel-on-action": null,
134
+ "clipbus-plugin-info-panel-on-close": null,
135
+ "clipbus-plugin-locale": "__CLIPBUS_PLUGIN_LOCALE__"
136
+ };
152
137
 
153
138
  // src/internal/topic.ts
154
139
  function createTopic(initial) {
@@ -193,95 +178,36 @@ function readWindowGlobal(key) {
193
178
  return window[key];
194
179
  }
195
180
 
196
- // src/generated/topicSubscribers.generated.ts
197
- function onContext(listener) {
198
- const handler = (e) => listener(e.detail);
199
- globalThis.addEventListener("clipbus-plugin-context", handler);
200
- return () => globalThis.removeEventListener("clipbus-plugin-context", handler);
201
- }
202
- function onItem(listener) {
203
- const handler = (e) => listener(e.detail);
204
- globalThis.addEventListener("clipbus-plugin-item", handler);
205
- return () => globalThis.removeEventListener("clipbus-plugin-item", handler);
206
- }
207
- function onAttachment(listener) {
208
- const handler = (e) => listener(e.detail);
209
- globalThis.addEventListener("clipbus-plugin-attachment", handler);
210
- return () => globalThis.removeEventListener("clipbus-plugin-attachment", handler);
211
- }
212
- function onDraft(listener) {
213
- const handler = (e) => listener(e.detail);
214
- globalThis.addEventListener("clipbus-plugin-draft", handler);
215
- return () => globalThis.removeEventListener("clipbus-plugin-draft", handler);
216
- }
217
- function onActionInput(listener) {
181
+ // src/internal/hostEvents.ts
182
+ function onHostEvent(name, listener) {
218
183
  const handler = (e) => listener(e.detail);
219
- globalThis.addEventListener("clipbus-plugin-action-input", handler);
220
- return () => globalThis.removeEventListener("clipbus-plugin-action-input", handler);
184
+ globalThis.addEventListener(name, handler);
185
+ return () => globalThis.removeEventListener(name, handler);
221
186
  }
222
- function onTheme(listener) {
223
- const handler = (e) => listener(e.detail);
224
- globalThis.addEventListener("clipbus-plugin-theme", handler);
225
- return () => globalThis.removeEventListener("clipbus-plugin-theme", handler);
226
- }
227
- function onAttachmentHostInvoke(listener) {
228
- const handler = (e) => listener(e.detail);
229
- globalThis.addEventListener("clipbus-plugin-attachment-host-invoke", handler);
230
- return () => globalThis.removeEventListener("clipbus-plugin-attachment-host-invoke", handler);
231
- }
232
- function onActionHostInvoke(listener) {
233
- const handler = (e) => listener(e.detail);
234
- globalThis.addEventListener("clipbus-plugin-action-host-invoke", handler);
235
- return () => globalThis.removeEventListener("clipbus-plugin-action-host-invoke", handler);
187
+ function createHostTopic(name) {
188
+ const windowGlobal = HOST_EVENT_WINDOW_GLOBALS[name];
189
+ const topic = createTopic(
190
+ windowGlobal === null ? void 0 : readWindowGlobal(windowGlobal)
191
+ );
192
+ onHostEvent(name, (payload) => topic.set(payload));
193
+ return topic;
236
194
  }
237
- function onInfoPanelOnAction(listener) {
238
- const handler = (e) => listener(e.detail);
239
- globalThis.addEventListener("clipbus-plugin-info-panel-on-action", handler);
240
- return () => globalThis.removeEventListener("clipbus-plugin-info-panel-on-action", handler);
241
- }
242
- function onInfoPanelOnClose(listener) {
243
- const handler = (e) => listener(e.detail);
244
- globalThis.addEventListener("clipbus-plugin-info-panel-on-close", handler);
245
- return () => globalThis.removeEventListener("clipbus-plugin-info-panel-on-close", handler);
246
- }
247
- function onLocale(listener) {
248
- const handler = (e) => listener(e.detail);
249
- globalThis.addEventListener("clipbus-plugin-locale", handler);
250
- return () => globalThis.removeEventListener("clipbus-plugin-locale", handler);
195
+ function createHostStream(name) {
196
+ const stream = createStream();
197
+ onHostEvent(name, (payload) => stream.emit(payload));
198
+ return stream;
251
199
  }
252
200
 
253
- // src/generated/ui.bootstrap.generated.ts
254
- var _pluginContextTopic = createTopic(readWindowGlobal("__CLIPBUS_PLUGIN_CONTEXT__"));
255
- onContext((p) => _pluginContextTopic.set(p));
256
- var _itemTopic = createTopic(readWindowGlobal("__CLIPBUS_PLUGIN_ITEM__"));
257
- onItem((p) => _itemTopic.set(p));
258
- var _itemAttachmentTopic = createTopic(readWindowGlobal("__CLIPBUS_PLUGIN_ATTACHMENT__"));
259
- onAttachment((p) => _itemAttachmentTopic.set(p));
260
- var _actionDraftTopic = createTopic(readWindowGlobal("__CLIPBUS_PLUGIN_DRAFT__"));
261
- onDraft((p) => _actionDraftTopic.set(p));
262
- var _actionInputTopic = createTopic(readWindowGlobal("__CLIPBUS_PLUGIN_ACTION_INPUT__"));
263
- onActionInput((p) => _actionInputTopic.set(p));
264
- var _themeTopic = createTopic(readWindowGlobal("__CLIPBUS_PLUGIN_THEME__"));
265
- onTheme((p) => _themeTopic.set(p));
266
- var _attachmentRendererOnHostInvokeStream = createStream();
267
- onAttachmentHostInvoke((p) => _attachmentRendererOnHostInvokeStream.emit(p));
268
- var _actionOnHostInvokeStream = createStream();
269
- onActionHostInvoke((p) => _actionOnHostInvokeStream.emit(p));
270
- var _infoPanelOnActionStream = createStream();
271
- onInfoPanelOnAction((p) => _infoPanelOnActionStream.emit(p));
272
- var _infoPanelOnCloseStream = createStream();
273
- onInfoPanelOnClose((p) => _infoPanelOnCloseStream.emit(p));
274
- var _localeTopic = createTopic(readWindowGlobal("__CLIPBUS_PLUGIN_LOCALE__"));
275
- onLocale((p) => _localeTopic.set(p));
201
+ // src/internal/pluginContext.ts
276
202
  var PluginContextError = class extends Error {
277
203
  constructor(message) {
278
204
  super(message);
279
205
  this.name = "PluginContextError";
280
206
  }
281
207
  };
282
- function guardContext(expected, run) {
208
+ function guardContext(contextTopic, expected, run) {
283
209
  return (...args) => {
284
- const current = _pluginContextTopic.current()?.mode;
210
+ const current = contextTopic.current()?.mode;
285
211
  if (current !== expected) {
286
212
  throw new PluginContextError(
287
213
  `This verb is not available in the current plugin context (expected: ${expected}, got: ${current || "unknown"})`
@@ -292,90 +218,102 @@ function guardContext(expected, run) {
292
218
  }
293
219
 
294
220
  // src/generated/ui.clipbus.generated.ts
221
+ var pluginContextTopic = createHostTopic("clipbus-plugin-context");
222
+ var itemTopic = createHostTopic("clipbus-plugin-item");
223
+ var itemAttachmentTopic = createHostTopic("clipbus-plugin-attachment");
224
+ var actionDraftTopic = createHostTopic("clipbus-plugin-draft");
225
+ var actionInputTopic = createHostTopic("clipbus-plugin-action-input");
226
+ var themeTopic = createHostTopic("clipbus-plugin-theme");
227
+ var attachmentRendererOnHostInvokeStream = createHostStream("clipbus-plugin-attachment-host-invoke");
228
+ var actionOnHostInvokeStream = createHostStream("clipbus-plugin-action-host-invoke");
229
+ var infoPanelOnActionStream = createHostStream("clipbus-plugin-info-panel-on-action");
230
+ var infoPanelOnCloseStream = createHostStream("clipbus-plugin-info-panel-on-close");
231
+ var localeTopic = createHostTopic("clipbus-plugin-locale");
295
232
  var clipbus = {
296
233
  capabilities: createCapabilitiesApi(() => readInjectedCapabilities(globalThis, CAPABILITIES_GLOBAL)),
297
234
  runtime: {
298
- invoke: (payload) => callRuntimeInvokeStrict(payload)
235
+ invoke: (payload) => callRuntimeInvoke(payload)
299
236
  },
300
237
  item: {
301
- current: () => _itemTopic.current(),
302
- on: (fn) => _itemTopic.on(fn),
303
- readAttachment: (payload) => callItemReadAttachment(payload),
238
+ current: itemTopic.current,
239
+ on: itemTopic.on,
240
+ readAttachment: (payload) => callPluginMethod("item.readAttachment", payload),
304
241
  attachment: {
305
- current: () => _itemAttachmentTopic.current(),
306
- on: (fn) => _itemAttachmentTopic.on(fn)
242
+ current: itemAttachmentTopic.current,
243
+ on: itemAttachmentTopic.on
307
244
  }
308
245
  },
309
246
  asset: {
310
- currentItemImageUrl: () => callAssetCurrentItemImageUrl(),
311
- pathReferenceImageUrl: (payload) => callAssetPathReferenceImageUrl(payload),
312
- currentActionInputImageUrl: guardContext("action", () => callAssetCurrentActionInputImageUrl()),
313
- currentActionInputPathReferenceImageUrl: guardContext("action", (payload) => callAssetCurrentActionInputPathReferenceImageUrl(payload))
247
+ currentItemImageUrl: () => callPluginMethod("asset.currentItemImageUrl", {}),
248
+ pathReferenceImageUrl: (payload) => callPluginMethod("asset.pathReferenceImageUrl", payload),
249
+ currentActionInputImageUrl: guardContext(pluginContextTopic, "action", () => callPluginMethod("asset.currentActionInputImageUrl", {})),
250
+ currentActionInputPathReferenceImageUrl: guardContext(pluginContextTopic, "action", (payload) => callPluginMethod("asset.currentActionInputPathReferenceImageUrl", payload))
314
251
  },
315
252
  clipboard: {
316
- copyText: (payload) => callClipboardCopyText(payload)
253
+ copyText: (payload) => callPluginMethod("clipboard.copyText", payload)
317
254
  },
318
255
  navigation: {
319
- openUrl: (payload) => callNavigationOpenUrl(payload),
320
- revealInFinder: (payload) => callNavigationRevealInFinder(payload),
321
- openFilePath: (payload) => callNavigationOpenFilePath(payload)
256
+ openUrl: (payload) => callPluginMethod("navigation.openUrl", payload),
257
+ revealInFinder: (payload) => callPluginMethod("navigation.revealInFinder", payload),
258
+ openFilePath: (payload) => callPluginMethod("navigation.openFilePath", payload)
322
259
  },
323
260
  action: {
324
- setButtons: guardContext("action", (payload) => callActionSetButtons(payload)),
325
- complete: guardContext("action", (payload) => callActionComplete(payload)),
261
+ setButtons: guardContext(pluginContextTopic, "action", (payload) => callPluginMethod("action.setButtons", payload)),
262
+ complete: guardContext(pluginContextTopic, "action", (payload) => callPluginMethod("action.complete", payload)),
326
263
  draft: {
327
- current: () => _actionDraftTopic.current(),
328
- on: (fn) => _actionDraftTopic.on(fn)
264
+ current: actionDraftTopic.current,
265
+ on: actionDraftTopic.on
329
266
  },
330
267
  input: {
331
- current: () => _actionInputTopic.current(),
332
- on: (fn) => _actionInputTopic.on(fn)
268
+ current: actionInputTopic.current,
269
+ on: actionInputTopic.on
333
270
  },
334
271
  onHostInvoke: {
335
- on: (fn) => _actionOnHostInvokeStream.on(fn)
272
+ on: actionOnHostInvokeStream.on
336
273
  }
337
274
  },
338
275
  attachmentRenderer: {
339
- setButtons: guardContext("attachmentRenderer", (payload) => callAttachmentRendererSetButtons(payload)),
276
+ setButtons: guardContext(pluginContextTopic, "attachmentRenderer", (payload) => callPluginMethod("attachmentRenderer.setButtons", payload)),
340
277
  onHostInvoke: {
341
- on: (fn) => _attachmentRendererOnHostInvokeStream.on(fn)
278
+ on: attachmentRendererOnHostInvokeStream.on
342
279
  }
343
280
  },
344
281
  window: {
345
- setHeight: (payload) => callWindowSetHeight(payload),
346
- autoFit: () => callWindowAutoFit()
282
+ setHeight: (payload) => callPluginMethod("window.setHeight", payload),
283
+ autoFit: () => callPluginMethod("window.autoFit", {})
347
284
  },
348
285
  infoPanel: {
349
- open: (payload) => callInfoPanelOpen(payload),
350
- close: (payload) => callInfoPanelClose(payload),
286
+ open: (payload) => callPluginMethod("infoPanel.open", payload),
287
+ close: (payload) => callPluginMethod("infoPanel.close", payload),
351
288
  onAction: {
352
- on: (fn) => _infoPanelOnActionStream.on(fn)
289
+ on: infoPanelOnActionStream.on
353
290
  },
354
291
  onClose: {
355
- on: (fn) => _infoPanelOnCloseStream.on(fn)
292
+ on: infoPanelOnCloseStream.on
356
293
  }
357
294
  },
358
295
  settings: {
359
- get: (payload) => callSettingsGet(payload),
360
- getAll: () => callSettingsGetAll()
296
+ get: (payload) => callPluginMethod("settings.get", payload),
297
+ getAll: () => callPluginMethod("settings.getAll", {})
361
298
  },
362
299
  console: {
363
- log: (payload) => callConsoleLog(payload)
300
+ log: (payload) => callPluginMethod("console.log", payload),
301
+ diagnostic: (payload) => callPluginMethod("console.diagnostic", payload)
364
302
  },
365
303
  textInput: {
366
- stateChanged: (payload) => callTextInputStateChanged(payload)
304
+ stateChanged: (payload) => callPluginMethod("textInput.stateChanged", payload)
367
305
  },
368
306
  pluginContext: {
369
- current: () => _pluginContextTopic.current(),
370
- on: (fn) => _pluginContextTopic.on(fn)
307
+ current: pluginContextTopic.current,
308
+ on: pluginContextTopic.on
371
309
  },
372
310
  theme: {
373
- current: () => _themeTopic.current(),
374
- on: (fn) => _themeTopic.on(fn)
311
+ current: themeTopic.current,
312
+ on: themeTopic.on
375
313
  },
376
314
  locale: {
377
- current: () => _localeTopic.current(),
378
- on: (fn) => _localeTopic.on(fn)
315
+ current: localeTopic.current,
316
+ on: localeTopic.on
379
317
  }
380
318
  };
381
319
 
@@ -1,4 +1,8 @@
1
- export * from '../generated/INDEX.ui.generated.js';
1
+ export { clipbus } from '../generated/ui.clipbus.generated.js';
2
+ export { PluginContextError } from '../internal/pluginContext.js';
2
3
  export { defineMessage } from './defineMessage.js';
3
4
  export type { UIMessageContract } from './defineMessage.js';
4
5
  export { CapabilityUnsupportedError } from '../internal/capabilities.js';
6
+ export type * from '../generated/data.generated.js';
7
+ export type * from '../generated/capabilities.generated.js';
8
+ export type { PluginContextPayload, PluginLocalePayload } from '../generated/hostEvents.generated.js';
@@ -1,4 +1,8 @@
1
- export * from '../generated/INDEX.ui.generated.js';
1
+ export { clipbus } from '../generated/ui.clipbus.generated.js';
2
+ export { PluginContextError } from '../internal/pluginContext.js';
2
3
  export { defineMessage } from './defineMessage.js';
3
4
  export type { UIMessageContract } from './defineMessage.js';
4
5
  export { CapabilityUnsupportedError } from '../internal/capabilities.js';
6
+ export type * from '../generated/data.generated.js';
7
+ export type * from '../generated/capabilities.generated.js';
8
+ export type { PluginContextPayload, PluginLocalePayload } from '../generated/hostEvents.generated.js';