@lvce-editor/renderer-process 30.64.14 → 30.65.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.
@@ -10173,6 +10173,16 @@ const read = async () => {
10173
10173
  const normalized = normalizeItems(items);
10174
10174
  return normalized;
10175
10175
  };
10176
+ const readImage = async () => {
10177
+ const items = await navigator.clipboard.read();
10178
+ for (const item of items) {
10179
+ const type = item.types.find(type => type.startsWith('image/'));
10180
+ if (type) {
10181
+ return await item.getType(type);
10182
+ }
10183
+ }
10184
+ return undefined;
10185
+ };
10176
10186
  const writeText = async text => {
10177
10187
  string(text);
10178
10188
  await navigator.clipboard.writeText(text);
@@ -10475,9 +10485,16 @@ const setModernUi = enabled => {
10475
10485
  const state$2 = {
10476
10486
  nextNotificationId: 0
10477
10487
  };
10488
+ const pendingChoices = new WeakMap();
10489
+ const close$1 = ($Notification, choice) => {
10490
+ const resolve = pendingChoices.get($Notification);
10491
+ pendingChoices.delete($Notification);
10492
+ remove$1($Notification);
10493
+ resolve?.(choice);
10494
+ };
10478
10495
  const handleCloseClick = event => {
10479
10496
  const $CloseButton = event.currentTarget;
10480
- remove$1($CloseButton.parentNode);
10497
+ close$1($CloseButton.parentNode);
10481
10498
  };
10482
10499
  const create$NotificationMessage = message => {
10483
10500
  const $NotificationMessage = document.createElement('p');
@@ -10555,10 +10572,23 @@ const createWithOptions = (type, message, options) => {
10555
10572
  append$1($Notification);
10556
10573
  return $Notification.id;
10557
10574
  };
10575
+ const showWithOptions = (type, message, options) => {
10576
+ const $Notification = create$NotificationWithOptions(message, options);
10577
+ return new Promise(resolve => {
10578
+ pendingChoices.set($Notification, resolve);
10579
+ $Notification.onclick = event => {
10580
+ const $Target = event.target;
10581
+ if ($Target instanceof HTMLButtonElement && $Target.classList.contains('NotificationOption')) {
10582
+ close$1($Notification, findIndex($Target));
10583
+ }
10584
+ };
10585
+ append$1($Notification);
10586
+ });
10587
+ };
10558
10588
  const dispose$3 = id => {
10559
10589
  const $Notification = document.getElementById(id);
10560
10590
  if ($Notification?.classList.contains('Notification')) {
10561
- remove$1($Notification);
10591
+ close$1($Notification);
10562
10592
  }
10563
10593
  };
10564
10594
 
@@ -11826,6 +11856,7 @@ const commandMap = {
11826
11856
  'Audio.play': play,
11827
11857
  'ClipBoard.execCopy': execCopy,
11828
11858
  'ClipBoard.read': read,
11859
+ 'ClipBoard.readImage': readImage,
11829
11860
  'ClipBoard.readText': readText,
11830
11861
  'ClipBoard.write': write$1,
11831
11862
  'ClipBoard.writeImage': writeImage,
@@ -11874,6 +11905,7 @@ const commandMap = {
11874
11905
  'Notification.create': create$3,
11875
11906
  'Notification.createWithOptions': createWithOptions,
11876
11907
  'Notification.dispose': dispose$3,
11908
+ 'Notification.showWithOptions': showWithOptions,
11877
11909
  'ObjectUrl.create': createObjectUrl,
11878
11910
  'ObjectUrl.revoke': revokeObjectUrl,
11879
11911
  'OffscreenCanvas.create': create$2,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/renderer-process",
3
- "version": "30.64.14",
3
+ "version": "30.65.1",
4
4
  "keywords": [
5
5
  "lvce-editor",
6
6
  "renderer-process"