@knapsack/renderer-react 4.70.0--canary.3797.b249674.0 → 4.70.0--canary.4821.e250df4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/init.js +66 -15
- package/dist/client/init.js.map +1 -1
- package/dist/client/init.mjs +71 -10
- package/dist/client/init.mjs.map +1 -1
- package/dist/demo-wrapper.d.mts +1 -2
- package/dist/demo-wrapper.d.ts +1 -2
- package/dist/demo-wrapper.js +27 -7
- package/dist/demo-wrapper.js.map +1 -1
- package/dist/demo-wrapper.mjs +9 -5
- package/dist/demo-wrapper.mjs.map +1 -1
- package/dist/error-catcher.js +94 -28
- package/dist/error-catcher.js.map +1 -1
- package/dist/error-catcher.mjs +66 -6
- package/dist/error-catcher.mjs.map +1 -1
- package/dist/index.d.mts +6 -7
- package/dist/index.d.ts +6 -7
- package/dist/index.js +1287 -42
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1296 -37
- package/dist/index.mjs.map +1 -1
- package/dist/prototype-template.js +26 -5
- package/dist/prototype-template.js.map +1 -1
- package/dist/prototype-template.mjs +8 -3
- package/dist/prototype-template.mjs.map +1 -1
- package/dist/types-CivTHEEo.d.mts +10 -0
- package/dist/types-CivTHEEo.d.ts +10 -0
- package/package.json +13 -13
- package/dist/types-D2eCZXsg.d.mts +0 -13
- package/dist/types-D2eCZXsg.d.ts +0 -13
package/dist/client/init.js
CHANGED
@@ -1,20 +1,71 @@
|
|
1
|
-
|
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
|
+
));
|
2
24
|
|
3
|
-
|
4
|
-
var
|
5
|
-
var
|
6
|
-
var
|
25
|
+
// src/client/init.tsx
|
26
|
+
var import_react = __toESM(require("react"));
|
27
|
+
var import_client = __toESM(require("react-dom/client"));
|
28
|
+
var import_client2 = require("@knapsack/renderer-webpack-base/client");
|
7
29
|
|
8
|
-
|
30
|
+
// src/types.ts
|
31
|
+
var rendererMetaScriptTagId = "ks-react-meta";
|
9
32
|
|
10
|
-
|
11
|
-
var
|
12
|
-
|
13
|
-
|
33
|
+
// src/client/init.tsx
|
34
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
35
|
+
async function init() {
|
36
|
+
try {
|
37
|
+
const {
|
38
|
+
getNeededImports,
|
39
|
+
getExtraImports,
|
40
|
+
rendererMeta: { disableReactStrictMode, demoWrapperProps },
|
41
|
+
rendererMethods: { getDemoApp }
|
42
|
+
} = (0, import_client2.getKsRendererClientUtils)({
|
43
|
+
rendererMetaScriptTagId
|
44
|
+
});
|
45
|
+
const [neededImports, { DemoWrapper, ErrorCatcher }] = await Promise.all([
|
46
|
+
getNeededImports(),
|
47
|
+
getExtraImports()
|
48
|
+
]);
|
49
|
+
const root = document.getElementById("render-root");
|
50
|
+
if (!root) {
|
51
|
+
throw new Error("No root element found");
|
52
|
+
}
|
53
|
+
const demoComponents = neededImports;
|
54
|
+
const DemoApp = getDemoApp(demoComponents);
|
55
|
+
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, {}) }) });
|
56
|
+
import_client.default.createRoot(root).render(
|
57
|
+
disableReactStrictMode ? app : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.default.StrictMode, { children: app })
|
58
|
+
);
|
59
|
+
} catch (e) {
|
60
|
+
console.error(e);
|
61
|
+
const errorElement = document.createElement("div");
|
62
|
+
errorElement.innerHTML = `
|
14
63
|
<h1>Error</h1>
|
15
|
-
<p>${
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
64
|
+
<p>${e.message}</p>
|
65
|
+
`;
|
66
|
+
document.body.appendChild(errorElement);
|
67
|
+
}
|
68
|
+
}
|
69
|
+
__name(init, "init");
|
70
|
+
init();
|
20
71
|
//# sourceMappingURL=init.js.map
|
package/dist/client/init.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../src/
|
1
|
+
{"version":3,"sources":["../../src/client/init.tsx","../../src/types.ts"],"sourcesContent":["/// <reference lib=\"dom\" />\nimport React from 'react';\nimport ReactDOM from 'react-dom/client';\nimport { getKsRendererClientUtils } from '@knapsack/renderer-webpack-base/client';\nimport {\n rendererMetaScriptTagId,\n type KsReactMeta,\n type Component,\n type RendererMethods,\n} from '../types';\n\nasync function init() {\n try {\n const {\n getNeededImports,\n getExtraImports,\n rendererMeta: { disableReactStrictMode, demoWrapperProps },\n rendererMethods: { getDemoApp },\n } = getKsRendererClientUtils<Component, KsReactMeta, RendererMethods>({\n rendererMetaScriptTagId,\n });\n const [neededImports, { DemoWrapper, ErrorCatcher }] = await Promise.all([\n getNeededImports(),\n getExtraImports(),\n ]);\n const root = document.getElementById('render-root');\n if (!root) {\n throw new Error('No root element found');\n }\n const demoComponents = neededImports;\n const DemoApp = 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 } 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}\n\ninit();\n","import type { Demo, Except } from '@knapsack/types';\nimport type { ComponentType } from 'react';\nimport type { RendererMetaBase } from '@knapsack/renderer-webpack-base/client';\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 demo: Demo;\n patternId: string;\n templateId: string;\n};\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<'DemoWrapper' | 'ErrorCatcher'>;\n\nexport const rendererMetaScriptTagId = 'ks-react-meta';\n\nexport type RendererMethods = {\n getDemoApp: (components: Record<string, Component>) => Component;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AACA,mBAAkB;AAClB,oBAAqB;AACrB,IAAAA,iBAAyC;;;ACwBlC,IAAM,0BAA0B;;;ADO7B;AAvBV,eAAe,OAAO;AACpB,MAAI;AACF,UAAM;AAAA,MACJ;AAAA,MACA;AAAA,MACA,cAAc,EAAE,wBAAwB,iBAAiB;AAAA,MACzD,iBAAiB,EAAE,WAAW;AAAA,IAChC,QAAI,yCAAkE;AAAA,MACpE;AAAA,IACF,CAAC;AACD,UAAM,CAAC,eAAe,EAAE,aAAa,aAAa,CAAC,IAAI,MAAM,QAAQ,IAAI;AAAA,MACvE,iBAAiB;AAAA,MACjB,gBAAgB;AAAA,IAClB,CAAC;AACD,UAAM,OAAO,SAAS,eAAe,aAAa;AAClD,QAAI,CAAC,MAAM;AACT,YAAM,IAAI,MAAM,uBAAuB;AAAA,IACzC;AACA,UAAM,iBAAiB;AACvB,UAAM,UAAU,WAAW,cAAc;AACzC,UAAM,MACJ,4CAAC,gBACC,sDAAC,eAAa,GAAG,kBACf,sDAAC,WAAQ,GACX,GACF;AAGF,kBAAAC,QAAS,WAAW,IAAI,EAAE;AAAA,MACxB,yBAAyB,MAAM,4CAAC,aAAAC,QAAM,YAAN,EAAkB,eAAI;AAAA,IACxD;AAAA,EACF,SAAS,GAAG;AACV,YAAQ,MAAM,CAAC;AAEf,UAAM,eAAe,SAAS,cAAc,KAAK;AACjD,iBAAa,YAAY;AAAA;AAAA,SAEpB,EAAE,OAAO;AAAA;AAEd,aAAS,KAAK,YAAY,YAAY;AAAA,EACxC;AACF;AAzCe;AA2Cf,KAAK;","names":["import_client","ReactDOM","React"]}
|
package/dist/client/init.mjs
CHANGED
@@ -1,13 +1,74 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
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
|
+
};
|
5
10
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
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
|
+
});
|
10
25
|
|
11
|
-
|
12
|
-
|
26
|
+
// src/client/init.tsx
|
27
|
+
import React from "react";
|
28
|
+
import ReactDOM from "react-dom/client";
|
29
|
+
import { getKsRendererClientUtils } from "@knapsack/renderer-webpack-base/client";
|
30
|
+
import { jsx } from "react/jsx-runtime";
|
31
|
+
var require_init = __commonJS({
|
32
|
+
"src/client/init.tsx"() {
|
33
|
+
init_esm_shims();
|
34
|
+
init_types();
|
35
|
+
async function init() {
|
36
|
+
try {
|
37
|
+
const {
|
38
|
+
getNeededImports,
|
39
|
+
getExtraImports,
|
40
|
+
rendererMeta: { disableReactStrictMode, demoWrapperProps },
|
41
|
+
rendererMethods: { getDemoApp }
|
42
|
+
} = getKsRendererClientUtils({
|
43
|
+
rendererMetaScriptTagId
|
44
|
+
});
|
45
|
+
const [neededImports, { DemoWrapper, ErrorCatcher }] = await Promise.all([
|
46
|
+
getNeededImports(),
|
47
|
+
getExtraImports()
|
48
|
+
]);
|
49
|
+
const root = document.getElementById("render-root");
|
50
|
+
if (!root) {
|
51
|
+
throw new Error("No root element found");
|
52
|
+
}
|
53
|
+
const demoComponents = neededImports;
|
54
|
+
const DemoApp = getDemoApp(demoComponents);
|
55
|
+
const app = /* @__PURE__ */ jsx(ErrorCatcher, { children: /* @__PURE__ */ jsx(DemoWrapper, { ...demoWrapperProps, children: /* @__PURE__ */ jsx(DemoApp, {}) }) });
|
56
|
+
ReactDOM.createRoot(root).render(
|
57
|
+
disableReactStrictMode ? app : /* @__PURE__ */ jsx(React.StrictMode, { children: app })
|
58
|
+
);
|
59
|
+
} catch (e) {
|
60
|
+
console.error(e);
|
61
|
+
const errorElement = document.createElement("div");
|
62
|
+
errorElement.innerHTML = `
|
63
|
+
<h1>Error</h1>
|
64
|
+
<p>${e.message}</p>
|
65
|
+
`;
|
66
|
+
document.body.appendChild(errorElement);
|
67
|
+
}
|
68
|
+
}
|
69
|
+
__name(init, "init");
|
70
|
+
init();
|
71
|
+
}
|
72
|
+
});
|
73
|
+
export default require_init();
|
13
74
|
//# sourceMappingURL=init.mjs.map
|
package/dist/client/init.mjs.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["
|
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/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';\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 demo: Demo;\n patternId: string;\n templateId: string;\n};\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<'DemoWrapper' | 'ErrorCatcher'>;\n\nexport const rendererMetaScriptTagId = 'ks-react-meta';\n\nexport type RendererMethods = {\n getDemoApp: (components: Record<string, Component>) => Component;\n};\n","/// <reference lib=\"dom\" />\nimport React from 'react';\nimport ReactDOM from 'react-dom/client';\nimport { getKsRendererClientUtils } from '@knapsack/renderer-webpack-base/client';\nimport {\n rendererMetaScriptTagId,\n type KsReactMeta,\n type Component,\n type RendererMethods,\n} from '../types';\n\nasync function init() {\n try {\n const {\n getNeededImports,\n getExtraImports,\n rendererMeta: { disableReactStrictMode, demoWrapperProps },\n rendererMethods: { getDemoApp },\n } = getKsRendererClientUtils<Component, KsReactMeta, RendererMethods>({\n rendererMetaScriptTagId,\n });\n const [neededImports, { DemoWrapper, ErrorCatcher }] = await Promise.all([\n getNeededImports(),\n getExtraImports(),\n ]);\n const root = document.getElementById('render-root');\n if (!root) {\n throw new Error('No root element found');\n }\n const demoComponents = neededImports;\n const DemoApp = 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 } 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}\n\ninit();\n"],"mappings":";;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;;;ACAA,IA2Ba;AA3Bb;AAAA;AAAA;AA2BO,IAAM,0BAA0B;AAAA;AAAA;;;AC1BvC,OAAO,WAAW;AAClB,OAAO,cAAc;AACrB,SAAS,gCAAgC;AA+B/B;AAlCV;AAAA;AAAA;AAIA;AAOA,mBAAe,OAAO;AACpB,UAAI;AACF,cAAM;AAAA,UACJ;AAAA,UACA;AAAA,UACA,cAAc,EAAE,wBAAwB,iBAAiB;AAAA,UACzD,iBAAiB,EAAE,WAAW;AAAA,QAChC,IAAI,yBAAkE;AAAA,UACpE;AAAA,QACF,CAAC;AACD,cAAM,CAAC,eAAe,EAAE,aAAa,aAAa,CAAC,IAAI,MAAM,QAAQ,IAAI;AAAA,UACvE,iBAAiB;AAAA,UACjB,gBAAgB;AAAA,QAClB,CAAC;AACD,cAAM,OAAO,SAAS,eAAe,aAAa;AAClD,YAAI,CAAC,MAAM;AACT,gBAAM,IAAI,MAAM,uBAAuB;AAAA,QACzC;AACA,cAAM,iBAAiB;AACvB,cAAM,UAAU,WAAW,cAAc;AACzC,cAAM,MACJ,oBAAC,gBACC,8BAAC,eAAa,GAAG,kBACf,8BAAC,WAAQ,GACX,GACF;AAGF,iBAAS,WAAW,IAAI,EAAE;AAAA,UACxB,yBAAyB,MAAM,oBAAC,MAAM,YAAN,EAAkB,eAAI;AAAA,QACxD;AAAA,MACF,SAAS,GAAG;AACV,gBAAQ,MAAM,CAAC;AAEf,cAAM,eAAe,SAAS,cAAc,KAAK;AACjD,qBAAa,YAAY;AAAA;AAAA,SAEpB,EAAE,OAAO;AAAA;AAEd,iBAAS,KAAK,YAAY,YAAY;AAAA,MACxC;AAAA,IACF;AAzCe;AA2Cf,SAAK;AAAA;AAAA;","names":[]}
|
package/dist/demo-wrapper.d.mts
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
2
|
-
import { D as DemoWrapperProps } from './types-
|
2
|
+
import { D as DemoWrapperProps } from './types-CivTHEEo.mjs';
|
3
3
|
import '@knapsack/types';
|
4
|
-
import '@knapsack/app/types';
|
5
4
|
|
6
5
|
declare const DemoWrapper: ({ children }: DemoWrapperProps) => react_jsx_runtime.JSX.Element;
|
7
6
|
|
package/dist/demo-wrapper.d.ts
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
2
|
-
import { D as DemoWrapperProps } from './types-
|
2
|
+
import { D as DemoWrapperProps } from './types-CivTHEEo.js';
|
3
3
|
import '@knapsack/types';
|
4
|
-
import '@knapsack/app/types';
|
5
4
|
|
6
5
|
declare const DemoWrapper: ({ children }: DemoWrapperProps) => react_jsx_runtime.JSX.Element;
|
7
6
|
|
package/dist/demo-wrapper.js
CHANGED
@@ -1,9 +1,29 @@
|
|
1
|
-
|
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);
|
2
19
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
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;
|
9
29
|
//# sourceMappingURL=demo-wrapper.js.map
|
package/dist/demo-wrapper.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../src/demo-wrapper.tsx"],"
|
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":[]}
|
package/dist/demo-wrapper.mjs
CHANGED
@@ -1,7 +1,11 @@
|
|
1
|
-
|
1
|
+
var __defProp = Object.defineProperty;
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
2
3
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
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
|
+
};
|
7
11
|
//# sourceMappingURL=demo-wrapper.mjs.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../src/demo-wrapper.tsx"],"
|
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":[]}
|
package/dist/error-catcher.js
CHANGED
@@ -1,30 +1,96 @@
|
|
1
|
-
|
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);
|
2
29
|
|
3
|
-
|
4
|
-
var
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
}
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
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
|
+
};
|
30
96
|
//# sourceMappingURL=error-catcher.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../src/error-catcher.tsx"],"
|
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":[]}
|
package/dist/error-catcher.mjs
CHANGED
@@ -1,8 +1,68 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
var __defProp = Object.defineProperty;
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
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
|
+
};
|
8
68
|
//# sourceMappingURL=error-catcher.mjs.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../src/error-catcher.tsx"],"
|
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":[]}
|
package/dist/index.d.mts
CHANGED
@@ -1,8 +1,7 @@
|
|
1
|
-
import { RendererWebpackBase, Renderer,
|
1
|
+
import { RendererWebpackBase, Renderer, KsJsImportMap } from '@knapsack/renderer-webpack-base';
|
2
2
|
import { Renderable } from '@knapsack/app/renderers';
|
3
3
|
import { RendererId } from '@knapsack/types';
|
4
|
-
|
5
|
-
export { D as DemoWrapperProps } from './types-D2eCZXsg.mjs';
|
4
|
+
export { D as DemoWrapperProps } from './types-CivTHEEo.mjs';
|
6
5
|
|
7
6
|
declare class KnapsackReactRenderer extends RendererWebpackBase implements Renderable {
|
8
7
|
/**
|
@@ -24,15 +23,15 @@ declare class KnapsackReactRenderer extends RendererWebpackBase implements Rende
|
|
24
23
|
id?: RendererId;
|
25
24
|
});
|
26
25
|
init: Renderer['init'];
|
26
|
+
hydrate: Renderer['hydrate'];
|
27
27
|
getMeta: Renderer['getMeta'];
|
28
28
|
changeCase: Renderer['changeCase'];
|
29
29
|
createWebpackConfig: RendererWebpackBase['createWebpackConfig'];
|
30
|
-
|
31
|
-
prepClientRenderResults({ usage, demoApp, imports: xImports, renderOptions: { pattern, template, demo }, }: {
|
30
|
+
prepClientRenderResults({ usage, demoApp, importMap, renderOptions: { demo, state, patternId, templateId }, }: {
|
32
31
|
usage: string;
|
33
32
|
demoApp: string;
|
34
|
-
|
35
|
-
renderOptions:
|
33
|
+
importMap: KsJsImportMap;
|
34
|
+
renderOptions: Parameters<Renderer['render']>[0];
|
36
35
|
}): ReturnType<Renderer['render']>;
|
37
36
|
render: Renderer['render'];
|
38
37
|
getUsageAndImports: RendererWebpackBase['getUsageAndImports'];
|