@sanity/workbench 0.0.1-alpha.0 → 0.1.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Sanity.io
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: !0 });
3
+ var runtime = require("@sanity/federation/runtime");
4
+ const REMOTE_NAME = "workbench-remote", REMOTE_MODULE = "./App";
5
+ async function renderWorkbench(rootElement, config, options) {
6
+ if (!rootElement)
7
+ throw new Error("Missing root element to mount application into");
8
+ const remoteUrl = (void 0).SANITY_INTERNAL_WORKBENCH_REMOTE_URL;
9
+ if (!remoteUrl)
10
+ throw new Error("SANITY_INTERNAL_WORKBENCH_REMOTE_URL is not set");
11
+ const mf = runtime.createInstance({
12
+ name: "sanity-workbench"
13
+ });
14
+ mf.registerRemotes([
15
+ {
16
+ name: REMOTE_NAME,
17
+ entry: remoteUrl
18
+ }
19
+ ]);
20
+ let remoteModule;
21
+ try {
22
+ remoteModule = await mf.loadRemote(
23
+ `${REMOTE_NAME}/${REMOTE_MODULE}`
24
+ );
25
+ } catch (error) {
26
+ throw new Error(
27
+ `Failed to load remote workbench module from "${remoteUrl}"`,
28
+ { cause: error }
29
+ );
30
+ }
31
+ if (!remoteModule || typeof remoteModule.render != "function")
32
+ throw new Error(
33
+ `Remote module from "${remoteUrl}" did not expose a render function`
34
+ );
35
+ return remoteModule.render(rootElement, config, options);
36
+ }
37
+ exports.renderWorkbench = renderWorkbench;
38
+ //# sourceMappingURL=_internal.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_internal.cjs","sources":["../src/_internal/render.ts"],"sourcesContent":["import { createInstance } from \"@sanity/federation/runtime\";\n\nconst REMOTE_NAME = \"workbench-remote\";\nconst REMOTE_MODULE = \"./App\";\n\n/**\n * @public\n */\nexport type Config = undefined;\n\n/**\n * @public\n */\nexport interface RenderWorkbenchOptions {\n reactStrictMode?: boolean;\n}\n\ninterface RemoteModule {\n render(\n rootElement: HTMLElement,\n config?: Config,\n options?: RenderWorkbenchOptions,\n ): () => void;\n}\n\n/**\n * Creates a Module Federation instance, loads a remote workbench\n * application, and renders it into the provided root element.\n *\n * @param rootElement - The DOM element to render into\n * @param config - Workbench configuration (reserved for future use)\n * @param options - Rendering options forwarded to the remote\n * @returns A cleanup function that unmounts the remote application\n *\n * @public\n */\nexport async function renderWorkbench(\n rootElement: HTMLElement,\n config?: Config,\n options?: RenderWorkbenchOptions,\n): Promise<() => void> {\n if (!rootElement) {\n throw new Error(\"Missing root element to mount application into\");\n }\n\n const remoteUrl = import.meta.env.SANITY_INTERNAL_WORKBENCH_REMOTE_URL;\n if (!remoteUrl) {\n throw new Error(\"SANITY_INTERNAL_WORKBENCH_REMOTE_URL is not set\");\n }\n\n const mf = createInstance({\n name: \"sanity-workbench\",\n });\n\n mf.registerRemotes([\n {\n name: REMOTE_NAME,\n entry: remoteUrl,\n },\n ]);\n\n let remoteModule: RemoteModule | null;\n try {\n remoteModule = await mf.loadRemote<RemoteModule>(\n `${REMOTE_NAME}/${REMOTE_MODULE}`,\n );\n } catch (error) {\n throw new Error(\n `Failed to load remote workbench module from \"${remoteUrl}\"`,\n { cause: error },\n );\n }\n\n if (!remoteModule || typeof remoteModule.render !== \"function\") {\n throw new Error(\n `Remote module from \"${remoteUrl}\" did not expose a render function`,\n );\n }\n\n return remoteModule.render(rootElement, config, options);\n}\n"],"names":["createInstance"],"mappings":";;;AAEA,MAAM,cAAc,oBACd,gBAAgB;AAiCtB,eAAsB,gBACpB,aACA,QACA,SACqB;AACrB,MAAI,CAAC;AACH,UAAM,IAAI,MAAM,gDAAgD;AAGlE,QAAM,YAAY,SAAgB;AAClC,MAAI,CAAC;AACH,UAAM,IAAI,MAAM,iDAAiD;AAGnE,QAAM,KAAKA,QAAAA,eAAe;AAAA,IACxB,MAAM;AAAA,EAAA,CACP;AAED,KAAG,gBAAgB;AAAA,IACjB;AAAA,MACE,MAAM;AAAA,MACN,OAAO;AAAA,IAAA;AAAA,EACT,CACD;AAED,MAAI;AACJ,MAAI;AACF,mBAAe,MAAM,GAAG;AAAA,MACtB,GAAG,WAAW,IAAI,aAAa;AAAA,IAAA;AAAA,EAEnC,SAAS,OAAO;AACd,UAAM,IAAI;AAAA,MACR,gDAAgD,SAAS;AAAA,MACzD,EAAE,OAAO,MAAA;AAAA,IAAM;AAAA,EAEnB;AAEA,MAAI,CAAC,gBAAgB,OAAO,aAAa,UAAW;AAClD,UAAM,IAAI;AAAA,MACR,uBAAuB,SAAS;AAAA,IAAA;AAIpC,SAAO,aAAa,OAAO,aAAa,QAAQ,OAAO;AACzD;;"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * @public
3
+ */
4
+ export declare type Config = undefined;
5
+
6
+ /**
7
+ * Creates a Module Federation instance, loads a remote workbench
8
+ * application, and renders it into the provided root element.
9
+ *
10
+ * @param rootElement - The DOM element to render into
11
+ * @param config - Workbench configuration (reserved for future use)
12
+ * @param options - Rendering options forwarded to the remote
13
+ * @returns A cleanup function that unmounts the remote application
14
+ *
15
+ * @public
16
+ */
17
+ export declare function renderWorkbench(
18
+ rootElement: HTMLElement,
19
+ config?: Config,
20
+ options?: RenderWorkbenchOptions,
21
+ ): Promise<() => void>;
22
+
23
+ /**
24
+ * @public
25
+ */
26
+ export declare interface RenderWorkbenchOptions {
27
+ reactStrictMode?: boolean;
28
+ }
29
+
30
+ export {};
@@ -0,0 +1,30 @@
1
+ /**
2
+ * @public
3
+ */
4
+ export declare type Config = undefined;
5
+
6
+ /**
7
+ * Creates a Module Federation instance, loads a remote workbench
8
+ * application, and renders it into the provided root element.
9
+ *
10
+ * @param rootElement - The DOM element to render into
11
+ * @param config - Workbench configuration (reserved for future use)
12
+ * @param options - Rendering options forwarded to the remote
13
+ * @returns A cleanup function that unmounts the remote application
14
+ *
15
+ * @public
16
+ */
17
+ export declare function renderWorkbench(
18
+ rootElement: HTMLElement,
19
+ config?: Config,
20
+ options?: RenderWorkbenchOptions,
21
+ ): Promise<() => void>;
22
+
23
+ /**
24
+ * @public
25
+ */
26
+ export declare interface RenderWorkbenchOptions {
27
+ reactStrictMode?: boolean;
28
+ }
29
+
30
+ export {};
@@ -0,0 +1,38 @@
1
+ import { createInstance } from "@sanity/federation/runtime";
2
+ const REMOTE_NAME = "workbench-remote", REMOTE_MODULE = "./App";
3
+ async function renderWorkbench(rootElement, config, options) {
4
+ if (!rootElement)
5
+ throw new Error("Missing root element to mount application into");
6
+ const remoteUrl = import.meta.env.SANITY_INTERNAL_WORKBENCH_REMOTE_URL;
7
+ if (!remoteUrl)
8
+ throw new Error("SANITY_INTERNAL_WORKBENCH_REMOTE_URL is not set");
9
+ const mf = createInstance({
10
+ name: "sanity-workbench"
11
+ });
12
+ mf.registerRemotes([
13
+ {
14
+ name: REMOTE_NAME,
15
+ entry: remoteUrl
16
+ }
17
+ ]);
18
+ let remoteModule;
19
+ try {
20
+ remoteModule = await mf.loadRemote(
21
+ `${REMOTE_NAME}/${REMOTE_MODULE}`
22
+ );
23
+ } catch (error) {
24
+ throw new Error(
25
+ `Failed to load remote workbench module from "${remoteUrl}"`,
26
+ { cause: error }
27
+ );
28
+ }
29
+ if (!remoteModule || typeof remoteModule.render != "function")
30
+ throw new Error(
31
+ `Remote module from "${remoteUrl}" did not expose a render function`
32
+ );
33
+ return remoteModule.render(rootElement, config, options);
34
+ }
35
+ export {
36
+ renderWorkbench
37
+ };
38
+ //# sourceMappingURL=_internal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_internal.js","sources":["../src/_internal/render.ts"],"sourcesContent":["import { createInstance } from \"@sanity/federation/runtime\";\n\nconst REMOTE_NAME = \"workbench-remote\";\nconst REMOTE_MODULE = \"./App\";\n\n/**\n * @public\n */\nexport type Config = undefined;\n\n/**\n * @public\n */\nexport interface RenderWorkbenchOptions {\n reactStrictMode?: boolean;\n}\n\ninterface RemoteModule {\n render(\n rootElement: HTMLElement,\n config?: Config,\n options?: RenderWorkbenchOptions,\n ): () => void;\n}\n\n/**\n * Creates a Module Federation instance, loads a remote workbench\n * application, and renders it into the provided root element.\n *\n * @param rootElement - The DOM element to render into\n * @param config - Workbench configuration (reserved for future use)\n * @param options - Rendering options forwarded to the remote\n * @returns A cleanup function that unmounts the remote application\n *\n * @public\n */\nexport async function renderWorkbench(\n rootElement: HTMLElement,\n config?: Config,\n options?: RenderWorkbenchOptions,\n): Promise<() => void> {\n if (!rootElement) {\n throw new Error(\"Missing root element to mount application into\");\n }\n\n const remoteUrl = import.meta.env.SANITY_INTERNAL_WORKBENCH_REMOTE_URL;\n if (!remoteUrl) {\n throw new Error(\"SANITY_INTERNAL_WORKBENCH_REMOTE_URL is not set\");\n }\n\n const mf = createInstance({\n name: \"sanity-workbench\",\n });\n\n mf.registerRemotes([\n {\n name: REMOTE_NAME,\n entry: remoteUrl,\n },\n ]);\n\n let remoteModule: RemoteModule | null;\n try {\n remoteModule = await mf.loadRemote<RemoteModule>(\n `${REMOTE_NAME}/${REMOTE_MODULE}`,\n );\n } catch (error) {\n throw new Error(\n `Failed to load remote workbench module from \"${remoteUrl}\"`,\n { cause: error },\n );\n }\n\n if (!remoteModule || typeof remoteModule.render !== \"function\") {\n throw new Error(\n `Remote module from \"${remoteUrl}\" did not expose a render function`,\n );\n }\n\n return remoteModule.render(rootElement, config, options);\n}\n"],"names":[],"mappings":";AAEA,MAAM,cAAc,oBACd,gBAAgB;AAiCtB,eAAsB,gBACpB,aACA,QACA,SACqB;AACrB,MAAI,CAAC;AACH,UAAM,IAAI,MAAM,gDAAgD;AAGlE,QAAM,YAAY,YAAY,IAAI;AAClC,MAAI,CAAC;AACH,UAAM,IAAI,MAAM,iDAAiD;AAGnE,QAAM,KAAK,eAAe;AAAA,IACxB,MAAM;AAAA,EAAA,CACP;AAED,KAAG,gBAAgB;AAAA,IACjB;AAAA,MACE,MAAM;AAAA,MACN,OAAO;AAAA,IAAA;AAAA,EACT,CACD;AAED,MAAI;AACJ,MAAI;AACF,mBAAe,MAAM,GAAG;AAAA,MACtB,GAAG,WAAW,IAAI,aAAa;AAAA,IAAA;AAAA,EAEnC,SAAS,OAAO;AACd,UAAM,IAAI;AAAA,MACR,gDAAgD,SAAS;AAAA,MACzD,EAAE,OAAO,MAAA;AAAA,IAAM;AAAA,EAEnB;AAEA,MAAI,CAAC,gBAAgB,OAAO,aAAa,UAAW;AAClD,UAAM,IAAI;AAAA,MACR,uBAAuB,SAAS;AAAA,IAAA;AAIpC,SAAO,aAAa,OAAO,aAAa,QAAQ,OAAO;AACzD;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/workbench",
3
- "version": "0.0.1-alpha.0",
3
+ "version": "0.1.0-alpha.1",
4
4
  "description": "Workbench component for the Sanity Content Operating System",
5
5
  "keywords": [],
6
6
  "homepage": "https://github.com/sanity-io/workbench/packages/@sanity/workbench#readme",
@@ -20,36 +20,31 @@
20
20
  "type": "module",
21
21
  "sideEffects": false,
22
22
  "exports": {
23
- ".": {
24
- "source": "./src/index.tsx",
25
- "require": "./dist/index.cjs",
26
- "default": "./dist/index.js"
23
+ "./_internal": {
24
+ "source": "./src/_internal/index.ts",
25
+ "require": "./dist/_internal.cjs",
26
+ "default": "./dist/_internal.js"
27
27
  },
28
28
  "./package.json": "./package.json"
29
29
  },
30
- "scripts": {
31
- "build": "pkg build --strict --clean --check",
32
- "check:lint": "oxlint",
33
- "check:lint:fix": "oxlint --fix",
34
- "check:types": "tsc --noEmit",
35
- "dev": "pkg watch"
30
+ "dependencies": {
31
+ "@sanity/federation": "0.1.0-alpha.1"
36
32
  },
37
33
  "devDependencies": {
38
- "@repo/oxc-config": "workspace:*",
39
- "@repo/tsconfig": "workspace:*",
40
34
  "@sanity/pkg-utils": "^9.2.3",
41
- "@types/react": "catalog:",
42
- "@types/react-dom": "catalog:",
43
- "react": "catalog:",
44
- "react-dom": "catalog:",
45
- "typescript": "catalog:"
46
- },
47
- "peerDependencies": {
48
- "react": "catalog:",
49
- "react-dom": "catalog:"
35
+ "typescript": "^5.9.2",
36
+ "@repo/oxc-config": "0.0.0",
37
+ "@repo/tsconfig": "0.0.1"
50
38
  },
51
39
  "browserslist": "extends @sanity/browserslist-config",
52
40
  "engines": {
53
41
  "node": ">=20.19.1 <22 || >=22.12"
42
+ },
43
+ "scripts": {
44
+ "build": "pkg build --strict --clean --check",
45
+ "check:lint": "oxlint",
46
+ "check:lint:fix": "oxlint --fix",
47
+ "check:types": "tsc --noEmit",
48
+ "dev": "pkg watch"
54
49
  }
55
- }
50
+ }
@@ -0,0 +1,2 @@
1
+ export { renderWorkbench } from "./render";
2
+ export type { Config, RenderWorkbenchOptions } from "./render";
@@ -0,0 +1,81 @@
1
+ import { createInstance } from "@sanity/federation/runtime";
2
+
3
+ const REMOTE_NAME = "workbench-remote";
4
+ const REMOTE_MODULE = "./App";
5
+
6
+ /**
7
+ * @public
8
+ */
9
+ export type Config = undefined;
10
+
11
+ /**
12
+ * @public
13
+ */
14
+ export interface RenderWorkbenchOptions {
15
+ reactStrictMode?: boolean;
16
+ }
17
+
18
+ interface RemoteModule {
19
+ render(
20
+ rootElement: HTMLElement,
21
+ config?: Config,
22
+ options?: RenderWorkbenchOptions,
23
+ ): () => void;
24
+ }
25
+
26
+ /**
27
+ * Creates a Module Federation instance, loads a remote workbench
28
+ * application, and renders it into the provided root element.
29
+ *
30
+ * @param rootElement - The DOM element to render into
31
+ * @param config - Workbench configuration (reserved for future use)
32
+ * @param options - Rendering options forwarded to the remote
33
+ * @returns A cleanup function that unmounts the remote application
34
+ *
35
+ * @public
36
+ */
37
+ export async function renderWorkbench(
38
+ rootElement: HTMLElement,
39
+ config?: Config,
40
+ options?: RenderWorkbenchOptions,
41
+ ): Promise<() => void> {
42
+ if (!rootElement) {
43
+ throw new Error("Missing root element to mount application into");
44
+ }
45
+
46
+ const remoteUrl = import.meta.env.SANITY_INTERNAL_WORKBENCH_REMOTE_URL;
47
+ if (!remoteUrl) {
48
+ throw new Error("SANITY_INTERNAL_WORKBENCH_REMOTE_URL is not set");
49
+ }
50
+
51
+ const mf = createInstance({
52
+ name: "sanity-workbench",
53
+ });
54
+
55
+ mf.registerRemotes([
56
+ {
57
+ name: REMOTE_NAME,
58
+ entry: remoteUrl,
59
+ },
60
+ ]);
61
+
62
+ let remoteModule: RemoteModule | null;
63
+ try {
64
+ remoteModule = await mf.loadRemote<RemoteModule>(
65
+ `${REMOTE_NAME}/${REMOTE_MODULE}`,
66
+ );
67
+ } catch (error) {
68
+ throw new Error(
69
+ `Failed to load remote workbench module from "${remoteUrl}"`,
70
+ { cause: error },
71
+ );
72
+ }
73
+
74
+ if (!remoteModule || typeof remoteModule.render !== "function") {
75
+ throw new Error(
76
+ `Remote module from "${remoteUrl}" did not expose a render function`,
77
+ );
78
+ }
79
+
80
+ return remoteModule.render(rootElement, config, options);
81
+ }
package/src/env.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ interface ImportMetaEnv {
2
+ readonly SANITY_INTERNAL_WORKBENCH_REMOTE_URL: string;
3
+ }
4
+
5
+ interface ImportMeta {
6
+ readonly env: ImportMetaEnv;
7
+ }
package/dist/index.cjs DELETED
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: !0 });
3
- var jsxRuntime = require("react/jsx-runtime"), react = require("react"), client = require("react-dom/client");
4
- function Workbench(_props) {
5
- return /* @__PURE__ */ jsxRuntime.jsx("h1", { children: "Hello World" });
6
- }
7
- function renderWorkbench(rootElement, config, options) {
8
- if (!rootElement)
9
- throw new Error("Missing root element to mount application into");
10
- const root = client.createRoot(rootElement), workbench = /* @__PURE__ */ jsxRuntime.jsx(Workbench, { config });
11
- return root.render(
12
- options?.reactStrictMode ? /* @__PURE__ */ jsxRuntime.jsx(react.StrictMode, { children: workbench }) : workbench
13
- ), () => root.unmount();
14
- }
15
- exports.renderWorkbench = renderWorkbench;
16
- //# sourceMappingURL=index.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.cjs","sources":["../src/index.tsx"],"sourcesContent":["import { StrictMode } from \"react\";\nimport { createRoot } from \"react-dom/client\";\n\ninterface WorkbenchProps {\n config: undefined;\n}\n\nfunction Workbench(_props: WorkbenchProps) {\n return <h1>Hello World</h1>;\n}\n\ninterface RenderWorkbenchOptions {\n reactStrictMode: boolean;\n}\n\nexport function renderWorkbench(\n rootElement: HTMLElement,\n config: Config,\n options?: RenderWorkbenchOptions,\n): () => void {\n if (!rootElement) {\n throw new Error(\"Missing root element to mount application into\");\n }\n\n const root = createRoot(rootElement);\n const workbench = <Workbench config={config} />;\n\n root.render(\n options?.reactStrictMode ? <StrictMode>{workbench}</StrictMode> : workbench,\n );\n\n return () => root.unmount();\n}\n\nexport type Config = WorkbenchProps[\"config\"];\n"],"names":["jsx","createRoot","StrictMode"],"mappings":";;;AAOA,SAAS,UAAU,QAAwB;AACzC,SAAOA,2BAAAA,IAAC,QAAG,UAAA,cAAA,CAAW;AACxB;AAMO,SAAS,gBACd,aACA,QACA,SACY;AACZ,MAAI,CAAC;AACH,UAAM,IAAI,MAAM,gDAAgD;AAGlE,QAAM,OAAOC,OAAAA,WAAW,WAAW,GAC7B,YAAYD,+BAAC,aAAU,QAAgB;AAE7C,SAAA,KAAK;AAAA,IACH,SAAS,kBAAkBA,+BAACE,MAAAA,YAAA,EAAY,qBAAU,IAAgB;AAAA,EAAA,GAG7D,MAAM,KAAK,QAAA;AACpB;;"}
package/dist/index.js DELETED
@@ -1,18 +0,0 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import { StrictMode } from "react";
3
- import { createRoot } from "react-dom/client";
4
- function Workbench(_props) {
5
- return /* @__PURE__ */ jsx("h1", { children: "Hello World" });
6
- }
7
- function renderWorkbench(rootElement, config, options) {
8
- if (!rootElement)
9
- throw new Error("Missing root element to mount application into");
10
- const root = createRoot(rootElement), workbench = /* @__PURE__ */ jsx(Workbench, { config });
11
- return root.render(
12
- options?.reactStrictMode ? /* @__PURE__ */ jsx(StrictMode, { children: workbench }) : workbench
13
- ), () => root.unmount();
14
- }
15
- export {
16
- renderWorkbench
17
- };
18
- //# sourceMappingURL=index.js.map
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":["../src/index.tsx"],"sourcesContent":["import { StrictMode } from \"react\";\nimport { createRoot } from \"react-dom/client\";\n\ninterface WorkbenchProps {\n config: undefined;\n}\n\nfunction Workbench(_props: WorkbenchProps) {\n return <h1>Hello World</h1>;\n}\n\ninterface RenderWorkbenchOptions {\n reactStrictMode: boolean;\n}\n\nexport function renderWorkbench(\n rootElement: HTMLElement,\n config: Config,\n options?: RenderWorkbenchOptions,\n): () => void {\n if (!rootElement) {\n throw new Error(\"Missing root element to mount application into\");\n }\n\n const root = createRoot(rootElement);\n const workbench = <Workbench config={config} />;\n\n root.render(\n options?.reactStrictMode ? <StrictMode>{workbench}</StrictMode> : workbench,\n );\n\n return () => root.unmount();\n}\n\nexport type Config = WorkbenchProps[\"config\"];\n"],"names":[],"mappings":";;;AAOA,SAAS,UAAU,QAAwB;AACzC,SAAO,oBAAC,QAAG,UAAA,cAAA,CAAW;AACxB;AAMO,SAAS,gBACd,aACA,QACA,SACY;AACZ,MAAI,CAAC;AACH,UAAM,IAAI,MAAM,gDAAgD;AAGlE,QAAM,OAAO,WAAW,WAAW,GAC7B,YAAY,oBAAC,aAAU,QAAgB;AAE7C,SAAA,KAAK;AAAA,IACH,SAAS,kBAAkB,oBAAC,YAAA,EAAY,qBAAU,IAAgB;AAAA,EAAA,GAG7D,MAAM,KAAK,QAAA;AACpB;"}
package/src/index.tsx DELETED
@@ -1,35 +0,0 @@
1
- import { StrictMode } from "react";
2
- import { createRoot } from "react-dom/client";
3
-
4
- interface WorkbenchProps {
5
- config: undefined;
6
- }
7
-
8
- function Workbench(_props: WorkbenchProps) {
9
- return <h1>Hello World</h1>;
10
- }
11
-
12
- interface RenderWorkbenchOptions {
13
- reactStrictMode: boolean;
14
- }
15
-
16
- export function renderWorkbench(
17
- rootElement: HTMLElement,
18
- config: Config,
19
- options?: RenderWorkbenchOptions,
20
- ): () => void {
21
- if (!rootElement) {
22
- throw new Error("Missing root element to mount application into");
23
- }
24
-
25
- const root = createRoot(rootElement);
26
- const workbench = <Workbench config={config} />;
27
-
28
- root.render(
29
- options?.reactStrictMode ? <StrictMode>{workbench}</StrictMode> : workbench,
30
- );
31
-
32
- return () => root.unmount();
33
- }
34
-
35
- export type Config = WorkbenchProps["config"];