@contember/react-devbar 2.1.0-alpha.9 → 2.1.0-beta.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.
Files changed (96) hide show
  1. package/dist/development/index.cjs +2 -2
  2. package/dist/development/index.js +1 -1
  3. package/dist/development/src/DevErrorManager.cjs.map +1 -1
  4. package/dist/development/src/DevErrorManager.js.map +1 -1
  5. package/dist/development/src/errorHandling.cjs +2 -22
  6. package/dist/development/src/errorHandling.cjs.map +1 -1
  7. package/dist/development/src/errorHandling.js +2 -5
  8. package/dist/development/src/errorHandling.js.map +1 -1
  9. package/dist/development/src/hooks/useCopyErrorMarkdown.cjs +101 -0
  10. package/dist/development/src/hooks/useCopyErrorMarkdown.cjs.map +1 -0
  11. package/dist/development/src/hooks/useCopyErrorMarkdown.js +101 -0
  12. package/dist/development/src/hooks/useCopyErrorMarkdown.js.map +1 -0
  13. package/dist/development/src/hooks/useParsedStacktrace.cjs.map +1 -1
  14. package/dist/development/src/hooks/useParsedStacktrace.js.map +1 -1
  15. package/dist/development/src/ui/DevBar/DevBar.cjs +15 -13
  16. package/dist/development/src/ui/DevBar/DevBar.cjs.map +1 -1
  17. package/dist/development/src/ui/DevBar/DevBar.js +15 -13
  18. package/dist/development/src/ui/DevBar/DevBar.js.map +1 -1
  19. package/dist/development/src/ui/DevError/DevError.cjs.map +1 -1
  20. package/dist/development/src/ui/DevError/DevError.js.map +1 -1
  21. package/dist/development/src/ui/DevError/DevErrorBadge.cjs +2 -2
  22. package/dist/development/src/ui/DevError/DevErrorBadge.cjs.map +1 -1
  23. package/dist/development/src/ui/DevError/DevErrorBadge.js +2 -2
  24. package/dist/development/src/ui/DevError/DevErrorBadge.js.map +1 -1
  25. package/dist/development/src/ui/DevError/DevErrorCopy.cjs +36 -0
  26. package/dist/development/src/ui/DevError/DevErrorCopy.cjs.map +1 -0
  27. package/dist/development/src/ui/DevError/DevErrorCopy.js +36 -0
  28. package/dist/development/src/ui/DevError/DevErrorCopy.js.map +1 -0
  29. package/dist/development/src/ui/DevError/DevErrorInner.cjs +26 -26
  30. package/dist/development/src/ui/DevError/DevErrorInner.cjs.map +1 -1
  31. package/dist/development/src/ui/DevError/DevErrorInner.js +26 -26
  32. package/dist/development/src/ui/DevError/DevErrorInner.js.map +1 -1
  33. package/dist/development/src/ui/DevError/DevErrorList.cjs +35 -27
  34. package/dist/development/src/ui/DevError/DevErrorList.cjs.map +1 -1
  35. package/dist/development/src/ui/DevError/DevErrorList.js +35 -27
  36. package/dist/development/src/ui/DevError/DevErrorList.js.map +1 -1
  37. package/dist/development/src/ui/DevError/StackTrace.cjs +11 -11
  38. package/dist/development/src/ui/DevError/StackTrace.cjs.map +1 -1
  39. package/dist/development/src/ui/DevError/StackTrace.js +11 -11
  40. package/dist/development/src/ui/DevError/StackTrace.js.map +1 -1
  41. package/dist/production/index.cjs +2 -2
  42. package/dist/production/index.js +1 -1
  43. package/dist/production/src/errorHandling.cjs +1 -21
  44. package/dist/production/src/errorHandling.cjs.map +1 -1
  45. package/dist/production/src/errorHandling.js +1 -4
  46. package/dist/production/src/errorHandling.js.map +1 -1
  47. package/dist/production/src/hooks/useCopyErrorMarkdown.cjs +101 -0
  48. package/dist/production/src/hooks/useCopyErrorMarkdown.cjs.map +1 -0
  49. package/dist/production/src/hooks/useCopyErrorMarkdown.js +101 -0
  50. package/dist/production/src/hooks/useCopyErrorMarkdown.js.map +1 -0
  51. package/dist/production/src/hooks/useParsedStacktrace.cjs.map +1 -1
  52. package/dist/production/src/hooks/useParsedStacktrace.js.map +1 -1
  53. package/dist/production/src/ui/DevBar/DevBar.cjs +2 -0
  54. package/dist/production/src/ui/DevBar/DevBar.cjs.map +1 -1
  55. package/dist/production/src/ui/DevBar/DevBar.js +2 -0
  56. package/dist/production/src/ui/DevBar/DevBar.js.map +1 -1
  57. package/dist/production/src/ui/DevError/DevError.cjs.map +1 -1
  58. package/dist/production/src/ui/DevError/DevError.js.map +1 -1
  59. package/dist/production/src/ui/DevError/DevErrorBadge.cjs.map +1 -1
  60. package/dist/production/src/ui/DevError/DevErrorBadge.js.map +1 -1
  61. package/dist/production/src/ui/DevError/DevErrorCopy.cjs +28 -0
  62. package/dist/production/src/ui/DevError/DevErrorCopy.cjs.map +1 -0
  63. package/dist/production/src/ui/DevError/DevErrorCopy.js +28 -0
  64. package/dist/production/src/ui/DevError/DevErrorCopy.js.map +1 -0
  65. package/dist/production/src/ui/DevError/DevErrorInner.cjs.map +1 -1
  66. package/dist/production/src/ui/DevError/DevErrorInner.js.map +1 -1
  67. package/dist/production/src/ui/DevError/DevErrorList.cjs +10 -6
  68. package/dist/production/src/ui/DevError/DevErrorList.cjs.map +1 -1
  69. package/dist/production/src/ui/DevError/DevErrorList.js +10 -6
  70. package/dist/production/src/ui/DevError/DevErrorList.js.map +1 -1
  71. package/dist/production/src/ui/DevError/StackTrace.cjs.map +1 -1
  72. package/dist/production/src/ui/DevError/StackTrace.js.map +1 -1
  73. package/dist/types/errorHandling.d.ts.map +1 -1
  74. package/dist/types/hooks/useCopyErrorMarkdown.d.ts +12 -0
  75. package/dist/types/hooks/useCopyErrorMarkdown.d.ts.map +1 -0
  76. package/dist/types/tsconfig.tsbuildinfo +1 -1
  77. package/dist/types/ui/DevBar/DevBar.d.ts +1 -1
  78. package/dist/types/ui/DevBar/DevBar.d.ts.map +1 -1
  79. package/dist/types/ui/DevError/DevErrorBadge.d.ts.map +1 -1
  80. package/dist/types/ui/DevError/DevErrorCopy.d.ts +6 -0
  81. package/dist/types/ui/DevError/DevErrorCopy.d.ts.map +1 -0
  82. package/dist/types/ui/DevError/DevErrorInner.d.ts.map +1 -1
  83. package/dist/types/ui/DevError/DevErrorList.d.ts +1 -1
  84. package/dist/types/ui/DevError/DevErrorList.d.ts.map +1 -1
  85. package/dist/types/ui/DevError/StackTrace.d.ts.map +1 -1
  86. package/package.json +10 -10
  87. package/src/errorHandling.tsx +1 -8
  88. package/src/hooks/useCopyErrorMarkdown.ts +127 -0
  89. package/src/hooks/useParsedStacktrace.ts +1 -1
  90. package/src/index.css +27 -0
  91. package/src/ui/DevBar/DevBar.tsx +9 -13
  92. package/src/ui/DevError/DevErrorBadge.tsx +0 -1
  93. package/src/ui/DevError/DevErrorCopy.tsx +30 -0
  94. package/src/ui/DevError/DevErrorInner.tsx +26 -26
  95. package/src/ui/DevError/DevErrorList.tsx +25 -19
  96. package/src/ui/DevError/StackTrace.tsx +1 -4
@@ -1 +1 @@
1
- {"version":3,"file":"errorHandling.cjs","sources":["../../../../packages/react-devbar/src/errorHandling.tsx"],"sourcesContent":["import * as ReactDOM from 'react-dom'\nimport { Buffer } from 'buffer'\nimport { DevErrorManager, ErrorBus } from './DevErrorManager'\nimport { ReactElement } from 'react'\n\nexport type ErrorReactRenderer = (domElement: Element, reactElement: ReactElement, onRecoverableError: (e: any) => void) => void\n\nconst getErrorContainer = () => {\n\tconst errorElementId = '__contember__dev__error__container__element'\n\tlet errorContainer = document.getElementById(errorElementId)\n\n\tif (errorContainer) {\n\t\t// eslint-disable-next-line react/no-deprecated\n\t\tReactDOM.unmountComponentAtNode(errorContainer)\n\n\t} else {\n\t\terrorContainer = document.createElement('div')\n\t\terrorContainer.id = errorElementId\n\t\tdocument.body.appendChild(errorContainer)\n\t}\n\n\treturn errorContainer\n}\n\nconst devErrorHandler = (renderer: ErrorReactRenderer): TryRun => {\n\tconst errorBus = new ErrorBus()\n\n\t;(window as any).Buffer = Buffer\n\twindow.addEventListener('error', e => {\n\t\tif (e.message.startsWith('ResizeObserver')) {\n\t\t\t// Apparently, this can be ignored: https://stackoverflow.com/questions/49384120/resizeobserver-loop-limit-exceeded\n\t\t\treturn\n\t\t}\n\t\terrorBus.handleError('Unhandled error', e.error)\n\t})\n\n\twindow.addEventListener('unhandledrejection', e => errorBus.handleError('Unhandled promise rejection', e.reason))\n\n\tconst origOnError = console.error\n\tconsole.error = (...args) => {\n\t\torigOnError(...args)\n\t\tfor (const arg of args) {\n\t\t\tif (arg instanceof Error) {\n\t\t\t\terrorBus.handleError('Logged error', arg)\n\t\t\t}\n\t\t}\n\t}\n\trenderer(getErrorContainer(), <DevErrorManager bus={errorBus} />, () => {})\n\n\treturn async cb => {\n\t\ttry {\n\t\t\tawait cb(e => errorBus.handleError('Recoverable React error', e))\n\t\t} catch (e) {\n\t\t\terrorBus.handleError('Entrypoint crash', e)\n\t\t}\n\t}\n}\n\ntype TryRun = <T>(cb: (onRecoverableError: (e: any) => void) => T | Promise<T>) => void\nconst prodErrorHandler = (renderer: ErrorReactRenderer): TryRun => {\n\tconst renderError = () => {\n\t\trenderer(getErrorContainer(), <h1>Fatal error</h1>, () => {})\n\t}\n\n\twindow.addEventListener('error', renderError)\n\twindow.addEventListener('unhandledrejection', renderError)\n\n\treturn async cb => {\n\t\ttry {\n\t\t\tawait cb(e => {\n\t\t\t\tconsole.warn(e)\n\t\t\t})\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t\trenderError()\n\t\t}\n\t}\n}\n\n\nexport const createErrorHandler = (renderer: ErrorReactRenderer) => {\n\tif (import.meta.env.DEV) {\n\t\treturn devErrorHandler(renderer)\n\t} else {\n\t\treturn prodErrorHandler(renderer)\n\t}\n}\n"],"names":["ReactDOM","jsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAOA,MAAM,oBAAoB,MAAM;AAC/B,QAAM,iBAAiB;AACnB,MAAA,iBAAiB,SAAS,eAAe,cAAc;AAE3D,MAAI,gBAAgB;AAEnBA,wBAAS,uBAAuB,cAAc;AAAA,EAAA,OAExC;AACW,qBAAA,SAAS,cAAc,KAAK;AAC7C,mBAAe,KAAK;AACX,aAAA,KAAK,YAAY,cAAc;AAAA,EAAA;AAGlC,SAAA;AACR;AAqCA,MAAM,mBAAmB,CAAC,aAAyC;AAClE,QAAM,cAAc,MAAM;AAChB,aAAA,qBAAsBC,+BAAA,MAAG,EAAA,UAAA,cAAW,CAAA,GAAO,MAAM;AAAA,IAAA,CAAE;AAAA,EAC7D;AAEO,SAAA,iBAAiB,SAAS,WAAW;AACrC,SAAA,iBAAiB,sBAAsB,WAAW;AAEzD,SAAO,OAAM,OAAM;AACd,QAAA;AACG,YAAA,GAAG,CAAK,MAAA;AACb,gBAAQ,KAAK,CAAC;AAAA,MAAA,CACd;AAAA,aACO,GAAG;AACX,cAAQ,MAAM,CAAC;AACH,kBAAA;AAAA,IAAA;AAAA,EAEd;AACD;AAGa,MAAA,qBAAqB,CAAC,aAAiC;AAG5D;AACN,WAAO,iBAAiB,QAAQ;AAAA,EAAA;AAElC;;"}
1
+ {"version":3,"file":"errorHandling.cjs","sources":["../../../../packages/react-devbar/src/errorHandling.tsx"],"sourcesContent":["import { Buffer } from 'buffer'\nimport { DevErrorManager, ErrorBus } from './DevErrorManager'\nimport { ReactElement } from 'react'\n\nexport type ErrorReactRenderer = (domElement: Element, reactElement: ReactElement, onRecoverableError: (e: any) => void) => void\n\nconst getErrorContainer = () => {\n\tconst errorElementId = '__contember__dev__error__container__element'\n\tlet errorContainer = document.getElementById(errorElementId)\n\n\tif (!errorContainer) {\n\t\terrorContainer = document.createElement('div')\n\t\terrorContainer.id = errorElementId\n\t\tdocument.body.appendChild(errorContainer)\n\t}\n\n\treturn errorContainer\n}\n\nconst devErrorHandler = (renderer: ErrorReactRenderer): TryRun => {\n\tconst errorBus = new ErrorBus()\n\t;(window as any).Buffer = Buffer\n\twindow.addEventListener('error', e => {\n\t\tif (e.message.startsWith('ResizeObserver')) {\n\t\t\t// Apparently, this can be ignored: https://stackoverflow.com/questions/49384120/resizeobserver-loop-limit-exceeded\n\t\t\treturn\n\t\t}\n\t\terrorBus.handleError('Unhandled error', e.error)\n\t})\n\n\twindow.addEventListener('unhandledrejection', e => errorBus.handleError('Unhandled promise rejection', e.reason))\n\n\tconst origOnError = console.error\n\tconsole.error = (...args) => {\n\t\torigOnError(...args)\n\t\tfor (const arg of args) {\n\t\t\tif (arg instanceof Error) {\n\t\t\t\terrorBus.handleError('Logged error', arg)\n\t\t\t}\n\t\t}\n\t}\n\trenderer(getErrorContainer(), <DevErrorManager bus={errorBus} />, () => {})\n\n\treturn async cb => {\n\t\ttry {\n\t\t\tawait cb(e => errorBus.handleError('Recoverable React error', e))\n\t\t} catch (e) {\n\t\t\terrorBus.handleError('Entrypoint crash', e)\n\t\t}\n\t}\n}\n\ntype TryRun = <T>(cb: (onRecoverableError: (e: any) => void) => T | Promise<T>) => void\nconst prodErrorHandler = (renderer: ErrorReactRenderer): TryRun => {\n\tconst renderError = () => {\n\t\trenderer(getErrorContainer(), <h1>Fatal error</h1>, () => {})\n\t}\n\n\twindow.addEventListener('error', renderError)\n\twindow.addEventListener('unhandledrejection', renderError)\n\n\treturn async cb => {\n\t\ttry {\n\t\t\tawait cb(e => {\n\t\t\t\tconsole.warn(e)\n\t\t\t})\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t\trenderError()\n\t\t}\n\t}\n}\n\nexport const createErrorHandler = (renderer: ErrorReactRenderer) => {\n\tif (import.meta.env.DEV) {\n\t\treturn devErrorHandler(renderer)\n\t} else {\n\t\treturn prodErrorHandler(renderer)\n\t}\n}\n"],"names":["jsx"],"mappings":";;;;AAMA,MAAM,oBAAoB,MAAM;AAC/B,QAAM,iBAAiB;AACvB,MAAI,iBAAiB,SAAS,eAAe,cAAc;AAE3D,MAAI,CAAC,gBAAgB;AACpB,qBAAiB,SAAS,cAAc,KAAK;AAC7C,mBAAe,KAAK;AACpB,aAAS,KAAK,YAAY,cAAc;AAAA,EACzC;AAEA,SAAO;AACR;AAoCA,MAAM,mBAAmB,CAAC,aAAyC;AAClE,QAAM,cAAc,MAAM;AACzB,aAAS,kBAAA,GAAqBA,+BAAC,MAAA,EAAG,UAAA,cAAA,CAAW,GAAO,MAAM;AAAA,IAAC,CAAC;AAAA,EAC7D;AAEA,SAAO,iBAAiB,SAAS,WAAW;AAC5C,SAAO,iBAAiB,sBAAsB,WAAW;AAEzD,SAAO,OAAM,OAAM;AAClB,QAAI;AACH,YAAM,GAAG,CAAA,MAAK;AACb,gBAAQ,KAAK,CAAC;AAAA,MACf,CAAC;AAAA,IACF,SAAS,GAAG;AACX,cAAQ,MAAM,CAAC;AACf,kBAAA;AAAA,IACD;AAAA,EACD;AACD;AAEO,MAAM,qBAAqB,CAAC,aAAiC;AAG5D;AACN,WAAO,iBAAiB,QAAQ;AAAA,EACjC;AACD;;"}
@@ -1,12 +1,9 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import * as ReactDOM from "react-dom";
3
2
  import "buffer";
4
3
  const getErrorContainer = () => {
5
4
  const errorElementId = "__contember__dev__error__container__element";
6
5
  let errorContainer = document.getElementById(errorElementId);
7
- if (errorContainer) {
8
- ReactDOM.unmountComponentAtNode(errorContainer);
9
- } else {
6
+ if (!errorContainer) {
10
7
  errorContainer = document.createElement("div");
11
8
  errorContainer.id = errorElementId;
12
9
  document.body.appendChild(errorContainer);
@@ -1 +1 @@
1
- {"version":3,"file":"errorHandling.js","sources":["../../../../packages/react-devbar/src/errorHandling.tsx"],"sourcesContent":["import * as ReactDOM from 'react-dom'\nimport { Buffer } from 'buffer'\nimport { DevErrorManager, ErrorBus } from './DevErrorManager'\nimport { ReactElement } from 'react'\n\nexport type ErrorReactRenderer = (domElement: Element, reactElement: ReactElement, onRecoverableError: (e: any) => void) => void\n\nconst getErrorContainer = () => {\n\tconst errorElementId = '__contember__dev__error__container__element'\n\tlet errorContainer = document.getElementById(errorElementId)\n\n\tif (errorContainer) {\n\t\t// eslint-disable-next-line react/no-deprecated\n\t\tReactDOM.unmountComponentAtNode(errorContainer)\n\n\t} else {\n\t\terrorContainer = document.createElement('div')\n\t\terrorContainer.id = errorElementId\n\t\tdocument.body.appendChild(errorContainer)\n\t}\n\n\treturn errorContainer\n}\n\nconst devErrorHandler = (renderer: ErrorReactRenderer): TryRun => {\n\tconst errorBus = new ErrorBus()\n\n\t;(window as any).Buffer = Buffer\n\twindow.addEventListener('error', e => {\n\t\tif (e.message.startsWith('ResizeObserver')) {\n\t\t\t// Apparently, this can be ignored: https://stackoverflow.com/questions/49384120/resizeobserver-loop-limit-exceeded\n\t\t\treturn\n\t\t}\n\t\terrorBus.handleError('Unhandled error', e.error)\n\t})\n\n\twindow.addEventListener('unhandledrejection', e => errorBus.handleError('Unhandled promise rejection', e.reason))\n\n\tconst origOnError = console.error\n\tconsole.error = (...args) => {\n\t\torigOnError(...args)\n\t\tfor (const arg of args) {\n\t\t\tif (arg instanceof Error) {\n\t\t\t\terrorBus.handleError('Logged error', arg)\n\t\t\t}\n\t\t}\n\t}\n\trenderer(getErrorContainer(), <DevErrorManager bus={errorBus} />, () => {})\n\n\treturn async cb => {\n\t\ttry {\n\t\t\tawait cb(e => errorBus.handleError('Recoverable React error', e))\n\t\t} catch (e) {\n\t\t\terrorBus.handleError('Entrypoint crash', e)\n\t\t}\n\t}\n}\n\ntype TryRun = <T>(cb: (onRecoverableError: (e: any) => void) => T | Promise<T>) => void\nconst prodErrorHandler = (renderer: ErrorReactRenderer): TryRun => {\n\tconst renderError = () => {\n\t\trenderer(getErrorContainer(), <h1>Fatal error</h1>, () => {})\n\t}\n\n\twindow.addEventListener('error', renderError)\n\twindow.addEventListener('unhandledrejection', renderError)\n\n\treturn async cb => {\n\t\ttry {\n\t\t\tawait cb(e => {\n\t\t\t\tconsole.warn(e)\n\t\t\t})\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t\trenderError()\n\t\t}\n\t}\n}\n\n\nexport const createErrorHandler = (renderer: ErrorReactRenderer) => {\n\tif (import.meta.env.DEV) {\n\t\treturn devErrorHandler(renderer)\n\t} else {\n\t\treturn prodErrorHandler(renderer)\n\t}\n}\n"],"names":[],"mappings":";;;AAOA,MAAM,oBAAoB,MAAM;AAC/B,QAAM,iBAAiB;AACnB,MAAA,iBAAiB,SAAS,eAAe,cAAc;AAE3D,MAAI,gBAAgB;AAEnB,aAAS,uBAAuB,cAAc;AAAA,EAAA,OAExC;AACW,qBAAA,SAAS,cAAc,KAAK;AAC7C,mBAAe,KAAK;AACX,aAAA,KAAK,YAAY,cAAc;AAAA,EAAA;AAGlC,SAAA;AACR;AAqCA,MAAM,mBAAmB,CAAC,aAAyC;AAClE,QAAM,cAAc,MAAM;AAChB,aAAA,qBAAsB,oBAAA,MAAG,EAAA,UAAA,cAAW,CAAA,GAAO,MAAM;AAAA,IAAA,CAAE;AAAA,EAC7D;AAEO,SAAA,iBAAiB,SAAS,WAAW;AACrC,SAAA,iBAAiB,sBAAsB,WAAW;AAEzD,SAAO,OAAM,OAAM;AACd,QAAA;AACG,YAAA,GAAG,CAAK,MAAA;AACb,gBAAQ,KAAK,CAAC;AAAA,MAAA,CACd;AAAA,aACO,GAAG;AACX,cAAQ,MAAM,CAAC;AACH,kBAAA;AAAA,IAAA;AAAA,EAEd;AACD;AAGa,MAAA,qBAAqB,CAAC,aAAiC;AAG5D;AACN,WAAO,iBAAiB,QAAQ;AAAA,EAAA;AAElC;"}
1
+ {"version":3,"file":"errorHandling.js","sources":["../../../../packages/react-devbar/src/errorHandling.tsx"],"sourcesContent":["import { Buffer } from 'buffer'\nimport { DevErrorManager, ErrorBus } from './DevErrorManager'\nimport { ReactElement } from 'react'\n\nexport type ErrorReactRenderer = (domElement: Element, reactElement: ReactElement, onRecoverableError: (e: any) => void) => void\n\nconst getErrorContainer = () => {\n\tconst errorElementId = '__contember__dev__error__container__element'\n\tlet errorContainer = document.getElementById(errorElementId)\n\n\tif (!errorContainer) {\n\t\terrorContainer = document.createElement('div')\n\t\terrorContainer.id = errorElementId\n\t\tdocument.body.appendChild(errorContainer)\n\t}\n\n\treturn errorContainer\n}\n\nconst devErrorHandler = (renderer: ErrorReactRenderer): TryRun => {\n\tconst errorBus = new ErrorBus()\n\t;(window as any).Buffer = Buffer\n\twindow.addEventListener('error', e => {\n\t\tif (e.message.startsWith('ResizeObserver')) {\n\t\t\t// Apparently, this can be ignored: https://stackoverflow.com/questions/49384120/resizeobserver-loop-limit-exceeded\n\t\t\treturn\n\t\t}\n\t\terrorBus.handleError('Unhandled error', e.error)\n\t})\n\n\twindow.addEventListener('unhandledrejection', e => errorBus.handleError('Unhandled promise rejection', e.reason))\n\n\tconst origOnError = console.error\n\tconsole.error = (...args) => {\n\t\torigOnError(...args)\n\t\tfor (const arg of args) {\n\t\t\tif (arg instanceof Error) {\n\t\t\t\terrorBus.handleError('Logged error', arg)\n\t\t\t}\n\t\t}\n\t}\n\trenderer(getErrorContainer(), <DevErrorManager bus={errorBus} />, () => {})\n\n\treturn async cb => {\n\t\ttry {\n\t\t\tawait cb(e => errorBus.handleError('Recoverable React error', e))\n\t\t} catch (e) {\n\t\t\terrorBus.handleError('Entrypoint crash', e)\n\t\t}\n\t}\n}\n\ntype TryRun = <T>(cb: (onRecoverableError: (e: any) => void) => T | Promise<T>) => void\nconst prodErrorHandler = (renderer: ErrorReactRenderer): TryRun => {\n\tconst renderError = () => {\n\t\trenderer(getErrorContainer(), <h1>Fatal error</h1>, () => {})\n\t}\n\n\twindow.addEventListener('error', renderError)\n\twindow.addEventListener('unhandledrejection', renderError)\n\n\treturn async cb => {\n\t\ttry {\n\t\t\tawait cb(e => {\n\t\t\t\tconsole.warn(e)\n\t\t\t})\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t\trenderError()\n\t\t}\n\t}\n}\n\nexport const createErrorHandler = (renderer: ErrorReactRenderer) => {\n\tif (import.meta.env.DEV) {\n\t\treturn devErrorHandler(renderer)\n\t} else {\n\t\treturn prodErrorHandler(renderer)\n\t}\n}\n"],"names":[],"mappings":";;AAMA,MAAM,oBAAoB,MAAM;AAC/B,QAAM,iBAAiB;AACvB,MAAI,iBAAiB,SAAS,eAAe,cAAc;AAE3D,MAAI,CAAC,gBAAgB;AACpB,qBAAiB,SAAS,cAAc,KAAK;AAC7C,mBAAe,KAAK;AACpB,aAAS,KAAK,YAAY,cAAc;AAAA,EACzC;AAEA,SAAO;AACR;AAoCA,MAAM,mBAAmB,CAAC,aAAyC;AAClE,QAAM,cAAc,MAAM;AACzB,aAAS,kBAAA,GAAqB,oBAAC,MAAA,EAAG,UAAA,cAAA,CAAW,GAAO,MAAM;AAAA,IAAC,CAAC;AAAA,EAC7D;AAEA,SAAO,iBAAiB,SAAS,WAAW;AAC5C,SAAO,iBAAiB,sBAAsB,WAAW;AAEzD,SAAO,OAAM,OAAM;AAClB,QAAI;AACH,YAAM,GAAG,CAAA,MAAK;AACb,gBAAQ,KAAK,CAAC;AAAA,MACf,CAAC;AAAA,IACF,SAAS,GAAG;AACX,cAAQ,MAAM,CAAC;AACf,kBAAA;AAAA,IACD;AAAA,EACD;AACD;AAEO,MAAM,qBAAqB,CAAC,aAAiC;AAG5D;AACN,WAAO,iBAAiB,QAAQ;AAAA,EACjC;AACD;"}
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const React = require("react");
4
+ const convertStackTraceToMarkdown = (stackTrace, lines) => {
5
+ stackTrace.forEach((frame, index) => {
6
+ lines.push(`**Frame ${index + 1}:**`);
7
+ lines.push("");
8
+ lines.push(`- **File:** ${frame.filename}${frame.line ? `:${frame.line}` : ""}`);
9
+ if (frame.callee) {
10
+ lines.push(`- **Function:** ${frame.callee}`);
11
+ }
12
+ lines.push("");
13
+ if (frame.line !== void 0 && frame.sourceCodeLines) {
14
+ lines.push("**Source Code:**");
15
+ lines.push("");
16
+ lines.push("```typescript");
17
+ frame.sourceCodeLines.forEach((codeLine, lineIndex) => {
18
+ const lineNumber = lineIndex + 1;
19
+ if (frame.line && lineNumber + 5 >= frame.line && lineNumber - 3 <= frame.line) {
20
+ const isErrorLine = lineNumber === frame.line;
21
+ const marker = isErrorLine ? ">>> " : " ";
22
+ lines.push(`${marker}${lineNumber.toString().padStart(3)}: ${codeLine}`);
23
+ }
24
+ });
25
+ lines.push("```");
26
+ lines.push("");
27
+ }
28
+ lines.push("---");
29
+ lines.push("");
30
+ });
31
+ };
32
+ const convertErrorToMarkdownRecursive = (error, lines, level) => {
33
+ const errorObject = error.error instanceof Error ? error.error : void 0;
34
+ const prefix = "#".repeat(level + 1);
35
+ if (errorObject) {
36
+ lines.push(`${prefix} ${errorObject.name}`);
37
+ lines.push("");
38
+ if (errorObject.message) {
39
+ lines.push(`**Message:** ${errorObject.message}`);
40
+ lines.push("");
41
+ }
42
+ if ("details" in errorObject && errorObject.details) {
43
+ lines.push(`**Details:** ${errorObject.details}`);
44
+ lines.push("");
45
+ }
46
+ } else {
47
+ lines.push(`${prefix} Unknown Error`);
48
+ lines.push("");
49
+ }
50
+ if (error.parsedStackStrace) {
51
+ lines.push(`${"#".repeat(level + 2)} Stack Trace`);
52
+ lines.push("");
53
+ convertStackTraceToMarkdown(error.parsedStackStrace, lines);
54
+ } else if (errorObject?.stack) {
55
+ lines.push(`${"#".repeat(level + 2)} Stack Trace`);
56
+ lines.push("");
57
+ lines.push("```");
58
+ lines.push(errorObject.stack);
59
+ lines.push("```");
60
+ lines.push("");
61
+ }
62
+ if (error.cause) {
63
+ lines.push(`${"#".repeat(level + 2)} Caused By`);
64
+ lines.push("");
65
+ convertErrorToMarkdownRecursive(error.cause, lines, level + 1);
66
+ }
67
+ };
68
+ const convertErrorToMarkdown = (error, source) => {
69
+ const lines = [];
70
+ lines.push("# Contember Error Report");
71
+ lines.push("");
72
+ lines.push(`**Source:** ${source}`);
73
+ lines.push("");
74
+ convertErrorToMarkdownRecursive(error, lines, 1);
75
+ return lines.join("\n");
76
+ };
77
+ const useCopyErrorMarkdown = ({ currentError, currentErrorSource }) => {
78
+ const [copyStatus, setCopyStatus] = React.useState("idle");
79
+ React.useEffect(() => {
80
+ setCopyStatus("idle");
81
+ }, [currentError]);
82
+ const handleCopyMarkdown = async () => {
83
+ setCopyStatus("copying");
84
+ try {
85
+ const markdown = convertErrorToMarkdown(currentError, currentErrorSource);
86
+ await navigator.clipboard.writeText(markdown);
87
+ setCopyStatus("success");
88
+ } catch (err) {
89
+ console.error("Failed to copy markdown:", err);
90
+ setCopyStatus("error");
91
+ }
92
+ };
93
+ const isClipboardSupported = !!navigator?.clipboard;
94
+ return {
95
+ copyStatus,
96
+ handleCopyMarkdown,
97
+ isClipboardSupported
98
+ };
99
+ };
100
+ exports.useCopyErrorMarkdown = useCopyErrorMarkdown;
101
+ //# sourceMappingURL=useCopyErrorMarkdown.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCopyErrorMarkdown.cjs","sources":["../../../../../packages/react-devbar/src/hooks/useCopyErrorMarkdown.ts"],"sourcesContent":["import { useEffect, useState } from 'react'\nimport type { ParsedStackTrace, ProcessedError } from '../ui/DevError/types'\n\nconst convertStackTraceToMarkdown = (stackTrace: ParsedStackTrace, lines: string[]) => {\n\tstackTrace.forEach((frame, index) => {\n\t\tlines.push(`**Frame ${index + 1}:**`)\n\t\tlines.push('')\n\t\tlines.push(`- **File:** ${frame.filename}${frame.line ? `:${frame.line}` : ''}`)\n\n\t\tif (frame.callee) {\n\t\t\tlines.push(`- **Function:** ${frame.callee}`)\n\t\t}\n\n\t\tlines.push('')\n\n\t\tif (frame.line !== undefined && frame.sourceCodeLines) {\n\t\t\tlines.push('**Source Code:**')\n\t\t\tlines.push('')\n\t\t\tlines.push('```typescript')\n\n\t\t\tframe.sourceCodeLines.forEach((codeLine, lineIndex) => {\n\t\t\t\tconst lineNumber = lineIndex + 1\n\t\t\t\t// Show context around the error line (similar to the UI logic)\n\t\t\t\tif (frame.line && lineNumber + 5 >= frame.line && lineNumber - 3 <= frame.line) {\n\t\t\t\t\tconst isErrorLine = lineNumber === frame.line\n\t\t\t\t\tconst marker = isErrorLine ? '>>> ' : ' '\n\t\t\t\t\tlines.push(`${marker}${lineNumber.toString().padStart(3)}: ${codeLine}`)\n\t\t\t\t}\n\t\t\t})\n\n\t\t\tlines.push('```')\n\t\t\tlines.push('')\n\t\t}\n\n\t\tlines.push('---')\n\t\tlines.push('')\n\t})\n}\n\nconst convertErrorToMarkdownRecursive = (error: ProcessedError, lines: string[], level: number) => {\n\tconst errorObject = error.error instanceof Error ? error.error : undefined\n\tconst prefix = '#'.repeat(level + 1)\n\n\tif (errorObject) {\n\t\tlines.push(`${prefix} ${errorObject.name}`)\n\t\tlines.push('')\n\n\t\tif (errorObject.message) {\n\t\t\tlines.push(`**Message:** ${errorObject.message}`)\n\t\t\tlines.push('')\n\t\t}\n\n\t\tif ('details' in errorObject && (errorObject as Error & { details?: unknown }).details) {\n\t\t\tlines.push(`**Details:** ${(errorObject as Error & { details: string }).details}`)\n\t\t\tlines.push('')\n\t\t}\n\t} else {\n\t\tlines.push(`${prefix} Unknown Error`)\n\t\tlines.push('')\n\t}\n\n\tif (error.parsedStackStrace) {\n\t\tlines.push(`${'#'.repeat(level + 2)} Stack Trace`)\n\t\tlines.push('')\n\t\tconvertStackTraceToMarkdown(error.parsedStackStrace, lines)\n\t} else if (errorObject?.stack) {\n\t\tlines.push(`${'#'.repeat(level + 2)} Stack Trace`)\n\t\tlines.push('')\n\t\tlines.push('```')\n\t\tlines.push(errorObject.stack)\n\t\tlines.push('```')\n\t\tlines.push('')\n\t}\n\n\tif (error.cause) {\n\t\tlines.push(`${'#'.repeat(level + 2)} Caused By`)\n\t\tlines.push('')\n\t\tconvertErrorToMarkdownRecursive(error.cause, lines, level + 1)\n\t}\n}\n\nconst convertErrorToMarkdown = (error: ProcessedError, source: string): string => {\n\tconst lines: string[] = []\n\n\tlines.push('# Contember Error Report')\n\tlines.push('')\n\tlines.push(`**Source:** ${source}`)\n\tlines.push('')\n\n\tconvertErrorToMarkdownRecursive(error, lines, 1)\n\n\treturn lines.join('\\n')\n}\n\ntype CopyMarkdownProps = {\n\tcurrentError: ProcessedError\n\tcurrentErrorSource: string\n}\n\nexport const useCopyErrorMarkdown = ({ currentError, currentErrorSource }: CopyMarkdownProps) => {\n\tconst [copyStatus, setCopyStatus] = useState<'idle' | 'copying' | 'success' | 'error'>('idle')\n\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: intentional\n\tuseEffect(() => {\n\t\tsetCopyStatus('idle')\n\t}, [currentError])\n\n\tconst handleCopyMarkdown = async () => {\n\t\tsetCopyStatus('copying')\n\t\ttry {\n\t\t\tconst markdown = convertErrorToMarkdown(currentError, currentErrorSource)\n\t\t\tawait navigator.clipboard.writeText(markdown)\n\t\t\tsetCopyStatus('success')\n\t\t} catch (err) {\n\t\t\tconsole.error('Failed to copy markdown:', err)\n\t\t\tsetCopyStatus('error')\n\t\t}\n\t}\n\n\tconst isClipboardSupported = !!navigator?.clipboard\n\n\treturn {\n\t\tcopyStatus,\n\t\thandleCopyMarkdown,\n\t\tisClipboardSupported,\n\t}\n}\n"],"names":["useState","useEffect"],"mappings":";;;AAGA,MAAM,8BAA8B,CAAC,YAA8B,UAAoB;AACtF,aAAW,QAAQ,CAAC,OAAO,UAAU;AACpC,UAAM,KAAK,WAAW,QAAQ,CAAC,KAAK;AACpC,UAAM,KAAK,EAAE;AACb,UAAM,KAAK,eAAe,MAAM,QAAQ,GAAG,MAAM,OAAO,IAAI,MAAM,IAAI,KAAK,EAAE,EAAE;AAE/E,QAAI,MAAM,QAAQ;AACjB,YAAM,KAAK,mBAAmB,MAAM,MAAM,EAAE;AAAA,IAC7C;AAEA,UAAM,KAAK,EAAE;AAEb,QAAI,MAAM,SAAS,UAAa,MAAM,iBAAiB;AACtD,YAAM,KAAK,kBAAkB;AAC7B,YAAM,KAAK,EAAE;AACb,YAAM,KAAK,eAAe;AAE1B,YAAM,gBAAgB,QAAQ,CAAC,UAAU,cAAc;AACtD,cAAM,aAAa,YAAY;AAE/B,YAAI,MAAM,QAAQ,aAAa,KAAK,MAAM,QAAQ,aAAa,KAAK,MAAM,MAAM;AAC/E,gBAAM,cAAc,eAAe,MAAM;AACzC,gBAAM,SAAS,cAAc,SAAS;AACtC,gBAAM,KAAK,GAAG,MAAM,GAAG,WAAW,WAAW,SAAS,CAAC,CAAC,KAAK,QAAQ,EAAE;AAAA,QACxE;AAAA,MACD,CAAC;AAED,YAAM,KAAK,KAAK;AAChB,YAAM,KAAK,EAAE;AAAA,IACd;AAEA,UAAM,KAAK,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AM,KAAK,0BAA0B;AACrC,QAAM,KAAK,EAAE;AACb,QAAM,KAAK,eAAe,MAAM,EAAE;AAClC,QAAM,KAAK,EAAE;AAEb,kCAAgC,OAAO,OAAO,CAAC;AAE/C,SAAO,MAAM,KAAK,IAAI;AACvB;AAOO,MAAM,uBAAuB,CAAC,EAAE,cAAc,yBAA4C;AAChG,QAAM,CAAC,YAAY,aAAa,IAAIA,MAAAA,SAAmD,MAAM;AAG7FC,QAAAA,UAAU,MAAM;AACf,kBAAc,MAAM;AAAA,EACrB,GAAG,CAAC,YAAY,CAAC;AAEjB,QAAM,qBAAqB,YAAY;AACtC,kBAAc,SAAS;AACvB,QAAI;AACH,YAAM,WAAW,uBAAuB,cAAc,kBAAkB;AACxE,YAAM,UAAU,UAAU,UAAU,QAAQ;AAC5C,oBAAc,SAAS;AAAA,IACxB,SAAS,KAAK;AACb,cAAQ,MAAM,4BAA4B,GAAG;AAC7C,oBAAc,OAAO;AAAA,IACtB;AAAA,EACD;AAEA,QAAM,uBAAuB,CAAC,CAAC,WAAW;AAE1C,SAAO;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,EAAA;AAEF;;"}
@@ -0,0 +1,101 @@
1
+ import { useState, useEffect } from "react";
2
+ const convertStackTraceToMarkdown = (stackTrace, lines) => {
3
+ stackTrace.forEach((frame, index) => {
4
+ lines.push(`**Frame ${index + 1}:**`);
5
+ lines.push("");
6
+ lines.push(`- **File:** ${frame.filename}${frame.line ? `:${frame.line}` : ""}`);
7
+ if (frame.callee) {
8
+ lines.push(`- **Function:** ${frame.callee}`);
9
+ }
10
+ lines.push("");
11
+ if (frame.line !== void 0 && frame.sourceCodeLines) {
12
+ lines.push("**Source Code:**");
13
+ lines.push("");
14
+ lines.push("```typescript");
15
+ frame.sourceCodeLines.forEach((codeLine, lineIndex) => {
16
+ const lineNumber = lineIndex + 1;
17
+ if (frame.line && lineNumber + 5 >= frame.line && lineNumber - 3 <= frame.line) {
18
+ const isErrorLine = lineNumber === frame.line;
19
+ const marker = isErrorLine ? ">>> " : " ";
20
+ lines.push(`${marker}${lineNumber.toString().padStart(3)}: ${codeLine}`);
21
+ }
22
+ });
23
+ lines.push("```");
24
+ lines.push("");
25
+ }
26
+ lines.push("---");
27
+ lines.push("");
28
+ });
29
+ };
30
+ const convertErrorToMarkdownRecursive = (error, lines, level) => {
31
+ const errorObject = error.error instanceof Error ? error.error : void 0;
32
+ const prefix = "#".repeat(level + 1);
33
+ if (errorObject) {
34
+ lines.push(`${prefix} ${errorObject.name}`);
35
+ lines.push("");
36
+ if (errorObject.message) {
37
+ lines.push(`**Message:** ${errorObject.message}`);
38
+ lines.push("");
39
+ }
40
+ if ("details" in errorObject && errorObject.details) {
41
+ lines.push(`**Details:** ${errorObject.details}`);
42
+ lines.push("");
43
+ }
44
+ } else {
45
+ lines.push(`${prefix} Unknown Error`);
46
+ lines.push("");
47
+ }
48
+ if (error.parsedStackStrace) {
49
+ lines.push(`${"#".repeat(level + 2)} Stack Trace`);
50
+ lines.push("");
51
+ convertStackTraceToMarkdown(error.parsedStackStrace, lines);
52
+ } else if (errorObject?.stack) {
53
+ lines.push(`${"#".repeat(level + 2)} Stack Trace`);
54
+ lines.push("");
55
+ lines.push("```");
56
+ lines.push(errorObject.stack);
57
+ lines.push("```");
58
+ lines.push("");
59
+ }
60
+ if (error.cause) {
61
+ lines.push(`${"#".repeat(level + 2)} Caused By`);
62
+ lines.push("");
63
+ convertErrorToMarkdownRecursive(error.cause, lines, level + 1);
64
+ }
65
+ };
66
+ const convertErrorToMarkdown = (error, source) => {
67
+ const lines = [];
68
+ lines.push("# Contember Error Report");
69
+ lines.push("");
70
+ lines.push(`**Source:** ${source}`);
71
+ lines.push("");
72
+ convertErrorToMarkdownRecursive(error, lines, 1);
73
+ return lines.join("\n");
74
+ };
75
+ const useCopyErrorMarkdown = ({ currentError, currentErrorSource }) => {
76
+ const [copyStatus, setCopyStatus] = useState("idle");
77
+ useEffect(() => {
78
+ setCopyStatus("idle");
79
+ }, [currentError]);
80
+ const handleCopyMarkdown = async () => {
81
+ setCopyStatus("copying");
82
+ try {
83
+ const markdown = convertErrorToMarkdown(currentError, currentErrorSource);
84
+ await navigator.clipboard.writeText(markdown);
85
+ setCopyStatus("success");
86
+ } catch (err) {
87
+ console.error("Failed to copy markdown:", err);
88
+ setCopyStatus("error");
89
+ }
90
+ };
91
+ const isClipboardSupported = !!navigator?.clipboard;
92
+ return {
93
+ copyStatus,
94
+ handleCopyMarkdown,
95
+ isClipboardSupported
96
+ };
97
+ };
98
+ export {
99
+ useCopyErrorMarkdown
100
+ };
101
+ //# sourceMappingURL=useCopyErrorMarkdown.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCopyErrorMarkdown.js","sources":["../../../../../packages/react-devbar/src/hooks/useCopyErrorMarkdown.ts"],"sourcesContent":["import { useEffect, useState } from 'react'\nimport type { ParsedStackTrace, ProcessedError } from '../ui/DevError/types'\n\nconst convertStackTraceToMarkdown = (stackTrace: ParsedStackTrace, lines: string[]) => {\n\tstackTrace.forEach((frame, index) => {\n\t\tlines.push(`**Frame ${index + 1}:**`)\n\t\tlines.push('')\n\t\tlines.push(`- **File:** ${frame.filename}${frame.line ? `:${frame.line}` : ''}`)\n\n\t\tif (frame.callee) {\n\t\t\tlines.push(`- **Function:** ${frame.callee}`)\n\t\t}\n\n\t\tlines.push('')\n\n\t\tif (frame.line !== undefined && frame.sourceCodeLines) {\n\t\t\tlines.push('**Source Code:**')\n\t\t\tlines.push('')\n\t\t\tlines.push('```typescript')\n\n\t\t\tframe.sourceCodeLines.forEach((codeLine, lineIndex) => {\n\t\t\t\tconst lineNumber = lineIndex + 1\n\t\t\t\t// Show context around the error line (similar to the UI logic)\n\t\t\t\tif (frame.line && lineNumber + 5 >= frame.line && lineNumber - 3 <= frame.line) {\n\t\t\t\t\tconst isErrorLine = lineNumber === frame.line\n\t\t\t\t\tconst marker = isErrorLine ? '>>> ' : ' '\n\t\t\t\t\tlines.push(`${marker}${lineNumber.toString().padStart(3)}: ${codeLine}`)\n\t\t\t\t}\n\t\t\t})\n\n\t\t\tlines.push('```')\n\t\t\tlines.push('')\n\t\t}\n\n\t\tlines.push('---')\n\t\tlines.push('')\n\t})\n}\n\nconst convertErrorToMarkdownRecursive = (error: ProcessedError, lines: string[], level: number) => {\n\tconst errorObject = error.error instanceof Error ? error.error : undefined\n\tconst prefix = '#'.repeat(level + 1)\n\n\tif (errorObject) {\n\t\tlines.push(`${prefix} ${errorObject.name}`)\n\t\tlines.push('')\n\n\t\tif (errorObject.message) {\n\t\t\tlines.push(`**Message:** ${errorObject.message}`)\n\t\t\tlines.push('')\n\t\t}\n\n\t\tif ('details' in errorObject && (errorObject as Error & { details?: unknown }).details) {\n\t\t\tlines.push(`**Details:** ${(errorObject as Error & { details: string }).details}`)\n\t\t\tlines.push('')\n\t\t}\n\t} else {\n\t\tlines.push(`${prefix} Unknown Error`)\n\t\tlines.push('')\n\t}\n\n\tif (error.parsedStackStrace) {\n\t\tlines.push(`${'#'.repeat(level + 2)} Stack Trace`)\n\t\tlines.push('')\n\t\tconvertStackTraceToMarkdown(error.parsedStackStrace, lines)\n\t} else if (errorObject?.stack) {\n\t\tlines.push(`${'#'.repeat(level + 2)} Stack Trace`)\n\t\tlines.push('')\n\t\tlines.push('```')\n\t\tlines.push(errorObject.stack)\n\t\tlines.push('```')\n\t\tlines.push('')\n\t}\n\n\tif (error.cause) {\n\t\tlines.push(`${'#'.repeat(level + 2)} Caused By`)\n\t\tlines.push('')\n\t\tconvertErrorToMarkdownRecursive(error.cause, lines, level + 1)\n\t}\n}\n\nconst convertErrorToMarkdown = (error: ProcessedError, source: string): string => {\n\tconst lines: string[] = []\n\n\tlines.push('# Contember Error Report')\n\tlines.push('')\n\tlines.push(`**Source:** ${source}`)\n\tlines.push('')\n\n\tconvertErrorToMarkdownRecursive(error, lines, 1)\n\n\treturn lines.join('\\n')\n}\n\ntype CopyMarkdownProps = {\n\tcurrentError: ProcessedError\n\tcurrentErrorSource: string\n}\n\nexport const useCopyErrorMarkdown = ({ currentError, currentErrorSource }: CopyMarkdownProps) => {\n\tconst [copyStatus, setCopyStatus] = useState<'idle' | 'copying' | 'success' | 'error'>('idle')\n\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: intentional\n\tuseEffect(() => {\n\t\tsetCopyStatus('idle')\n\t}, [currentError])\n\n\tconst handleCopyMarkdown = async () => {\n\t\tsetCopyStatus('copying')\n\t\ttry {\n\t\t\tconst markdown = convertErrorToMarkdown(currentError, currentErrorSource)\n\t\t\tawait navigator.clipboard.writeText(markdown)\n\t\t\tsetCopyStatus('success')\n\t\t} catch (err) {\n\t\t\tconsole.error('Failed to copy markdown:', err)\n\t\t\tsetCopyStatus('error')\n\t\t}\n\t}\n\n\tconst isClipboardSupported = !!navigator?.clipboard\n\n\treturn {\n\t\tcopyStatus,\n\t\thandleCopyMarkdown,\n\t\tisClipboardSupported,\n\t}\n}\n"],"names":[],"mappings":";AAGA,MAAM,8BAA8B,CAAC,YAA8B,UAAoB;AACtF,aAAW,QAAQ,CAAC,OAAO,UAAU;AACpC,UAAM,KAAK,WAAW,QAAQ,CAAC,KAAK;AACpC,UAAM,KAAK,EAAE;AACb,UAAM,KAAK,eAAe,MAAM,QAAQ,GAAG,MAAM,OAAO,IAAI,MAAM,IAAI,KAAK,EAAE,EAAE;AAE/E,QAAI,MAAM,QAAQ;AACjB,YAAM,KAAK,mBAAmB,MAAM,MAAM,EAAE;AAAA,IAC7C;AAEA,UAAM,KAAK,EAAE;AAEb,QAAI,MAAM,SAAS,UAAa,MAAM,iBAAiB;AACtD,YAAM,KAAK,kBAAkB;AAC7B,YAAM,KAAK,EAAE;AACb,YAAM,KAAK,eAAe;AAE1B,YAAM,gBAAgB,QAAQ,CAAC,UAAU,cAAc;AACtD,cAAM,aAAa,YAAY;AAE/B,YAAI,MAAM,QAAQ,aAAa,KAAK,MAAM,QAAQ,aAAa,KAAK,MAAM,MAAM;AAC/E,gBAAM,cAAc,eAAe,MAAM;AACz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,UAAM,KAAK,GAAG,IAAI,OAAO,QAAQ,CAAC,CAAC,YAAY;AAC/C,UAAM,KAAK,EAAE;AACb,oCAAgC,MAAM,OAAO,OAAO,QAAQ,CAAC;AAAA,EAC9D;AACD;AAEA,MAAM,yBAAyB,CAAC,OAAuB,WAA2B;AACjF,QAAM,QAAkB,CAAA;AAExB,QAAM,KAAK,0BAA0B;AACrC,QAAM,KAAK,EAAE;AACb,QAAM,KAAK,eAAe,MAAM,EAAE;AAClC,QAAM,KAAK,EAAE;AAEb,kCAAgC,OAAO,OAAO,CAAC;AAE/C,SAAO,MAAM,KAAK,IAAI;AACvB;AAOO,MAAM,uBAAuB,CAAC,EAAE,cAAc,yBAA4C;AAChG,QAAM,CAAC,YAAY,aAAa,IAAI,SAAmD,MAAM;AAG7F,YAAU,MAAM;AACf,kBAAc,MAAM;AAAA,EACrB,GAAG,CAAC,YAAY,CAAC;AAEjB,QAAM,qBAAqB,YAAY;AACtC,kBAAc,SAAS;AACvB,QAAI;AACH,YAAM,WAAW,uBAAuB,cAAc,kBAAkB;AACxE,YAAM,UAAU,UAAU,UAAU,QAAQ;AAC5C,oBAAc,SAAS;AAAA,IACxB,SAAS,KAAK;AACb,cAAQ,MAAM,4BAA4B,GAAG;AAC7C,oBAAc,OAAO;AAAA,IACtB;AAAA,EACD;AAEA,QAAM,uBAAuB,CAAC,CAAC,WAAW;AAE1C,SAAO;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,EAAA;AAEF;"}
@@ -1 +1 @@
1
- {"version":3,"file":"useParsedStacktrace.cjs","sources":["../../../../../packages/react-devbar/src/hooks/useParsedStacktrace.ts"],"sourcesContent":["import { useEffect, useState } from 'react'\nimport { ErrorType, ProcessedError } from '../ui/DevError'\n\nexport const parseStacktrace = async (e: Error) => {\n\tlet StackTracey\n\ttry {\n\t\tStackTracey = (await import('stacktracey')).default\n\t} catch {\n\t\treturn undefined\n\t}\n\treturn (await new StackTracey(e).withSourcesAsync()).items.map(it => ({\n\t\tfilename: it.fileShort,\n\t\tline: it.line,\n\t\tcallee: it.callee,\n\t\tthirdParty: it.thirdParty,\n\t\tsourceCodeLines: it.sourceFile?.lines,\n\t}))\n}\n\nconst createInitialError = (e: ErrorType): ProcessedError => ({\n\terror: e,\n\tcause: e instanceof Error && 'cause' in e && (e as any).cause !== undefined ? createInitialError((e as any).cause) : undefined,\n})\n\nexport const useProcessedError = (e: ErrorType): ProcessedError => {\n\tconst [error, setError] = useState<ProcessedError>(() => createInitialError(e))\n\tuseEffect(() => {\n\t\tsetError(createInitialError(e))\n\t\tif (!(e instanceof Error)) {\n\t\t\treturn\n\t\t}\n\t\tconst createErrorWithStackTrace = async (e: ErrorType): Promise<ProcessedError> => {\n\t\t\treturn {\n\t\t\t\terror: e,\n\t\t\t\tparsedStackStrace: e instanceof Error ? await parseStacktrace(e) : undefined,\n\t\t\t\tcause: e instanceof Error && 'cause' in e && (e as any).cause !== undefined ? await createErrorWithStackTrace((e as any).cause) : undefined,\n\t\t\t}\n\t\t}\n\t\t(async () => {\n\t\t\tsetError(await createErrorWithStackTrace(e))\n\t\t})()\n\t}, [e])\n\n\treturn error\n}\n"],"names":["useState","useEffect","e"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAGa,MAAA,kBAAkB,OAAO,MAAa;AAC9C,MAAA;AACA,MAAA;AACY,mBAAA,MAAM,OAAO,aAAa,GAAG;AAAA,EAAA,QACrC;AACA,WAAA;AAAA,EAAA;AAEA,UAAA,MAAM,IAAI,YAAY,CAAC,EAAE,iBAAiB,GAAG,MAAM,IAAI,CAAO,QAAA;AAAA,IACrE,UAAU,GAAG;AAAA,IACb,MAAM,GAAG;AAAA,IACT,QAAQ,GAAG;AAAA,IACX,YAAY,GAAG;AAAA,IACf,iBAAiB,GAAG,YAAY;AAAA,EAAA,EAC/B;AACH;AAEA,MAAM,qBAAqB,CAAC,OAAkC;AAAA,EAC7D,OAAO;AAAA,EACP,OAAO,aAAa,SAAS,WAAW,KAAM,EAAU,UAAU,SAAY,mBAAoB,EAAU,KAAK,IAAI;AACtH;AAEa,MAAA,oBAAoB,CAAC,MAAiC;AAC5D,QAAA,CAAC,OAAO,QAAQ,IAAIA,eAAyB,MAAM,mBAAmB,CAAC,CAAC;AAC9EC,QAAAA,UAAU,MAAM;AACN,aAAA,mBAAmB,CAAC,CAAC;AAC1B,QAAA,EAAE,aAAa,QAAQ;AAC1B;AAAA,IAAA;AAEK,UAAA,4BAA4B,OAAOC,OAA0C;AAC3E,aAAA;AAAA,QACN,OAAOA;AAAAA,QACP,mBAAmBA,cAAa,QAAQ,MAAM,gBAAgBA,EAAC,IAAI;AAAA,QACnE,OAAOA,cAAa,SAAS,WAAWA,MAAMA,GAAU,UAAU,SAAY,MAAM,0BAA2BA,GAAU,KAAK,IAAI;AAAA,MACnI;AAAA,IACD;AACA,KAAC,YAAY;AACH,eAAA,MAAM,0BAA0B,CAAC,CAAC;AAAA,IAAA,GACzC;AAAA,EAAA,GACD,CAAC,CAAC,CAAC;AAEC,SAAA;AACR;;;"}
1
+ {"version":3,"file":"useParsedStacktrace.cjs","sources":["../../../../../packages/react-devbar/src/hooks/useParsedStacktrace.ts"],"sourcesContent":["import { useEffect, useState } from 'react'\nimport { ErrorType, ProcessedError } from '../ui/DevError'\n\nexport const parseStacktrace = async (e: Error) => {\n\tlet StackTracey\n\ttry {\n\t\tStackTracey = (await import('stacktracey')).default\n\t} catch {\n\t\treturn undefined\n\t}\n\treturn (await new StackTracey(e).withSourcesAsync()).items.map(it => ({\n\t\tfilename: it.fileShort,\n\t\tline: it.line,\n\t\tcallee: it.callee,\n\t\tthirdParty: it.thirdParty,\n\t\tsourceCodeLines: it.sourceFile?.lines,\n\t}))\n}\n\nconst createInitialError = (e: ErrorType): ProcessedError => ({\n\terror: e,\n\tcause: e instanceof Error && 'cause' in e && (e as any).cause !== undefined ? createInitialError((e as any).cause) : undefined,\n})\n\nexport const useProcessedError = (e: ErrorType): ProcessedError => {\n\tconst [error, setError] = useState<ProcessedError>(() => createInitialError(e))\n\tuseEffect(() => {\n\t\tsetError(createInitialError(e))\n\t\tif (!(e instanceof Error)) {\n\t\t\treturn\n\t\t}\n\t\tconst createErrorWithStackTrace = async (e: ErrorType): Promise<ProcessedError> => {\n\t\t\treturn {\n\t\t\t\terror: e,\n\t\t\t\tparsedStackStrace: e instanceof Error ? await parseStacktrace(e) : undefined,\n\t\t\t\tcause: e instanceof Error && 'cause' in e && (e as any).cause !== undefined ? await createErrorWithStackTrace((e as any).cause) : undefined,\n\t\t\t}\n\t\t}\n\t\t;(async () => {\n\t\t\tsetError(await createErrorWithStackTrace(e))\n\t\t})()\n\t}, [e])\n\n\treturn error\n}\n"],"names":["useState","useEffect","e"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAGO,MAAM,kBAAkB,OAAO,MAAa;AAClD,MAAI;AACJ,MAAI;AACH,mBAAe,MAAM,OAAO,aAAa,GAAG;AAAA,EAC7C,QAAQ;AACP,WAAO;AAAA,EACR;AACA,UAAQ,MAAM,IAAI,YAAY,CAAC,EAAE,iBAAA,GAAoB,MAAM,IAAI,CAAA,QAAO;AAAA,IACrE,UAAU,GAAG;AAAA,IACb,MAAM,GAAG;AAAA,IACT,QAAQ,GAAG;AAAA,IACX,YAAY,GAAG;AAAA,IACf,iBAAiB,GAAG,YAAY;AAAA,EAAA,EAC/B;AACH;AAEA,MAAM,qBAAqB,CAAC,OAAkC;AAAA,EAC7D,OAAO;AAAA,EACP,OAAO,aAAa,SAAS,WAAW,KAAM,EAAU,UAAU,SAAY,mBAAoB,EAAU,KAAK,IAAI;AACtH;AAEO,MAAM,oBAAoB,CAAC,MAAiC;AAClE,QAAM,CAAC,OAAO,QAAQ,IAAIA,MAAAA,SAAyB,MAAM,mBAAmB,CAAC,CAAC;AAC9EC,QAAAA,UAAU,MAAM;AACf,aAAS,mBAAmB,CAAC,CAAC;AAC9B,QAAI,EAAE,aAAa,QAAQ;AAC1B;AAAA,IACD;AACA,UAAM,4BAA4B,OAAOC,OAA0C;AAClF,aAAO;AAAA,QACN,OAAOA;AAAAA,QACP,mBAAmBA,cAAa,QAAQ,MAAM,gBAAgBA,EAAC,IAAI;AAAA,QACnE,OAAOA,cAAa,SAAS,WAAWA,MAAMA,GAAU,UAAU,SAAY,MAAM,0BAA2BA,GAAU,KAAK,IAAI;AAAA,MAAA;AAAA,IAEpI;AACC,KAAC,YAAY;AACb,eAAS,MAAM,0BAA0B,CAAC,CAAC;AAAA,IAC5C,GAAA;AAAA,EACD,GAAG,CAAC,CAAC,CAAC;AAEN,SAAO;AACR;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"useParsedStacktrace.js","sources":["../../../../../packages/react-devbar/src/hooks/useParsedStacktrace.ts"],"sourcesContent":["import { useEffect, useState } from 'react'\nimport { ErrorType, ProcessedError } from '../ui/DevError'\n\nexport const parseStacktrace = async (e: Error) => {\n\tlet StackTracey\n\ttry {\n\t\tStackTracey = (await import('stacktracey')).default\n\t} catch {\n\t\treturn undefined\n\t}\n\treturn (await new StackTracey(e).withSourcesAsync()).items.map(it => ({\n\t\tfilename: it.fileShort,\n\t\tline: it.line,\n\t\tcallee: it.callee,\n\t\tthirdParty: it.thirdParty,\n\t\tsourceCodeLines: it.sourceFile?.lines,\n\t}))\n}\n\nconst createInitialError = (e: ErrorType): ProcessedError => ({\n\terror: e,\n\tcause: e instanceof Error && 'cause' in e && (e as any).cause !== undefined ? createInitialError((e as any).cause) : undefined,\n})\n\nexport const useProcessedError = (e: ErrorType): ProcessedError => {\n\tconst [error, setError] = useState<ProcessedError>(() => createInitialError(e))\n\tuseEffect(() => {\n\t\tsetError(createInitialError(e))\n\t\tif (!(e instanceof Error)) {\n\t\t\treturn\n\t\t}\n\t\tconst createErrorWithStackTrace = async (e: ErrorType): Promise<ProcessedError> => {\n\t\t\treturn {\n\t\t\t\terror: e,\n\t\t\t\tparsedStackStrace: e instanceof Error ? await parseStacktrace(e) : undefined,\n\t\t\t\tcause: e instanceof Error && 'cause' in e && (e as any).cause !== undefined ? await createErrorWithStackTrace((e as any).cause) : undefined,\n\t\t\t}\n\t\t}\n\t\t(async () => {\n\t\t\tsetError(await createErrorWithStackTrace(e))\n\t\t})()\n\t}, [e])\n\n\treturn error\n}\n"],"names":["e"],"mappings":";AAGa,MAAA,kBAAkB,OAAO,MAAa;AAC9C,MAAA;AACA,MAAA;AACY,mBAAA,MAAM,OAAO,aAAa,GAAG;AAAA,EAAA,QACrC;AACA,WAAA;AAAA,EAAA;AAEA,UAAA,MAAM,IAAI,YAAY,CAAC,EAAE,iBAAiB,GAAG,MAAM,IAAI,CAAO,QAAA;AAAA,IACrE,UAAU,GAAG;AAAA,IACb,MAAM,GAAG;AAAA,IACT,QAAQ,GAAG;AAAA,IACX,YAAY,GAAG;AAAA,IACf,iBAAiB,GAAG,YAAY;AAAA,EAAA,EAC/B;AACH;AAEA,MAAM,qBAAqB,CAAC,OAAkC;AAAA,EAC7D,OAAO;AAAA,EACP,OAAO,aAAa,SAAS,WAAW,KAAM,EAAU,UAAU,SAAY,mBAAoB,EAAU,KAAK,IAAI;AACtH;AAEa,MAAA,oBAAoB,CAAC,MAAiC;AAC5D,QAAA,CAAC,OAAO,QAAQ,IAAI,SAAyB,MAAM,mBAAmB,CAAC,CAAC;AAC9E,YAAU,MAAM;AACN,aAAA,mBAAmB,CAAC,CAAC;AAC1B,QAAA,EAAE,aAAa,QAAQ;AAC1B;AAAA,IAAA;AAEK,UAAA,4BAA4B,OAAOA,OAA0C;AAC3E,aAAA;AAAA,QACN,OAAOA;AAAAA,QACP,mBAAmBA,cAAa,QAAQ,MAAM,gBAAgBA,EAAC,IAAI;AAAA,QACnE,OAAOA,cAAa,SAAS,WAAWA,MAAMA,GAAU,UAAU,SAAY,MAAM,0BAA2BA,GAAU,KAAK,IAAI;AAAA,MACnI;AAAA,IACD;AACA,KAAC,YAAY;AACH,eAAA,MAAM,0BAA0B,CAAC,CAAC;AAAA,IAAA,GACzC;AAAA,EAAA,GACD,CAAC,CAAC,CAAC;AAEC,SAAA;AACR;"}
1
+ {"version":3,"file":"useParsedStacktrace.js","sources":["../../../../../packages/react-devbar/src/hooks/useParsedStacktrace.ts"],"sourcesContent":["import { useEffect, useState } from 'react'\nimport { ErrorType, ProcessedError } from '../ui/DevError'\n\nexport const parseStacktrace = async (e: Error) => {\n\tlet StackTracey\n\ttry {\n\t\tStackTracey = (await import('stacktracey')).default\n\t} catch {\n\t\treturn undefined\n\t}\n\treturn (await new StackTracey(e).withSourcesAsync()).items.map(it => ({\n\t\tfilename: it.fileShort,\n\t\tline: it.line,\n\t\tcallee: it.callee,\n\t\tthirdParty: it.thirdParty,\n\t\tsourceCodeLines: it.sourceFile?.lines,\n\t}))\n}\n\nconst createInitialError = (e: ErrorType): ProcessedError => ({\n\terror: e,\n\tcause: e instanceof Error && 'cause' in e && (e as any).cause !== undefined ? createInitialError((e as any).cause) : undefined,\n})\n\nexport const useProcessedError = (e: ErrorType): ProcessedError => {\n\tconst [error, setError] = useState<ProcessedError>(() => createInitialError(e))\n\tuseEffect(() => {\n\t\tsetError(createInitialError(e))\n\t\tif (!(e instanceof Error)) {\n\t\t\treturn\n\t\t}\n\t\tconst createErrorWithStackTrace = async (e: ErrorType): Promise<ProcessedError> => {\n\t\t\treturn {\n\t\t\t\terror: e,\n\t\t\t\tparsedStackStrace: e instanceof Error ? await parseStacktrace(e) : undefined,\n\t\t\t\tcause: e instanceof Error && 'cause' in e && (e as any).cause !== undefined ? await createErrorWithStackTrace((e as any).cause) : undefined,\n\t\t\t}\n\t\t}\n\t\t;(async () => {\n\t\t\tsetError(await createErrorWithStackTrace(e))\n\t\t})()\n\t}, [e])\n\n\treturn error\n}\n"],"names":["e"],"mappings":";AAGO,MAAM,kBAAkB,OAAO,MAAa;AAClD,MAAI;AACJ,MAAI;AACH,mBAAe,MAAM,OAAO,aAAa,GAAG;AAAA,EAC7C,QAAQ;AACP,WAAO;AAAA,EACR;AACA,UAAQ,MAAM,IAAI,YAAY,CAAC,EAAE,iBAAA,GAAoB,MAAM,IAAI,CAAA,QAAO;AAAA,IACrE,UAAU,GAAG;AAAA,IACb,MAAM,GAAG;AAAA,IACT,QAAQ,GAAG;AAAA,IACX,YAAY,GAAG;AAAA,IACf,iBAAiB,GAAG,YAAY;AAAA,EAAA,EAC/B;AACH;AAEA,MAAM,qBAAqB,CAAC,OAAkC;AAAA,EAC7D,OAAO;AAAA,EACP,OAAO,aAAa,SAAS,WAAW,KAAM,EAAU,UAAU,SAAY,mBAAoB,EAAU,KAAK,IAAI;AACtH;AAEO,MAAM,oBAAoB,CAAC,MAAiC;AAClE,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAyB,MAAM,mBAAmB,CAAC,CAAC;AAC9E,YAAU,MAAM;AACf,aAAS,mBAAmB,CAAC,CAAC;AAC9B,QAAI,EAAE,aAAa,QAAQ;AAC1B;AAAA,IACD;AACA,UAAM,4BAA4B,OAAOA,OAA0C;AAClF,aAAO;AAAA,QACN,OAAOA;AAAAA,QACP,mBAAmBA,cAAa,QAAQ,MAAM,gBAAgBA,EAAC,IAAI;AAAA,QACnE,OAAOA,cAAa,SAAS,WAAWA,MAAMA,GAAU,UAAU,SAAY,MAAM,0BAA2BA,GAAU,KAAK,IAAI;AAAA,MAAA;AAAA,IAEpI;AACC,KAAC,YAAY;AACb,eAAS,MAAM,0BAA0B,CAAC,CAAC;AAAA,IAC5C,GAAA;AAAA,EACD,GAAG,CAAC,CAAC,CAAC;AAEN,SAAO;AACR;"}
@@ -89,6 +89,7 @@ const DevPanel = ({ heading, icon, children, preview }) => {
89
89
  /* @__PURE__ */ jsxRuntime.jsxs(
90
90
  "button",
91
91
  {
92
+ type: "button",
92
93
  ref: triggerRef,
93
94
  tabIndex: 0,
94
95
  "aria-haspopup": "dialog",
@@ -107,6 +108,7 @@ const DevPanel = ({ heading, icon, children, preview }) => {
107
108
  /* @__PURE__ */ jsxRuntime.jsx(
108
109
  "button",
109
110
  {
111
+ type: "button",
110
112
  onClick: handleClose,
111
113
  className: className("close-button"),
112
114
  "aria-label": "Close",
@@ -1 +1 @@
1
- {"version":3,"file":"DevBar.cjs","sources":["../../../../../../packages/react-devbar/src/ui/DevBar/DevBar.tsx"],"sourcesContent":["import {\n\tuseId,\n\tuseOnElementClickOutsideCallback,\n\tuseReferentiallyStableCallback,\n\tuseWindowSize,\n} from '@contember/react-utils'\nimport { dataAttribute } from '@contember/utilities'\nimport { PropsWithChildren, ReactNode, useCallback, useEffect, useRef, useState } from 'react'\n\nconst className = (cls: string | null) => cls ? `cui-devBar-${cls}` : 'cui-devBar'\n\nexport const DevBar = ({\n\tbreakpoint = 768,\n\tchildren,\n}: PropsWithChildren<{\n\tbreakpoint?: number\n}>) => {\n\tconst [expanded, setExpanded] = useState(false)\n\tconst isSmallScreen = useWindowSize().width < breakpoint\n\n\tconst handleToggle = useReferentiallyStableCallback(() => {\n\t\tsetExpanded(expanded => !expanded)\n\t})\n\n\tuseEffect(() => {\n\t\tfunction handleKeyDown(event: KeyboardEvent) {\n\t\t\tif (event.code === 'KeyJ' && (event.ctrlKey || event.metaKey)) {\n\t\t\t\tevent.preventDefault()\n\t\t\t\tevent.stopPropagation()\n\n\t\t\t\thandleToggle()\n\t\t\t}\n\t\t}\n\n\t\tdocument.addEventListener('keydown', handleKeyDown)\n\t\treturn () => document.removeEventListener('keydown', handleKeyDown)\n\t}, [expanded, handleToggle])\n\n\tconst devBarContentRef = useRef<HTMLDivElement>(null)\n\n\tuseOnElementClickOutsideCallback(devBarContentRef, () => {\n\t\tif (expanded) {\n\t\t\tsetExpanded(false)\n\t\t}\n\t})\n\n\tconst id = `dev-bar-panel${useId()}`\n\n\treturn (\n\t\t<section\n\t\t\tdata-transparent=\"true\"\n\t\t\tdata-overrides-lucide-icons=\"true\"\n\t\t\tdata-expanded={dataAttribute(expanded)}\n\t\t\tdata-small-screen={dataAttribute(isSmallScreen)}\n\t\t\tclassName={className(null)}\n\t\t>\n\t\t\t<div ref={devBarContentRef} className={className('content')}>\n\t\t\t\t<div\n\t\t\t\t\tdata-expanded={true}\n\t\t\t\t\tid={id}\n\t\t\t\t\trole=\"dialog\"\n\t\t\t\t\tstyle={{ display: 'contents' }}\n\t\t\t\t>\n\t\t\t\t\t<div className={className('panels')}>\n\t\t\t\t\t\t{children}\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</section>\n\t)\n}\n\ninterface DevPanelProps {\n\ticon: ReactNode\n\theading: ReactNode\n\tchildren: ReactNode\n\tpreview?: ReactNode\n}\n\nexport const DevPanel = ({ heading, icon, children, preview }: DevPanelProps) => {\n\tconst id = `cui-devBar-panel-${useId()}`\n\tconst dialogRef = useRef<HTMLDialogElement>(null)\n\tconst triggerRef = useRef<HTMLButtonElement>(null)\n\n\tconst handleOpen = useCallback(() => {\n\t\tdialogRef.current?.showModal()\n\t}, [])\n\n\tconst handleClose = useCallback(() => {\n\t\tdialogRef.current?.close()\n\t}, [])\n\n\tuseEffect(() => {\n\t\tconst dialog = dialogRef.current\n\t\tif (!dialog) return\n\n\t\tconst handleClickOutside = (event: MouseEvent) => {\n\t\t\tconst rect = dialog.getBoundingClientRect()\n\t\t\tconst isInDialog = (\n\t\t\t\trect.top <= event.clientY &&\n\t\t\t\tevent.clientY <= rect.top + rect.height &&\n\t\t\t\trect.left <= event.clientX &&\n\t\t\t\tevent.clientX <= rect.left + rect.width\n\t\t\t)\n\n\t\t\tif (!isInDialog) {\n\t\t\t\tdialog.close()\n\t\t\t}\n\t\t}\n\n\t\tdialog.addEventListener('click', handleClickOutside)\n\t\treturn () => dialog.removeEventListener('click', handleClickOutside)\n\t}, [])\n\n\tuseEffect(() => {\n\t\tconst handleEscape = (event: KeyboardEvent) => {\n\t\t\tif (event.key === 'Escape') {\n\t\t\t\thandleClose()\n\t\t\t}\n\t\t}\n\n\t\tdocument.addEventListener('keydown', handleEscape)\n\t\treturn () => document.removeEventListener('keydown', handleEscape)\n\t}, [handleClose])\n\n\treturn (\n\t\t<div className={className('trigger')}>\n\t\t\t<button\n\t\t\t\tref={triggerRef}\n\t\t\t\ttabIndex={0}\n\t\t\t\taria-haspopup=\"dialog\"\n\t\t\t\taria-controls={id}\n\t\t\t\tclassName={className('trigger-label')}\n\t\t\t\tonClick={handleOpen}\n\t\t\t>\n\t\t\t\t{icon}\n\t\t\t\t<span className={className('trigger-label-text')}>\n\t\t\t\t\t{preview ?? heading}\n\t\t\t\t</span>\n\t\t\t</button>\n\n\t\t\t<dialog ref={dialogRef} id={id} className={className('panel')}>\n\t\t\t\t<div className={className('panel-content')}>\n\t\t\t\t\t<div className={className('panel-header')}>\n\t\t\t\t\t\t<h2 className=\"h4\">{heading}</h2>\n\t\t\t\t\t\t<button\n\t\t\t\t\t\t\tonClick={handleClose}\n\t\t\t\t\t\t\tclassName={className('close-button')}\n\t\t\t\t\t\t\taria-label=\"Close\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t✕\n\t\t\t\t\t\t</button>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div className={className('panel-body')}>\n\t\t\t\t\t\t{children}\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</dialog>\n\t\t</div>\n\t)\n}\n"],"names":["useState","useWindowSize","useReferentiallyStableCallback","expanded","useEffect","useRef","useOnElementClickOutsideCallback","useId","jsx","dataAttribute","useCallback","jsxs"],"mappings":";;;;;;AASA,MAAM,YAAY,CAAC,QAAuB,MAAM,cAAc,GAAG,KAAK;AAE/D,MAAM,SAAS,CAAC;AAAA,EACtB,aAAa;AAAA,EACb;AACD,MAEO;AACN,QAAM,CAAC,UAAU,WAAW,IAAIA,MAAAA,SAAS,KAAK;AACxC,QAAA,gBAAgBC,WAAAA,gBAAgB,QAAQ;AAExC,QAAA,eAAeC,WAAAA,+BAA+B,MAAM;AAC7C,gBAAA,CAAAC,cAAY,CAACA,SAAQ;AAAA,EAAA,CACjC;AAEDC,QAAAA,UAAU,MAAM;AACf,aAAS,cAAc,OAAsB;AAC5C,UAAI,MAAM,SAAS,WAAW,MAAM,WAAW,MAAM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AI,EAAA,WAAW,UAAU,cAAc,GACvC,UAAA;AAAA,QAACH,2BAAA,IAAA,MAAA,EAAG,WAAU,MAAM,UAAQ,SAAA;AAAA,QAC5BA,2BAAA;AAAA,UAAC;AAAA,UAAA;AAAA,YACA,SAAS;AAAA,YACT,WAAW,UAAU,cAAc;AAAA,YACnC,cAAW;AAAA,YACX,UAAA;AAAA,UAAA;AAAA,QAAA;AAAA,MAED,GACD;AAAA,qCACC,OAAI,EAAA,WAAW,UAAU,YAAY,GACpC,SACF,CAAA;AAAA,IAAA,EAAA,CACD,EACD,CAAA;AAAA,EAAA,GACD;AAEF;;;"}
1
+ {"version":3,"file":"DevBar.cjs","sources":["../../../../../../packages/react-devbar/src/ui/DevBar/DevBar.tsx"],"sourcesContent":["import { useId, useOnElementClickOutsideCallback, useReferentiallyStableCallback, useWindowSize } from '@contember/react-utils'\nimport { dataAttribute } from '@contember/utilities'\nimport { type PropsWithChildren, type ReactNode, useCallback, useEffect, useRef, useState } from 'react'\n\nconst className = (cls: string | null) => cls ? `cui-devBar-${cls}` : 'cui-devBar'\n\nexport const DevBar = ({\n\tbreakpoint = 768,\n\tchildren,\n}: PropsWithChildren<{\n\tbreakpoint?: number\n}>) => {\n\tconst [expanded, setExpanded] = useState(false)\n\tconst isSmallScreen = useWindowSize().width < breakpoint\n\n\tconst handleToggle = useReferentiallyStableCallback(() => {\n\t\tsetExpanded(expanded => !expanded)\n\t})\n\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: intentional\n\tuseEffect(() => {\n\t\tfunction handleKeyDown(event: KeyboardEvent) {\n\t\t\tif (event.code === 'KeyJ' && (event.ctrlKey || event.metaKey)) {\n\t\t\t\tevent.preventDefault()\n\t\t\t\tevent.stopPropagation()\n\n\t\t\t\thandleToggle()\n\t\t\t}\n\t\t}\n\n\t\tdocument.addEventListener('keydown', handleKeyDown)\n\t\treturn () => document.removeEventListener('keydown', handleKeyDown)\n\t}, [expanded, handleToggle])\n\n\tconst devBarContentRef = useRef<HTMLDivElement>(null)\n\n\tuseOnElementClickOutsideCallback(devBarContentRef, () => {\n\t\tif (expanded) {\n\t\t\tsetExpanded(false)\n\t\t}\n\t})\n\n\tconst id = `dev-bar-panel${useId()}`\n\n\treturn (\n\t\t<section\n\t\t\tdata-transparent=\"true\"\n\t\t\tdata-overrides-lucide-icons=\"true\"\n\t\t\tdata-expanded={dataAttribute(expanded)}\n\t\t\tdata-small-screen={dataAttribute(isSmallScreen)}\n\t\t\tclassName={className(null)}\n\t\t>\n\t\t\t<div ref={devBarContentRef} className={className('content')}>\n\t\t\t\t<div\n\t\t\t\t\tdata-expanded={true}\n\t\t\t\t\tid={id}\n\t\t\t\t\trole=\"dialog\"\n\t\t\t\t\tstyle={{ display: 'contents' }}\n\t\t\t\t>\n\t\t\t\t\t<div className={className('panels')}>\n\t\t\t\t\t\t{children}\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</section>\n\t)\n}\n\ninterface DevPanelProps {\n\ticon: ReactNode\n\theading: ReactNode\n\tchildren: ReactNode\n\tpreview?: ReactNode\n}\n\nexport const DevPanel = ({ heading, icon, children, preview }: DevPanelProps) => {\n\tconst id = `cui-devBar-panel-${useId()}`\n\tconst dialogRef = useRef<HTMLDialogElement>(null)\n\tconst triggerRef = useRef<HTMLButtonElement>(null)\n\n\tconst handleOpen = useCallback(() => {\n\t\tdialogRef.current?.showModal()\n\t}, [])\n\n\tconst handleClose = useCallback(() => {\n\t\tdialogRef.current?.close()\n\t}, [])\n\n\tuseEffect(() => {\n\t\tconst dialog = dialogRef.current\n\t\tif (!dialog) return\n\n\t\tconst handleClickOutside = (event: MouseEvent) => {\n\t\t\tconst rect = dialog.getBoundingClientRect()\n\t\t\tconst isInDialog = rect.top <= event.clientY\n\t\t\t\t&& event.clientY <= rect.top + rect.height\n\t\t\t\t&& rect.left <= event.clientX\n\t\t\t\t&& event.clientX <= rect.left + rect.width\n\n\t\t\tif (!isInDialog) {\n\t\t\t\tdialog.close()\n\t\t\t}\n\t\t}\n\n\t\tdialog.addEventListener('click', handleClickOutside)\n\t\treturn () => dialog.removeEventListener('click', handleClickOutside)\n\t}, [])\n\n\tuseEffect(() => {\n\t\tconst handleEscape = (event: KeyboardEvent) => {\n\t\t\tif (event.key === 'Escape') {\n\t\t\t\thandleClose()\n\t\t\t}\n\t\t}\n\n\t\tdocument.addEventListener('keydown', handleEscape)\n\t\treturn () => document.removeEventListener('keydown', handleEscape)\n\t}, [handleClose])\n\n\treturn (\n\t\t<div className={className('trigger')}>\n\t\t\t<button\n\t\t\t\ttype=\"button\"\n\t\t\t\tref={triggerRef}\n\t\t\t\ttabIndex={0}\n\t\t\t\taria-haspopup=\"dialog\"\n\t\t\t\taria-controls={id}\n\t\t\t\tclassName={className('trigger-label')}\n\t\t\t\tonClick={handleOpen}\n\t\t\t>\n\t\t\t\t{icon}\n\t\t\t\t<span className={className('trigger-label-text')}>\n\t\t\t\t\t{preview ?? heading}\n\t\t\t\t</span>\n\t\t\t</button>\n\n\t\t\t<dialog ref={dialogRef} id={id} className={className('panel')}>\n\t\t\t\t<div className={className('panel-content')}>\n\t\t\t\t\t<div className={className('panel-header')}>\n\t\t\t\t\t\t<h2 className=\"h4\">{heading}</h2>\n\t\t\t\t\t\t<button\n\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\tonClick={handleClose}\n\t\t\t\t\t\t\tclassName={className('close-button')}\n\t\t\t\t\t\t\taria-label=\"Close\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t✕\n\t\t\t\t\t\t</button>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div className={className('panel-body')}>\n\t\t\t\t\t\t{children}\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</dialog>\n\t\t</div>\n\t)\n}\n"],"names":["useState","useWindowSize","useReferentiallyStableCallback","expanded","useEffect","useRef","useOnElementClickOutsideCallback","useId","jsx","dataAttribute","useCallback","jsxs"],"mappings":";;;;;;AAIA,MAAM,YAA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AAAA,MAAC;AAAA,MAAA;AAAA,QACA,MAAK;AAAA,QACL,KAAK;AAAA,QACL,UAAU;AAAA,QACV,iBAAc;AAAA,QACd,iBAAe;AAAA,QACf,WAAW,UAAU,eAAe;AAAA,QACpC,SAAS;AAAA,QAER,UAAA;AAAA,UAAA;AAAA,yCACA,QAAA,EAAK,WAAW,UAAU,oBAAoB,GAC7C,qBAAW,QAAA,CACb;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,IAGDH,2BAAAA,IAAC,UAAA,EAAO,KAAK,WAAW,IAAQ,WAAW,UAAU,OAAO,GAC3D,UAAAG,2BAAAA,KAAC,OAAA,EAAI,WAAW,UAAU,eAAe,GACxC,UAAA;AAAA,MAAAA,2BAAAA,KAAC,OAAA,EAAI,WAAW,UAAU,cAAc,GACvC,UAAA;AAAA,QAAAH,2BAAAA,IAAC,MAAA,EAAG,WAAU,MAAM,UAAA,SAAQ;AAAA,QAC5BA,2BAAAA;AAAAA,UAAC;AAAA,UAAA;AAAA,YACA,MAAK;AAAA,YACL,SAAS;AAAA,YACT,WAAW,UAAU,cAAc;AAAA,YACnC,cAAW;AAAA,YACX,UAAA;AAAA,UAAA;AAAA,QAAA;AAAA,MAED,GACD;AAAA,qCACC,OAAA,EAAI,WAAW,UAAU,YAAY,GACpC,SAAA,CACF;AAAA,IAAA,EAAA,CACD,EAAA,CACD;AAAA,EAAA,GACD;AAEF;;;"}
@@ -87,6 +87,7 @@ const DevPanel = ({ heading, icon, children, preview }) => {
87
87
  /* @__PURE__ */ jsxs(
88
88
  "button",
89
89
  {
90
+ type: "button",
90
91
  ref: triggerRef,
91
92
  tabIndex: 0,
92
93
  "aria-haspopup": "dialog",
@@ -105,6 +106,7 @@ const DevPanel = ({ heading, icon, children, preview }) => {
105
106
  /* @__PURE__ */ jsx(
106
107
  "button",
107
108
  {
109
+ type: "button",
108
110
  onClick: handleClose,
109
111
  className: className("close-button"),
110
112
  "aria-label": "Close",
@@ -1 +1 @@
1
- {"version":3,"file":"DevBar.js","sources":["../../../../../../packages/react-devbar/src/ui/DevBar/DevBar.tsx"],"sourcesContent":["import {\n\tuseId,\n\tuseOnElementClickOutsideCallback,\n\tuseReferentiallyStableCallback,\n\tuseWindowSize,\n} from '@contember/react-utils'\nimport { dataAttribute } from '@contember/utilities'\nimport { PropsWithChildren, ReactNode, useCallback, useEffect, useRef, useState } from 'react'\n\nconst className = (cls: string | null) => cls ? `cui-devBar-${cls}` : 'cui-devBar'\n\nexport const DevBar = ({\n\tbreakpoint = 768,\n\tchildren,\n}: PropsWithChildren<{\n\tbreakpoint?: number\n}>) => {\n\tconst [expanded, setExpanded] = useState(false)\n\tconst isSmallScreen = useWindowSize().width < breakpoint\n\n\tconst handleToggle = useReferentiallyStableCallback(() => {\n\t\tsetExpanded(expanded => !expanded)\n\t})\n\n\tuseEffect(() => {\n\t\tfunction handleKeyDown(event: KeyboardEvent) {\n\t\t\tif (event.code === 'KeyJ' && (event.ctrlKey || event.metaKey)) {\n\t\t\t\tevent.preventDefault()\n\t\t\t\tevent.stopPropagation()\n\n\t\t\t\thandleToggle()\n\t\t\t}\n\t\t}\n\n\t\tdocument.addEventListener('keydown', handleKeyDown)\n\t\treturn () => document.removeEventListener('keydown', handleKeyDown)\n\t}, [expanded, handleToggle])\n\n\tconst devBarContentRef = useRef<HTMLDivElement>(null)\n\n\tuseOnElementClickOutsideCallback(devBarContentRef, () => {\n\t\tif (expanded) {\n\t\t\tsetExpanded(false)\n\t\t}\n\t})\n\n\tconst id = `dev-bar-panel${useId()}`\n\n\treturn (\n\t\t<section\n\t\t\tdata-transparent=\"true\"\n\t\t\tdata-overrides-lucide-icons=\"true\"\n\t\t\tdata-expanded={dataAttribute(expanded)}\n\t\t\tdata-small-screen={dataAttribute(isSmallScreen)}\n\t\t\tclassName={className(null)}\n\t\t>\n\t\t\t<div ref={devBarContentRef} className={className('content')}>\n\t\t\t\t<div\n\t\t\t\t\tdata-expanded={true}\n\t\t\t\t\tid={id}\n\t\t\t\t\trole=\"dialog\"\n\t\t\t\t\tstyle={{ display: 'contents' }}\n\t\t\t\t>\n\t\t\t\t\t<div className={className('panels')}>\n\t\t\t\t\t\t{children}\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</section>\n\t)\n}\n\ninterface DevPanelProps {\n\ticon: ReactNode\n\theading: ReactNode\n\tchildren: ReactNode\n\tpreview?: ReactNode\n}\n\nexport const DevPanel = ({ heading, icon, children, preview }: DevPanelProps) => {\n\tconst id = `cui-devBar-panel-${useId()}`\n\tconst dialogRef = useRef<HTMLDialogElement>(null)\n\tconst triggerRef = useRef<HTMLButtonElement>(null)\n\n\tconst handleOpen = useCallback(() => {\n\t\tdialogRef.current?.showModal()\n\t}, [])\n\n\tconst handleClose = useCallback(() => {\n\t\tdialogRef.current?.close()\n\t}, [])\n\n\tuseEffect(() => {\n\t\tconst dialog = dialogRef.current\n\t\tif (!dialog) return\n\n\t\tconst handleClickOutside = (event: MouseEvent) => {\n\t\t\tconst rect = dialog.getBoundingClientRect()\n\t\t\tconst isInDialog = (\n\t\t\t\trect.top <= event.clientY &&\n\t\t\t\tevent.clientY <= rect.top + rect.height &&\n\t\t\t\trect.left <= event.clientX &&\n\t\t\t\tevent.clientX <= rect.left + rect.width\n\t\t\t)\n\n\t\t\tif (!isInDialog) {\n\t\t\t\tdialog.close()\n\t\t\t}\n\t\t}\n\n\t\tdialog.addEventListener('click', handleClickOutside)\n\t\treturn () => dialog.removeEventListener('click', handleClickOutside)\n\t}, [])\n\n\tuseEffect(() => {\n\t\tconst handleEscape = (event: KeyboardEvent) => {\n\t\t\tif (event.key === 'Escape') {\n\t\t\t\thandleClose()\n\t\t\t}\n\t\t}\n\n\t\tdocument.addEventListener('keydown', handleEscape)\n\t\treturn () => document.removeEventListener('keydown', handleEscape)\n\t}, [handleClose])\n\n\treturn (\n\t\t<div className={className('trigger')}>\n\t\t\t<button\n\t\t\t\tref={triggerRef}\n\t\t\t\ttabIndex={0}\n\t\t\t\taria-haspopup=\"dialog\"\n\t\t\t\taria-controls={id}\n\t\t\t\tclassName={className('trigger-label')}\n\t\t\t\tonClick={handleOpen}\n\t\t\t>\n\t\t\t\t{icon}\n\t\t\t\t<span className={className('trigger-label-text')}>\n\t\t\t\t\t{preview ?? heading}\n\t\t\t\t</span>\n\t\t\t</button>\n\n\t\t\t<dialog ref={dialogRef} id={id} className={className('panel')}>\n\t\t\t\t<div className={className('panel-content')}>\n\t\t\t\t\t<div className={className('panel-header')}>\n\t\t\t\t\t\t<h2 className=\"h4\">{heading}</h2>\n\t\t\t\t\t\t<button\n\t\t\t\t\t\t\tonClick={handleClose}\n\t\t\t\t\t\t\tclassName={className('close-button')}\n\t\t\t\t\t\t\taria-label=\"Close\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t✕\n\t\t\t\t\t\t</button>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div className={className('panel-body')}>\n\t\t\t\t\t\t{children}\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</dialog>\n\t\t</div>\n\t)\n}\n"],"names":["expanded"],"mappings":";;;;AASA,MAAM,YAAY,CAAC,QAAuB,MAAM,cAAc,GAAG,KAAK;AAE/D,MAAM,SAAS,CAAC;AAAA,EACtB,aAAa;AAAA,EACb;AACD,MAEO;AACN,QAAM,CAAC,UAAU,WAAW,IAAI,SAAS,KAAK;AACxC,QAAA,gBAAgB,gBAAgB,QAAQ;AAExC,QAAA,eAAe,+BAA+B,MAAM;AAC7C,gBAAA,CAAAA,cAAY,CAACA,SAAQ;AAAA,EAAA,CACjC;AAED,YAAU,MAAM;AACf,aAAS,cAAc,OAAsB;AAC5C,UAAI,MAAM,SAAS,WAAW,MAAM,WAAW,MAAM,UAAU;AAC9D,cAAM,eAAe;AACrB,cAAM,gBAAgB;AAET,qBAAA;AAAA,MAAA;AAAA,IACd;AAGQ,aAAA,iBAAiB,WAAW,aAAa;AAClD,WAAO,MAAM,SAAS,oBAAoB,WAAW,aAAa;AA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AAW,UAAU,YAAY,GACpC,SACF,CAAA;AAAA,IAAA,EAAA,CACD,EACD,CAAA;AAAA,EAAA,GACD;AAEF;"}
1
+ {"version":3,"file":"DevBar.js","sources":["../../../../../../packages/react-devbar/src/ui/DevBar/DevBar.tsx"],"sourcesContent":["import { useId, useOnElementClickOutsideCallback, useReferentiallyStableCallback, useWindowSize } from '@contember/react-utils'\nimport { dataAttribute } from '@contember/utilities'\nimport { type PropsWithChildren, type ReactNode, useCallback, useEffect, useRef, useState } from 'react'\n\nconst className = (cls: string | null) => cls ? `cui-devBar-${cls}` : 'cui-devBar'\n\nexport const DevBar = ({\n\tbreakpoint = 768,\n\tchildren,\n}: PropsWithChildren<{\n\tbreakpoint?: number\n}>) => {\n\tconst [expanded, setExpanded] = useState(false)\n\tconst isSmallScreen = useWindowSize().width < breakpoint\n\n\tconst handleToggle = useReferentiallyStableCallback(() => {\n\t\tsetExpanded(expanded => !expanded)\n\t})\n\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: intentional\n\tuseEffect(() => {\n\t\tfunction handleKeyDown(event: KeyboardEvent) {\n\t\t\tif (event.code === 'KeyJ' && (event.ctrlKey || event.metaKey)) {\n\t\t\t\tevent.preventDefault()\n\t\t\t\tevent.stopPropagation()\n\n\t\t\t\thandleToggle()\n\t\t\t}\n\t\t}\n\n\t\tdocument.addEventListener('keydown', handleKeyDown)\n\t\treturn () => document.removeEventListener('keydown', handleKeyDown)\n\t}, [expanded, handleToggle])\n\n\tconst devBarContentRef = useRef<HTMLDivElement>(null)\n\n\tuseOnElementClickOutsideCallback(devBarContentRef, () => {\n\t\tif (expanded) {\n\t\t\tsetExpanded(false)\n\t\t}\n\t})\n\n\tconst id = `dev-bar-panel${useId()}`\n\n\treturn (\n\t\t<section\n\t\t\tdata-transparent=\"true\"\n\t\t\tdata-overrides-lucide-icons=\"true\"\n\t\t\tdata-expanded={dataAttribute(expanded)}\n\t\t\tdata-small-screen={dataAttribute(isSmallScreen)}\n\t\t\tclassName={className(null)}\n\t\t>\n\t\t\t<div ref={devBarContentRef} className={className('content')}>\n\t\t\t\t<div\n\t\t\t\t\tdata-expanded={true}\n\t\t\t\t\tid={id}\n\t\t\t\t\trole=\"dialog\"\n\t\t\t\t\tstyle={{ display: 'contents' }}\n\t\t\t\t>\n\t\t\t\t\t<div className={className('panels')}>\n\t\t\t\t\t\t{children}\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</section>\n\t)\n}\n\ninterface DevPanelProps {\n\ticon: ReactNode\n\theading: ReactNode\n\tchildren: ReactNode\n\tpreview?: ReactNode\n}\n\nexport const DevPanel = ({ heading, icon, children, preview }: DevPanelProps) => {\n\tconst id = `cui-devBar-panel-${useId()}`\n\tconst dialogRef = useRef<HTMLDialogElement>(null)\n\tconst triggerRef = useRef<HTMLButtonElement>(null)\n\n\tconst handleOpen = useCallback(() => {\n\t\tdialogRef.current?.showModal()\n\t}, [])\n\n\tconst handleClose = useCallback(() => {\n\t\tdialogRef.current?.close()\n\t}, [])\n\n\tuseEffect(() => {\n\t\tconst dialog = dialogRef.current\n\t\tif (!dialog) return\n\n\t\tconst handleClickOutside = (event: MouseEvent) => {\n\t\t\tconst rect = dialog.getBoundingClientRect()\n\t\t\tconst isInDialog = rect.top <= event.clientY\n\t\t\t\t&& event.clientY <= rect.top + rect.height\n\t\t\t\t&& rect.left <= event.clientX\n\t\t\t\t&& event.clientX <= rect.left + rect.width\n\n\t\t\tif (!isInDialog) {\n\t\t\t\tdialog.close()\n\t\t\t}\n\t\t}\n\n\t\tdialog.addEventListener('click', handleClickOutside)\n\t\treturn () => dialog.removeEventListener('click', handleClickOutside)\n\t}, [])\n\n\tuseEffect(() => {\n\t\tconst handleEscape = (event: KeyboardEvent) => {\n\t\t\tif (event.key === 'Escape') {\n\t\t\t\thandleClose()\n\t\t\t}\n\t\t}\n\n\t\tdocument.addEventListener('keydown', handleEscape)\n\t\treturn () => document.removeEventListener('keydown', handleEscape)\n\t}, [handleClose])\n\n\treturn (\n\t\t<div className={className('trigger')}>\n\t\t\t<button\n\t\t\t\ttype=\"button\"\n\t\t\t\tref={triggerRef}\n\t\t\t\ttabIndex={0}\n\t\t\t\taria-haspopup=\"dialog\"\n\t\t\t\taria-controls={id}\n\t\t\t\tclassName={className('trigger-label')}\n\t\t\t\tonClick={handleOpen}\n\t\t\t>\n\t\t\t\t{icon}\n\t\t\t\t<span className={className('trigger-label-text')}>\n\t\t\t\t\t{preview ?? heading}\n\t\t\t\t</span>\n\t\t\t</button>\n\n\t\t\t<dialog ref={dialogRef} id={id} className={className('panel')}>\n\t\t\t\t<div className={className('panel-content')}>\n\t\t\t\t\t<div className={className('panel-header')}>\n\t\t\t\t\t\t<h2 className=\"h4\">{heading}</h2>\n\t\t\t\t\t\t<button\n\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\tonClick={handleClose}\n\t\t\t\t\t\t\tclassName={className('close-button')}\n\t\t\t\t\t\t\taria-label=\"Close\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t✕\n\t\t\t\t\t\t</button>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div className={className('panel-body')}>\n\t\t\t\t\t\t{children}\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</dialog>\n\t\t</div>\n\t)\n}\n"],"names":["expanded"],"mappings":";;;;AAIA,MAAM,YAAY,CAAC,QAAuB,MAAM,cAAc,GAAG,KAAK;AAE/D,MAAM,SAAS,CAAC;AAAA,EACtB,aAAa;AAAA,EACb;AACD,MAEO;AACN,QAAM,CAAC,UAAU,WAAW,IAAI,SAAS,KAAK;AAC9C,QAAM,gBAAgB,gBAAgB,QAAQ;AAE9C,QAAM,eAAe,+BAA+B,MAAM;AACzD,gBAAY,CAAAA,cAAY,CAACA,SAAQ;AAAA,EAClC,CAAC;AAGD,YAAU,MAAM;AACf,aAAS,cAAc,OAAsB;AAC5C,UAAI,MAAM,SAAS,WAAW,MAAM,WAAW,MAAM,UAAU;AAC9D,c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,UAAC;AAAA,UAAA;AAAA,YACA,MAAK;AAAA,YACL,SAAS;AAAA,YACT,WAAW,UAAU,cAAc;AAAA,YACnC,cAAW;AAAA,YACX,UAAA;AAAA,UAAA;AAAA,QAAA;AAAA,MAED,GACD;AAAA,0BACC,OAAA,EAAI,WAAW,UAAU,YAAY,GACpC,SAAA,CACF;AAAA,IAAA,EAAA,CACD,EAAA,CACD;AAAA,EAAA,GACD;AAEF;"}
@@ -1 +1 @@
1
- {"version":3,"file":"DevError.cjs","sources":["../../../../../../packages/react-devbar/src/ui/DevError/DevError.tsx"],"sourcesContent":["import { DevErrorInner, DevErrorInnerProps } from './DevErrorInner'\n\nexport interface DevErrorProps extends DevErrorInnerProps {\n\tsource: string\n}\n\nconst className = (cls?: string | null) => cls ? `cui-devError-${cls}` : 'cui-devError'\n\nexport function DevError(props: DevErrorProps) {\n\treturn (\n\t\t<div className={className()}>\n\t\t\t<div className={className('in')}>\n\t\t\t\t<div className={className('bar')}>\n\t\t\t\t\t<div className={className('errorSource')}>{props.source}</div>\n\t\t\t\t</div>\n\t\t\t\t<DevErrorInner error={props.error} />\n\t\t\t</div>\n\t\t</div>\n\t)\n}\n"],"names":["jsx","DevErrorInner"],"mappings":";;;;AAMA,MAAM,YAAY,CAAC,QAAwB,MAAM,gBAAgB,GAAG,KAAK;AAElE,SAAS,SAAS,OAAsB;AAE7C,SAAAA,2BAAA,IAAC,OAAI,EAAA,WAAW,UAAU,GACzB,0CAAC,OAAI,EAAA,WAAW,UAAU,IAAI,GAC7B,UAAA;AAAA,IAAAA,2BAAA,IAAC,OAAI,EAAA,WAAW,UAAU,KAAK,GAC9B,UAAAA,+BAAC,OAAI,EAAA,WAAW,UAAU,aAAa,GAAI,UAAA,MAAM,OAAO,CAAA,GACzD;AAAA,IACCA,2BAAAA,IAAAC,cAAAA,eAAA,EAAc,OAAO,MAAM,MAAO,CAAA;AAAA,EAAA,EAAA,CACpC,EACD,CAAA;AAEF;;"}
1
+ {"version":3,"file":"DevError.cjs","sources":["../../../../../../packages/react-devbar/src/ui/DevError/DevError.tsx"],"sourcesContent":["import { DevErrorInner, DevErrorInnerProps } from './DevErrorInner'\n\nexport interface DevErrorProps extends DevErrorInnerProps {\n\tsource: string\n}\n\nconst className = (cls?: string | null) => cls ? `cui-devError-${cls}` : 'cui-devError'\n\nexport function DevError(props: DevErrorProps) {\n\treturn (\n\t\t<div className={className()}>\n\t\t\t<div className={className('in')}>\n\t\t\t\t<div className={className('bar')}>\n\t\t\t\t\t<div className={className('errorSource')}>{props.source}</div>\n\t\t\t\t</div>\n\t\t\t\t<DevErrorInner error={props.error} />\n\t\t\t</div>\n\t\t</div>\n\t)\n}\n"],"names":["jsx","DevErrorInner"],"mappings":";;;;AAMA,MAAM,YAAY,CAAC,QAAwB,MAAM,gBAAgB,GAAG,KAAK;AAElE,SAAS,SAAS,OAAsB;AAC9C,SACCA,2BAAAA,IAAC,OAAA,EAAI,WAAW,UAAA,GACf,0CAAC,OAAA,EAAI,WAAW,UAAU,IAAI,GAC7B,UAAA;AAAA,IAAAA,2BAAAA,IAAC,OAAA,EAAI,WAAW,UAAU,KAAK,GAC9B,UAAAA,+BAAC,OAAA,EAAI,WAAW,UAAU,aAAa,GAAI,UAAA,MAAM,QAAO,GACzD;AAAA,IACAA,2BAAAA,IAACC,cAAAA,eAAA,EAAc,OAAO,MAAM,MAAA,CAAO;AAAA,EAAA,EAAA,CACpC,EAAA,CACD;AAEF;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"DevError.js","sources":["../../../../../../packages/react-devbar/src/ui/DevError/DevError.tsx"],"sourcesContent":["import { DevErrorInner, DevErrorInnerProps } from './DevErrorInner'\n\nexport interface DevErrorProps extends DevErrorInnerProps {\n\tsource: string\n}\n\nconst className = (cls?: string | null) => cls ? `cui-devError-${cls}` : 'cui-devError'\n\nexport function DevError(props: DevErrorProps) {\n\treturn (\n\t\t<div className={className()}>\n\t\t\t<div className={className('in')}>\n\t\t\t\t<div className={className('bar')}>\n\t\t\t\t\t<div className={className('errorSource')}>{props.source}</div>\n\t\t\t\t</div>\n\t\t\t\t<DevErrorInner error={props.error} />\n\t\t\t</div>\n\t\t</div>\n\t)\n}\n"],"names":[],"mappings":";;AAMA,MAAM,YAAY,CAAC,QAAwB,MAAM,gBAAgB,GAAG,KAAK;AAElE,SAAS,SAAS,OAAsB;AAE7C,SAAA,oBAAC,OAAI,EAAA,WAAW,UAAU,GACzB,+BAAC,OAAI,EAAA,WAAW,UAAU,IAAI,GAC7B,UAAA;AAAA,IAAA,oBAAC,OAAI,EAAA,WAAW,UAAU,KAAK,GAC9B,UAAA,oBAAC,OAAI,EAAA,WAAW,UAAU,aAAa,GAAI,UAAA,MAAM,OAAO,CAAA,GACzD;AAAA,IACC,oBAAA,eAAA,EAAc,OAAO,MAAM,MAAO,CAAA;AAAA,EAAA,EAAA,CACpC,EACD,CAAA;AAEF;"}
1
+ {"version":3,"file":"DevError.js","sources":["../../../../../../packages/react-devbar/src/ui/DevError/DevError.tsx"],"sourcesContent":["import { DevErrorInner, DevErrorInnerProps } from './DevErrorInner'\n\nexport interface DevErrorProps extends DevErrorInnerProps {\n\tsource: string\n}\n\nconst className = (cls?: string | null) => cls ? `cui-devError-${cls}` : 'cui-devError'\n\nexport function DevError(props: DevErrorProps) {\n\treturn (\n\t\t<div className={className()}>\n\t\t\t<div className={className('in')}>\n\t\t\t\t<div className={className('bar')}>\n\t\t\t\t\t<div className={className('errorSource')}>{props.source}</div>\n\t\t\t\t</div>\n\t\t\t\t<DevErrorInner error={props.error} />\n\t\t\t</div>\n\t\t</div>\n\t)\n}\n"],"names":[],"mappings":";;AAMA,MAAM,YAAY,CAAC,QAAwB,MAAM,gBAAgB,GAAG,KAAK;AAElE,SAAS,SAAS,OAAsB;AAC9C,SACC,oBAAC,OAAA,EAAI,WAAW,UAAA,GACf,+BAAC,OAAA,EAAI,WAAW,UAAU,IAAI,GAC7B,UAAA;AAAA,IAAA,oBAAC,OAAA,EAAI,WAAW,UAAU,KAAK,GAC9B,UAAA,oBAAC,OAAA,EAAI,WAAW,UAAU,aAAa,GAAI,UAAA,MAAM,QAAO,GACzD;AAAA,IACA,oBAAC,eAAA,EAAc,OAAO,MAAM,MAAA,CAAO;AAAA,EAAA,EAAA,CACpC,EAAA,CACD;AAEF;"}
@@ -1 +1 @@
1
- {"version":3,"file":"DevErrorBadge.cjs","sources":["../../../../../../packages/react-devbar/src/ui/DevError/DevErrorBadge.tsx"],"sourcesContent":["export interface DevErrorBadgeProps {\n\tonOpen: () => void\n\tonClear: () => void\n\terrorCount: number\n}\n\n\nconst className = (cls?: string | null) => cls ? `cui-devErrorBadge-${cls}` : 'cui-devErrorBadge'\n\nexport function DevErrorBadge({ errorCount, onOpen, onClear }: DevErrorBadgeProps) {\n\treturn (\n\t\t<div className={className()}>\n\t\t\t<a className={className('button')} onClick={onOpen}>\n\t\t\t\t{errorCount} {errorCount > 1 ? 'errors' : 'error'}\n\t\t\t</a>\n\t\t</div>\n\t)\n}\n"],"names":["jsx","jsxs"],"mappings":";;;AAOA,MAAM,YAAY,CAAC,QAAwB,MAAM,qBAAqB,GAAG,KAAK;AAEvE,SAAS,cAAc,EAAE,YAAY,QAAQ,WAA+B;AAClF,SACEA,2BAAAA,IAAA,OAAA,EAAI,WAAW,UAAA,GACf,UAAAC,2BAAA,KAAC,KAAE,EAAA,WAAW,UAAU,QAAQ,GAAG,SAAS,QAC1C,UAAA;AAAA,IAAA;AAAA,IAAW;AAAA,IAAE,aAAa,IAAI,WAAW;AAAA,EAAA,EAAA,CAC3C,EACD,CAAA;AAEF;;"}
1
+ {"version":3,"file":"DevErrorBadge.cjs","sources":["../../../../../../packages/react-devbar/src/ui/DevError/DevErrorBadge.tsx"],"sourcesContent":["export interface DevErrorBadgeProps {\n\tonOpen: () => void\n\tonClear: () => void\n\terrorCount: number\n}\n\nconst className = (cls?: string | null) => cls ? `cui-devErrorBadge-${cls}` : 'cui-devErrorBadge'\n\nexport function DevErrorBadge({ errorCount, onOpen, onClear }: DevErrorBadgeProps) {\n\treturn (\n\t\t<div className={className()}>\n\t\t\t<a className={className('button')} onClick={onOpen}>\n\t\t\t\t{errorCount} {errorCount > 1 ? 'errors' : 'error'}\n\t\t\t</a>\n\t\t</div>\n\t)\n}\n"],"names":["jsx","jsxs"],"mappings":";;;AAMA,MAAM,YAAY,CAAC,QAAwB,MAAM,qBAAqB,GAAG,KAAK;AAEvE,SAAS,cAAc,EAAE,YAAY,QAAQ,WAA+B;AAClF,SACCA,2BAAAA,IAAC,OAAA,EAAI,WAAW,UAAA,GACf,UAAAC,2BAAAA,KAAC,KAAA,EAAE,WAAW,UAAU,QAAQ,GAAG,SAAS,QAC1C,UAAA;AAAA,IAAA;AAAA,IAAW;AAAA,IAAE,aAAa,IAAI,WAAW;AAAA,EAAA,EAAA,CAC3C,EAAA,CACD;AAEF;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"DevErrorBadge.js","sources":["../../../../../../packages/react-devbar/src/ui/DevError/DevErrorBadge.tsx"],"sourcesContent":["export interface DevErrorBadgeProps {\n\tonOpen: () => void\n\tonClear: () => void\n\terrorCount: number\n}\n\n\nconst className = (cls?: string | null) => cls ? `cui-devErrorBadge-${cls}` : 'cui-devErrorBadge'\n\nexport function DevErrorBadge({ errorCount, onOpen, onClear }: DevErrorBadgeProps) {\n\treturn (\n\t\t<div className={className()}>\n\t\t\t<a className={className('button')} onClick={onOpen}>\n\t\t\t\t{errorCount} {errorCount > 1 ? 'errors' : 'error'}\n\t\t\t</a>\n\t\t</div>\n\t)\n}\n"],"names":[],"mappings":";AAOA,MAAM,YAAY,CAAC,QAAwB,MAAM,qBAAqB,GAAG,KAAK;AAEvE,SAAS,cAAc,EAAE,YAAY,QAAQ,WAA+B;AAClF,SACE,oBAAA,OAAA,EAAI,WAAW,UAAA,GACf,UAAA,qBAAC,KAAE,EAAA,WAAW,UAAU,QAAQ,GAAG,SAAS,QAC1C,UAAA;AAAA,IAAA;AAAA,IAAW;AAAA,IAAE,aAAa,IAAI,WAAW;AAAA,EAAA,EAAA,CAC3C,EACD,CAAA;AAEF;"}
1
+ {"version":3,"file":"DevErrorBadge.js","sources":["../../../../../../packages/react-devbar/src/ui/DevError/DevErrorBadge.tsx"],"sourcesContent":["export interface DevErrorBadgeProps {\n\tonOpen: () => void\n\tonClear: () => void\n\terrorCount: number\n}\n\nconst className = (cls?: string | null) => cls ? `cui-devErrorBadge-${cls}` : 'cui-devErrorBadge'\n\nexport function DevErrorBadge({ errorCount, onOpen, onClear }: DevErrorBadgeProps) {\n\treturn (\n\t\t<div className={className()}>\n\t\t\t<a className={className('button')} onClick={onOpen}>\n\t\t\t\t{errorCount} {errorCount > 1 ? 'errors' : 'error'}\n\t\t\t</a>\n\t\t</div>\n\t)\n}\n"],"names":[],"mappings":";AAMA,MAAM,YAAY,CAAC,QAAwB,MAAM,qBAAqB,GAAG,KAAK;AAEvE,SAAS,cAAc,EAAE,YAAY,QAAQ,WAA+B;AAClF,SACC,oBAAC,OAAA,EAAI,WAAW,UAAA,GACf,UAAA,qBAAC,KAAA,EAAE,WAAW,UAAU,QAAQ,GAAG,SAAS,QAC1C,UAAA;AAAA,IAAA;AAAA,IAAW;AAAA,IAAE,aAAa,IAAI,WAAW;AAAA,EAAA,EAAA,CAC3C,EAAA,CACD;AAEF;"}
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const jsxRuntime = require("react/jsx-runtime");
4
+ const useCopyErrorMarkdown = require("../../hooks/useCopyErrorMarkdown.cjs");
5
+ const DevErrorCopy = ({ currentError, currentErrorSource }) => {
6
+ const { copyStatus, handleCopyMarkdown, isClipboardSupported } = useCopyErrorMarkdown.useCopyErrorMarkdown({ currentError, currentErrorSource });
7
+ if (!isClipboardSupported) {
8
+ return null;
9
+ }
10
+ return /* @__PURE__ */ jsxRuntime.jsx(
11
+ "button",
12
+ {
13
+ type: "button",
14
+ className: "cui-devError-copyButton",
15
+ onClick: handleCopyMarkdown,
16
+ disabled: copyStatus === "copying",
17
+ title: "Copy current error as Markdown",
18
+ children: {
19
+ success: "Copied!",
20
+ copying: "Copying...",
21
+ error: "❌ Copy Failed",
22
+ idle: "Copy as Markdown"
23
+ }[copyStatus]
24
+ }
25
+ );
26
+ };
27
+ exports.DevErrorCopy = DevErrorCopy;
28
+ //# sourceMappingURL=DevErrorCopy.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DevErrorCopy.cjs","sources":["../../../../../../packages/react-devbar/src/ui/DevError/DevErrorCopy.tsx"],"sourcesContent":["import { useCopyErrorMarkdown } from '../../hooks/useCopyErrorMarkdown'\nimport { ProcessedError } from './types'\n\nexport const DevErrorCopy = ({ currentError, currentErrorSource }: {\n\tcurrentError: ProcessedError\n\tcurrentErrorSource: string\n}) => {\n\tconst { copyStatus, handleCopyMarkdown, isClipboardSupported } = useCopyErrorMarkdown({ currentError, currentErrorSource })\n\n\tif (!isClipboardSupported) {\n\t\treturn null\n\t}\n\n\treturn (\n\t\t<button\n\t\t\ttype=\"button\"\n\t\t\tclassName=\"cui-devError-copyButton\"\n\t\t\tonClick={handleCopyMarkdown}\n\t\t\tdisabled={copyStatus === 'copying'}\n\t\t\ttitle=\"Copy current error as Markdown\"\n\t\t>\n\t\t\t{{\n\t\t\t\tsuccess: 'Copied!',\n\t\t\t\tcopying: 'Copying...',\n\t\t\t\terror: '❌ Copy Failed',\n\t\t\t\tidle: 'Copy as Markdown',\n\t\t\t}[copyStatus]}\n\t\t</button>\n\t)\n}\n"],"names":["useCopyErrorMarkdown","jsx"],"mappings":";;;;AAGO,MAAM,eAAe,CAAC,EAAE,cAAc,yBAGvC;AACL,QAAM,EAAE,YAAY,oBAAoB,qBAAA,IAAyBA,qBAAAA,qBAAqB,EAAE,cAAc,oBAAoB;AAE1H,MAAI,CAAC,sBAAsB;AAC1B,WAAO;AAAA,EACR;AAEA,SACCC,2BAAAA;AAAAA,IAAC;AAAA,IAAA;AAAA,MACA,MAAK;AAAA,MACL,WAAU;AAAA,MACV,SAAS;AAAA,MACT,UAAU,eAAe;AAAA,MACzB,OAAM;AAAA,MAEL,UAAA;AAAA,QACA,SAAS;AAAA,QACT,SAAS;AAAA,QACT,OAAO;AAAA,QACP,MAAM;AAAA,MAAA,EACL,UAAU;AAAA,IAAA;AAAA,EAAA;AAGf;;"}
@@ -0,0 +1,28 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { useCopyErrorMarkdown } from "../../hooks/useCopyErrorMarkdown.js";
3
+ const DevErrorCopy = ({ currentError, currentErrorSource }) => {
4
+ const { copyStatus, handleCopyMarkdown, isClipboardSupported } = useCopyErrorMarkdown({ currentError, currentErrorSource });
5
+ if (!isClipboardSupported) {
6
+ return null;
7
+ }
8
+ return /* @__PURE__ */ jsx(
9
+ "button",
10
+ {
11
+ type: "button",
12
+ className: "cui-devError-copyButton",
13
+ onClick: handleCopyMarkdown,
14
+ disabled: copyStatus === "copying",
15
+ title: "Copy current error as Markdown",
16
+ children: {
17
+ success: "Copied!",
18
+ copying: "Copying...",
19
+ error: "❌ Copy Failed",
20
+ idle: "Copy as Markdown"
21
+ }[copyStatus]
22
+ }
23
+ );
24
+ };
25
+ export {
26
+ DevErrorCopy
27
+ };
28
+ //# sourceMappingURL=DevErrorCopy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DevErrorCopy.js","sources":["../../../../../../packages/react-devbar/src/ui/DevError/DevErrorCopy.tsx"],"sourcesContent":["import { useCopyErrorMarkdown } from '../../hooks/useCopyErrorMarkdown'\nimport { ProcessedError } from './types'\n\nexport const DevErrorCopy = ({ currentError, currentErrorSource }: {\n\tcurrentError: ProcessedError\n\tcurrentErrorSource: string\n}) => {\n\tconst { copyStatus, handleCopyMarkdown, isClipboardSupported } = useCopyErrorMarkdown({ currentError, currentErrorSource })\n\n\tif (!isClipboardSupported) {\n\t\treturn null\n\t}\n\n\treturn (\n\t\t<button\n\t\t\ttype=\"button\"\n\t\t\tclassName=\"cui-devError-copyButton\"\n\t\t\tonClick={handleCopyMarkdown}\n\t\t\tdisabled={copyStatus === 'copying'}\n\t\t\ttitle=\"Copy current error as Markdown\"\n\t\t>\n\t\t\t{{\n\t\t\t\tsuccess: 'Copied!',\n\t\t\t\tcopying: 'Copying...',\n\t\t\t\terror: '❌ Copy Failed',\n\t\t\t\tidle: 'Copy as Markdown',\n\t\t\t}[copyStatus]}\n\t\t</button>\n\t)\n}\n"],"names":[],"mappings":";;AAGO,MAAM,eAAe,CAAC,EAAE,cAAc,yBAGvC;AACL,QAAM,EAAE,YAAY,oBAAoB,qBAAA,IAAyB,qBAAqB,EAAE,cAAc,oBAAoB;AAE1H,MAAI,CAAC,sBAAsB;AAC1B,WAAO;AAAA,EACR;AAEA,SACC;AAAA,IAAC;AAAA,IAAA;AAAA,MACA,MAAK;AAAA,MACL,WAAU;AAAA,MACV,SAAS;AAAA,MACT,UAAU,eAAe;AAAA,MACzB,OAAM;AAAA,MAEL,UAAA;AAAA,QACA,SAAS;AAAA,QACT,SAAS;AAAA,QACT,OAAO;AAAA,QACP,MAAM;AAAA,MAAA,EACL,UAAU;AAAA,IAAA;AAAA,EAAA;AAGf;"}
@@ -1 +1 @@
1
- {"version":3,"file":"DevErrorInner.cjs","sources":["../../../../../../packages/react-devbar/src/ui/DevError/DevErrorInner.tsx"],"sourcesContent":["import { StackTrace } from './StackTrace'\nimport type { ProcessedError } from './types'\n\nexport interface DevErrorInnerProps {\n\terror: ProcessedError\n\tlevel?: number\n}\n\n\nconst className = (cls?: string | null) => cls ? `cui-devError-${cls}` : 'cui-devError'\n\nexport function DevErrorInner({ error, level = 1 }: DevErrorInnerProps) {\n\n\tlet errorObject: Error | undefined = error.error instanceof Error ? error.error : undefined\n\n\treturn (\n\t\t<>\n\t\t\t<div className={className('header')}>\n\t\t\t\t{errorObject ? (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<h1 className={className('errorName')}>{errorObject.name}</h1>\n\t\t\t\t\t\t{error.cause && <a href={`#error-${level}`} className={className('causeLink')}>caused by &gt;</a>}\n\t\t\t\t\t\t{errorObject.message && <h2 className={className('errorMessage')}>{errorObject.message}</h2>}\n\t\t\t\t\t\t{'details' in errorObject && <div className={className('errorDetails')}>{(errorObject as any).details}</div>}\n\t\t\t\t\t</>\n\t\t\t\t) : (\n\t\t\t\t\t<h1 className={className('errorName')}>Unknown error</h1>\n\t\t\t\t)}\n\t\t\t</div>\n\t\t\t{error.parsedStackStrace ? (\n\t\t\t\t<StackTrace stackTrace={error.parsedStackStrace} />\n\t\t\t) : errorObject?.stack ? (\n\t\t\t\t<div className={className('stack')}>\n\t\t\t\t\t<div className={className('stack-dump')}>{errorObject.stack}</div>\n\t\t\t\t</div>\n\t\t\t) : null}\n\t\t\t{error.cause ? (\n\t\t\t\t<>\n\t\t\t\t\t<div className={className('causedBy')} id={`error-${level}`}>\n\t\t\t\t\t\tCaused by\n\t\t\t\t\t</div>\n\t\t\t\t\t<DevErrorInner error={error.cause} level={level + 1} />\n\t\t\t\t</>\n\t\t\t) : null}\n\t\t</>\n\t)\n}\n"],"names":["jsxs","Fragment","jsx","StackTrace"],"mappings":";;;;AASA,MAAM,YAAY,CAAC,QAAwB,MAAM,gBAAgB,GAAG,KAAK;AAElE,SAAS,cAAc,EAAE,OAAO,QAAQ,KAAyB;AAEvE,MAAI,cAAiC,MAAM,iBAAiB,QAAQ,MAAM,QAAQ;AAElF,SAEEA,2BAAA,KAAAC,qBAAA,EAAA,UAAA;AAAA,IAAAC,2BAAAA,IAAC,SAAI,WAAW,UAAU,QAAQ,GAChC,wBAECF,2BAAAA,KAAAC,WAAA,UAAA,EAAA,UAAA;AAAA,MAAAC,+BAAC,QAAG,WAAW,UAAU,WAAW,GAAI,sBAAY,MAAK;AAAA,MACxD,MAAM,SAAUA,2BAAA,IAAA,KAAA,EAAE,MAAM,UAAU,KAAK,IAAI,WAAW,UAAU,WAAW,GAAG,UAAc,eAAA;AAAA,MAC5F,YAAY,WAAYA,+BAAA,MAAA,EAAG,WAAW,UAAU,cAAc,GAAI,UAAA,YAAY,QAAQ,CAAA;AAAA,MACtF,aAAa,eAAgBA,+BAAA,OAAA,EAAI,WAAW,UAAU,cAAc,GAAK,UAAA,YAAoB,QAAQ,CAAA;AAAA,IACvG,EAAA,CAAA,mCAEC,MAAG,EAAA,WAAW,UAAU,WAAW,GAAG,2BAAa,EAEtD,CAAA;AAAA,IACC,MAAM,oBACNA,2BAAAA,IAACC,WAAAA,YAAW,EAAA,YAAY,MAAM,kBAAmB,CAAA,IAC9C,aAAa,QACfD,2BAAAA,IAAA,OAAA,EAAI,WAAW,UAAU,OAAO,GAChC,UAAAA,2BAAA,IAAC,OAAI,EAAA,WAAW,UAAU,YAAY,GAAI,UAAA,YAAY,MAAM,CAAA,EAAA,CAC7D,IACG;AAAA,IACH,MAAM,QAELF,2BAAAA,KAAAC,WAAA,UAAA,EAAA,UAAA;AAAA,MAACC,2BAAAA,IAAA,OAAA,EAAI,WAAW,UAAU,UAAU,GAAG,IAAI,SAAS,KAAK,IAAI,UAE7D,YAAA,CAAA;AAAA,qCACC,eAAc,EAAA,OAAO,MAAM,OAAO,OAAO,QAAQ,EAAG,CAAA;AAAA,IAAA,EAAA,CACtD,IACG;AAAA,EAAA,GACL;AAEF;;"}
1
+ {"version":3,"file":"DevErrorInner.cjs","sources":["../../../../../../packages/react-devbar/src/ui/DevError/DevErrorInner.tsx"],"sourcesContent":["import { StackTrace } from './StackTrace'\nimport type { ProcessedError } from './types'\n\nexport interface DevErrorInnerProps {\n\terror: ProcessedError\n\tlevel?: number\n}\n\nconst className = (cls?: string | null) => cls ? `cui-devError-${cls}` : 'cui-devError'\n\nexport function DevErrorInner({ error, level = 1 }: DevErrorInnerProps) {\n\tlet errorObject: Error | undefined = error.error instanceof Error ? error.error : undefined\n\n\treturn (\n\t\t<>\n\t\t\t<div className={className('header')}>\n\t\t\t\t{errorObject\n\t\t\t\t\t? (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<h1 className={className('errorName')}>{errorObject.name}</h1>\n\t\t\t\t\t\t\t{error.cause && <a href={`#error-${level}`} className={className('causeLink')}>caused by &gt;</a>}\n\t\t\t\t\t\t\t{errorObject.message && <h2 className={className('errorMessage')}>{errorObject.message}</h2>}\n\t\t\t\t\t\t\t{'details' in errorObject && <div className={className('errorDetails')}>{(errorObject as any).details}</div>}\n\t\t\t\t\t\t</>\n\t\t\t\t\t)\n\t\t\t\t\t: <h1 className={className('errorName')}>Unknown error</h1>}\n\t\t\t</div>\n\t\t\t{error.parsedStackStrace ? <StackTrace stackTrace={error.parsedStackStrace} /> : errorObject?.stack\n\t\t\t\t? (\n\t\t\t\t\t<div className={className('stack')}>\n\t\t\t\t\t\t<div className={className('stack-dump')}>{errorObject.stack}</div>\n\t\t\t\t\t</div>\n\t\t\t\t)\n\t\t\t\t: null}\n\t\t\t{error.cause\n\t\t\t\t? (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<div className={className('causedBy')} id={`error-${level}`}>\n\t\t\t\t\t\t\tCaused by\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<DevErrorInner error={error.cause} level={level + 1} />\n\t\t\t\t\t</>\n\t\t\t\t)\n\t\t\t\t: null}\n\t\t</>\n\t)\n}\n"],"names":["jsxs","Fragment","jsx","StackTrace"],"mappings":";;;;AAQA,MAAM,YAAY,CAAC,QAAwB,MAAM,gBAAgB,GAAG,KAAK;AAElE,SAAS,cAAc,EAAE,OAAO,QAAQ,KAAyB;AACvE,MAAI,cAAiC,MAAM,iBAAiB,QAAQ,MAAM,QAAQ;AAElF,SACCA,2BAAAA,KAAAC,qBAAA,EACC,UAAA;AAAA,IAAAC,2BAAAA,IAAC,SAAI,WAAW,UAAU,QAAQ,GAChC,wBAECF,2BAAAA,KAAAC,WAAAA,UAAA,EACC,UAAA;AAAA,MAAAC,+BAAC,QAAG,WAAW,UAAU,WAAW,GAAI,sBAAY,MAAK;AAAA,MACxD,MAAM,SAASA,2BAAAA,IAAC,KAAA,EAAE,MAAM,UAAU,KAAK,I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