@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.esm.js
CHANGED
|
@@ -45051,7 +45051,7 @@ var useInstalledWidgets = function useInstalledWidgets() {
|
|
|
45051
45051
|
error = _useState6[0],
|
|
45052
45052
|
setError = _useState6[1];
|
|
45053
45053
|
var refresh = useCallback(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
45054
|
-
var _window$mainApi, cMap, builtinWidgets,
|
|
45054
|
+
var _window$mainApi, cMap, builtinWidgets, registryByName, list, installedFromCM, cmSourcePackages, fallbackInstalled, _t;
|
|
45055
45055
|
return _regeneratorRuntime.wrap(function (_context) {
|
|
45056
45056
|
while (1) switch (_context.prev = _context.next) {
|
|
45057
45057
|
case 0:
|
|
@@ -45080,11 +45080,11 @@ var useInstalledWidgets = function useInstalledWidgets() {
|
|
|
45080
45080
|
workspace: config.workspace || null,
|
|
45081
45081
|
componentNames: [key]
|
|
45082
45082
|
};
|
|
45083
|
-
}); // ── Installed widgets from
|
|
45084
|
-
//
|
|
45085
|
-
//
|
|
45086
|
-
//
|
|
45087
|
-
|
|
45083
|
+
}); // ── Installed widgets from ComponentManager + Registry ───
|
|
45084
|
+
// CM entries with _sourcePackage are registry-installed widgets.
|
|
45085
|
+
// Show each as an individual "installed" entry, enriched with
|
|
45086
|
+
// registry-level metadata (version, path, packageId).
|
|
45087
|
+
registryByName = {};
|
|
45088
45088
|
if (!((_window$mainApi = window.mainApi) !== null && _window$mainApi !== void 0 && _window$mainApi.widgets)) {
|
|
45089
45089
|
_context.next = 3;
|
|
45090
45090
|
break;
|
|
@@ -45093,50 +45093,57 @@ var useInstalledWidgets = function useInstalledWidgets() {
|
|
|
45093
45093
|
return window.mainApi.widgets.list();
|
|
45094
45094
|
case 2:
|
|
45095
45095
|
list = _context.sent;
|
|
45096
|
-
|
|
45097
|
-
|
|
45098
|
-
|
|
45099
|
-
|
|
45100
|
-
|
|
45101
|
-
|
|
45102
|
-
|
|
45103
|
-
|
|
45104
|
-
|
|
45105
|
-
|
|
45106
|
-
|
|
45096
|
+
(list || []).forEach(function (w) {
|
|
45097
|
+
registryByName[w.name] = w;
|
|
45098
|
+
});
|
|
45099
|
+
case 3:
|
|
45100
|
+
installedFromCM = Object.keys(cMap).filter(function (key) {
|
|
45101
|
+
return cMap[key].type === "widget" && !!cMap[key]._sourcePackage;
|
|
45102
|
+
}).map(function (key) {
|
|
45103
|
+
var config = cMap[key];
|
|
45104
|
+
var reg = registryByName[config._sourcePackage] || {};
|
|
45105
|
+
return {
|
|
45106
|
+
name: key,
|
|
45107
|
+
displayName: config.name || key,
|
|
45108
|
+
author: config.author || reg.author || null,
|
|
45109
|
+
"package": config["package"] || null,
|
|
45110
|
+
description: config.description || null,
|
|
45111
|
+
icon: config.icon || null,
|
|
45112
|
+
version: reg.version || null,
|
|
45113
|
+
path: reg.path || null,
|
|
45114
|
+
source: "installed",
|
|
45115
|
+
providers: config.providers || [],
|
|
45116
|
+
workspace: config.workspace || null,
|
|
45117
|
+
componentNames: [key],
|
|
45118
|
+
packageId: reg.packageId || config._sourcePackage
|
|
45119
|
+
};
|
|
45120
|
+
}); // Fallback: registry packages whose components never loaded
|
|
45121
|
+
// into CM (e.g. compile failure). Show the package-level entry.
|
|
45122
|
+
cmSourcePackages = new Set(Object.values(cMap).filter(function (c) {
|
|
45123
|
+
return c._sourcePackage;
|
|
45124
|
+
}).map(function (c) {
|
|
45125
|
+
return c._sourcePackage;
|
|
45126
|
+
}));
|
|
45127
|
+
fallbackInstalled = Object.values(registryByName).filter(function (w) {
|
|
45128
|
+
return !cmSourcePackages.has(w.name);
|
|
45129
|
+
}).map(function (w) {
|
|
45107
45130
|
return {
|
|
45108
45131
|
name: w.name,
|
|
45109
|
-
displayName: w.displayName ||
|
|
45110
|
-
author: w.author ||
|
|
45111
|
-
"package": w["package"] ||
|
|
45112
|
-
description: w.description ||
|
|
45113
|
-
icon: w.icon ||
|
|
45132
|
+
displayName: w.displayName || w.name,
|
|
45133
|
+
author: w.author || null,
|
|
45134
|
+
"package": w["package"] || null,
|
|
45135
|
+
description: w.description || null,
|
|
45136
|
+
icon: w.icon || null,
|
|
45114
45137
|
version: w.version || null,
|
|
45115
45138
|
path: w.path || null,
|
|
45116
45139
|
source: "installed",
|
|
45117
|
-
providers:
|
|
45118
|
-
workspace: w.workspace ||
|
|
45119
|
-
componentNames: w.componentNames ||
|
|
45140
|
+
providers: w.providers || [],
|
|
45141
|
+
workspace: w.workspace || null,
|
|
45142
|
+
componentNames: w.componentNames || [],
|
|
45120
45143
|
packageId: w.packageId || w.name
|
|
45121
45144
|
};
|
|
45122
45145
|
});
|
|
45123
|
-
|
|
45124
|
-
// ── Merge: installed wins on name collision ──────────────
|
|
45125
|
-
// Also remove builtin entries whose _sourcePackage matches an
|
|
45126
|
-
// installed widget name (e.g. builtin "WeatherWidget" with
|
|
45127
|
-
// _sourcePackage "weather-widget" is the same as installed
|
|
45128
|
-
// "weather-widget").
|
|
45129
|
-
installedNames = new Set(installedWidgets.map(function (w) {
|
|
45130
|
-
return w.name;
|
|
45131
|
-
}));
|
|
45132
|
-
deduped = builtinWidgets.filter(function (w) {
|
|
45133
|
-
var _cMap$w$name;
|
|
45134
|
-
if (installedNames.has(w.name)) return false;
|
|
45135
|
-
var sp = (_cMap$w$name = cMap[w.name]) === null || _cMap$w$name === void 0 ? void 0 : _cMap$w$name._sourcePackage;
|
|
45136
|
-
if (sp && installedNames.has(sp)) return false;
|
|
45137
|
-
return true;
|
|
45138
|
-
});
|
|
45139
|
-
setWidgets([].concat(_toConsumableArray(deduped), _toConsumableArray(installedWidgets)));
|
|
45146
|
+
setWidgets([].concat(_toConsumableArray(builtinWidgets), _toConsumableArray(installedFromCM), _toConsumableArray(fallbackInstalled)));
|
|
45140
45147
|
_context.next = 5;
|
|
45141
45148
|
break;
|
|
45142
45149
|
case 4:
|