@knapsack/renderer-react 4.69.12--canary.4820.6d71796.0 → 4.69.12--canary.4821.8709676.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -24,58 +24,48 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
24
24
 
25
25
  // src/client/init.tsx
26
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");
27
+ var import_client = __toESM(require("react-dom/client"));
28
+ var import_client2 = require("@knapsack/renderer-webpack-base/client");
31
29
 
32
30
  // src/types.ts
33
31
  var rendererMetaScriptTagId = "ks-react-meta";
34
32
 
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
33
  // src/client/init.tsx
51
34
  var import_jsx_runtime = require("react/jsx-runtime");
52
35
  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 = `
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 = `
76
63
  <h1>Error</h1>
77
64
  <p>${e.message}</p>
78
65
  `;
79
- document.body.appendChild(errorElement);
66
+ document.body.appendChild(errorElement);
67
+ }
80
68
  }
69
+ __name(init, "init");
70
+ init();
81
71
  //# sourceMappingURL=init.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/client/init.tsx","../../src/client/ks-utils.ts","../../src/types.ts"],"sourcesContent":["/// <reference lib=\"dom\" />\nimport React from 'react';\nimport ReactDOM from 'react-dom/client';\nimport { rendererMeta, rendererMethods, getAllImports } from './ks-utils';\n\nasync function init() {\n const { neededImports, disableReactStrictMode, demoWrapperProps } =\n rendererMeta;\n const all = await getAllImports({\n patterns: neededImports.filter((i) => i.type !== 'extra'),\n extras: neededImports\n .filter((i) => i.type === 'extra')\n .map(({ importInfo }) => ({ name: importInfo.name })),\n });\n\n const root = document.getElementById('render-root');\n if (!root) {\n throw new Error('No root element found');\n }\n const { DemoWrapper, ErrorCatcher, ...demoComponents } = all;\n const DemoApp = rendererMethods.getDemoApp(demoComponents);\n const app = (\n <ErrorCatcher>\n <DemoWrapper {...demoWrapperProps}>\n <DemoApp />\n </DemoWrapper>\n </ErrorCatcher>\n );\n\n ReactDOM.createRoot(root).render(\n disableReactStrictMode ? app : <React.StrictMode>{app}</React.StrictMode>,\n );\n}\n\ntry {\n init();\n} catch (e) {\n console.error(e);\n // create html element with error message\n const errorElement = document.createElement('div');\n errorElement.innerHTML = `\n <h1>Error</h1>\n <p>${e.message}</p>\n `;\n document.body.appendChild(errorElement);\n}\n","import { getKsRendererClientGlobal } from '@knapsack/renderer-webpack-base/client';\nimport {\n rendererMetaScriptTagId,\n type KsReactMeta,\n type Component,\n type RendererMethods,\n} from '../types';\n\nexport const {\n getAllImports,\n getExtraImport,\n getImport,\n getImports,\n getPatternImport,\n importedModules,\n meta,\n rendererMeta,\n rendererMethods,\n} = getKsRendererClientGlobal<Component, KsReactMeta, RendererMethods>({\n rendererMetaScriptTagId,\n});\n","import type { Demo, Except } from '@knapsack/types';\nimport type { ComponentType } from 'react';\nimport type { RendererMetaBase } from '@knapsack/renderer-webpack-base/client';\nimport type { KnapsackRenderParams } from '@knapsack/app/types';\n\nexport type Component = ComponentType<Record<string, unknown>>;\n\nexport type DemoWrapperProps = {\n children: React.ReactNode;\n patternsUsed: {\n patternId: string;\n templateId: string;\n demoId?: string;\n }[];\n} & Except<KnapsackRenderParams, 'patternManifest'>;\n\n/**\n * Found as JSON in HTML `#ks-react-meta`\n */\nexport type KsReactMeta = {\n disableReactStrictMode: boolean;\n demo: Demo;\n demoWrapperProps: Except<DemoWrapperProps, 'children'>;\n} & RendererMetaBase;\n\nexport const rendererMetaScriptTagId = 'ks-react-meta';\n\nexport type RendererMethods = {\n getDemoApp: (components: Record<string, Component>) => Component;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AACA,mBAAkB;AAClB,IAAAA,iBAAqB;;;ACFrB,oBAA0C;;;ACyBnC,IAAM,0BAA0B;;;ADjBhC,IAAM;AAAA,EACX;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,QAAI,yCAAmE;AAAA,EACrE;AACF,CAAC;;;ADIO;AAnBR,eAAe,OAAO;AACpB,QAAM,EAAE,eAAe,wBAAwB,iBAAiB,IAC9D;AACF,QAAM,MAAM,MAAM,cAAc;AAAA,IAC9B,UAAU,cAAc,OAAO,CAAC,MAAM,EAAE,SAAS,OAAO;AAAA,IACxD,QAAQ,cACL,OAAO,CAAC,MAAM,EAAE,SAAS,OAAO,EAChC,IAAI,CAAC,EAAE,WAAW,OAAO,EAAE,MAAM,WAAW,KAAK,EAAE;AAAA,EACxD,CAAC;AAED,QAAM,OAAO,SAAS,eAAe,aAAa;AAClD,MAAI,CAAC,MAAM;AACT,UAAM,IAAI,MAAM,uBAAuB;AAAA,EACzC;AACA,QAAM,EAAE,aAAa,cAAc,GAAG,eAAe,IAAI;AACzD,QAAM,UAAU,gBAAgB,WAAW,cAAc;AACzD,QAAM,MACJ,4CAAC,gBACC,sDAAC,eAAa,GAAG,kBACf,sDAAC,WAAQ,GACX,GACF;AAGF,iBAAAC,QAAS,WAAW,IAAI,EAAE;AAAA,IACxB,yBAAyB,MAAM,4CAAC,aAAAC,QAAM,YAAN,EAAkB,eAAI;AAAA,EACxD;AACF;AA3Be;AA6Bf,IAAI;AACF,OAAK;AACP,SAAS,GAAG;AACV,UAAQ,MAAM,CAAC;AAEf,QAAM,eAAe,SAAS,cAAc,KAAK;AACjD,eAAa,YAAY;AAAA;AAAA,SAElB,EAAE,OAAO;AAAA;AAEhB,WAAS,KAAK,YAAY,YAAY;AACxC;","names":["import_client","ReactDOM","React"]}
1
+ {"version":3,"sources":["../../src/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"]}
@@ -23,66 +23,51 @@ var init_types = __esm({
23
23
  }
24
24
  });
25
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
26
  // src/client/init.tsx
50
27
  import React from "react";
51
28
  import ReactDOM from "react-dom/client";
29
+ import { getKsRendererClientUtils } from "@knapsack/renderer-webpack-base/client";
52
30
  import { jsx } from "react/jsx-runtime";
53
31
  var require_init = __commonJS({
54
32
  "src/client/init.tsx"() {
55
33
  init_esm_shims();
56
- init_ks_utils();
34
+ init_types();
57
35
  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 = `
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 = `
81
63
  <h1>Error</h1>
82
64
  <p>${e.message}</p>
83
65
  `;
84
- document.body.appendChild(errorElement);
66
+ document.body.appendChild(errorElement);
67
+ }
85
68
  }
69
+ __name(init, "init");
70
+ init();
86
71
  }
87
72
  });
88
73
  export default require_init();
@@ -1 +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 { RendererMetaBase } from '@knapsack/renderer-webpack-base/client';\nimport type { KnapsackRenderParams } from '@knapsack/app/types';\n\nexport type Component = ComponentType<Record<string, unknown>>;\n\nexport type DemoWrapperProps = {\n children: React.ReactNode;\n patternsUsed: {\n patternId: string;\n templateId: string;\n demoId?: string;\n }[];\n} & Except<KnapsackRenderParams, 'patternManifest'>;\n\n/**\n * Found as JSON in HTML `#ks-react-meta`\n */\nexport type KsReactMeta = {\n disableReactStrictMode: boolean;\n demo: Demo;\n demoWrapperProps: Except<DemoWrapperProps, 'children'>;\n} & RendererMetaBase;\n\nexport const rendererMetaScriptTagId = 'ks-react-meta';\n\nexport type RendererMethods = {\n getDemoApp: (components: Record<string, Component>) => Component;\n};\n","import { getKsRendererClientGlobal } from '@knapsack/renderer-webpack-base/client';\nimport {\n rendererMetaScriptTagId,\n type KsReactMeta,\n type Component,\n type RendererMethods,\n} from '../types';\n\nexport const {\n getAllImports,\n getExtraImport,\n getImport,\n getImports,\n getPatternImport,\n importedModules,\n meta,\n rendererMeta,\n rendererMethods,\n} = getKsRendererClientGlobal<Component, KsReactMeta, RendererMethods>({\n rendererMetaScriptTagId,\n});\n","/// <reference lib=\"dom\" />\nimport React from 'react';\nimport ReactDOM from 'react-dom/client';\nimport { rendererMeta, rendererMethods, getAllImports } from './ks-utils';\n\nasync function init() {\n const { neededImports, disableReactStrictMode, demoWrapperProps } =\n rendererMeta;\n const all = await getAllImports({\n patterns: neededImports.filter((i) => i.type !== 'extra'),\n extras: neededImports\n .filter((i) => i.type === 'extra')\n .map(({ importInfo }) => ({ name: importInfo.name })),\n });\n\n const root = document.getElementById('render-root');\n if (!root) {\n throw new Error('No root element found');\n }\n const { DemoWrapper, ErrorCatcher, ...demoComponents } = all;\n const DemoApp = rendererMethods.getDemoApp(demoComponents);\n const app = (\n <ErrorCatcher>\n <DemoWrapper {...demoWrapperProps}>\n <DemoApp />\n </DemoWrapper>\n </ErrorCatcher>\n );\n\n ReactDOM.createRoot(root).render(\n disableReactStrictMode ? app : <React.StrictMode>{app}</React.StrictMode>,\n );\n}\n\ntry {\n init();\n} catch (e) {\n console.error(e);\n // create html element with error message\n const errorElement = document.createElement('div');\n errorElement.innerHTML = `\n <h1>Error</h1>\n <p>${e.message}</p>\n `;\n document.body.appendChild(errorElement);\n}\n"],"mappings":";;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAyBa;AAzBb;AAAA;AAAA;AAyBO,IAAM,0BAA0B;AAAA;AAAA;;;ACzBvC,SAAS,iCAAiC;AAA1C,IASE,eACA,gBACA,WACA,YACA,kBACA,iBACA,MACA,cACA;AAjBF;AAAA;AAAA;AACA;AAOO,KAAM;AAAA,MACX;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,QACE,0BAAmE;AAAA,MACrE;AAAA,IACF,CAAC;AAAA;AAAA;;;ACnBD,OAAO,WAAW;AAClB,OAAO,cAAc;AAsBb;AAxBR;AAAA;AAAA;AAGA;AAEA,mBAAe,OAAO;AACpB,YAAM,EAAE,eAAe,wBAAwB,iBAAiB,IAC9D;AACF,YAAM,MAAM,MAAM,cAAc;AAAA,QAC9B,UAAU,cAAc,OAAO,CAAC,MAAM,EAAE,SAAS,OAAO;AAAA,QACxD,QAAQ,cACL,OAAO,CAAC,MAAM,EAAE,SAAS,OAAO,EAChC,IAAI,CAAC,EAAE,WAAW,OAAO,EAAE,MAAM,WAAW,KAAK,EAAE;AAAA,MACxD,CAAC;AAED,YAAM,OAAO,SAAS,eAAe,aAAa;AAClD,UAAI,CAAC,MAAM;AACT,cAAM,IAAI,MAAM,uBAAuB;AAAA,MACzC;AACA,YAAM,EAAE,aAAa,cAAc,GAAG,eAAe,IAAI;AACzD,YAAM,UAAU,gBAAgB,WAAW,cAAc;AACzD,YAAM,MACJ,oBAAC,gBACC,8BAAC,eAAa,GAAG,kBACf,8BAAC,WAAQ,GACX,GACF;AAGF,eAAS,WAAW,IAAI,EAAE;AAAA,QACxB,yBAAyB,MAAM,oBAAC,MAAM,YAAN,EAAkB,eAAI;AAAA,MACxD;AAAA,IACF;AA3Be;AA6Bf,QAAI;AACF,WAAK;AAAA,IACP,SAAS,GAAG;AACV,cAAQ,MAAM,CAAC;AAEf,YAAM,eAAe,SAAS,cAAc,KAAK;AACjD,mBAAa,YAAY;AAAA;AAAA,SAElB,EAAE,OAAO;AAAA;AAEhB,eAAS,KAAK,YAAY,YAAY;AAAA,IACxC;AAAA;AAAA;","names":[]}
1
+ {"version":3,"sources":["../../../../../../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/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":[]}
@@ -1,7 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { D as DemoWrapperProps } from './types-D2eCZXsg.mjs';
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
 
@@ -1,7 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { D as DemoWrapperProps } from './types-D2eCZXsg.js';
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/index.d.mts CHANGED
@@ -1,8 +1,7 @@
1
- import { RendererWebpackBase, Renderer, KsJsImport } from '@knapsack/renderer-webpack-base';
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
- import { KnapsackRenderParams } from '@knapsack/app/types';
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
  /**
@@ -27,12 +26,11 @@ declare class KnapsackReactRenderer extends RendererWebpackBase implements Rende
27
26
  getMeta: Renderer['getMeta'];
28
27
  changeCase: Renderer['changeCase'];
29
28
  createWebpackConfig: RendererWebpackBase['createWebpackConfig'];
30
- getJsImports: RendererWebpackBase['getJsImports'];
31
- prepClientRenderResults({ usage, demoApp, imports: xImports, renderOptions: { pattern, template, demo }, }: {
29
+ prepClientRenderResults({ usage, demoApp, importMap, renderOptions: { demo, state, patternId, templateId }, }: {
32
30
  usage: string;
33
31
  demoApp: string;
34
- imports: KsJsImport[];
35
- renderOptions: KnapsackRenderParams;
32
+ importMap: KsJsImportMap;
33
+ renderOptions: Parameters<Renderer['render']>[0];
36
34
  }): ReturnType<Renderer['render']>;
37
35
  render: Renderer['render'];
38
36
  getUsageAndImports: RendererWebpackBase['getUsageAndImports'];
package/dist/index.d.ts CHANGED
@@ -1,8 +1,7 @@
1
- import { RendererWebpackBase, Renderer, KsJsImport } from '@knapsack/renderer-webpack-base';
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
- import { KnapsackRenderParams } from '@knapsack/app/types';
5
- export { D as DemoWrapperProps } from './types-D2eCZXsg.js';
4
+ export { D as DemoWrapperProps } from './types-CivTHEEo.js';
6
5
 
7
6
  declare class KnapsackReactRenderer extends RendererWebpackBase implements Renderable {
8
7
  /**
@@ -27,12 +26,11 @@ declare class KnapsackReactRenderer extends RendererWebpackBase implements Rende
27
26
  getMeta: Renderer['getMeta'];
28
27
  changeCase: Renderer['changeCase'];
29
28
  createWebpackConfig: RendererWebpackBase['createWebpackConfig'];
30
- getJsImports: RendererWebpackBase['getJsImports'];
31
- prepClientRenderResults({ usage, demoApp, imports: xImports, renderOptions: { pattern, template, demo }, }: {
29
+ prepClientRenderResults({ usage, demoApp, importMap, renderOptions: { demo, state, patternId, templateId }, }: {
32
30
  usage: string;
33
31
  demoApp: string;
34
- imports: KsJsImport[];
35
- renderOptions: KnapsackRenderParams;
32
+ importMap: KsJsImportMap;
33
+ renderOptions: Parameters<Renderer['render']>[0];
36
34
  }): ReturnType<Renderer['render']>;
37
35
  render: Renderer['render'];
38
36
  getUsageAndImports: RendererWebpackBase['getUsageAndImports'];