@xyo-network/react-embed 2.64.0 → 2.64.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. package/dist/browser/components/EmbedPlugin.js +203 -11
  2. package/dist/browser/components/EmbedPlugin.js.map +1 -1
  3. package/dist/browser/components/EmbedResolver.js +13 -3
  4. package/dist/browser/components/EmbedResolver.js.map +1 -1
  5. package/dist/browser/components/controls/EmbedFormControl.js +3 -2
  6. package/dist/browser/components/controls/EmbedFormControl.js.map +1 -1
  7. package/dist/browser/components/controls/ListModeSelect.js +23 -11
  8. package/dist/browser/components/controls/ListModeSelect.js.map +1 -1
  9. package/dist/browser/components/controls/RenderSelect.js +26 -7
  10. package/dist/browser/components/controls/RenderSelect.js.map +1 -1
  11. package/dist/browser/components/controls/index.js +63 -3
  12. package/dist/browser/components/controls/index.js.map +1 -1
  13. package/dist/browser/components/embed-card/EmbedCardResolver.js +52 -5
  14. package/dist/browser/components/embed-card/EmbedCardResolver.js.map +1 -1
  15. package/dist/browser/components/embed-card/EmbedPluginCard.js +429 -11
  16. package/dist/browser/components/embed-card/EmbedPluginCard.js.map +1 -1
  17. package/dist/browser/components/embed-card/card/BusyCard.js +3 -2
  18. package/dist/browser/components/embed-card/card/BusyCard.js.map +1 -1
  19. package/dist/browser/components/embed-card/card/EmbedCardHeader.js +61 -10
  20. package/dist/browser/components/embed-card/card/EmbedCardHeader.js.map +1 -1
  21. package/dist/browser/components/embed-card/card/EmbedPluginCard.js +168 -13
  22. package/dist/browser/components/embed-card/card/EmbedPluginCard.js.map +1 -1
  23. package/dist/browser/components/embed-card/card/index.js +182 -3
  24. package/dist/browser/components/embed-card/card/index.js.map +1 -1
  25. package/dist/browser/components/embed-card/error-handling/EmbedCardApiErrorRenderer.js +26 -6
  26. package/dist/browser/components/embed-card/error-handling/EmbedCardApiErrorRenderer.js.map +1 -1
  27. package/dist/browser/components/embed-card/error-handling/EmbedErrorCard.js +4 -3
  28. package/dist/browser/components/embed-card/error-handling/EmbedErrorCard.js.map +1 -1
  29. package/dist/browser/components/embed-card/error-handling/index.js +33 -2
  30. package/dist/browser/components/embed-card/error-handling/index.js.map +1 -1
  31. package/dist/browser/components/embed-card/index.js +481 -2
  32. package/dist/browser/components/embed-card/index.js.map +1 -1
  33. package/dist/browser/components/embed-card/menu/EmbedMenu.js +30 -6
  34. package/dist/browser/components/embed-card/menu/EmbedMenu.js.map +1 -1
  35. package/dist/browser/components/embed-card/menu/JsonMenuItem.js +13 -3
  36. package/dist/browser/components/embed-card/menu/JsonMenuItem.js.map +1 -1
  37. package/dist/browser/components/embed-card/menu/index.js +46 -1
  38. package/dist/browser/components/embed-card/menu/index.js.map +1 -1
  39. package/dist/browser/components/embed-plugin-stories/storyPayload.js +2 -1
  40. package/dist/browser/components/embed-plugin-stories/storyPayload.js.map +1 -1
  41. package/dist/browser/components/embed-plugin-stories/storyShared.js +480 -5
  42. package/dist/browser/components/embed-plugin-stories/storyShared.js.map +1 -1
  43. package/dist/browser/components/index.js +482 -2
  44. package/dist/browser/components/index.js.map +1 -1
  45. package/dist/browser/components/validation-alerts/ValidatePayload.js +13 -3
  46. package/dist/browser/components/validation-alerts/ValidatePayload.js.map +1 -1
  47. package/dist/browser/components/validation-alerts/ValidatePlugins.js +21 -3
  48. package/dist/browser/components/validation-alerts/ValidatePlugins.js.map +1 -1
  49. package/dist/browser/components/validation-alerts/index.js +59 -2
  50. package/dist/browser/components/validation-alerts/index.js.map +1 -1
  51. package/dist/browser/contexts/EmbedPluginContext/Context.js +2 -1
  52. package/dist/browser/contexts/EmbedPluginContext/Context.js.map +1 -1
  53. package/dist/browser/contexts/EmbedPluginContext/Provider.js +9 -3
  54. package/dist/browser/contexts/EmbedPluginContext/Provider.js.map +1 -1
  55. package/dist/browser/contexts/EmbedPluginContext/index.js +44 -4
  56. package/dist/browser/contexts/EmbedPluginContext/index.js.map +1 -1
  57. package/dist/browser/contexts/EmbedPluginContext/use.js +8 -2
  58. package/dist/browser/contexts/EmbedPluginContext/use.js.map +1 -1
  59. package/dist/browser/contexts/RefreshPayloadContext/Context.js +2 -1
  60. package/dist/browser/contexts/RefreshPayloadContext/Context.js.map +1 -1
  61. package/dist/browser/contexts/RefreshPayloadContext/Provider.js +9 -3
  62. package/dist/browser/contexts/RefreshPayloadContext/Provider.js.map +1 -1
  63. package/dist/browser/contexts/RefreshPayloadContext/index.js +21 -3
  64. package/dist/browser/contexts/RefreshPayloadContext/index.js.map +1 -1
  65. package/dist/browser/contexts/RefreshPayloadContext/use.js +8 -2
  66. package/dist/browser/contexts/RefreshPayloadContext/use.js.map +1 -1
  67. package/dist/browser/contexts/ResolvePayloadContext/Context.js +2 -1
  68. package/dist/browser/contexts/ResolvePayloadContext/Context.js.map +1 -1
  69. package/dist/browser/contexts/ResolvePayloadContext/Provider.js +17 -4
  70. package/dist/browser/contexts/ResolvePayloadContext/Provider.js.map +1 -1
  71. package/dist/browser/contexts/ResolvePayloadContext/index.js +72 -4
  72. package/dist/browser/contexts/ResolvePayloadContext/index.js.map +1 -1
  73. package/dist/browser/contexts/ResolvePayloadContext/use.js +8 -2
  74. package/dist/browser/contexts/ResolvePayloadContext/use.js.map +1 -1
  75. package/dist/browser/contexts/ValidatePayloadContext/Context.js +2 -1
  76. package/dist/browser/contexts/ValidatePayloadContext/Context.js.map +1 -1
  77. package/dist/browser/contexts/ValidatePayloadContext/Provider.js +17 -4
  78. package/dist/browser/contexts/ValidatePayloadContext/Provider.js.map +1 -1
  79. package/dist/browser/contexts/ValidatePayloadContext/index.js +49 -3
  80. package/dist/browser/contexts/ValidatePayloadContext/index.js.map +1 -1
  81. package/dist/browser/contexts/ValidatePayloadContext/use.js +8 -2
  82. package/dist/browser/contexts/ValidatePayloadContext/use.js.map +1 -1
  83. package/dist/browser/contexts/index.js +165 -4
  84. package/dist/browser/contexts/index.js.map +1 -1
  85. package/dist/browser/index.js +492 -3
  86. package/dist/browser/index.js.map +1 -1
  87. package/dist/browser/types/index.js +0 -1
  88. package/dist/browser/types/index.js.map +1 -1
  89. package/dist/docs.json +109 -109
  90. package/package.json +15 -15
@@ -1,9 +1,201 @@
1
- import { jsx } from "react/jsx-runtime";
1
+ // src/components/EmbedPlugin.tsx
2
2
  import { ErrorBoundary, ListModeProvider } from "@xyo-network/react-shared";
3
- import { EmbedPluginProvider, RefreshPayloadProvider, ResolvePayloadProvider, ValidatePayloadProvider } from "../contexts";
4
- import { EmbedResolver } from "./EmbedResolver";
5
- import { ValidatePayloadAlert, ValidatePluginsAlert } from "./validation-alerts";
6
- const EmbedPluginInner = ({
3
+
4
+ // src/contexts/EmbedPluginContext/Context.tsx
5
+ import { createContextEx } from "@xyo-network/react-shared";
6
+ var EmbedPluginContext = createContextEx();
7
+
8
+ // src/contexts/EmbedPluginContext/Provider.tsx
9
+ import { useEffect, useState } from "react";
10
+ import { jsx } from "react/jsx-runtime";
11
+ var EmbedPluginProvider = ({
12
+ children,
13
+ refreshTitle,
14
+ timestampLabel,
15
+ hideElementsConfig,
16
+ plugins,
17
+ embedPluginConfig
18
+ }) => {
19
+ const [activePlugin, setActivePlugin] = useState(plugins ? plugins[0] : void 0);
20
+ useEffect(() => {
21
+ setActivePlugin(plugins ? plugins[0] : void 0);
22
+ }, [plugins]);
23
+ return /* @__PURE__ */ jsx(
24
+ EmbedPluginContext.Provider,
25
+ {
26
+ value: {
27
+ activePlugin,
28
+ embedPluginConfig,
29
+ hideElementsConfig,
30
+ provided: true,
31
+ refreshTitle,
32
+ setActivePlugin,
33
+ timestampLabel
34
+ },
35
+ children
36
+ }
37
+ );
38
+ };
39
+
40
+ // src/contexts/EmbedPluginContext/use.tsx
41
+ import { useContextEx } from "@xyo-network/react-shared";
42
+ var useEmbedPluginState = () => useContextEx(EmbedPluginContext, "EmbedPlugin", true);
43
+
44
+ // src/contexts/RefreshPayloadContext/Provider.tsx
45
+ import { useState as useState2 } from "react";
46
+
47
+ // src/contexts/RefreshPayloadContext/Context.tsx
48
+ import { createContextEx as createContextEx2 } from "@xyo-network/react-shared";
49
+ var RefreshPayloadContext = createContextEx2();
50
+
51
+ // src/contexts/RefreshPayloadContext/Provider.tsx
52
+ import { jsx as jsx2 } from "react/jsx-runtime";
53
+ var RefreshPayloadProvider = ({ children, onRefresh, refreshPayload }) => {
54
+ const [localRefreshPayload, setRefreshPayload] = useState2(refreshPayload);
55
+ return /* @__PURE__ */ jsx2(RefreshPayloadContext.Provider, { value: { onRefresh, provided: true, refreshPayload: localRefreshPayload, setRefreshPayload }, children });
56
+ };
57
+
58
+ // src/contexts/RefreshPayloadContext/use.tsx
59
+ import { useContextEx as useContextEx2 } from "@xyo-network/react-shared";
60
+ var useRefreshPayload = () => useContextEx2(RefreshPayloadContext, "RefreshPayload", true);
61
+
62
+ // src/contexts/ResolvePayloadContext/Context.ts
63
+ import { createContextEx as createContextEx3 } from "@xyo-network/react-shared";
64
+ var ResolvePayloadContext = createContextEx3();
65
+
66
+ // src/contexts/ResolvePayloadContext/Provider.tsx
67
+ import { delay } from "@xylabs/delay";
68
+ import { useAsyncEffect } from "@xylabs/react-async-effect";
69
+ import { Huri } from "@xyo-network/huri";
70
+ import { ModuleErrorSchema } from "@xyo-network/payload-model";
71
+ import { useEffect as useEffect2, useState as useState3 } from "react";
72
+ import { jsx as jsx3 } from "react/jsx-runtime";
73
+ var ResolvePayloadProvider = ({ children, huriPayload }) => {
74
+ const [payload, setPayload] = useState3();
75
+ const [huri, setHuri] = useState3();
76
+ const { refreshPayload, setRefreshPayload, onRefresh } = useRefreshPayload();
77
+ useEffect2(() => {
78
+ typeof huriPayload === "string" ? setHuri(huriPayload) : void 0;
79
+ if (typeof huriPayload === "object") {
80
+ setPayload(huriPayload);
81
+ setRefreshPayload?.(true);
82
+ }
83
+ }, [huriPayload, setRefreshPayload]);
84
+ const [notFound, setNotFound] = useState3();
85
+ const [huriError, setHuriError] = useState3();
86
+ useAsyncEffect(
87
+ // eslint-disable-next-line react-hooks/exhaustive-deps
88
+ async (mounted) => {
89
+ if (huri && !refreshPayload) {
90
+ try {
91
+ const huriInstance = new Huri(huri);
92
+ const result = await huriInstance.fetch();
93
+ await delay(500);
94
+ if (mounted()) {
95
+ setNotFound(result === null);
96
+ setPayload(result);
97
+ setRefreshPayload?.(true);
98
+ }
99
+ } catch (e) {
100
+ const error = e;
101
+ setHuriError({ message: error.message, schema: ModuleErrorSchema, sources: [] });
102
+ }
103
+ }
104
+ },
105
+ [huri, payload, refreshPayload, setRefreshPayload]
106
+ );
107
+ const refreshHuri = () => {
108
+ onRefresh?.();
109
+ if (huri) {
110
+ setRefreshPayload?.(false);
111
+ }
112
+ };
113
+ return /* @__PURE__ */ jsx3(ResolvePayloadContext.Provider, { value: { huri, huriError, notFound, payload, provided: true, refreshHuri, setPayload }, children });
114
+ };
115
+
116
+ // src/contexts/ResolvePayloadContext/use.tsx
117
+ import { useContextEx as useContextEx3 } from "@xyo-network/react-shared";
118
+ var useResolvePayload = () => useContextEx3(ResolvePayloadContext, "ResolvePayload", true);
119
+
120
+ // src/contexts/ValidatePayloadContext/Provider.tsx
121
+ import { Chip } from "@mui/material";
122
+ import { useAsyncEffect as useAsyncEffect2 } from "@xylabs/react-async-effect";
123
+ import { SchemaCache } from "@xyo-network/schema-cache";
124
+ import { useState as useState4 } from "react";
125
+
126
+ // src/contexts/ValidatePayloadContext/Context.ts
127
+ import { createContextEx as createContextEx4 } from "@xyo-network/react-shared";
128
+ var ValidatePayloadContext = createContextEx4();
129
+
130
+ // src/contexts/ValidatePayloadContext/Provider.tsx
131
+ import { Fragment, jsx as jsx4 } from "react/jsx-runtime";
132
+ var ValidatePayloadProvider = ({ children, enabled = false }) => {
133
+ const { payload } = useResolvePayload();
134
+ const [initialized, setInitialized] = useState4(false);
135
+ const [valid, setValid] = useState4();
136
+ useAsyncEffect2(
137
+ // eslint-disable-next-line react-hooks/exhaustive-deps
138
+ async () => {
139
+ if (payload && enabled) {
140
+ await SchemaCache.instance.get(payload.schema);
141
+ const possibleKnownSchema = payload.schema;
142
+ if (SchemaCache.instance.validators[possibleKnownSchema]) {
143
+ const validator = SchemaCache.instance.validators[possibleKnownSchema];
144
+ setValid(validator?.(payload));
145
+ }
146
+ setInitialized(true);
147
+ }
148
+ },
149
+ [payload, enabled]
150
+ );
151
+ return /* @__PURE__ */ jsx4(ValidatePayloadContext.Provider, { value: { enabled, provided: true, schema: payload?.schema, validPayload: valid }, children: enabled ? /* @__PURE__ */ jsx4(Fragment, { children: initialized ? children : /* @__PURE__ */ jsx4(Chip, { label: "Validating Payload..." }) }) : children });
152
+ };
153
+
154
+ // src/contexts/ValidatePayloadContext/use.tsx
155
+ import { useContextEx as useContextEx4 } from "@xyo-network/react-shared";
156
+ var useValidatePayload = () => useContextEx4(ValidatePayloadContext, "ValidateSchema", true);
157
+
158
+ // src/components/EmbedResolver.tsx
159
+ import { LoadResult } from "@xyo-network/react-shared";
160
+ import { jsx as jsx5 } from "react/jsx-runtime";
161
+ var EmbedResolver = ({ children }) => {
162
+ const { payload, notFound, huriError } = useResolvePayload();
163
+ return /* @__PURE__ */ jsx5(LoadResult, { searchResult: payload, notFound: !!notFound, error: !!huriError, children });
164
+ };
165
+
166
+ // src/components/validation-alerts/ValidatePayload.tsx
167
+ import { Alert } from "@mui/material";
168
+ import { Fragment as Fragment2, jsx as jsx6, jsxs } from "react/jsx-runtime";
169
+ var ValidatePayloadAlert = ({ children, ...props }) => {
170
+ const { validPayload, enabled, schema } = useValidatePayload();
171
+ if (enabled && validPayload === false) {
172
+ return /* @__PURE__ */ jsxs(Alert, { severity: "error", title: "Invalid Payload!", ...props, children: [
173
+ "Payload schema claimed to be ",
174
+ schema,
175
+ " but failed to validate."
176
+ ] });
177
+ }
178
+ return /* @__PURE__ */ jsx6(Fragment2, { children });
179
+ };
180
+
181
+ // src/components/validation-alerts/ValidatePlugins.tsx
182
+ import { Alert as Alert2, AlertTitle } from "@mui/material";
183
+ import { Fragment as Fragment3, jsx as jsx7, jsxs as jsxs2 } from "react/jsx-runtime";
184
+ var ValidatePluginsAlert = ({ children, ...props }) => {
185
+ const { payload } = useResolvePayload();
186
+ const { plugins } = useEmbedPluginState();
187
+ if (payload && plugins?.length === 0) {
188
+ return /* @__PURE__ */ jsxs2(Alert2, { severity: "warning", ...props, children: [
189
+ /* @__PURE__ */ jsx7(AlertTitle, { children: "Missing plugins!" }),
190
+ "Payload found but no plugins were present."
191
+ ] });
192
+ }
193
+ return /* @__PURE__ */ jsx7(Fragment3, { children });
194
+ };
195
+
196
+ // src/components/EmbedPlugin.tsx
197
+ import { jsx as jsx8 } from "react/jsx-runtime";
198
+ var EmbedPluginInner = ({
7
199
  validateSchema,
8
200
  plugins = [],
9
201
  huriPayload,
@@ -14,7 +206,7 @@ const EmbedPluginInner = ({
14
206
  onRefresh,
15
207
  children
16
208
  }) => {
17
- return /* @__PURE__ */ jsx(ErrorBoundary, { children: /* @__PURE__ */ jsx(
209
+ return /* @__PURE__ */ jsx8(ErrorBoundary, { children: /* @__PURE__ */ jsx8(
18
210
  EmbedPluginProvider,
19
211
  {
20
212
  refreshTitle,
@@ -22,15 +214,15 @@ const EmbedPluginInner = ({
22
214
  hideElementsConfig,
23
215
  plugins,
24
216
  embedPluginConfig,
25
- children: /* @__PURE__ */ jsx(WithResolvers, { onRefresh, huriPayload, children: /* @__PURE__ */ jsx(WithValidators, { validateSchema, children: /* @__PURE__ */ jsx(ListModeProvider, { defaultListMode: embedPluginConfig?.listMode, children }) }) })
217
+ children: /* @__PURE__ */ jsx8(WithResolvers, { onRefresh, huriPayload, children: /* @__PURE__ */ jsx8(WithValidators, { validateSchema, children: /* @__PURE__ */ jsx8(ListModeProvider, { defaultListMode: embedPluginConfig?.listMode, children }) }) })
26
218
  }
27
219
  ) });
28
220
  };
29
- const WithResolvers = ({ children, onRefresh, huriPayload }) => {
30
- return /* @__PURE__ */ jsx(RefreshPayloadProvider, { onRefresh, children: /* @__PURE__ */ jsx(ResolvePayloadProvider, { huriPayload, children: /* @__PURE__ */ jsx(EmbedResolver, { children }) }) });
221
+ var WithResolvers = ({ children, onRefresh, huriPayload }) => {
222
+ return /* @__PURE__ */ jsx8(RefreshPayloadProvider, { onRefresh, children: /* @__PURE__ */ jsx8(ResolvePayloadProvider, { huriPayload, children: /* @__PURE__ */ jsx8(EmbedResolver, { children }) }) });
31
223
  };
32
- const WithValidators = ({ children, validateSchema }) => {
33
- return /* @__PURE__ */ jsx(ValidatePayloadProvider, { enabled: validateSchema, children: /* @__PURE__ */ jsx(ValidatePluginsAlert, { children: /* @__PURE__ */ jsx(ValidatePayloadAlert, { children }) }) });
224
+ var WithValidators = ({ children, validateSchema }) => {
225
+ return /* @__PURE__ */ jsx8(ValidatePayloadProvider, { enabled: validateSchema, children: /* @__PURE__ */ jsx8(ValidatePluginsAlert, { children: /* @__PURE__ */ jsx8(ValidatePayloadAlert, { children }) }) });
34
226
  };
35
227
  export {
36
228
  EmbedPluginInner
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/EmbedPlugin.tsx"],"sourcesContent":["import { FlexBoxProps } from '@xylabs/react-flexbox'\nimport { WithChildren } from '@xylabs/react-shared'\nimport { ErrorBoundary, ListModeProvider } from '@xyo-network/react-shared'\n\nimport { EmbedPluginProvider, RefreshPayloadProvider, ResolvePayloadProvider, ValidatePayloadProvider } from '../contexts'\nimport { EmbedPluginProps } from '../types'\nimport { EmbedResolver } from './EmbedResolver'\nimport { ValidatePayloadAlert, ValidatePluginsAlert } from './validation-alerts'\n\nexport const EmbedPluginInner: React.FC<WithChildren<EmbedPluginProps>> = ({\n validateSchema,\n plugins = [],\n huriPayload,\n refreshTitle = '',\n timestampLabel = 'Data From',\n hideElementsConfig,\n embedPluginConfig,\n onRefresh,\n children,\n}) => {\n return (\n <ErrorBoundary>\n <EmbedPluginProvider\n refreshTitle={refreshTitle}\n timestampLabel={timestampLabel}\n hideElementsConfig={hideElementsConfig}\n plugins={plugins}\n embedPluginConfig={embedPluginConfig}\n >\n <WithResolvers onRefresh={onRefresh} huriPayload={huriPayload}>\n <WithValidators validateSchema={validateSchema}>\n <ListModeProvider defaultListMode={embedPluginConfig?.listMode}>{children}</ListModeProvider>\n </WithValidators>\n </WithResolvers>\n </EmbedPluginProvider>\n </ErrorBoundary>\n )\n}\n\ninterface WithResolversProps extends Pick<EmbedPluginProps, 'onRefresh' | 'huriPayload'>, FlexBoxProps {}\n\nconst WithResolvers: React.FC<WithChildren<WithResolversProps>> = ({ children, onRefresh, huriPayload }) => {\n return (\n <RefreshPayloadProvider onRefresh={onRefresh}>\n <ResolvePayloadProvider huriPayload={huriPayload}>\n <EmbedResolver>{children}</EmbedResolver>\n </ResolvePayloadProvider>\n </RefreshPayloadProvider>\n )\n}\n\nconst WithValidators: React.FC<WithChildren<{ validateSchema?: boolean }>> = ({ children, validateSchema }) => {\n return (\n <ValidatePayloadProvider enabled={validateSchema}>\n <ValidatePluginsAlert>\n <ValidatePayloadAlert>{children}</ValidatePayloadAlert>\n </ValidatePluginsAlert>\n </ValidatePayloadProvider>\n )\n}\n"],"mappings":"AA+BY;AA7BZ,SAAS,eAAe,wBAAwB;AAEhD,SAAS,qBAAqB,wBAAwB,wBAAwB,+BAA+B;AAE7G,SAAS,qBAAqB;AAC9B,SAAS,sBAAsB,4BAA4B;AAEpD,MAAM,mBAA6D,CAAC;AAAA,EACzE;AAAA,EACA,UAAU,CAAC;AAAA,EACX;AAAA,EACA,eAAe;AAAA,EACf,iBAAiB;AAAA,EACjB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,SACE,oBAAC,iBACC;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MAEA,8BAAC,iBAAc,WAAsB,aACnC,8BAAC,kBAAe,gBACd,8BAAC,oBAAiB,iBAAiB,mBAAmB,UAAW,UAAS,GAC5E,GACF;AAAA;AAAA,EACF,GACF;AAEJ;AAIA,MAAM,gBAA4D,CAAC,EAAE,UAAU,WAAW,YAAY,MAAM;AAC1G,SACE,oBAAC,0BAAuB,WACtB,8BAAC,0BAAuB,aACtB,8BAAC,iBAAe,UAAS,GAC3B,GACF;AAEJ;AAEA,MAAM,iBAAuE,CAAC,EAAE,UAAU,eAAe,MAAM;AAC7G,SACE,oBAAC,2BAAwB,SAAS,gBAChC,8BAAC,wBACC,8BAAC,wBAAsB,UAAS,GAClC,GACF;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../../src/components/EmbedPlugin.tsx","../../../src/contexts/EmbedPluginContext/Context.tsx","../../../src/contexts/EmbedPluginContext/Provider.tsx","../../../src/contexts/EmbedPluginContext/use.tsx","../../../src/contexts/RefreshPayloadContext/Provider.tsx","../../../src/contexts/RefreshPayloadContext/Context.tsx","../../../src/contexts/RefreshPayloadContext/use.tsx","../../../src/contexts/ResolvePayloadContext/Context.ts","../../../src/contexts/ResolvePayloadContext/Provider.tsx","../../../src/contexts/ResolvePayloadContext/use.tsx","../../../src/contexts/ValidatePayloadContext/Provider.tsx","../../../src/contexts/ValidatePayloadContext/Context.ts","../../../src/contexts/ValidatePayloadContext/use.tsx","../../../src/components/EmbedResolver.tsx","../../../src/components/validation-alerts/ValidatePayload.tsx","../../../src/components/validation-alerts/ValidatePlugins.tsx"],"sourcesContent":["import { FlexBoxProps } from '@xylabs/react-flexbox'\nimport { WithChildren } from '@xylabs/react-shared'\nimport { ErrorBoundary, ListModeProvider } from '@xyo-network/react-shared'\n\nimport { EmbedPluginProvider, RefreshPayloadProvider, ResolvePayloadProvider, ValidatePayloadProvider } from '../contexts'\nimport { EmbedPluginProps } from '../types'\nimport { EmbedResolver } from './EmbedResolver'\nimport { ValidatePayloadAlert, ValidatePluginsAlert } from './validation-alerts'\n\nexport const EmbedPluginInner: React.FC<WithChildren<EmbedPluginProps>> = ({\n validateSchema,\n plugins = [],\n huriPayload,\n refreshTitle = '',\n timestampLabel = 'Data From',\n hideElementsConfig,\n embedPluginConfig,\n onRefresh,\n children,\n}) => {\n return (\n <ErrorBoundary>\n <EmbedPluginProvider\n refreshTitle={refreshTitle}\n timestampLabel={timestampLabel}\n hideElementsConfig={hideElementsConfig}\n plugins={plugins}\n embedPluginConfig={embedPluginConfig}\n >\n <WithResolvers onRefresh={onRefresh} huriPayload={huriPayload}>\n <WithValidators validateSchema={validateSchema}>\n <ListModeProvider defaultListMode={embedPluginConfig?.listMode}>{children}</ListModeProvider>\n </WithValidators>\n </WithResolvers>\n </EmbedPluginProvider>\n </ErrorBoundary>\n )\n}\n\ninterface WithResolversProps extends Pick<EmbedPluginProps, 'onRefresh' | 'huriPayload'>, FlexBoxProps {}\n\nconst WithResolvers: React.FC<WithChildren<WithResolversProps>> = ({ children, onRefresh, huriPayload }) => {\n return (\n <RefreshPayloadProvider onRefresh={onRefresh}>\n <ResolvePayloadProvider huriPayload={huriPayload}>\n <EmbedResolver>{children}</EmbedResolver>\n </ResolvePayloadProvider>\n </RefreshPayloadProvider>\n )\n}\n\nconst WithValidators: React.FC<WithChildren<{ validateSchema?: boolean }>> = ({ children, validateSchema }) => {\n return (\n <ValidatePayloadProvider enabled={validateSchema}>\n <ValidatePluginsAlert>\n <ValidatePayloadAlert>{children}</ValidatePayloadAlert>\n </ValidatePluginsAlert>\n </ValidatePayloadProvider>\n )\n}\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport { EmbedPluginState } from './State'\n\nexport const EmbedPluginContext = createContextEx<EmbedPluginState>()\n","import { WithChildren } from '@xylabs/react-shared'\nimport { PayloadRenderPlugin } from '@xyo-network/react-payload-plugin'\nimport { useEffect, useState } from 'react'\n\nimport { EmbedPluginContext } from './Context'\nimport { EmbedPluginBase } from './State'\n\nexport type EmbedPluginProviderProps = EmbedPluginBase\n\n/** Expose passed embed plugin props via context */\nexport const EmbedPluginProvider: React.FC<WithChildren<EmbedPluginProviderProps>> = ({\n children,\n refreshTitle,\n timestampLabel,\n hideElementsConfig,\n plugins,\n embedPluginConfig,\n}) => {\n const [activePlugin, setActivePlugin] = useState<PayloadRenderPlugin | undefined>(plugins ? plugins[0] : undefined)\n\n useEffect(() => {\n setActivePlugin(plugins ? plugins[0] : undefined)\n }, [plugins])\n\n return (\n <EmbedPluginContext.Provider\n value={{\n activePlugin,\n embedPluginConfig,\n hideElementsConfig,\n provided: true,\n refreshTitle,\n setActivePlugin,\n timestampLabel,\n }}\n >\n {children}\n </EmbedPluginContext.Provider>\n )\n}\n","import { useContextEx } from '@xyo-network/react-shared'\n\nimport { EmbedPluginContext } from './Context'\n\nexport const useEmbedPluginState = () => useContextEx(EmbedPluginContext, 'EmbedPlugin', true)\n","import { WithChildren } from '@xylabs/react-shared'\nimport { useState } from 'react'\n\nimport { RefreshPayloadContext } from './Context'\n\nexport interface RefreshPayloadProps {\n onRefresh?: () => void\n refreshPayload?: boolean\n}\n\nexport const RefreshPayloadProvider: React.FC<WithChildren<RefreshPayloadProps>> = ({ children, onRefresh, refreshPayload }) => {\n const [localRefreshPayload, setRefreshPayload] = useState(refreshPayload)\n\n return (\n <RefreshPayloadContext.Provider value={{ onRefresh, provided: true, refreshPayload: localRefreshPayload, setRefreshPayload }}>\n {children}\n </RefreshPayloadContext.Provider>\n )\n}\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport { RefreshPayloadState } from './State'\n\nexport const RefreshPayloadContext = createContextEx<RefreshPayloadState>()\n","import { useContextEx } from '@xyo-network/react-shared'\n\nimport { RefreshPayloadContext } from './Context'\n\nexport const useRefreshPayload = () => useContextEx(RefreshPayloadContext, 'RefreshPayload', true)\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport { ResolvePayloadState } from './State'\n\nexport const ResolvePayloadContext = createContextEx<ResolvePayloadState>()\n","import { delay } from '@xylabs/delay'\nimport { useAsyncEffect } from '@xylabs/react-async-effect'\nimport { WithChildren } from '@xylabs/react-shared'\nimport { Huri } from '@xyo-network/huri'\nimport { ModuleError, ModuleErrorSchema, Payload } from '@xyo-network/payload-model'\nimport { useEffect, useState } from 'react'\n\nimport { useRefreshPayload } from '../RefreshPayloadContext'\nimport { ResolvePayloadContext } from './Context'\nimport { ResolvePayloadState } from './State'\n\nexport type ResolvePayloadProviderProps = Omit<ResolvePayloadState, 'provided'>\n\nexport const ResolvePayloadProvider: React.FC<WithChildren<ResolvePayloadProviderProps>> = ({ children, huriPayload }) => {\n const [payload, setPayload] = useState<Payload>()\n const [huri, setHuri] = useState<string>()\n const { refreshPayload, setRefreshPayload, onRefresh } = useRefreshPayload()\n\n useEffect(() => {\n typeof huriPayload === 'string' ? setHuri(huriPayload) : undefined\n if (typeof huriPayload === 'object') {\n setPayload(huriPayload)\n setRefreshPayload?.(true)\n }\n }, [huriPayload, setRefreshPayload])\n\n const [notFound, setNotFound] = useState<boolean>()\n const [huriError, setHuriError] = useState<ModuleError>()\n\n useAsyncEffect(\n // eslint-disable-next-line react-hooks/exhaustive-deps\n async (mounted) => {\n if (huri && !refreshPayload) {\n try {\n const huriInstance = new Huri(huri)\n const result = await huriInstance.fetch()\n // ensure the busy state can stay for a moment to avoid flashing too quickly\n await delay(500)\n\n if (mounted()) {\n setNotFound(result === null)\n setPayload(result)\n setRefreshPayload?.(true)\n }\n } catch (e) {\n const error = e as Error\n setHuriError({ message: error.message, schema: ModuleErrorSchema, sources: [] })\n }\n }\n },\n [huri, payload, refreshPayload, setRefreshPayload],\n )\n\n const refreshHuri = () => {\n onRefresh?.()\n if (huri) {\n setRefreshPayload?.(false)\n }\n }\n\n return (\n <ResolvePayloadContext.Provider value={{ huri, huriError, notFound, payload, provided: true, refreshHuri, setPayload }}>\n {children}\n </ResolvePayloadContext.Provider>\n )\n}\n","import { useContextEx } from '@xyo-network/react-shared'\n\nimport { ResolvePayloadContext } from './Context'\n\nexport const useResolvePayload = () => useContextEx(ResolvePayloadContext, 'ResolvePayload', true)\n","import { Chip } from '@mui/material'\nimport { useAsyncEffect } from '@xylabs/react-async-effect'\nimport { WithChildren } from '@xylabs/react-shared'\nimport { SchemaCache, SchemaNameToValidatorMap } from '@xyo-network/schema-cache'\nimport { useState } from 'react'\n\nimport { useResolvePayload } from '../ResolvePayloadContext'\nimport { ValidatePayloadContext } from './Context'\n\nexport interface ValidatePayloadProviderProps {\n // Opt-in flag to validate payloads for the plugin(s)\n enabled?: boolean\n}\n\nexport const ValidatePayloadProvider: React.FC<WithChildren<ValidatePayloadProviderProps>> = ({ children, enabled = false }) => {\n const { payload } = useResolvePayload()\n const [initialized, setInitialized] = useState(false)\n const [valid, setValid] = useState<boolean>()\n\n useAsyncEffect(\n // eslint-disable-next-line react-hooks/exhaustive-deps\n async () => {\n if (payload && enabled) {\n await SchemaCache.instance.get(payload.schema)\n\n const possibleKnownSchema = payload.schema as keyof SchemaNameToValidatorMap\n\n if (SchemaCache.instance.validators[possibleKnownSchema]) {\n const validator = SchemaCache.instance.validators[possibleKnownSchema]\n setValid(validator?.(payload))\n }\n setInitialized(true)\n }\n },\n [payload, enabled],\n )\n\n return (\n <ValidatePayloadContext.Provider value={{ enabled, provided: true, schema: payload?.schema, validPayload: valid }}>\n {enabled ? <>{initialized ? children : <Chip label=\"Validating Payload...\" />}</> : children}\n </ValidatePayloadContext.Provider>\n )\n}\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport { ValidatePayloadState } from './State'\n\nexport const ValidatePayloadContext = createContextEx<ValidatePayloadState>()\n","import { useContextEx } from '@xyo-network/react-shared'\n\nimport { ValidatePayloadContext } from './Context'\n\nexport const useValidatePayload = () => useContextEx(ValidatePayloadContext, 'ValidateSchema', true)\n","import { WithChildren } from '@xylabs/react-shared'\nimport { LoadResult } from '@xyo-network/react-shared'\n\nimport { useResolvePayload } from '../contexts'\n\nexport const EmbedResolver: React.FC<WithChildren> = ({ children }) => {\n const { payload, notFound, huriError } = useResolvePayload()\n\n return (\n <LoadResult searchResult={payload} notFound={!!notFound} error={!!huriError}>\n {children}\n </LoadResult>\n )\n}\n","import { Alert, AlertProps } from '@mui/material'\nimport { WithChildren } from '@xylabs/react-shared'\n\nimport { useValidatePayload } from '../../contexts'\n\nexport const ValidatePayloadAlert: React.FC<WithChildren<AlertProps>> = ({ children, ...props }) => {\n const { validPayload, enabled, schema } = useValidatePayload()\n\n if (enabled && validPayload === false) {\n return (\n <Alert severity=\"error\" title=\"Invalid Payload!\" {...props}>\n Payload schema claimed to be {schema} but failed to validate.\n </Alert>\n )\n }\n\n return <>{children}</>\n}\n","import { Alert, AlertProps, AlertTitle } from '@mui/material'\nimport { WithChildren } from '@xylabs/react-shared'\n\nimport { useEmbedPluginState, useResolvePayload } from '../../contexts'\n\nexport const ValidatePluginsAlert: React.FC<WithChildren<AlertProps>> = ({ children, ...props }) => {\n const { payload } = useResolvePayload()\n const { plugins } = useEmbedPluginState()\n\n if (payload && plugins?.length === 0) {\n return (\n <Alert severity=\"warning\" {...props}>\n <AlertTitle>Missing plugins!</AlertTitle>Payload found but no plugins were present.\n </Alert>\n )\n }\n\n return <>{children}</>\n}\n"],"mappings":"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","names":["useState","createContextEx","jsx","useState","useContextEx","useContextEx","createContextEx","useEffect","useState","jsx","useState","useEffect","useContextEx","useContextEx","useAsyncEffect","useState","createContextEx","jsx","useState","useAsyncEffect","useContextEx","useContextEx","jsx","Fragment","jsx","Alert","Fragment","jsx","jsxs","Alert","jsx"]}
@@ -1,7 +1,17 @@
1
- import { jsx } from "react/jsx-runtime";
1
+ // src/components/EmbedResolver.tsx
2
2
  import { LoadResult } from "@xyo-network/react-shared";
3
- import { useResolvePayload } from "../contexts";
4
- const EmbedResolver = ({ children }) => {
3
+
4
+ // src/contexts/ResolvePayloadContext/Context.ts
5
+ import { createContextEx } from "@xyo-network/react-shared";
6
+ var ResolvePayloadContext = createContextEx();
7
+
8
+ // src/contexts/ResolvePayloadContext/use.tsx
9
+ import { useContextEx } from "@xyo-network/react-shared";
10
+ var useResolvePayload = () => useContextEx(ResolvePayloadContext, "ResolvePayload", true);
11
+
12
+ // src/components/EmbedResolver.tsx
13
+ import { jsx } from "react/jsx-runtime";
14
+ var EmbedResolver = ({ children }) => {
5
15
  const { payload, notFound, huriError } = useResolvePayload();
6
16
  return /* @__PURE__ */ jsx(LoadResult, { searchResult: payload, notFound: !!notFound, error: !!huriError, children });
7
17
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/EmbedResolver.tsx"],"sourcesContent":["import { WithChildren } from '@xylabs/react-shared'\nimport { LoadResult } from '@xyo-network/react-shared'\n\nimport { useResolvePayload } from '../contexts'\n\nexport const EmbedResolver: React.FC<WithChildren> = ({ children }) => {\n const { payload, notFound, huriError } = useResolvePayload()\n\n return (\n <LoadResult searchResult={payload} notFound={!!notFound} error={!!huriError}>\n {children}\n </LoadResult>\n )\n}\n"],"mappings":"AASI;AARJ,SAAS,kBAAkB;AAE3B,SAAS,yBAAyB;AAE3B,MAAM,gBAAwC,CAAC,EAAE,SAAS,MAAM;AACrE,QAAM,EAAE,SAAS,UAAU,UAAU,IAAI,kBAAkB;AAE3D,SACE,oBAAC,cAAW,cAAc,SAAS,UAAU,CAAC,CAAC,UAAU,OAAO,CAAC,CAAC,WAC/D,UACH;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../../src/components/EmbedResolver.tsx","../../../src/contexts/ResolvePayloadContext/Context.ts","../../../src/contexts/ResolvePayloadContext/use.tsx"],"sourcesContent":["import { WithChildren } from '@xylabs/react-shared'\nimport { LoadResult } from '@xyo-network/react-shared'\n\nimport { useResolvePayload } from '../contexts'\n\nexport const EmbedResolver: React.FC<WithChildren> = ({ children }) => {\n const { payload, notFound, huriError } = useResolvePayload()\n\n return (\n <LoadResult searchResult={payload} notFound={!!notFound} error={!!huriError}>\n {children}\n </LoadResult>\n )\n}\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport { ResolvePayloadState } from './State'\n\nexport const ResolvePayloadContext = createContextEx<ResolvePayloadState>()\n","import { useContextEx } from '@xyo-network/react-shared'\n\nimport { ResolvePayloadContext } from './Context'\n\nexport const useResolvePayload = () => useContextEx(ResolvePayloadContext, 'ResolvePayload', true)\n"],"mappings":";AACA,SAAS,kBAAkB;;;ACD3B,SAAS,uBAAuB;AAIzB,IAAM,wBAAwB,gBAAqC;;;ACJ1E,SAAS,oBAAoB;AAItB,IAAM,oBAAoB,MAAM,aAAa,uBAAuB,kBAAkB,IAAI;;;AFK7F;AAJG,IAAM,gBAAwC,CAAC,EAAE,SAAS,MAAM;AACrE,QAAM,EAAE,SAAS,UAAU,UAAU,IAAI,kBAAkB;AAE3D,SACE,oBAAC,cAAW,cAAc,SAAS,UAAU,CAAC,CAAC,UAAU,OAAO,CAAC,CAAC,WAC/D,UACH;AAEJ;","names":[]}
@@ -1,6 +1,7 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
1
+ // src/components/controls/EmbedFormControl.tsx
2
2
  import { FormControl, InputLabel } from "@mui/material";
3
- const EmbedFormControl = ({ formId, formLabel, children, ...props }) => {
3
+ import { jsx, jsxs } from "react/jsx-runtime";
4
+ var EmbedFormControl = ({ formId, formLabel, children, ...props }) => {
4
5
  return /* @__PURE__ */ jsxs(FormControl, { ...props, children: [
5
6
  /* @__PURE__ */ jsx(InputLabel, { id: formId, children: formLabel }),
6
7
  children
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/controls/EmbedFormControl.tsx"],"sourcesContent":["import { FormControl, FormControlProps, InputLabel } from '@mui/material'\nimport { WithChildren } from '@xylabs/react-shared'\n\ninterface EmbedFormControlProps extends FormControlProps {\n formId?: string\n formLabel?: string\n}\n\nexport const EmbedFormControl: React.FC<WithChildren<EmbedFormControlProps>> = ({ formId, formLabel, children, ...props }) => {\n return (\n <FormControl {...props}>\n <InputLabel id={formId}>{formLabel}</InputLabel>\n {children}\n </FormControl>\n )\n}\n"],"mappings":"AAUI,SACE,KADF;AAVJ,SAAS,aAA+B,kBAAkB;AAQnD,MAAM,mBAAkE,CAAC,EAAE,QAAQ,WAAW,UAAU,GAAG,MAAM,MAAM;AAC5H,SACE,qBAAC,eAAa,GAAG,OACf;AAAA,wBAAC,cAAW,IAAI,QAAS,qBAAU;AAAA,IAClC;AAAA,KACH;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../../../src/components/controls/EmbedFormControl.tsx"],"sourcesContent":["import { FormControl, FormControlProps, InputLabel } from '@mui/material'\nimport { WithChildren } from '@xylabs/react-shared'\n\ninterface EmbedFormControlProps extends FormControlProps {\n formId?: string\n formLabel?: string\n}\n\nexport const EmbedFormControl: React.FC<WithChildren<EmbedFormControlProps>> = ({ formId, formLabel, children, ...props }) => {\n return (\n <FormControl {...props}>\n <InputLabel id={formId}>{formLabel}</InputLabel>\n {children}\n </FormControl>\n )\n}\n"],"mappings":";AAAA,SAAS,aAA+B,kBAAkB;AAUtD,SACE,KADF;AAFG,IAAM,mBAAkE,CAAC,EAAE,QAAQ,WAAW,UAAU,GAAG,MAAM,MAAM;AAC5H,SACE,qBAAC,eAAa,GAAG,OACf;AAAA,wBAAC,cAAW,IAAI,QAAS,qBAAU;AAAA,IAClC;AAAA,KACH;AAEJ;","names":[]}
@@ -1,12 +1,24 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
1
+ // src/components/controls/ListModeSelect.tsx
2
2
  import { MenuItem, Select } from "@mui/material";
3
3
  import { useListMode } from "@xyo-network/react-shared";
4
- import { EmbedFormControl } from "./EmbedFormControl";
5
- const listModeSelectId = "listmode-select-id";
6
- const listModeSelectLabel = "List Mode";
7
- const ListModeSelect = (props) => {
4
+
5
+ // src/components/controls/EmbedFormControl.tsx
6
+ import { FormControl, InputLabel } from "@mui/material";
7
+ import { jsx, jsxs } from "react/jsx-runtime";
8
+ var EmbedFormControl = ({ formId, formLabel, children, ...props }) => {
9
+ return /* @__PURE__ */ jsxs(FormControl, { ...props, children: [
10
+ /* @__PURE__ */ jsx(InputLabel, { id: formId, children: formLabel }),
11
+ children
12
+ ] });
13
+ };
14
+
15
+ // src/components/controls/ListModeSelect.tsx
16
+ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
17
+ var listModeSelectId = "listmode-select-id";
18
+ var listModeSelectLabel = "List Mode";
19
+ var ListModeSelect = (props) => {
8
20
  const { listMode, setListMode } = useListMode();
9
- return /* @__PURE__ */ jsxs(
21
+ return /* @__PURE__ */ jsxs2(
10
22
  Select,
11
23
  {
12
24
  value: listMode ?? "default",
@@ -15,15 +27,15 @@ const ListModeSelect = (props) => {
15
27
  },
16
28
  ...props,
17
29
  children: [
18
- /* @__PURE__ */ jsx(MenuItem, { value: "default", children: "Default" }, "default"),
19
- /* @__PURE__ */ jsx(MenuItem, { value: "table", children: "Table" }, "table"),
20
- /* @__PURE__ */ jsx(MenuItem, { value: "grid", children: "Grid" }, "grid")
30
+ /* @__PURE__ */ jsx2(MenuItem, { value: "default", children: "Default" }, "default"),
31
+ /* @__PURE__ */ jsx2(MenuItem, { value: "table", children: "Table" }, "table"),
32
+ /* @__PURE__ */ jsx2(MenuItem, { value: "grid", children: "Grid" }, "grid")
21
33
  ]
22
34
  }
23
35
  );
24
36
  };
25
- const ListModeSelectFormControl = (props) => {
26
- return /* @__PURE__ */ jsx(EmbedFormControl, { formId: listModeSelectId, formLabel: listModeSelectLabel, children: /* @__PURE__ */ jsx(ListModeSelect, { size: "small", label: listModeSelectLabel, labelId: listModeSelectId, ...props }) });
37
+ var ListModeSelectFormControl = (props) => {
38
+ return /* @__PURE__ */ jsx2(EmbedFormControl, { formId: listModeSelectId, formLabel: listModeSelectLabel, children: /* @__PURE__ */ jsx2(ListModeSelect, { size: "small", label: listModeSelectLabel, labelId: listModeSelectId, ...props }) });
27
39
  };
28
40
  export {
29
41
  ListModeSelect,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/controls/ListModeSelect.tsx"],"sourcesContent":["import { MenuItem, Select, SelectProps } from '@mui/material'\nimport { ListMode, useListMode } from '@xyo-network/react-shared'\n\nimport { EmbedFormControl } from './EmbedFormControl'\n\nconst listModeSelectId = 'listmode-select-id'\nconst listModeSelectLabel = 'List Mode'\n\nexport const ListModeSelect: React.FC<SelectProps<ListMode>> = (props) => {\n const { listMode, setListMode } = useListMode()\n\n return (\n <Select<ListMode>\n value={(listMode ?? 'default') as ListMode}\n onChange={(event) => {\n setListMode?.(event.target.value as ListMode)\n }}\n {...props}\n >\n <MenuItem key=\"default\" value=\"default\">\n Default\n </MenuItem>\n <MenuItem key=\"table\" value=\"table\">\n Table\n </MenuItem>\n <MenuItem key=\"grid\" value=\"grid\">\n Grid\n </MenuItem>\n </Select>\n )\n}\n\nexport const ListModeSelectFormControl: React.FC<SelectProps<ListMode>> = (props) => {\n return (\n <EmbedFormControl formId={listModeSelectId} formLabel={listModeSelectLabel}>\n <ListModeSelect size=\"small\" label={listModeSelectLabel} labelId={listModeSelectId} {...props} />\n </EmbedFormControl>\n )\n}\n"],"mappings":"AAYI,SAOE,KAPF;AAZJ,SAAS,UAAU,cAA2B;AAC9C,SAAmB,mBAAmB;AAEtC,SAAS,wBAAwB;AAEjC,MAAM,mBAAmB;AACzB,MAAM,sBAAsB;AAErB,MAAM,iBAAkD,CAAC,UAAU;AACxE,QAAM,EAAE,UAAU,YAAY,IAAI,YAAY;AAE9C,SACE;AAAA,IAAC;AAAA;AAAA,MACC,OAAQ,YAAY;AAAA,MACpB,UAAU,CAAC,UAAU;AACnB,sBAAc,MAAM,OAAO,KAAiB;AAAA,MAC9C;AAAA,MACC,GAAG;AAAA,MAEJ;AAAA,4BAAC,YAAuB,OAAM,WAAU,uBAA1B,SAEd;AAAA,QACA,oBAAC,YAAqB,OAAM,SAAQ,qBAAtB,OAEd;AAAA,QACA,oBAAC,YAAoB,OAAM,QAAO,oBAApB,MAEd;AAAA;AAAA;AAAA,EACF;AAEJ;AAEO,MAAM,4BAA6D,CAAC,UAAU;AACnF,SACE,oBAAC,oBAAiB,QAAQ,kBAAkB,WAAW,qBACrD,8BAAC,kBAAe,MAAK,SAAQ,OAAO,qBAAqB,SAAS,kBAAmB,GAAG,OAAO,GACjG;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../../../src/components/controls/ListModeSelect.tsx","../../../../src/components/controls/EmbedFormControl.tsx"],"sourcesContent":["import { MenuItem, Select, SelectProps } from '@mui/material'\nimport { ListMode, useListMode } from '@xyo-network/react-shared'\n\nimport { EmbedFormControl } from './EmbedFormControl'\n\nconst listModeSelectId = 'listmode-select-id'\nconst listModeSelectLabel = 'List Mode'\n\nexport const ListModeSelect: React.FC<SelectProps<ListMode>> = (props) => {\n const { listMode, setListMode } = useListMode()\n\n return (\n <Select<ListMode>\n value={(listMode ?? 'default') as ListMode}\n onChange={(event) => {\n setListMode?.(event.target.value as ListMode)\n }}\n {...props}\n >\n <MenuItem key=\"default\" value=\"default\">\n Default\n </MenuItem>\n <MenuItem key=\"table\" value=\"table\">\n Table\n </MenuItem>\n <MenuItem key=\"grid\" value=\"grid\">\n Grid\n </MenuItem>\n </Select>\n )\n}\n\nexport const ListModeSelectFormControl: React.FC<SelectProps<ListMode>> = (props) => {\n return (\n <EmbedFormControl formId={listModeSelectId} formLabel={listModeSelectLabel}>\n <ListModeSelect size=\"small\" label={listModeSelectLabel} labelId={listModeSelectId} {...props} />\n </EmbedFormControl>\n )\n}\n","import { FormControl, FormControlProps, InputLabel } from '@mui/material'\nimport { WithChildren } from '@xylabs/react-shared'\n\ninterface EmbedFormControlProps extends FormControlProps {\n formId?: string\n formLabel?: string\n}\n\nexport const EmbedFormControl: React.FC<WithChildren<EmbedFormControlProps>> = ({ formId, formLabel, children, ...props }) => {\n return (\n <FormControl {...props}>\n <InputLabel id={formId}>{formLabel}</InputLabel>\n {children}\n </FormControl>\n )\n}\n"],"mappings":";AAAA,SAAS,UAAU,cAA2B;AAC9C,SAAmB,mBAAmB;;;ACDtC,SAAS,aAA+B,kBAAkB;AAUtD,SACE,KADF;AAFG,IAAM,mBAAkE,CAAC,EAAE,QAAQ,WAAW,UAAU,GAAG,MAAM,MAAM;AAC5H,SACE,qBAAC,eAAa,GAAG,OACf;AAAA,wBAAC,cAAW,IAAI,QAAS,qBAAU;AAAA,IAClC;AAAA,KACH;AAEJ;;;ADHI,SAOE,OAAAA,MAPF,QAAAC,aAAA;AAPJ,IAAM,mBAAmB;AACzB,IAAM,sBAAsB;AAErB,IAAM,iBAAkD,CAAC,UAAU;AACxE,QAAM,EAAE,UAAU,YAAY,IAAI,YAAY;AAE9C,SACE,gBAAAA;AAAA,IAAC;AAAA;AAAA,MACC,OAAQ,YAAY;AAAA,MACpB,UAAU,CAAC,UAAU;AACnB,sBAAc,MAAM,OAAO,KAAiB;AAAA,MAC9C;AAAA,MACC,GAAG;AAAA,MAEJ;AAAA,wBAAAD,KAAC,YAAuB,OAAM,WAAU,uBAA1B,SAEd;AAAA,QACA,gBAAAA,KAAC,YAAqB,OAAM,SAAQ,qBAAtB,OAEd;AAAA,QACA,gBAAAA,KAAC,YAAoB,OAAM,QAAO,oBAApB,MAEd;AAAA;AAAA;AAAA,EACF;AAEJ;AAEO,IAAM,4BAA6D,CAAC,UAAU;AACnF,SACE,gBAAAA,KAAC,oBAAiB,QAAQ,kBAAkB,WAAW,qBACrD,0BAAAA,KAAC,kBAAe,MAAK,SAAQ,OAAO,qBAAqB,SAAS,kBAAmB,GAAG,OAAO,GACjG;AAEJ;","names":["jsx","jsxs"]}
@@ -1,12 +1,31 @@
1
- import { jsx } from "react/jsx-runtime";
1
+ // src/components/controls/RenderSelect.tsx
2
2
  import { MenuItem, Select } from "@mui/material";
3
- import { useEmbedPluginState } from "../../contexts";
4
- import { EmbedFormControl } from "./EmbedFormControl";
5
- const renderSelectId = "render-select-id";
6
- const renderSelectLabel = "Renderer";
7
- const EmbedRenderSelect = (props) => {
3
+
4
+ // src/contexts/EmbedPluginContext/Context.tsx
5
+ import { createContextEx } from "@xyo-network/react-shared";
6
+ var EmbedPluginContext = createContextEx();
7
+
8
+ // src/contexts/EmbedPluginContext/use.tsx
9
+ import { useContextEx } from "@xyo-network/react-shared";
10
+ var useEmbedPluginState = () => useContextEx(EmbedPluginContext, "EmbedPlugin", true);
11
+
12
+ // src/components/controls/EmbedFormControl.tsx
13
+ import { FormControl, InputLabel } from "@mui/material";
14
+ import { jsx, jsxs } from "react/jsx-runtime";
15
+ var EmbedFormControl = ({ formId, formLabel, children, ...props }) => {
16
+ return /* @__PURE__ */ jsxs(FormControl, { ...props, children: [
17
+ /* @__PURE__ */ jsx(InputLabel, { id: formId, children: formLabel }),
18
+ children
19
+ ] });
20
+ };
21
+
22
+ // src/components/controls/RenderSelect.tsx
23
+ import { jsx as jsx2 } from "react/jsx-runtime";
24
+ var renderSelectId = "render-select-id";
25
+ var renderSelectLabel = "Renderer";
26
+ var EmbedRenderSelect = (props) => {
8
27
  const { activePlugin, setActivePlugin, plugins } = useEmbedPluginState();
9
- return /* @__PURE__ */ jsx(EmbedFormControl, { formId: renderSelectId, formLabel: renderSelectLabel, children: /* @__PURE__ */ jsx(Select, { size: "small", value: activePlugin?.name, ...props, children: plugins?.map((plugin) => /* @__PURE__ */ jsx(MenuItem, { value: plugin.name, onClick: () => setActivePlugin?.(plugin), children: plugin.name }, plugin.name)) }) });
28
+ return /* @__PURE__ */ jsx2(EmbedFormControl, { formId: renderSelectId, formLabel: renderSelectLabel, children: /* @__PURE__ */ jsx2(Select, { size: "small", value: activePlugin?.name, ...props, children: plugins?.map((plugin) => /* @__PURE__ */ jsx2(MenuItem, { value: plugin.name, onClick: () => setActivePlugin?.(plugin), children: plugin.name }, plugin.name)) }) });
10
29
  };
11
30
  export {
12
31
  EmbedRenderSelect
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/controls/RenderSelect.tsx"],"sourcesContent":["import { MenuItem, Select, SelectProps } from '@mui/material'\n\nimport { useEmbedPluginState } from '../../contexts'\nimport { EmbedFormControl } from './EmbedFormControl'\n\nconst renderSelectId = 'render-select-id'\nconst renderSelectLabel = 'Renderer'\n\nexport const EmbedRenderSelect: React.FC<SelectProps> = (props) => {\n const { activePlugin, setActivePlugin, plugins } = useEmbedPluginState()\n return (\n <EmbedFormControl formId={renderSelectId} formLabel={renderSelectLabel}>\n <Select size=\"small\" value={activePlugin?.name} {...props}>\n {plugins?.map((plugin) => (\n <MenuItem value={plugin.name} key={plugin.name} onClick={() => setActivePlugin?.(plugin)}>\n {plugin.name}\n </MenuItem>\n ))}\n </Select>\n </EmbedFormControl>\n )\n}\n"],"mappings":"AAcU;AAdV,SAAS,UAAU,cAA2B;AAE9C,SAAS,2BAA2B;AACpC,SAAS,wBAAwB;AAEjC,MAAM,iBAAiB;AACvB,MAAM,oBAAoB;AAEnB,MAAM,oBAA2C,CAAC,UAAU;AACjE,QAAM,EAAE,cAAc,iBAAiB,QAAQ,IAAI,oBAAoB;AACvE,SACE,oBAAC,oBAAiB,QAAQ,gBAAgB,WAAW,mBACnD,8BAAC,UAAO,MAAK,SAAQ,OAAO,cAAc,MAAO,GAAG,OACjD,mBAAS,IAAI,CAAC,WACb,oBAAC,YAAS,OAAO,OAAO,MAAwB,SAAS,MAAM,kBAAkB,MAAM,GACpF,iBAAO,QADyB,OAAO,IAE1C,CACD,GACH,GACF;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../../../src/components/controls/RenderSelect.tsx","../../../../src/contexts/EmbedPluginContext/Context.tsx","../../../../src/contexts/EmbedPluginContext/use.tsx","../../../../src/components/controls/EmbedFormControl.tsx"],"sourcesContent":["import { MenuItem, Select, SelectProps } from '@mui/material'\n\nimport { useEmbedPluginState } from '../../contexts'\nimport { EmbedFormControl } from './EmbedFormControl'\n\nconst renderSelectId = 'render-select-id'\nconst renderSelectLabel = 'Renderer'\n\nexport const EmbedRenderSelect: React.FC<SelectProps> = (props) => {\n const { activePlugin, setActivePlugin, plugins } = useEmbedPluginState()\n return (\n <EmbedFormControl formId={renderSelectId} formLabel={renderSelectLabel}>\n <Select size=\"small\" value={activePlugin?.name} {...props}>\n {plugins?.map((plugin) => (\n <MenuItem value={plugin.name} key={plugin.name} onClick={() => setActivePlugin?.(plugin)}>\n {plugin.name}\n </MenuItem>\n ))}\n </Select>\n </EmbedFormControl>\n )\n}\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport { EmbedPluginState } from './State'\n\nexport const EmbedPluginContext = createContextEx<EmbedPluginState>()\n","import { useContextEx } from '@xyo-network/react-shared'\n\nimport { EmbedPluginContext } from './Context'\n\nexport const useEmbedPluginState = () => useContextEx(EmbedPluginContext, 'EmbedPlugin', true)\n","import { FormControl, FormControlProps, InputLabel } from '@mui/material'\nimport { WithChildren } from '@xylabs/react-shared'\n\ninterface EmbedFormControlProps extends FormControlProps {\n formId?: string\n formLabel?: string\n}\n\nexport const EmbedFormControl: React.FC<WithChildren<EmbedFormControlProps>> = ({ formId, formLabel, children, ...props }) => {\n return (\n <FormControl {...props}>\n <InputLabel id={formId}>{formLabel}</InputLabel>\n {children}\n </FormControl>\n )\n}\n"],"mappings":";AAAA,SAAS,UAAU,cAA2B;;;ACA9C,SAAS,uBAAuB;AAIzB,IAAM,qBAAqB,gBAAkC;;;ACJpE,SAAS,oBAAoB;AAItB,IAAM,sBAAsB,MAAM,aAAa,oBAAoB,eAAe,IAAI;;;ACJ7F,SAAS,aAA+B,kBAAkB;AAUtD,SACE,KADF;AAFG,IAAM,mBAAkE,CAAC,EAAE,QAAQ,WAAW,UAAU,GAAG,MAAM,MAAM;AAC5H,SACE,qBAAC,eAAa,GAAG,OACf;AAAA,wBAAC,cAAW,IAAI,QAAS,qBAAU;AAAA,IAClC;AAAA,KACH;AAEJ;;;AHDU,gBAAAA,YAAA;AATV,IAAM,iBAAiB;AACvB,IAAM,oBAAoB;AAEnB,IAAM,oBAA2C,CAAC,UAAU;AACjE,QAAM,EAAE,cAAc,iBAAiB,QAAQ,IAAI,oBAAoB;AACvE,SACE,gBAAAA,KAAC,oBAAiB,QAAQ,gBAAgB,WAAW,mBACnD,0BAAAA,KAAC,UAAO,MAAK,SAAQ,OAAO,cAAc,MAAO,GAAG,OACjD,mBAAS,IAAI,CAAC,WACb,gBAAAA,KAAC,YAAS,OAAO,OAAO,MAAwB,SAAS,MAAM,kBAAkB,MAAM,GACpF,iBAAO,QADyB,OAAO,IAE1C,CACD,GACH,GACF;AAEJ;","names":["jsx"]}
@@ -1,4 +1,64 @@
1
- export * from "./EmbedFormControl";
2
- export * from "./ListModeSelect";
3
- export * from "./RenderSelect";
1
+ // src/components/controls/EmbedFormControl.tsx
2
+ import { FormControl, InputLabel } from "@mui/material";
3
+ import { jsx, jsxs } from "react/jsx-runtime";
4
+ var EmbedFormControl = ({ formId, formLabel, children, ...props }) => {
5
+ return /* @__PURE__ */ jsxs(FormControl, { ...props, children: [
6
+ /* @__PURE__ */ jsx(InputLabel, { id: formId, children: formLabel }),
7
+ children
8
+ ] });
9
+ };
10
+
11
+ // src/components/controls/ListModeSelect.tsx
12
+ import { MenuItem, Select } from "@mui/material";
13
+ import { useListMode } from "@xyo-network/react-shared";
14
+ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
15
+ var listModeSelectId = "listmode-select-id";
16
+ var listModeSelectLabel = "List Mode";
17
+ var ListModeSelect = (props) => {
18
+ const { listMode, setListMode } = useListMode();
19
+ return /* @__PURE__ */ jsxs2(
20
+ Select,
21
+ {
22
+ value: listMode ?? "default",
23
+ onChange: (event) => {
24
+ setListMode?.(event.target.value);
25
+ },
26
+ ...props,
27
+ children: [
28
+ /* @__PURE__ */ jsx2(MenuItem, { value: "default", children: "Default" }, "default"),
29
+ /* @__PURE__ */ jsx2(MenuItem, { value: "table", children: "Table" }, "table"),
30
+ /* @__PURE__ */ jsx2(MenuItem, { value: "grid", children: "Grid" }, "grid")
31
+ ]
32
+ }
33
+ );
34
+ };
35
+ var ListModeSelectFormControl = (props) => {
36
+ return /* @__PURE__ */ jsx2(EmbedFormControl, { formId: listModeSelectId, formLabel: listModeSelectLabel, children: /* @__PURE__ */ jsx2(ListModeSelect, { size: "small", label: listModeSelectLabel, labelId: listModeSelectId, ...props }) });
37
+ };
38
+
39
+ // src/components/controls/RenderSelect.tsx
40
+ import { MenuItem as MenuItem2, Select as Select2 } from "@mui/material";
41
+
42
+ // src/contexts/EmbedPluginContext/Context.tsx
43
+ import { createContextEx } from "@xyo-network/react-shared";
44
+ var EmbedPluginContext = createContextEx();
45
+
46
+ // src/contexts/EmbedPluginContext/use.tsx
47
+ import { useContextEx } from "@xyo-network/react-shared";
48
+ var useEmbedPluginState = () => useContextEx(EmbedPluginContext, "EmbedPlugin", true);
49
+
50
+ // src/components/controls/RenderSelect.tsx
51
+ import { jsx as jsx3 } from "react/jsx-runtime";
52
+ var renderSelectId = "render-select-id";
53
+ var renderSelectLabel = "Renderer";
54
+ var EmbedRenderSelect = (props) => {
55
+ const { activePlugin, setActivePlugin, plugins } = useEmbedPluginState();
56
+ return /* @__PURE__ */ jsx3(EmbedFormControl, { formId: renderSelectId, formLabel: renderSelectLabel, children: /* @__PURE__ */ jsx3(Select2, { size: "small", value: activePlugin?.name, ...props, children: plugins?.map((plugin) => /* @__PURE__ */ jsx3(MenuItem2, { value: plugin.name, onClick: () => setActivePlugin?.(plugin), children: plugin.name }, plugin.name)) }) });
57
+ };
58
+ export {
59
+ EmbedFormControl,
60
+ EmbedRenderSelect,
61
+ ListModeSelect,
62
+ ListModeSelectFormControl
63
+ };
4
64
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/controls/index.ts"],"sourcesContent":["export * from './EmbedFormControl'\nexport * from './ListModeSelect'\nexport * from './RenderSelect'\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;","names":[]}
1
+ {"version":3,"sources":["../../../../src/components/controls/EmbedFormControl.tsx","../../../../src/components/controls/ListModeSelect.tsx","../../../../src/components/controls/RenderSelect.tsx","../../../../src/contexts/EmbedPluginContext/Context.tsx","../../../../src/contexts/EmbedPluginContext/use.tsx"],"sourcesContent":["import { FormControl, FormControlProps, InputLabel } from '@mui/material'\nimport { WithChildren } from '@xylabs/react-shared'\n\ninterface EmbedFormControlProps extends FormControlProps {\n formId?: string\n formLabel?: string\n}\n\nexport const EmbedFormControl: React.FC<WithChildren<EmbedFormControlProps>> = ({ formId, formLabel, children, ...props }) => {\n return (\n <FormControl {...props}>\n <InputLabel id={formId}>{formLabel}</InputLabel>\n {children}\n </FormControl>\n )\n}\n","import { MenuItem, Select, SelectProps } from '@mui/material'\nimport { ListMode, useListMode } from '@xyo-network/react-shared'\n\nimport { EmbedFormControl } from './EmbedFormControl'\n\nconst listModeSelectId = 'listmode-select-id'\nconst listModeSelectLabel = 'List Mode'\n\nexport const ListModeSelect: React.FC<SelectProps<ListMode>> = (props) => {\n const { listMode, setListMode } = useListMode()\n\n return (\n <Select<ListMode>\n value={(listMode ?? 'default') as ListMode}\n onChange={(event) => {\n setListMode?.(event.target.value as ListMode)\n }}\n {...props}\n >\n <MenuItem key=\"default\" value=\"default\">\n Default\n </MenuItem>\n <MenuItem key=\"table\" value=\"table\">\n Table\n </MenuItem>\n <MenuItem key=\"grid\" value=\"grid\">\n Grid\n </MenuItem>\n </Select>\n )\n}\n\nexport const ListModeSelectFormControl: React.FC<SelectProps<ListMode>> = (props) => {\n return (\n <EmbedFormControl formId={listModeSelectId} formLabel={listModeSelectLabel}>\n <ListModeSelect size=\"small\" label={listModeSelectLabel} labelId={listModeSelectId} {...props} />\n </EmbedFormControl>\n )\n}\n","import { MenuItem, Select, SelectProps } from '@mui/material'\n\nimport { useEmbedPluginState } from '../../contexts'\nimport { EmbedFormControl } from './EmbedFormControl'\n\nconst renderSelectId = 'render-select-id'\nconst renderSelectLabel = 'Renderer'\n\nexport const EmbedRenderSelect: React.FC<SelectProps> = (props) => {\n const { activePlugin, setActivePlugin, plugins } = useEmbedPluginState()\n return (\n <EmbedFormControl formId={renderSelectId} formLabel={renderSelectLabel}>\n <Select size=\"small\" value={activePlugin?.name} {...props}>\n {plugins?.map((plugin) => (\n <MenuItem value={plugin.name} key={plugin.name} onClick={() => setActivePlugin?.(plugin)}>\n {plugin.name}\n </MenuItem>\n ))}\n </Select>\n </EmbedFormControl>\n )\n}\n","import { createContextEx } from '@xyo-network/react-shared'\n\nimport { EmbedPluginState } from './State'\n\nexport const EmbedPluginContext = createContextEx<EmbedPluginState>()\n","import { useContextEx } from '@xyo-network/react-shared'\n\nimport { EmbedPluginContext } from './Context'\n\nexport const useEmbedPluginState = () => useContextEx(EmbedPluginContext, 'EmbedPlugin', true)\n"],"mappings":";AAAA,SAAS,aAA+B,kBAAkB;AAUtD,SACE,KADF;AAFG,IAAM,mBAAkE,CAAC,EAAE,QAAQ,WAAW,UAAU,GAAG,MAAM,MAAM;AAC5H,SACE,qBAAC,eAAa,GAAG,OACf;AAAA,wBAAC,cAAW,IAAI,QAAS,qBAAU;AAAA,IAClC;AAAA,KACH;AAEJ;;;ACfA,SAAS,UAAU,cAA2B;AAC9C,SAAmB,mBAAmB;AAWlC,SAOE,OAAAA,MAPF,QAAAC,aAAA;AAPJ,IAAM,mBAAmB;AACzB,IAAM,sBAAsB;AAErB,IAAM,iBAAkD,CAAC,UAAU;AACxE,QAAM,EAAE,UAAU,YAAY,IAAI,YAAY;AAE9C,SACE,gBAAAA;AAAA,IAAC;AAAA;AAAA,MACC,OAAQ,YAAY;AAAA,MACpB,UAAU,CAAC,UAAU;AACnB,sBAAc,MAAM,OAAO,KAAiB;AAAA,MAC9C;AAAA,MACC,GAAG;AAAA,MAEJ;AAAA,wBAAAD,KAAC,YAAuB,OAAM,WAAU,uBAA1B,SAEd;AAAA,QACA,gBAAAA,KAAC,YAAqB,OAAM,SAAQ,qBAAtB,OAEd;AAAA,QACA,gBAAAA,KAAC,YAAoB,OAAM,QAAO,oBAApB,MAEd;AAAA;AAAA;AAAA,EACF;AAEJ;AAEO,IAAM,4BAA6D,CAAC,UAAU;AACnF,SACE,gBAAAA,KAAC,oBAAiB,QAAQ,kBAAkB,WAAW,qBACrD,0BAAAA,KAAC,kBAAe,MAAK,SAAQ,OAAO,qBAAqB,SAAS,kBAAmB,GAAG,OAAO,GACjG;AAEJ;;;ACtCA,SAAS,YAAAE,WAAU,UAAAC,eAA2B;;;ACA9C,SAAS,uBAAuB;AAIzB,IAAM,qBAAqB,gBAAkC;;;ACJpE,SAAS,oBAAoB;AAItB,IAAM,sBAAsB,MAAM,aAAa,oBAAoB,eAAe,IAAI;;;AFUnF,gBAAAC,YAAA;AATV,IAAM,iBAAiB;AACvB,IAAM,oBAAoB;AAEnB,IAAM,oBAA2C,CAAC,UAAU;AACjE,QAAM,EAAE,cAAc,iBAAiB,QAAQ,IAAI,oBAAoB;AACvE,SACE,gBAAAA,KAAC,oBAAiB,QAAQ,gBAAgB,WAAW,mBACnD,0BAAAA,KAACC,SAAA,EAAO,MAAK,SAAQ,OAAO,cAAc,MAAO,GAAG,OACjD,mBAAS,IAAI,CAAC,WACb,gBAAAD,KAACE,WAAA,EAAS,OAAO,OAAO,MAAwB,SAAS,MAAM,kBAAkB,MAAM,GACpF,iBAAO,QADyB,OAAO,IAE1C,CACD,GACH,GACF;AAEJ;","names":["jsx","jsxs","MenuItem","Select","jsx","Select","MenuItem"]}
@@ -1,14 +1,61 @@
1
- import { jsx } from "react/jsx-runtime";
1
+ // src/components/embed-card/EmbedCardResolver.tsx
2
2
  import { useTheme } from "@mui/material";
3
3
  import { FlexCol } from "@xylabs/react-flexbox";
4
4
  import { LoadResult } from "@xyo-network/react-shared";
5
- import { useRefreshPayload, useResolvePayload } from "../../contexts";
6
- import { EmbedCardApiErrorRenderer } from "./error-handling";
7
- const EmbedCardResolverFlexBox = ({ children, ...props }) => {
5
+
6
+ // src/contexts/RefreshPayloadContext/Context.tsx
7
+ import { createContextEx } from "@xyo-network/react-shared";
8
+ var RefreshPayloadContext = createContextEx();
9
+
10
+ // src/contexts/RefreshPayloadContext/use.tsx
11
+ import { useContextEx } from "@xyo-network/react-shared";
12
+ var useRefreshPayload = () => useContextEx(RefreshPayloadContext, "RefreshPayload", true);
13
+
14
+ // src/contexts/ResolvePayloadContext/Context.ts
15
+ import { createContextEx as createContextEx2 } from "@xyo-network/react-shared";
16
+ var ResolvePayloadContext = createContextEx2();
17
+
18
+ // src/contexts/ResolvePayloadContext/use.tsx
19
+ import { useContextEx as useContextEx2 } from "@xyo-network/react-shared";
20
+ var useResolvePayload = () => useContextEx2(ResolvePayloadContext, "ResolvePayload", true);
21
+
22
+ // src/components/embed-card/error-handling/EmbedCardApiErrorRenderer.tsx
23
+ import { ErrorAlert, ErrorRender } from "@xyo-network/react-error";
24
+
25
+ // src/components/embed-card/error-handling/EmbedErrorCard.tsx
26
+ import { Alert, AlertTitle, Card, CardContent, Typography } from "@mui/material";
27
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
28
+ var EmbedErrorCard = (props) => {
29
+ const { alertProps, error, hideErrorDetails = true, children, ...cardProps } = props;
30
+ const errorProps = { alertProps, error, hideErrorDetails };
31
+ return /* @__PURE__ */ jsx(Card, { ...cardProps, children: /* @__PURE__ */ jsx(CardContent, { children: children ?? /* @__PURE__ */ jsx(DefaultErrorAlert, { ...errorProps }) }) });
32
+ };
33
+ var DefaultErrorAlert = ({ alertProps, hideErrorDetails, error }) => {
34
+ return /* @__PURE__ */ jsxs(Alert, { severity: "error", ...alertProps, children: [
35
+ /* @__PURE__ */ jsx(AlertTitle, { children: "Whoops! Something went wrong" }),
36
+ !hideErrorDetails && error ? /* @__PURE__ */ jsxs(Fragment, { children: [
37
+ /* @__PURE__ */ jsx(Typography, { variant: "caption", children: "Error: " }),
38
+ /* @__PURE__ */ jsx(Typography, { variant: "caption", children: error?.message })
39
+ ] }) : /* @__PURE__ */ jsx(Typography, { variant: "caption", fontSize: "small", children: "Error Loading Plugin" })
40
+ ] });
41
+ };
42
+
43
+ // src/components/embed-card/error-handling/EmbedCardApiErrorRenderer.tsx
44
+ import { jsx as jsx2 } from "react/jsx-runtime";
45
+ var EmbedCardApiErrorRenderer = ({ xyoError, children, ...props }) => {
46
+ return /* @__PURE__ */ jsx2(ErrorRender, { error: xyoError, noReAuth: true, noErrorDisplay: true, customError: /* @__PURE__ */ jsx2(CustomApiErrorCard, { xyoError, ...props }), children });
47
+ };
48
+ var CustomApiErrorCard = ({ xyoError, ...props }) => {
49
+ return /* @__PURE__ */ jsx2(EmbedErrorCard, { ...props, children: /* @__PURE__ */ jsx2(ErrorAlert, { error: xyoError }) });
50
+ };
51
+
52
+ // src/components/embed-card/EmbedCardResolver.tsx
53
+ import { jsx as jsx3 } from "react/jsx-runtime";
54
+ var EmbedCardResolverFlexBox = ({ children, ...props }) => {
8
55
  const { payload, notFound, huriError } = useResolvePayload();
9
56
  const { refreshPayload } = useRefreshPayload();
10
57
  const theme = useTheme();
11
- return /* @__PURE__ */ jsx(LoadResult, { searchResult: payload, notFound: !!notFound, error: !!huriError, children: /* @__PURE__ */ jsx(EmbedCardApiErrorRenderer, { xyoError: huriError, children: /* @__PURE__ */ jsx(
58
+ return /* @__PURE__ */ jsx3(LoadResult, { searchResult: payload, notFound: !!notFound, error: !!huriError, children: /* @__PURE__ */ jsx3(EmbedCardApiErrorRenderer, { xyoError: huriError, children: /* @__PURE__ */ jsx3(
12
59
  FlexCol,
13
60
  {
14
61
  id: "embed-outer-wrap",