@trops/dash-core 0.1.560 → 0.1.562
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/electron/index.js +429 -28
- package/dist/electron/index.js.map +1 -1
- package/dist/index.esm.js +54 -10
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +54 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -18977,18 +18977,38 @@ var WidgetCardHeader = function WidgetCardHeader(_ref) {
|
|
|
18977
18977
|
};
|
|
18978
18978
|
var providerRequirements = getProviderRequirements();
|
|
18979
18979
|
|
|
18980
|
-
//
|
|
18981
|
-
//
|
|
18982
|
-
//
|
|
18983
|
-
|
|
18984
|
-
|
|
18980
|
+
// App providers — needed to detect when a global default
|
|
18981
|
+
// (`isDefaultForType: true`) exists for a required provider type.
|
|
18982
|
+
// The runtime resolution chain in useMcpProvider / useWebSocketProvider
|
|
18983
|
+
// falls through to the default when no per-instance pick is set, so
|
|
18984
|
+
// the amber-dot indicator should respect that fallback: a widget
|
|
18985
|
+
// whose required type has a default ISN'T actually unresolved.
|
|
18986
|
+
// Without this, the dot fires on every widget the user hasn't
|
|
18987
|
+
// explicitly bound, even though the runtime is happy.
|
|
18988
|
+
var appCtx = React.useContext(AppContext);
|
|
18989
|
+
var appProviders = (appCtx === null || appCtx === void 0 ? void 0 : appCtx.providers) || {};
|
|
18990
|
+
|
|
18991
|
+
// Check if a required provider has a resolved provider for it —
|
|
18992
|
+
// either a per-instance pick OR a global `isDefaultForType: true`
|
|
18993
|
+
// provider of the matching type. Mirrors the resolution chain in
|
|
18994
|
+
// `utils/providerResolution.js` so the indicator agrees with what
|
|
18995
|
+
// the runtime hook actually does.
|
|
18996
|
+
var isProviderResolved = function isProviderResolved(providerType) {
|
|
18997
|
+
if (selectedProviders[providerType] != null) return true;
|
|
18998
|
+
// Walk appProviders looking for a default of this type.
|
|
18999
|
+
var entries = appProviders && _typeof(appProviders) === "object" ? Object.values(appProviders) : [];
|
|
19000
|
+
return entries.some(function (p) {
|
|
19001
|
+
return p && p.type === providerType && p.isDefaultForType === true;
|
|
19002
|
+
});
|
|
18985
19003
|
};
|
|
18986
19004
|
|
|
18987
|
-
// True when any required provider
|
|
18988
|
-
//
|
|
18989
|
-
//
|
|
19005
|
+
// True when any required provider has neither a per-instance pick
|
|
19006
|
+
// nor a global default — drives the amber dot on the overflow
|
|
19007
|
+
// button + the "!" badge on the Providers menu item so the user
|
|
19008
|
+
// can see truly-unresolved state at a glance. Widgets relying on
|
|
19009
|
+
// a global default no longer trip this.
|
|
18990
19010
|
var hasUnresolvedRequiredProvider = providerRequirements.some(function (req) {
|
|
18991
|
-
return req.required && !
|
|
19011
|
+
return req.required && !isProviderResolved(req.type);
|
|
18992
19012
|
});
|
|
18993
19013
|
|
|
18994
19014
|
// Build overflow actions list — single source of truth for the
|
|
@@ -32351,6 +32371,12 @@ function _arrayLikeToArray$q(r, a) { (null == a || a > r.length) && (a = r.lengt
|
|
|
32351
32371
|
* Matches the provider resolution pattern used by useMcpProvider:
|
|
32352
32372
|
* 1. Widget-level: widgetData.selectedProviders[providerType] (set by handleSelectProvider on the layout item)
|
|
32353
32373
|
* 2. Workspace-level fallback: workspace.workspaceData.selectedProviders[widgetId][providerType]
|
|
32374
|
+
* 3. App-default fallback: any provider of matching type flagged `isDefaultForType` in AppContext.providers
|
|
32375
|
+
* (managed via Settings → Providers "Use as default…" toggle)
|
|
32376
|
+
* 4. null — widget surfaces its own "no provider" empty state
|
|
32377
|
+
*
|
|
32378
|
+
* Existing widgets/workspaces retain their explicit bindings; the default layer only
|
|
32379
|
+
* activates for widgets with no explicit binding (mirrors useMcpProvider exactly).
|
|
32354
32380
|
*
|
|
32355
32381
|
* Reads provider data from AppContext.providers (not DashboardContext.providers, which has a
|
|
32356
32382
|
* structural issue where providers don't flow through from AppWrapper).
|
|
@@ -32392,9 +32418,10 @@ var useWidgetProviders = function useWidgetProviders() {
|
|
|
32392
32418
|
// Get all provider type declarations from the widget config
|
|
32393
32419
|
var providerDeclarations = (widgetData === null || widgetData === void 0 ? void 0 : widgetData.providers) || [];
|
|
32394
32420
|
|
|
32395
|
-
// Resolve each declared provider using the same
|
|
32421
|
+
// Resolve each declared provider using the same three-layer lookup as useMcpProvider:
|
|
32396
32422
|
// 1. Widget-level: stored directly on the layout item by handleSelectProvider
|
|
32397
32423
|
// 2. Workspace-level: stored as workspace.selectedProviders[widgetId][providerType]
|
|
32424
|
+
// 3. App-default: any provider in AppContext.providers flagged isDefaultForType
|
|
32398
32425
|
var providers = {};
|
|
32399
32426
|
var _iterator = _createForOfIteratorHelper$q(providerDeclarations),
|
|
32400
32427
|
_step;
|
|
@@ -32413,6 +32440,23 @@ var useWidgetProviders = function useWidgetProviders() {
|
|
|
32413
32440
|
providerName = (workspace === null || workspace === void 0 || (_workspace$workspaceD = workspace.workspaceData) === null || _workspace$workspaceD === void 0 || (_workspace$workspaceD = _workspace$workspaceD.selectedProviders) === null || _workspace$workspaceD === void 0 || (_workspace$workspaceD = _workspace$workspaceD[widgetId]) === null || _workspace$workspaceD === void 0 ? void 0 : _workspace$workspaceD[providerType]) || null;
|
|
32414
32441
|
}
|
|
32415
32442
|
|
|
32443
|
+
// 3. App-default fallback — only kicks in for widgets with no explicit
|
|
32444
|
+
// per-widget or per-workspace binding. Walking the map is O(N)
|
|
32445
|
+
// in the provider count, which is small (typically <20 even for
|
|
32446
|
+
// heavy users); the cost is bounded and the lookup runs once per
|
|
32447
|
+
// declared provider type per render.
|
|
32448
|
+
if (!providerName && app !== null && app !== void 0 && app.providers && _typeof(app.providers) === "object") {
|
|
32449
|
+
for (var _i = 0, _Object$entries = Object.entries(app.providers); _i < _Object$entries.length; _i++) {
|
|
32450
|
+
var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
|
|
32451
|
+
name = _Object$entries$_i[0],
|
|
32452
|
+
data = _Object$entries$_i[1];
|
|
32453
|
+
if ((data === null || data === void 0 ? void 0 : data.type) === providerType && (data === null || data === void 0 ? void 0 : data.isDefaultForType) === true) {
|
|
32454
|
+
providerName = name;
|
|
32455
|
+
break;
|
|
32456
|
+
}
|
|
32457
|
+
}
|
|
32458
|
+
}
|
|
32459
|
+
|
|
32416
32460
|
// Look up from AppContext.providers (not DashboardContext)
|
|
32417
32461
|
if (providerName) {
|
|
32418
32462
|
var _app$providers;
|