@optiaxiom/proteus 0.2.9 → 0.2.11-next.2

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.
@@ -1,5 +1,5 @@
1
- @layer optiaxiom._1fgw1dd;
2
- @layer optiaxiom._1fgw1dd {
1
+ @layer optiaxiom.g7voo0;
2
+ @layer optiaxiom.g7voo0 {
3
3
  .ProteusChart__jmlqij1 {
4
4
  border-radius: 16px;
5
5
  }
@@ -1,5 +1,5 @@
1
- @layer optiaxiom._1fgw1dd;
2
- @layer optiaxiom._1fgw1dd {
1
+ @layer optiaxiom.g7voo0;
2
+ @layer optiaxiom.g7voo0 {
3
3
  .ProteusChartTooltipContent__1gsvq810 {
4
4
  min-width: 128px;
5
5
  position: absolute;
@@ -1,5 +1,5 @@
1
- @layer optiaxiom._1fgw1dd;
2
- @layer optiaxiom._1fgw1dd {
1
+ @layer optiaxiom.g7voo0;
2
+ @layer optiaxiom.g7voo0 {
3
3
  .ProteusDocumentShell__vpuvfj1 {
4
4
  margin: -4px;
5
5
  }
@@ -1,5 +1,5 @@
1
- @layer optiaxiom._1fgw1dd;
2
- @layer optiaxiom._1fgw1dd {
1
+ @layer optiaxiom.g7voo0;
2
+ @layer optiaxiom.g7voo0 {
3
3
  .ProteusImageCarousel__1t6qej70 {
4
4
  outline: none;
5
5
  user-select: none;
@@ -1,5 +1,5 @@
1
- @layer optiaxiom._1fgw1dd;
2
- @layer optiaxiom._1fgw1dd {
1
+ @layer optiaxiom.g7voo0;
2
+ @layer optiaxiom.g7voo0 {
3
3
  .ProteusQuestion__8f590p0 {
4
4
  outline: none;
5
5
  }
package/dist/esm/index.js CHANGED
@@ -5,6 +5,7 @@ export { ProteusDataTable } from './proteus-data-table/ProteusDataTable.js';
5
5
  export { ProteusDocumentRenderer } from './proteus-document/ProteusDocumentRenderer.js';
6
6
  export { ProteusDocumentShell } from './proteus-document/ProteusDocumentShell.js';
7
7
  export { safeParseDocument } from './proteus-document/schemas.js';
8
+ export { ProteusFederated } from './proteus-federated/ProteusFederated.js';
8
9
  export { ProteusFileUpload } from './proteus-file-upload/ProteusFileUpload.js';
9
10
  export { ProteusImage } from './proteus-image/ProteusImage.js';
10
11
  export { ProteusImageCarousel } from './proteus-image-carousel/ProteusImageCarousel.js';
@@ -1,4 +1,4 @@
1
- import './../assets/src/proteus-chart/ProteusChart.css.ts.vanilla-BO0-TwP_.css';
1
+ import './../assets/src/proteus-chart/ProteusChart.css.ts.vanilla-dJjly98l.css';
2
2
  import { recipe } from '@optiaxiom/react/css-runtime';
3
3
 
4
4
  var chart = recipe({base:[{border:'1',borderColor:'border.tertiary',fontSize:'sm',p:'16'},'ProteusChart__jmlqij1','ProteusChart__jmlqij0']});
@@ -1,4 +1,4 @@
1
- import './../assets/src/proteus-chart/ProteusChartTooltipContent.css.ts.vanilla-ETMXhILd.css';
1
+ import './../assets/src/proteus-chart/ProteusChartTooltipContent.css.ts.vanilla-Crdo1SWy.css';
2
2
  import { recipe } from '@optiaxiom/react/css-runtime';
3
3
 
4
4
  var tooltip = recipe({base:[{bg:'bg.default',border:'1',borderColor:'border.secondary',display:'grid',fontSize:'sm',gap:'6',pointerEvents:'none',px:'8',py:'10',rounded:'lg',shadow:'lg',transition:'all',z:'popover'},'ProteusChartTooltipContent__1gsvq810']});
@@ -1,4 +1,4 @@
1
- import './../assets/src/proteus-document/ProteusDocumentShell.css.ts.vanilla-CDxANCyw.css';
1
+ import './../assets/src/proteus-document/ProteusDocumentShell.css.ts.vanilla-DvoqWndD.css';
2
2
  import { recipe } from '@optiaxiom/react/css-runtime';
3
3
 
4
4
  var body = recipe({base:[{flexDirection:'column',gap:'16'},'ProteusDocumentShell__vpuvfj0'],variants:{truncate:{false:{},true:[{maxH:'sm',overflow:'auto',p:'4'},'ProteusDocumentShell__vpuvfj1']}}});
@@ -11,6 +11,7 @@ import { useProteusDocumentContext } from '../proteus-document/ProteusDocumentCo
11
11
  import { useProteusDocumentPathContext } from '../proteus-document/ProteusDocumentPathContext.js';
12
12
  import { resolveProteusProp } from '../proteus-document/resolveProteusProp.js';
13
13
  import { safeParseElement } from '../proteus-document/schemas.js';
14
+ import { ProteusFederated } from '../proteus-federated/ProteusFederated.js';
14
15
  import { ProteusFileUpload } from '../proteus-file-upload/ProteusFileUpload.js';
15
16
  import { ProteusImageCarousel } from '../proteus-image-carousel/ProteusImageCarousel.js';
16
17
  import { ProteusImage } from '../proteus-image/ProteusImage.js';
@@ -96,6 +97,13 @@ const ProteusElement = ({
96
97
  ...resolve(element)
97
98
  }
98
99
  );
100
+ case "Federated":
101
+ return /* @__PURE__ */ jsx(
102
+ ProteusFederated,
103
+ {
104
+ ...resolve(element)
105
+ }
106
+ );
99
107
  case "Field":
100
108
  return /* @__PURE__ */ jsx(Field, { ...resolve(element) });
101
109
  case "FileUpload":
@@ -0,0 +1,58 @@
1
+ "use client";
2
+ import { jsx, Fragment } from 'react/jsx-runtime';
3
+ import { registerRemotes, loadRemote, getInstance, init } from '@module-federation/enhanced/runtime';
4
+ import { useId, useState, useEffect, Suspense } from 'react';
5
+ import { useProteusDocumentContext } from '../proteus-document/ProteusDocumentContext.js';
6
+
7
+ function ProteusFederated({
8
+ entry,
9
+ exposeKey = ".",
10
+ fallback
11
+ }) {
12
+ const { data, onEvent } = useProteusDocumentContext(
13
+ "@optiaxiom/proteus/ProteusFederated"
14
+ );
15
+ const id = useId();
16
+ const name = `proteus_${id.replace(/[^a-zA-Z0-9]/g, "_")}`;
17
+ const [Component, setComponent] = useState(null);
18
+ const [error, setError] = useState(false);
19
+ useEffect(() => {
20
+ if (!entry) {
21
+ setError(true);
22
+ return;
23
+ }
24
+ let cancelled = false;
25
+ ensureInstance();
26
+ registerRemotes([{ entry, name, type: "esm" }], { force: false });
27
+ const modulePath = exposeKey === "." ? "" : exposeKey.replace(/^\.\//, "");
28
+ const remoteId = modulePath ? `${name}/${modulePath}` : name;
29
+ loadRemote(remoteId).then((mod) => {
30
+ if (!cancelled && mod) {
31
+ setComponent(() => mod.default);
32
+ } else if (!cancelled) {
33
+ setError(true);
34
+ }
35
+ }).catch(() => {
36
+ if (!cancelled)
37
+ setError(true);
38
+ });
39
+ return () => {
40
+ cancelled = true;
41
+ };
42
+ }, [entry, exposeKey, name]);
43
+ if (error) {
44
+ return fallback ? /* @__PURE__ */ jsx(Fragment, { children: fallback }) : null;
45
+ }
46
+ if (!Component) {
47
+ return null;
48
+ }
49
+ return /* @__PURE__ */ jsx(Suspense, { fallback: null, children: /* @__PURE__ */ jsx(Component, { data, onEvent }) });
50
+ }
51
+ function ensureInstance() {
52
+ if (!getInstance()) {
53
+ init({ name: "proteus-federated", remotes: [] });
54
+ }
55
+ }
56
+ ProteusFederated.displayName = "@optiaxiom/proteus/ProteusFederated";
57
+
58
+ export { ProteusFederated };
@@ -1,4 +1,4 @@
1
- import './../assets/src/proteus-image-carousel/ProteusImageCarousel.css.ts.vanilla-CVLALefb.css';
1
+ import './../assets/src/proteus-image-carousel/ProteusImageCarousel.css.ts.vanilla-DWOlO6KM.css';
2
2
  import { recipe } from '@optiaxiom/react/css-runtime';
3
3
 
4
4
  var carousel = recipe({base:[{flexDirection:'column',gap:'12'},'ProteusImageCarousel__1t6qej70']});
@@ -1,4 +1,4 @@
1
- import './../assets/src/proteus-question/ProteusQuestion.css.ts.vanilla-DKDk8HIF.css';
1
+ import './../assets/src/proteus-question/ProteusQuestion.css.ts.vanilla-DLqLEZxX.css';
2
2
  import { recipe } from '@optiaxiom/react/css-runtime';
3
3
 
4
4
  var addon = recipe({base:[{display:'grid',fontWeight:'500',placeItems:'center',rounded:'lg',size:'md',transition:'colors'},'ProteusQuestion__8f590p3'],variants:{cursor:{pointer:{cursor:'pointer'}}}});