@lvce-editor/renderer-process 10.22.0 → 10.24.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.
@@ -513,25 +513,12 @@ const create$3$1 = () => {
513
513
  const warn$1 = (...args) => {
514
514
  console.warn(...args);
515
515
  };
516
- const withResolvers$2 = () => {
517
- /**
518
- * @type {any}
519
- */
520
- let _resolve;
521
- const promise = new Promise(resolve => {
522
- _resolve = resolve;
523
- });
524
- return {
525
- resolve: _resolve,
526
- promise
527
- };
528
- };
529
516
  const registerPromise = () => {
530
517
  const id = create$3$1();
531
518
  const {
532
519
  resolve,
533
520
  promise
534
- } = withResolvers$2();
521
+ } = Promise.withResolvers();
535
522
  set$6(id, resolve);
536
523
  return {
537
524
  id,
@@ -697,7 +684,7 @@ const unwrapJsonRpcResult = responseMessage => {
697
684
  throw new JsonRpcError('unexpected response message');
698
685
  };
699
686
  const E_COMMAND_NOT_FOUND = 'E_COMMAND_NOT_FOUND';
700
- const getType$2 = prettyError => {
687
+ const getErrorType = prettyError => {
701
688
  if (prettyError && prettyError.type) {
702
689
  return prettyError.type;
703
690
  }
@@ -720,7 +707,7 @@ const getErrorProperty = (error, prettyError) => {
720
707
  data: {
721
708
  stack: prettyError.stack,
722
709
  codeFrame: prettyError.codeFrame,
723
- type: getType$2(prettyError),
710
+ type: getErrorType(prettyError),
724
711
  code: prettyError.code,
725
712
  name: prettyError.name
726
713
  }
@@ -998,7 +985,7 @@ const hydrate$4 = async () => {
998
985
  };
999
986
 
1000
987
  // TODO needed?
1001
- const dispose$o = () => {
988
+ const dispose$p = () => {
1002
989
  // @ts-expect-error
1003
990
  if (state$9.rendererWorker) {
1004
991
  // @ts-expect-error
@@ -1021,7 +1008,7 @@ const invokeAndTransfer = (method, ...params) => {
1021
1008
 
1022
1009
  const RendererWorker = {
1023
1010
  __proto__: null,
1024
- dispose: dispose$o,
1011
+ dispose: dispose$p,
1025
1012
  hydrate: hydrate$4,
1026
1013
  invoke: invoke$1,
1027
1014
  invokeAndTransfer,
@@ -1709,7 +1696,7 @@ const applyUidWorkaround = element => {
1709
1696
  set$5(element, editorUid);
1710
1697
  };
1711
1698
 
1712
- const setBounds$9 = ($Element, x, y, width, height) => {
1699
+ const setBounds$a = ($Element, x, y, width, height) => {
1713
1700
  $Element.style.top = `${y}px`;
1714
1701
  $Element.style.left = `${x}px`;
1715
1702
  $Element.style.width = `${width}px`;
@@ -1924,7 +1911,7 @@ const setOffsetX = (state, offsetX) => {
1924
1911
  setXAndYTransform($ColorPickerSliderThumb, offsetX, 0);
1925
1912
  applyUidWorkaround($Viewlet);
1926
1913
  };
1927
- const appendWidget$5 = state => {
1914
+ const appendWidget$6 = state => {
1928
1915
  const {
1929
1916
  $Viewlet
1930
1917
  } = state;
@@ -1934,45 +1921,12 @@ const appendWidget$5 = state => {
1934
1921
  const ViewletColorPicker = {
1935
1922
  __proto__: null,
1936
1923
  Events: ViewletColorPickerEvents,
1937
- appendWidget: appendWidget$5,
1924
+ appendWidget: appendWidget$6,
1938
1925
  setColor,
1939
1926
  setOffsetX
1940
1927
  };
1941
1928
 
1942
- const Alert = 'alert';
1943
- const Application = 'application';
1944
- const Code = 'code';
1945
- const Complementary = 'complementary';
1946
- const ContentInfo = 'contentinfo';
1947
- const Group = 'group';
1948
- const List$1 = 'list';
1949
- const ListBox = 'listbox';
1950
- const Log = 'log';
1951
- const Main$1 = 'main';
1952
- const Menu = 'menu';
1953
- const None$2 = 'none';
1954
- const Status = 'status';
1955
- const TabList = 'tablist';
1956
- const TextBox = 'textbox';
1957
- const ToolBar = 'toolbar';
1958
- const Tree = 'tree';
1959
- const ComboBox = 'combobox';
1960
-
1961
- const attachEvents$c = ($Node, eventMap) => {
1962
- for (const [key, value] of Object.entries(eventMap)) {
1963
- $Node.addEventListener(key, value);
1964
- }
1965
- };
1966
-
1967
- const Passive = {
1968
- passive: true
1969
- };
1970
- const Active = {
1971
- passive: false
1972
- };
1973
- const Capture = {
1974
- capture: true
1975
- };
1929
+ const Script = 2;
1976
1930
 
1977
1931
  /**
1978
1932
  * @param {Event} event
@@ -2052,19 +2006,6 @@ const executeViewletCommand = (uid, command, ...args) => {
2052
2006
  send('Viewlet.executeViewletCommand', uid, command, ...args);
2053
2007
  };
2054
2008
 
2055
- const startTracking = ($Target, pointerId, handlePointerMove, handlePointerUp) => {
2056
- $Target.setPointerCapture(pointerId);
2057
- $Target.addEventListener(PointerMove, handlePointerMove);
2058
- // TODO use pointerlost event instead
2059
- $Target.addEventListener(PointerUp, handlePointerUp);
2060
- };
2061
- const stopTracking = ($Target, pointerId, handlePointerMove, handlePointerUp) => {
2062
- $Target.releasePointerCapture(pointerId);
2063
- $Target.removeEventListener(PointerMove, handlePointerMove);
2064
- // TODO use pointerlost event instead
2065
- $Target.removeEventListener(PointerUp, handlePointerUp);
2066
- };
2067
-
2068
2009
  const nameAnonymousFunction = (fn, name) => {
2069
2010
  Object.defineProperty(fn, 'name', {
2070
2011
  value: name
@@ -2119,7 +2060,7 @@ const handleDropFilePath = forwardViewletCommand('handleDropFilePath');
2119
2060
  const handleDropFiles = forwardViewletCommand('handleDrop');
2120
2061
  forwardViewletCommand('handleFilterInput');
2121
2062
  const handleFocus$c = forwardViewletCommand('handleFocus');
2122
- const handleFocusIn$4 = forwardViewletCommand('handleFocusIn');
2063
+ const handleFocusIn$5 = forwardViewletCommand('handleFocusIn');
2123
2064
  const handleIconError$1 = forwardViewletCommand('handleIconError');
2124
2065
  const handleImageError$1 = forwardViewletCommand('handleImageError');
2125
2066
  const handleInput$9 = forwardViewletCommand('handleInput');
@@ -2176,6 +2117,109 @@ forwardViewletCommand('type');
2176
2117
  forwardViewletCommand('typeWithAutoClosing');
2177
2118
  const updateEditingValue = forwardViewletCommand('updateEditingValue');
2178
2119
 
2120
+ const handleFocusIn$4 = event => {
2121
+ preventDefault(event);
2122
+ const uid = fromEvent(event);
2123
+ handleFocusIn$5(uid);
2124
+ };
2125
+
2126
+ const ViewletEditorCodeGeneratorEvents = {
2127
+ __proto__: null,
2128
+ handleFocusIn: handleFocusIn$4
2129
+ };
2130
+
2131
+ const setBounds$9 = (state, x, y, width, height) => {
2132
+ const {
2133
+ $Viewlet
2134
+ } = state;
2135
+ setBounds$a($Viewlet, x, y, width, height);
2136
+ applyUidWorkaround($Viewlet);
2137
+ };
2138
+ const appendWidget$5 = state => {
2139
+ const {
2140
+ $Viewlet
2141
+ } = state;
2142
+ append$1($Viewlet);
2143
+ };
2144
+ const dispose$o = state => {
2145
+ remove$2(state.$Viewlet);
2146
+ };
2147
+ const focus$j = (state, key, source) => {
2148
+ if (!key) {
2149
+ return;
2150
+ }
2151
+ if (source !== Script) {
2152
+ return;
2153
+ }
2154
+ const {
2155
+ $Viewlet
2156
+ } = state;
2157
+ const $Element = $Viewlet.querySelector(key);
2158
+ if (!$Element) {
2159
+ console.warn(`element not found: ${key}`);
2160
+ return;
2161
+ }
2162
+ $Element.focus();
2163
+ applyUidWorkaround($Viewlet);
2164
+ };
2165
+
2166
+ const ViewletEditorCodeGenerator = {
2167
+ __proto__: null,
2168
+ Events: ViewletEditorCodeGeneratorEvents,
2169
+ appendWidget: appendWidget$5,
2170
+ dispose: dispose$o,
2171
+ focus: focus$j,
2172
+ setBounds: setBounds$9
2173
+ };
2174
+
2175
+ const Alert = 'alert';
2176
+ const Application = 'application';
2177
+ const Code = 'code';
2178
+ const Complementary = 'complementary';
2179
+ const ContentInfo = 'contentinfo';
2180
+ const Group = 'group';
2181
+ const List$1 = 'list';
2182
+ const ListBox = 'listbox';
2183
+ const Log = 'log';
2184
+ const Main$1 = 'main';
2185
+ const Menu = 'menu';
2186
+ const None$2 = 'none';
2187
+ const Status = 'status';
2188
+ const TabList = 'tablist';
2189
+ const TextBox = 'textbox';
2190
+ const ToolBar = 'toolbar';
2191
+ const Tree = 'tree';
2192
+ const ComboBox = 'combobox';
2193
+
2194
+ const attachEvents$c = ($Node, eventMap) => {
2195
+ for (const [key, value] of Object.entries(eventMap)) {
2196
+ $Node.addEventListener(key, value);
2197
+ }
2198
+ };
2199
+
2200
+ const Passive = {
2201
+ passive: true
2202
+ };
2203
+ const Active = {
2204
+ passive: false
2205
+ };
2206
+ const Capture = {
2207
+ capture: true
2208
+ };
2209
+
2210
+ const startTracking = ($Target, pointerId, handlePointerMove, handlePointerUp) => {
2211
+ $Target.setPointerCapture(pointerId);
2212
+ $Target.addEventListener(PointerMove, handlePointerMove);
2213
+ // TODO use pointerlost event instead
2214
+ $Target.addEventListener(PointerUp, handlePointerUp);
2215
+ };
2216
+ const stopTracking = ($Target, pointerId, handlePointerMove, handlePointerUp) => {
2217
+ $Target.releasePointerCapture(pointerId);
2218
+ $Target.removeEventListener(PointerMove, handlePointerMove);
2219
+ // TODO use pointerlost event instead
2220
+ $Target.removeEventListener(PointerUp, handlePointerUp);
2221
+ };
2222
+
2179
2223
  const handleMousedown = event => {
2180
2224
  preventDefault(event);
2181
2225
  const {
@@ -2353,7 +2397,7 @@ const setBounds$8 = (state, x, y, width, height) => {
2353
2397
  const {
2354
2398
  $Viewlet
2355
2399
  } = state;
2356
- setBounds$9($Viewlet, x, y, width, height);
2400
+ setBounds$a($Viewlet, x, y, width, height);
2357
2401
  applyUidWorkaround($Viewlet);
2358
2402
  };
2359
2403
 
@@ -2416,7 +2460,7 @@ const setBounds$7 = (state, x, y, width, height) => {
2416
2460
  const {
2417
2461
  $Viewlet
2418
2462
  } = state;
2419
- setBounds$9($Viewlet, x, y, width, height);
2463
+ setBounds$a($Viewlet, x, y, width, height);
2420
2464
  };
2421
2465
 
2422
2466
  const ViewletEditorCompletionDetails = {
@@ -2490,7 +2534,7 @@ const ViewletEditorHover = {
2490
2534
  const handleFocusIn$3 = event => {
2491
2535
  preventDefault(event);
2492
2536
  const uid = fromEvent(event);
2493
- handleFocusIn$4(uid);
2537
+ handleFocusIn$5(uid);
2494
2538
  };
2495
2539
  const handleBlur$a = event => {
2496
2540
  const uid = fromEvent(event);
@@ -2518,7 +2562,7 @@ const setBounds$5 = (state, x, y, width, height) => {
2518
2562
  const {
2519
2563
  $Viewlet
2520
2564
  } = state;
2521
- setBounds$9($Viewlet, x, y, width, height);
2565
+ setBounds$a($Viewlet, x, y, width, height);
2522
2566
  applyUidWorkaround($Viewlet);
2523
2567
  };
2524
2568
  const appendWidget$2 = state => {
@@ -2542,7 +2586,7 @@ const ViewletEditorRename = {
2542
2586
  const handleFocusIn$2 = event => {
2543
2587
  preventDefault(event);
2544
2588
  const uid = fromEvent(event);
2545
- handleFocusIn$4(uid);
2589
+ handleFocusIn$5(uid);
2546
2590
  };
2547
2591
 
2548
2592
  const ViewletEditorSourceActionsEvents = {
@@ -2554,7 +2598,7 @@ const setBounds$4 = (state, x, y, width, height) => {
2554
2598
  const {
2555
2599
  $Viewlet
2556
2600
  } = state;
2557
- setBounds$9($Viewlet, x, y, width, height);
2601
+ setBounds$a($Viewlet, x, y, width, height);
2558
2602
  applyUidWorkaround($Viewlet);
2559
2603
  };
2560
2604
  const appendWidget$1 = state => {
@@ -2676,7 +2720,7 @@ const focus$i = (state, key, source) => {
2676
2720
  if (!key) {
2677
2721
  return;
2678
2722
  }
2679
- if (source !== /* script */2) {
2723
+ if (source !== Script) {
2680
2724
  return;
2681
2725
  }
2682
2726
  const {
@@ -2716,7 +2760,7 @@ const setBounds$3 = (state, x, y, width, height) => {
2716
2760
  const {
2717
2761
  $Viewlet
2718
2762
  } = state;
2719
- setBounds$9($Viewlet, x, y, width, height);
2763
+ setBounds$a($Viewlet, x, y, width, height);
2720
2764
  };
2721
2765
  const dispose$j = state => {
2722
2766
  remove$2(state.$Viewlet);
@@ -2794,6 +2838,7 @@ const WebView = 'WebView';
2794
2838
  const EditorCompletionDetails = 'EditorCompletionDetails';
2795
2839
  const EditorTextError = 'EditorTextError';
2796
2840
  const EditorRename = 'EditorRename';
2841
+ const EditorCodeGenerator = 'EditorCodeGenerator';
2797
2842
 
2798
2843
  const state$6 = {
2799
2844
  instances: Object.create(null),
@@ -3137,6 +3182,7 @@ const enable = async window => {
3137
3182
  const main = async () => {
3138
3183
  enable(window);
3139
3184
  state$6.modules[ColorPicker] = ViewletColorPicker;
3185
+ state$6.modules[EditorCodeGenerator] = ViewletEditorCodeGenerator;
3140
3186
  state$6.modules[EditorCompletion] = ViewletEditorCompletion;
3141
3187
  state$6.modules[EditorCompletionDetails] = ViewletEditorCompletionDetails;
3142
3188
  state$6.modules[EditorHover] = ViewletEditorHover;
@@ -5842,6 +5888,8 @@ const load$1 = moduleId => {
5842
5888
  return Promise.resolve().then(function () { return ViewletEditorCompletionDetails; });
5843
5889
  case EditorTextError:
5844
5890
  return Promise.resolve().then(function () { return ViewletEditorTextError; });
5891
+ case EditorCodeGenerator:
5892
+ return Promise.resolve().then(function () { return ViewletEditorCodeGenerator; });
5845
5893
  default:
5846
5894
  throw new Error(`${moduleId} module not found in renderer process`);
5847
5895
  }
@@ -5954,7 +6002,7 @@ const isSpecial = id => {
5954
6002
  const createPlaceholder = (viewletId, parentId, top, left, width, height) => {
5955
6003
  const $PlaceHolder = document.createElement('div');
5956
6004
  $PlaceHolder.className = `Viewlet ${viewletId}`;
5957
- setBounds$9($PlaceHolder, left, top, width, height);
6005
+ setBounds$a($PlaceHolder, left, top, width, height);
5958
6006
  if (isSpecial(viewletId)) {
5959
6007
  $PlaceHolder.id = viewletId;
5960
6008
  }
@@ -6275,7 +6323,7 @@ const setBounds$2 = (id, left, top, width, height) => {
6275
6323
  return;
6276
6324
  }
6277
6325
  const $Viewlet = instance.state.$Viewlet;
6278
- setBounds$9($Viewlet, left, top, width, height);
6326
+ setBounds$a($Viewlet, left, top, width, height);
6279
6327
  };
6280
6328
 
6281
6329
  const name$8 = 'Viewlet';
@@ -7032,7 +7080,7 @@ const setBounds$1 = (state, x, y, width, height) => {
7032
7080
  const {
7033
7081
  $Viewlet
7034
7082
  } = state;
7035
- setBounds$9($Viewlet, x, y, width, height);
7083
+ setBounds$a($Viewlet, x, y, width, height);
7036
7084
  };
7037
7085
 
7038
7086
  const ViewletEditorError = {
@@ -7832,7 +7880,7 @@ const setBounds = (state, x, y, width, height) => {
7832
7880
  const {
7833
7881
  $Viewlet
7834
7882
  } = state;
7835
- setBounds$9($Viewlet, x, y, width, height);
7883
+ setBounds$a($Viewlet, x, y, width, height);
7836
7884
  };
7837
7885
 
7838
7886
  const ViewletEditorWidgetError = {
@@ -9174,9 +9222,9 @@ const setSashes = (state, sashSideBar, sashPanel) => {
9174
9222
  $SashSideBar,
9175
9223
  $SashPanel
9176
9224
  } = state;
9177
- setBounds$9($SashSideBar, sashSideBar.x, sashSideBar.y, sashSideBar.width, sashSideBar.height);
9225
+ setBounds$a($SashSideBar, sashSideBar.x, sashSideBar.y, sashSideBar.width, sashSideBar.height);
9178
9226
  $SashSideBar.classList.toggle('SashActive', sashSideBar.active);
9179
- setBounds$9($SashPanel, sashPanel.x, sashPanel.y, sashPanel.width, sashPanel.height);
9227
+ setBounds$a($SashPanel, sashPanel.x, sashPanel.y, sashPanel.width, sashPanel.height);
9180
9228
  $SashPanel.classList.toggle('SashActive', sashPanel.active);
9181
9229
  };
9182
9230
 
@@ -9289,7 +9337,7 @@ const setDragOverlay = (state, visible, x, y, width, height) => {
9289
9337
  const {
9290
9338
  $DragOverlay
9291
9339
  } = state;
9292
- setBounds$9($DragOverlay, x, y, width, height);
9340
+ setBounds$a($DragOverlay, x, y, width, height);
9293
9341
  if (!hasOverlay) {
9294
9342
  document.body.append($DragOverlay);
9295
9343
  }
@@ -11232,7 +11280,7 @@ const setMenus = (state, changes, uid) => {
11232
11280
  level,
11233
11281
  focusedIndex
11234
11282
  } = menu;
11235
- setBounds$9($Menu, x, y, width, height);
11283
+ setBounds$a($Menu, x, y, width, height);
11236
11284
  renderInto($Menu, dom);
11237
11285
  $Menu.id = `Menu-${level}`;
11238
11286
  append$1($Menu);
@@ -11258,7 +11306,7 @@ const setMenus = (state, changes, uid) => {
11258
11306
  focusedIndex
11259
11307
  } = menu;
11260
11308
  const $Menu = $$Menus[level];
11261
- setBounds$9($Menu, x, y, width, height);
11309
+ setBounds$a($Menu, x, y, width, height);
11262
11310
  renderInto($Menu, dom);
11263
11311
  if (level === newLength - 1) {
11264
11312
  if (focusedIndex === -1) {
@@ -11683,7 +11731,7 @@ const setPort = (state, portId, origin) => {
11683
11731
  };
11684
11732
  const setPosition = (state, id, x, y, width, height) => {
11685
11733
  const $Iframe = get(id);
11686
- setBounds$9($Iframe, x, y, width, height);
11734
+ setBounds$a($Iframe, x, y, width, height);
11687
11735
  };
11688
11736
 
11689
11737
  const ViewletWebView = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/renderer-process",
3
- "version": "10.22.0",
3
+ "version": "10.24.0",
4
4
  "description": "",
5
5
  "main": "dist/rendererProcessMain.js",
6
6
  "type": "module",