create-bluecopa-react-app 1.0.6 → 1.0.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-bluecopa-react-app",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
4
4
  "description": "CLI tool to create bluecopa React applications",
5
5
  "type": "module",
6
6
  "main": "./bin/create-bluecopa-react-app.js",
@@ -48,10 +48,10 @@ const lifecycles = singleSpaReact({
48
48
  },
49
49
  renderType: "createRoot",
50
50
  domElementGetter: () => {
51
- const el = document.getElementById("single-spa-application:pnl-explorer");
51
+ const el = document.getElementById("single-spa-application:bluecopa-preview");
52
52
  if (!el)
53
53
  throw new Error(
54
- "Mount target #single-spa-application:pnl-explorer not found"
54
+ "Mount target #single-spa-application:bluecopa-preview not found"
55
55
  );
56
56
  return el;
57
57
  },
@@ -1,4 +1,4 @@
1
- System.register(['./__federation_fn_import-CzfA7kmP.js', './client-DgSav55y.js'], (function (exports, module) {
1
+ System.register(['./__federation_fn_import-CzfA7kmP.js', './client-BZh_TW_6.js'], (function (exports, module) {
2
2
  'use strict';
3
3
  var importShared, jsxRuntimeExports, clientExports, MemoryRouter, BrowserRouter, App;
4
4
  return {
@@ -17,10 +17,44 @@ System.register(['./__federation_fn_import-CzfA7kmP.js', './client-DgSav55y.js']
17
17
 
18
18
  const React = await importShared('react');
19
19
  let root = null;
20
+ const injectStylesIntoShadowDOM = exports("injectStylesIntoShadowDOM", (styles) => {
21
+ const shadowRoot = window.__microfrontendShadowRoot;
22
+ if (shadowRoot) {
23
+ const styleElement = document.createElement("style");
24
+ const stylesArray = Array.isArray(styles) ? styles : [styles];
25
+ styleElement.textContent = stylesArray.join("\n");
26
+ shadowRoot.appendChild(styleElement);
27
+ console.log("Styles injected into shadow DOM");
28
+ } else {
29
+ console.warn("Shadow DOM not available for style injection");
30
+ }
31
+ });
32
+ const loadCSSIntoShadowDOM = exports("loadCSSIntoShadowDOM", async (cssUrls) => {
33
+ const shadowRoot = window.__microfrontendShadowRoot;
34
+ if (shadowRoot) {
35
+ const urlsArray = Array.isArray(cssUrls) ? cssUrls : [cssUrls];
36
+ for (const cssUrl of urlsArray) {
37
+ try {
38
+ console.log(`Loading CSS file: ${cssUrl}`);
39
+ const linkElement = document.createElement("link");
40
+ linkElement.rel = "stylesheet";
41
+ linkElement.href = cssUrl;
42
+ linkElement.onload = () => console.log(`CSS loaded: ${cssUrl}`);
43
+ linkElement.onerror = () => console.warn(`Failed to load CSS: ${cssUrl}`);
44
+ shadowRoot.appendChild(linkElement);
45
+ await new Promise((resolve) => setTimeout(resolve, 100));
46
+ } catch (error) {
47
+ console.warn(`Failed to load CSS: ${cssUrl}`, error);
48
+ }
49
+ }
50
+ } else {
51
+ console.warn("Shadow DOM not available for CSS loading");
52
+ }
53
+ });
20
54
  const MicrofrontendRoot = ({ basename = "/", isMicroFrontend = false }) => {
21
55
  const Router = isMicroFrontend ? MemoryRouter : BrowserRouter;
22
56
  const routerProps = isMicroFrontend ? {} : { basename };
23
- return /* @__PURE__ */ jsxRuntimeExports.jsx(Router, { ...routerProps, children: /* @__PURE__ */ jsxRuntimeExports.jsx(App, {}) });
57
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: { width: "100%", height: "100%", overflow: "auto" }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Router, { ...routerProps, children: /* @__PURE__ */ jsxRuntimeExports.jsx(App, {}) }) });
24
58
  };
25
59
  const lifecycles = i({
26
60
  React,
@@ -32,10 +66,10 @@ System.register(['./__federation_fn_import-CzfA7kmP.js', './client-DgSav55y.js']
32
66
  },
33
67
  renderType: "createRoot",
34
68
  domElementGetter: () => {
35
- const el = document.getElementById("single-spa-application:pnl-explorer");
69
+ const el = document.getElementById("single-spa-application:bluecopa-preview");
36
70
  if (!el)
37
71
  throw new Error(
38
- "Mount target #single-spa-application:pnl-explorer not found"
72
+ "Mount target #single-spa-application:bluecopa-preview not found"
39
73
  );
40
74
  return el;
41
75
  }
@@ -50,6 +84,28 @@ System.register(['./__federation_fn_import-CzfA7kmP.js', './client-DgSav55y.js']
50
84
  root.unmount();
51
85
  root = null;
52
86
  }
87
+ injectStylesIntoShadowDOM(`
88
+ /* Basic reset for microfrontend */
89
+ * {
90
+ box-sizing: border-box;
91
+ }
92
+
93
+ body {
94
+ margin: 0;
95
+ padding: 0;
96
+ font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
97
+ font-size: 14px;
98
+ line-height: 1.5;
99
+ color: #000;
100
+ }
101
+
102
+ /* Ensure proper display */
103
+ #microfrontend-container {
104
+ width: 100%;
105
+ height: 100%;
106
+ overflow: auto;
107
+ }
108
+ `);
53
109
  root = clientExports.createRoot(props.domElement);
54
110
  root.render(
55
111
  /* @__PURE__ */ jsxRuntimeExports.jsx(