@trops/dash-core 0.1.556 → 0.1.561
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 +75 -13
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +75 -13
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -14412,7 +14412,35 @@ var PanelEditItemProviders = function PanelEditItemProviders(_ref) {
|
|
|
14412
14412
|
}, p);
|
|
14413
14413
|
});
|
|
14414
14414
|
var isConfigured = !!current;
|
|
14415
|
-
|
|
14415
|
+
// Detect the global default for this type. If one exists,
|
|
14416
|
+
// the runtime resolution chain (widget → workspace → app
|
|
14417
|
+
// default → null, see useMcpProvider.js + providerResolution.js)
|
|
14418
|
+
// will use it even when no per-instance override is set —
|
|
14419
|
+
// so the user isn't actually missing anything.
|
|
14420
|
+
//
|
|
14421
|
+
// Without this fallback awareness the UI flagged every
|
|
14422
|
+
// widget with no per-instance pick as "REQUIRED" in red,
|
|
14423
|
+
// even though the widget worked fine at runtime via the
|
|
14424
|
+
// default. Three states now drive the styling instead of
|
|
14425
|
+
// two:
|
|
14426
|
+
// - overridden: user explicitly picked a per-instance
|
|
14427
|
+
// provider → neutral panel + "override" tag
|
|
14428
|
+
// - using-default: per-instance empty but a global
|
|
14429
|
+
// default exists → neutral panel + "using default
|
|
14430
|
+
// <name>" hint
|
|
14431
|
+
// - missing: per-instance empty AND no global default
|
|
14432
|
+
// for this type → red panel + "REQUIRED" tag
|
|
14433
|
+
var defaultOption = options.find(function (o) {
|
|
14434
|
+
return o.isDefaultForType;
|
|
14435
|
+
});
|
|
14436
|
+
var isUsingDefault = !isConfigured && !!defaultOption;
|
|
14437
|
+
var isMissing = req.required && !isConfigured && !defaultOption;
|
|
14438
|
+
// resolvedName is what runtime will actually use — either
|
|
14439
|
+
// the per-instance override, or the global default if one
|
|
14440
|
+
// exists. Surfaced in the "using default" hint so the user
|
|
14441
|
+
// can see which provider is actually wired in without
|
|
14442
|
+
// opening Settings → Providers.
|
|
14443
|
+
var resolvedName = isConfigured ? current : isUsingDefault ? defaultOption.name : null;
|
|
14416
14444
|
return /*#__PURE__*/jsxs("div", {
|
|
14417
14445
|
className: "rounded border px-3 py-2 ".concat(isMissing ? "bg-red-900 border-red-500" : "bg-gray-800 border-gray-700"),
|
|
14418
14446
|
children: [/*#__PURE__*/jsxs("div", {
|
|
@@ -14423,10 +14451,24 @@ var PanelEditItemProviders = function PanelEditItemProviders(_ref) {
|
|
|
14423
14451
|
}), /*#__PURE__*/jsx("span", {
|
|
14424
14452
|
className: "text-[10px] uppercase tracking-wide px-1.5 py-0.5 rounded font-semibold ".concat(isMissing ? "bg-red-600 text-white" : req.required ? "bg-indigo-800 text-indigo-100" : "bg-gray-700 text-gray-300"),
|
|
14425
14453
|
children: req.required ? "required" : "optional"
|
|
14454
|
+
}), isUsingDefault && /*#__PURE__*/jsx("span", {
|
|
14455
|
+
className: "text-[10px] uppercase tracking-wide px-1.5 py-0.5 rounded font-semibold bg-emerald-800 text-emerald-100",
|
|
14456
|
+
title: "No per-widget override set \u2014 runtime resolves to the global default \"".concat(resolvedName, "\" (Settings \u2192 Providers)."),
|
|
14457
|
+
children: "using default"
|
|
14458
|
+
}), isConfigured && /*#__PURE__*/jsx("span", {
|
|
14459
|
+
className: "text-[10px] uppercase tracking-wide px-1.5 py-0.5 rounded font-semibold bg-indigo-900 text-indigo-200",
|
|
14460
|
+
title: "A per-widget provider is set; overrides the global default.",
|
|
14461
|
+
children: "override"
|
|
14426
14462
|
})]
|
|
14427
14463
|
}), req.description && /*#__PURE__*/jsx("div", {
|
|
14428
14464
|
className: "text-xs opacity-60 mt-1",
|
|
14429
14465
|
children: req.description
|
|
14466
|
+
}), isUsingDefault && /*#__PURE__*/jsxs("div", {
|
|
14467
|
+
className: "mt-1 text-[11px] text-emerald-300",
|
|
14468
|
+
children: ["Using global default:", " ", /*#__PURE__*/jsx("span", {
|
|
14469
|
+
className: "font-mono",
|
|
14470
|
+
children: resolvedName
|
|
14471
|
+
}), ". Pick a specific provider below to override."]
|
|
14430
14472
|
}), /*#__PURE__*/jsxs("div", {
|
|
14431
14473
|
className: "mt-2",
|
|
14432
14474
|
children: [/*#__PURE__*/jsxs("select", {
|
|
@@ -14437,11 +14479,11 @@ var PanelEditItemProviders = function PanelEditItemProviders(_ref) {
|
|
|
14437
14479
|
className: "w-full bg-gray-900 border rounded px-2 py-1.5 text-sm ".concat(isMissing ? "border-red-500" : "border-gray-700"),
|
|
14438
14480
|
children: [/*#__PURE__*/jsx("option", {
|
|
14439
14481
|
value: "",
|
|
14440
|
-
children: req.required ? "— select a provider —" : "— none —"
|
|
14482
|
+
children: isUsingDefault ? "\u2014 use default (".concat(resolvedName, ") \u2014") : req.required ? "— select a provider —" : "— none —"
|
|
14441
14483
|
}), options.map(function (opt) {
|
|
14442
|
-
return /*#__PURE__*/
|
|
14484
|
+
return /*#__PURE__*/jsxs("option", {
|
|
14443
14485
|
value: opt.name,
|
|
14444
|
-
children: opt.name
|
|
14486
|
+
children: [opt.name, opt.isDefaultForType ? " (default)" : ""]
|
|
14445
14487
|
}, opt.name);
|
|
14446
14488
|
})]
|
|
14447
14489
|
}), options.length === 0 && /*#__PURE__*/jsxs("div", {
|
|
@@ -18917,18 +18959,38 @@ var WidgetCardHeader = function WidgetCardHeader(_ref) {
|
|
|
18917
18959
|
};
|
|
18918
18960
|
var providerRequirements = getProviderRequirements();
|
|
18919
18961
|
|
|
18920
|
-
//
|
|
18921
|
-
//
|
|
18922
|
-
//
|
|
18923
|
-
|
|
18924
|
-
|
|
18962
|
+
// App providers — needed to detect when a global default
|
|
18963
|
+
// (`isDefaultForType: true`) exists for a required provider type.
|
|
18964
|
+
// The runtime resolution chain in useMcpProvider / useWebSocketProvider
|
|
18965
|
+
// falls through to the default when no per-instance pick is set, so
|
|
18966
|
+
// the amber-dot indicator should respect that fallback: a widget
|
|
18967
|
+
// whose required type has a default ISN'T actually unresolved.
|
|
18968
|
+
// Without this, the dot fires on every widget the user hasn't
|
|
18969
|
+
// explicitly bound, even though the runtime is happy.
|
|
18970
|
+
var appCtx = useContext(AppContext);
|
|
18971
|
+
var appProviders = (appCtx === null || appCtx === void 0 ? void 0 : appCtx.providers) || {};
|
|
18972
|
+
|
|
18973
|
+
// Check if a required provider has a resolved provider for it —
|
|
18974
|
+
// either a per-instance pick OR a global `isDefaultForType: true`
|
|
18975
|
+
// provider of the matching type. Mirrors the resolution chain in
|
|
18976
|
+
// `utils/providerResolution.js` so the indicator agrees with what
|
|
18977
|
+
// the runtime hook actually does.
|
|
18978
|
+
var isProviderResolved = function isProviderResolved(providerType) {
|
|
18979
|
+
if (selectedProviders[providerType] != null) return true;
|
|
18980
|
+
// Walk appProviders looking for a default of this type.
|
|
18981
|
+
var entries = appProviders && _typeof(appProviders) === "object" ? Object.values(appProviders) : [];
|
|
18982
|
+
return entries.some(function (p) {
|
|
18983
|
+
return p && p.type === providerType && p.isDefaultForType === true;
|
|
18984
|
+
});
|
|
18925
18985
|
};
|
|
18926
18986
|
|
|
18927
|
-
// True when any required provider
|
|
18928
|
-
//
|
|
18929
|
-
//
|
|
18987
|
+
// True when any required provider has neither a per-instance pick
|
|
18988
|
+
// nor a global default — drives the amber dot on the overflow
|
|
18989
|
+
// button + the "!" badge on the Providers menu item so the user
|
|
18990
|
+
// can see truly-unresolved state at a glance. Widgets relying on
|
|
18991
|
+
// a global default no longer trip this.
|
|
18930
18992
|
var hasUnresolvedRequiredProvider = providerRequirements.some(function (req) {
|
|
18931
|
-
return req.required && !
|
|
18993
|
+
return req.required && !isProviderResolved(req.type);
|
|
18932
18994
|
});
|
|
18933
18995
|
|
|
18934
18996
|
// Build overflow actions list — single source of truth for the
|