@knapsack/renderer-react 4.70.0--canary.4433.133de0f.0 → 4.70.0--canary.4854.b1d79a8.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +96 -0
- package/dist/client/init.d.mts +2 -0
- package/dist/client/init.d.ts +2 -0
- package/dist/client/init.js +82 -0
- package/dist/client/init.js.map +1 -0
- package/dist/client/init.mjs +90 -0
- package/dist/client/init.mjs.map +1 -0
- package/dist/demo-wrapper.d.mts +1 -3
- package/dist/demo-wrapper.d.ts +1 -3
- package/dist/demo-wrapper.js.map +1 -1
- package/dist/demo-wrapper.mjs.map +1 -1
- package/dist/error-catcher.js.map +1 -1
- package/dist/error-catcher.mjs.map +1 -1
- package/dist/index.d.mts +21 -36
- package/dist/index.d.ts +21 -36
- package/dist/index.js +109 -177
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +121 -186
- package/dist/index.mjs.map +1 -1
- package/dist/types-D2eCZXsg.d.mts +13 -0
- package/dist/types-D2eCZXsg.d.ts +13 -0
- package/package.json +20 -15
package/CHANGELOG.md
CHANGED
@@ -1,3 +1,99 @@
|
|
1
|
+
# v4.69.11 (Fri Sep 20 2024)
|
2
|
+
|
3
|
+
#### 🐛 Bug Fix
|
4
|
+
|
5
|
+
- Merge branch 'latest' into GormanDesign-patch-2 ([@GormanDesign](https://github.com/GormanDesign))
|
6
|
+
|
7
|
+
#### 🏠 Internal
|
8
|
+
|
9
|
+
- chore(deps): update dependency @types/react to ^18.3.8 [#4824](https://github.com/knapsack-labs/app-monorepo/pull/4824) ([@renovate[bot]](https://github.com/renovate[bot]))
|
10
|
+
- adds select all option to exclude patterns filters [#4803](https://github.com/knapsack-labs/app-monorepo/pull/4803) ([@GormanDesign](https://github.com/GormanDesign))
|
11
|
+
|
12
|
+
#### Authors: 2
|
13
|
+
|
14
|
+
- [@renovate[bot]](https://github.com/renovate[bot])
|
15
|
+
- Matt Gorman ([@GormanDesign](https://github.com/GormanDesign))
|
16
|
+
|
17
|
+
---
|
18
|
+
|
19
|
+
# v4.69.10 (Wed Sep 18 2024)
|
20
|
+
|
21
|
+
#### 🏠 Internal
|
22
|
+
|
23
|
+
- chore(deps): update dependency @types/react to ^18.3.7 [#4796](https://github.com/knapsack-labs/app-monorepo/pull/4796) ([@renovate[bot]](https://github.com/renovate[bot]))
|
24
|
+
|
25
|
+
#### Authors: 1
|
26
|
+
|
27
|
+
- [@renovate[bot]](https://github.com/renovate[bot])
|
28
|
+
|
29
|
+
---
|
30
|
+
|
31
|
+
# v4.69.9 (Sat Sep 14 2024)
|
32
|
+
|
33
|
+
#### 🐛 Bug Fix
|
34
|
+
|
35
|
+
- refactor Renderer clients [#4768](https://github.com/knapsack-labs/app-monorepo/pull/4768) ([@EvanLovely](https://github.com/EvanLovely))
|
36
|
+
|
37
|
+
#### 🏠 Internal
|
38
|
+
|
39
|
+
- update template stage ui [#4763](https://github.com/knapsack-labs/app-monorepo/pull/4763) ([@GormanDesign](https://github.com/GormanDesign))
|
40
|
+
- add spacing under form feedback banner [#4747](https://github.com/knapsack-labs/app-monorepo/pull/4747) ([@GormanDesign](https://github.com/GormanDesign))
|
41
|
+
|
42
|
+
#### Authors: 2
|
43
|
+
|
44
|
+
- Evan Lovely ([@EvanLovely](https://github.com/EvanLovely))
|
45
|
+
- Matt Gorman ([@GormanDesign](https://github.com/GormanDesign))
|
46
|
+
|
47
|
+
---
|
48
|
+
|
49
|
+
# v4.69.8 (Thu Sep 12 2024)
|
50
|
+
|
51
|
+
#### 🐛 Bug Fix
|
52
|
+
|
53
|
+
- refactor Renderers for cleaner types [#4746](https://github.com/knapsack-labs/app-monorepo/pull/4746) ([@EvanLovely](https://github.com/EvanLovely))
|
54
|
+
|
55
|
+
#### Authors: 1
|
56
|
+
|
57
|
+
- Evan Lovely ([@EvanLovely](https://github.com/EvanLovely))
|
58
|
+
|
59
|
+
---
|
60
|
+
|
61
|
+
# v4.69.7 (Wed Sep 11 2024)
|
62
|
+
|
63
|
+
#### 🐛 Bug Fix
|
64
|
+
|
65
|
+
- Merge branch 'latest' into feature/ksp-5497-setup-status-id-in-client ([@mabry1985](https://github.com/mabry1985))
|
66
|
+
|
67
|
+
#### 🏠 Internal
|
68
|
+
|
69
|
+
- fixes schema form select appearance [#4700](https://github.com/knapsack-labs/app-monorepo/pull/4700) ([@GormanDesign](https://github.com/GormanDesign))
|
70
|
+
- add scroll indicator to popover [#4697](https://github.com/knapsack-labs/app-monorepo/pull/4697) ([@GormanDesign](https://github.com/GormanDesign))
|
71
|
+
|
72
|
+
#### Authors: 2
|
73
|
+
|
74
|
+
- Josh Mabry ([@mabry1985](https://github.com/mabry1985))
|
75
|
+
- Matt Gorman ([@GormanDesign](https://github.com/GormanDesign))
|
76
|
+
|
77
|
+
---
|
78
|
+
|
79
|
+
# v4.69.6 (Fri Sep 06 2024)
|
80
|
+
|
81
|
+
#### 🐛 Bug Fix
|
82
|
+
|
83
|
+
- Merge branch 'latest' into feature/ksp-5458-anchor-links-not-jumping-to-the-right-spot ([@GormanDesign](https://github.com/GormanDesign))
|
84
|
+
|
85
|
+
#### 🏠 Internal
|
86
|
+
|
87
|
+
- Update dependency @types/node to ^20.16.5 [#4669](https://github.com/knapsack-labs/app-monorepo/pull/4669) ([@renovate[bot]](https://github.com/renovate[bot]))
|
88
|
+
- restores hash link handling [#4637](https://github.com/knapsack-labs/app-monorepo/pull/4637) ([@GormanDesign](https://github.com/GormanDesign))
|
89
|
+
|
90
|
+
#### Authors: 2
|
91
|
+
|
92
|
+
- [@renovate[bot]](https://github.com/renovate[bot])
|
93
|
+
- Matt Gorman ([@GormanDesign](https://github.com/GormanDesign))
|
94
|
+
|
95
|
+
---
|
96
|
+
|
1
97
|
# v4.69.3 (Wed Sep 04 2024)
|
2
98
|
|
3
99
|
#### 🏠 Internal
|
@@ -0,0 +1,82 @@
|
|
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
|
+
));
|
24
|
+
|
25
|
+
// src/client/init.tsx
|
26
|
+
var import_react = __toESM(require("react"));
|
27
|
+
var import_client2 = __toESM(require("react-dom/client"));
|
28
|
+
|
29
|
+
// src/client/ks-utils.ts
|
30
|
+
var import_client = require("@knapsack/renderer-webpack-base/client");
|
31
|
+
|
32
|
+
// src/types.ts
|
33
|
+
var rendererMetaScriptTagId = "ks-react-meta";
|
34
|
+
|
35
|
+
// src/client/ks-utils.ts
|
36
|
+
var {
|
37
|
+
allAvailableImports,
|
38
|
+
getAllImports,
|
39
|
+
getExtraImport,
|
40
|
+
getImport,
|
41
|
+
getImports,
|
42
|
+
getPatternImport,
|
43
|
+
importedModules,
|
44
|
+
meta,
|
45
|
+
rendererMeta,
|
46
|
+
rendererMethods
|
47
|
+
} = (0, import_client.getKsRendererClientGlobal)({
|
48
|
+
rendererMetaScriptTagId
|
49
|
+
});
|
50
|
+
|
51
|
+
// src/client/init.tsx
|
52
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
53
|
+
async function init() {
|
54
|
+
const { imports, disableReactStrictMode, demoWrapperProps } = rendererMeta;
|
55
|
+
const all = await getAllImports({
|
56
|
+
patterns: imports.filter((i) => i.type !== "extra"),
|
57
|
+
extras: imports.filter((i) => i.type === "extra").map(({ importInfo }) => ({ name: importInfo.name }))
|
58
|
+
});
|
59
|
+
const root = document.getElementById("render-root");
|
60
|
+
if (!root) {
|
61
|
+
throw new Error("No root element found");
|
62
|
+
}
|
63
|
+
const { DemoWrapper, ErrorCatcher, ...demoComponents } = all;
|
64
|
+
const DemoApp = rendererMethods.getDemoApp(demoComponents);
|
65
|
+
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, {}) }) });
|
66
|
+
import_client2.default.createRoot(root).render(
|
67
|
+
disableReactStrictMode ? app : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.default.StrictMode, { children: app })
|
68
|
+
);
|
69
|
+
}
|
70
|
+
__name(init, "init");
|
71
|
+
try {
|
72
|
+
init();
|
73
|
+
} catch (e) {
|
74
|
+
console.error(e);
|
75
|
+
const errorElement = document.createElement("div");
|
76
|
+
errorElement.innerHTML = `
|
77
|
+
<h1>Error</h1>
|
78
|
+
<p>${e.message}</p>
|
79
|
+
`;
|
80
|
+
document.body.appendChild(errorElement);
|
81
|
+
}
|
82
|
+
//# sourceMappingURL=init.js.map
|
@@ -0,0 +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 { imports, disableReactStrictMode, demoWrapperProps } = rendererMeta;\n const all = await getAllImports({\n patterns: imports.filter((i) => i.type !== 'extra'),\n extras: imports\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 allAvailableImports,\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 {\n KsJsImport,\n KsJsImportInfo,\n} 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 imports: KsJsImport[];\n moduleImports: {\n [path: string]: KsJsImportInfo[];\n };\n disableReactStrictMode: boolean;\n demo: Demo;\n patternId: string;\n templateId: string;\n demoWrapperProps: Except<DemoWrapperProps, 'children'>;\n};\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;;;ACkCnC,IAAM,0BAA0B;;;AD1BhC,IAAM;AAAA,EACX;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,QAAI,yCAAmE;AAAA,EACrE;AACF,CAAC;;;ADEO;AAlBR,eAAe,OAAO;AACpB,QAAM,EAAE,SAAS,wBAAwB,iBAAiB,IAAI;AAC9D,QAAM,MAAM,MAAM,cAAc;AAAA,IAC9B,UAAU,QAAQ,OAAO,CAAC,MAAM,EAAE,SAAS,OAAO;AAAA,IAClD,QAAQ,QACL,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;AA1Be;AA4Bf,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"]}
|
@@ -0,0 +1,90 @@
|
|
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
|
+
};
|
10
|
+
|
11
|
+
// ../../../../node_modules/.pnpm/tsup@8.2.4_@microsoft+api-extractor@7.43.8_@types+node@20.16.5__@swc+core@1.3.57_@swc+helpers_ltnhnypbjniokjoiamajspm464/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.5__@swc+core@1.3.57_@swc+helpers_ltnhnypbjniokjoiamajspm464/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 allAvailableImports, 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
|
+
allAvailableImports,
|
35
|
+
getAllImports,
|
36
|
+
getExtraImport,
|
37
|
+
getImport,
|
38
|
+
getImports,
|
39
|
+
getPatternImport,
|
40
|
+
importedModules,
|
41
|
+
meta,
|
42
|
+
rendererMeta,
|
43
|
+
rendererMethods
|
44
|
+
} = getKsRendererClientGlobal({
|
45
|
+
rendererMetaScriptTagId
|
46
|
+
}));
|
47
|
+
}
|
48
|
+
});
|
49
|
+
|
50
|
+
// src/client/init.tsx
|
51
|
+
import React from "react";
|
52
|
+
import ReactDOM from "react-dom/client";
|
53
|
+
import { jsx } from "react/jsx-runtime";
|
54
|
+
var require_init = __commonJS({
|
55
|
+
"src/client/init.tsx"() {
|
56
|
+
init_esm_shims();
|
57
|
+
init_ks_utils();
|
58
|
+
async function init() {
|
59
|
+
const { imports, disableReactStrictMode, demoWrapperProps } = rendererMeta;
|
60
|
+
const all = await getAllImports({
|
61
|
+
patterns: imports.filter((i) => i.type !== "extra"),
|
62
|
+
extras: imports.filter((i) => i.type === "extra").map(({ importInfo }) => ({ name: importInfo.name }))
|
63
|
+
});
|
64
|
+
const root = document.getElementById("render-root");
|
65
|
+
if (!root) {
|
66
|
+
throw new Error("No root element found");
|
67
|
+
}
|
68
|
+
const { DemoWrapper, ErrorCatcher, ...demoComponents } = all;
|
69
|
+
const DemoApp = rendererMethods.getDemoApp(demoComponents);
|
70
|
+
const app = /* @__PURE__ */ jsx(ErrorCatcher, { children: /* @__PURE__ */ jsx(DemoWrapper, { ...demoWrapperProps, children: /* @__PURE__ */ jsx(DemoApp, {}) }) });
|
71
|
+
ReactDOM.createRoot(root).render(
|
72
|
+
disableReactStrictMode ? app : /* @__PURE__ */ jsx(React.StrictMode, { children: app })
|
73
|
+
);
|
74
|
+
}
|
75
|
+
__name(init, "init");
|
76
|
+
try {
|
77
|
+
init();
|
78
|
+
} catch (e) {
|
79
|
+
console.error(e);
|
80
|
+
const errorElement = document.createElement("div");
|
81
|
+
errorElement.innerHTML = `
|
82
|
+
<h1>Error</h1>
|
83
|
+
<p>${e.message}</p>
|
84
|
+
`;
|
85
|
+
document.body.appendChild(errorElement);
|
86
|
+
}
|
87
|
+
}
|
88
|
+
});
|
89
|
+
export default require_init();
|
90
|
+
//# sourceMappingURL=init.mjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../../../../../node_modules/.pnpm/tsup@8.2.4_@microsoft+api-extractor@7.43.8_@types+node@20.16.5__@swc+core@1.3.57_@swc+helpers_ltnhnypbjniokjoiamajspm464/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 {\n KsJsImport,\n KsJsImportInfo,\n} 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 imports: KsJsImport[];\n moduleImports: {\n [path: string]: KsJsImportInfo[];\n };\n disableReactStrictMode: boolean;\n demo: Demo;\n patternId: string;\n templateId: string;\n demoWrapperProps: Except<DemoWrapperProps, 'children'>;\n};\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 allAvailableImports,\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 { imports, disableReactStrictMode, demoWrapperProps } = rendererMeta;\n const all = await getAllImports({\n patterns: imports.filter((i) => i.type !== 'extra'),\n extras: imports\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,IAkCa;AAlCb;AAAA;AAAA;AAkCO,IAAM,0BAA0B;AAAA;AAAA;;;AClCvC,SAAS,iCAAiC;AAA1C,IASE,qBACA,eACA,gBACA,WACA,YACA,kBACA,iBACA,MACA,cACA;AAlBF;AAAA;AAAA;AACA;AAOO,KAAM;AAAA,MACX;AAAA,MACA;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;;;ACpBD,OAAO,WAAW;AAClB,OAAO,cAAc;AAqBb;AAvBR;AAAA;AAAA;AAGA;AAEA,mBAAe,OAAO;AACpB,YAAM,EAAE,SAAS,wBAAwB,iBAAiB,IAAI;AAC9D,YAAM,MAAM,MAAM,cAAc;AAAA,QAC9B,UAAU,QAAQ,OAAO,CAAC,MAAM,EAAE,SAAS,OAAO;AAAA,QAClD,QAAQ,QACL,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;AA1Be;AA4Bf,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":[]}
|
package/dist/demo-wrapper.d.mts
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
2
|
-
import { DemoWrapperProps } from './
|
3
|
-
import '@knapsack/renderer-webpack-base';
|
4
|
-
import '@knapsack/utils';
|
2
|
+
import { D as DemoWrapperProps } from './types-D2eCZXsg.mjs';
|
5
3
|
import '@knapsack/types';
|
6
4
|
import '@knapsack/app/types';
|
7
5
|
|
package/dist/demo-wrapper.d.ts
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
2
|
-
import { DemoWrapperProps } from './
|
3
|
-
import '@knapsack/renderer-webpack-base';
|
4
|
-
import '@knapsack/utils';
|
2
|
+
import { D as DemoWrapperProps } from './types-D2eCZXsg.js';
|
5
3
|
import '@knapsack/types';
|
6
4
|
import '@knapsack/app/types';
|
7
5
|
|
package/dist/demo-wrapper.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../src/demo-wrapper.tsx"],"sourcesContent":["import type { DemoWrapperProps } from './
|
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 +1 @@
|
|
1
|
-
{"version":3,"sources":["../src/demo-wrapper.tsx"],"sourcesContent":["import type { DemoWrapperProps } from './
|
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 +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 componentDidCatch(error: Error, errorInfo: React.ErrorInfo): void {\n const { componentStack } = errorInfo;\n this.setState({\n error,\n componentStack,\n });\n }\n\n 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,
|
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 +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 componentDidCatch(error: Error, errorInfo: React.ErrorInfo): void {\n const { componentStack } = errorInfo;\n this.setState({\n error,\n componentStack,\n });\n }\n\n 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,
|
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,27 +1,19 @@
|
|
1
|
-
import {
|
2
|
-
import {
|
3
|
-
import { RendererId
|
4
|
-
import { KnapsackRenderParams
|
1
|
+
import { RendererWebpackBase, Renderer, KsJsImport } from '@knapsack/renderer-webpack-base';
|
2
|
+
import { Renderable } from '@knapsack/app/renderers';
|
3
|
+
import { RendererId } from '@knapsack/types';
|
4
|
+
import { KnapsackRenderParams } from '@knapsack/app/types';
|
5
|
+
export { D as DemoWrapperProps } from './types-D2eCZXsg.mjs';
|
5
6
|
|
6
|
-
|
7
|
-
children: React.ReactNode;
|
8
|
-
patternsUsed: {
|
9
|
-
patternId: string;
|
10
|
-
templateId: string;
|
11
|
-
demoId?: string;
|
12
|
-
}[];
|
13
|
-
} & Except<KnapsackRenderParams, 'patternManifest'>;
|
14
|
-
declare class KnapsackReactRenderer extends KnapsackRendererWebpackBase implements KnapsackTemplateRenderer {
|
7
|
+
declare class KnapsackReactRenderer extends RendererWebpackBase implements Renderable {
|
15
8
|
/**
|
16
9
|
* `react.js` & `react-dom.js` root relative paths
|
17
10
|
*/
|
18
11
|
assets: string[];
|
19
12
|
babelConfig: Record<string, unknown>;
|
20
|
-
creators: KnapsackTemplateRenderer['creators'];
|
21
13
|
private demoWrapperPath;
|
22
14
|
private disableReactStrictMode?;
|
23
15
|
constructor({ webpackConfig, demoWrapperPath, id, disableReactStrictMode, }?: {
|
24
|
-
webpackConfig?: ConstructorParameters<typeof
|
16
|
+
webpackConfig?: ConstructorParameters<typeof RendererWebpackBase>[0]['webpackConfig'];
|
25
17
|
demoWrapperPath?: string;
|
26
18
|
/** When using React v18+, this option allows a workspace to _disable_ React's Strict Mode from running in Knapsack's React Renderer (StrictMode is enabled by default).
|
27
19
|
*
|
@@ -31,31 +23,24 @@ declare class KnapsackReactRenderer extends KnapsackRendererWebpackBase implemen
|
|
31
23
|
/** Don't set if calling from `knapsack.config.js`, only use if creating a new Renderer based on the React Renderer */
|
32
24
|
id?: RendererId;
|
33
25
|
});
|
34
|
-
init
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
changeCase(str: string): string;
|
40
|
-
createWebpackConfig(): ReturnType<KnapsackRendererWebpackBase['createWebpackConfig']>;
|
41
|
-
getJsImports(): ReturnType<KnapsackRendererWebpackBase['getJsImports']>;
|
26
|
+
init: Renderer['init'];
|
27
|
+
getMeta: Renderer['getMeta'];
|
28
|
+
changeCase: Renderer['changeCase'];
|
29
|
+
createWebpackConfig: RendererWebpackBase['createWebpackConfig'];
|
30
|
+
getJsImports: RendererWebpackBase['getJsImports'];
|
42
31
|
prepClientRenderResults({ usage, demoApp, imports: xImports, renderOptions: { pattern, template, demo }, }: {
|
43
32
|
usage: string;
|
44
33
|
demoApp: string;
|
45
34
|
imports: KsJsImport[];
|
46
35
|
renderOptions: KnapsackRenderParams;
|
47
|
-
}):
|
48
|
-
render
|
49
|
-
getUsageAndImports
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
watch(opt: Parameters<KnapsackTemplateRendererBase['watch']>[0]): Promise<void>;
|
56
|
-
getTemplateMeta: KnapsackTemplateRendererBase['getTemplateMeta'];
|
57
|
-
alterTemplateMetaFiles: KnapsackTemplateRendererBase['alterTemplateMetaFiles'];
|
58
|
-
getTemplateSuggestions({ newPath, }: Parameters<KnapsackTemplateRendererBase['getTemplateSuggestions']>[0]): ReturnType<KnapsackTemplateRendererBase['getTemplateSuggestions']>;
|
36
|
+
}): ReturnType<Renderer['render']>;
|
37
|
+
render: Renderer['render'];
|
38
|
+
getUsageAndImports: RendererWebpackBase['getUsageAndImports'];
|
39
|
+
inferSpec: Renderer['inferSpec'];
|
40
|
+
watch: Renderer['watch'];
|
41
|
+
getTemplateMeta: Renderer['getTemplateMeta'];
|
42
|
+
alterTemplateMetaFiles: Renderer['alterTemplateMetaFiles'];
|
43
|
+
getTemplateSuggestions: Renderer['getTemplateSuggestions'];
|
59
44
|
}
|
60
45
|
|
61
|
-
export {
|
46
|
+
export { KnapsackReactRenderer };
|
package/dist/index.d.ts
CHANGED
@@ -1,27 +1,19 @@
|
|
1
|
-
import {
|
2
|
-
import {
|
3
|
-
import { RendererId
|
4
|
-
import { KnapsackRenderParams
|
1
|
+
import { RendererWebpackBase, Renderer, KsJsImport } from '@knapsack/renderer-webpack-base';
|
2
|
+
import { Renderable } from '@knapsack/app/renderers';
|
3
|
+
import { RendererId } from '@knapsack/types';
|
4
|
+
import { KnapsackRenderParams } from '@knapsack/app/types';
|
5
|
+
export { D as DemoWrapperProps } from './types-D2eCZXsg.js';
|
5
6
|
|
6
|
-
|
7
|
-
children: React.ReactNode;
|
8
|
-
patternsUsed: {
|
9
|
-
patternId: string;
|
10
|
-
templateId: string;
|
11
|
-
demoId?: string;
|
12
|
-
}[];
|
13
|
-
} & Except<KnapsackRenderParams, 'patternManifest'>;
|
14
|
-
declare class KnapsackReactRenderer extends KnapsackRendererWebpackBase implements KnapsackTemplateRenderer {
|
7
|
+
declare class KnapsackReactRenderer extends RendererWebpackBase implements Renderable {
|
15
8
|
/**
|
16
9
|
* `react.js` & `react-dom.js` root relative paths
|
17
10
|
*/
|
18
11
|
assets: string[];
|
19
12
|
babelConfig: Record<string, unknown>;
|
20
|
-
creators: KnapsackTemplateRenderer['creators'];
|
21
13
|
private demoWrapperPath;
|
22
14
|
private disableReactStrictMode?;
|
23
15
|
constructor({ webpackConfig, demoWrapperPath, id, disableReactStrictMode, }?: {
|
24
|
-
webpackConfig?: ConstructorParameters<typeof
|
16
|
+
webpackConfig?: ConstructorParameters<typeof RendererWebpackBase>[0]['webpackConfig'];
|
25
17
|
demoWrapperPath?: string;
|
26
18
|
/** When using React v18+, this option allows a workspace to _disable_ React's Strict Mode from running in Knapsack's React Renderer (StrictMode is enabled by default).
|
27
19
|
*
|
@@ -31,31 +23,24 @@ declare class KnapsackReactRenderer extends KnapsackRendererWebpackBase implemen
|
|
31
23
|
/** Don't set if calling from `knapsack.config.js`, only use if creating a new Renderer based on the React Renderer */
|
32
24
|
id?: RendererId;
|
33
25
|
});
|
34
|
-
init
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
changeCase(str: string): string;
|
40
|
-
createWebpackConfig(): ReturnType<KnapsackRendererWebpackBase['createWebpackConfig']>;
|
41
|
-
getJsImports(): ReturnType<KnapsackRendererWebpackBase['getJsImports']>;
|
26
|
+
init: Renderer['init'];
|
27
|
+
getMeta: Renderer['getMeta'];
|
28
|
+
changeCase: Renderer['changeCase'];
|
29
|
+
createWebpackConfig: RendererWebpackBase['createWebpackConfig'];
|
30
|
+
getJsImports: RendererWebpackBase['getJsImports'];
|
42
31
|
prepClientRenderResults({ usage, demoApp, imports: xImports, renderOptions: { pattern, template, demo }, }: {
|
43
32
|
usage: string;
|
44
33
|
demoApp: string;
|
45
34
|
imports: KsJsImport[];
|
46
35
|
renderOptions: KnapsackRenderParams;
|
47
|
-
}):
|
48
|
-
render
|
49
|
-
getUsageAndImports
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
watch(opt: Parameters<KnapsackTemplateRendererBase['watch']>[0]): Promise<void>;
|
56
|
-
getTemplateMeta: KnapsackTemplateRendererBase['getTemplateMeta'];
|
57
|
-
alterTemplateMetaFiles: KnapsackTemplateRendererBase['alterTemplateMetaFiles'];
|
58
|
-
getTemplateSuggestions({ newPath, }: Parameters<KnapsackTemplateRendererBase['getTemplateSuggestions']>[0]): ReturnType<KnapsackTemplateRendererBase['getTemplateSuggestions']>;
|
36
|
+
}): ReturnType<Renderer['render']>;
|
37
|
+
render: Renderer['render'];
|
38
|
+
getUsageAndImports: RendererWebpackBase['getUsageAndImports'];
|
39
|
+
inferSpec: Renderer['inferSpec'];
|
40
|
+
watch: Renderer['watch'];
|
41
|
+
getTemplateMeta: Renderer['getTemplateMeta'];
|
42
|
+
alterTemplateMetaFiles: Renderer['alterTemplateMetaFiles'];
|
43
|
+
getTemplateSuggestions: Renderer['getTemplateSuggestions'];
|
59
44
|
}
|
60
45
|
|
61
|
-
export {
|
46
|
+
export { KnapsackReactRenderer };
|