@trops/dash-core 0.1.265 → 0.1.266
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.
- package/dist/index.esm.js +49 -42
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +49 -42
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -45069,7 +45069,7 @@ var useInstalledWidgets = function useInstalledWidgets() {
|
|
|
45069
45069
|
error = _useState6[0],
|
|
45070
45070
|
setError = _useState6[1];
|
|
45071
45071
|
var refresh = React.useCallback(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
45072
|
-
var _window$mainApi, cMap, builtinWidgets,
|
|
45072
|
+
var _window$mainApi, cMap, builtinWidgets, registryByName, list, installedFromCM, cmSourcePackages, fallbackInstalled, _t;
|
|
45073
45073
|
return _regeneratorRuntime.wrap(function (_context) {
|
|
45074
45074
|
while (1) switch (_context.prev = _context.next) {
|
|
45075
45075
|
case 0:
|
|
@@ -45098,11 +45098,11 @@ var useInstalledWidgets = function useInstalledWidgets() {
|
|
|
45098
45098
|
workspace: config.workspace || null,
|
|
45099
45099
|
componentNames: [key]
|
|
45100
45100
|
};
|
|
45101
|
-
}); // ── Installed widgets from
|
|
45102
|
-
//
|
|
45103
|
-
//
|
|
45104
|
-
//
|
|
45105
|
-
|
|
45101
|
+
}); // ── Installed widgets from ComponentManager + Registry ───
|
|
45102
|
+
// CM entries with _sourcePackage are registry-installed widgets.
|
|
45103
|
+
// Show each as an individual "installed" entry, enriched with
|
|
45104
|
+
// registry-level metadata (version, path, packageId).
|
|
45105
|
+
registryByName = {};
|
|
45106
45106
|
if (!((_window$mainApi = window.mainApi) !== null && _window$mainApi !== void 0 && _window$mainApi.widgets)) {
|
|
45107
45107
|
_context.next = 3;
|
|
45108
45108
|
break;
|
|
@@ -45111,50 +45111,57 @@ var useInstalledWidgets = function useInstalledWidgets() {
|
|
|
45111
45111
|
return window.mainApi.widgets.list();
|
|
45112
45112
|
case 2:
|
|
45113
45113
|
list = _context.sent;
|
|
45114
|
-
|
|
45115
|
-
|
|
45116
|
-
|
|
45117
|
-
|
|
45118
|
-
|
|
45119
|
-
|
|
45120
|
-
|
|
45121
|
-
|
|
45122
|
-
|
|
45123
|
-
|
|
45124
|
-
|
|
45114
|
+
(list || []).forEach(function (w) {
|
|
45115
|
+
registryByName[w.name] = w;
|
|
45116
|
+
});
|
|
45117
|
+
case 3:
|
|
45118
|
+
installedFromCM = Object.keys(cMap).filter(function (key) {
|
|
45119
|
+
return cMap[key].type === "widget" && !!cMap[key]._sourcePackage;
|
|
45120
|
+
}).map(function (key) {
|
|
45121
|
+
var config = cMap[key];
|
|
45122
|
+
var reg = registryByName[config._sourcePackage] || {};
|
|
45123
|
+
return {
|
|
45124
|
+
name: key,
|
|
45125
|
+
displayName: config.name || key,
|
|
45126
|
+
author: config.author || reg.author || null,
|
|
45127
|
+
"package": config["package"] || null,
|
|
45128
|
+
description: config.description || null,
|
|
45129
|
+
icon: config.icon || null,
|
|
45130
|
+
version: reg.version || null,
|
|
45131
|
+
path: reg.path || null,
|
|
45132
|
+
source: "installed",
|
|
45133
|
+
providers: config.providers || [],
|
|
45134
|
+
workspace: config.workspace || null,
|
|
45135
|
+
componentNames: [key],
|
|
45136
|
+
packageId: reg.packageId || config._sourcePackage
|
|
45137
|
+
};
|
|
45138
|
+
}); // Fallback: registry packages whose components never loaded
|
|
45139
|
+
// into CM (e.g. compile failure). Show the package-level entry.
|
|
45140
|
+
cmSourcePackages = new Set(Object.values(cMap).filter(function (c) {
|
|
45141
|
+
return c._sourcePackage;
|
|
45142
|
+
}).map(function (c) {
|
|
45143
|
+
return c._sourcePackage;
|
|
45144
|
+
}));
|
|
45145
|
+
fallbackInstalled = Object.values(registryByName).filter(function (w) {
|
|
45146
|
+
return !cmSourcePackages.has(w.name);
|
|
45147
|
+
}).map(function (w) {
|
|
45125
45148
|
return {
|
|
45126
45149
|
name: w.name,
|
|
45127
|
-
displayName: w.displayName ||
|
|
45128
|
-
author: w.author ||
|
|
45129
|
-
"package": w["package"] ||
|
|
45130
|
-
description: w.description ||
|
|
45131
|
-
icon: w.icon ||
|
|
45150
|
+
displayName: w.displayName || w.name,
|
|
45151
|
+
author: w.author || null,
|
|
45152
|
+
"package": w["package"] || null,
|
|
45153
|
+
description: w.description || null,
|
|
45154
|
+
icon: w.icon || null,
|
|
45132
45155
|
version: w.version || null,
|
|
45133
45156
|
path: w.path || null,
|
|
45134
45157
|
source: "installed",
|
|
45135
|
-
providers:
|
|
45136
|
-
workspace: w.workspace ||
|
|
45137
|
-
componentNames: w.componentNames ||
|
|
45158
|
+
providers: w.providers || [],
|
|
45159
|
+
workspace: w.workspace || null,
|
|
45160
|
+
componentNames: w.componentNames || [],
|
|
45138
45161
|
packageId: w.packageId || w.name
|
|
45139
45162
|
};
|
|
45140
45163
|
});
|
|
45141
|
-
|
|
45142
|
-
// ── Merge: installed wins on name collision ──────────────
|
|
45143
|
-
// Also remove builtin entries whose _sourcePackage matches an
|
|
45144
|
-
// installed widget name (e.g. builtin "WeatherWidget" with
|
|
45145
|
-
// _sourcePackage "weather-widget" is the same as installed
|
|
45146
|
-
// "weather-widget").
|
|
45147
|
-
installedNames = new Set(installedWidgets.map(function (w) {
|
|
45148
|
-
return w.name;
|
|
45149
|
-
}));
|
|
45150
|
-
deduped = builtinWidgets.filter(function (w) {
|
|
45151
|
-
var _cMap$w$name;
|
|
45152
|
-
if (installedNames.has(w.name)) return false;
|
|
45153
|
-
var sp = (_cMap$w$name = cMap[w.name]) === null || _cMap$w$name === void 0 ? void 0 : _cMap$w$name._sourcePackage;
|
|
45154
|
-
if (sp && installedNames.has(sp)) return false;
|
|
45155
|
-
return true;
|
|
45156
|
-
});
|
|
45157
|
-
setWidgets([].concat(_toConsumableArray(deduped), _toConsumableArray(installedWidgets)));
|
|
45164
|
+
setWidgets([].concat(_toConsumableArray(builtinWidgets), _toConsumableArray(installedFromCM), _toConsumableArray(fallbackInstalled)));
|
|
45158
45165
|
_context.next = 5;
|
|
45159
45166
|
break;
|
|
45160
45167
|
case 4:
|