@optiaxiom/proteus 0.2.8 → 0.2.10

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.
Files changed (19) hide show
  1. package/dist/esm/assets/src/proteus-chart/{ProteusChart.css.ts.vanilla-BO0-TwP_.css → ProteusChart.css.ts.vanilla-9aXajeqc.css} +2 -2
  2. package/dist/esm/assets/src/proteus-chart/{ProteusChartTooltipContent.css.ts.vanilla-ETMXhILd.css → ProteusChartTooltipContent.css.ts.vanilla-BvKLAJt6.css} +2 -2
  3. package/dist/esm/assets/src/proteus-document/{ProteusDocumentShell.css.ts.vanilla-CDxANCyw.css → ProteusDocumentShell.css.ts.vanilla-DKjJk3n9.css} +2 -2
  4. package/dist/esm/assets/src/proteus-image-carousel/{ProteusImageCarousel.css.ts.vanilla-CVLALefb.css → ProteusImageCarousel.css.ts.vanilla-CVsqKi1-.css} +2 -2
  5. package/dist/esm/assets/src/proteus-question/{ProteusQuestion.css.ts.vanilla-DKDk8HIF.css → ProteusQuestion.css.ts.vanilla-DAuhHkyp.css} +2 -2
  6. package/dist/esm/index.js +1 -0
  7. package/dist/esm/proteus-chart/ProteusChart-css.js +1 -1
  8. package/dist/esm/proteus-chart/ProteusChartTooltipContent-css.js +1 -1
  9. package/dist/esm/proteus-document/ProteusDocumentShell-css.js +1 -1
  10. package/dist/esm/proteus-document/ProteusDocumentShell.js +4 -0
  11. package/dist/esm/proteus-element/ProteusElement.js +8 -0
  12. package/dist/esm/proteus-federated/ProteusFederated.js +58 -0
  13. package/dist/esm/proteus-image-carousel/ProteusImageCarousel-css.js +1 -1
  14. package/dist/esm/proteus-question/ProteusQuestion-css.js +1 -1
  15. package/dist/esm/schema/public-schema.json.js +62 -0
  16. package/dist/esm/schema/runtime-schema.json.js +60 -0
  17. package/dist/index.d.ts +25 -1
  18. package/dist/spec.d.ts +2252 -2210
  19. package/package.json +4 -3
@@ -1,5 +1,5 @@
1
- @layer optiaxiom._1fgw1dd;
2
- @layer optiaxiom._1fgw1dd {
1
+ @layer optiaxiom._13gldnk;
2
+ @layer optiaxiom._13gldnk {
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._13gldnk;
2
+ @layer optiaxiom._13gldnk {
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._13gldnk;
2
+ @layer optiaxiom._13gldnk {
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._13gldnk;
2
+ @layer optiaxiom._13gldnk {
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._13gldnk;
2
+ @layer optiaxiom._13gldnk {
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-9aXajeqc.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-BvKLAJt6.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-DKjJk3n9.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']}}});
@@ -94,6 +94,10 @@ function ProteusDocumentShell({
94
94
  } else {
95
95
  await Promise.all(urls.map((u) => downloadFile(u)));
96
96
  }
97
+ } else if (event.action === "openLink") {
98
+ if (typeof event.url === "string") {
99
+ window.open(event.url, "_blank", "noopener,noreferrer");
100
+ }
97
101
  }
98
102
  return;
99
103
  }),
@@ -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-CVsqKi1-.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-DAuhHkyp.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'}}}});
@@ -2731,6 +2731,9 @@ var definitions = {
2731
2731
  {
2732
2732
  $ref: "#/definitions/ProteusDataTable"
2733
2733
  },
2734
+ {
2735
+ $ref: "#/definitions/ProteusFederated"
2736
+ },
2734
2737
  {
2735
2738
  $ref: "#/definitions/ProteusField"
2736
2739
  },
@@ -2875,6 +2878,33 @@ var definitions = {
2875
2878
  "url"
2876
2879
  ],
2877
2880
  type: "object"
2881
+ },
2882
+ {
2883
+ additionalProperties: false,
2884
+ description: "Client-side component action - for opening a link in a new tab",
2885
+ properties: {
2886
+ action: {
2887
+ "const": "openLink",
2888
+ description: "The action type",
2889
+ type: "string"
2890
+ },
2891
+ url: {
2892
+ anyOf: [
2893
+ {
2894
+ $ref: "#/definitions/ProteusExpression"
2895
+ },
2896
+ {
2897
+ type: "string"
2898
+ }
2899
+ ],
2900
+ description: "URL to open in a new tab"
2901
+ }
2902
+ },
2903
+ required: [
2904
+ "action",
2905
+ "url"
2906
+ ],
2907
+ type: "object"
2878
2908
  }
2879
2909
  ],
2880
2910
  description: "Handler for user interactions - a server-side interaction call, client-side message, or client-side component action"
@@ -4921,6 +4951,38 @@ var definitions = {
4921
4951
  ],
4922
4952
  type: "object"
4923
4953
  },
4954
+ ProteusFederated: {
4955
+ additionalProperties: false,
4956
+ examples: [
4957
+ {
4958
+ $type: "Federated",
4959
+ entry: "https://widgets.example.com/remoteEntry.js"
4960
+ }
4961
+ ],
4962
+ properties: {
4963
+ $type: {
4964
+ "const": "Federated"
4965
+ },
4966
+ entry: {
4967
+ description: "URL to the remote application's remoteEntry.js or mf-manifest.json",
4968
+ type: "string"
4969
+ },
4970
+ exposeKey: {
4971
+ "default": ".",
4972
+ description: "The key from the remote's ModuleFederationPlugin exposes config (e.g. './App'). Defaults to '.' (root export)",
4973
+ type: "string"
4974
+ },
4975
+ fallback: {
4976
+ $ref: "#/definitions/ProteusNode",
4977
+ description: "Content rendered when the federated component fails to load"
4978
+ }
4979
+ },
4980
+ required: [
4981
+ "$type",
4982
+ "entry"
4983
+ ],
4984
+ type: "object"
4985
+ },
4924
4986
  ProteusField: {
4925
4987
  additionalProperties: false,
4926
4988
  examples: [
@@ -2719,6 +2719,9 @@ var definitions = {
2719
2719
  {
2720
2720
  $ref: "#/definitions/ProteusDataTable"
2721
2721
  },
2722
+ {
2723
+ $ref: "#/definitions/ProteusFederated"
2724
+ },
2722
2725
  {
2723
2726
  $ref: "#/definitions/ProteusField"
2724
2727
  },
@@ -2860,6 +2863,32 @@ var definitions = {
2860
2863
  "url"
2861
2864
  ],
2862
2865
  type: "object"
2866
+ },
2867
+ {
2868
+ description: "Client-side component action - for opening a link in a new tab",
2869
+ properties: {
2870
+ action: {
2871
+ "const": "openLink",
2872
+ description: "The action type",
2873
+ type: "string"
2874
+ },
2875
+ url: {
2876
+ anyOf: [
2877
+ {
2878
+ $ref: "#/definitions/ProteusExpression"
2879
+ },
2880
+ {
2881
+ type: "string"
2882
+ }
2883
+ ],
2884
+ description: "URL to open in a new tab"
2885
+ }
2886
+ },
2887
+ required: [
2888
+ "action",
2889
+ "url"
2890
+ ],
2891
+ type: "object"
2863
2892
  }
2864
2893
  ],
2865
2894
  description: "Handler for user interactions - a server-side interaction call, client-side message, or client-side component action"
@@ -4889,6 +4918,37 @@ var definitions = {
4889
4918
  ],
4890
4919
  type: "object"
4891
4920
  },
4921
+ ProteusFederated: {
4922
+ examples: [
4923
+ {
4924
+ $type: "Federated",
4925
+ entry: "https://widgets.example.com/remoteEntry.js"
4926
+ }
4927
+ ],
4928
+ properties: {
4929
+ $type: {
4930
+ "const": "Federated"
4931
+ },
4932
+ entry: {
4933
+ description: "URL to the remote application's remoteEntry.js or mf-manifest.json",
4934
+ type: "string"
4935
+ },
4936
+ exposeKey: {
4937
+ "default": ".",
4938
+ description: "The key from the remote's ModuleFederationPlugin exposes config (e.g. './App'). Defaults to '.' (root export)",
4939
+ type: "string"
4940
+ },
4941
+ fallback: {
4942
+ $ref: "#/definitions/ProteusNode",
4943
+ description: "Content rendered when the federated component fails to load"
4944
+ }
4945
+ },
4946
+ required: [
4947
+ "$type",
4948
+ "entry"
4949
+ ],
4950
+ type: "object"
4951
+ },
4892
4952
  ProteusField: {
4893
4953
  examples: [
4894
4954
  {
package/dist/index.d.ts CHANGED
@@ -77,6 +77,25 @@ declare const ProteusDataTable: {
77
77
  displayName: string;
78
78
  };
79
79
 
80
+ type ProteusFederatedProps = {
81
+ /**
82
+ * URL to the remote's remoteEntry.js or mf-manifest.json
83
+ */
84
+ entry: string;
85
+ /**
86
+ * The key from the remote's ModuleFederationPlugin exposes config (e.g. './App'). Defaults to '.' (root export)
87
+ */
88
+ exposeKey?: string;
89
+ /**
90
+ * Content rendered when the federated component fails to load
91
+ */
92
+ fallback?: ReactNode;
93
+ };
94
+ declare function ProteusFederated({ entry, exposeKey, fallback, }: ProteusFederatedProps): react_jsx_runtime.JSX.Element | null;
95
+ declare namespace ProteusFederated {
96
+ var displayName: string;
97
+ }
98
+
80
99
  type ProteusFileUploadProps = {
81
100
  /**
82
101
  * File types to accept; array of MIME types or extensions.
@@ -320,6 +339,11 @@ type ProteusEventHandler = {
320
339
  url: (ProteusValueProps & {
321
340
  $type: "Value";
322
341
  }) | string | string[];
342
+ } | {
343
+ action: "openLink";
344
+ url: (ProteusValueProps & {
345
+ $type: "Value";
346
+ }) | string;
323
347
  } | {
324
348
  interaction: string;
325
349
  params?: Record<string, unknown>;
@@ -395,5 +419,5 @@ declare namespace ProteusTextarea {
395
419
 
396
420
  declare function useProteusValue(element: ProteusValueProps): any;
397
421
 
398
- export { ProteusAction, ProteusBridge, ProteusChart, ProteusDataTable, ProteusDocumentRenderer, ProteusDocumentShell, ProteusFileUpload, ProteusImage, ProteusImageCarousel, ProteusInput, ProteusMap, ProteusSelect, ProteusShow, ProteusTextarea, safeParseDocument, useProteusValue };
422
+ export { ProteusAction, ProteusBridge, ProteusChart, ProteusDataTable, ProteusDocumentRenderer, ProteusDocumentShell, ProteusFederated, ProteusFileUpload, ProteusImage, ProteusImageCarousel, ProteusInput, ProteusMap, ProteusSelect, ProteusShow, ProteusTextarea, safeParseDocument, useProteusValue };
399
423
  export type { ProteusDocumentRendererProps, ProteusDocumentShellProps, ProteusFileUploadProps, StructuredMessage, UploadFile };