@lvce-editor/renderer-process 16.1.0 → 17.0.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.
@@ -2621,7 +2621,27 @@ const getAssetDir = () => {
2621
2621
  };
2622
2622
  const assetDir = getAssetDir();
2623
2623
 
2624
- const rendererWorkerUrl = `${assetDir}/packages/renderer-worker/src/rendererWorkerMain.ts`;
2624
+ const getConfiguredWorkerUrl = key => {
2625
+ if (typeof location === 'undefined' || typeof document === 'undefined') {
2626
+ return '';
2627
+ }
2628
+ const configElement = document.getElementById('Config');
2629
+ if (!configElement) {
2630
+ return '';
2631
+ }
2632
+ const text = configElement.textContent;
2633
+ if (!text) {
2634
+ return '';
2635
+ }
2636
+ const config = JSON.parse(text);
2637
+ return config[key] || '';
2638
+ };
2639
+
2640
+ const getConfiguredRendererWorkerUrl = () => {
2641
+ return getConfiguredWorkerUrl('rendererWorkerUrl');
2642
+ };
2643
+
2644
+ const rendererWorkerUrl = getConfiguredRendererWorkerUrl() || `${assetDir}/packages/renderer-worker/src/rendererWorkerMain.ts`;
2625
2645
 
2626
2646
  const getName = platform => {
2627
2647
  switch (platform) {
@@ -9167,6 +9187,10 @@ const sendMultiple = commands => {
9167
9187
  // @ts-ignore
9168
9188
  setDragData(viewletId, method, ...args);
9169
9189
  break;
9190
+ case 'Viewlet.replaceChildren':
9191
+ // @ts-ignore
9192
+ replaceChildren(viewletId, method, ...args);
9193
+ break;
9170
9194
  case 'Viewlet.addCss':
9171
9195
  case 'Viewlet.setCss':
9172
9196
  case 'Css.addCssStyleSheet':
@@ -9296,6 +9320,17 @@ const append = (parentId, childId, referenceNodes) => {
9296
9320
  childInstance.factory.postAppend(childInstance.state);
9297
9321
  }
9298
9322
  };
9323
+ const replaceChildren = (parentId, childIds) => {
9324
+ const parentInstance = state$1.instances[parentId];
9325
+ const $Parent = parentInstance.state.$Viewlet;
9326
+ const $Fragment = document.createDocumentFragment();
9327
+ for (const childId of childIds) {
9328
+ const childInstance = state$1.instances[childId];
9329
+ const $Child = childInstance.state.$Viewlet;
9330
+ $Fragment.append($Child);
9331
+ }
9332
+ $Parent.replaceChildren($Fragment);
9333
+ };
9299
9334
  const appendToBody = childId => {
9300
9335
  const $Parent = document.body;
9301
9336
  const childInstance = state$1.instances[childId];
@@ -9352,6 +9387,8 @@ const getFn = command => {
9352
9387
  return setInputValues;
9353
9388
  case 'Viewlet.setProperty':
9354
9389
  return setProperty;
9390
+ case 'Viewlet.replaceChildren':
9391
+ return replaceChildren;
9355
9392
  case 'Css.addCssStyleSheet':
9356
9393
  case 'Viewlet.addCss':
9357
9394
  case 'Viewlet.setCss':
@@ -9669,22 +9706,6 @@ const commandMap = {
9669
9706
  'WindowTitle.set': set$1
9670
9707
  };
9671
9708
 
9672
- const getConfiguredWorkerUrl = key => {
9673
- if (typeof location === 'undefined' || typeof document === 'undefined') {
9674
- return '';
9675
- }
9676
- const configElement = document.getElementById('Config');
9677
- if (!configElement) {
9678
- return '';
9679
- }
9680
- const text = configElement.textContent;
9681
- if (!text) {
9682
- return '';
9683
- }
9684
- const config = JSON.parse(text);
9685
- return config[key] || '';
9686
- };
9687
-
9688
9709
  const getConfiguredEditorWorkerUrl = () => {
9689
9710
  return getConfiguredWorkerUrl('editorWorkerUrl');
9690
9711
  };
@@ -9741,7 +9762,11 @@ const hydrate$1 = async () => {
9741
9762
  await promise;
9742
9763
  };
9743
9764
 
9744
- const syntaxHighlightingWorkerUrl = `${assetDir}/packages/renderer-worker/node_modules/@lvce-editor/syntax-highlighting-worker/dist/syntaxHighlightingWorkerMain.js`;
9765
+ const getConfiguredSyntaxHighlightingWorkerUrl = () => {
9766
+ return getConfiguredWorkerUrl('syntaxHighlightingWorkerUrl');
9767
+ };
9768
+
9769
+ const syntaxHighlightingWorkerUrl = getConfiguredSyntaxHighlightingWorkerUrl() || `${assetDir}/packages/renderer-worker/node_modules/@lvce-editor/syntax-highlighting-worker/dist/syntaxHighlightingWorkerMain.js`;
9745
9770
 
9746
9771
  const launchSyntaxHighlightingWorker = async port => {
9747
9772
  const ipc = await create$A({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/renderer-process",
3
- "version": "16.1.0",
3
+ "version": "17.0.0",
4
4
  "keywords": [
5
5
  "lvce-editor",
6
6
  "renderer-process"