@knapsack/renderer-react 4.69.15--canary.4532.e420d28.0 → 4.69.15--canary.4771.9877e61.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,81 +1,20 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
8
- var __copyProps = (to, from, except, desc) => {
9
- if (from && typeof from === "object" || typeof from === "function") {
10
- for (let key of __getOwnPropNames(from))
11
- if (!__hasOwnProp.call(to, key) && key !== except)
12
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
- }
14
- return to;
15
- };
16
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
- // If the importer is in node compatibility mode or this is not an ESM
18
- // file that has been converted to a CommonJS file using a Babel-
19
- // compatible transform (i.e. "__esModule" has not been set), then set
20
- // "default" to the CommonJS "module.exports" for node compatibility.
21
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
- mod
23
- ));
1
+ 'use strict';
24
2
 
25
- // src/client/init.tsx
26
- var import_react = __toESM(require("react"));
27
- var import_client2 = __toESM(require("react-dom/client"));
3
+ var client = require('@knapsack/renderer-webpack-base/client');
4
+ var E = require('react');
5
+ var D = require('react-dom/client');
6
+ var jsxRuntime = require('react/jsx-runtime');
28
7
 
29
- // src/client/ks-utils.ts
30
- var import_client = require("@knapsack/renderer-webpack-base/client");
8
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
31
9
 
32
- // src/types.ts
33
- var rendererMetaScriptTagId = "ks-react-meta";
10
+ var E__default = /*#__PURE__*/_interopDefault(E);
11
+ var D__default = /*#__PURE__*/_interopDefault(D);
34
12
 
35
- // src/client/ks-utils.ts
36
- var {
37
- getAllImports,
38
- getExtraImport,
39
- getImport,
40
- getImports,
41
- getPatternImport,
42
- importedModules,
43
- meta,
44
- rendererMeta,
45
- rendererMethods
46
- } = (0, import_client.getKsRendererClientGlobal)({
47
- rendererMetaScriptTagId
48
- });
49
-
50
- // src/client/init.tsx
51
- var import_jsx_runtime = require("react/jsx-runtime");
52
- async function init() {
53
- const { neededImports, disableReactStrictMode, demoWrapperProps } = rendererMeta;
54
- const all = await getAllImports({
55
- patterns: neededImports.filter((i) => i.type !== "extra"),
56
- extras: neededImports.filter((i) => i.type === "extra").map(({ importInfo }) => ({ name: importInfo.name }))
57
- });
58
- const root = document.getElementById("render-root");
59
- if (!root) {
60
- throw new Error("No root element found");
61
- }
62
- const { DemoWrapper, ErrorCatcher, ...demoComponents } = all;
63
- const DemoApp = rendererMethods.getDemoApp(demoComponents);
64
- const app = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ErrorCatcher, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DemoWrapper, { ...demoWrapperProps, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DemoApp, {}) }) });
65
- import_client2.default.createRoot(root).render(
66
- disableReactStrictMode ? app : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.default.StrictMode, { children: app })
67
- );
68
- }
69
- __name(init, "init");
70
- try {
71
- init();
72
- } catch (e) {
73
- console.error(e);
74
- const errorElement = document.createElement("div");
75
- errorElement.innerHTML = `
13
+ var x=Object.defineProperty;var a=(t,e)=>x(t,"name",{value:e,configurable:!0});var m=(t,e)=>()=>(t&&(e=t(t=0)),e);var C=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var d,s=m(()=>{d="ks-react-meta";});var c,w,A,T,B,N,v,i,l,M=m(()=>{s();({getAllImports:c,getExtraImport:w,getImport:A,getImports:T,getPatternImport:B,importedModules:N,meta:v,rendererMeta:i,rendererMethods:l}=client.getKsRendererClientGlobal({rendererMetaScriptTagId:d}));});var P=C(()=>{M();async function b(){let{neededImports:t,disableReactStrictMode:e,demoWrapperProps:y}=i,R=await c({patterns:t.filter(r=>r.type!=="extra"),extras:t.filter(r=>r.type==="extra").map(({importInfo:r})=>({name:r.name}))}),p=document.getElementById("render-root");if(!p)throw new Error("No root element found");let{DemoWrapper:g,ErrorCatcher:f,...h}=R,I=l.getDemoApp(h),n=jsxRuntime.jsx(f,{children:jsxRuntime.jsx(g,{...y,children:jsxRuntime.jsx(I,{})})});D__default.default.createRoot(p).render(e?n:jsxRuntime.jsx(E__default.default.StrictMode,{children:n}));}a(b,"init");try{b();}catch(t){console.error(t);let e=document.createElement("div");e.innerHTML=`
76
14
  <h1>Error</h1>
77
- <p>${e.message}</p>
78
- `;
79
- document.body.appendChild(errorElement);
80
- }
15
+ <p>${t.message}</p>
16
+ `,document.body.appendChild(e);}});var init = P();
17
+
18
+ module.exports = init;
19
+ //# sourceMappingURL=init.js.map
81
20
  //# sourceMappingURL=init.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/client/init.tsx","../../src/client/ks-utils.ts","../../src/types.ts"],"sourcesContent":["/// <reference lib=\"dom\" />\nimport React from 'react';\nimport ReactDOM from 'react-dom/client';\nimport { rendererMeta, rendererMethods, getAllImports } from './ks-utils';\n\nasync function init() {\n const { neededImports, disableReactStrictMode, demoWrapperProps } =\n rendererMeta;\n const all = await getAllImports({\n patterns: neededImports.filter((i) => i.type !== 'extra'),\n extras: neededImports\n .filter((i) => i.type === 'extra')\n .map(({ importInfo }) => ({ name: importInfo.name })),\n });\n\n const root = document.getElementById('render-root');\n if (!root) {\n throw new Error('No root element found');\n }\n const { DemoWrapper, ErrorCatcher, ...demoComponents } = all;\n const DemoApp = rendererMethods.getDemoApp(demoComponents);\n const app = (\n <ErrorCatcher>\n <DemoWrapper {...demoWrapperProps}>\n <DemoApp />\n </DemoWrapper>\n </ErrorCatcher>\n );\n\n ReactDOM.createRoot(root).render(\n disableReactStrictMode ? app : <React.StrictMode>{app}</React.StrictMode>,\n );\n}\n\ntry {\n init();\n} catch (e) {\n console.error(e);\n // create html element with error message\n const errorElement = document.createElement('div');\n errorElement.innerHTML = `\n <h1>Error</h1>\n <p>${e.message}</p>\n `;\n document.body.appendChild(errorElement);\n}\n","import { getKsRendererClientGlobal } from '@knapsack/renderer-webpack-base/client';\nimport {\n rendererMetaScriptTagId,\n type KsReactMeta,\n type Component,\n type RendererMethods,\n} from '../types';\n\nexport const {\n getAllImports,\n getExtraImport,\n getImport,\n getImports,\n getPatternImport,\n importedModules,\n meta,\n rendererMeta,\n rendererMethods,\n} = getKsRendererClientGlobal<Component, KsReactMeta, RendererMethods>({\n rendererMetaScriptTagId,\n});\n","import type { Demo, Except } from '@knapsack/types';\nimport type { ComponentType } from 'react';\nimport type { RendererMetaBase } from '@knapsack/renderer-webpack-base/client';\nimport type { KnapsackRenderParams } from '@knapsack/app/types';\n\nexport type Component = ComponentType<Record<string, unknown>>;\n\nexport type DemoWrapperProps = {\n children: React.ReactNode;\n patternsUsed: {\n patternId: string;\n templateId: string;\n demoId?: string;\n }[];\n} & Except<KnapsackRenderParams, 'patternManifest'>;\n\n/**\n * Found as JSON in HTML `#ks-react-meta`\n */\nexport type KsReactMeta = {\n disableReactStrictMode: boolean;\n demo: Demo;\n demoWrapperProps: Except<DemoWrapperProps, 'children'>;\n} & RendererMetaBase;\n\nexport const rendererMetaScriptTagId = 'ks-react-meta';\n\nexport type RendererMethods = {\n getDemoApp: (components: Record<string, Component>) => Component;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AACA,mBAAkB;AAClB,IAAAA,iBAAqB;;;ACFrB,oBAA0C;;;ACyBnC,IAAM,0BAA0B;;;ADjBhC,IAAM;AAAA,EACX;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,QAAI,yCAAmE;AAAA,EACrE;AACF,CAAC;;;ADIO;AAnBR,eAAe,OAAO;AACpB,QAAM,EAAE,eAAe,wBAAwB,iBAAiB,IAC9D;AACF,QAAM,MAAM,MAAM,cAAc;AAAA,IAC9B,UAAU,cAAc,OAAO,CAAC,MAAM,EAAE,SAAS,OAAO;AAAA,IACxD,QAAQ,cACL,OAAO,CAAC,MAAM,EAAE,SAAS,OAAO,EAChC,IAAI,CAAC,EAAE,WAAW,OAAO,EAAE,MAAM,WAAW,KAAK,EAAE;AAAA,EACxD,CAAC;AAED,QAAM,OAAO,SAAS,eAAe,aAAa;AAClD,MAAI,CAAC,MAAM;AACT,UAAM,IAAI,MAAM,uBAAuB;AAAA,EACzC;AACA,QAAM,EAAE,aAAa,cAAc,GAAG,eAAe,IAAI;AACzD,QAAM,UAAU,gBAAgB,WAAW,cAAc;AACzD,QAAM,MACJ,4CAAC,gBACC,sDAAC,eAAa,GAAG,kBACf,sDAAC,WAAQ,GACX,GACF;AAGF,iBAAAC,QAAS,WAAW,IAAI,EAAE;AAAA,IACxB,yBAAyB,MAAM,4CAAC,aAAAC,QAAM,YAAN,EAAkB,eAAI;AAAA,EACxD;AACF;AA3Be;AA6Bf,IAAI;AACF,OAAK;AACP,SAAS,GAAG;AACV,UAAQ,MAAM,CAAC;AAEf,QAAM,eAAe,SAAS,cAAc,KAAK;AACjD,eAAa,YAAY;AAAA;AAAA,SAElB,EAAE,OAAO;AAAA;AAEhB,WAAS,KAAK,YAAY,YAAY;AACxC;","names":["import_client","ReactDOM","React"]}
1
+ {"version":3,"sources":["../../src/types.ts","../../src/client/ks-utils.ts","../../src/client/init.tsx"],"names":["rendererMetaScriptTagId","init_types","__esmMin","getAllImports","getExtraImport","getImport","getImports","getPatternImport","importedModules","meta","rendererMeta","rendererMethods","init_ks_utils","getKsRendererClientGlobal","require_init","__commonJSMin","init","neededImports","disableReactStrictMode","demoWrapperProps","all","i","importInfo","root","DemoWrapper","ErrorCatcher","demoComponents","DemoApp","app","jsx","ReactDOM","React","__name","e","errorElement"],"mappings":";;;;;;;;;;;;gLAAA,IAyBaA,CAAAA,CAzBbC,EAAAC,CAAA,CAAA,IAAA,CAyBaF,EAA0B,gBCzBvC,CAAA,CAAA,CAAA,IASEG,CACAC,CAAAA,CAAAA,CACAC,EACAC,CACAC,CAAAA,CAAAA,CACAC,EACAC,CACAC,CAAAA,CAAAA,CACAC,EAjBFC,CAAAV,CAAAA,CAAAA,CAAA,KACAD,CAOa,EAAA,CAAA,CAAA,CACX,cAAAE,CACA,CAAA,cAAA,CAAAC,EACA,SAAAC,CAAAA,CAAAA,CACA,WAAAC,CACA,CAAA,gBAAA,CAAAC,EACA,eAAAC,CAAAA,CAAAA,CACA,KAAAC,CACA,CAAA,YAAA,CAAAC,EACA,eAAAC,CAAAA,CAAAA,CAAAA,CACEE,gCAAmE,CAAA,CACrE,uBAAAb,CAAAA,CACF,CAAC,CCnBD,EAAA,CAAA,CAAA,CADA,IAAAc,EAAAC,CAAA,CAAA,IAAA,CAGAH,IAEA,eAAeI,CAAAA,EAAO,CACpB,GAAM,CAAE,cAAAC,CAAe,CAAA,sBAAA,CAAAC,EAAwB,gBAAAC,CAAAA,CAAiB,EAC9DT,CACIU,CAAAA,CAAAA,CAAM,MAAMjB,CAAc,CAAA,CAC9B,SAAUc,CAAc,CAAA,MAAA,CAAQI,GAAMA,CAAE,CAAA,IAAA,GAAS,OAAO,CACxD,CAAA,MAAA,CAAQJ,EACL,MAAQI,CAAAA,CAAAA,EAAMA,CAAE,CAAA,IAAA,GAAS,OAAO,CAAA,CAChC,IAAI,CAAC,CAAE,WAAAC,CAAW,CAAA,IAAO,CAAE,IAAMA,CAAAA,CAAAA,CAAW,IAAK,CAAE,CAAA,CACxD,CAAC,CAEKC,CAAAA,CAAAA,CAAO,SAAS,cAAe,CAAA,aAAa,EAClD,GAAI,CAACA,EACH,MAAM,IAAI,MAAM,uBAAuB,CAAA,CAEzC,GAAM,CAAE,WAAA,CAAAC,EAAa,YAAAC,CAAAA,CAAAA,CAAc,GAAGC,CAAe,CAAA,CAAIN,EACnDO,CAAUhB,CAAAA,CAAAA,CAAgB,WAAWe,CAAc,CAAA,CACnDE,EACJC,cAACJ,CAAAA,CAAAA,CAAA,CACC,QAAA,CAAAI,cAACL,CAAAA,CAAAA,CAAA,CAAa,GAAGL,CAAAA,CACf,SAAAU,cAACF,CAAAA,CAAAA,CAAA,EAAQ,CACX,CAAA,CAAA,CACF,EAGFG,kBAAS,CAAA,UAAA,CAAWP,CAAI,CAAE,CAAA,MAAA,CACxBL,EAAyBU,CAAMC,CAAAA,cAAAA,CAACE,mBAAM,UAAN,CAAA,CAAkB,SAAAH,CAAI,CAAA,CACxD,EACF,CA3BeI,CAAAA,CAAAhB,EAAA,MA6Bf,CAAA,CAAA,GAAI,CACFA,CAAK,GACP,OAASiB,CAAG,CAAA,CACV,QAAQ,KAAMA,CAAAA,CAAC,EAEf,IAAMC,CAAAA,CAAe,SAAS,aAAc,CAAA,KAAK,CACjDA,CAAAA,CAAAA,CAAa,SAAY,CAAA,CAAA;AAAA;AAAA,OAAA,EAElBD,EAAE,OAAO,CAAA;AAAA,EAAA,CAAA,CAEhB,QAAS,CAAA,IAAA,CAAK,WAAYC,CAAAA,CAAY,EACxC,CAAA,CAAA,CAAA,CAAA,WAAA,CAAA,EAAA","file":"init.js","sourcesContent":["import type { Demo, Except } from '@knapsack/types';\nimport type { ComponentType } from 'react';\nimport type { RendererMetaBase } from '@knapsack/renderer-webpack-base/client';\nimport type { KnapsackRenderParams } from '@knapsack/app/types';\n\nexport type Component = ComponentType<Record<string, unknown>>;\n\nexport type DemoWrapperProps = {\n children: React.ReactNode;\n patternsUsed: {\n patternId: string;\n templateId: string;\n demoId?: string;\n }[];\n} & Except<KnapsackRenderParams, 'patternManifest'>;\n\n/**\n * Found as JSON in HTML `#ks-react-meta`\n */\nexport type KsReactMeta = {\n disableReactStrictMode: boolean;\n demo: Demo;\n demoWrapperProps: Except<DemoWrapperProps, 'children'>;\n} & RendererMetaBase;\n\nexport const rendererMetaScriptTagId = 'ks-react-meta';\n\nexport type RendererMethods = {\n getDemoApp: (components: Record<string, Component>) => Component;\n};\n","import { getKsRendererClientGlobal } from '@knapsack/renderer-webpack-base/client';\nimport {\n rendererMetaScriptTagId,\n type KsReactMeta,\n type Component,\n type RendererMethods,\n} from '../types';\n\nexport const {\n getAllImports,\n getExtraImport,\n getImport,\n getImports,\n getPatternImport,\n importedModules,\n meta,\n rendererMeta,\n rendererMethods,\n} = getKsRendererClientGlobal<Component, KsReactMeta, RendererMethods>({\n rendererMetaScriptTagId,\n});\n","/// <reference lib=\"dom\" />\nimport React from 'react';\nimport ReactDOM from 'react-dom/client';\nimport { rendererMeta, rendererMethods, getAllImports } from './ks-utils';\n\nasync function init() {\n const { neededImports, disableReactStrictMode, demoWrapperProps } =\n rendererMeta;\n const all = await getAllImports({\n patterns: neededImports.filter((i) => i.type !== 'extra'),\n extras: neededImports\n .filter((i) => i.type === 'extra')\n .map(({ importInfo }) => ({ name: importInfo.name })),\n });\n\n const root = document.getElementById('render-root');\n if (!root) {\n throw new Error('No root element found');\n }\n const { DemoWrapper, ErrorCatcher, ...demoComponents } = all;\n const DemoApp = rendererMethods.getDemoApp(demoComponents);\n const app = (\n <ErrorCatcher>\n <DemoWrapper {...demoWrapperProps}>\n <DemoApp />\n </DemoWrapper>\n </ErrorCatcher>\n );\n\n ReactDOM.createRoot(root).render(\n disableReactStrictMode ? app : <React.StrictMode>{app}</React.StrictMode>,\n );\n}\n\ntry {\n init();\n} catch (e) {\n console.error(e);\n // create html element with error message\n const errorElement = document.createElement('div');\n errorElement.innerHTML = `\n <h1>Error</h1>\n <p>${e.message}</p>\n `;\n document.body.appendChild(errorElement);\n}\n"]}
@@ -1,89 +1,13 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropNames = Object.getOwnPropertyNames;
3
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
4
- var __esm = (fn, res) => function __init() {
5
- return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
6
- };
7
- var __commonJS = (cb, mod) => function __require() {
8
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
9
- };
1
+ import { getKsRendererClientGlobal } from '@knapsack/renderer-webpack-base/client';
2
+ import E from 'react';
3
+ import D from 'react-dom/client';
4
+ import { jsx } from 'react/jsx-runtime';
10
5
 
11
- // ../../../../node_modules/.pnpm/tsup@8.2.4_@microsoft+api-extractor@7.43.8_@types+node@20.16.6__@swc+core@1.3.57_@swc+helpers_iqa4vqpgdlzwuubzthdmdz7nfe/node_modules/tsup/assets/esm_shims.js
12
- var init_esm_shims = __esm({
13
- "../../../../node_modules/.pnpm/tsup@8.2.4_@microsoft+api-extractor@7.43.8_@types+node@20.16.6__@swc+core@1.3.57_@swc+helpers_iqa4vqpgdlzwuubzthdmdz7nfe/node_modules/tsup/assets/esm_shims.js"() {
14
- }
15
- });
16
-
17
- // src/types.ts
18
- var rendererMetaScriptTagId;
19
- var init_types = __esm({
20
- "src/types.ts"() {
21
- init_esm_shims();
22
- rendererMetaScriptTagId = "ks-react-meta";
23
- }
24
- });
25
-
26
- // src/client/ks-utils.ts
27
- import { getKsRendererClientGlobal } from "@knapsack/renderer-webpack-base/client";
28
- var getAllImports, getExtraImport, getImport, getImports, getPatternImport, importedModules, meta, rendererMeta, rendererMethods;
29
- var init_ks_utils = __esm({
30
- "src/client/ks-utils.ts"() {
31
- init_esm_shims();
32
- init_types();
33
- ({
34
- getAllImports,
35
- getExtraImport,
36
- getImport,
37
- getImports,
38
- getPatternImport,
39
- importedModules,
40
- meta,
41
- rendererMeta,
42
- rendererMethods
43
- } = getKsRendererClientGlobal({
44
- rendererMetaScriptTagId
45
- }));
46
- }
47
- });
48
-
49
- // src/client/init.tsx
50
- import React from "react";
51
- import ReactDOM from "react-dom/client";
52
- import { jsx } from "react/jsx-runtime";
53
- var require_init = __commonJS({
54
- "src/client/init.tsx"() {
55
- init_esm_shims();
56
- init_ks_utils();
57
- async function init() {
58
- const { neededImports, disableReactStrictMode, demoWrapperProps } = rendererMeta;
59
- const all = await getAllImports({
60
- patterns: neededImports.filter((i) => i.type !== "extra"),
61
- extras: neededImports.filter((i) => i.type === "extra").map(({ importInfo }) => ({ name: importInfo.name }))
62
- });
63
- const root = document.getElementById("render-root");
64
- if (!root) {
65
- throw new Error("No root element found");
66
- }
67
- const { DemoWrapper, ErrorCatcher, ...demoComponents } = all;
68
- const DemoApp = rendererMethods.getDemoApp(demoComponents);
69
- const app = /* @__PURE__ */ jsx(ErrorCatcher, { children: /* @__PURE__ */ jsx(DemoWrapper, { ...demoWrapperProps, children: /* @__PURE__ */ jsx(DemoApp, {}) }) });
70
- ReactDOM.createRoot(root).render(
71
- disableReactStrictMode ? app : /* @__PURE__ */ jsx(React.StrictMode, { children: app })
72
- );
73
- }
74
- __name(init, "init");
75
- try {
76
- init();
77
- } catch (e) {
78
- console.error(e);
79
- const errorElement = document.createElement("div");
80
- errorElement.innerHTML = `
6
+ var x=Object.defineProperty;var a=(t,e)=>x(t,"name",{value:e,configurable:!0});var m=(t,e)=>()=>(t&&(e=t(t=0)),e);var C=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var d,s=m(()=>{d="ks-react-meta";});var c,w,A,T,B,N,v,i,l,M=m(()=>{s();({getAllImports:c,getExtraImport:w,getImport:A,getImports:T,getPatternImport:B,importedModules:N,meta:v,rendererMeta:i,rendererMethods:l}=getKsRendererClientGlobal({rendererMetaScriptTagId:d}));});var P=C(()=>{M();async function b(){let{neededImports:t,disableReactStrictMode:e,demoWrapperProps:y}=i,R=await c({patterns:t.filter(r=>r.type!=="extra"),extras:t.filter(r=>r.type==="extra").map(({importInfo:r})=>({name:r.name}))}),p=document.getElementById("render-root");if(!p)throw new Error("No root element found");let{DemoWrapper:g,ErrorCatcher:f,...h}=R,I=l.getDemoApp(h),n=jsx(f,{children:jsx(g,{...y,children:jsx(I,{})})});D.createRoot(p).render(e?n:jsx(E.StrictMode,{children:n}));}a(b,"init");try{b();}catch(t){console.error(t);let e=document.createElement("div");e.innerHTML=`
81
7
  <h1>Error</h1>
82
- <p>${e.message}</p>
83
- `;
84
- document.body.appendChild(errorElement);
85
- }
86
- }
87
- });
88
- export default require_init();
8
+ <p>${t.message}</p>
9
+ `,document.body.appendChild(e);}});var init = P();
10
+
11
+ export { init as default };
12
+ //# sourceMappingURL=init.mjs.map
89
13
  //# sourceMappingURL=init.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../node_modules/.pnpm/tsup@8.2.4_@microsoft+api-extractor@7.43.8_@types+node@20.16.6__@swc+core@1.3.57_@swc+helpers_iqa4vqpgdlzwuubzthdmdz7nfe/node_modules/tsup/assets/esm_shims.js","../../src/types.ts","../../src/client/ks-utils.ts","../../src/client/init.tsx"],"sourcesContent":["// Shim globals in esm bundle\nimport { fileURLToPath } from 'url'\nimport path from 'path'\n\nconst getFilename = () => fileURLToPath(import.meta.url)\nconst getDirname = () => path.dirname(getFilename())\n\nexport const __dirname = /* @__PURE__ */ getDirname()\nexport const __filename = /* @__PURE__ */ getFilename()\n","import type { Demo, Except } from '@knapsack/types';\nimport type { ComponentType } from 'react';\nimport type { RendererMetaBase } from '@knapsack/renderer-webpack-base/client';\nimport type { KnapsackRenderParams } from '@knapsack/app/types';\n\nexport type Component = ComponentType<Record<string, unknown>>;\n\nexport type DemoWrapperProps = {\n children: React.ReactNode;\n patternsUsed: {\n patternId: string;\n templateId: string;\n demoId?: string;\n }[];\n} & Except<KnapsackRenderParams, 'patternManifest'>;\n\n/**\n * Found as JSON in HTML `#ks-react-meta`\n */\nexport type KsReactMeta = {\n disableReactStrictMode: boolean;\n demo: Demo;\n demoWrapperProps: Except<DemoWrapperProps, 'children'>;\n} & RendererMetaBase;\n\nexport const rendererMetaScriptTagId = 'ks-react-meta';\n\nexport type RendererMethods = {\n getDemoApp: (components: Record<string, Component>) => Component;\n};\n","import { getKsRendererClientGlobal } from '@knapsack/renderer-webpack-base/client';\nimport {\n rendererMetaScriptTagId,\n type KsReactMeta,\n type Component,\n type RendererMethods,\n} from '../types';\n\nexport const {\n getAllImports,\n getExtraImport,\n getImport,\n getImports,\n getPatternImport,\n importedModules,\n meta,\n rendererMeta,\n rendererMethods,\n} = getKsRendererClientGlobal<Component, KsReactMeta, RendererMethods>({\n rendererMetaScriptTagId,\n});\n","/// <reference lib=\"dom\" />\nimport React from 'react';\nimport ReactDOM from 'react-dom/client';\nimport { rendererMeta, rendererMethods, getAllImports } from './ks-utils';\n\nasync function init() {\n const { neededImports, disableReactStrictMode, demoWrapperProps } =\n rendererMeta;\n const all = await getAllImports({\n patterns: neededImports.filter((i) => i.type !== 'extra'),\n extras: neededImports\n .filter((i) => i.type === 'extra')\n .map(({ importInfo }) => ({ name: importInfo.name })),\n });\n\n const root = document.getElementById('render-root');\n if (!root) {\n throw new Error('No root element found');\n }\n const { DemoWrapper, ErrorCatcher, ...demoComponents } = all;\n const DemoApp = rendererMethods.getDemoApp(demoComponents);\n const app = (\n <ErrorCatcher>\n <DemoWrapper {...demoWrapperProps}>\n <DemoApp />\n </DemoWrapper>\n </ErrorCatcher>\n );\n\n ReactDOM.createRoot(root).render(\n disableReactStrictMode ? app : <React.StrictMode>{app}</React.StrictMode>,\n );\n}\n\ntry {\n init();\n} catch (e) {\n console.error(e);\n // create html element with error message\n const errorElement = document.createElement('div');\n errorElement.innerHTML = `\n <h1>Error</h1>\n <p>${e.message}</p>\n `;\n document.body.appendChild(errorElement);\n}\n"],"mappings":";;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAyBa;AAzBb;AAAA;AAAA;AAyBO,IAAM,0BAA0B;AAAA;AAAA;;;ACzBvC,SAAS,iCAAiC;AAA1C,IASE,eACA,gBACA,WACA,YACA,kBACA,iBACA,MACA,cACA;AAjBF;AAAA;AAAA;AACA;AAOO,KAAM;AAAA,MACX;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,QACE,0BAAmE;AAAA,MACrE;AAAA,IACF,CAAC;AAAA;AAAA;;;ACnBD,OAAO,WAAW;AAClB,OAAO,cAAc;AAsBb;AAxBR;AAAA;AAAA;AAGA;AAEA,mBAAe,OAAO;AACpB,YAAM,EAAE,eAAe,wBAAwB,iBAAiB,IAC9D;AACF,YAAM,MAAM,MAAM,cAAc;AAAA,QAC9B,UAAU,cAAc,OAAO,CAAC,MAAM,EAAE,SAAS,OAAO;AAAA,QACxD,QAAQ,cACL,OAAO,CAAC,MAAM,EAAE,SAAS,OAAO,EAChC,IAAI,CAAC,EAAE,WAAW,OAAO,EAAE,MAAM,WAAW,KAAK,EAAE;AAAA,MACxD,CAAC;AAED,YAAM,OAAO,SAAS,eAAe,aAAa;AAClD,UAAI,CAAC,MAAM;AACT,cAAM,IAAI,MAAM,uBAAuB;AAAA,MACzC;AACA,YAAM,EAAE,aAAa,cAAc,GAAG,eAAe,IAAI;AACzD,YAAM,UAAU,gBAAgB,WAAW,cAAc;AACzD,YAAM,MACJ,oBAAC,gBACC,8BAAC,eAAa,GAAG,kBACf,8BAAC,WAAQ,GACX,GACF;AAGF,eAAS,WAAW,IAAI,EAAE;AAAA,QACxB,yBAAyB,MAAM,oBAAC,MAAM,YAAN,EAAkB,eAAI;AAAA,MACxD;AAAA,IACF;AA3Be;AA6Bf,QAAI;AACF,WAAK;AAAA,IACP,SAAS,GAAG;AACV,cAAQ,MAAM,CAAC;AAEf,YAAM,eAAe,SAAS,cAAc,KAAK;AACjD,mBAAa,YAAY;AAAA;AAAA,SAElB,EAAE,OAAO;AAAA;AAEhB,eAAS,KAAK,YAAY,YAAY;AAAA,IACxC;AAAA;AAAA;","names":[]}
1
+ {"version":3,"sources":["../../src/types.ts","../../src/client/ks-utils.ts","../../src/client/init.tsx"],"names":["rendererMetaScriptTagId","init_types","__esmMin","getAllImports","getExtraImport","getImport","getImports","getPatternImport","importedModules","meta","rendererMeta","rendererMethods","init_ks_utils","getKsRendererClientGlobal","require_init","__commonJSMin","init","neededImports","disableReactStrictMode","demoWrapperProps","all","i","importInfo","root","DemoWrapper","ErrorCatcher","demoComponents","DemoApp","app","jsx","ReactDOM","React","__name","e","errorElement"],"mappings":";;;;;gLAAA,IAyBaA,CAAAA,CAzBbC,EAAAC,CAAA,CAAA,IAAA,CAyBaF,EAA0B,gBCzBvC,CAAA,CAAA,CAAA,IASEG,CACAC,CAAAA,CAAAA,CACAC,EACAC,CACAC,CAAAA,CAAAA,CACAC,EACAC,CACAC,CAAAA,CAAAA,CACAC,EAjBFC,CAAAV,CAAAA,CAAAA,CAAA,KACAD,CAOa,EAAA,CAAA,CAAA,CACX,cAAAE,CACA,CAAA,cAAA,CAAAC,EACA,SAAAC,CAAAA,CAAAA,CACA,WAAAC,CACA,CAAA,gBAAA,CAAAC,EACA,eAAAC,CAAAA,CAAAA,CACA,KAAAC,CACA,CAAA,YAAA,CAAAC,EACA,eAAAC,CAAAA,CAAAA,CAAAA,CACEE,yBAAmE,CAAA,CACrE,uBAAAb,CAAAA,CACF,CAAC,CCnBD,EAAA,CAAA,CAAA,CADA,IAAAc,EAAAC,CAAA,CAAA,IAAA,CAGAH,IAEA,eAAeI,CAAAA,EAAO,CACpB,GAAM,CAAE,cAAAC,CAAe,CAAA,sBAAA,CAAAC,EAAwB,gBAAAC,CAAAA,CAAiB,EAC9DT,CACIU,CAAAA,CAAAA,CAAM,MAAMjB,CAAc,CAAA,CAC9B,SAAUc,CAAc,CAAA,MAAA,CAAQI,GAAMA,CAAE,CAAA,IAAA,GAAS,OAAO,CACxD,CAAA,MAAA,CAAQJ,EACL,MAAQI,CAAAA,CAAAA,EAAMA,CAAE,CAAA,IAAA,GAAS,OAAO,CAAA,CAChC,IAAI,CAAC,CAAE,WAAAC,CAAW,CAAA,IAAO,CAAE,IAAMA,CAAAA,CAAAA,CAAW,IAAK,CAAE,CAAA,CACxD,CAAC,CAEKC,CAAAA,CAAAA,CAAO,SAAS,cAAe,CAAA,aAAa,EAClD,GAAI,CAACA,EACH,MAAM,IAAI,MAAM,uBAAuB,CAAA,CAEzC,GAAM,CAAE,WAAA,CAAAC,EAAa,YAAAC,CAAAA,CAAAA,CAAc,GAAGC,CAAe,CAAA,CAAIN,EACnDO,CAAUhB,CAAAA,CAAAA,CAAgB,WAAWe,CAAc,CAAA,CACnDE,EACJC,GAACJ,CAAAA,CAAAA,CAAA,CACC,QAAA,CAAAI,GAACL,CAAAA,CAAAA,CAAA,CAAa,GAAGL,CAAAA,CACf,SAAAU,GAACF,CAAAA,CAAAA,CAAA,EAAQ,CACX,CAAA,CAAA,CACF,EAGFG,CAAS,CAAA,UAAA,CAAWP,CAAI,CAAE,CAAA,MAAA,CACxBL,EAAyBU,CAAMC,CAAAA,GAAAA,CAACE,EAAM,UAAN,CAAA,CAAkB,SAAAH,CAAI,CAAA,CACxD,EACF,CA3BeI,CAAAA,CAAAhB,EAAA,MA6Bf,CAAA,CAAA,GAAI,CACFA,CAAK,GACP,OAASiB,CAAG,CAAA,CACV,QAAQ,KAAMA,CAAAA,CAAC,EAEf,IAAMC,CAAAA,CAAe,SAAS,aAAc,CAAA,KAAK,CACjDA,CAAAA,CAAAA,CAAa,SAAY,CAAA,CAAA;AAAA;AAAA,OAAA,EAElBD,EAAE,OAAO,CAAA;AAAA,EAAA,CAAA,CAEhB,QAAS,CAAA,IAAA,CAAK,WAAYC,CAAAA,CAAY,EACxC,CAAA,CAAA,CAAA,CAAA,WAAA,CAAA,EAAA","file":"init.mjs","sourcesContent":["import type { Demo, Except } from '@knapsack/types';\nimport type { ComponentType } from 'react';\nimport type { RendererMetaBase } from '@knapsack/renderer-webpack-base/client';\nimport type { KnapsackRenderParams } from '@knapsack/app/types';\n\nexport type Component = ComponentType<Record<string, unknown>>;\n\nexport type DemoWrapperProps = {\n children: React.ReactNode;\n patternsUsed: {\n patternId: string;\n templateId: string;\n demoId?: string;\n }[];\n} & Except<KnapsackRenderParams, 'patternManifest'>;\n\n/**\n * Found as JSON in HTML `#ks-react-meta`\n */\nexport type KsReactMeta = {\n disableReactStrictMode: boolean;\n demo: Demo;\n demoWrapperProps: Except<DemoWrapperProps, 'children'>;\n} & RendererMetaBase;\n\nexport const rendererMetaScriptTagId = 'ks-react-meta';\n\nexport type RendererMethods = {\n getDemoApp: (components: Record<string, Component>) => Component;\n};\n","import { getKsRendererClientGlobal } from '@knapsack/renderer-webpack-base/client';\nimport {\n rendererMetaScriptTagId,\n type KsReactMeta,\n type Component,\n type RendererMethods,\n} from '../types';\n\nexport const {\n getAllImports,\n getExtraImport,\n getImport,\n getImports,\n getPatternImport,\n importedModules,\n meta,\n rendererMeta,\n rendererMethods,\n} = getKsRendererClientGlobal<Component, KsReactMeta, RendererMethods>({\n rendererMetaScriptTagId,\n});\n","/// <reference lib=\"dom\" />\nimport React from 'react';\nimport ReactDOM from 'react-dom/client';\nimport { rendererMeta, rendererMethods, getAllImports } from './ks-utils';\n\nasync function init() {\n const { neededImports, disableReactStrictMode, demoWrapperProps } =\n rendererMeta;\n const all = await getAllImports({\n patterns: neededImports.filter((i) => i.type !== 'extra'),\n extras: neededImports\n .filter((i) => i.type === 'extra')\n .map(({ importInfo }) => ({ name: importInfo.name })),\n });\n\n const root = document.getElementById('render-root');\n if (!root) {\n throw new Error('No root element found');\n }\n const { DemoWrapper, ErrorCatcher, ...demoComponents } = all;\n const DemoApp = rendererMethods.getDemoApp(demoComponents);\n const app = (\n <ErrorCatcher>\n <DemoWrapper {...demoWrapperProps}>\n <DemoApp />\n </DemoWrapper>\n </ErrorCatcher>\n );\n\n ReactDOM.createRoot(root).render(\n disableReactStrictMode ? app : <React.StrictMode>{app}</React.StrictMode>,\n );\n}\n\ntry {\n init();\n} catch (e) {\n console.error(e);\n // create html element with error message\n const errorElement = document.createElement('div');\n errorElement.innerHTML = `\n <h1>Error</h1>\n <p>${e.message}</p>\n `;\n document.body.appendChild(errorElement);\n}\n"]}
@@ -1,29 +1,9 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
1
+ 'use strict';
19
2
 
20
- // src/demo-wrapper.tsx
21
- var demo_wrapper_exports = {};
22
- __export(demo_wrapper_exports, {
23
- default: () => demo_wrapper_default
24
- });
25
- module.exports = __toCommonJS(demo_wrapper_exports);
26
- var import_jsx_runtime = require("react/jsx-runtime");
27
- var DemoWrapper = /* @__PURE__ */ __name(({ children }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "demo-wrapper", children }), "DemoWrapper");
28
- var demo_wrapper_default = DemoWrapper;
3
+ var jsxRuntime = require('react/jsx-runtime');
4
+
5
+ var o=Object.defineProperty;var e=(p,r)=>o(p,"name",{value:r,configurable:!0});var a=e(({children:p})=>jsxRuntime.jsx("div",{className:"demo-wrapper",children:p}),"DemoWrapper"),d=a;
6
+
7
+ module.exports = d;
8
+ //# sourceMappingURL=demo-wrapper.js.map
29
9
  //# sourceMappingURL=demo-wrapper.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/demo-wrapper.tsx"],"sourcesContent":["import type { DemoWrapperProps } from './types';\n\nconst DemoWrapper = ({ children }: DemoWrapperProps) => (\n <div className=\"demo-wrapper\">{children}</div>\n);\n\nexport default DemoWrapper;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGE;AADF,IAAM,cAAc,wBAAC,EAAE,SAAS,MAC9B,4CAAC,SAAI,WAAU,gBAAgB,UAAS,GADtB;AAIpB,IAAO,uBAAQ;","names":[]}
1
+ {"version":3,"sources":["../src/demo-wrapper.tsx"],"names":["DemoWrapper","__name","children","jsx","demo_wrapper_default"],"mappings":";;;;AAGE,IAAA,CAAA,CAAA,MAAA,CAAA,cAAA,CAAA,IAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,GAAA,CAAA,CAAA,CAAA,CAAA,MAAA,CAAA,CAAA,KAAA,CAAA,CAAA,CAAA,YAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CADF,IAAMA,EAAcC,CAAA,CAAA,CAAC,CAAE,QAAAC,CAAAA,CAAS,CAC9BC,GAAAA,cAAAA,CAAC,OAAI,SAAU,CAAA,cAAA,CAAgB,SAAAD,CAAS,CAAA,CAAA,CADtB,eAIbE,CAAQJ,CAAAA","file":"demo-wrapper.js","sourcesContent":["import type { DemoWrapperProps } from './types';\n\nconst DemoWrapper = ({ children }: DemoWrapperProps) => (\n <div className=\"demo-wrapper\">{children}</div>\n);\n\nexport default DemoWrapper;\n"]}
@@ -1,11 +1,7 @@
1
- var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
1
+ import { jsx } from 'react/jsx-runtime';
3
2
 
4
- // src/demo-wrapper.tsx
5
- import { jsx } from "react/jsx-runtime";
6
- var DemoWrapper = /* @__PURE__ */ __name(({ children }) => /* @__PURE__ */ jsx("div", { className: "demo-wrapper", children }), "DemoWrapper");
7
- var demo_wrapper_default = DemoWrapper;
8
- export {
9
- demo_wrapper_default as default
10
- };
3
+ var o=Object.defineProperty;var e=(p,r)=>o(p,"name",{value:r,configurable:!0});var a=e(({children:p})=>jsx("div",{className:"demo-wrapper",children:p}),"DemoWrapper"),d=a;
4
+
5
+ export { d as default };
6
+ //# sourceMappingURL=demo-wrapper.mjs.map
11
7
  //# sourceMappingURL=demo-wrapper.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/demo-wrapper.tsx"],"sourcesContent":["import type { DemoWrapperProps } from './types';\n\nconst DemoWrapper = ({ children }: DemoWrapperProps) => (\n <div className=\"demo-wrapper\">{children}</div>\n);\n\nexport default DemoWrapper;\n"],"mappings":";;;;AAGE;AADF,IAAM,cAAc,wBAAC,EAAE,SAAS,MAC9B,oBAAC,SAAI,WAAU,gBAAgB,UAAS,GADtB;AAIpB,IAAO,uBAAQ;","names":[]}
1
+ {"version":3,"sources":["../src/demo-wrapper.tsx"],"names":["DemoWrapper","__name","children","jsx","demo_wrapper_default"],"mappings":";;AAGE,IAAA,CAAA,CAAA,MAAA,CAAA,cAAA,CAAA,IAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,GAAA,CAAA,CAAA,CAAA,CAAA,MAAA,CAAA,CAAA,KAAA,CAAA,CAAA,CAAA,YAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CADF,IAAMA,EAAcC,CAAA,CAAA,CAAC,CAAE,QAAAC,CAAAA,CAAS,CAC9BC,GAAAA,GAAAA,CAAC,OAAI,SAAU,CAAA,cAAA,CAAgB,SAAAD,CAAS,CAAA,CAAA,CADtB,eAIbE,CAAQJ,CAAAA","file":"demo-wrapper.mjs","sourcesContent":["import type { DemoWrapperProps } from './types';\n\nconst DemoWrapper = ({ children }: DemoWrapperProps) => (\n <div className=\"demo-wrapper\">{children}</div>\n);\n\nexport default DemoWrapper;\n"]}
@@ -1,96 +1,30 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
1
+ 'use strict';
29
2
 
30
- // src/error-catcher.tsx
31
- var error_catcher_exports = {};
32
- __export(error_catcher_exports, {
33
- default: () => ErrorCatcher
34
- });
35
- module.exports = __toCommonJS(error_catcher_exports);
36
- var React = __toESM(require("react"));
37
- var import_jsx_runtime = require("react/jsx-runtime");
38
- var ErrorCatcher = class extends React.Component {
39
- static {
40
- __name(this, "ErrorCatcher");
41
- }
42
- constructor(props) {
43
- super(props);
44
- this.state = {
45
- hasError: false,
46
- componentStack: "",
47
- error: null
48
- };
49
- }
50
- static getDerivedStateFromError(error) {
51
- return {
52
- hasError: true
53
- };
54
- }
55
- componentDidCatch(error, errorInfo) {
56
- const { componentStack } = errorInfo;
57
- this.setState({
58
- error,
59
- componentStack
60
- });
61
- }
62
- render() {
63
- if (this.state.hasError) {
64
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
65
- "div",
66
- {
67
- style: {
68
- padding: "5px"
69
- },
70
- children: [
71
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h5", { children: "Error caught in React Components" }),
72
- this.state.error?.name && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("h5", { children: [
73
- "Error Name: ",
74
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("code", { children: this.state.error?.name })
75
- ] }),
76
- this.state.error?.message && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("h5", { children: [
77
- "Message:",
78
- this.state.error?.message
79
- ] }),
80
- this.state.componentStack && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
81
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h6", { children: "Component Stack:" }),
82
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("pre", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("code", { children: this.state.componentStack }) }),
83
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("br", {})
84
- ] }),
85
- this.state.error?.stack && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
86
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h6", { children: "Error Stack:" }),
87
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("pre", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("code", { children: this.state.error?.stack }) })
88
- ] })
89
- ]
90
- }
91
- );
92
- }
93
- return this.props.children;
94
- }
95
- };
3
+ var n = require('react');
4
+ var jsxRuntime = require('react/jsx-runtime');
5
+
6
+ function _interopNamespace(e) {
7
+ if (e && e.__esModule) return e;
8
+ var n = Object.create(null);
9
+ if (e) {
10
+ Object.keys(e).forEach(function (k) {
11
+ if (k !== 'default') {
12
+ var d = Object.getOwnPropertyDescriptor(e, k);
13
+ Object.defineProperty(n, k, d.get ? d : {
14
+ enumerable: true,
15
+ get: function () { return e[k]; }
16
+ });
17
+ }
18
+ });
19
+ }
20
+ n.default = e;
21
+ return Object.freeze(n);
22
+ }
23
+
24
+ var n__namespace = /*#__PURE__*/_interopNamespace(n);
25
+
26
+ var d=Object.defineProperty;var a=(s,t)=>d(s,"name",{value:t,configurable:!0});var o=class extends n__namespace.Component{static{a(this,"ErrorCatcher");}constructor(t){super(t),this.state={hasError:!1,componentStack:"",error:null};}static getDerivedStateFromError(t){return {hasError:!0}}componentDidCatch(t,h){let{componentStack:i}=h;this.setState({error:t,componentStack:i});}render(){return this.state.hasError?jsxRuntime.jsxs("div",{style:{padding:"5px"},children:[jsxRuntime.jsx("h5",{children:"Error caught in React Components"}),this.state.error?.name&&jsxRuntime.jsxs("h5",{children:["Error Name: ",jsxRuntime.jsx("code",{children:this.state.error?.name})]}),this.state.error?.message&&jsxRuntime.jsxs("h5",{children:["Message:",this.state.error?.message]}),this.state.componentStack&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("h6",{children:"Component Stack:"}),jsxRuntime.jsx("pre",{children:jsxRuntime.jsx("code",{children:this.state.componentStack})}),jsxRuntime.jsx("br",{})]}),this.state.error?.stack&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("h6",{children:"Error Stack:"}),jsxRuntime.jsx("pre",{children:jsxRuntime.jsx("code",{children:this.state.error?.stack})})]})]}):this.props.children}};
27
+
28
+ module.exports = o;
29
+ //# sourceMappingURL=error-catcher.js.map
96
30
  //# sourceMappingURL=error-catcher.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/error-catcher.tsx"],"sourcesContent":["import * as React from 'react';\n\ntype State = {\n hasError: boolean;\n componentStack?: string;\n error?: Error;\n};\n\nexport default class ErrorCatcher extends React.Component<\n { children: React.ReactNode },\n State\n> {\n constructor(props) {\n super(props);\n this.state = {\n hasError: false,\n componentStack: '',\n error: null,\n };\n }\n\n static getDerivedStateFromError(error: Error) {\n // Update state so the next render will show the fallback UI.\n return {\n hasError: true,\n };\n }\n\n override componentDidCatch(error: Error, errorInfo: React.ErrorInfo): void {\n const { componentStack } = errorInfo;\n this.setState({\n error,\n componentStack,\n });\n }\n\n override render() {\n if (this.state.hasError) {\n return (\n <div\n style={{\n padding: '5px',\n }}\n >\n <h5>Error caught in React Components</h5>\n {this.state.error?.name && (\n <h5>\n Error Name: <code>{this.state.error?.name}</code>\n </h5>\n )}\n {this.state.error?.message && (\n <h5>\n Message:\n {this.state.error?.message}\n </h5>\n )}\n {this.state.componentStack && (\n <>\n <h6>Component Stack:</h6>\n <pre>\n <code>{this.state.componentStack}</code>\n </pre>\n <br />\n </>\n )}\n {this.state.error?.stack && (\n <>\n <h6>Error Stack:</h6>\n <pre>\n <code>{this.state.error?.stack}</code>\n </pre>\n </>\n )}\n </div>\n );\n }\n\n return this.props.children;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,YAAuB;AA4Cb;AApCV,IAAqB,eAArB,cAAgD,gBAG9C;AAAA,EAXF,OAWE;AAAA;AAAA;AAAA,EACA,YAAY,OAAO;AACjB,UAAM,KAAK;AACX,SAAK,QAAQ;AAAA,MACX,UAAU;AAAA,MACV,gBAAgB;AAAA,MAChB,OAAO;AAAA,IACT;AAAA,EACF;AAAA,EAEA,OAAO,yBAAyB,OAAc;AAE5C,WAAO;AAAA,MACL,UAAU;AAAA,IACZ;AAAA,EACF;AAAA,EAES,kBAAkB,OAAc,WAAkC;AACzE,UAAM,EAAE,eAAe,IAAI;AAC3B,SAAK,SAAS;AAAA,MACZ;AAAA,MACA;AAAA,IACF,CAAC;AAAA,EACH;AAAA,EAES,SAAS;AAChB,QAAI,KAAK,MAAM,UAAU;AACvB,aACE;AAAA,QAAC;AAAA;AAAA,UACC,OAAO;AAAA,YACL,SAAS;AAAA,UACX;AAAA,UAEA;AAAA,wDAAC,QAAG,8CAAgC;AAAA,YACnC,KAAK,MAAM,OAAO,QACjB,6CAAC,QAAG;AAAA;AAAA,cACU,4CAAC,UAAM,eAAK,MAAM,OAAO,MAAK;AAAA,eAC5C;AAAA,YAED,KAAK,MAAM,OAAO,WACjB,6CAAC,QAAG;AAAA;AAAA,cAED,KAAK,MAAM,OAAO;AAAA,eACrB;AAAA,YAED,KAAK,MAAM,kBACV,4EACE;AAAA,0DAAC,QAAG,8BAAgB;AAAA,cACpB,4CAAC,SACC,sDAAC,UAAM,eAAK,MAAM,gBAAe,GACnC;AAAA,cACA,4CAAC,QAAG;AAAA,eACN;AAAA,YAED,KAAK,MAAM,OAAO,SACjB,4EACE;AAAA,0DAAC,QAAG,0BAAY;AAAA,cAChB,4CAAC,SACC,sDAAC,UAAM,eAAK,MAAM,OAAO,OAAM,GACjC;AAAA,eACF;AAAA;AAAA;AAAA,MAEJ;AAAA,IAEJ;AAEA,WAAO,KAAK,MAAM;AAAA,EACpB;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/error-catcher.tsx"],"names":["ErrorCatcher","n","__name","props","error","errorInfo","componentStack","jsxs","jsx","Fragment"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAA,CAAA,CAAA,MAAA,CAAA,cAAA,CAAA,IAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,GAAA,CAAA,CAAA,CAAA,CAAA,MAAA,CAAA,CAAA,KAAA,CAAA,CAAA,CAAA,YAAA,CAAA,CAAA,CAAA,CAAA,CAAA,KAQqBA,CAArB,CAAA,cAAgDC,sBAG9C,CAXF,OAWEC,CAAA,CAAA,IAAA,CAAA,cAAA,EAAA,CACA,WAAYC,CAAAA,CAAAA,CAAO,CACjB,KAAMA,CAAAA,CAAK,CACX,CAAA,IAAA,CAAK,MAAQ,CACX,QAAA,CAAU,CACV,CAAA,CAAA,cAAA,CAAgB,GAChB,KAAO,CAAA,IACT,EACF,CAEA,OAAO,yBAAyBC,CAAc,CAAA,CAE5C,OAAO,CACL,SAAU,CACZ,CAAA,CACF,CAES,iBAAA,CAAkBA,EAAcC,CAAkC,CAAA,CACzE,GAAM,CAAE,eAAAC,CAAe,CAAA,CAAID,EAC3B,IAAK,CAAA,QAAA,CAAS,CACZ,KAAAD,CAAAA,CAAAA,CACA,cAAAE,CAAAA,CACF,CAAC,EACH,CAES,MAAS,EAAA,CAChB,OAAI,IAAK,CAAA,KAAA,CAAM,QAEXC,CAAAA,eAAAA,CAAC,OACC,KAAO,CAAA,CACL,QAAS,KACX,CAAA,CAEA,UAAAC,cAAC,CAAA,IAAA,CAAA,CAAG,QAAgC,CAAA,kCAAA,CAAA,CAAA,CACnC,KAAK,KAAM,CAAA,KAAA,EAAO,IACjBD,EAAAA,eAAAA,CAAC,MAAG,QACUC,CAAAA,CAAAA,cAAAA,CAAAA,cAAAA,CAAC,MAAM,CAAA,CAAA,QAAA,CAAA,IAAA,CAAK,MAAM,KAAO,EAAA,IAAA,CAAK,GAC5C,CAED,CAAA,IAAA,CAAK,MAAM,KAAO,EAAA,OAAA,EACjBD,eAAC,CAAA,IAAA,CAAA,CAAG,qBAED,IAAK,CAAA,KAAA,CAAM,KAAO,EAAA,OAAA,CAAA,CACrB,EAED,IAAK,CAAA,KAAA,CAAM,cACVA,EAAAA,eAAAA,CAAAE,oBAAA,CACE,QAAA,CAAA,CAAAD,eAAC,IAAG,CAAA,CAAA,QAAA,CAAA,kBAAA,CAAgB,EACpBA,cAAC,CAAA,KAAA,CAAA,CACC,QAAAA,CAAAA,cAAAA,CAAC,QAAM,QAAK,CAAA,IAAA,CAAA,KAAA,CAAM,cAAe,CAAA,CAAA,CACnC,EACAA,cAAC,CAAA,IAAA,CAAA,EAAG,CACN,CAAA,CAAA,CAAA,CAED,KAAK,KAAM,CAAA,KAAA,EAAO,OACjBD,eAAAE,CAAAA,mBAAAA,CAAA,CACE,QAAAD,CAAAA,CAAAA,cAAAA,CAAC,IAAG,CAAA,CAAA,QAAA,CAAA,cAAA,CAAY,EAChBA,cAAC,CAAA,KAAA,CAAA,CACC,QAAAA,CAAAA,cAAAA,CAAC,QAAM,QAAK,CAAA,IAAA,CAAA,KAAA,CAAM,KAAO,EAAA,KAAA,CAAM,EACjC,CACF,CAAA,CAAA,CAAA,CAAA,CAEJ,EAIG,IAAK,CAAA,KAAA,CAAM,QACpB,CACF","file":"error-catcher.js","sourcesContent":["import * as React from 'react';\n\ntype State = {\n hasError: boolean;\n componentStack?: string;\n error?: Error;\n};\n\nexport default class ErrorCatcher extends React.Component<\n { children: React.ReactNode },\n State\n> {\n constructor(props) {\n super(props);\n this.state = {\n hasError: false,\n componentStack: '',\n error: null,\n };\n }\n\n static getDerivedStateFromError(error: Error) {\n // Update state so the next render will show the fallback UI.\n return {\n hasError: true,\n };\n }\n\n override componentDidCatch(error: Error, errorInfo: React.ErrorInfo): void {\n const { componentStack } = errorInfo;\n this.setState({\n error,\n componentStack,\n });\n }\n\n override render() {\n if (this.state.hasError) {\n return (\n <div\n style={{\n padding: '5px',\n }}\n >\n <h5>Error caught in React Components</h5>\n {this.state.error?.name && (\n <h5>\n Error Name: <code>{this.state.error?.name}</code>\n </h5>\n )}\n {this.state.error?.message && (\n <h5>\n Message:\n {this.state.error?.message}\n </h5>\n )}\n {this.state.componentStack && (\n <>\n <h6>Component Stack:</h6>\n <pre>\n <code>{this.state.componentStack}</code>\n </pre>\n <br />\n </>\n )}\n {this.state.error?.stack && (\n <>\n <h6>Error Stack:</h6>\n <pre>\n <code>{this.state.error?.stack}</code>\n </pre>\n </>\n )}\n </div>\n );\n }\n\n return this.props.children;\n }\n}\n"]}
@@ -1,68 +1,8 @@
1
- var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
1
+ import * as n from 'react';
2
+ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
3
3
 
4
- // src/error-catcher.tsx
5
- import * as React from "react";
6
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
7
- var ErrorCatcher = class extends React.Component {
8
- static {
9
- __name(this, "ErrorCatcher");
10
- }
11
- constructor(props) {
12
- super(props);
13
- this.state = {
14
- hasError: false,
15
- componentStack: "",
16
- error: null
17
- };
18
- }
19
- static getDerivedStateFromError(error) {
20
- return {
21
- hasError: true
22
- };
23
- }
24
- componentDidCatch(error, errorInfo) {
25
- const { componentStack } = errorInfo;
26
- this.setState({
27
- error,
28
- componentStack
29
- });
30
- }
31
- render() {
32
- if (this.state.hasError) {
33
- return /* @__PURE__ */ jsxs(
34
- "div",
35
- {
36
- style: {
37
- padding: "5px"
38
- },
39
- children: [
40
- /* @__PURE__ */ jsx("h5", { children: "Error caught in React Components" }),
41
- this.state.error?.name && /* @__PURE__ */ jsxs("h5", { children: [
42
- "Error Name: ",
43
- /* @__PURE__ */ jsx("code", { children: this.state.error?.name })
44
- ] }),
45
- this.state.error?.message && /* @__PURE__ */ jsxs("h5", { children: [
46
- "Message:",
47
- this.state.error?.message
48
- ] }),
49
- this.state.componentStack && /* @__PURE__ */ jsxs(Fragment, { children: [
50
- /* @__PURE__ */ jsx("h6", { children: "Component Stack:" }),
51
- /* @__PURE__ */ jsx("pre", { children: /* @__PURE__ */ jsx("code", { children: this.state.componentStack }) }),
52
- /* @__PURE__ */ jsx("br", {})
53
- ] }),
54
- this.state.error?.stack && /* @__PURE__ */ jsxs(Fragment, { children: [
55
- /* @__PURE__ */ jsx("h6", { children: "Error Stack:" }),
56
- /* @__PURE__ */ jsx("pre", { children: /* @__PURE__ */ jsx("code", { children: this.state.error?.stack }) })
57
- ] })
58
- ]
59
- }
60
- );
61
- }
62
- return this.props.children;
63
- }
64
- };
65
- export {
66
- ErrorCatcher as default
67
- };
4
+ var d=Object.defineProperty;var a=(s,t)=>d(s,"name",{value:t,configurable:!0});var o=class extends n.Component{static{a(this,"ErrorCatcher");}constructor(t){super(t),this.state={hasError:!1,componentStack:"",error:null};}static getDerivedStateFromError(t){return {hasError:!0}}componentDidCatch(t,h){let{componentStack:i}=h;this.setState({error:t,componentStack:i});}render(){return this.state.hasError?jsxs("div",{style:{padding:"5px"},children:[jsx("h5",{children:"Error caught in React Components"}),this.state.error?.name&&jsxs("h5",{children:["Error Name: ",jsx("code",{children:this.state.error?.name})]}),this.state.error?.message&&jsxs("h5",{children:["Message:",this.state.error?.message]}),this.state.componentStack&&jsxs(Fragment,{children:[jsx("h6",{children:"Component Stack:"}),jsx("pre",{children:jsx("code",{children:this.state.componentStack})}),jsx("br",{})]}),this.state.error?.stack&&jsxs(Fragment,{children:[jsx("h6",{children:"Error Stack:"}),jsx("pre",{children:jsx("code",{children:this.state.error?.stack})})]})]}):this.props.children}};
5
+
6
+ export { o as default };
7
+ //# sourceMappingURL=error-catcher.mjs.map
68
8
  //# sourceMappingURL=error-catcher.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/error-catcher.tsx"],"sourcesContent":["import * as React from 'react';\n\ntype State = {\n hasError: boolean;\n componentStack?: string;\n error?: Error;\n};\n\nexport default class ErrorCatcher extends React.Component<\n { children: React.ReactNode },\n State\n> {\n constructor(props) {\n super(props);\n this.state = {\n hasError: false,\n componentStack: '',\n error: null,\n };\n }\n\n static getDerivedStateFromError(error: Error) {\n // Update state so the next render will show the fallback UI.\n return {\n hasError: true,\n };\n }\n\n override componentDidCatch(error: Error, errorInfo: React.ErrorInfo): void {\n const { componentStack } = errorInfo;\n this.setState({\n error,\n componentStack,\n });\n }\n\n override render() {\n if (this.state.hasError) {\n return (\n <div\n style={{\n padding: '5px',\n }}\n >\n <h5>Error caught in React Components</h5>\n {this.state.error?.name && (\n <h5>\n Error Name: <code>{this.state.error?.name}</code>\n </h5>\n )}\n {this.state.error?.message && (\n <h5>\n Message:\n {this.state.error?.message}\n </h5>\n )}\n {this.state.componentStack && (\n <>\n <h6>Component Stack:</h6>\n <pre>\n <code>{this.state.componentStack}</code>\n </pre>\n <br />\n </>\n )}\n {this.state.error?.stack && (\n <>\n <h6>Error Stack:</h6>\n <pre>\n <code>{this.state.error?.stack}</code>\n </pre>\n </>\n )}\n </div>\n );\n }\n\n return this.props.children;\n }\n}\n"],"mappings":";;;;AAAA,YAAY,WAAW;AA4Cb,SAaE,UAbF,KAEE,YAFF;AApCV,IAAqB,eAArB,cAAgD,gBAG9C;AAAA,EAXF,OAWE;AAAA;AAAA;AAAA,EACA,YAAY,OAAO;AACjB,UAAM,KAAK;AACX,SAAK,QAAQ;AAAA,MACX,UAAU;AAAA,MACV,gBAAgB;AAAA,MAChB,OAAO;AAAA,IACT;AAAA,EACF;AAAA,EAEA,OAAO,yBAAyB,OAAc;AAE5C,WAAO;AAAA,MACL,UAAU;AAAA,IACZ;AAAA,EACF;AAAA,EAES,kBAAkB,OAAc,WAAkC;AACzE,UAAM,EAAE,eAAe,IAAI;AAC3B,SAAK,SAAS;AAAA,MACZ;AAAA,MACA;AAAA,IACF,CAAC;AAAA,EACH;AAAA,EAES,SAAS;AAChB,QAAI,KAAK,MAAM,UAAU;AACvB,aACE;AAAA,QAAC;AAAA;AAAA,UACC,OAAO;AAAA,YACL,SAAS;AAAA,UACX;AAAA,UAEA;AAAA,gCAAC,QAAG,8CAAgC;AAAA,YACnC,KAAK,MAAM,OAAO,QACjB,qBAAC,QAAG;AAAA;AAAA,cACU,oBAAC,UAAM,eAAK,MAAM,OAAO,MAAK;AAAA,eAC5C;AAAA,YAED,KAAK,MAAM,OAAO,WACjB,qBAAC,QAAG;AAAA;AAAA,cAED,KAAK,MAAM,OAAO;AAAA,eACrB;AAAA,YAED,KAAK,MAAM,kBACV,iCACE;AAAA,kCAAC,QAAG,8BAAgB;AAAA,cACpB,oBAAC,SACC,8BAAC,UAAM,eAAK,MAAM,gBAAe,GACnC;AAAA,cACA,oBAAC,QAAG;AAAA,eACN;AAAA,YAED,KAAK,MAAM,OAAO,SACjB,iCACE;AAAA,kCAAC,QAAG,0BAAY;AAAA,cAChB,oBAAC,SACC,8BAAC,UAAM,eAAK,MAAM,OAAO,OAAM,GACjC;AAAA,eACF;AAAA;AAAA;AAAA,MAEJ;AAAA,IAEJ;AAEA,WAAO,KAAK,MAAM;AAAA,EACpB;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/error-catcher.tsx"],"names":["ErrorCatcher","__name","props","error","errorInfo","componentStack","jsxs","jsx","Fragment"],"mappings":";;;AAAA,IAAA,CAAA,CAAA,MAAA,CAAA,cAAA,CAAA,IAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,GAAA,CAAA,CAAA,CAAA,CAAA,MAAA,CAAA,CAAA,KAAA,CAAA,CAAA,CAAA,YAAA,CAAA,CAAA,CAAA,CAAA,CAAA,KAQqBA,CAArB,CAAA,cAAgD,WAG9C,CAXF,OAWEC,CAAA,CAAA,IAAA,CAAA,cAAA,EAAA,CACA,WAAYC,CAAAA,CAAAA,CAAO,CACjB,KAAMA,CAAAA,CAAK,CACX,CAAA,IAAA,CAAK,MAAQ,CACX,QAAA,CAAU,CACV,CAAA,CAAA,cAAA,CAAgB,GAChB,KAAO,CAAA,IACT,EACF,CAEA,OAAO,yBAAyBC,CAAc,CAAA,CAE5C,OAAO,CACL,SAAU,CACZ,CAAA,CACF,CAES,iBAAA,CAAkBA,EAAcC,CAAkC,CAAA,CACzE,GAAM,CAAE,eAAAC,CAAe,CAAA,CAAID,EAC3B,IAAK,CAAA,QAAA,CAAS,CACZ,KAAAD,CAAAA,CAAAA,CACA,cAAAE,CAAAA,CACF,CAAC,EACH,CAES,MAAS,EAAA,CAChB,OAAI,IAAK,CAAA,KAAA,CAAM,QAEXC,CAAAA,IAAAA,CAAC,OACC,KAAO,CAAA,CACL,QAAS,KACX,CAAA,CAEA,UAAAC,GAAC,CAAA,IAAA,CAAA,CAAG,QAAgC,CAAA,kCAAA,CAAA,CAAA,CACnC,KAAK,KAAM,CAAA,KAAA,EAAO,IACjBD,EAAAA,IAAAA,CAAC,MAAG,QACUC,CAAAA,CAAAA,cAAAA,CAAAA,GAAAA,CAAC,MAAM,CAAA,CAAA,QAAA,CAAA,IAAA,CAAK,MAAM,KAAO,EAAA,IAAA,CAAK,GAC5C,CAED,CAAA,IAAA,CAAK,MAAM,KAAO,EAAA,OAAA,EACjBD,IAAC,CAAA,IAAA,CAAA,CAAG,qBAED,IAAK,CAAA,KAAA,CAAM,KAAO,EAAA,OAAA,CAAA,CACrB,EAED,IAAK,CAAA,KAAA,CAAM,cACVA,EAAAA,IAAAA,CAAAE,SAAA,CACE,QAAA,CAAA,CAAAD,IAAC,IAAG,CAAA,CAAA,QAAA,CAAA,kBAAA,CAAgB,EACpBA,GAAC,CAAA,KAAA,CAAA,CACC,QAAAA,CAAAA,GAAAA,CAAC,QAAM,QAAK,CAAA,IAAA,CAAA,KAAA,CAAM,cAAe,CAAA,CAAA,CACnC,EACAA,GAAC,CAAA,IAAA,CAAA,EAAG,CACN,CAAA,CAAA,CAAA,CAED,KAAK,KAAM,CAAA,KAAA,EAAO,OACjBD,IAAAE,CAAAA,QAAAA,CAAA,CACE,QAAAD,CAAAA,CAAAA,GAAAA,CAAC,IAAG,CAAA,CAAA,QAAA,CAAA,cAAA,CAAY,EAChBA,GAAC,CAAA,KAAA,CAAA,CACC,QAAAA,CAAAA,GAAAA,CAAC,QAAM,QAAK,CAAA,IAAA,CAAA,KAAA,CAAM,KAAO,EAAA,KAAA,CAAM,EACjC,CACF,CAAA,CAAA,CAAA,CAAA,CAEJ,EAIG,IAAK,CAAA,KAAA,CAAM,QACpB,CACF","file":"error-catcher.mjs","sourcesContent":["import * as React from 'react';\n\ntype State = {\n hasError: boolean;\n componentStack?: string;\n error?: Error;\n};\n\nexport default class ErrorCatcher extends React.Component<\n { children: React.ReactNode },\n State\n> {\n constructor(props) {\n super(props);\n this.state = {\n hasError: false,\n componentStack: '',\n error: null,\n };\n }\n\n static getDerivedStateFromError(error: Error) {\n // Update state so the next render will show the fallback UI.\n return {\n hasError: true,\n };\n }\n\n override componentDidCatch(error: Error, errorInfo: React.ErrorInfo): void {\n const { componentStack } = errorInfo;\n this.setState({\n error,\n componentStack,\n });\n }\n\n override render() {\n if (this.state.hasError) {\n return (\n <div\n style={{\n padding: '5px',\n }}\n >\n <h5>Error caught in React Components</h5>\n {this.state.error?.name && (\n <h5>\n Error Name: <code>{this.state.error?.name}</code>\n </h5>\n )}\n {this.state.error?.message && (\n <h5>\n Message:\n {this.state.error?.message}\n </h5>\n )}\n {this.state.componentStack && (\n <>\n <h6>Component Stack:</h6>\n <pre>\n <code>{this.state.componentStack}</code>\n </pre>\n <br />\n </>\n )}\n {this.state.error?.stack && (\n <>\n <h6>Error Stack:</h6>\n <pre>\n <code>{this.state.error?.stack}</code>\n </pre>\n </>\n )}\n </div>\n );\n }\n\n return this.props.children;\n }\n}\n"]}