@knapsack/renderer-react 4.70.0--canary.4433.133de0f.0 → 4.70.0--canary.4513.12c8d13.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +135 -0
- package/dist/client/init.d.mts +2 -0
- package/dist/client/init.d.ts +2 -0
- package/dist/client/init.js +81 -0
- package/dist/client/init.js.map +1 -0
- package/dist/client/init.mjs +89 -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 +104 -178
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +113 -185
- 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 +21 -17
package/CHANGELOG.md
CHANGED
@@ -1,3 +1,138 @@
|
|
1
|
+
# v4.69.13 (Thu Sep 26 2024)
|
2
|
+
|
3
|
+
#### 🐛 Bug Fix
|
4
|
+
|
5
|
+
- update design src user flow to be async [#4739](https://github.com/knapsack-labs/app-monorepo/pull/4739) ([@mabry1985](https://github.com/mabry1985))
|
6
|
+
- Merge branch 'latest' into feature/ksp-5512-create-add-design-src-file-async-mutation ([@mabry1985](https://github.com/mabry1985))
|
7
|
+
|
8
|
+
#### 🏠 Internal
|
9
|
+
|
10
|
+
- improve Renderer clients [#4770](https://github.com/knapsack-labs/app-monorepo/pull/4770) ([@EvanLovely](https://github.com/EvanLovely))
|
11
|
+
- refactors user flow for updating design src files [#4769](https://github.com/knapsack-labs/app-monorepo/pull/4769) ([@mabry1985](https://github.com/mabry1985))
|
12
|
+
|
13
|
+
#### Authors: 2
|
14
|
+
|
15
|
+
- Evan Lovely ([@EvanLovely](https://github.com/EvanLovely))
|
16
|
+
- Josh Mabry ([@mabry1985](https://github.com/mabry1985))
|
17
|
+
|
18
|
+
---
|
19
|
+
|
20
|
+
# v4.69.12 (Thu Sep 26 2024)
|
21
|
+
|
22
|
+
#### 🐛 Bug Fix
|
23
|
+
|
24
|
+
- Merge branch 'latest' into feature/ksp-5560-replace-schema-forms-in-content-blocks ([@GormanDesign](https://github.com/GormanDesign))
|
25
|
+
|
26
|
+
#### 🏠 Internal
|
27
|
+
|
28
|
+
- Remove unused types [#4819](https://github.com/knapsack-labs/app-monorepo/pull/4819) ([@greylabel](https://github.com/greylabel))
|
29
|
+
- chore(deps): update dependency @types/react to ^18.3.9 [#4851](https://github.com/knapsack-labs/app-monorepo/pull/4851) ([@renovate[bot]](https://github.com/renovate[bot]))
|
30
|
+
- chore(deps): update dependency @types/node to ^20.16.6 [#4846](https://github.com/knapsack-labs/app-monorepo/pull/4846) ([@renovate[bot]](https://github.com/renovate[bot]))
|
31
|
+
|
32
|
+
#### Authors: 3
|
33
|
+
|
34
|
+
- [@renovate[bot]](https://github.com/renovate[bot])
|
35
|
+
- Grant Gaudet ([@greylabel](https://github.com/greylabel))
|
36
|
+
- Matt Gorman ([@GormanDesign](https://github.com/GormanDesign))
|
37
|
+
|
38
|
+
---
|
39
|
+
|
40
|
+
# v4.69.11 (Fri Sep 20 2024)
|
41
|
+
|
42
|
+
#### 🐛 Bug Fix
|
43
|
+
|
44
|
+
- Merge branch 'latest' into GormanDesign-patch-2 ([@GormanDesign](https://github.com/GormanDesign))
|
45
|
+
|
46
|
+
#### 🏠 Internal
|
47
|
+
|
48
|
+
- 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]))
|
49
|
+
- adds select all option to exclude patterns filters [#4803](https://github.com/knapsack-labs/app-monorepo/pull/4803) ([@GormanDesign](https://github.com/GormanDesign))
|
50
|
+
|
51
|
+
#### Authors: 2
|
52
|
+
|
53
|
+
- [@renovate[bot]](https://github.com/renovate[bot])
|
54
|
+
- Matt Gorman ([@GormanDesign](https://github.com/GormanDesign))
|
55
|
+
|
56
|
+
---
|
57
|
+
|
58
|
+
# v4.69.10 (Wed Sep 18 2024)
|
59
|
+
|
60
|
+
#### 🏠 Internal
|
61
|
+
|
62
|
+
- 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]))
|
63
|
+
|
64
|
+
#### Authors: 1
|
65
|
+
|
66
|
+
- [@renovate[bot]](https://github.com/renovate[bot])
|
67
|
+
|
68
|
+
---
|
69
|
+
|
70
|
+
# v4.69.9 (Sat Sep 14 2024)
|
71
|
+
|
72
|
+
#### 🐛 Bug Fix
|
73
|
+
|
74
|
+
- refactor Renderer clients [#4768](https://github.com/knapsack-labs/app-monorepo/pull/4768) ([@EvanLovely](https://github.com/EvanLovely))
|
75
|
+
|
76
|
+
#### 🏠 Internal
|
77
|
+
|
78
|
+
- update template stage ui [#4763](https://github.com/knapsack-labs/app-monorepo/pull/4763) ([@GormanDesign](https://github.com/GormanDesign))
|
79
|
+
- add spacing under form feedback banner [#4747](https://github.com/knapsack-labs/app-monorepo/pull/4747) ([@GormanDesign](https://github.com/GormanDesign))
|
80
|
+
|
81
|
+
#### Authors: 2
|
82
|
+
|
83
|
+
- Evan Lovely ([@EvanLovely](https://github.com/EvanLovely))
|
84
|
+
- Matt Gorman ([@GormanDesign](https://github.com/GormanDesign))
|
85
|
+
|
86
|
+
---
|
87
|
+
|
88
|
+
# v4.69.8 (Thu Sep 12 2024)
|
89
|
+
|
90
|
+
#### 🐛 Bug Fix
|
91
|
+
|
92
|
+
- refactor Renderers for cleaner types [#4746](https://github.com/knapsack-labs/app-monorepo/pull/4746) ([@EvanLovely](https://github.com/EvanLovely))
|
93
|
+
|
94
|
+
#### Authors: 1
|
95
|
+
|
96
|
+
- Evan Lovely ([@EvanLovely](https://github.com/EvanLovely))
|
97
|
+
|
98
|
+
---
|
99
|
+
|
100
|
+
# v4.69.7 (Wed Sep 11 2024)
|
101
|
+
|
102
|
+
#### 🐛 Bug Fix
|
103
|
+
|
104
|
+
- Merge branch 'latest' into feature/ksp-5497-setup-status-id-in-client ([@mabry1985](https://github.com/mabry1985))
|
105
|
+
|
106
|
+
#### 🏠 Internal
|
107
|
+
|
108
|
+
- fixes schema form select appearance [#4700](https://github.com/knapsack-labs/app-monorepo/pull/4700) ([@GormanDesign](https://github.com/GormanDesign))
|
109
|
+
- add scroll indicator to popover [#4697](https://github.com/knapsack-labs/app-monorepo/pull/4697) ([@GormanDesign](https://github.com/GormanDesign))
|
110
|
+
|
111
|
+
#### Authors: 2
|
112
|
+
|
113
|
+
- Josh Mabry ([@mabry1985](https://github.com/mabry1985))
|
114
|
+
- Matt Gorman ([@GormanDesign](https://github.com/GormanDesign))
|
115
|
+
|
116
|
+
---
|
117
|
+
|
118
|
+
# v4.69.6 (Fri Sep 06 2024)
|
119
|
+
|
120
|
+
#### 🐛 Bug Fix
|
121
|
+
|
122
|
+
- Merge branch 'latest' into feature/ksp-5458-anchor-links-not-jumping-to-the-right-spot ([@GormanDesign](https://github.com/GormanDesign))
|
123
|
+
|
124
|
+
#### 🏠 Internal
|
125
|
+
|
126
|
+
- 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]))
|
127
|
+
- restores hash link handling [#4637](https://github.com/knapsack-labs/app-monorepo/pull/4637) ([@GormanDesign](https://github.com/GormanDesign))
|
128
|
+
|
129
|
+
#### Authors: 2
|
130
|
+
|
131
|
+
- [@renovate[bot]](https://github.com/renovate[bot])
|
132
|
+
- Matt Gorman ([@GormanDesign](https://github.com/GormanDesign))
|
133
|
+
|
134
|
+
---
|
135
|
+
|
1
136
|
# v4.69.3 (Wed Sep 04 2024)
|
2
137
|
|
3
138
|
#### 🏠 Internal
|
@@ -0,0 +1,81 @@
|
|
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
|
+
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 = `
|
76
|
+
<h1>Error</h1>
|
77
|
+
<p>${e.message}</p>
|
78
|
+
`;
|
79
|
+
document.body.appendChild(errorElement);
|
80
|
+
}
|
81
|
+
//# 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 { 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"]}
|
@@ -0,0 +1,89 @@
|
|
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.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 = `
|
81
|
+
<h1>Error</h1>
|
82
|
+
<p>${e.message}</p>
|
83
|
+
`;
|
84
|
+
document.body.appendChild(errorElement);
|
85
|
+
}
|
86
|
+
}
|
87
|
+
});
|
88
|
+
export default require_init();
|
89
|
+
//# 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.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":[]}
|
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 };
|