@xyo-network/react-schema 7.4.1 → 7.5.0

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,9 +1,9 @@
1
1
  import type { Meta } from '@storybook/react-vite';
2
2
  declare const StorybookEntry: Meta;
3
- declare const Default: import(".store/storybook-virtual-a067dd1507/package/internal/csf").AnnotatedStoryFn<import("@storybook/react-vite").ReactRenderer, import("@storybook/react-vite").Args>;
4
- declare const WithVerifiedValue: import(".store/storybook-virtual-a067dd1507/package/internal/csf").AnnotatedStoryFn<import("@storybook/react-vite").ReactRenderer, import("@storybook/react-vite").Args>;
5
- declare const WithVerifiedValuePaper: import(".store/storybook-virtual-a067dd1507/package/internal/csf").AnnotatedStoryFn<import("@storybook/react-vite").ReactRenderer, import("@storybook/react-vite").Args>;
6
- declare const WithUnverifiedValue: import(".store/storybook-virtual-a067dd1507/package/internal/csf").AnnotatedStoryFn<import("@storybook/react-vite").ReactRenderer, import("@storybook/react-vite").Args>;
3
+ declare const Default: import("storybook/internal/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, import("@storybook/react-vite").Args>;
4
+ declare const WithVerifiedValue: import("storybook/internal/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, import("@storybook/react-vite").Args>;
5
+ declare const WithVerifiedValuePaper: import("storybook/internal/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, import("@storybook/react-vite").Args>;
6
+ declare const WithUnverifiedValue: import("storybook/internal/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, import("@storybook/react-vite").Args>;
7
7
  export { Default, WithUnverifiedValue, WithVerifiedValue, WithVerifiedValuePaper, };
8
8
  export default StorybookEntry;
9
9
  //# sourceMappingURL=SchemaProperty.stories.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SchemaProperty.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/Property/SchemaProperty.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAW,MAAM,uBAAuB,CAAA;AAO1D,QAAA,MAAM,cAAc,EAAE,IAIrB,CAAA;AAaD,QAAA,MAAM,OAAO,0KAAoB,CAAA;AAGjC,QAAA,MAAM,iBAAiB,0KAAoB,CAAA;AAG3C,QAAA,MAAM,sBAAsB,0KAAoB,CAAA;AAGhD,QAAA,MAAM,mBAAmB,0KAAoB,CAAA;AAG7C,OAAO,EACL,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,sBAAsB,GACxE,CAAA;AAED,eAAe,cAAc,CAAA"}
1
+ {"version":3,"file":"SchemaProperty.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/Property/SchemaProperty.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAW,MAAM,uBAAuB,CAAA;AAO1D,QAAA,MAAM,cAAc,EAAE,IAIrB,CAAA;AAaD,QAAA,MAAM,OAAO,mIAAoB,CAAA;AAGjC,QAAA,MAAM,iBAAiB,mIAAoB,CAAA;AAG3C,QAAA,MAAM,sBAAsB,mIAAoB,CAAA;AAGhD,QAAA,MAAM,mBAAmB,mIAAoB,CAAA;AAG7C,OAAO,EACL,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,sBAAsB,GACxE,CAAA;AAED,eAAe,cAAc,CAAA"}
@@ -1,6 +1,6 @@
1
1
  import type { Meta } from '@storybook/react-vite';
2
2
  declare const _default: Meta;
3
3
  export default _default;
4
- declare const Default: import(".store/storybook-virtual-a067dd1507/package/internal/csf").AnnotatedStoryFn<import("@storybook/react-vite").ReactRenderer, {}>;
4
+ declare const Default: import("storybook/internal/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, {}>;
5
5
  export { Default };
6
6
  //# sourceMappingURL=TestSchemaHooks.stories.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TestSchemaHooks.stories.d.ts","sourceRoot":"","sources":["../../../../src/hooks/stories/TestSchemaHooks.stories.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACC,IAAI,EAChB,MAAM,uBAAuB,CAAA;wBAoDzB,IAAI;AAHT,wBAGS;AAyCT,QAAA,MAAM,OAAO,wIAAoB,CAAA;AAEjC,OAAO,EAAE,OAAO,EAAE,CAAA"}
1
+ {"version":3,"file":"TestSchemaHooks.stories.d.ts","sourceRoot":"","sources":["../../../../src/hooks/stories/TestSchemaHooks.stories.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACC,IAAI,EAChB,MAAM,uBAAuB,CAAA;wBAoDzB,IAAI;AAHT,wBAGS;AAyCT,QAAA,MAAM,OAAO,iGAAoB,CAAA;AAEjC,OAAO,EAAE,OAAO,EAAE,CAAA"}
@@ -5,7 +5,7 @@ import type { SchemaPayload } from '@xyo-network/schema-payload-plugin';
5
5
  */
6
6
  declare const useGetSchemaPayload: (schema?: string) => {
7
7
  notFound: boolean;
8
- schemaHuri: import(".store/@xyo-network-huri-npm-5.2.17-fc78df6afe/package").Huri<import("@xyo-network/payload-model").Payload> | undefined;
8
+ schemaHuri: import("@xyo-network/huri").Huri<import("@xyo-network/payload-model").Payload> | undefined;
9
9
  schemaPayload: SchemaPayload | null | undefined;
10
10
  xyoError: WithSources<ModuleError> | undefined;
11
11
  };
@@ -1,9 +1,9 @@
1
1
  import type { Meta } from '@storybook/react-vite';
2
2
  declare const StorybookEntry: Meta;
3
- declare const Default: import(".store/storybook-virtual-a067dd1507/package/internal/csf").AnnotatedStoryFn<import("@storybook/react-vite").ReactRenderer, {
3
+ declare const Default: import("storybook/internal/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, {
4
4
  schema: string;
5
5
  }>;
6
- declare const Domain: import(".store/storybook-virtual-a067dd1507/package/internal/csf").AnnotatedStoryFn<import("@storybook/react-vite").ReactRenderer, {
6
+ declare const Domain: import("storybook/internal/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, {
7
7
  schema: string;
8
8
  }>;
9
9
  export { Default, Domain };
@@ -1,4 +1,4 @@
1
- import type { Address } from '@xylabs/hex';
1
+ import type { Address } from '@xylabs/sdk-js';
2
2
  import type { SchemaListPayload } from '@xyo-network/diviner-schema-list-model';
3
3
  export declare const useSchemaList: (address?: Address, nameOrAddress?: string) => [SchemaListPayload | null | undefined, Error | undefined];
4
4
  //# sourceMappingURL=useSchemaList.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useSchemaList.d.ts","sourceRoot":"","sources":["../../../src/hooks/useSchemaList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAE1C,OAAO,KAAK,EAAE,iBAAiB,EAA0B,MAAM,wCAAwC,CAAA;AAKvG,eAAO,MAAM,aAAa,GAAI,UAAU,OAAO,EAAE,sBAAmC,KAAG,CAAC,iBAAiB,GAAG,IAAI,GAAG,SAAS,EAAE,KAAK,GAAG,SAAS,CA2B9I,CAAA"}
1
+ {"version":3,"file":"useSchemaList.d.ts","sourceRoot":"","sources":["../../../src/hooks/useSchemaList.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,KAAK,EAAE,iBAAiB,EAA0B,MAAM,wCAAwC,CAAA;AAKvG,eAAO,MAAM,aAAa,GAAI,UAAU,OAAO,EAAE,sBAAmC,KAAG,CAAC,iBAAiB,GAAG,IAAI,GAAG,SAAS,EAAE,KAAK,GAAG,SAAS,CA2B9I,CAAA"}
@@ -1,4 +1,4 @@
1
- import type { Address } from '@xylabs/hex';
1
+ import type { Address } from '@xylabs/sdk-js';
2
2
  import type { SchemaStatsPayload } from '@xyo-network/diviner-schema-stats-model';
3
3
  import type { Dispatch, SetStateAction } from 'react';
4
4
  export declare const useSchemaStats: (statsAddress?: Address, nameOrAddress?: string) => [SchemaStatsPayload[] | undefined, Error | undefined, Dispatch<SetStateAction<number>>];
@@ -1 +1 @@
1
- {"version":3,"file":"useSchemaStats.d.ts","sourceRoot":"","sources":["../../../src/hooks/useSchemaStats.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAE1C,OAAO,KAAK,EACV,kBAAkB,EAEnB,MAAM,yCAAyC,CAAA;AAShD,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAGrD,eAAO,MAAM,cAAc,GACzB,eAAe,OAAO,EACtB,sBAAwC,KACvC,CAAC,kBAAkB,EAAE,GAAG,SAAS,EAAE,KAAK,GAAG,SAAS,EAAE,QAAQ,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CA6CxF,CAAA"}
1
+ {"version":3,"file":"useSchemaStats.d.ts","sourceRoot":"","sources":["../../../src/hooks/useSchemaStats.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,KAAK,EACV,kBAAkB,EAEnB,MAAM,yCAAyC,CAAA;AAShD,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAGrD,eAAO,MAAM,cAAc,GACzB,eAAe,OAAO,EACtB,sBAAwC,KACvC,CAAC,kBAAkB,EAAE,GAAG,SAAS,EAAE,KAAK,GAAG,SAAS,EAAE,QAAQ,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CA6CxF,CAAA"}
@@ -1,9 +1,8 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+
1
4
  // src/components/Property/SchemaProperty.tsx
2
- import {
3
- NewReleases as NewReleasesIcon,
4
- OpenInNew as OpenInNewIcon,
5
- Verified as VerifiedIcon
6
- } from "@mui/icons-material";
5
+ import { NewReleases as NewReleasesIcon, OpenInNew as OpenInNewIcon, Verified as VerifiedIcon } from "@mui/icons-material";
7
6
  import { IconButton } from "@mui/material";
8
7
  import { useAsyncEffect } from "@xylabs/react-async-effect";
9
8
  import { FlexGrowRow } from "@xylabs/react-flexbox";
@@ -11,128 +10,115 @@ import { LinkEx } from "@xylabs/react-link";
11
10
  import { useEvent } from "@xyo-network/react-event";
12
11
  import { Property, PropertyValue } from "@xyo-network/react-property";
13
12
  import { SchemaCache } from "@xyo-network/schema-cache";
14
- import { useState } from "react";
15
- import { jsx, jsxs } from "react/jsx-runtime";
16
- var useResolveSchema = (schema) => {
13
+ import React, { useState } from "react";
14
+ var useResolveSchema = /* @__PURE__ */ __name((schema) => {
17
15
  const [entry, setEntry] = useState();
18
- useAsyncEffect(
19
- async (mounted) => {
20
- if (schema) {
21
- const entry2 = await SchemaCache.instance.get(schema);
22
- if (mounted()) {
23
- setEntry(entry2);
24
- }
16
+ useAsyncEffect(async (mounted) => {
17
+ if (schema) {
18
+ const entry2 = await SchemaCache.instance.get(schema);
19
+ if (mounted()) {
20
+ setEntry(entry2);
25
21
  }
26
- },
27
- [schema]
28
- );
22
+ }
23
+ }, [
24
+ schema
25
+ ]);
29
26
  return entry;
30
- };
31
- var SchemaProperty = ({
32
- showLinkNames = true,
33
- showOpenNewWindowLink = true,
34
- showStatusIcon = true,
35
- titleProps,
36
- value,
37
- ...props
38
- }) => {
27
+ }, "useResolveSchema");
28
+ var SchemaProperty = /* @__PURE__ */ __name(({ showLinkNames = true, showOpenNewWindowLink = true, showStatusIcon = true, titleProps, value, ...props }) => {
39
29
  const resolvedSchema = useResolveSchema(value);
40
30
  const [buttonRef, buttonDispatch] = useEvent();
41
31
  const [divRef, divDispatch] = useEvent();
42
- const onClick = (dispatch, openNewWindow = false) => {
43
- dispatch?.(
44
- "schema",
45
- "click",
46
- JSON.stringify({
47
- openNewWindow,
48
- schema: value
49
- })
50
- );
51
- };
52
- return /* @__PURE__ */ jsxs(Property, { title: "Schema", value, tip: "Schema sent with the payload", titleProps, ...props, children: [
53
- value && showStatusIcon ? resolvedSchema === null ? /* @__PURE__ */ jsx(
54
- IconButton,
55
- {
56
- ref: buttonRef,
57
- size: "small",
58
- onClick: () => {
59
- if (!buttonRef.current) {
60
- console.warn("buttonRef.current is null");
61
- }
62
- onClick(buttonDispatch);
63
- },
64
- children: /* @__PURE__ */ jsx(NewReleasesIcon, { color: "warning", fontSize: "inherit" })
32
+ const onClick = /* @__PURE__ */ __name((dispatch, openNewWindow = false) => {
33
+ dispatch?.("schema", "click", JSON.stringify({
34
+ openNewWindow,
35
+ schema: value
36
+ }));
37
+ }, "onClick");
38
+ return /* @__PURE__ */ React.createElement(Property, {
39
+ title: "Schema",
40
+ value,
41
+ tip: "Schema sent with the payload",
42
+ titleProps,
43
+ ...props
44
+ }, value && showStatusIcon ? resolvedSchema === null ? /* @__PURE__ */ React.createElement(IconButton, {
45
+ ref: buttonRef,
46
+ size: "small",
47
+ onClick: /* @__PURE__ */ __name(() => {
48
+ if (!buttonRef.current) {
49
+ console.warn("buttonRef.current is null");
65
50
  }
66
- ) : resolvedSchema === void 0 ? /* @__PURE__ */ jsx(
67
- IconButton,
68
- {
69
- ref: buttonRef,
70
- size: "small",
71
- onClick: () => {
72
- if (!buttonRef.current) {
73
- console.warn("buttonRef.current is null");
74
- }
75
- onClick(buttonDispatch);
76
- },
77
- children: /* @__PURE__ */ jsx(NewReleasesIcon, { color: "disabled", fontSize: "inherit" })
51
+ onClick(buttonDispatch);
52
+ }, "onClick")
53
+ }, /* @__PURE__ */ React.createElement(NewReleasesIcon, {
54
+ color: "warning",
55
+ fontSize: "inherit"
56
+ })) : resolvedSchema === void 0 ? /* @__PURE__ */ React.createElement(IconButton, {
57
+ ref: buttonRef,
58
+ size: "small",
59
+ onClick: /* @__PURE__ */ __name(() => {
60
+ if (!buttonRef.current) {
61
+ console.warn("buttonRef.current is null");
78
62
  }
79
- ) : /* @__PURE__ */ jsx(IconButton, { rel: "noopener noreferrer", size: "small", target: "_blank", href: resolvedSchema?.huri?.href ?? "", children: /* @__PURE__ */ jsx(VerifiedIcon, { color: "success", fontSize: "inherit" }) }) : null,
80
- value ? /* @__PURE__ */ jsxs(FlexGrowRow, { ref: divRef, justifyContent: "space-between", children: [
81
- showLinkNames ? /* @__PURE__ */ jsx(
82
- LinkEx,
83
- {
84
- display: "block",
85
- width: "100%",
86
- sx: { cursor: "pointer" },
87
- children: /* @__PURE__ */ jsx(
88
- PropertyValue,
89
- {
90
- value,
91
- title: "view schema",
92
- onClick: () => {
93
- if (!divRef.current) {
94
- console.warn("divRef.current is null");
95
- }
96
- onClick(divDispatch);
97
- }
98
- }
99
- )
100
- }
101
- ) : /* @__PURE__ */ jsx(
102
- PropertyValue,
103
- {
104
- value,
105
- title: "view schema",
106
- onClick: () => {
107
- if (!divRef.current) {
108
- console.warn("divRef.current is null");
109
- }
110
- onClick(divDispatch);
111
- }
112
- }
113
- ),
114
- showOpenNewWindowLink ? /* @__PURE__ */ jsx(
115
- IconButton,
116
- {
117
- ref: buttonRef,
118
- size: "small",
119
- onClick: () => {
120
- if (!buttonRef.current) {
121
- console.warn("buttonRef.current is null");
122
- }
123
- onClick(buttonDispatch, true);
124
- },
125
- children: /* @__PURE__ */ jsx(OpenInNewIcon, { fontSize: "inherit" })
126
- }
127
- ) : null
128
- ] }) : null
129
- ] });
130
- };
63
+ onClick(buttonDispatch);
64
+ }, "onClick")
65
+ }, /* @__PURE__ */ React.createElement(NewReleasesIcon, {
66
+ color: "disabled",
67
+ fontSize: "inherit"
68
+ })) : /* @__PURE__ */ React.createElement(IconButton, {
69
+ rel: "noopener noreferrer",
70
+ size: "small",
71
+ target: "_blank",
72
+ href: resolvedSchema?.huri?.href ?? ""
73
+ }, /* @__PURE__ */ React.createElement(VerifiedIcon, {
74
+ color: "success",
75
+ fontSize: "inherit"
76
+ })) : null, value ? /* @__PURE__ */ React.createElement(FlexGrowRow, {
77
+ ref: divRef,
78
+ justifyContent: "space-between"
79
+ }, showLinkNames ? /* @__PURE__ */ React.createElement(LinkEx, {
80
+ display: "block",
81
+ width: "100%",
82
+ sx: {
83
+ cursor: "pointer"
84
+ }
85
+ }, /* @__PURE__ */ React.createElement(PropertyValue, {
86
+ value,
87
+ title: "view schema",
88
+ onClick: /* @__PURE__ */ __name(() => {
89
+ if (!divRef.current) {
90
+ console.warn("divRef.current is null");
91
+ }
92
+ onClick(divDispatch);
93
+ }, "onClick")
94
+ })) : /* @__PURE__ */ React.createElement(PropertyValue, {
95
+ value,
96
+ title: "view schema",
97
+ onClick: /* @__PURE__ */ __name(() => {
98
+ if (!divRef.current) {
99
+ console.warn("divRef.current is null");
100
+ }
101
+ onClick(divDispatch);
102
+ }, "onClick")
103
+ }), showOpenNewWindowLink ? /* @__PURE__ */ React.createElement(IconButton, {
104
+ ref: buttonRef,
105
+ size: "small",
106
+ onClick: /* @__PURE__ */ __name(() => {
107
+ if (!buttonRef.current) {
108
+ console.warn("buttonRef.current is null");
109
+ }
110
+ onClick(buttonDispatch, true);
111
+ }, "onClick")
112
+ }, /* @__PURE__ */ React.createElement(OpenInNewIcon, {
113
+ fontSize: "inherit"
114
+ })) : null) : null);
115
+ }, "SchemaProperty");
131
116
  SchemaProperty.displayName = "SchemaProperty";
132
117
 
133
118
  // src/components/SelectEx/SchemaSelectEx.tsx
134
119
  import { MenuItem, Typography } from "@mui/material";
135
120
  import { SelectEx } from "@xylabs/react-select";
121
+ import React4 from "react";
136
122
 
137
123
  // src/contexts/Schema/Context.ts
138
124
  import { createContextEx } from "@xylabs/react-shared";
@@ -140,7 +126,7 @@ var SchemaContext = createContextEx();
140
126
 
141
127
  // src/contexts/Schema/Provider/Memory.tsx
142
128
  import { exists } from "@xylabs/exists";
143
- import { useMemo as useMemo3, useState as useState5 } from "react";
129
+ import React2, { useMemo as useMemo3, useState as useState5 } from "react";
144
130
 
145
131
  // src/hooks/useGetSchema.tsx
146
132
  import { useAsyncEffect as useAsyncEffect2 } from "@xylabs/react-async-effect";
@@ -148,157 +134,159 @@ import { PayloadBuilder } from "@xyo-network/payload-builder";
148
134
  import { ModuleErrorSchema } from "@xyo-network/payload-model";
149
135
  import { SchemaCache as SchemaCache2 } from "@xyo-network/schema-cache";
150
136
  import { useState as useState2 } from "react";
151
- var useGetSchemaPayload = (schema) => {
137
+ var useGetSchemaPayload = /* @__PURE__ */ __name((schema) => {
152
138
  const [notFound, setNotFound] = useState2(false);
153
139
  const [xyoError, setError] = useState2();
154
140
  const [schemaCacheEntry, setSchemaCacheEntry] = useState2();
155
141
  const [schemaLocal, setSchemaLocal] = useState2();
156
- useAsyncEffect2(
157
- async (mounted) => {
158
- const firstRequest = !notFound && !schemaCacheEntry && !xyoError;
159
- const schemaChanged = schema !== schemaLocal;
160
- if (schema && firstRequest || schema && schemaChanged) {
161
- try {
162
- const schemaCacheEntry2 = await SchemaCache2.instance.get(schema);
163
- if (mounted()) {
164
- setSchemaCacheEntry(schemaCacheEntry2);
165
- setNotFound(schemaCacheEntry2 === null || schemaCacheEntry2 === void 0);
166
- }
167
- } catch (e) {
168
- const error = e;
169
- console.error(e);
170
- if (mounted()) {
171
- setError({
172
- message: error.message,
173
- schema: ModuleErrorSchema,
174
- $sources: []
175
- });
176
- }
142
+ useAsyncEffect2(async (mounted) => {
143
+ const firstRequest = !notFound && !schemaCacheEntry && !xyoError;
144
+ const schemaChanged = schema !== schemaLocal;
145
+ if (schema && firstRequest || schema && schemaChanged) {
146
+ try {
147
+ const schemaCacheEntry2 = await SchemaCache2.instance.get(schema);
148
+ if (mounted()) {
149
+ setSchemaCacheEntry(schemaCacheEntry2);
150
+ setNotFound(schemaCacheEntry2 === null || schemaCacheEntry2 === void 0);
151
+ }
152
+ } catch (e) {
153
+ const error = e;
154
+ console.error(e);
155
+ if (mounted()) {
156
+ setError({
157
+ message: error.message,
158
+ schema: ModuleErrorSchema,
159
+ $sources: []
160
+ });
177
161
  }
178
162
  }
179
- if (schemaChanged) {
180
- setSchemaLocal(schema);
181
- }
182
- },
183
- [xyoError, notFound, schema, schemaLocal, schemaCacheEntry]
184
- );
163
+ }
164
+ if (schemaChanged) {
165
+ setSchemaLocal(schema);
166
+ }
167
+ }, [
168
+ xyoError,
169
+ notFound,
170
+ schema,
171
+ schemaLocal,
172
+ schemaCacheEntry
173
+ ]);
185
174
  return {
186
175
  notFound,
187
176
  schemaHuri: schemaCacheEntry?.huri,
188
177
  schemaPayload: schemaCacheEntry ? new PayloadBuilder(schemaCacheEntry?.payload).fields(schemaCacheEntry.payload).build() : schemaCacheEntry,
189
178
  xyoError
190
179
  };
191
- };
180
+ }, "useGetSchemaPayload");
192
181
 
193
182
  // src/hooks/useSchemaDefinitions.tsx
194
183
  import { useAsyncEffect as useAsyncEffect3 } from "@xylabs/react-async-effect";
195
184
  import { SchemaCache as SchemaCache3 } from "@xyo-network/schema-cache";
196
185
  import { useState as useState3 } from "react";
197
- var useSchemaDefinitions = (schemaList) => {
186
+ var useSchemaDefinitions = /* @__PURE__ */ __name((schemaList) => {
198
187
  const [schemaPayloads, setSchemaPayloads] = useState3();
199
- useAsyncEffect3(
200
- async (mounted) => {
201
- if (schemaList) {
202
- const promiseResults = await Promise.allSettled(schemaList?.map(({ name }) => SchemaCache3.instance.get(name)));
203
- if (mounted()) {
204
- setSchemaPayloads(
205
- promiseResults.map((result) => result.status === "fulfilled" ? result.value?.payload : void 0).filter((item) => item !== void 0 && item !== null)
206
- );
207
- }
188
+ useAsyncEffect3(async (mounted) => {
189
+ if (schemaList) {
190
+ const promiseResults = await Promise.allSettled(schemaList?.map(({ name }) => SchemaCache3.instance.get(name)));
191
+ if (mounted()) {
192
+ setSchemaPayloads(promiseResults.map((result) => result.status === "fulfilled" ? result.value?.payload : void 0).filter((item) => item !== void 0 && item !== null));
208
193
  }
209
- },
210
- [schemaList]
211
- );
194
+ }
195
+ }, [
196
+ schemaList
197
+ ]);
212
198
  return schemaPayloads;
213
- };
199
+ }, "useSchemaDefinitions");
214
200
 
215
201
  // src/hooks/useSchemaList.tsx
216
202
  import { usePromise } from "@xylabs/react-promise";
217
203
  import { SchemaListQuerySchema } from "@xyo-network/diviner-schema-list-model";
218
204
  import { useWeakDivinerFromNode } from "@xyo-network/react-diviner";
219
205
  import { useMemo } from "react";
220
- var useSchemaList = (address, nameOrAddress = "SchemaListDiviner") => {
206
+ var useSchemaList = /* @__PURE__ */ __name((address, nameOrAddress = "SchemaListDiviner") => {
221
207
  const [diviner, divinerError] = useWeakDivinerFromNode(nameOrAddress);
222
- const query = useMemo(
223
- () => address ? [
224
- {
225
- address,
226
- schema: SchemaListQuerySchema
227
- }
228
- ] : void 0,
229
- [address]
230
- );
231
- const [schemaList, error] = usePromise(
232
- async () => {
233
- const divinerInstance = diviner?.deref();
234
- if (divinerInstance) {
235
- const response = await divinerInstance.divine(query);
236
- return response.at(0);
237
- }
238
- },
239
- [diviner, divinerError, query]
240
- );
241
- return [schemaList, error];
242
- };
208
+ const query = useMemo(() => address ? [
209
+ {
210
+ address,
211
+ schema: SchemaListQuerySchema
212
+ }
213
+ ] : void 0, [
214
+ address
215
+ ]);
216
+ const [schemaList, error] = usePromise(async () => {
217
+ const divinerInstance = diviner?.deref();
218
+ if (divinerInstance) {
219
+ const response = await divinerInstance.divine(query);
220
+ return response.at(0);
221
+ }
222
+ }, [
223
+ diviner,
224
+ divinerError,
225
+ query
226
+ ]);
227
+ return [
228
+ schemaList,
229
+ error
230
+ ];
231
+ }, "useSchemaList");
243
232
 
244
233
  // src/hooks/useSchemaStats.tsx
245
234
  import { useAsyncEffect as useAsyncEffect4 } from "@xylabs/react-async-effect";
246
- import {
247
- SchemaStatsDivinerSchema,
248
- SchemaStatsQuerySchema
249
- } from "@xyo-network/diviner-schema-stats-model";
235
+ import { SchemaStatsDivinerSchema, SchemaStatsQuerySchema } from "@xyo-network/diviner-schema-stats-model";
250
236
  import { TYPES } from "@xyo-network/node-core-types";
251
237
  import { isPayloadOfSchemaType } from "@xyo-network/payload-model";
252
238
  import { useWeakDivinerFromNode as useWeakDivinerFromNode2 } from "@xyo-network/react-diviner";
253
239
  import { useMemo as useMemo2, useState as useState4 } from "react";
254
- var useSchemaStats = (statsAddress, nameOrAddress = TYPES.SchemaStatsDiviner) => {
240
+ var useSchemaStats = /* @__PURE__ */ __name((statsAddress, nameOrAddress = TYPES.SchemaStatsDiviner) => {
255
241
  const [refresh, setRefresh] = useState4(1);
256
242
  const [diviner, divinerError] = useWeakDivinerFromNode2(nameOrAddress);
257
243
  const [error, setError] = useState4();
258
- const refreshHistory = () => setRefresh((previous) => previous + 1);
244
+ const refreshHistory = /* @__PURE__ */ __name(() => setRefresh((previous) => previous + 1), "refreshHistory");
259
245
  const [schemaList, setSchemaList] = useState4();
260
- const query = useMemo2(
261
- () => ({
262
- address: statsAddress,
263
- schema: SchemaStatsQuerySchema
264
- }),
265
- [statsAddress]
266
- );
267
- useAsyncEffect4(
268
- async (mounted) => {
269
- const instance = diviner?.deref();
270
- if (instance) {
271
- if (divinerError) {
246
+ const query = useMemo2(() => ({
247
+ address: statsAddress,
248
+ schema: SchemaStatsQuerySchema
249
+ }), [
250
+ statsAddress
251
+ ]);
252
+ useAsyncEffect4(async (mounted) => {
253
+ const instance = diviner?.deref();
254
+ if (instance) {
255
+ if (divinerError) {
256
+ if (mounted()) {
257
+ setError(divinerError);
258
+ setSchemaList(void 0);
259
+ }
260
+ } else {
261
+ try {
262
+ const schemas = (await instance.divine([
263
+ query
264
+ ])).filter(isPayloadOfSchemaType(SchemaStatsDivinerSchema));
272
265
  if (mounted()) {
273
- setError(divinerError);
274
- setSchemaList(void 0);
275
- }
276
- } else {
277
- try {
278
- const schemas = (await instance.divine([query])).filter(isPayloadOfSchemaType(SchemaStatsDivinerSchema));
279
- if (mounted()) {
280
- setSchemaList(schemas);
281
- setError(void 0);
282
- }
283
- } catch (ex) {
284
- setError(ex);
285
- setSchemaList(void 0);
266
+ setSchemaList(schemas);
267
+ setError(void 0);
286
268
  }
269
+ } catch (ex) {
270
+ setError(ex);
271
+ setSchemaList(void 0);
287
272
  }
288
273
  }
289
- },
290
- [diviner, refresh, divinerError, query]
291
- );
292
- return [schemaList, error, refreshHistory];
293
- };
274
+ }
275
+ }, [
276
+ diviner,
277
+ refresh,
278
+ divinerError,
279
+ query
280
+ ]);
281
+ return [
282
+ schemaList,
283
+ error,
284
+ refreshHistory
285
+ ];
286
+ }, "useSchemaStats");
294
287
 
295
288
  // src/contexts/Schema/Provider/Memory.tsx
296
- import { jsx as jsx2 } from "react/jsx-runtime";
297
- var SchemaMemoryProvider = ({
298
- defaultSchema,
299
- knownSchemaList,
300
- ...props
301
- }) => {
289
+ var SchemaMemoryProvider = /* @__PURE__ */ __name(({ defaultSchema, knownSchemaList, ...props }) => {
302
290
  const [schema, setSchema] = useState5(defaultSchema);
303
291
  const [schemaList, setSchemaList] = useState5(knownSchemaList);
304
292
  const [fetchedSchemaStats] = useSchemaStats();
@@ -307,60 +295,63 @@ var SchemaMemoryProvider = ({
307
295
  const schemaList2 = fetchedSchemaStats.map(({ name }) => name).filter(exists);
308
296
  setSchemaList(schemaList2);
309
297
  }
310
- }, [fetchedSchemaStats]);
298
+ }, [
299
+ fetchedSchemaStats
300
+ ]);
311
301
  const value = useMemo3(() => ({
312
302
  provided: true,
313
303
  schema,
314
304
  schemaList: knownSchemaList ?? schemaList,
315
305
  setSchema,
316
306
  setSchemaList
317
- }), [schema, schemaList, knownSchemaList]);
318
- return /* @__PURE__ */ jsx2(SchemaContext, { value, ...props });
319
- };
307
+ }), [
308
+ schema,
309
+ schemaList,
310
+ knownSchemaList
311
+ ]);
312
+ return /* @__PURE__ */ React2.createElement(SchemaContext, {
313
+ value,
314
+ ...props
315
+ });
316
+ }, "SchemaMemoryProvider");
320
317
 
321
318
  // src/contexts/Schema/Provider/Route.tsx
322
- import {
323
- useCallback,
324
- useEffect,
325
- useMemo as useMemo4
326
- } from "react";
319
+ import React3, { useCallback, useEffect, useMemo as useMemo4 } from "react";
327
320
  import { useSearchParams } from "react-router-dom";
328
321
 
329
322
  // src/contexts/Schema/use.ts
330
323
  import { useContextEx } from "@xylabs/react-shared";
331
- var useSchema = (required = false) => {
324
+ var useSchema = /* @__PURE__ */ __name((required = false) => {
332
325
  return useContextEx(SchemaContext, "Schema", required);
333
- };
326
+ }, "useSchema");
334
327
 
335
328
  // src/contexts/Schema/Provider/Route.tsx
336
- import { jsx as jsx3 } from "react/jsx-runtime";
337
- var SchemaRouteProviderInner = ({ children }) => {
338
- const {
339
- schema,
340
- setSchema,
341
- schemaList
342
- } = useSchema();
329
+ var SchemaRouteProviderInner = /* @__PURE__ */ __name(({ children }) => {
330
+ const { schema, setSchema, schemaList } = useSchema();
343
331
  const [params, setParams] = useSearchParams();
344
332
  const routeSchema = params.get("schema");
345
- const setSchemaParam = useCallback(
346
- (schema2) => {
347
- if (schema2) {
348
- params.set("schema", schema2);
349
- setParams(params, { replace: true });
350
- setSchema?.(schema2);
351
- } else {
352
- params.delete("network");
353
- }
354
- },
355
- [params, setParams, setSchema]
356
- );
357
- const setSchemaLocal = useCallback(
358
- (schema2) => {
359
- setSchemaParam(schema2);
333
+ const setSchemaParam = useCallback((schema2) => {
334
+ if (schema2) {
335
+ params.set("schema", schema2);
336
+ setParams(params, {
337
+ replace: true
338
+ });
360
339
  setSchema?.(schema2);
361
- },
362
- [setSchemaParam, setSchema]
363
- );
340
+ } else {
341
+ params.delete("network");
342
+ }
343
+ }, [
344
+ params,
345
+ setParams,
346
+ setSchema
347
+ ]);
348
+ const setSchemaLocal = useCallback((schema2) => {
349
+ setSchemaParam(schema2);
350
+ setSchema?.(schema2);
351
+ }, [
352
+ setSchemaParam,
353
+ setSchema
354
+ ]);
364
355
  useEffect(() => {
365
356
  if (routeSchema !== schema) {
366
357
  if (routeSchema === void 0 && schema !== void 0) {
@@ -369,60 +360,61 @@ var SchemaRouteProviderInner = ({ children }) => {
369
360
  setSchema?.(routeSchema);
370
361
  }
371
362
  }
372
- }, [routeSchema, schema, setSchemaParam, setSchema, setSchemaLocal]);
363
+ }, [
364
+ routeSchema,
365
+ schema,
366
+ setSchemaParam,
367
+ setSchema,
368
+ setSchemaLocal
369
+ ]);
373
370
  const value = useMemo4(() => ({
374
371
  provided: true,
375
372
  schema,
376
373
  schemaList,
377
374
  setSchema: setSchemaLocal
378
- }), [schema, schemaList, setSchemaLocal]);
379
- return /* @__PURE__ */ jsx3(SchemaContext, { value, children });
380
- };
381
- var SchemaRouteProvider = ({
382
- knownSchemaList,
383
- defaultSchema,
384
- ...props
385
- }) => {
386
- return /* @__PURE__ */ jsx3(SchemaMemoryProvider, { knownSchemaList, defaultSchema, children: /* @__PURE__ */ jsx3(SchemaRouteProviderInner, { ...props }) });
387
- };
375
+ }), [
376
+ schema,
377
+ schemaList,
378
+ setSchemaLocal
379
+ ]);
380
+ return /* @__PURE__ */ React3.createElement(SchemaContext, {
381
+ value
382
+ }, children);
383
+ }, "SchemaRouteProviderInner");
384
+ var SchemaRouteProvider = /* @__PURE__ */ __name(({ knownSchemaList, defaultSchema, ...props }) => {
385
+ return /* @__PURE__ */ React3.createElement(SchemaMemoryProvider, {
386
+ knownSchemaList,
387
+ defaultSchema
388
+ }, /* @__PURE__ */ React3.createElement(SchemaRouteProviderInner, props));
389
+ }, "SchemaRouteProvider");
388
390
 
389
391
  // src/components/SelectEx/SchemaSelectEx.tsx
390
- import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
391
- var SchemaSelectEx = ({
392
- onChange,
393
- variant = "outlined",
394
- ...props
395
- }) => {
396
- const {
397
- schema,
398
- setSchema,
399
- schemaList
400
- } = useSchema(false);
401
- return /* @__PURE__ */ jsxs2(
402
- SelectEx,
403
- {
404
- variant,
405
- size: "small",
406
- value: schema ?? "none",
407
- onChange: (event, child) => {
408
- if (event.target.value !== schema) {
409
- onChange?.(event, child);
410
- setSchema?.(event.target.value);
411
- }
412
- },
413
- renderValue: (value) => {
414
- return /* @__PURE__ */ jsx4(Typography, { children: value === "none" ? "- None -" : value });
415
- },
416
- ...props,
417
- children: [
418
- schemaList?.map((schema2, index) => {
419
- return /* @__PURE__ */ jsx4(MenuItem, { value: schema2, children: schema2 }, index);
420
- }),
421
- /* @__PURE__ */ jsx4(MenuItem, { value: "none", children: "- None -" }, "none")
422
- ]
423
- }
424
- );
425
- };
392
+ var SchemaSelectEx = /* @__PURE__ */ __name(({ onChange, variant = "outlined", ...props }) => {
393
+ const { schema, setSchema, schemaList } = useSchema(false);
394
+ return /* @__PURE__ */ React4.createElement(SelectEx, {
395
+ variant,
396
+ size: "small",
397
+ value: schema ?? "none",
398
+ onChange: /* @__PURE__ */ __name((event, child) => {
399
+ if (event.target.value !== schema) {
400
+ onChange?.(event, child);
401
+ setSchema?.(event.target.value);
402
+ }
403
+ }, "onChange"),
404
+ renderValue: /* @__PURE__ */ __name((value) => {
405
+ return /* @__PURE__ */ React4.createElement(Typography, null, value === "none" ? "- None -" : value);
406
+ }, "renderValue"),
407
+ ...props
408
+ }, schemaList?.map((schema2, index) => {
409
+ return /* @__PURE__ */ React4.createElement(MenuItem, {
410
+ key: index,
411
+ value: schema2
412
+ }, schema2);
413
+ }), /* @__PURE__ */ React4.createElement(MenuItem, {
414
+ key: "none",
415
+ value: "none"
416
+ }, "- None -"));
417
+ }, "SchemaSelectEx");
426
418
  export {
427
419
  SchemaContext,
428
420
  SchemaMemoryProvider,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/components/Property/SchemaProperty.tsx","../../src/components/SelectEx/SchemaSelectEx.tsx","../../src/contexts/Schema/Context.ts","../../src/contexts/Schema/Provider/Memory.tsx","../../src/hooks/useGetSchema.tsx","../../src/hooks/useSchemaDefinitions.tsx","../../src/hooks/useSchemaList.tsx","../../src/hooks/useSchemaStats.tsx","../../src/contexts/Schema/Provider/Route.tsx","../../src/contexts/Schema/use.ts"],"sourcesContent":["import {\n NewReleases as NewReleasesIcon, OpenInNew as OpenInNewIcon, Verified as VerifiedIcon,\n} from '@mui/icons-material'\nimport { IconButton } from '@mui/material'\nimport { useAsyncEffect } from '@xylabs/react-async-effect'\nimport { FlexGrowRow } from '@xylabs/react-flexbox'\nimport { LinkEx } from '@xylabs/react-link'\nimport type { EventDispatch, EventNoun } from '@xyo-network/react-event'\nimport { useEvent } from '@xyo-network/react-event'\nimport type { PropertyProps } from '@xyo-network/react-property'\nimport { Property, PropertyValue } from '@xyo-network/react-property'\nimport type { SchemaCacheEntry } from '@xyo-network/schema-cache'\nimport { SchemaCache } from '@xyo-network/schema-cache'\nimport React, { useState } from 'react'\n\nexport type SchemaPropertyProps = PropertyProps & {\n showLinkNames?: boolean\n showOpenNewWindowLink?: boolean\n showStatusIcon?: boolean\n value?: string\n}\n\nconst useResolveSchema = (schema?: string) => {\n const [entry, setEntry] = useState<SchemaCacheEntry | null>()\n useAsyncEffect(\n async (mounted) => {\n if (schema) {\n const entry = await SchemaCache.instance.get(schema)\n if (mounted()) {\n setEntry(entry)\n }\n }\n },\n [schema],\n )\n return entry\n}\n\nexport const SchemaProperty: React.FC<SchemaPropertyProps> = ({\n showLinkNames = true, showOpenNewWindowLink = true, showStatusIcon = true, titleProps, value, ...props\n}) => {\n const resolvedSchema = useResolveSchema(value)\n const [buttonRef, buttonDispatch] = useEvent<HTMLButtonElement>()\n const [divRef, divDispatch] = useEvent<HTMLDivElement>()\n\n const onClick = (dispatch?: EventDispatch<EventNoun, 'click', string>, openNewWindow = false) => {\n dispatch?.(\n 'schema',\n 'click',\n JSON.stringify({\n openNewWindow,\n schema: value,\n }),\n )\n }\n\n return (\n <Property title=\"Schema\" value={value} tip=\"Schema sent with the payload\" titleProps={titleProps} {...props}>\n {value && showStatusIcon\n ? resolvedSchema === null\n ? (\n <IconButton\n ref={buttonRef}\n size=\"small\"\n onClick={() => {\n if (!buttonRef.current) {\n console.warn('buttonRef.current is null')\n }\n onClick(buttonDispatch)\n }}\n >\n <NewReleasesIcon color=\"warning\" fontSize=\"inherit\" />\n </IconButton>\n )\n : resolvedSchema === undefined\n ? (\n <IconButton\n ref={buttonRef}\n size=\"small\"\n onClick={() => {\n if (!buttonRef.current) {\n console.warn('buttonRef.current is null')\n }\n onClick(buttonDispatch)\n }}\n >\n <NewReleasesIcon color=\"disabled\" fontSize=\"inherit\" />\n </IconButton>\n )\n : (\n <IconButton rel=\"noopener noreferrer\" size=\"small\" target=\"_blank\" href={resolvedSchema?.huri?.href ?? ''}>\n <VerifiedIcon color=\"success\" fontSize=\"inherit\" />\n </IconButton>\n )\n\n : null}\n {value\n ? (\n <FlexGrowRow ref={divRef} justifyContent=\"space-between\">\n {showLinkNames\n ? (\n <LinkEx\n display=\"block\"\n width=\"100%\"\n sx={{ cursor: 'pointer' }}\n >\n <PropertyValue\n value={value}\n title=\"view schema\"\n onClick={() => {\n if (!divRef.current) {\n console.warn('divRef.current is null')\n }\n onClick(divDispatch)\n }}\n />\n </LinkEx>\n )\n : (\n <PropertyValue\n value={value}\n title=\"view schema\"\n onClick={() => {\n if (!divRef.current) {\n console.warn('divRef.current is null')\n }\n onClick(divDispatch)\n }}\n />\n )}\n {showOpenNewWindowLink\n ? (\n <IconButton\n ref={buttonRef}\n size=\"small\"\n onClick={() => {\n if (!buttonRef.current) {\n console.warn('buttonRef.current is null')\n }\n onClick(buttonDispatch, true)\n }}\n >\n <OpenInNewIcon fontSize=\"inherit\" />\n </IconButton>\n )\n : null}\n </FlexGrowRow>\n )\n : null}\n </Property>\n )\n}\n\nSchemaProperty.displayName = 'SchemaProperty'\n","import { MenuItem, Typography } from '@mui/material'\nimport type { SelectExProps } from '@xylabs/react-select'\nimport { SelectEx } from '@xylabs/react-select'\nimport React from 'react'\n\nimport { useSchema } from '../../contexts/index.ts'\n\nexport type SchemaSelectExProps = SelectExProps<string>\n\nexport const SchemaSelectEx: React.FC<SchemaSelectExProps> = ({\n onChange, variant = 'outlined', ...props\n}) => {\n const {\n schema, setSchema, schemaList,\n } = useSchema(false)\n\n return (\n <SelectEx\n variant={variant}\n size=\"small\"\n value={schema ?? 'none'}\n onChange={(event, child) => {\n if (event.target.value !== schema) {\n onChange?.(event, child)\n setSchema?.(event.target.value)\n }\n }}\n renderValue={(value) => {\n return <Typography>{value === 'none' ? '- None -' : value}</Typography>\n }}\n {...props}\n >\n {schemaList?.map((schema, index) => {\n return (\n <MenuItem key={index} value={schema}>\n {schema}\n </MenuItem>\n )\n })}\n <MenuItem key=\"none\" value=\"none\">\n - None -\n </MenuItem>\n </SelectEx>\n )\n}\n","import { createContextEx } from '@xylabs/react-shared'\n\nimport type { SchemaContextState } from './State.ts'\n\nexport const SchemaContext = createContextEx<SchemaContextState>()\n","import { exists } from '@xylabs/exists'\nimport type { PropsWithChildren } from 'react'\nimport React, { useMemo, useState } from 'react'\n\nimport { useSchemaStats } from '../../../hooks/index.ts'\nimport { SchemaContext } from '../Context.ts'\nimport type { SchemaContextState } from '../State.ts'\nimport type { SchemaProviderProps } from './Props.ts'\n\nexport const SchemaMemoryProvider: React.FC<PropsWithChildren<SchemaProviderProps>> = ({\n defaultSchema, knownSchemaList, ...props\n}) => {\n const [schema, setSchema] = useState(defaultSchema)\n const [schemaList, setSchemaList] = useState<string[] | undefined>(knownSchemaList)\n const [fetchedSchemaStats] = useSchemaStats()\n\n useMemo(() => {\n if (fetchedSchemaStats) {\n const schemaList = (fetchedSchemaStats.map(({ name }) => name)).filter(exists)\n setSchemaList(schemaList)\n }\n }, [fetchedSchemaStats])\n\n const value: SchemaContextState = useMemo(() => ({\n provided: true, schema, schemaList: knownSchemaList ?? schemaList, setSchema, setSchemaList,\n }), [schema, schemaList, knownSchemaList])\n\n return <SchemaContext value={value} {...props} />\n}\n","import { useAsyncEffect } from '@xylabs/react-async-effect'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport type { ModuleError, WithSources } from '@xyo-network/payload-model'\nimport { ModuleErrorSchema } from '@xyo-network/payload-model'\nimport type { SchemaCacheEntry } from '@xyo-network/schema-cache'\nimport { SchemaCache } from '@xyo-network/schema-cache'\nimport type { SchemaPayload } from '@xyo-network/schema-payload-plugin'\nimport { useState } from 'react'\n\n/**\n * Gets a Huri and schema payload from a schema string\n */\nconst useGetSchemaPayload = (schema?: string) => {\n const [notFound, setNotFound] = useState(false)\n const [xyoError, setError] = useState<WithSources<ModuleError>>()\n const [schemaCacheEntry, setSchemaCacheEntry] = useState<SchemaCacheEntry | null | undefined>()\n const [schemaLocal, setSchemaLocal] = useState<string>()\n\n useAsyncEffect(\n async (mounted) => {\n const firstRequest = !notFound && !schemaCacheEntry && !xyoError\n const schemaChanged = schema !== schemaLocal\n\n if ((schema && firstRequest) || (schema && schemaChanged)) {\n try {\n const schemaCacheEntry = await SchemaCache.instance.get(schema)\n if (mounted()) {\n setSchemaCacheEntry(schemaCacheEntry)\n setNotFound(schemaCacheEntry === null || schemaCacheEntry === undefined)\n }\n } catch (e) {\n const error = e as Error\n console.error(e)\n if (mounted()) {\n setError({\n message: error.message, schema: ModuleErrorSchema, $sources: [],\n })\n }\n }\n }\n if (schemaChanged) {\n setSchemaLocal(schema)\n }\n },\n [xyoError, notFound, schema, schemaLocal, schemaCacheEntry],\n )\n\n return {\n notFound,\n schemaHuri: schemaCacheEntry?.huri,\n schemaPayload:\n schemaCacheEntry ? new PayloadBuilder<SchemaPayload>(schemaCacheEntry?.payload).fields(schemaCacheEntry.payload).build() : schemaCacheEntry,\n xyoError,\n }\n}\n\nexport { useGetSchemaPayload }\n","import { useAsyncEffect } from '@xylabs/react-async-effect'\nimport { SchemaCache } from '@xyo-network/schema-cache'\nimport type { SchemaPayload } from '@xyo-network/schema-payload-plugin'\nimport { useState } from 'react'\n\nexport type SchemaList = { name: string }\n\nexport const useSchemaDefinitions = (schemaList?: SchemaList[]): SchemaPayload[] | undefined => {\n const [schemaPayloads, setSchemaPayloads] = useState<SchemaPayload[]>()\n useAsyncEffect(\n async (mounted) => {\n if (schemaList) {\n const promiseResults = await Promise.allSettled(schemaList?.map(({ name }) => SchemaCache.instance.get(name)))\n if (mounted()) {\n setSchemaPayloads(\n promiseResults\n .map(result => (result.status === 'fulfilled' ? result.value?.payload : undefined))\n .filter(item => item !== undefined && item !== null) as SchemaPayload[],\n )\n }\n }\n },\n [schemaList],\n )\n return schemaPayloads\n}\n","import type { Address } from '@xylabs/hex'\nimport { usePromise } from '@xylabs/react-promise'\nimport type { SchemaListPayload, SchemaListQueryPayload } from '@xyo-network/diviner-schema-list-model'\nimport { SchemaListQuerySchema } from '@xyo-network/diviner-schema-list-model'\nimport { useWeakDivinerFromNode } from '@xyo-network/react-diviner'\nimport { useMemo } from 'react'\n\nexport const useSchemaList = (address?: Address, nameOrAddress = 'SchemaListDiviner'): [SchemaListPayload | null | undefined, Error | undefined] => {\n const [diviner, divinerError] = useWeakDivinerFromNode(nameOrAddress)\n\n const query: SchemaListQueryPayload[] | undefined = useMemo(\n () =>\n address\n ? [\n {\n address,\n schema: SchemaListQuerySchema,\n },\n ]\n : undefined,\n [address],\n )\n\n const [schemaList, error] = usePromise(\n async () => {\n const divinerInstance = diviner?.deref()\n if (divinerInstance) {\n const response = (await divinerInstance.divine(query)) as SchemaListPayload[]\n return response.at(0)\n }\n },\n [diviner, divinerError, query],\n )\n return [schemaList, error]\n}\n","import type { Address } from '@xylabs/hex'\nimport { useAsyncEffect } from '@xylabs/react-async-effect'\nimport type {\n SchemaStatsPayload,\n SchemaStatsQueryPayload,\n} from '@xyo-network/diviner-schema-stats-model'\nimport {\n SchemaStatsDivinerSchema,\n SchemaStatsQuerySchema,\n} from '@xyo-network/diviner-schema-stats-model'\nimport { TYPES } from '@xyo-network/node-core-types'\nimport type { WithSources } from '@xyo-network/payload-model'\nimport { isPayloadOfSchemaType } from '@xyo-network/payload-model'\nimport { useWeakDivinerFromNode } from '@xyo-network/react-diviner'\nimport type { Dispatch, SetStateAction } from 'react'\nimport { useMemo, useState } from 'react'\n\nexport const useSchemaStats = (\n statsAddress?: Address,\n nameOrAddress = TYPES.SchemaStatsDiviner,\n): [SchemaStatsPayload[] | undefined, Error | undefined, Dispatch<SetStateAction<number>>] => {\n const [refresh, setRefresh] = useState(1)\n const [diviner, divinerError] = useWeakDivinerFromNode(nameOrAddress)\n const [error, setError] = useState<Error>()\n const refreshHistory = () => setRefresh(previous => previous + 1)\n\n const [schemaList, setSchemaList] = useState<WithSources<SchemaStatsPayload>[]>()\n\n const query: SchemaStatsQueryPayload = useMemo(\n () => ({\n address: statsAddress,\n schema: SchemaStatsQuerySchema,\n }),\n [statsAddress],\n )\n\n useAsyncEffect(\n async (mounted) => {\n const instance = diviner?.deref()\n if (instance) {\n if (divinerError) {\n if (mounted()) {\n setError(divinerError)\n setSchemaList(undefined)\n }\n } else {\n try {\n const schemas = (await instance.divine([query])).filter(isPayloadOfSchemaType(SchemaStatsDivinerSchema)) as WithSources<\n SchemaStatsPayload\n >[]\n if (mounted()) {\n setSchemaList(schemas)\n setError(undefined)\n }\n } catch (ex) {\n setError(ex as Error)\n setSchemaList(undefined)\n }\n }\n }\n },\n [diviner, refresh, divinerError, query],\n )\n\n return [schemaList, error, refreshHistory]\n}\n","import type { PropsWithChildren } from 'react'\nimport React, {\n useCallback, useEffect, useMemo,\n} from 'react'\nimport { useSearchParams } from 'react-router-dom'\n\nimport { SchemaContext } from '../Context.ts'\nimport type { SchemaContextState } from '../State.ts'\nimport { useSchema } from '../use.ts'\nimport { SchemaMemoryProvider } from './Memory.tsx'\nimport type { SchemaProviderProps } from './Props.ts'\n\nconst SchemaRouteProviderInner: React.FC<PropsWithChildren> = ({ children }) => {\n const {\n schema, setSchema, schemaList,\n } = useSchema()\n\n const [params, setParams] = useSearchParams()\n\n const routeSchema = params.get('schema')\n\n // update the network stored in the route\n const setSchemaParam = useCallback(\n (schema?: string) => {\n if (schema) {\n params.set('schema', schema)\n setParams(params, { replace: true })\n setSchema?.(schema)\n } else {\n params.delete('network')\n }\n },\n [params, setParams, setSchema],\n )\n\n // if the network is actively changed, update both memory and route\n const setSchemaLocal = useCallback(\n (schema: string) => {\n setSchemaParam(schema)\n setSchema?.(schema)\n },\n [setSchemaParam, setSchema],\n )\n\n // sync memory and route storage of network\n useEffect(() => {\n if (routeSchema !== schema) {\n if (routeSchema === undefined && schema !== undefined) {\n // if the route does not have a network selected, use what is in the memory context\n setSchemaLocal(schema)\n } else if (routeSchema) {\n // if the route has a selection and it is different from memory, update memory\n setSchema?.(routeSchema)\n }\n }\n }, [routeSchema, schema, setSchemaParam, setSchema, setSchemaLocal])\n\n const value: SchemaContextState = useMemo(() => ({\n provided: true, schema, schemaList, setSchema: setSchemaLocal,\n }), [schema, schemaList, setSchemaLocal])\n\n return <SchemaContext value={value}>{children}</SchemaContext>\n}\n\nexport const SchemaRouteProvider: React.FC<PropsWithChildren<SchemaProviderProps>> = ({\n knownSchemaList, defaultSchema, ...props\n}) => {\n return (\n <SchemaMemoryProvider knownSchemaList={knownSchemaList} defaultSchema={defaultSchema}>\n <SchemaRouteProviderInner {...props} />\n </SchemaMemoryProvider>\n )\n}\n","import { useContextEx } from '@xylabs/react-shared'\n\nimport { SchemaContext } from './Context.ts'\nimport type { SchemaContextState } from './State.ts'\n\nexport const useSchema = (required = false) => {\n return useContextEx<SchemaContextState>(SchemaContext, 'Schema', required)\n}\n"],"mappings":";AAAA;AAAA,EACE,eAAe;AAAA,EAAiB,aAAa;AAAA,EAAe,YAAY;AAAA,OACnE;AACP,SAAS,kBAAkB;AAC3B,SAAS,sBAAsB;AAC/B,SAAS,mBAAmB;AAC5B,SAAS,cAAc;AAEvB,SAAS,gBAAgB;AAEzB,SAAS,UAAU,qBAAqB;AAExC,SAAS,mBAAmB;AAC5B,SAAgB,gBAAgB;AA0DhB,cA2BJ,YA3BI;AAjDhB,IAAM,mBAAmB,CAAC,WAAoB;AAC5C,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAkC;AAC5D;AAAA,IACE,OAAO,YAAY;AACjB,UAAI,QAAQ;AACV,cAAMA,SAAQ,MAAM,YAAY,SAAS,IAAI,MAAM;AACnD,YAAI,QAAQ,GAAG;AACb,mBAASA,MAAK;AAAA,QAChB;AAAA,MACF;AAAA,IACF;AAAA,IACA,CAAC,MAAM;AAAA,EACT;AACA,SAAO;AACT;AAEO,IAAM,iBAAgD,CAAC;AAAA,EAC5D,gBAAgB;AAAA,EAAM,wBAAwB;AAAA,EAAM,iBAAiB;AAAA,EAAM;AAAA,EAAY;AAAA,EAAO,GAAG;AACnG,MAA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useMemo","useState","useAsyncEffect","SchemaCache","useState","schemaCacheEntry","useAsyncEffect","SchemaCache","useState","useAsyncEffect","useWeakDivinerFromNode","useMemo","useState","jsx","useState","useMemo","schemaList","useMemo","jsx","schema","useMemo","jsx","jsxs","schema"]}
1
+ {"version":3,"sources":["../../src/components/Property/SchemaProperty.tsx","../../src/components/SelectEx/SchemaSelectEx.tsx","../../src/contexts/Schema/Context.ts","../../src/contexts/Schema/Provider/Memory.tsx","../../src/hooks/useGetSchema.tsx","../../src/hooks/useSchemaDefinitions.tsx","../../src/hooks/useSchemaList.tsx","../../src/hooks/useSchemaStats.tsx","../../src/contexts/Schema/Provider/Route.tsx","../../src/contexts/Schema/use.ts"],"sourcesContent":["import {\n NewReleases as NewReleasesIcon, OpenInNew as OpenInNewIcon, Verified as VerifiedIcon,\n} from '@mui/icons-material'\nimport { IconButton } from '@mui/material'\nimport { useAsyncEffect } from '@xylabs/react-async-effect'\nimport { FlexGrowRow } from '@xylabs/react-flexbox'\nimport { LinkEx } from '@xylabs/react-link'\nimport type { EventDispatch, EventNoun } from '@xyo-network/react-event'\nimport { useEvent } from '@xyo-network/react-event'\nimport type { PropertyProps } from '@xyo-network/react-property'\nimport { Property, PropertyValue } from '@xyo-network/react-property'\nimport type { SchemaCacheEntry } from '@xyo-network/schema-cache'\nimport { SchemaCache } from '@xyo-network/schema-cache'\nimport React, { useState } from 'react'\n\nexport type SchemaPropertyProps = PropertyProps & {\n showLinkNames?: boolean\n showOpenNewWindowLink?: boolean\n showStatusIcon?: boolean\n value?: string\n}\n\nconst useResolveSchema = (schema?: string) => {\n const [entry, setEntry] = useState<SchemaCacheEntry | null>()\n useAsyncEffect(\n async (mounted) => {\n if (schema) {\n const entry = await SchemaCache.instance.get(schema)\n if (mounted()) {\n setEntry(entry)\n }\n }\n },\n [schema],\n )\n return entry\n}\n\nexport const SchemaProperty: React.FC<SchemaPropertyProps> = ({\n showLinkNames = true, showOpenNewWindowLink = true, showStatusIcon = true, titleProps, value, ...props\n}) => {\n const resolvedSchema = useResolveSchema(value)\n const [buttonRef, buttonDispatch] = useEvent<HTMLButtonElement>()\n const [divRef, divDispatch] = useEvent<HTMLDivElement>()\n\n const onClick = (dispatch?: EventDispatch<EventNoun, 'click', string>, openNewWindow = false) => {\n dispatch?.(\n 'schema',\n 'click',\n JSON.stringify({\n openNewWindow,\n schema: value,\n }),\n )\n }\n\n return (\n <Property title=\"Schema\" value={value} tip=\"Schema sent with the payload\" titleProps={titleProps} {...props}>\n {value && showStatusIcon\n ? resolvedSchema === null\n ? (\n <IconButton\n ref={buttonRef}\n size=\"small\"\n onClick={() => {\n if (!buttonRef.current) {\n console.warn('buttonRef.current is null')\n }\n onClick(buttonDispatch)\n }}\n >\n <NewReleasesIcon color=\"warning\" fontSize=\"inherit\" />\n </IconButton>\n )\n : resolvedSchema === undefined\n ? (\n <IconButton\n ref={buttonRef}\n size=\"small\"\n onClick={() => {\n if (!buttonRef.current) {\n console.warn('buttonRef.current is null')\n }\n onClick(buttonDispatch)\n }}\n >\n <NewReleasesIcon color=\"disabled\" fontSize=\"inherit\" />\n </IconButton>\n )\n : (\n <IconButton rel=\"noopener noreferrer\" size=\"small\" target=\"_blank\" href={resolvedSchema?.huri?.href ?? ''}>\n <VerifiedIcon color=\"success\" fontSize=\"inherit\" />\n </IconButton>\n )\n\n : null}\n {value\n ? (\n <FlexGrowRow ref={divRef} justifyContent=\"space-between\">\n {showLinkNames\n ? (\n <LinkEx\n display=\"block\"\n width=\"100%\"\n sx={{ cursor: 'pointer' }}\n >\n <PropertyValue\n value={value}\n title=\"view schema\"\n onClick={() => {\n if (!divRef.current) {\n console.warn('divRef.current is null')\n }\n onClick(divDispatch)\n }}\n />\n </LinkEx>\n )\n : (\n <PropertyValue\n value={value}\n title=\"view schema\"\n onClick={() => {\n if (!divRef.current) {\n console.warn('divRef.current is null')\n }\n onClick(divDispatch)\n }}\n />\n )}\n {showOpenNewWindowLink\n ? (\n <IconButton\n ref={buttonRef}\n size=\"small\"\n onClick={() => {\n if (!buttonRef.current) {\n console.warn('buttonRef.current is null')\n }\n onClick(buttonDispatch, true)\n }}\n >\n <OpenInNewIcon fontSize=\"inherit\" />\n </IconButton>\n )\n : null}\n </FlexGrowRow>\n )\n : null}\n </Property>\n )\n}\n\nSchemaProperty.displayName = 'SchemaProperty'\n","import { MenuItem, Typography } from '@mui/material'\nimport type { SelectExProps } from '@xylabs/react-select'\nimport { SelectEx } from '@xylabs/react-select'\nimport React from 'react'\n\nimport { useSchema } from '../../contexts/index.ts'\n\nexport type SchemaSelectExProps = SelectExProps<string>\n\nexport const SchemaSelectEx: React.FC<SchemaSelectExProps> = ({\n onChange, variant = 'outlined', ...props\n}) => {\n const {\n schema, setSchema, schemaList,\n } = useSchema(false)\n\n return (\n <SelectEx\n variant={variant}\n size=\"small\"\n value={schema ?? 'none'}\n onChange={(event, child) => {\n if (event.target.value !== schema) {\n onChange?.(event, child)\n setSchema?.(event.target.value)\n }\n }}\n renderValue={(value) => {\n return <Typography>{value === 'none' ? '- None -' : value}</Typography>\n }}\n {...props}\n >\n {schemaList?.map((schema, index) => {\n return (\n <MenuItem key={index} value={schema}>\n {schema}\n </MenuItem>\n )\n })}\n <MenuItem key=\"none\" value=\"none\">\n - None -\n </MenuItem>\n </SelectEx>\n )\n}\n","import { createContextEx } from '@xylabs/react-shared'\n\nimport type { SchemaContextState } from './State.ts'\n\nexport const SchemaContext = createContextEx<SchemaContextState>()\n","import { exists } from '@xylabs/exists'\nimport type { PropsWithChildren } from 'react'\nimport React, { useMemo, useState } from 'react'\n\nimport { useSchemaStats } from '../../../hooks/index.ts'\nimport { SchemaContext } from '../Context.ts'\nimport type { SchemaContextState } from '../State.ts'\nimport type { SchemaProviderProps } from './Props.ts'\n\nexport const SchemaMemoryProvider: React.FC<PropsWithChildren<SchemaProviderProps>> = ({\n defaultSchema, knownSchemaList, ...props\n}) => {\n const [schema, setSchema] = useState(defaultSchema)\n const [schemaList, setSchemaList] = useState<string[] | undefined>(knownSchemaList)\n const [fetchedSchemaStats] = useSchemaStats()\n\n useMemo(() => {\n if (fetchedSchemaStats) {\n const schemaList = (fetchedSchemaStats.map(({ name }) => name)).filter(exists)\n setSchemaList(schemaList)\n }\n }, [fetchedSchemaStats])\n\n const value: SchemaContextState = useMemo(() => ({\n provided: true, schema, schemaList: knownSchemaList ?? schemaList, setSchema, setSchemaList,\n }), [schema, schemaList, knownSchemaList])\n\n return <SchemaContext value={value} {...props} />\n}\n","import { useAsyncEffect } from '@xylabs/react-async-effect'\nimport { PayloadBuilder } from '@xyo-network/payload-builder'\nimport type { ModuleError, WithSources } from '@xyo-network/payload-model'\nimport { ModuleErrorSchema } from '@xyo-network/payload-model'\nimport type { SchemaCacheEntry } from '@xyo-network/schema-cache'\nimport { SchemaCache } from '@xyo-network/schema-cache'\nimport type { SchemaPayload } from '@xyo-network/schema-payload-plugin'\nimport { useState } from 'react'\n\n/**\n * Gets a Huri and schema payload from a schema string\n */\nconst useGetSchemaPayload = (schema?: string) => {\n const [notFound, setNotFound] = useState(false)\n const [xyoError, setError] = useState<WithSources<ModuleError>>()\n const [schemaCacheEntry, setSchemaCacheEntry] = useState<SchemaCacheEntry | null | undefined>()\n const [schemaLocal, setSchemaLocal] = useState<string>()\n\n useAsyncEffect(\n async (mounted) => {\n const firstRequest = !notFound && !schemaCacheEntry && !xyoError\n const schemaChanged = schema !== schemaLocal\n\n if ((schema && firstRequest) || (schema && schemaChanged)) {\n try {\n const schemaCacheEntry = await SchemaCache.instance.get(schema)\n if (mounted()) {\n setSchemaCacheEntry(schemaCacheEntry)\n setNotFound(schemaCacheEntry === null || schemaCacheEntry === undefined)\n }\n } catch (e) {\n const error = e as Error\n console.error(e)\n if (mounted()) {\n setError({\n message: error.message, schema: ModuleErrorSchema, $sources: [],\n })\n }\n }\n }\n if (schemaChanged) {\n setSchemaLocal(schema)\n }\n },\n [xyoError, notFound, schema, schemaLocal, schemaCacheEntry],\n )\n\n return {\n notFound,\n schemaHuri: schemaCacheEntry?.huri,\n schemaPayload:\n schemaCacheEntry ? new PayloadBuilder<SchemaPayload>(schemaCacheEntry?.payload).fields(schemaCacheEntry.payload).build() : schemaCacheEntry,\n xyoError,\n }\n}\n\nexport { useGetSchemaPayload }\n","import { useAsyncEffect } from '@xylabs/react-async-effect'\nimport { SchemaCache } from '@xyo-network/schema-cache'\nimport type { SchemaPayload } from '@xyo-network/schema-payload-plugin'\nimport { useState } from 'react'\n\nexport type SchemaList = { name: string }\n\nexport const useSchemaDefinitions = (schemaList?: SchemaList[]): SchemaPayload[] | undefined => {\n const [schemaPayloads, setSchemaPayloads] = useState<SchemaPayload[]>()\n useAsyncEffect(\n async (mounted) => {\n if (schemaList) {\n const promiseResults = await Promise.allSettled(schemaList?.map(({ name }) => SchemaCache.instance.get(name)))\n if (mounted()) {\n setSchemaPayloads(\n promiseResults\n .map(result => (result.status === 'fulfilled' ? result.value?.payload : undefined))\n .filter(item => item !== undefined && item !== null) as SchemaPayload[],\n )\n }\n }\n },\n [schemaList],\n )\n return schemaPayloads\n}\n","import { usePromise } from '@xylabs/react-promise'\nimport type { Address } from '@xylabs/sdk-js'\nimport type { SchemaListPayload, SchemaListQueryPayload } from '@xyo-network/diviner-schema-list-model'\nimport { SchemaListQuerySchema } from '@xyo-network/diviner-schema-list-model'\nimport { useWeakDivinerFromNode } from '@xyo-network/react-diviner'\nimport { useMemo } from 'react'\n\nexport const useSchemaList = (address?: Address, nameOrAddress = 'SchemaListDiviner'): [SchemaListPayload | null | undefined, Error | undefined] => {\n const [diviner, divinerError] = useWeakDivinerFromNode(nameOrAddress)\n\n const query: SchemaListQueryPayload[] | undefined = useMemo(\n () =>\n address\n ? [\n {\n address,\n schema: SchemaListQuerySchema,\n },\n ]\n : undefined,\n [address],\n )\n\n const [schemaList, error] = usePromise(\n async () => {\n const divinerInstance = diviner?.deref()\n if (divinerInstance) {\n const response = (await divinerInstance.divine(query)) as SchemaListPayload[]\n return response.at(0)\n }\n },\n [diviner, divinerError, query],\n )\n return [schemaList, error]\n}\n","import { useAsyncEffect } from '@xylabs/react-async-effect'\nimport type { Address } from '@xylabs/sdk-js'\nimport type {\n SchemaStatsPayload,\n SchemaStatsQueryPayload,\n} from '@xyo-network/diviner-schema-stats-model'\nimport {\n SchemaStatsDivinerSchema,\n SchemaStatsQuerySchema,\n} from '@xyo-network/diviner-schema-stats-model'\nimport { TYPES } from '@xyo-network/node-core-types'\nimport type { WithSources } from '@xyo-network/payload-model'\nimport { isPayloadOfSchemaType } from '@xyo-network/payload-model'\nimport { useWeakDivinerFromNode } from '@xyo-network/react-diviner'\nimport type { Dispatch, SetStateAction } from 'react'\nimport { useMemo, useState } from 'react'\n\nexport const useSchemaStats = (\n statsAddress?: Address,\n nameOrAddress = TYPES.SchemaStatsDiviner,\n): [SchemaStatsPayload[] | undefined, Error | undefined, Dispatch<SetStateAction<number>>] => {\n const [refresh, setRefresh] = useState(1)\n const [diviner, divinerError] = useWeakDivinerFromNode(nameOrAddress)\n const [error, setError] = useState<Error>()\n const refreshHistory = () => setRefresh(previous => previous + 1)\n\n const [schemaList, setSchemaList] = useState<WithSources<SchemaStatsPayload>[]>()\n\n const query: SchemaStatsQueryPayload = useMemo(\n () => ({\n address: statsAddress,\n schema: SchemaStatsQuerySchema,\n }),\n [statsAddress],\n )\n\n useAsyncEffect(\n async (mounted) => {\n const instance = diviner?.deref()\n if (instance) {\n if (divinerError) {\n if (mounted()) {\n setError(divinerError)\n setSchemaList(undefined)\n }\n } else {\n try {\n const schemas = (await instance.divine([query])).filter(isPayloadOfSchemaType(SchemaStatsDivinerSchema)) as WithSources<\n SchemaStatsPayload\n >[]\n if (mounted()) {\n setSchemaList(schemas)\n setError(undefined)\n }\n } catch (ex) {\n setError(ex as Error)\n setSchemaList(undefined)\n }\n }\n }\n },\n [diviner, refresh, divinerError, query],\n )\n\n return [schemaList, error, refreshHistory]\n}\n","import type { PropsWithChildren } from 'react'\nimport React, {\n useCallback, useEffect, useMemo,\n} from 'react'\nimport { useSearchParams } from 'react-router-dom'\n\nimport { SchemaContext } from '../Context.ts'\nimport type { SchemaContextState } from '../State.ts'\nimport { useSchema } from '../use.ts'\nimport { SchemaMemoryProvider } from './Memory.tsx'\nimport type { SchemaProviderProps } from './Props.ts'\n\nconst SchemaRouteProviderInner: React.FC<PropsWithChildren> = ({ children }) => {\n const {\n schema, setSchema, schemaList,\n } = useSchema()\n\n const [params, setParams] = useSearchParams()\n\n const routeSchema = params.get('schema')\n\n // update the network stored in the route\n const setSchemaParam = useCallback(\n (schema?: string) => {\n if (schema) {\n params.set('schema', schema)\n setParams(params, { replace: true })\n setSchema?.(schema)\n } else {\n params.delete('network')\n }\n },\n [params, setParams, setSchema],\n )\n\n // if the network is actively changed, update both memory and route\n const setSchemaLocal = useCallback(\n (schema: string) => {\n setSchemaParam(schema)\n setSchema?.(schema)\n },\n [setSchemaParam, setSchema],\n )\n\n // sync memory and route storage of network\n useEffect(() => {\n if (routeSchema !== schema) {\n if (routeSchema === undefined && schema !== undefined) {\n // if the route does not have a network selected, use what is in the memory context\n setSchemaLocal(schema)\n } else if (routeSchema) {\n // if the route has a selection and it is different from memory, update memory\n setSchema?.(routeSchema)\n }\n }\n }, [routeSchema, schema, setSchemaParam, setSchema, setSchemaLocal])\n\n const value: SchemaContextState = useMemo(() => ({\n provided: true, schema, schemaList, setSchema: setSchemaLocal,\n }), [schema, schemaList, setSchemaLocal])\n\n return <SchemaContext value={value}>{children}</SchemaContext>\n}\n\nexport const SchemaRouteProvider: React.FC<PropsWithChildren<SchemaProviderProps>> = ({\n knownSchemaList, defaultSchema, ...props\n}) => {\n return (\n <SchemaMemoryProvider knownSchemaList={knownSchemaList} defaultSchema={defaultSchema}>\n <SchemaRouteProviderInner {...props} />\n </SchemaMemoryProvider>\n )\n}\n","import { useContextEx } from '@xylabs/react-shared'\n\nimport { SchemaContext } from './Context.ts'\nimport type { SchemaContextState } from './State.ts'\n\nexport const useSchema = (required = false) => {\n return useContextEx<SchemaContextState>(SchemaContext, 'Schema', required)\n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S,aAAaA,KAAAA;IACtD,GAFa;IAGZ,GAAGR;KAEHG,YAAYW,IAAI,CAACb,SAAQc,UAAAA;AACxB,WACE,gBAAAV,OAAA,cAACW,UAAAA;MAASC,KAAKF;MAAOP,OAAOP;OAC1BA,OAAAA;EAGP,CAAA,GACA,gBAAAI,OAAA,cAACW,UAAAA;IAASC,KAAI;IAAOT,OAAM;KAAO,UAAA,CAAA;AAKxC,GAnC6D;","names":["NewReleases","NewReleasesIcon","OpenInNew","OpenInNewIcon","Verified","VerifiedIcon","IconButton","useAsyncEffect","FlexGrowRow","LinkEx","useEvent","Property","PropertyValue","SchemaCache","React","useState","useResolveSchema","schema","entry","setEntry","useState","useAsyncEffect","mounted","SchemaCache","instance","get","SchemaProperty","showLinkNames","showOpenNewWindowLink","showStatusIcon","titleProps","value","props","resolvedSchema","buttonRef","buttonDispatch","useEvent","divRef","divDispatch","onClick","dispatch","openNewWindow","JSON","stringify","Property","title","tip","IconButton","ref","size","current","console","warn","NewReleasesIcon","color","fontSize","undefined","rel","target","href","huri","VerifiedIcon","FlexGrowRow","justifyContent","LinkEx","display","width","sx","cursor","PropertyValue","OpenInNewIcon","displayName","MenuItem","Typography","SelectEx","React","createContextEx","SchemaContext","exists","React","useMemo","useState","useAsyncEffect","PayloadBuilder","ModuleErrorSchema","SchemaCache","useState","useGetSchemaPayload","schema","notFound","setNotFound","useState","xyoError","setError","schemaCacheEntry","setSchemaCacheEntry","schemaLocal","setSchemaLocal","useAsyncEffect","mounted","firstRequest","schemaChanged","SchemaCache","instance","get","undefined","e","error","console","message","ModuleErrorSchema","$sources","schemaHuri","huri","schemaPayload","PayloadBuilder","payload","fields","build","useAsyncEffect","SchemaCache","useState","useSchemaDefinitions","schemaList","schemaPayloads","setSchemaPayloads","useState","useAsyncEffect","mounted","promiseResults","Promise","allSettled","map","name","SchemaCache","instance","get","result","status","value","payload","undefined","filter","item","usePromise","SchemaListQuerySchema","useWeakDivinerFromNode","useMemo","useSchemaList","address","nameOrAddress","diviner","divinerError","useWeakDivinerFromNode","query","useMemo","schema","SchemaListQuerySchema","undefined","schemaList","error","usePromise","divinerInstance","deref","response","divine","at","useAsyncEffect","SchemaStatsDivinerSchema","SchemaStatsQuerySchema","TYPES","isPayloadOfSchemaType","useWeakDivinerFromNode","useMemo","useState","useSchemaStats","statsAddress","nameOrAddress","TYPES","SchemaStatsDiviner","refresh","setRefresh","useState","diviner","divinerError","useWeakDivinerFromNode","error","setError","refreshHistory","previous","schemaList","setSchemaList","query","useMemo","address","schema","SchemaStatsQuerySchema","useAsyncEffect","mounted","instance","deref","undefined","schemas","divine","filter","isPayloadOfSchemaType","SchemaStatsDivinerSchema","ex","SchemaMemoryProvider","defaultSchema","knownSchemaList","props","schema","setSchema","useState","schemaList","setSchemaList","fetchedSchemaStats","useSchemaStats","useMemo","map","name","filter","exists","value","provided","React","SchemaContext","React","useCallback","useEffect","useMemo","useSearchParams","useContextEx","useSchema","required","useContextEx","SchemaContext","SchemaRouteProviderInner","children","schema","setSchema","schemaList","useSchema","params","setParams","useSearchParams","routeSchema","get","setSchemaParam","useCallback","set","replace","delete","setSchemaLocal","useEffect","undefined","value","useMemo","provided","React","SchemaContext","SchemaRouteProvider","knownSchemaList","defaultSchema","props","SchemaMemoryProvider","SchemaSelectEx","onChange","variant","props","schema","setSchema","schemaList","useSchema","React","SelectEx","size","value","event","child","target","renderValue","Typography","map","index","MenuItem","key"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xyo-network/react-schema",
3
- "version": "7.4.1",
3
+ "version": "7.5.0",
4
4
  "description": "Common React library for all XYO projects that use React",
5
5
  "keywords": [
6
6
  "xyo",
@@ -43,60 +43,62 @@
43
43
  "src"
44
44
  ],
45
45
  "dependencies": {
46
- "@xylabs/exists": "~5.0.50",
47
- "@xylabs/hex": "~5.0.50",
48
- "@xylabs/react-async-effect": "~7.1.8",
49
- "@xylabs/react-flexbox": "~7.1.8",
50
- "@xylabs/react-link": "~7.1.8",
51
- "@xylabs/react-promise": "~7.1.8",
52
- "@xylabs/react-select": "~7.1.8",
53
- "@xylabs/react-shared": "~7.1.8",
54
- "@xyo-network/diviner-schema-list-model": "~5.2.17",
55
- "@xyo-network/diviner-schema-stats-model": "~5.2.17",
56
- "@xyo-network/node-core-types": "~4.1.6",
57
- "@xyo-network/payload-builder": "~5.2.17",
58
- "@xyo-network/payload-model": "~5.2.17",
59
- "@xyo-network/react-diviner": "^7.4.1",
60
- "@xyo-network/react-event": "^7.4.1",
61
- "@xyo-network/react-property": "^7.4.1",
62
- "@xyo-network/schema-cache": "~5.2.17",
63
- "@xyo-network/schema-payload-plugin": "~5.2.17",
64
- "react-router-dom": "^7.10.0"
46
+ "@xylabs/exists": "~5.0.64",
47
+ "@xylabs/hex": "~5.0.64",
48
+ "@xylabs/react-async-effect": "~7.1.9",
49
+ "@xylabs/react-flexbox": "~7.1.9",
50
+ "@xylabs/react-link": "~7.1.9",
51
+ "@xylabs/react-promise": "~7.1.9",
52
+ "@xylabs/react-select": "~7.1.9",
53
+ "@xylabs/react-shared": "~7.1.9",
54
+ "@xyo-network/diviner-schema-list-model": "~5.3.2",
55
+ "@xyo-network/diviner-schema-stats-model": "~5.3.2",
56
+ "@xyo-network/node-core-types": "~4.1.7",
57
+ "@xyo-network/payload-builder": "~5.3.2",
58
+ "@xyo-network/payload-model": "~5.3.2",
59
+ "@xyo-network/react-diviner": "7.5.0",
60
+ "@xyo-network/react-event": "7.5.0",
61
+ "@xyo-network/react-property": "7.5.0",
62
+ "@xyo-network/schema-cache": "~5.3.2",
63
+ "@xyo-network/schema-payload-plugin": "~5.3.2",
64
+ "react-router-dom": "^7.13.0"
65
65
  },
66
66
  "devDependencies": {
67
67
  "@emotion/react": "~11.14.0",
68
68
  "@emotion/styled": "~11.14.1",
69
- "@mui/icons-material": "~7.3.6",
70
- "@mui/material": "~7.3.6",
71
- "@storybook/react-vite": "~10.1.4",
72
- "@types/react": "^19.2.7",
73
- "@xylabs/react-flexbox": "~7.1.8",
74
- "@xylabs/react-hooks": "~7.1.8",
75
- "@xylabs/ts-scripts-yarn3": "~7.2.8",
76
- "@xylabs/tsconfig": "~7.2.8",
77
- "@xylabs/tsconfig-dom": "~7.2.8",
78
- "@xylabs/tsconfig-react": "~7.2.8",
79
- "@xyo-network/bridge-http": "~5.2.17",
80
- "@xyo-network/node-memory": "~5.2.17",
81
- "@xyo-network/node-model": "~5.2.17",
82
- "@xyo-network/react-node": "^7.4.1",
83
- "@xyo-network/react-payload-raw-info": "^7.4.1",
84
- "@xyo-network/react-storybook": "^7.4.1",
85
- "@xyo-network/react-wallet": "^7.4.1",
86
- "react": "^19.2.1",
87
- "react-dom": "^19.2.1",
88
- "storybook": "~10.1.4",
69
+ "@mui/icons-material": "~7.3.7",
70
+ "@mui/material": "~7.3.7",
71
+ "@storybook/react-vite": "~10.2.1",
72
+ "@types/react": "^19.2.10",
73
+ "@xylabs/react-flexbox": "~7.1.9",
74
+ "@xylabs/react-hooks": "~7.1.9",
75
+ "@xylabs/sdk-js": "~5.0.64",
76
+ "@xylabs/ts-scripts-yarn3": "~7.3.2",
77
+ "@xylabs/tsconfig": "~7.3.2",
78
+ "@xylabs/tsconfig-dom": "~7.3.2",
79
+ "@xylabs/tsconfig-react": "~7.3.2",
80
+ "@xyo-network/bridge-http": "~5.3.2",
81
+ "@xyo-network/node-memory": "~5.3.2",
82
+ "@xyo-network/node-model": "~5.3.2",
83
+ "@xyo-network/react-node": "7.5.0",
84
+ "@xyo-network/react-payload-raw-info": "7.5.0",
85
+ "@xyo-network/react-storybook": "7.5.0",
86
+ "@xyo-network/react-wallet": "7.5.0",
87
+ "react": "^19.2.4",
88
+ "react-dom": "^19.2.4",
89
+ "storybook": "~10.2.1",
89
90
  "typescript": "^5.9.3",
90
- "vite": "~7.2.6"
91
+ "vite": "~7.3.1"
91
92
  },
92
93
  "peerDependencies": {
93
94
  "@mui/icons-material": ">=6 <8",
94
95
  "@mui/material": ">=6 <8",
95
96
  "react": "^19",
96
- "react-dom": "^19"
97
+ "react-dom": "^19",
98
+ "zod": "^4"
97
99
  },
98
100
  "publishConfig": {
99
101
  "access": "public"
100
102
  },
101
103
  "docs": "dist/docs.json"
102
- }
104
+ }
@@ -4,9 +4,9 @@ import {
4
4
  import type {
5
5
  Decorator, Meta, StoryFn,
6
6
  } from '@storybook/react-vite'
7
- import type { Address } from '@xylabs/hex'
8
7
  import { useAsyncEffect } from '@xylabs/react-async-effect'
9
8
  import { FlexGrowRow } from '@xylabs/react-flexbox'
9
+ import type { Address } from '@xylabs/sdk-js'
10
10
  import { HttpBridge, HttpBridgeConfigSchema } from '@xyo-network/bridge-http'
11
11
  import { MemoryNode } from '@xyo-network/node-memory'
12
12
  import { NodeConfigSchema } from '@xyo-network/node-model'
@@ -1,5 +1,5 @@
1
- import type { Address } from '@xylabs/hex'
2
1
  import { usePromise } from '@xylabs/react-promise'
2
+ import type { Address } from '@xylabs/sdk-js'
3
3
  import type { SchemaListPayload, SchemaListQueryPayload } from '@xyo-network/diviner-schema-list-model'
4
4
  import { SchemaListQuerySchema } from '@xyo-network/diviner-schema-list-model'
5
5
  import { useWeakDivinerFromNode } from '@xyo-network/react-diviner'
@@ -1,5 +1,5 @@
1
- import type { Address } from '@xylabs/hex'
2
1
  import { useAsyncEffect } from '@xylabs/react-async-effect'
2
+ import type { Address } from '@xylabs/sdk-js'
3
3
  import type {
4
4
  SchemaStatsPayload,
5
5
  SchemaStatsQueryPayload,