@xyo-network/react-schema 2.64.9 → 2.64.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (154) hide show
  1. package/dist/docs.json +38 -38
  2. package/package.json +26 -26
  3. package/dist/browser/components/Property/SchemaProperty.cjs +0 -76
  4. package/dist/browser/components/Property/SchemaProperty.cjs.map +0 -1
  5. package/dist/browser/components/Property/SchemaProperty.js +0 -55
  6. package/dist/browser/components/Property/SchemaProperty.js.map +0 -1
  7. package/dist/browser/components/Property/index.cjs +0 -78
  8. package/dist/browser/components/Property/index.cjs.map +0 -1
  9. package/dist/browser/components/Property/index.js +0 -55
  10. package/dist/browser/components/Property/index.js.map +0 -1
  11. package/dist/browser/components/SelectEx/SchemaSelectEx.cjs +0 -68
  12. package/dist/browser/components/SelectEx/SchemaSelectEx.cjs.map +0 -1
  13. package/dist/browser/components/SelectEx/SchemaSelectEx.js +0 -47
  14. package/dist/browser/components/SelectEx/SchemaSelectEx.js.map +0 -1
  15. package/dist/browser/components/SelectEx/index.cjs +0 -70
  16. package/dist/browser/components/SelectEx/index.cjs.map +0 -1
  17. package/dist/browser/components/SelectEx/index.js +0 -47
  18. package/dist/browser/components/SelectEx/index.js.map +0 -1
  19. package/dist/browser/components/index.cjs +0 -123
  20. package/dist/browser/components/index.cjs.map +0 -1
  21. package/dist/browser/components/index.js +0 -100
  22. package/dist/browser/components/index.js.map +0 -1
  23. package/dist/browser/contexts/Schema/Context.cjs +0 -28
  24. package/dist/browser/contexts/Schema/Context.cjs.map +0 -1
  25. package/dist/browser/contexts/Schema/Context.js +0 -7
  26. package/dist/browser/contexts/Schema/Context.js.map +0 -1
  27. package/dist/browser/contexts/Schema/Provider/Memory.cjs +0 -94
  28. package/dist/browser/contexts/Schema/Provider/Memory.cjs.map +0 -1
  29. package/dist/browser/contexts/Schema/Provider/Memory.js +0 -73
  30. package/dist/browser/contexts/Schema/Provider/Memory.js.map +0 -1
  31. package/dist/browser/contexts/Schema/Provider/Props.cjs +0 -19
  32. package/dist/browser/contexts/Schema/Provider/Props.cjs.map +0 -1
  33. package/dist/browser/contexts/Schema/Provider/Props.js +0 -1
  34. package/dist/browser/contexts/Schema/Provider/Props.js.map +0 -1
  35. package/dist/browser/contexts/Schema/Provider/Route.cjs +0 -144
  36. package/dist/browser/contexts/Schema/Provider/Route.cjs.map +0 -1
  37. package/dist/browser/contexts/Schema/Provider/Route.js +0 -123
  38. package/dist/browser/contexts/Schema/Provider/Route.js.map +0 -1
  39. package/dist/browser/contexts/Schema/Provider/index.cjs +0 -147
  40. package/dist/browser/contexts/Schema/Provider/index.cjs.map +0 -1
  41. package/dist/browser/contexts/Schema/Provider/index.js +0 -124
  42. package/dist/browser/contexts/Schema/Provider/index.js.map +0 -1
  43. package/dist/browser/contexts/Schema/State.cjs +0 -19
  44. package/dist/browser/contexts/Schema/State.cjs.map +0 -1
  45. package/dist/browser/contexts/Schema/State.js +0 -1
  46. package/dist/browser/contexts/Schema/State.js.map +0 -1
  47. package/dist/browser/contexts/Schema/index.cjs +0 -149
  48. package/dist/browser/contexts/Schema/index.cjs.map +0 -1
  49. package/dist/browser/contexts/Schema/index.js +0 -126
  50. package/dist/browser/contexts/Schema/index.js.map +0 -1
  51. package/dist/browser/contexts/Schema/use.cjs +0 -36
  52. package/dist/browser/contexts/Schema/use.cjs.map +0 -1
  53. package/dist/browser/contexts/Schema/use.js +0 -15
  54. package/dist/browser/contexts/Schema/use.js.map +0 -1
  55. package/dist/browser/contexts/index.cjs +0 -149
  56. package/dist/browser/contexts/index.cjs.map +0 -1
  57. package/dist/browser/contexts/index.js +0 -126
  58. package/dist/browser/contexts/index.js.map +0 -1
  59. package/dist/browser/hooks/index.cjs +0 -189
  60. package/dist/browser/hooks/index.cjs.map +0 -1
  61. package/dist/browser/hooks/index.js +0 -166
  62. package/dist/browser/hooks/index.js.map +0 -1
  63. package/dist/browser/hooks/useGetSchema.cjs +0 -69
  64. package/dist/browser/hooks/useGetSchema.cjs.map +0 -1
  65. package/dist/browser/hooks/useGetSchema.js +0 -48
  66. package/dist/browser/hooks/useGetSchema.js.map +0 -1
  67. package/dist/browser/hooks/useSchemaDefinitions.cjs +0 -47
  68. package/dist/browser/hooks/useSchemaDefinitions.cjs.map +0 -1
  69. package/dist/browser/hooks/useSchemaDefinitions.js +0 -26
  70. package/dist/browser/hooks/useSchemaDefinitions.js.map +0 -1
  71. package/dist/browser/hooks/useSchemaList.cjs +0 -69
  72. package/dist/browser/hooks/useSchemaList.cjs.map +0 -1
  73. package/dist/browser/hooks/useSchemaList.js +0 -48
  74. package/dist/browser/hooks/useSchemaList.js.map +0 -1
  75. package/dist/browser/hooks/useSchemaStats.cjs +0 -71
  76. package/dist/browser/hooks/useSchemaStats.cjs.map +0 -1
  77. package/dist/browser/hooks/useSchemaStats.js +0 -50
  78. package/dist/browser/hooks/useSchemaStats.js.map +0 -1
  79. package/dist/node/components/Property/SchemaProperty.cjs +0 -81
  80. package/dist/node/components/Property/SchemaProperty.cjs.map +0 -1
  81. package/dist/node/components/Property/SchemaProperty.js +0 -56
  82. package/dist/node/components/Property/SchemaProperty.js.map +0 -1
  83. package/dist/node/components/Property/index.cjs +0 -83
  84. package/dist/node/components/Property/index.cjs.map +0 -1
  85. package/dist/node/components/Property/index.js +0 -56
  86. package/dist/node/components/Property/index.js.map +0 -1
  87. package/dist/node/components/SelectEx/SchemaSelectEx.cjs +0 -72
  88. package/dist/node/components/SelectEx/SchemaSelectEx.cjs.map +0 -1
  89. package/dist/node/components/SelectEx/SchemaSelectEx.js +0 -47
  90. package/dist/node/components/SelectEx/SchemaSelectEx.js.map +0 -1
  91. package/dist/node/components/SelectEx/index.cjs +0 -74
  92. package/dist/node/components/SelectEx/index.cjs.map +0 -1
  93. package/dist/node/components/SelectEx/index.js +0 -47
  94. package/dist/node/components/SelectEx/index.js.map +0 -1
  95. package/dist/node/components/index.cjs +0 -129
  96. package/dist/node/components/index.cjs.map +0 -1
  97. package/dist/node/components/index.js +0 -101
  98. package/dist/node/components/index.js.map +0 -1
  99. package/dist/node/contexts/Schema/Context.cjs +0 -32
  100. package/dist/node/contexts/Schema/Context.cjs.map +0 -1
  101. package/dist/node/contexts/Schema/Context.js +0 -7
  102. package/dist/node/contexts/Schema/Context.js.map +0 -1
  103. package/dist/node/contexts/Schema/Provider/Memory.cjs +0 -98
  104. package/dist/node/contexts/Schema/Provider/Memory.cjs.map +0 -1
  105. package/dist/node/contexts/Schema/Provider/Memory.js +0 -73
  106. package/dist/node/contexts/Schema/Provider/Memory.js.map +0 -1
  107. package/dist/node/contexts/Schema/Provider/Props.cjs +0 -19
  108. package/dist/node/contexts/Schema/Provider/Props.cjs.map +0 -1
  109. package/dist/node/contexts/Schema/Provider/Props.js +0 -1
  110. package/dist/node/contexts/Schema/Provider/Props.js.map +0 -1
  111. package/dist/node/contexts/Schema/Provider/Route.cjs +0 -148
  112. package/dist/node/contexts/Schema/Provider/Route.cjs.map +0 -1
  113. package/dist/node/contexts/Schema/Provider/Route.js +0 -123
  114. package/dist/node/contexts/Schema/Provider/Route.js.map +0 -1
  115. package/dist/node/contexts/Schema/Provider/index.cjs +0 -152
  116. package/dist/node/contexts/Schema/Provider/index.cjs.map +0 -1
  117. package/dist/node/contexts/Schema/Provider/index.js +0 -124
  118. package/dist/node/contexts/Schema/Provider/index.js.map +0 -1
  119. package/dist/node/contexts/Schema/State.cjs +0 -19
  120. package/dist/node/contexts/Schema/State.cjs.map +0 -1
  121. package/dist/node/contexts/Schema/State.js +0 -1
  122. package/dist/node/contexts/Schema/State.js.map +0 -1
  123. package/dist/node/contexts/Schema/index.cjs +0 -156
  124. package/dist/node/contexts/Schema/index.cjs.map +0 -1
  125. package/dist/node/contexts/Schema/index.js +0 -126
  126. package/dist/node/contexts/Schema/index.js.map +0 -1
  127. package/dist/node/contexts/Schema/use.cjs +0 -40
  128. package/dist/node/contexts/Schema/use.cjs.map +0 -1
  129. package/dist/node/contexts/Schema/use.js +0 -15
  130. package/dist/node/contexts/Schema/use.js.map +0 -1
  131. package/dist/node/contexts/index.cjs +0 -156
  132. package/dist/node/contexts/index.cjs.map +0 -1
  133. package/dist/node/contexts/index.js +0 -126
  134. package/dist/node/contexts/index.js.map +0 -1
  135. package/dist/node/hooks/index.cjs +0 -199
  136. package/dist/node/hooks/index.cjs.map +0 -1
  137. package/dist/node/hooks/index.js +0 -169
  138. package/dist/node/hooks/index.js.map +0 -1
  139. package/dist/node/hooks/useGetSchema.cjs +0 -73
  140. package/dist/node/hooks/useGetSchema.cjs.map +0 -1
  141. package/dist/node/hooks/useGetSchema.js +0 -48
  142. package/dist/node/hooks/useGetSchema.js.map +0 -1
  143. package/dist/node/hooks/useSchemaDefinitions.cjs +0 -54
  144. package/dist/node/hooks/useSchemaDefinitions.cjs.map +0 -1
  145. package/dist/node/hooks/useSchemaDefinitions.js +0 -29
  146. package/dist/node/hooks/useSchemaDefinitions.js.map +0 -1
  147. package/dist/node/hooks/useSchemaList.cjs +0 -73
  148. package/dist/node/hooks/useSchemaList.cjs.map +0 -1
  149. package/dist/node/hooks/useSchemaList.js +0 -48
  150. package/dist/node/hooks/useSchemaList.js.map +0 -1
  151. package/dist/node/hooks/useSchemaStats.cjs +0 -75
  152. package/dist/node/hooks/useSchemaStats.cjs.map +0 -1
  153. package/dist/node/hooks/useSchemaStats.js +0 -50
  154. package/dist/node/hooks/useSchemaStats.js.map +0 -1
@@ -1,69 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/hooks/useSchemaList.tsx
21
- var useSchemaList_exports = {};
22
- __export(useSchemaList_exports, {
23
- useSchemaList: () => useSchemaList
24
- });
25
- module.exports = __toCommonJS(useSchemaList_exports);
26
- var import_react_async_effect = require("@xylabs/react-async-effect");
27
- var import_diviner_schema_list_model = require("@xyo-network/diviner-schema-list-model");
28
- var import_react_diviner = require("@xyo-network/react-diviner");
29
- var import_react = require("react");
30
- var useSchemaList = (address, nameOrAddress = "SchemaListDiviner") => {
31
- const [schemaList, setSchemaList] = (0, import_react.useState)();
32
- const [error, setError] = (0, import_react.useState)();
33
- const [diviner, divinerError] = (0, import_react_diviner.useDivinerFromNode)(nameOrAddress);
34
- const query = (0, import_react.useMemo)(
35
- () => address ? [
36
- {
37
- address,
38
- schema: import_diviner_schema_list_model.SchemaListQuerySchema
39
- }
40
- ] : void 0,
41
- [address]
42
- );
43
- (0, import_react.useEffect)(() => {
44
- if (diviner === null) {
45
- setSchemaList(null);
46
- setError(void 0);
47
- }
48
- }, [diviner]);
49
- (0, import_react_async_effect.useAsyncEffect)(
50
- // eslint-disable-next-line react-hooks/exhaustive-deps, require-await
51
- async (mounted) => {
52
- if (diviner) {
53
- try {
54
- const response = await diviner.divine(query);
55
- if (mounted()) {
56
- setSchemaList(response?.[0]);
57
- setError(void 0);
58
- }
59
- } catch (e) {
60
- setError(e);
61
- setSchemaList(void 0);
62
- }
63
- }
64
- },
65
- [diviner, divinerError, query]
66
- );
67
- return [schemaList, error];
68
- };
69
- //# sourceMappingURL=useSchemaList.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/hooks/useSchemaList.tsx"],"sourcesContent":["import { useAsyncEffect } from '@xylabs/react-async-effect'\nimport { SchemaListPayload, SchemaListQueryPayload, SchemaListQuerySchema } from '@xyo-network/diviner-schema-list-model'\nimport { useDivinerFromNode } from '@xyo-network/react-diviner'\nimport { useEffect, useMemo, useState } from 'react'\n\nexport const useSchemaList = (address?: string, nameOrAddress = 'SchemaListDiviner'): [SchemaListPayload | null | undefined, Error | undefined] => {\n const [schemaList, setSchemaList] = useState<SchemaListPayload | null>()\n const [error, setError] = useState<Error>()\n const [diviner, divinerError] = useDivinerFromNode(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 useEffect(() => {\n if (diviner === null) {\n setSchemaList(null)\n setError(undefined)\n }\n }, [diviner])\n\n useAsyncEffect(\n // eslint-disable-next-line react-hooks/exhaustive-deps, require-await\n async (mounted) => {\n if (diviner) {\n try {\n const response = (await diviner.divine(query)) as SchemaListPayload[]\n if (mounted()) {\n setSchemaList(response?.[0])\n setError(undefined)\n }\n } catch (e) {\n setError(e as Error)\n setSchemaList(undefined)\n }\n }\n },\n [diviner, divinerError, query],\n )\n return [schemaList, error]\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gCAA+B;AAC/B,uCAAiF;AACjF,2BAAmC;AACnC,mBAA6C;AAEtC,IAAM,gBAAgB,CAAC,SAAkB,gBAAgB,wBAAmF;AACjJ,QAAM,CAAC,YAAY,aAAa,QAAI,uBAAmC;AACvE,QAAM,CAAC,OAAO,QAAQ,QAAI,uBAAgB;AAC1C,QAAM,CAAC,SAAS,YAAY,QAAI,yCAAmB,aAAa;AAEhE,QAAM,YAA8C;AAAA,IAClD,MACE,UACI;AAAA,MACE;AAAA,QACE;AAAA,QACA,QAAQ;AAAA,MACV;AAAA,IACF,IACA;AAAA,IACN,CAAC,OAAO;AAAA,EACV;AAEA,8BAAU,MAAM;AACd,QAAI,YAAY,MAAM;AACpB,oBAAc,IAAI;AAClB,eAAS,MAAS;AAAA,IACpB;AAAA,EACF,GAAG,CAAC,OAAO,CAAC;AAEZ;AAAA;AAAA,IAEE,OAAO,YAAY;AACjB,UAAI,SAAS;AACX,YAAI;AACF,gBAAM,WAAY,MAAM,QAAQ,OAAO,KAAK;AAC5C,cAAI,QAAQ,GAAG;AACb,0BAAc,WAAW,CAAC,CAAC;AAC3B,qBAAS,MAAS;AAAA,UACpB;AAAA,QACF,SAAS,GAAG;AACV,mBAAS,CAAU;AACnB,wBAAc,MAAS;AAAA,QACzB;AAAA,MACF;AAAA,IACF;AAAA,IACA,CAAC,SAAS,cAAc,KAAK;AAAA,EAC/B;AACA,SAAO,CAAC,YAAY,KAAK;AAC3B;","names":[]}
@@ -1,48 +0,0 @@
1
- // src/hooks/useSchemaList.tsx
2
- import { useAsyncEffect } from "@xylabs/react-async-effect";
3
- import { SchemaListQuerySchema } from "@xyo-network/diviner-schema-list-model";
4
- import { useDivinerFromNode } from "@xyo-network/react-diviner";
5
- import { useEffect, useMemo, useState } from "react";
6
- var useSchemaList = (address, nameOrAddress = "SchemaListDiviner") => {
7
- const [schemaList, setSchemaList] = useState();
8
- const [error, setError] = useState();
9
- const [diviner, divinerError] = useDivinerFromNode(nameOrAddress);
10
- const query = useMemo(
11
- () => address ? [
12
- {
13
- address,
14
- schema: SchemaListQuerySchema
15
- }
16
- ] : void 0,
17
- [address]
18
- );
19
- useEffect(() => {
20
- if (diviner === null) {
21
- setSchemaList(null);
22
- setError(void 0);
23
- }
24
- }, [diviner]);
25
- useAsyncEffect(
26
- // eslint-disable-next-line react-hooks/exhaustive-deps, require-await
27
- async (mounted) => {
28
- if (diviner) {
29
- try {
30
- const response = await diviner.divine(query);
31
- if (mounted()) {
32
- setSchemaList(response?.[0]);
33
- setError(void 0);
34
- }
35
- } catch (e) {
36
- setError(e);
37
- setSchemaList(void 0);
38
- }
39
- }
40
- },
41
- [diviner, divinerError, query]
42
- );
43
- return [schemaList, error];
44
- };
45
- export {
46
- useSchemaList
47
- };
48
- //# sourceMappingURL=useSchemaList.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/hooks/useSchemaList.tsx"],"sourcesContent":["import { useAsyncEffect } from '@xylabs/react-async-effect'\nimport { SchemaListPayload, SchemaListQueryPayload, SchemaListQuerySchema } from '@xyo-network/diviner-schema-list-model'\nimport { useDivinerFromNode } from '@xyo-network/react-diviner'\nimport { useEffect, useMemo, useState } from 'react'\n\nexport const useSchemaList = (address?: string, nameOrAddress = 'SchemaListDiviner'): [SchemaListPayload | null | undefined, Error | undefined] => {\n const [schemaList, setSchemaList] = useState<SchemaListPayload | null>()\n const [error, setError] = useState<Error>()\n const [diviner, divinerError] = useDivinerFromNode(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 useEffect(() => {\n if (diviner === null) {\n setSchemaList(null)\n setError(undefined)\n }\n }, [diviner])\n\n useAsyncEffect(\n // eslint-disable-next-line react-hooks/exhaustive-deps, require-await\n async (mounted) => {\n if (diviner) {\n try {\n const response = (await diviner.divine(query)) as SchemaListPayload[]\n if (mounted()) {\n setSchemaList(response?.[0])\n setError(undefined)\n }\n } catch (e) {\n setError(e as Error)\n setSchemaList(undefined)\n }\n }\n },\n [diviner, divinerError, query],\n )\n return [schemaList, error]\n}\n"],"mappings":";AAAA,SAAS,sBAAsB;AAC/B,SAAoD,6BAA6B;AACjF,SAAS,0BAA0B;AACnC,SAAS,WAAW,SAAS,gBAAgB;AAEtC,IAAM,gBAAgB,CAAC,SAAkB,gBAAgB,wBAAmF;AACjJ,QAAM,CAAC,YAAY,aAAa,IAAI,SAAmC;AACvE,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAgB;AAC1C,QAAM,CAAC,SAAS,YAAY,IAAI,mBAAmB,aAAa;AAEhE,QAAM,QAA8C;AAAA,IAClD,MACE,UACI;AAAA,MACE;AAAA,QACE;AAAA,QACA,QAAQ;AAAA,MACV;AAAA,IACF,IACA;AAAA,IACN,CAAC,OAAO;AAAA,EACV;AAEA,YAAU,MAAM;AACd,QAAI,YAAY,MAAM;AACpB,oBAAc,IAAI;AAClB,eAAS,MAAS;AAAA,IACpB;AAAA,EACF,GAAG,CAAC,OAAO,CAAC;AAEZ;AAAA;AAAA,IAEE,OAAO,YAAY;AACjB,UAAI,SAAS;AACX,YAAI;AACF,gBAAM,WAAY,MAAM,QAAQ,OAAO,KAAK;AAC5C,cAAI,QAAQ,GAAG;AACb,0BAAc,WAAW,CAAC,CAAC;AAC3B,qBAAS,MAAS;AAAA,UACpB;AAAA,QACF,SAAS,GAAG;AACV,mBAAS,CAAU;AACnB,wBAAc,MAAS;AAAA,QACzB;AAAA,MACF;AAAA,IACF;AAAA,IACA,CAAC,SAAS,cAAc,KAAK;AAAA,EAC/B;AACA,SAAO,CAAC,YAAY,KAAK;AAC3B;","names":[]}
@@ -1,71 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/hooks/useSchemaStats.tsx
21
- var useSchemaStats_exports = {};
22
- __export(useSchemaStats_exports, {
23
- useSchemaStats: () => useSchemaStats
24
- });
25
- module.exports = __toCommonJS(useSchemaStats_exports);
26
- var import_react_async_effect = require("@xylabs/react-async-effect");
27
- var import_diviner_schema_stats_model = require("@xyo-network/diviner-schema-stats-model");
28
- var import_node_core_types = require("@xyo-network/node-core-types");
29
- var import_react_diviner = require("@xyo-network/react-diviner");
30
- var import_react = require("react");
31
- var useSchemaStats = (statsAddress, nameOrAddress = import_node_core_types.TYPES.SchemaStatsDiviner.description) => {
32
- const [refresh, setRefresh] = (0, import_react.useState)(1);
33
- const [diviner, divinerError] = (0, import_react_diviner.useDivinerFromNode)(nameOrAddress);
34
- const [error, setError] = (0, import_react.useState)();
35
- const refreshHistory = () => setRefresh((previous) => previous + 1);
36
- const [schemaList, setSchemaList] = (0, import_react.useState)();
37
- const query = (0, import_react.useMemo)(
38
- () => ({
39
- address: statsAddress,
40
- schema: import_diviner_schema_stats_model.SchemaStatsQuerySchema
41
- }),
42
- [statsAddress]
43
- );
44
- (0, import_react_async_effect.useAsyncEffect)(
45
- // eslint-disable-next-line react-hooks/exhaustive-deps
46
- async (mounted) => {
47
- if (diviner) {
48
- if (divinerError) {
49
- if (mounted()) {
50
- setError(divinerError);
51
- setSchemaList(void 0);
52
- }
53
- } else {
54
- try {
55
- const schemas = (await diviner.divine([query])).filter(import_diviner_schema_stats_model.isSchemaStatsPayload);
56
- if (mounted()) {
57
- setSchemaList(schemas);
58
- setError(void 0);
59
- }
60
- } catch (ex) {
61
- setError(ex);
62
- setSchemaList(void 0);
63
- }
64
- }
65
- }
66
- },
67
- [diviner, refresh, divinerError, query]
68
- );
69
- return [schemaList, error, refreshHistory];
70
- };
71
- //# sourceMappingURL=useSchemaStats.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/hooks/useSchemaStats.tsx"],"sourcesContent":["import { useAsyncEffect } from '@xylabs/react-async-effect'\nimport { isSchemaStatsPayload, SchemaStatsPayload, SchemaStatsQueryPayload, SchemaStatsQuerySchema } from '@xyo-network/diviner-schema-stats-model'\nimport { TYPES } from '@xyo-network/node-core-types'\nimport { useDivinerFromNode } from '@xyo-network/react-diviner'\nimport { Dispatch, SetStateAction, useMemo, useState } from 'react'\n\nexport const useSchemaStats = (\n statsAddress?: string,\n nameOrAddress = TYPES.SchemaStatsDiviner.description,\n): [SchemaStatsPayload[] | undefined, Error | undefined, Dispatch<SetStateAction<number>>] => {\n const [refresh, setRefresh] = useState(1)\n const [diviner, divinerError] = useDivinerFromNode(nameOrAddress)\n const [error, setError] = useState<Error>()\n const refreshHistory = () => setRefresh((previous) => previous + 1)\n\n const [schemaList, setSchemaList] = useState<SchemaStatsPayload[]>()\n\n const query: SchemaStatsQueryPayload = useMemo(\n () => ({\n address: statsAddress,\n schema: SchemaStatsQuerySchema,\n }),\n [statsAddress],\n )\n\n useAsyncEffect(\n // eslint-disable-next-line react-hooks/exhaustive-deps\n async (mounted) => {\n if (diviner) {\n if (divinerError) {\n if (mounted()) {\n setError(divinerError)\n setSchemaList(undefined)\n }\n } else {\n try {\n const schemas = (await diviner.divine([query])).filter(isSchemaStatsPayload)\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"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gCAA+B;AAC/B,wCAA0G;AAC1G,6BAAsB;AACtB,2BAAmC;AACnC,mBAA4D;AAErD,IAAM,iBAAiB,CAC5B,cACA,gBAAgB,6BAAM,mBAAmB,gBACmD;AAC5F,QAAM,CAAC,SAAS,UAAU,QAAI,uBAAS,CAAC;AACxC,QAAM,CAAC,SAAS,YAAY,QAAI,yCAAmB,aAAa;AAChE,QAAM,CAAC,OAAO,QAAQ,QAAI,uBAAgB;AAC1C,QAAM,iBAAiB,MAAM,WAAW,CAAC,aAAa,WAAW,CAAC;AAElE,QAAM,CAAC,YAAY,aAAa,QAAI,uBAA+B;AAEnE,QAAM,YAAiC;AAAA,IACrC,OAAO;AAAA,MACL,SAAS;AAAA,MACT,QAAQ;AAAA,IACV;AAAA,IACA,CAAC,YAAY;AAAA,EACf;AAEA;AAAA;AAAA,IAEE,OAAO,YAAY;AACjB,UAAI,SAAS;AACX,YAAI,cAAc;AAChB,cAAI,QAAQ,GAAG;AACb,qBAAS,YAAY;AACrB,0BAAc,MAAS;AAAA,UACzB;AAAA,QACF,OAAO;AACL,cAAI;AACF,kBAAM,WAAW,MAAM,QAAQ,OAAO,CAAC,KAAK,CAAC,GAAG,OAAO,sDAAoB;AAC3E,gBAAI,QAAQ,GAAG;AACb,4BAAc,OAAO;AACrB,uBAAS,MAAS;AAAA,YACpB;AAAA,UACF,SAAS,IAAI;AACX,qBAAS,EAAW;AACpB,0BAAc,MAAS;AAAA,UACzB;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,IACA,CAAC,SAAS,SAAS,cAAc,KAAK;AAAA,EACxC;AAEA,SAAO,CAAC,YAAY,OAAO,cAAc;AAC3C;","names":[]}
@@ -1,50 +0,0 @@
1
- // src/hooks/useSchemaStats.tsx
2
- import { useAsyncEffect } from "@xylabs/react-async-effect";
3
- import { isSchemaStatsPayload, SchemaStatsQuerySchema } from "@xyo-network/diviner-schema-stats-model";
4
- import { TYPES } from "@xyo-network/node-core-types";
5
- import { useDivinerFromNode } from "@xyo-network/react-diviner";
6
- import { useMemo, useState } from "react";
7
- var useSchemaStats = (statsAddress, nameOrAddress = TYPES.SchemaStatsDiviner.description) => {
8
- const [refresh, setRefresh] = useState(1);
9
- const [diviner, divinerError] = useDivinerFromNode(nameOrAddress);
10
- const [error, setError] = useState();
11
- const refreshHistory = () => setRefresh((previous) => previous + 1);
12
- const [schemaList, setSchemaList] = useState();
13
- const query = useMemo(
14
- () => ({
15
- address: statsAddress,
16
- schema: SchemaStatsQuerySchema
17
- }),
18
- [statsAddress]
19
- );
20
- useAsyncEffect(
21
- // eslint-disable-next-line react-hooks/exhaustive-deps
22
- async (mounted) => {
23
- if (diviner) {
24
- if (divinerError) {
25
- if (mounted()) {
26
- setError(divinerError);
27
- setSchemaList(void 0);
28
- }
29
- } else {
30
- try {
31
- const schemas = (await diviner.divine([query])).filter(isSchemaStatsPayload);
32
- if (mounted()) {
33
- setSchemaList(schemas);
34
- setError(void 0);
35
- }
36
- } catch (ex) {
37
- setError(ex);
38
- setSchemaList(void 0);
39
- }
40
- }
41
- }
42
- },
43
- [diviner, refresh, divinerError, query]
44
- );
45
- return [schemaList, error, refreshHistory];
46
- };
47
- export {
48
- useSchemaStats
49
- };
50
- //# sourceMappingURL=useSchemaStats.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/hooks/useSchemaStats.tsx"],"sourcesContent":["import { useAsyncEffect } from '@xylabs/react-async-effect'\nimport { isSchemaStatsPayload, SchemaStatsPayload, SchemaStatsQueryPayload, SchemaStatsQuerySchema } from '@xyo-network/diviner-schema-stats-model'\nimport { TYPES } from '@xyo-network/node-core-types'\nimport { useDivinerFromNode } from '@xyo-network/react-diviner'\nimport { Dispatch, SetStateAction, useMemo, useState } from 'react'\n\nexport const useSchemaStats = (\n statsAddress?: string,\n nameOrAddress = TYPES.SchemaStatsDiviner.description,\n): [SchemaStatsPayload[] | undefined, Error | undefined, Dispatch<SetStateAction<number>>] => {\n const [refresh, setRefresh] = useState(1)\n const [diviner, divinerError] = useDivinerFromNode(nameOrAddress)\n const [error, setError] = useState<Error>()\n const refreshHistory = () => setRefresh((previous) => previous + 1)\n\n const [schemaList, setSchemaList] = useState<SchemaStatsPayload[]>()\n\n const query: SchemaStatsQueryPayload = useMemo(\n () => ({\n address: statsAddress,\n schema: SchemaStatsQuerySchema,\n }),\n [statsAddress],\n )\n\n useAsyncEffect(\n // eslint-disable-next-line react-hooks/exhaustive-deps\n async (mounted) => {\n if (diviner) {\n if (divinerError) {\n if (mounted()) {\n setError(divinerError)\n setSchemaList(undefined)\n }\n } else {\n try {\n const schemas = (await diviner.divine([query])).filter(isSchemaStatsPayload)\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"],"mappings":";AAAA,SAAS,sBAAsB;AAC/B,SAAS,sBAAmE,8BAA8B;AAC1G,SAAS,aAAa;AACtB,SAAS,0BAA0B;AACnC,SAAmC,SAAS,gBAAgB;AAErD,IAAM,iBAAiB,CAC5B,cACA,gBAAgB,MAAM,mBAAmB,gBACmD;AAC5F,QAAM,CAAC,SAAS,UAAU,IAAI,SAAS,CAAC;AACxC,QAAM,CAAC,SAAS,YAAY,IAAI,mBAAmB,aAAa;AAChE,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAgB;AAC1C,QAAM,iBAAiB,MAAM,WAAW,CAAC,aAAa,WAAW,CAAC;AAElE,QAAM,CAAC,YAAY,aAAa,IAAI,SAA+B;AAEnE,QAAM,QAAiC;AAAA,IACrC,OAAO;AAAA,MACL,SAAS;AAAA,MACT,QAAQ;AAAA,IACV;AAAA,IACA,CAAC,YAAY;AAAA,EACf;AAEA;AAAA;AAAA,IAEE,OAAO,YAAY;AACjB,UAAI,SAAS;AACX,YAAI,cAAc;AAChB,cAAI,QAAQ,GAAG;AACb,qBAAS,YAAY;AACrB,0BAAc,MAAS;AAAA,UACzB;AAAA,QACF,OAAO;AACL,cAAI;AACF,kBAAM,WAAW,MAAM,QAAQ,OAAO,CAAC,KAAK,CAAC,GAAG,OAAO,oBAAoB;AAC3E,gBAAI,QAAQ,GAAG;AACb,4BAAc,OAAO;AACrB,uBAAS,MAAS;AAAA,YACpB;AAAA,UACF,SAAS,IAAI;AACX,qBAAS,EAAW;AACpB,0BAAc,MAAS;AAAA,UACzB;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,IACA,CAAC,SAAS,SAAS,cAAc,KAAK;AAAA,EACxC;AAEA,SAAO,CAAC,YAAY,OAAO,cAAc;AAC3C;","names":[]}
@@ -1,81 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/components/Property/SchemaProperty.tsx
21
- var SchemaProperty_exports = {};
22
- __export(SchemaProperty_exports, {
23
- SchemaProperty: () => SchemaProperty
24
- });
25
- module.exports = __toCommonJS(SchemaProperty_exports);
26
- var import_icons_material = require("@mui/icons-material");
27
- var import_material = require("@mui/material");
28
- var import_react_async_effect = require("@xylabs/react-async-effect");
29
- var import_react_link = require("@xylabs/react-link");
30
- var import_react_event = require("@xyo-network/react-event");
31
- var import_react_property = require("@xyo-network/react-property");
32
- var import_schema_cache = require("@xyo-network/schema-cache");
33
- var import_react = require("react");
34
- var import_jsx_runtime = require("react/jsx-runtime");
35
- var useResolveSchema = (schema) => {
36
- const [entry, setEntry] = (0, import_react.useState)();
37
- (0, import_react_async_effect.useAsyncEffect)(
38
- // eslint-disable-next-line react-hooks/exhaustive-deps
39
- async (mounted) => {
40
- if (schema) {
41
- const entry2 = await import_schema_cache.SchemaCache.instance.get(schema);
42
- if (mounted()) {
43
- setEntry(entry2);
44
- }
45
- }
46
- },
47
- [schema]
48
- );
49
- return entry;
50
- };
51
- var SchemaProperty = (0, import_react.forwardRef)(
52
- ({ showLinkNames = true, showOpenNewWindowLink = true, showStatusIcon = true, titleProps, value, ...props }, forwardedRef) => {
53
- var _a;
54
- const resolvedSchema = useResolveSchema(value);
55
- const [buttonRef, buttonDispatch] = (0, import_react_event.useEvent)(void 0);
56
- const [divRef, divDispatch] = (0, import_react_event.useEvent)(void 0);
57
- const onClick = (dispatch, openNewWindow = false) => {
58
- dispatch == null ? void 0 : dispatch(
59
- "schema",
60
- "click",
61
- JSON.stringify({
62
- openNewWindow,
63
- schema: value
64
- })
65
- );
66
- };
67
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react_property.Property, { ref: forwardedRef, title: "Schema", value, tip: "Schema sent with the payload", titleProps, ...props, children: [
68
- value && showStatusIcon ? resolvedSchema === null ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.IconButton, { ref: buttonRef, size: "small", onClick: () => onClick(buttonDispatch), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons_material.NewReleases, { color: "warning", fontSize: "inherit" }) }) : resolvedSchema === void 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.IconButton, { ref: buttonRef, size: "small", onClick: () => onClick(buttonDispatch), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons_material.NewReleases, { color: "disabled", fontSize: "inherit" }) }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.IconButton, { rel: "noopener noreferrer", size: "small", target: "_blank", href: ((_a = resolvedSchema == null ? void 0 : resolvedSchema.huri) == null ? void 0 : _a.href) ?? "", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons_material.Verified, { color: "success", fontSize: "inherit" }) }) : null,
69
- value ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
70
- showLinkNames ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_link.LinkEx, { display: "block", width: "100%", sx: { cursor: "pointer" }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_property.PropertyValue, { ref: divRef, value, title: "view schema", onClick: () => onClick(divDispatch) }) }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_property.PropertyValue, { ref: divRef, value, title: "view schema", onClick: () => onClick(divDispatch) }),
71
- showOpenNewWindowLink ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.IconButton, { ref: buttonRef, size: "small", onClick: () => onClick(buttonDispatch, true), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons_material.OpenInNew, { fontSize: "inherit" }) }) : null
72
- ] }) : null
73
- ] });
74
- }
75
- );
76
- SchemaProperty.displayName = "SchemaProperty";
77
- // Annotate the CommonJS export names for ESM import in node:
78
- 0 && (module.exports = {
79
- SchemaProperty
80
- });
81
- //# sourceMappingURL=SchemaProperty.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/components/Property/SchemaProperty.tsx"],"sourcesContent":["import { NewReleases as NewReleasesIcon, OpenInNew as OpenInNewIcon, Verified as VerifiedIcon } from '@mui/icons-material'\nimport { IconButton } from '@mui/material'\nimport { useAsyncEffect } from '@xylabs/react-async-effect'\nimport { LinkEx } from '@xylabs/react-link'\nimport { EventDispatch, EventNoun, useEvent } from '@xyo-network/react-event'\nimport { Property, PropertyProps, PropertyValue } from '@xyo-network/react-property'\nimport { SchemaCache, SchemaCacheEntry } from '@xyo-network/schema-cache'\nimport { forwardRef, 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 // eslint-disable-next-line react-hooks/exhaustive-deps\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 = forwardRef<HTMLDivElement, SchemaPropertyProps>(\n ({ showLinkNames = true, showOpenNewWindowLink = true, showStatusIcon = true, titleProps, value, ...props }, forwardedRef) => {\n const resolvedSchema = useResolveSchema(value)\n const [buttonRef, buttonDispatch] = useEvent<HTMLButtonElement>(undefined)\n const [divRef, divDispatch] = useEvent<HTMLDivElement>(undefined)\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 ref={forwardedRef} title=\"Schema\" value={value} tip=\"Schema sent with the payload\" titleProps={titleProps} {...props}>\n {value && showStatusIcon ? (\n resolvedSchema === null ? (\n <IconButton ref={buttonRef} size=\"small\" onClick={() => onClick(buttonDispatch)}>\n <NewReleasesIcon color=\"warning\" fontSize=\"inherit\" />\n </IconButton>\n ) : resolvedSchema === undefined ? (\n <IconButton ref={buttonRef} size=\"small\" onClick={() => onClick(buttonDispatch)}>\n <NewReleasesIcon color=\"disabled\" fontSize=\"inherit\" />\n </IconButton>\n ) : (\n <IconButton rel=\"noopener noreferrer\" size=\"small\" target=\"_blank\" href={resolvedSchema?.huri?.href ?? ''}>\n <VerifiedIcon color=\"success\" fontSize=\"inherit\" />\n </IconButton>\n )\n ) : null}\n {value ? (\n <>\n {showLinkNames ? (\n <LinkEx display=\"block\" width=\"100%\" sx={{ cursor: 'pointer' }}>\n <PropertyValue ref={divRef} value={value} title=\"view schema\" onClick={() => onClick(divDispatch)} />\n </LinkEx>\n ) : (\n <PropertyValue ref={divRef} value={value} title=\"view schema\" onClick={() => onClick(divDispatch)} />\n )}\n {showOpenNewWindowLink ? (\n <IconButton ref={buttonRef} size=\"small\" onClick={() => onClick(buttonDispatch, true)}>\n <OpenInNewIcon fontSize=\"inherit\" />\n </IconButton>\n ) : null}\n </>\n ) : null}\n </Property>\n )\n },\n)\n\nSchemaProperty.displayName = 'SchemaProperty'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BAAqG;AACrG,sBAA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,YAAW,UAAS,WAAU,GACvD,IAEA,4CAAC,8BAAW,KAAI,uBAAsB,MAAK,SAAQ,QAAO,UAAS,QAAM,sDAAgB,SAAhB,mBAAsB,SAAQ,IACrG,sDAAC,sBAAAC,UAAA,EAAa,OAAM,WAAU,UAAS,WAAU,GACnD,IAEA;AAAA,MACH,QACC,4EACG;AAAA,wBACC,4CAAC,4BAAO,SAAQ,SAAQ,OAAM,QAAO,IAAI,EAAE,QAAQ,UAAU,GAC3D,sDAAC,uCAAc,KAAK,QAAQ,OAAc,OAAM,eAAc,SAAS,MAAM,QAAQ,WAAW,GAAG,GACrG,IAEA,4CAAC,uCAAc,KAAK,QAAQ,OAAc,OAAM,eAAc,SAAS,MAAM,QAAQ,WAAW,GAAG;AAAA,QAEpG,wBACC,4CAAC,8BAAW,KAAK,WAAW,MAAK,SAAQ,SAAS,MAAM,QAAQ,gBAAgB,IAAI,GAClF,sDAAC,sBAAAC,WAAA,EAAc,UAAS,WAAU,GACpC,IACE;AAAA,SACN,IACE;AAAA,OACN;AAAA,EAEJ;AACF;AAEA,eAAe,cAAc;","names":["entry","NewReleasesIcon","VerifiedIcon","OpenInNewIcon"]}
@@ -1,56 +0,0 @@
1
- // src/components/Property/SchemaProperty.tsx
2
- import { NewReleases as NewReleasesIcon, OpenInNew as OpenInNewIcon, Verified as VerifiedIcon } from "@mui/icons-material";
3
- import { IconButton } from "@mui/material";
4
- import { useAsyncEffect } from "@xylabs/react-async-effect";
5
- import { LinkEx } from "@xylabs/react-link";
6
- import { useEvent } from "@xyo-network/react-event";
7
- import { Property, PropertyValue } from "@xyo-network/react-property";
8
- import { SchemaCache } from "@xyo-network/schema-cache";
9
- import { forwardRef, useState } from "react";
10
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
11
- var useResolveSchema = (schema) => {
12
- const [entry, setEntry] = useState();
13
- useAsyncEffect(
14
- // eslint-disable-next-line react-hooks/exhaustive-deps
15
- async (mounted) => {
16
- if (schema) {
17
- const entry2 = await SchemaCache.instance.get(schema);
18
- if (mounted()) {
19
- setEntry(entry2);
20
- }
21
- }
22
- },
23
- [schema]
24
- );
25
- return entry;
26
- };
27
- var SchemaProperty = forwardRef(
28
- ({ showLinkNames = true, showOpenNewWindowLink = true, showStatusIcon = true, titleProps, value, ...props }, forwardedRef) => {
29
- var _a;
30
- const resolvedSchema = useResolveSchema(value);
31
- const [buttonRef, buttonDispatch] = useEvent(void 0);
32
- const [divRef, divDispatch] = useEvent(void 0);
33
- const onClick = (dispatch, openNewWindow = false) => {
34
- dispatch == null ? void 0 : dispatch(
35
- "schema",
36
- "click",
37
- JSON.stringify({
38
- openNewWindow,
39
- schema: value
40
- })
41
- );
42
- };
43
- return /* @__PURE__ */ jsxs(Property, { ref: forwardedRef, title: "Schema", value, tip: "Schema sent with the payload", titleProps, ...props, children: [
44
- value && showStatusIcon ? resolvedSchema === null ? /* @__PURE__ */ jsx(IconButton, { ref: buttonRef, size: "small", onClick: () => onClick(buttonDispatch), children: /* @__PURE__ */ jsx(NewReleasesIcon, { color: "warning", fontSize: "inherit" }) }) : resolvedSchema === void 0 ? /* @__PURE__ */ jsx(IconButton, { ref: buttonRef, size: "small", onClick: () => onClick(buttonDispatch), children: /* @__PURE__ */ jsx(NewReleasesIcon, { color: "disabled", fontSize: "inherit" }) }) : /* @__PURE__ */ jsx(IconButton, { rel: "noopener noreferrer", size: "small", target: "_blank", href: ((_a = resolvedSchema == null ? void 0 : resolvedSchema.huri) == null ? void 0 : _a.href) ?? "", children: /* @__PURE__ */ jsx(VerifiedIcon, { color: "success", fontSize: "inherit" }) }) : null,
45
- value ? /* @__PURE__ */ jsxs(Fragment, { children: [
46
- showLinkNames ? /* @__PURE__ */ jsx(LinkEx, { display: "block", width: "100%", sx: { cursor: "pointer" }, children: /* @__PURE__ */ jsx(PropertyValue, { ref: divRef, value, title: "view schema", onClick: () => onClick(divDispatch) }) }) : /* @__PURE__ */ jsx(PropertyValue, { ref: divRef, value, title: "view schema", onClick: () => onClick(divDispatch) }),
47
- showOpenNewWindowLink ? /* @__PURE__ */ jsx(IconButton, { ref: buttonRef, size: "small", onClick: () => onClick(buttonDispatch, true), children: /* @__PURE__ */ jsx(OpenInNewIcon, { fontSize: "inherit" }) }) : null
48
- ] }) : null
49
- ] });
50
- }
51
- );
52
- SchemaProperty.displayName = "SchemaProperty";
53
- export {
54
- SchemaProperty
55
- };
56
- //# sourceMappingURL=SchemaProperty.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/components/Property/SchemaProperty.tsx"],"sourcesContent":["import { NewReleases as NewReleasesIcon, OpenInNew as OpenInNewIcon, Verified as VerifiedIcon } from '@mui/icons-material'\nimport { IconButton } from '@mui/material'\nimport { useAsyncEffect } from '@xylabs/react-async-effect'\nimport { LinkEx } from '@xylabs/react-link'\nimport { EventDispatch, EventNoun, useEvent } from '@xyo-network/react-event'\nimport { Property, PropertyProps, PropertyValue } from '@xyo-network/react-property'\nimport { SchemaCache, SchemaCacheEntry } from '@xyo-network/schema-cache'\nimport { forwardRef, 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 // eslint-disable-next-line react-hooks/exhaustive-deps\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 = forwardRef<HTMLDivElement, SchemaPropertyProps>(\n ({ showLinkNames = true, showOpenNewWindowLink = true, showStatusIcon = true, titleProps, value, ...props }, forwardedRef) => {\n const resolvedSchema = useResolveSchema(value)\n const [buttonRef, buttonDispatch] = useEvent<HTMLButtonElement>(undefined)\n const [divRef, divDispatch] = useEvent<HTMLDivElement>(undefined)\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 ref={forwardedRef} title=\"Schema\" value={value} tip=\"Schema sent with the payload\" titleProps={titleProps} {...props}>\n {value && showStatusIcon ? (\n resolvedSchema === null ? (\n <IconButton ref={buttonRef} size=\"small\" onClick={() => onClick(buttonDispatch)}>\n <NewReleasesIcon color=\"warning\" fontSize=\"inherit\" />\n </IconButton>\n ) : resolvedSchema === undefined ? (\n <IconButton ref={buttonRef} size=\"small\" onClick={() => onClick(buttonDispatch)}>\n <NewReleasesIcon color=\"disabled\" fontSize=\"inherit\" />\n </IconButton>\n ) : (\n <IconButton rel=\"noopener noreferrer\" size=\"small\" target=\"_blank\" href={resolvedSchema?.huri?.href ?? ''}>\n <VerifiedIcon color=\"success\" fontSize=\"inherit\" />\n </IconButton>\n )\n ) : null}\n {value ? (\n <>\n {showLinkNames ? (\n <LinkEx display=\"block\" width=\"100%\" sx={{ cursor: 'pointer' }}>\n <PropertyValue ref={divRef} value={value} title=\"view schema\" onClick={() => onClick(divDispatch)} />\n </LinkEx>\n ) : (\n <PropertyValue ref={divRef} value={value} title=\"view schema\" onClick={() => onClick(divDispatch)} />\n )}\n {showOpenNewWindowLink ? (\n <IconButton ref={buttonRef} size=\"small\" onClick={() => onClick(buttonDispatch, true)}>\n <OpenInNewIcon fontSize=\"inherit\" />\n </IconButton>\n ) : null}\n </>\n ) : null}\n </Property>\n )\n },\n)\n\nSchemaProperty.displayName = 'SchemaProperty'\n"],"mappings":";AAAA,SAAS,eAAe,iBAAiB,aAAa,eAAe,YAAY,oBAAoB;AACrG,SAAS,kBAAkB;AAC3B,SAAS,sBAAsB;AAC/B,SAAS,cAAc;AACvB,SAAmC,gBAAgB;AACnD,SAAS,UAAyB,qBAAqB;AACvD,SAAS,mBAAqC;AAC9C,SAAS,YAAY,gBAAgB;AAgDvB,SAaJ,UAbI,KAaJ,YAbI;AAvCd,IAA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WAAU,UAAS,WAAU,GACnD,IAEA;AAAA,MACH,QACC,iCACG;AAAA,wBACC,oBAAC,UAAO,SAAQ,SAAQ,OAAM,QAAO,IAAI,EAAE,QAAQ,UAAU,GAC3D,8BAAC,iBAAc,KAAK,QAAQ,OAAc,OAAM,eAAc,SAAS,MAAM,QAAQ,WAAW,GAAG,GACrG,IAEA,oBAAC,iBAAc,KAAK,QAAQ,OAAc,OAAM,eAAc,SAAS,MAAM,QAAQ,WAAW,GAAG;AAAA,QAEpG,wBACC,oBAAC,cAAW,KAAK,WAAW,MAAK,SAAQ,SAAS,MAAM,QAAQ,gBAAgB,IAAI,GAClF,8BAAC,iBAAc,UAAS,WAAU,GACpC,IACE;AAAA,SACN,IACE;AAAA,OACN;AAAA,EAEJ;AACF;AAEA,eAAe,cAAc;","names":["entry"]}
@@ -1,83 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/components/Property/index.ts
21
- var Property_exports = {};
22
- __export(Property_exports, {
23
- SchemaProperty: () => SchemaProperty
24
- });
25
- module.exports = __toCommonJS(Property_exports);
26
-
27
- // src/components/Property/SchemaProperty.tsx
28
- var import_icons_material = require("@mui/icons-material");
29
- var import_material = require("@mui/material");
30
- var import_react_async_effect = require("@xylabs/react-async-effect");
31
- var import_react_link = require("@xylabs/react-link");
32
- var import_react_event = require("@xyo-network/react-event");
33
- var import_react_property = require("@xyo-network/react-property");
34
- var import_schema_cache = require("@xyo-network/schema-cache");
35
- var import_react = require("react");
36
- var import_jsx_runtime = require("react/jsx-runtime");
37
- var useResolveSchema = (schema) => {
38
- const [entry, setEntry] = (0, import_react.useState)();
39
- (0, import_react_async_effect.useAsyncEffect)(
40
- // eslint-disable-next-line react-hooks/exhaustive-deps
41
- async (mounted) => {
42
- if (schema) {
43
- const entry2 = await import_schema_cache.SchemaCache.instance.get(schema);
44
- if (mounted()) {
45
- setEntry(entry2);
46
- }
47
- }
48
- },
49
- [schema]
50
- );
51
- return entry;
52
- };
53
- var SchemaProperty = (0, import_react.forwardRef)(
54
- ({ showLinkNames = true, showOpenNewWindowLink = true, showStatusIcon = true, titleProps, value, ...props }, forwardedRef) => {
55
- var _a;
56
- const resolvedSchema = useResolveSchema(value);
57
- const [buttonRef, buttonDispatch] = (0, import_react_event.useEvent)(void 0);
58
- const [divRef, divDispatch] = (0, import_react_event.useEvent)(void 0);
59
- const onClick = (dispatch, openNewWindow = false) => {
60
- dispatch == null ? void 0 : dispatch(
61
- "schema",
62
- "click",
63
- JSON.stringify({
64
- openNewWindow,
65
- schema: value
66
- })
67
- );
68
- };
69
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react_property.Property, { ref: forwardedRef, title: "Schema", value, tip: "Schema sent with the payload", titleProps, ...props, children: [
70
- value && showStatusIcon ? resolvedSchema === null ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.IconButton, { ref: buttonRef, size: "small", onClick: () => onClick(buttonDispatch), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons_material.NewReleases, { color: "warning", fontSize: "inherit" }) }) : resolvedSchema === void 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.IconButton, { ref: buttonRef, size: "small", onClick: () => onClick(buttonDispatch), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons_material.NewReleases, { color: "disabled", fontSize: "inherit" }) }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.IconButton, { rel: "noopener noreferrer", size: "small", target: "_blank", href: ((_a = resolvedSchema == null ? void 0 : resolvedSchema.huri) == null ? void 0 : _a.href) ?? "", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons_material.Verified, { color: "success", fontSize: "inherit" }) }) : null,
71
- value ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
72
- showLinkNames ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_link.LinkEx, { display: "block", width: "100%", sx: { cursor: "pointer" }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_property.PropertyValue, { ref: divRef, value, title: "view schema", onClick: () => onClick(divDispatch) }) }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_property.PropertyValue, { ref: divRef, value, title: "view schema", onClick: () => onClick(divDispatch) }),
73
- showOpenNewWindowLink ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.IconButton, { ref: buttonRef, size: "small", onClick: () => onClick(buttonDispatch, true), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons_material.OpenInNew, { fontSize: "inherit" }) }) : null
74
- ] }) : null
75
- ] });
76
- }
77
- );
78
- SchemaProperty.displayName = "SchemaProperty";
79
- // Annotate the CommonJS export names for ESM import in node:
80
- 0 && (module.exports = {
81
- SchemaProperty
82
- });
83
- //# sourceMappingURL=index.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/components/Property/index.ts","../../../../src/components/Property/SchemaProperty.tsx"],"sourcesContent":["export * from './SchemaProperty'\n","import { NewReleases as NewReleasesIcon, OpenInNew as OpenInNewIcon, Verified as VerifiedIcon } from '@mui/icons-material'\nimport { IconButton } from '@mui/material'\nimport { useAsyncEffect } from '@xylabs/react-async-effect'\nimport { LinkEx } from '@xylabs/react-link'\nimport { EventDispatch, EventNoun, useEvent } from '@xyo-network/react-event'\nimport { Property, PropertyProps, PropertyValue } from '@xyo-network/react-property'\nimport { SchemaCache, SchemaCacheEntry } from '@xyo-network/schema-cache'\nimport { forwardRef, 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 // eslint-disable-next-line react-hooks/exhaustive-deps\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 = forwardRef<HTMLDivElement, SchemaPropertyProps>(\n ({ showLinkNames = true, showOpenNewWindowLink = true, showStatusIcon = true, titleProps, value, ...props }, forwardedRef) => {\n const resolvedSchema = useResolveSchema(value)\n const [buttonRef, buttonDispatch] = useEvent<HTMLButtonElement>(undefined)\n const [divRef, divDispatch] = useEvent<HTMLDivElement>(undefined)\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 ref={forwardedRef} title=\"Schema\" value={value} tip=\"Schema sent with the payload\" titleProps={titleProps} {...props}>\n {value && showStatusIcon ? (\n resolvedSchema === null ? (\n <IconButton ref={buttonRef} size=\"small\" onClick={() => onClick(buttonDispatch)}>\n <NewReleasesIcon color=\"warning\" fontSize=\"inherit\" />\n </IconButton>\n ) : resolvedSchema === undefined ? (\n <IconButton ref={buttonRef} size=\"small\" onClick={() => onClick(buttonDispatch)}>\n <NewReleasesIcon color=\"disabled\" fontSize=\"inherit\" />\n </IconButton>\n ) : (\n <IconButton rel=\"noopener noreferrer\" size=\"small\" target=\"_blank\" href={resolvedSchema?.huri?.href ?? ''}>\n <VerifiedIcon color=\"success\" fontSize=\"inherit\" />\n </IconButton>\n )\n ) : null}\n {value ? (\n <>\n {showLinkNames ? (\n <LinkEx display=\"block\" width=\"100%\" sx={{ cursor: 'pointer' }}>\n <PropertyValue ref={divRef} value={value} title=\"view schema\" onClick={() => onClick(divDispatch)} />\n </LinkEx>\n ) : (\n <PropertyValue ref={divRef} value={value} title=\"view schema\" onClick={() => onClick(divDispatch)} />\n )}\n {showOpenNewWindowLink ? (\n <IconButton ref={buttonRef} size=\"small\" onClick={() => onClick(buttonDispatch, true)}>\n <OpenInNewIcon fontSize=\"inherit\" />\n </IconButton>\n ) : null}\n </>\n ) : null}\n </Property>\n )\n },\n)\n\nSchemaProperty.displayName = 'SchemaProperty'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,4BAAqG;AACrG,sBAA2B;AAC3B,gCAA+B;AAC/B,wBAAuB;AACvB,yBAAmD;AACnD,4BAAuD;AACvD,0BAA8C;AAC9C,mBAAqC;AAgDvB;AAvCd,IAAM,mBAAmB,CAAC,WAAoB;AAC5C,QAAM,CAAC,OAAO,QAAQ,QAAI,uBAAkC;AAC5D;AAAA;AAAA,IAEE,OAAO,YAAY;AACjB,UAAI,QAAQ;AACV,cAAMA,SAAQ,MAAM,gCAAY,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,qBAAiB;AAAA,EAC5B,CAAC,EAAE,gBAAgB,MAAM,wBAAwB,MAAM,iBAAiB,MAAM,YAAY,OAAO,GAAG,MAAM,GAAG,iBAAiB;AAlChI;AAmCI,UAAM,iBAAiB,iBAAiB,KAAK;AAC7C,UAAM,CAAC,WAAW,cAAc,QAAI,6BAA4B,MAAS;AACzE,UAAM,CAAC,QAA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EA,eAAe,cAAc;","names":["entry","NewReleasesIcon","VerifiedIcon","OpenInNewIcon"]}
@@ -1,56 +0,0 @@
1
- // src/components/Property/SchemaProperty.tsx
2
- import { NewReleases as NewReleasesIcon, OpenInNew as OpenInNewIcon, Verified as VerifiedIcon } from "@mui/icons-material";
3
- import { IconButton } from "@mui/material";
4
- import { useAsyncEffect } from "@xylabs/react-async-effect";
5
- import { LinkEx } from "@xylabs/react-link";
6
- import { useEvent } from "@xyo-network/react-event";
7
- import { Property, PropertyValue } from "@xyo-network/react-property";
8
- import { SchemaCache } from "@xyo-network/schema-cache";
9
- import { forwardRef, useState } from "react";
10
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
11
- var useResolveSchema = (schema) => {
12
- const [entry, setEntry] = useState();
13
- useAsyncEffect(
14
- // eslint-disable-next-line react-hooks/exhaustive-deps
15
- async (mounted) => {
16
- if (schema) {
17
- const entry2 = await SchemaCache.instance.get(schema);
18
- if (mounted()) {
19
- setEntry(entry2);
20
- }
21
- }
22
- },
23
- [schema]
24
- );
25
- return entry;
26
- };
27
- var SchemaProperty = forwardRef(
28
- ({ showLinkNames = true, showOpenNewWindowLink = true, showStatusIcon = true, titleProps, value, ...props }, forwardedRef) => {
29
- var _a;
30
- const resolvedSchema = useResolveSchema(value);
31
- const [buttonRef, buttonDispatch] = useEvent(void 0);
32
- const [divRef, divDispatch] = useEvent(void 0);
33
- const onClick = (dispatch, openNewWindow = false) => {
34
- dispatch == null ? void 0 : dispatch(
35
- "schema",
36
- "click",
37
- JSON.stringify({
38
- openNewWindow,
39
- schema: value
40
- })
41
- );
42
- };
43
- return /* @__PURE__ */ jsxs(Property, { ref: forwardedRef, title: "Schema", value, tip: "Schema sent with the payload", titleProps, ...props, children: [
44
- value && showStatusIcon ? resolvedSchema === null ? /* @__PURE__ */ jsx(IconButton, { ref: buttonRef, size: "small", onClick: () => onClick(buttonDispatch), children: /* @__PURE__ */ jsx(NewReleasesIcon, { color: "warning", fontSize: "inherit" }) }) : resolvedSchema === void 0 ? /* @__PURE__ */ jsx(IconButton, { ref: buttonRef, size: "small", onClick: () => onClick(buttonDispatch), children: /* @__PURE__ */ jsx(NewReleasesIcon, { color: "disabled", fontSize: "inherit" }) }) : /* @__PURE__ */ jsx(IconButton, { rel: "noopener noreferrer", size: "small", target: "_blank", href: ((_a = resolvedSchema == null ? void 0 : resolvedSchema.huri) == null ? void 0 : _a.href) ?? "", children: /* @__PURE__ */ jsx(VerifiedIcon, { color: "success", fontSize: "inherit" }) }) : null,
45
- value ? /* @__PURE__ */ jsxs(Fragment, { children: [
46
- showLinkNames ? /* @__PURE__ */ jsx(LinkEx, { display: "block", width: "100%", sx: { cursor: "pointer" }, children: /* @__PURE__ */ jsx(PropertyValue, { ref: divRef, value, title: "view schema", onClick: () => onClick(divDispatch) }) }) : /* @__PURE__ */ jsx(PropertyValue, { ref: divRef, value, title: "view schema", onClick: () => onClick(divDispatch) }),
47
- showOpenNewWindowLink ? /* @__PURE__ */ jsx(IconButton, { ref: buttonRef, size: "small", onClick: () => onClick(buttonDispatch, true), children: /* @__PURE__ */ jsx(OpenInNewIcon, { fontSize: "inherit" }) }) : null
48
- ] }) : null
49
- ] });
50
- }
51
- );
52
- SchemaProperty.displayName = "SchemaProperty";
53
- export {
54
- SchemaProperty
55
- };
56
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/components/Property/SchemaProperty.tsx"],"sourcesContent":["import { NewReleases as NewReleasesIcon, OpenInNew as OpenInNewIcon, Verified as VerifiedIcon } from '@mui/icons-material'\nimport { IconButton } from '@mui/material'\nimport { useAsyncEffect } from '@xylabs/react-async-effect'\nimport { LinkEx } from '@xylabs/react-link'\nimport { EventDispatch, EventNoun, useEvent } from '@xyo-network/react-event'\nimport { Property, PropertyProps, PropertyValue } from '@xyo-network/react-property'\nimport { SchemaCache, SchemaCacheEntry } from '@xyo-network/schema-cache'\nimport { forwardRef, 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 // eslint-disable-next-line react-hooks/exhaustive-deps\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 = forwardRef<HTMLDivElement, SchemaPropertyProps>(\n ({ showLinkNames = true, showOpenNewWindowLink = true, showStatusIcon = true, titleProps, value, ...props }, forwardedRef) => {\n const resolvedSchema = useResolveSchema(value)\n const [buttonRef, buttonDispatch] = useEvent<HTMLButtonElement>(undefined)\n const [divRef, divDispatch] = useEvent<HTMLDivElement>(undefined)\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 ref={forwardedRef} title=\"Schema\" value={value} tip=\"Schema sent with the payload\" titleProps={titleProps} {...props}>\n {value && showStatusIcon ? (\n resolvedSchema === null ? (\n <IconButton ref={buttonRef} size=\"small\" onClick={() => onClick(buttonDispatch)}>\n <NewReleasesIcon color=\"warning\" fontSize=\"inherit\" />\n </IconButton>\n ) : resolvedSchema === undefined ? (\n <IconButton ref={buttonRef} size=\"small\" onClick={() => onClick(buttonDispatch)}>\n <NewReleasesIcon color=\"disabled\" fontSize=\"inherit\" />\n </IconButton>\n ) : (\n <IconButton rel=\"noopener noreferrer\" size=\"small\" target=\"_blank\" href={resolvedSchema?.huri?.href ?? ''}>\n <VerifiedIcon color=\"success\" fontSize=\"inherit\" />\n </IconButton>\n )\n ) : null}\n {value ? (\n <>\n {showLinkNames ? (\n <LinkEx display=\"block\" width=\"100%\" sx={{ cursor: 'pointer' }}>\n <PropertyValue ref={divRef} value={value} title=\"view schema\" onClick={() => onClick(divDispatch)} />\n </LinkEx>\n ) : (\n <PropertyValue ref={divRef} value={value} title=\"view schema\" onClick={() => onClick(divDispatch)} />\n )}\n {showOpenNewWindowLink ? (\n <IconButton ref={buttonRef} size=\"small\" onClick={() => onClick(buttonDispatch, true)}>\n <OpenInNewIcon fontSize=\"inherit\" />\n </IconButton>\n ) : null}\n </>\n ) : null}\n </Property>\n )\n },\n)\n\nSchemaProperty.displayName = 'SchemaProperty'\n"],"mappings":";AAAA,SAAS,eAAe,iBAAiB,aAAa,eAAe,YAAY,oBAAoB;AACrG,SAAS,kBAAkB;AAC3B,SAAS,sBAAsB;AAC/B,SAAS,cAAc;AACvB,SAAmC,gBAAgB;AACnD,SAAS,UAAyB,qBAAqB;AACvD,SAAS,mBAAqC;AAC9C,SAAS,YAAY,gBAAgB;AAgDvB,SAaJ,UAbI,KAaJ,YAbI;AAvCd,IAAM,mBAAmB,CAAC,WAAoB;AAC5C,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAkC;AAC5D;AAAA;AAAA,IAEE,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,iBAAiB;AAAA,EAC5B,CAAC,EAAE,gBAAgB,MAAM,wBAAwB,MAAM,iBAAiB,MAAM,YAAY,OAAO,GAAG,MAAM,GAAG,iBAAiB;AAlChI;AAmCI,UAAM,iBAAiB,iBAAiB,KAAK;AAC7C,UAAM,CAAC,WAAW,cAAc,IAAI,SAA4B,MAAS;AACzE,UAAM,CAAC,QAAQ,WAAW,IAAI,SAAyB,MAAS;AAEhE,UAAM,UAAU,CAAC,UAAsD,gBAAgB,UAAU;AAC/F;AAAA,QACE;AAAA,QACA;AAAA,QACA,KAAK,UA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