@lvce-editor/about-view 7.27.0 → 7.29.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.
@@ -602,6 +602,9 @@ const restoreExistingError = (error, currentStack) => {
602
602
  };
603
603
  const restoreMethodNotFoundError = (error, currentStack) => {
604
604
  const restoredError = new JsonRpcError(error.message);
605
+ Object.assign(restoredError, {
606
+ code: error.code
607
+ });
605
608
  const parentStack = getParentStack(error);
606
609
  setStack(restoredError, `${parentStack}${NewLine$1}${currentStack}`);
607
610
  return restoredError;
@@ -621,9 +624,13 @@ const applyDataProperties = (restoredError, error) => {
621
624
  // @ts-ignore
622
625
  restoredError.codeFrame = error.data.codeFrame;
623
626
  }
624
- if (error.data.code) {
627
+ if (typeof error.data.code === 'string' || typeof error.data.code === 'number') {
625
628
  // @ts-ignore
626
- restoredError.code = error.data.code;
629
+ Object.defineProperty(restoredError, 'code', {
630
+ configurable: true,
631
+ value: error.data.code,
632
+ writable: true
633
+ });
627
634
  }
628
635
  if (error.data.type) {
629
636
  // @ts-ignore
@@ -644,7 +651,14 @@ const applyDirectProperties = (restoredError, error) => {
644
651
  }
645
652
  };
646
653
  const restoreMessageError = (error, _currentStack) => {
647
- const restoredError = constructError(error.message, error.type, error.name);
654
+ const restoredError = constructError(error.message, error.type || error.data?.type, error.name);
655
+ if (typeof error.code === 'string' || typeof error.code === 'number') {
656
+ Object.defineProperty(restoredError, 'code', {
657
+ configurable: true,
658
+ value: error.code,
659
+ writable: true
660
+ });
661
+ }
648
662
  if (error.data) {
649
663
  applyDataProperties(restoredError, error);
650
664
  } else {
@@ -723,9 +737,9 @@ const getErrorProperty = (error, prettyError) => {
723
737
  return {
724
738
  code: Custom,
725
739
  data: {
726
- code: prettyError.code,
740
+ code: prettyError.code ?? error?.code,
727
741
  codeFrame: prettyError.codeFrame,
728
- name: prettyError.name,
742
+ name: prettyError.name ?? error?.name,
729
743
  stack: getStack(prettyError),
730
744
  type: getErrorType(prettyError)
731
745
  },
@@ -760,7 +774,12 @@ const getErrorResponseSimple = (id, error) => {
760
774
  return {
761
775
  error: {
762
776
  code: Custom,
763
- data: error,
777
+ data: error instanceof Error ? {
778
+ ...error,
779
+ code: 'code' in error ? error.code : undefined,
780
+ stack: error.stack,
781
+ type: error.name
782
+ } : error,
764
783
  // @ts-ignore
765
784
  message: error.message
766
785
  },
@@ -2135,20 +2154,22 @@ const True = 'true';
2135
2154
 
2136
2155
  const Dialog = 'dialog';
2137
2156
 
2157
+ const buttonClassName$1 = mergeClassNames(Button, ButtonPrimary);
2138
2158
  const getPrimaryButtonVirtualDom = (message, name) => {
2139
2159
  return [{
2140
2160
  childCount: 1,
2141
- className: mergeClassNames(Button, ButtonPrimary),
2161
+ className: buttonClassName$1,
2142
2162
  name,
2143
2163
  onClick: HandleClickButton,
2144
2164
  type: Button$1
2145
2165
  }, text(message)];
2146
2166
  };
2147
2167
 
2168
+ const buttonClassName = mergeClassNames(Button, ButtonSecondary);
2148
2169
  const getSecondaryButtonVirtualDom = (message, name) => {
2149
2170
  return [{
2150
2171
  childCount: 1,
2151
- className: mergeClassNames(Button, ButtonSecondary),
2172
+ className: buttonClassName,
2152
2173
  name,
2153
2174
  onClick: HandleClickButton,
2154
2175
  type: Button$1
@@ -2164,6 +2185,7 @@ const joinBySpace = (...items) => {
2164
2185
 
2165
2186
  const Focusable = -1;
2166
2187
 
2188
+ const infoIconClassName = mergeClassNames(DialogIcon$1, DialogInfoIcon, MaskIcon, MaskIconInfo);
2167
2189
  const dialogToolBarRow = {
2168
2190
  childCount: 1,
2169
2191
  className: DialogToolBarRow,
@@ -2214,7 +2236,7 @@ const getDialogVirtualDom = (content, closeMessage, infoMessage, okMessage, copy
2214
2236
  }, closeIcon, dialogMessageRow, {
2215
2237
  ariaLabel: infoMessage,
2216
2238
  childCount: 0,
2217
- className: mergeClassNames(DialogIcon$1, DialogInfoIcon, MaskIcon, MaskIconInfo),
2239
+ className: infoIconClassName,
2218
2240
  id: DialogIcon,
2219
2241
  type: Div
2220
2242
  }, dialogContentRight, dialogHeading, text(productName), ...content, dialogButtonsRow, ...getSecondaryButtonVirtualDom(okMessage, Ok$1), ...getPrimaryButtonVirtualDom(copyMessage, Copy$1)];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/about-view",
3
- "version": "7.27.0",
3
+ "version": "7.29.0",
4
4
  "description": "About View Worker",
5
5
  "keywords": [
6
6
  "about-view"