@solidxai/core-ui 0.1.9-beta.18 → 0.1.9-beta.19

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 (177) hide show
  1. package/dist/adapters/auth/handleLogout.d.ts +1 -1
  2. package/dist/adapters/auth/handleLogout.d.ts.map +1 -1
  3. package/dist/adapters/auth/handleLogout.js +20 -32
  4. package/dist/adapters/auth/handleLogout.js.map +1 -1
  5. package/dist/adapters/auth/handleLogout.ts +7 -14
  6. package/dist/components/core/common/SolidAccountSettings/SolidChangePassword.d.ts.map +1 -1
  7. package/dist/components/core/common/SolidAccountSettings/SolidChangePassword.js +1 -10
  8. package/dist/components/core/common/SolidAccountSettings/SolidChangePassword.js.map +1 -1
  9. package/dist/components/core/common/SolidAccountSettings/SolidChangePassword.tsx +1 -8
  10. package/dist/components/core/common/SolidAccountSettings/SolidNotifications.d.ts.map +1 -1
  11. package/dist/components/core/common/SolidAccountSettings/SolidNotifications.js +6 -11
  12. package/dist/components/core/common/SolidAccountSettings/SolidNotifications.js.map +1 -1
  13. package/dist/components/core/common/SolidAccountSettings/SolidNotifications.tsx +5 -31
  14. package/dist/components/core/common/SolidGlobalSearchElement.d.ts.map +1 -1
  15. package/dist/components/core/common/SolidGlobalSearchElement.js +47 -13
  16. package/dist/components/core/common/SolidGlobalSearchElement.js.map +1 -1
  17. package/dist/components/core/common/SolidGlobalSearchElement.tsx +38 -4
  18. package/dist/components/core/extension/solid-core/metadata/MetadataExplorerFormWidget.d.ts +16 -0
  19. package/dist/components/core/extension/solid-core/metadata/MetadataExplorerFormWidget.d.ts.map +1 -0
  20. package/dist/components/core/extension/solid-core/metadata/MetadataExplorerFormWidget.js +31 -0
  21. package/dist/components/core/extension/solid-core/metadata/MetadataExplorerFormWidget.js.map +1 -0
  22. package/dist/components/core/extension/solid-core/metadata/MetadataExplorerFormWidget.tsx +43 -0
  23. package/dist/components/core/extension/solid-core/moduleMetadata/list/ClearModulePackageRuntimeHeaderAction.d.ts +3 -0
  24. package/dist/components/core/extension/solid-core/moduleMetadata/list/ClearModulePackageRuntimeHeaderAction.d.ts.map +1 -0
  25. package/dist/components/core/extension/solid-core/moduleMetadata/list/ClearModulePackageRuntimeHeaderAction.js +141 -0
  26. package/dist/components/core/extension/solid-core/moduleMetadata/list/ClearModulePackageRuntimeHeaderAction.js.map +1 -0
  27. package/dist/components/core/extension/solid-core/moduleMetadata/list/ClearModulePackageRuntimeHeaderAction.tsx +205 -0
  28. package/dist/components/core/extension/solid-core/moduleMetadata/list/ExportModulePackageRowAction.d.ts +4 -0
  29. package/dist/components/core/extension/solid-core/moduleMetadata/list/ExportModulePackageRowAction.d.ts.map +1 -0
  30. package/dist/components/core/extension/solid-core/moduleMetadata/list/ExportModulePackageRowAction.js +112 -0
  31. package/dist/components/core/extension/solid-core/moduleMetadata/list/ExportModulePackageRowAction.js.map +1 -0
  32. package/dist/components/core/extension/solid-core/moduleMetadata/list/ExportModulePackageRowAction.tsx +146 -0
  33. package/dist/components/core/extension/solid-core/moduleMetadata/list/ModuleImportListHeaderAction.d.ts +11 -0
  34. package/dist/components/core/extension/solid-core/moduleMetadata/list/ModuleImportListHeaderAction.d.ts.map +1 -0
  35. package/dist/components/core/extension/solid-core/moduleMetadata/list/ModuleImportListHeaderAction.js +22 -0
  36. package/dist/components/core/extension/solid-core/moduleMetadata/list/ModuleImportListHeaderAction.js.map +1 -0
  37. package/dist/components/core/extension/solid-core/moduleMetadata/list/ModuleImportListHeaderAction.tsx +36 -0
  38. package/dist/components/core/extension/solid-core/moduleMetadata/list/moduleMetadataListOnLoad.d.ts +3 -0
  39. package/dist/components/core/extension/solid-core/moduleMetadata/list/moduleMetadataListOnLoad.d.ts.map +1 -0
  40. package/dist/components/core/extension/solid-core/moduleMetadata/list/moduleMetadataListOnLoad.js +133 -0
  41. package/dist/components/core/extension/solid-core/moduleMetadata/list/moduleMetadataListOnLoad.js.map +1 -0
  42. package/dist/components/core/extension/solid-core/moduleMetadata/list/moduleMetadataListOnLoad.ts +76 -0
  43. package/dist/components/core/form/fields/relations/RolesGroupedByModuleWidget.d.ts +12 -0
  44. package/dist/components/core/form/fields/relations/RolesGroupedByModuleWidget.d.ts.map +1 -0
  45. package/dist/components/core/form/fields/relations/RolesGroupedByModuleWidget.js +168 -0
  46. package/dist/components/core/form/fields/relations/RolesGroupedByModuleWidget.js.map +1 -0
  47. package/dist/components/core/form/fields/relations/RolesGroupedByModuleWidget.tsx +241 -0
  48. package/dist/components/core/list/SolidEmptyListViewPlaceholder.d.ts.map +1 -1
  49. package/dist/components/core/list/SolidEmptyListViewPlaceholder.js +3 -0
  50. package/dist/components/core/list/SolidEmptyListViewPlaceholder.js.map +1 -1
  51. package/dist/components/core/list/SolidEmptyListViewPlaceholder.tsx +2 -0
  52. package/dist/components/core/list/SolidListView.d.ts.map +1 -1
  53. package/dist/components/core/list/SolidListView.js +74 -68
  54. package/dist/components/core/list/SolidListView.js.map +1 -1
  55. package/dist/components/core/list/SolidListView.tsx +13 -4
  56. package/dist/components/core/list/SolidListViewColumn.d.ts.map +1 -1
  57. package/dist/components/core/list/SolidListViewColumn.js +0 -2
  58. package/dist/components/core/list/SolidListViewColumn.js.map +1 -1
  59. package/dist/components/core/list/SolidListViewColumn.tsx +0 -1
  60. package/dist/components/core/list/SolidListViewConfigure.d.ts.map +1 -1
  61. package/dist/components/core/list/SolidListViewConfigure.js +10 -9
  62. package/dist/components/core/list/SolidListViewConfigure.js.map +1 -1
  63. package/dist/components/core/list/SolidListViewConfigure.tsx +3 -1
  64. package/dist/components/core/list/SolidListViewHeaderButton.d.ts.map +1 -1
  65. package/dist/components/core/list/SolidListViewHeaderButton.js +3 -0
  66. package/dist/components/core/list/SolidListViewHeaderButton.js.map +1 -1
  67. package/dist/components/core/list/SolidListViewHeaderButton.tsx +2 -0
  68. package/dist/components/core/list/SolidListViewHeaderContextMenuButton.d.ts.map +1 -1
  69. package/dist/components/core/list/SolidListViewHeaderContextMenuButton.js +3 -0
  70. package/dist/components/core/list/SolidListViewHeaderContextMenuButton.js.map +1 -1
  71. package/dist/components/core/list/SolidListViewHeaderContextMenuButton.tsx +2 -0
  72. package/dist/components/core/list/SolidListViewRowActionsMenu.d.ts.map +1 -1
  73. package/dist/components/core/list/SolidListViewRowActionsMenu.js +7 -1
  74. package/dist/components/core/list/SolidListViewRowActionsMenu.js.map +1 -1
  75. package/dist/components/core/list/SolidListViewRowActionsMenu.tsx +5 -1
  76. package/dist/components/core/list/columns/SolidBooleanColumn.d.ts.map +1 -1
  77. package/dist/components/core/list/columns/SolidBooleanColumn.js +4 -6
  78. package/dist/components/core/list/columns/SolidBooleanColumn.js.map +1 -1
  79. package/dist/components/core/list/columns/SolidBooleanColumn.tsx +1 -3
  80. package/dist/components/core/list/columns/SolidMediaMultipleColumn.d.ts.map +1 -1
  81. package/dist/components/core/list/columns/SolidMediaMultipleColumn.js +3 -2
  82. package/dist/components/core/list/columns/SolidMediaMultipleColumn.js.map +1 -1
  83. package/dist/components/core/list/columns/SolidMediaMultipleColumn.tsx +3 -2
  84. package/dist/components/core/list/columns/SolidMediaSingleColumn.d.ts.map +1 -1
  85. package/dist/components/core/list/columns/SolidMediaSingleColumn.js +3 -2
  86. package/dist/components/core/list/columns/SolidMediaSingleColumn.js.map +1 -1
  87. package/dist/components/core/list/columns/SolidMediaSingleColumn.tsx +3 -2
  88. package/dist/components/core/model/CreateModel.css +48 -0
  89. package/dist/components/core/model/CreateModel.d.ts +1 -0
  90. package/dist/components/core/model/CreateModel.d.ts.map +1 -1
  91. package/dist/components/core/model/CreateModel.js +69 -104
  92. package/dist/components/core/model/CreateModel.js.map +1 -1
  93. package/dist/components/core/model/CreateModel.tsx +92 -204
  94. package/dist/components/core/model/FieldMetaData.d.ts +1 -1
  95. package/dist/components/core/model/FieldMetaData.d.ts.map +1 -1
  96. package/dist/components/core/model/FieldMetaData.js +6 -22
  97. package/dist/components/core/model/FieldMetaData.js.map +1 -1
  98. package/dist/components/core/model/FieldMetaData.tsx +6 -45
  99. package/dist/components/core/model/FieldMetaDataForm.d.ts.map +1 -1
  100. package/dist/components/core/model/FieldMetaDataForm.js +196 -222
  101. package/dist/components/core/model/FieldMetaDataForm.js.map +1 -1
  102. package/dist/components/core/model/FieldMetaDataForm.tsx +0 -72
  103. package/dist/components/core/model/ModelMetaData.d.ts.map +1 -1
  104. package/dist/components/core/model/ModelMetaData.js +7 -7
  105. package/dist/components/core/model/ModelMetaData.js.map +1 -1
  106. package/dist/components/core/model/ModelMetaData.tsx +7 -0
  107. package/dist/components/core/module/CreateModule.css +44 -0
  108. package/dist/components/core/module/CreateModule.d.ts +1 -0
  109. package/dist/components/core/module/CreateModule.d.ts.map +1 -1
  110. package/dist/components/core/module/CreateModule.js +40 -43
  111. package/dist/components/core/module/CreateModule.js.map +1 -1
  112. package/dist/components/core/module/CreateModule.tsx +243 -247
  113. package/dist/components/core/module/ModuleListViewData.d.ts.map +1 -1
  114. package/dist/components/core/module/ModuleListViewData.js +47 -7
  115. package/dist/components/core/module/ModuleListViewData.js.map +1 -1
  116. package/dist/components/core/module/ModuleListViewData.tsx +58 -0
  117. package/dist/components/core/module/ModuleMetadataExplorer.css +638 -0
  118. package/dist/components/core/module/ModuleMetadataExplorer.d.ts +15 -0
  119. package/dist/components/core/module/ModuleMetadataExplorer.d.ts.map +1 -0
  120. package/dist/components/core/module/ModuleMetadataExplorer.js +666 -0
  121. package/dist/components/core/module/ModuleMetadataExplorer.js.map +1 -0
  122. package/dist/components/core/module/ModuleMetadataExplorer.tsx +1000 -0
  123. package/dist/components/core/module/ModulePackageDialog.css +540 -0
  124. package/dist/components/core/module/ModulePackageDialog.d.ts +16 -0
  125. package/dist/components/core/module/ModulePackageDialog.d.ts.map +1 -0
  126. package/dist/components/core/module/ModulePackageDialog.js +625 -0
  127. package/dist/components/core/module/ModulePackageDialog.js.map +1 -0
  128. package/dist/components/core/module/ModulePackageDialog.tsx +906 -0
  129. package/dist/components/layout/user-profile-menu.d.ts.map +1 -1
  130. package/dist/components/layout/user-profile-menu.js +57 -33
  131. package/dist/components/layout/user-profile-menu.js.map +1 -1
  132. package/dist/components/layout/user-profile-menu.tsx +11 -59
  133. package/dist/helpers/buttonEnvironment.d.ts +5 -0
  134. package/dist/helpers/buttonEnvironment.d.ts.map +1 -0
  135. package/dist/helpers/buttonEnvironment.js +30 -0
  136. package/dist/helpers/buttonEnvironment.js.map +1 -0
  137. package/dist/helpers/buttonEnvironment.ts +35 -0
  138. package/dist/helpers/fileTypeIcon.d.ts +12 -0
  139. package/dist/helpers/fileTypeIcon.d.ts.map +1 -0
  140. package/dist/helpers/fileTypeIcon.js +37 -0
  141. package/dist/helpers/fileTypeIcon.js.map +1 -0
  142. package/dist/helpers/fileTypeIcon.tsx +65 -0
  143. package/dist/helpers/registry.d.ts.map +1 -1
  144. package/dist/helpers/registry.js +10 -0
  145. package/dist/helpers/registry.js.map +1 -1
  146. package/dist/helpers/registry.ts +10 -0
  147. package/dist/helpers/waitForBackendAvailability.d.ts +7 -0
  148. package/dist/helpers/waitForBackendAvailability.d.ts.map +1 -0
  149. package/dist/helpers/waitForBackendAvailability.js +86 -0
  150. package/dist/helpers/waitForBackendAvailability.js.map +1 -0
  151. package/dist/helpers/waitForBackendAvailability.ts +37 -0
  152. package/dist/index.d.ts +2 -1
  153. package/dist/index.d.ts.map +1 -1
  154. package/dist/index.js +2 -1
  155. package/dist/index.js.map +1 -1
  156. package/dist/index.ts +18 -0
  157. package/dist/redux/api/moduleApi.d.ts +26 -1
  158. package/dist/redux/api/moduleApi.d.ts.map +1 -1
  159. package/dist/redux/api/moduleApi.js +237 -1
  160. package/dist/redux/api/moduleApi.js.map +1 -1
  161. package/dist/redux/api/moduleApi.ts +181 -1
  162. package/dist/redux/store/defaultStoreConfig.d.ts +22 -0
  163. package/dist/redux/store/defaultStoreConfig.d.ts.map +1 -1
  164. package/dist/redux/store/solidEntityApiPool.d.ts +1 -0
  165. package/dist/redux/store/solidEntityApiPool.d.ts.map +1 -1
  166. package/dist/redux/store/solidEntityApiPool.js +4 -0
  167. package/dist/redux/store/solidEntityApiPool.js.map +1 -1
  168. package/dist/redux/store/solidEntityApiPool.ts +4 -0
  169. package/dist/resources/globals.css +56 -0
  170. package/dist/resources/shadcn-base.css +5 -0
  171. package/dist/routes/AppEventListener.d.ts.map +1 -1
  172. package/dist/routes/AppEventListener.js +58 -8
  173. package/dist/routes/AppEventListener.js.map +1 -1
  174. package/dist/routes/AppEventListener.tsx +69 -8
  175. package/dist/types/index.d.ts +1 -0
  176. package/dist/types/jsoneditor.d.ts +4 -0
  177. package/package.json +2 -1
@@ -0,0 +1,666 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
13
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
14
+ return new (P || (P = Promise))(function (resolve, reject) {
15
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
16
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
17
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
18
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
19
+ });
20
+ };
21
+ var __generator = (this && this.__generator) || function (thisArg, body) {
22
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
23
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
24
+ function verb(n) { return function (v) { return step([n, v]); }; }
25
+ function step(op) {
26
+ if (f) throw new TypeError("Generator is already executing.");
27
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
28
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
29
+ if (y = 0, t) op = [op[0] & 2, t.value];
30
+ switch (op[0]) {
31
+ case 0: case 1: t = op; break;
32
+ case 4: _.label++; return { value: op[1], done: false };
33
+ case 5: _.label++; y = op[1]; op = [0]; continue;
34
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
35
+ default:
36
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
37
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
38
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
39
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
40
+ if (t[2]) _.ops.pop();
41
+ _.trys.pop(); continue;
42
+ }
43
+ op = body.call(thisArg, _);
44
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
45
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
46
+ }
47
+ };
48
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
49
+ import { ChevronDown, ChevronRight, DatabaseZap, FileSearch, Save, Search, Settings, Wand2 } from "lucide-react";
50
+ import React, { useEffect, useImperativeHandle, useMemo, useRef, useState } from "react";
51
+ import { useDispatch } from "react-redux";
52
+ import { useGetModuleMetadataExplorerDocumentQuery, useGetModuleMetadataExplorerManifestQuery, useSeedModuleMetadataMutation, useUpdateModuleMetadataExplorerSectionMutation, useValidateModuleMetadataExplorerSectionMutation, } from "../../../redux/api/moduleApi";
53
+ import { showToast } from "../../../redux/features/toastSlice";
54
+ import { SolidButton, SolidDialog, SolidDialogBody, SolidDialogFooter, SolidDialogHeader, SolidDialogSeparator, SolidDialogTitle, SolidDropdownMenu, SolidDropdownMenuContent, SolidDropdownMenuItem, SolidDropdownMenuTrigger, SolidInput, SolidMessage, SolidTag, } from "../../shad-cn-ui";
55
+ import "jsoneditor/dist/jsoneditor.css";
56
+ import "./ModuleMetadataExplorer.css";
57
+ function extractApiErrorMessage(error) {
58
+ var _a, _b, _c;
59
+ var message = (_c = (_b = (_a = error === null || error === void 0 ? void 0 : error.data) === null || _a === void 0 ? void 0 : _a.message) !== null && _b !== void 0 ? _b : error === null || error === void 0 ? void 0 : error.message) !== null && _c !== void 0 ? _c : "Something went wrong";
60
+ return Array.isArray(message) ? message.join(", ") : String(message);
61
+ }
62
+ function serializeJson(value) {
63
+ try {
64
+ return JSON.stringify(value);
65
+ }
66
+ catch (_error) {
67
+ return "";
68
+ }
69
+ }
70
+ function deepCloneJson(value) {
71
+ return JSON.parse(JSON.stringify(value));
72
+ }
73
+ function humanizeKey(value) {
74
+ return value
75
+ .replace(/([a-z0-9])([A-Z])/g, "$1 $2")
76
+ .replace(/[_-]+/g, " ")
77
+ .replace(/\s+/g, " ")
78
+ .trim()
79
+ .replace(/^./, function (char) { return char.toUpperCase(); });
80
+ }
81
+ function tokenizePath(path) {
82
+ var tokens = [];
83
+ var regex = /([^[.\]]+)|\[(\d+)\]/g;
84
+ var match;
85
+ while ((match = regex.exec(path)) !== null) {
86
+ if (match[1] !== undefined) {
87
+ tokens.push(match[1]);
88
+ }
89
+ else if (match[2] !== undefined) {
90
+ tokens.push(Number(match[2]));
91
+ }
92
+ }
93
+ return tokens;
94
+ }
95
+ function getValueAtJsonPath(source, path) {
96
+ if (!path)
97
+ return source;
98
+ return tokenizePath(path).reduce(function (current, token) {
99
+ if (current === undefined || current === null)
100
+ return undefined;
101
+ return current[token];
102
+ }, source);
103
+ }
104
+ function setValueAtJsonPath(target, path, value) {
105
+ var tokens = tokenizePath(path);
106
+ if (!tokens.length)
107
+ return;
108
+ var current = target;
109
+ for (var index = 0; index < tokens.length - 1; index += 1) {
110
+ current = current[tokens[index]];
111
+ }
112
+ current[tokens[tokens.length - 1]] = value;
113
+ }
114
+ function appendPath(basePath, key) {
115
+ return basePath ? "".concat(basePath, ".").concat(key) : key;
116
+ }
117
+ function getArrayItemLabel(item, index, parentKey) {
118
+ var labelCandidates = [
119
+ "singularName",
120
+ "name",
121
+ "displayName",
122
+ "pluralName",
123
+ "label",
124
+ "key",
125
+ "title",
126
+ "id",
127
+ ];
128
+ for (var _i = 0, labelCandidates_1 = labelCandidates; _i < labelCandidates_1.length; _i++) {
129
+ var candidate = labelCandidates_1[_i];
130
+ var nextValue = item === null || item === void 0 ? void 0 : item[candidate];
131
+ if (nextValue !== undefined && nextValue !== null && "".concat(nextValue).trim()) {
132
+ return "".concat(nextValue);
133
+ }
134
+ }
135
+ return "".concat(humanizeKey(parentKey || "Item"), " ").concat(index + 1);
136
+ }
137
+ function buildTreeNode(value, options) {
138
+ var label = options.label, path = options.path, parentPath = options.parentPath, sectionKey = options.sectionKey, sectionTitle = options.sectionTitle, hintKey = options.hintKey;
139
+ var children = [];
140
+ if (Array.isArray(value)) {
141
+ children = value
142
+ .filter(function (item) { return item !== null && typeof item === "object"; })
143
+ .map(function (item, index) { return buildTreeNode(item, {
144
+ label: getArrayItemLabel(item, index, hintKey),
145
+ path: "".concat(path, "[").concat(index, "]"),
146
+ parentPath: path,
147
+ sectionKey: sectionKey,
148
+ sectionTitle: sectionTitle,
149
+ hintKey: hintKey,
150
+ }); });
151
+ }
152
+ else if (value && typeof value === "object") {
153
+ children = Object.entries(value)
154
+ .filter(function (_a) {
155
+ var nextValue = _a[1];
156
+ return nextValue !== null && typeof nextValue === "object";
157
+ })
158
+ .map(function (_a) {
159
+ var key = _a[0], nextValue = _a[1];
160
+ return buildTreeNode(nextValue, {
161
+ label: humanizeKey(key),
162
+ path: appendPath(path, key),
163
+ parentPath: path,
164
+ sectionKey: sectionKey,
165
+ sectionTitle: sectionTitle,
166
+ hintKey: key,
167
+ });
168
+ });
169
+ }
170
+ return {
171
+ id: path,
172
+ label: label,
173
+ path: path,
174
+ parentPath: parentPath,
175
+ sectionKey: sectionKey,
176
+ sectionTitle: sectionTitle,
177
+ children: children,
178
+ };
179
+ }
180
+ function buildTreeFromDocument(sections, documentValue) {
181
+ var nodes = sections
182
+ .map(function (section) {
183
+ var sectionValue = getValueAtJsonPath(documentValue, section.jsonPath);
184
+ if (sectionValue === undefined)
185
+ return null;
186
+ return buildTreeNode(sectionValue, {
187
+ label: section.title,
188
+ path: section.jsonPath,
189
+ parentPath: null,
190
+ sectionKey: section.key,
191
+ sectionTitle: section.title,
192
+ hintKey: section.key,
193
+ });
194
+ })
195
+ .filter(Boolean);
196
+ var nodeMap = new Map();
197
+ var visit = function (nextNodes) {
198
+ nextNodes.forEach(function (node) {
199
+ nodeMap.set(node.path, node);
200
+ if (node.children.length)
201
+ visit(node.children);
202
+ });
203
+ };
204
+ visit(nodes);
205
+ return { nodes: nodes, nodeMap: nodeMap };
206
+ }
207
+ function filterTreeNodes(nodes, query) {
208
+ var needle = query.trim().toLowerCase();
209
+ if (!needle)
210
+ return nodes;
211
+ var visit = function (node) {
212
+ var filteredChildren = node.children
213
+ .map(visit)
214
+ .filter(Boolean);
215
+ var matches = node.label.toLowerCase().includes(needle) || node.path.toLowerCase().includes(needle);
216
+ if (matches || filteredChildren.length) {
217
+ return __assign(__assign({}, node), { children: filteredChildren });
218
+ }
219
+ return null;
220
+ };
221
+ return nodes.map(visit).filter(Boolean);
222
+ }
223
+ function getAncestorPaths(nodeMap, path) {
224
+ var paths = [];
225
+ var current = nodeMap.get(path);
226
+ while (current === null || current === void 0 ? void 0 : current.parentPath) {
227
+ paths.push(current.parentPath);
228
+ current = nodeMap.get(current.parentPath);
229
+ }
230
+ return paths;
231
+ }
232
+ function getSectionForPath(sections, path) {
233
+ var _a;
234
+ return (_a = sections
235
+ .filter(function (section) { return path === section.jsonPath || path.startsWith("".concat(section.jsonPath, ".")) || path.startsWith("".concat(section.jsonPath, "[")); })
236
+ .sort(function (left, right) { return right.jsonPath.length - left.jsonPath.length; })[0]) !== null && _a !== void 0 ? _a : null;
237
+ }
238
+ function filterIssuesForPath(issues, path) {
239
+ return issues.filter(function (issue) {
240
+ if (!issue.path)
241
+ return false;
242
+ return issue.path === path || issue.path.startsWith("".concat(path, ".")) || issue.path.startsWith("".concat(path, "["));
243
+ });
244
+ }
245
+ var JsonEditorSurface = React.forwardRef(function JsonEditorSurface(_a, ref) {
246
+ var value = _a.value, resetToken = _a.resetToken, _b = _a.readOnly, readOnly = _b === void 0 ? false : _b, onValueChange = _a.onValueChange, onErrorChange = _a.onErrorChange;
247
+ var containerRef = useRef(null);
248
+ var editorRef = useRef(null);
249
+ // Keep a ref to the latest value so the async init can seed the editor correctly
250
+ var latestValueRef = useRef(value);
251
+ // Sync latest value into ref so async editor init can use it
252
+ useEffect(function () { latestValueRef.current = value; }, [value]);
253
+ var emitState = function () {
254
+ var editor = editorRef.current;
255
+ if (!editor)
256
+ return;
257
+ try {
258
+ var nextValue = editor.get();
259
+ onValueChange(nextValue);
260
+ onErrorChange(null);
261
+ }
262
+ catch (error) {
263
+ onErrorChange((error === null || error === void 0 ? void 0 : error.message) ? String(error.message) : "The JSON is currently invalid.");
264
+ }
265
+ };
266
+ useImperativeHandle(ref, function () { return ({
267
+ format: function () {
268
+ var _a, _b;
269
+ try {
270
+ (_b = (_a = editorRef.current) === null || _a === void 0 ? void 0 : _a.format) === null || _b === void 0 ? void 0 : _b.call(_a);
271
+ }
272
+ catch (_error) {
273
+ // jsoneditor already surfaces parse states through onErrorChange
274
+ }
275
+ emitState();
276
+ },
277
+ }); }, []);
278
+ useEffect(function () {
279
+ if (!containerRef.current || editorRef.current)
280
+ return;
281
+ var destroyed = false;
282
+ // @ts-ignore
283
+ void import("jsoneditor").then(function (jsonEditorModule) {
284
+ var _a, _b, _c;
285
+ if (destroyed || !containerRef.current || editorRef.current) {
286
+ return;
287
+ }
288
+ var JSONEditor = (_a = jsonEditorModule === null || jsonEditorModule === void 0 ? void 0 : jsonEditorModule.default) !== null && _a !== void 0 ? _a : jsonEditorModule;
289
+ editorRef.current = new JSONEditor(containerRef.current, {
290
+ mode: "code",
291
+ modes: ["code"],
292
+ mainMenuBar: true,
293
+ navigationBar: true,
294
+ statusBar: true,
295
+ search: true,
296
+ enableSort: false,
297
+ enableTransform: false,
298
+ onChange: function () { return emitState(); },
299
+ });
300
+ // Seed editor with current value (which may already be set before async init resolved)
301
+ try {
302
+ editorRef.current.set(latestValueRef.current);
303
+ }
304
+ catch (_e) { }
305
+ emitState();
306
+ if ((_c = (_b = editorRef.current) === null || _b === void 0 ? void 0 : _b.aceEditor) === null || _c === void 0 ? void 0 : _c.setReadOnly) {
307
+ editorRef.current.aceEditor.setReadOnly(readOnly);
308
+ }
309
+ });
310
+ return function () {
311
+ var _a, _b;
312
+ destroyed = true;
313
+ (_b = (_a = editorRef.current) === null || _a === void 0 ? void 0 : _a.destroy) === null || _b === void 0 ? void 0 : _b.call(_a);
314
+ editorRef.current = null;
315
+ };
316
+ }, []);
317
+ useEffect(function () {
318
+ if (!editorRef.current)
319
+ return;
320
+ editorRef.current.set(value);
321
+ emitState();
322
+ }, [resetToken, value]);
323
+ useEffect(function () {
324
+ var _a, _b;
325
+ if (!((_b = (_a = editorRef.current) === null || _a === void 0 ? void 0 : _a.aceEditor) === null || _b === void 0 ? void 0 : _b.setReadOnly))
326
+ return;
327
+ editorRef.current.aceEditor.setReadOnly(readOnly);
328
+ }, [readOnly]);
329
+ return _jsx("div", { ref: containerRef, className: "solid-module-explorer-editor-host solid-module-explorer-jsoneditor ".concat(readOnly ? "is-readonly" : "") });
330
+ });
331
+ function MetadataTree(_a) {
332
+ var nodes = _a.nodes, activePath = _a.activePath, expandedPaths = _a.expandedPaths, onToggle = _a.onToggle, onSelect = _a.onSelect, _b = _a.depth, depth = _b === void 0 ? 0 : _b;
333
+ return (_jsx(_Fragment, { children: nodes.map(function (node) {
334
+ var isExpanded = expandedPaths.has(node.path);
335
+ var hasChildren = node.children.length > 0;
336
+ var isActive = activePath === node.path;
337
+ return (_jsxs("div", { className: "solid-module-explorer-tree-node", children: [_jsxs("div", { className: "solid-module-explorer-tree-row ".concat(isActive ? "is-active" : ""), style: { paddingLeft: "".concat(depth * 0.9, "rem") }, children: [_jsx("button", { type: "button", className: "solid-module-explorer-tree-toggle", onClick: function () { return hasChildren && onToggle(node.path); }, "aria-label": hasChildren ? (isExpanded ? "Collapse node" : "Expand node") : "Leaf node", disabled: !hasChildren, children: hasChildren ? (isExpanded ? _jsx(ChevronDown, { size: 14 }) : _jsx(ChevronRight, { size: 14 })) : _jsx("span", { className: "solid-module-explorer-tree-dot" }) }), _jsx("button", { type: "button", className: "solid-module-explorer-tree-label", onClick: function () { return onSelect(node.path); }, title: node.path, children: node.label })] }), hasChildren && isExpanded && (_jsx(MetadataTree, { nodes: node.children, activePath: activePath, expandedPaths: expandedPaths, onToggle: onToggle, onSelect: onSelect, depth: depth + 1 }))] }, node.id));
338
+ }) }));
339
+ }
340
+ export function ModuleMetadataExplorer(_a) {
341
+ var _this = this;
342
+ var _b, _c, _d, _f, _g, _h, _j, _k, _l;
343
+ var moduleName = _a.moduleName, moduleId = _a.moduleId, modelSingularName = _a.modelSingularName, scopedArrayPath = _a.scopedArrayPath, scopedItemValue = _a.scopedItemValue, scopedItemField = _a.scopedItemField, _m = _a.readOnly, readOnly = _m === void 0 ? false : _m, _o = _a.allowSeed, allowSeed = _o === void 0 ? true : _o;
344
+ var dispatch = useDispatch();
345
+ var editorRef = useRef(null);
346
+ var explorerRef = useRef(null);
347
+ var isResizingRef = useRef(false);
348
+ var _p = useState(""), activePath = _p[0], setActivePath = _p[1];
349
+ var _q = useState(new Set()), expandedPaths = _q[0], setExpandedPaths = _q[1];
350
+ var _r = useState(""), treeFilter = _r[0], setTreeFilter = _r[1];
351
+ var _s = useState(280), sidebarWidth = _s[0], setSidebarWidth = _s[1];
352
+ var _t = useState({}), editorValue = _t[0], setEditorValue = _t[1];
353
+ var _u = useState({}), savedValue = _u[0], setSavedValue = _u[1];
354
+ var _v = useState(null), editorError = _v[0], setEditorError = _v[1];
355
+ var _w = useState("initial"), editorResetToken = _w[0], setEditorResetToken = _w[1];
356
+ var _x = useState(null), validationIssues = _x[0], setValidationIssues = _x[1];
357
+ var _y = useState(""), localActionSummary = _y[0], setLocalActionSummary = _y[1];
358
+ var _z = useState(false), isContextDialogOpen = _z[0], setIsContextDialogOpen = _z[1];
359
+ var _0 = useState(false), isSeedDialogOpen = _0[0], setIsSeedDialogOpen = _0[1];
360
+ var _1 = useGetModuleMetadataExplorerManifestQuery(moduleName, {
361
+ skip: !moduleName,
362
+ }), manifestData = _1.data, manifestError = _1.error, refetchManifest = _1.refetch;
363
+ var _2 = useGetModuleMetadataExplorerDocumentQuery(moduleName, {
364
+ skip: !moduleName,
365
+ }), documentData = _2.data, isDocumentLoading = _2.isLoading, documentError = _2.error, refetchDocument = _2.refetch;
366
+ var _3 = useUpdateModuleMetadataExplorerSectionMutation(), updateSection = _3[0], isSavingSection = _3[1].isLoading;
367
+ var _4 = useValidateModuleMetadataExplorerSectionMutation(), validateSection = _4[0], isValidatingSection = _4[1].isLoading;
368
+ var _5 = useSeedModuleMetadataMutation(), seedModuleMetadata = _5[0], isSeedingModule = _5[1].isLoading;
369
+ var isReadOnlyExplorer = readOnly || (moduleName === null || moduleName === void 0 ? void 0 : moduleName.toLowerCase()) === "solid-core";
370
+ var sections = ((_b = manifestData === null || manifestData === void 0 ? void 0 : manifestData.sections) !== null && _b !== void 0 ? _b : []);
371
+ var fullDocument = (_c = documentData === null || documentData === void 0 ? void 0 : documentData.value) !== null && _c !== void 0 ? _c : {};
372
+ var loadError = !manifestData || !documentData ? (manifestError !== null && manifestError !== void 0 ? manifestError : documentError) : null;
373
+ var _6 = useMemo(function () { return buildTreeFromDocument(sections, fullDocument); }, [sections, fullDocument]), treeNodes = _6.nodes, nodeMap = _6.nodeMap;
374
+ var scopedRootPath = useMemo(function () {
375
+ // Scope to a specific model definition
376
+ if (modelSingularName) {
377
+ var models = getValueAtJsonPath(fullDocument, "moduleMetadata.models");
378
+ if (!Array.isArray(models))
379
+ return "";
380
+ var modelIndex = models.findIndex(function (model) { return (model === null || model === void 0 ? void 0 : model.singularName) === modelSingularName; });
381
+ return modelIndex >= 0 ? "moduleMetadata.models[".concat(modelIndex, "]") : "";
382
+ }
383
+ // Scope to a specific item in a root-level array (e.g. views, actions, menus)
384
+ if (scopedArrayPath && scopedItemValue) {
385
+ var arr = getValueAtJsonPath(fullDocument, scopedArrayPath);
386
+ if (!Array.isArray(arr))
387
+ return "";
388
+ var matchField_1 = scopedItemField !== null && scopedItemField !== void 0 ? scopedItemField : "name";
389
+ var itemIndex = arr.findIndex(function (item) { return (item === null || item === void 0 ? void 0 : item[matchField_1]) === scopedItemValue; });
390
+ return itemIndex >= 0 ? "".concat(scopedArrayPath, "[").concat(itemIndex, "]") : "";
391
+ }
392
+ return "";
393
+ }, [fullDocument, modelSingularName, scopedArrayPath, scopedItemValue, scopedItemField]);
394
+ var scopedTreeNodes = useMemo(function () {
395
+ if (!scopedRootPath)
396
+ return treeNodes;
397
+ var scopedNode = nodeMap.get(scopedRootPath);
398
+ return scopedNode ? [scopedNode] : [];
399
+ }, [nodeMap, scopedRootPath, treeNodes]);
400
+ var filteredTreeNodes = useMemo(function () { return filterTreeNodes(scopedTreeNodes, treeFilter); }, [scopedTreeNodes, treeFilter]);
401
+ var visibleExpandedPaths = useMemo(function () {
402
+ if (!treeFilter.trim())
403
+ return expandedPaths;
404
+ var nextExpanded = new Set();
405
+ var visit = function (nodesToVisit) {
406
+ nodesToVisit.forEach(function (node) {
407
+ if (node.children.length) {
408
+ nextExpanded.add(node.path);
409
+ visit(node.children);
410
+ }
411
+ });
412
+ };
413
+ visit(filteredTreeNodes);
414
+ return nextExpanded;
415
+ }, [expandedPaths, filteredTreeNodes, treeFilter]);
416
+ var activeNode = activePath ? (_d = nodeMap.get(activePath)) !== null && _d !== void 0 ? _d : null : null;
417
+ var activeSection = activePath ? getSectionForPath(sections, activePath) : null;
418
+ var activeValidationIssues = filterIssuesForPath(validationIssues !== null && validationIssues !== void 0 ? validationIssues : [], activePath);
419
+ var savedSerialized = serializeJson(savedValue);
420
+ var editorSerialized = serializeJson(editorValue);
421
+ var isDirty = editorError ? true : savedSerialized !== editorSerialized;
422
+ var hasMutableChanges = !isReadOnlyExplorer && isDirty;
423
+ var canSave = !isReadOnlyExplorer && isDirty && !editorError;
424
+ var hasValidationFailure = Boolean(editorError) || activeValidationIssues.length > 0;
425
+ var validationSummary = editorError
426
+ ? editorError
427
+ : activeValidationIssues.length
428
+ ? "".concat(activeValidationIssues.length, " validation issue").concat(activeValidationIssues.length === 1 ? "" : "s", ": ").concat((_g = (_f = activeValidationIssues[0]) === null || _f === void 0 ? void 0 : _f.message) !== null && _g !== void 0 ? _g : "Review this JSON before saving.")
429
+ : "";
430
+ useEffect(function () {
431
+ var _a, _b;
432
+ setValidationIssues((_b = (_a = documentData === null || documentData === void 0 ? void 0 : documentData.validation) === null || _a === void 0 ? void 0 : _a.issues) !== null && _b !== void 0 ? _b : []);
433
+ }, [documentData === null || documentData === void 0 ? void 0 : documentData.lastModifiedAt]);
434
+ useEffect(function () {
435
+ var handlePointerMove = function (event) {
436
+ if (!isResizingRef.current || !explorerRef.current)
437
+ return;
438
+ var bounds = explorerRef.current.getBoundingClientRect();
439
+ var nextWidth = Math.min(Math.max(event.clientX - bounds.left, 220), 520);
440
+ setSidebarWidth(nextWidth);
441
+ };
442
+ var handlePointerUp = function () {
443
+ isResizingRef.current = false;
444
+ document.body.style.cursor = "";
445
+ document.body.style.userSelect = "";
446
+ };
447
+ window.addEventListener("pointermove", handlePointerMove);
448
+ window.addEventListener("pointerup", handlePointerUp);
449
+ return function () {
450
+ window.removeEventListener("pointermove", handlePointerMove);
451
+ window.removeEventListener("pointerup", handlePointerUp);
452
+ };
453
+ }, []);
454
+ useEffect(function () {
455
+ if (!scopedTreeNodes.length)
456
+ return;
457
+ var isPathInsideScope = !scopedRootPath ||
458
+ activePath === scopedRootPath ||
459
+ activePath.startsWith("".concat(scopedRootPath, ".")) ||
460
+ activePath.startsWith("".concat(scopedRootPath, "["));
461
+ if (!activePath || !nodeMap.has(activePath) || !isPathInsideScope) {
462
+ var defaultPath = scopedTreeNodes[0].path;
463
+ setActivePath(defaultPath);
464
+ setExpandedPaths(new Set([defaultPath]));
465
+ }
466
+ }, [activePath, nodeMap, scopedRootPath, scopedTreeNodes]);
467
+ useEffect(function () {
468
+ var _a;
469
+ if (!activePath)
470
+ return;
471
+ var nextValue = getValueAtJsonPath(fullDocument, activePath);
472
+ if (nextValue === undefined)
473
+ return;
474
+ setSavedValue(nextValue);
475
+ setEditorValue(nextValue);
476
+ setEditorError(null);
477
+ setEditorResetToken("".concat(activePath, ":").concat((_a = documentData === null || documentData === void 0 ? void 0 : documentData.lastModifiedAt) !== null && _a !== void 0 ? _a : ""));
478
+ }, [activePath, documentData === null || documentData === void 0 ? void 0 : documentData.lastModifiedAt, fullDocument]);
479
+ var showErrorToast = function (error) {
480
+ dispatch(showToast({
481
+ severity: "error",
482
+ summary: "Metadata Explorer",
483
+ detail: extractApiErrorMessage(error),
484
+ life: 4000,
485
+ }));
486
+ };
487
+ var toggleExpandedPath = function (path) {
488
+ setExpandedPaths(function (current) {
489
+ var next = new Set(current);
490
+ if (next.has(path)) {
491
+ next.delete(path);
492
+ }
493
+ else {
494
+ next.add(path);
495
+ }
496
+ return next;
497
+ });
498
+ };
499
+ var selectPath = function (path) {
500
+ if (path === activePath)
501
+ return;
502
+ if (!isReadOnlyExplorer && isDirty) {
503
+ var shouldProceed = window.confirm("You have unsaved metadata changes. Switch nodes and discard them?");
504
+ if (!shouldProceed)
505
+ return;
506
+ }
507
+ var ancestorPaths = getAncestorPaths(nodeMap, path);
508
+ setExpandedPaths(function (current) {
509
+ var next = new Set(current);
510
+ ancestorPaths.forEach(function (ancestorPath) { return next.add(ancestorPath); });
511
+ return next;
512
+ });
513
+ setActivePath(path);
514
+ };
515
+ var handleSidebarResizeStart = function () {
516
+ isResizingRef.current = true;
517
+ document.body.style.cursor = "col-resize";
518
+ document.body.style.userSelect = "none";
519
+ };
520
+ var handleCollapseAll = function () {
521
+ setExpandedPaths(new Set());
522
+ };
523
+ var handleFormat = function () {
524
+ var _a;
525
+ (_a = editorRef.current) === null || _a === void 0 ? void 0 : _a.format();
526
+ };
527
+ var buildPatchedDocument = function () {
528
+ var nextDocument = deepCloneJson(fullDocument);
529
+ setValueAtJsonPath(nextDocument, activePath, editorValue);
530
+ return nextDocument;
531
+ };
532
+ var buildPatchedSectionValue = function () {
533
+ if (!activeSection)
534
+ return undefined;
535
+ return getValueAtJsonPath(buildPatchedDocument(), activeSection.jsonPath);
536
+ };
537
+ var handleValidate = function () { return __awaiter(_this, void 0, void 0, function () {
538
+ var response, error_1;
539
+ var _a;
540
+ return __generator(this, function (_b) {
541
+ switch (_b.label) {
542
+ case 0:
543
+ if (!moduleName || !activePath || !activeSection)
544
+ return [2 /*return*/];
545
+ if (editorError) {
546
+ setLocalActionSummary("Validation blocked because the JSON is currently invalid.");
547
+ dispatch(showToast({
548
+ severity: "error",
549
+ summary: "Metadata Explorer",
550
+ detail: "Fix the invalid JSON before validating.",
551
+ life: 3500,
552
+ }));
553
+ return [2 /*return*/];
554
+ }
555
+ _b.label = 1;
556
+ case 1:
557
+ _b.trys.push([1, 3, , 4]);
558
+ return [4 /*yield*/, validateSection({
559
+ moduleName: moduleName,
560
+ sectionKey: activeSection.key,
561
+ value: buildPatchedSectionValue(),
562
+ }).unwrap()];
563
+ case 2:
564
+ response = _b.sent();
565
+ setValidationIssues((_a = response === null || response === void 0 ? void 0 : response.issues) !== null && _a !== void 0 ? _a : []);
566
+ setLocalActionSummary((response === null || response === void 0 ? void 0 : response.valid) ? "Validation passed for the current JSON fragment." : "Validation reported issues for the current JSON fragment.");
567
+ dispatch(showToast({
568
+ severity: (response === null || response === void 0 ? void 0 : response.valid) ? "success" : "warn",
569
+ summary: "Metadata Explorer",
570
+ detail: (response === null || response === void 0 ? void 0 : response.valid) ? "Validation passed." : "Validation reported issues.",
571
+ life: 3000,
572
+ }));
573
+ return [3 /*break*/, 4];
574
+ case 3:
575
+ error_1 = _b.sent();
576
+ showErrorToast(error_1);
577
+ return [3 /*break*/, 4];
578
+ case 4: return [2 /*return*/];
579
+ }
580
+ });
581
+ }); };
582
+ var handleSave = function () { return __awaiter(_this, void 0, void 0, function () {
583
+ var response, error_2;
584
+ var _a, _b;
585
+ return __generator(this, function (_c) {
586
+ switch (_c.label) {
587
+ case 0:
588
+ if (!moduleName || !activePath || !activeSection)
589
+ return [2 /*return*/];
590
+ if (editorError) {
591
+ dispatch(showToast({
592
+ severity: "error",
593
+ summary: "Metadata Explorer",
594
+ detail: "Fix the invalid JSON before saving.",
595
+ life: 3500,
596
+ }));
597
+ return [2 /*return*/];
598
+ }
599
+ _c.label = 1;
600
+ case 1:
601
+ _c.trys.push([1, 3, , 4]);
602
+ return [4 /*yield*/, updateSection({
603
+ moduleName: moduleName,
604
+ sectionKey: activeSection.key,
605
+ value: buildPatchedSectionValue(),
606
+ }).unwrap()];
607
+ case 2:
608
+ response = _c.sent();
609
+ setValidationIssues((_b = (_a = response === null || response === void 0 ? void 0 : response.validation) === null || _a === void 0 ? void 0 : _a.issues) !== null && _b !== void 0 ? _b : []);
610
+ setLocalActionSummary("JSON fragment saved to the metadata file.");
611
+ dispatch(showToast({
612
+ severity: "success",
613
+ summary: "Metadata Explorer",
614
+ detail: "Metadata saved successfully.",
615
+ life: 3000,
616
+ }));
617
+ refetchManifest();
618
+ refetchDocument();
619
+ return [3 /*break*/, 4];
620
+ case 3:
621
+ error_2 = _c.sent();
622
+ showErrorToast(error_2);
623
+ return [3 /*break*/, 4];
624
+ case 4: return [2 /*return*/];
625
+ }
626
+ });
627
+ }); };
628
+ var handleSeedModule = function () { return __awaiter(_this, void 0, void 0, function () {
629
+ var response, error_3;
630
+ var _a, _b;
631
+ return __generator(this, function (_c) {
632
+ switch (_c.label) {
633
+ case 0:
634
+ if (!moduleId)
635
+ return [2 /*return*/];
636
+ _c.label = 1;
637
+ case 1:
638
+ _c.trys.push([1, 3, , 4]);
639
+ return [4 /*yield*/, seedModuleMetadata({ id: moduleId }).unwrap()];
640
+ case 2:
641
+ response = _c.sent();
642
+ setIsSeedDialogOpen(false);
643
+ setLocalActionSummary((_a = response === null || response === void 0 ? void 0 : response.message) !== null && _a !== void 0 ? _a : "Seeded metadata for module ".concat(moduleName, "."));
644
+ dispatch(showToast({
645
+ severity: "success",
646
+ summary: "Metadata Explorer",
647
+ detail: (_b = response === null || response === void 0 ? void 0 : response.message) !== null && _b !== void 0 ? _b : "Module metadata seeded successfully.",
648
+ life: 3000,
649
+ }));
650
+ refetchManifest();
651
+ refetchDocument();
652
+ return [3 /*break*/, 4];
653
+ case 3:
654
+ error_3 = _c.sent();
655
+ showErrorToast(error_3);
656
+ return [3 /*break*/, 4];
657
+ case 4: return [2 /*return*/];
658
+ }
659
+ });
660
+ }); };
661
+ if (!moduleName) {
662
+ return null;
663
+ }
664
+ return (_jsxs("div", { className: "solid-module-explorer", children: [_jsxs("div", { className: "solid-module-explorer-panel", children: [loadError && (_jsx("div", { className: "solid-module-explorer-alert", children: _jsx(SolidMessage, { severity: "error", text: "Unable to load metadata explorer: ".concat(extractApiErrorMessage(loadError)), className: "justify-content-start" }) })), _jsxs("div", { ref: explorerRef, className: "solid-module-explorer-workspace", style: { gridTemplateColumns: "".concat(sidebarWidth, "px 8px minmax(0, 1fr)") }, children: [_jsx("aside", { className: "solid-module-explorer-sidebar", children: _jsxs("div", { className: "solid-module-explorer-sidebar-section solid-module-explorer-sidebar-sections", children: [_jsxs("div", { className: "solid-module-explorer-sidebar-heading", children: [_jsxs("div", { className: "solid-module-explorer-sidebar-heading-main", children: [_jsx("div", { className: "solid-module-explorer-sidebar-title", children: modelSingularName ? "Explorer" : "Sections" }), _jsx(SolidTag, { tone: "info", children: modelSingularName ? scopedTreeNodes.length : sections.length })] }), _jsx("button", { type: "button", className: "solid-module-explorer-sidebar-action", onClick: handleCollapseAll, children: "Collapse all" })] }), _jsxs("div", { className: "solid-module-explorer-sidebar-search", children: [_jsx(SolidInput, { value: treeFilter, onChange: function (event) { return setTreeFilter(event.target.value); }, placeholder: "Search metadata tree" }), _jsx("div", { className: "solid-module-explorer-sidebar-search-icon", children: _jsx(Search, { size: 14 }) })] }), _jsx("div", { className: "solid-module-explorer-section-list solid-module-explorer-tree-list", children: _jsx(MetadataTree, { nodes: filteredTreeNodes, activePath: activePath, expandedPaths: visibleExpandedPaths, onToggle: toggleExpandedPath, onSelect: selectPath }) })] }) }), _jsx("div", { className: "solid-module-explorer-resizer", role: "separator", "aria-orientation": "vertical", "aria-label": "Resize metadata navigation panel", onPointerDown: handleSidebarResizeStart }), _jsxs("section", { className: "solid-module-explorer-main", children: [_jsxs("div", { className: "solid-module-explorer-main-header", children: [_jsxs("div", { className: "solid-module-explorer-main-title", children: [_jsxs("div", { className: "solid-module-explorer-main-heading-row", children: [_jsx("h4", { children: (_j = (_h = activeNode === null || activeNode === void 0 ? void 0 : activeNode.label) !== null && _h !== void 0 ? _h : activeSection === null || activeSection === void 0 ? void 0 : activeSection.title) !== null && _j !== void 0 ? _j : "Metadata" }), _jsx("p", { children: activePath || "Choose a metadata node from the tree." })] }), hasValidationFailure && (_jsx("div", { className: "solid-module-explorer-inline-validation", title: validationSummary, children: validationSummary })), isReadOnlyExplorer && (_jsx("div", { className: "solid-module-explorer-readonly-note", children: "This metadata is browse-only in the explorer." }))] }), _jsxs("div", { className: "solid-module-explorer-main-actions", children: [_jsxs("div", { className: "solid-module-explorer-main-meta", children: [hasMutableChanges && _jsx(SolidTag, { tone: "warn", children: "Unsaved changes" }), editorError && _jsx(SolidTag, { tone: "danger", children: "Invalid JSON" }), isReadOnlyExplorer && _jsx(SolidTag, { tone: "info", children: "Read only" })] }), !isReadOnlyExplorer && (_jsx(SolidButton, { size: "sm", leftIcon: _jsx(Save, { size: 14 }), onClick: handleSave, loading: isSavingSection, disabled: !canSave, children: "Save Section" })), _jsxs(SolidDropdownMenu, { children: [_jsx(SolidDropdownMenuTrigger, { asChild: true, children: _jsx(SolidButton, { variant: "ghost", size: "sm", className: "solid-icon-button", "aria-label": "Explorer actions", children: _jsx(Settings, { size: 16 }) }) }), _jsxs(SolidDropdownMenuContent, { className: "solid-module-explorer-actions-menu", children: [!isReadOnlyExplorer && (_jsx(SolidDropdownMenuItem, { onSelect: handleFormat, children: _jsxs("div", { className: "solid-module-explorer-actions-item", children: [_jsx(Wand2, { size: 14 }), _jsx("span", { children: "Format" })] }) })), _jsx(SolidDropdownMenuItem, { onSelect: handleValidate, disabled: isValidatingSection, children: _jsxs("div", { className: "solid-module-explorer-actions-item", children: [_jsx(FileSearch, { size: 14 }), _jsx("span", { children: isValidatingSection ? "Validating..." : "Validate" })] }) }), _jsx(SolidDropdownMenuItem, { onSelect: function () { return setIsContextDialogOpen(true); }, children: _jsxs("div", { className: "solid-module-explorer-actions-item", children: [_jsx(Settings, { size: 14 }), _jsx("span", { children: "Context" })] }) }), allowSeed && (_jsx(SolidDropdownMenuItem, { onSelect: function () { return setIsSeedDialogOpen(true); }, disabled: !moduleId || isSeedingModule, children: _jsxs("div", { className: "solid-module-explorer-actions-item", children: [_jsx(DatabaseZap, { size: 14 }), _jsx("span", { children: isSeedingModule ? "Seeding..." : "Seed" })] }) }))] })] })] })] }), _jsx("div", { className: "solid-module-explorer-editor-wrap", children: _jsx("div", { className: "solid-module-explorer-editor-shell", children: isDocumentLoading ? (_jsx("div", { style: { padding: "1rem" }, className: "solid-module-explorer-empty", children: "Loading metadata JSON..." })) : (_jsx(JsonEditorSurface, { ref: editorRef, value: savedValue, resetToken: editorResetToken, readOnly: isReadOnlyExplorer, onValueChange: setEditorValue, onErrorChange: setEditorError })) }) })] })] })] }), _jsx(SolidDialog, { open: isContextDialogOpen, onOpenChange: setIsContextDialogOpen, header: "Context", contentClassName: "solid-module-explorer-context-dialog", children: _jsx(SolidDialogBody, { children: _jsxs("div", { className: "solid-module-explorer-context-dialog-body", children: [_jsxs("div", { className: "solid-module-explorer-context-dialog-header", children: [_jsx("div", { className: "solid-module-explorer-context-dialog-title", children: (_k = activeNode === null || activeNode === void 0 ? void 0 : activeNode.label) !== null && _k !== void 0 ? _k : "Metadata node" }), _jsx("div", { className: "solid-module-explorer-context-dialog-meta", children: (activeNode === null || activeNode === void 0 ? void 0 : activeNode.sectionTitle) && _jsx(SolidTag, { tone: "info", children: activeNode.sectionTitle }) })] }), _jsxs("div", { className: "solid-module-explorer-context-grid", children: [_jsxs("div", { className: "solid-module-explorer-context-row", children: [_jsx("div", { className: "solid-module-explorer-context-label", children: "JSON Path" }), _jsx("div", { className: "solid-module-explorer-context-value", children: activePath || "-" })] }), _jsxs("div", { className: "solid-module-explorer-context-row", children: [_jsx("div", { className: "solid-module-explorer-context-label", children: "File" }), _jsx("div", { className: "solid-module-explorer-context-value", children: (_l = manifestData === null || manifestData === void 0 ? void 0 : manifestData.filePath) !== null && _l !== void 0 ? _l : "-" })] }), localActionSummary && (_jsxs("div", { className: "solid-module-explorer-context-row", children: [_jsx("div", { className: "solid-module-explorer-context-label", children: "Last Action" }), _jsx("div", { className: "solid-module-explorer-context-value", children: localActionSummary })] }))] }), _jsx("div", { className: "solid-module-explorer-context-note", children: "Clicking any branch or leaf in the tree opens that exact JSON fragment on the right." })] }) }) }), _jsxs(SolidDialog, { open: isSeedDialogOpen, onOpenChange: setIsSeedDialogOpen, contentClassName: "solid-module-explorer-seed-dialog", children: [_jsx(SolidDialogHeader, { children: _jsx(SolidDialogTitle, { children: "Seed Module Metadata" }) }), _jsx(SolidDialogSeparator, {}), _jsx(SolidDialogBody, { children: _jsxs("div", { className: "solid-module-explorer-seed-dialog-body", children: [_jsxs("p", { children: ["Re-seed metadata for ", _jsx("strong", { children: moduleName }), " from its JSON file?"] }), _jsx("p", { className: "solid-module-explorer-seed-dialog-note", children: "This only re-runs metadata seeding for the current module and refreshes database metadata from the module JSON." })] }) }), _jsxs(SolidDialogFooter, { children: [_jsx(SolidButton, { variant: "outline", size: "sm", onClick: function () { return setIsSeedDialogOpen(false); }, disabled: isSeedingModule, children: "Cancel" }), _jsx(SolidButton, { size: "sm", onClick: handleSeedModule, loading: isSeedingModule, disabled: !moduleId, children: "Seed" })] })] })] }));
665
+ }
666
+ //# sourceMappingURL=ModuleMetadataExplorer.js.map