@trops/dash-core 0.1.104 → 0.1.106
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 +104 -13
- package/dist/electron/index.js.map +1 -1
- package/dist/index.esm.js +161 -34
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +161 -34
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -31096,13 +31096,16 @@ var PublishDashboardModal = function PublishDashboardModal(_ref) {
|
|
|
31096
31096
|
children: authorName || "—"
|
|
31097
31097
|
})]
|
|
31098
31098
|
}), preview && preview.componentNames && preview.componentNames.length > 0 && /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
31099
|
-
|
|
31100
|
-
|
|
31101
|
-
|
|
31102
|
-
|
|
31103
|
-
|
|
31104
|
-
|
|
31105
|
-
|
|
31099
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("label", {
|
|
31100
|
+
className: "block text-sm font-medium opacity-70 mb-2",
|
|
31101
|
+
children: "Widgets Included"
|
|
31102
|
+
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
31103
|
+
className: "flex flex-wrap gap-1.5",
|
|
31104
|
+
children: preview.componentNames.map(function (name) {
|
|
31105
|
+
return /*#__PURE__*/jsxRuntime.jsx(DashReact.Tag3, {
|
|
31106
|
+
text: name
|
|
31107
|
+
}, name);
|
|
31108
|
+
})
|
|
31106
31109
|
})]
|
|
31107
31110
|
}), /*#__PURE__*/jsxRuntime.jsx(DashReact.TextArea, {
|
|
31108
31111
|
label: "Description",
|
|
@@ -31194,8 +31197,13 @@ var PublishDashboardModal = function PublishDashboardModal(_ref) {
|
|
|
31194
31197
|
children: [/*#__PURE__*/jsxRuntime.jsx("span", {
|
|
31195
31198
|
className: "opacity-50 w-20 flex-shrink-0",
|
|
31196
31199
|
children: "Widgets"
|
|
31197
|
-
}), /*#__PURE__*/jsxRuntime.jsx("
|
|
31198
|
-
|
|
31200
|
+
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
31201
|
+
className: "flex flex-wrap gap-1",
|
|
31202
|
+
children: preview.componentNames.map(function (name) {
|
|
31203
|
+
return /*#__PURE__*/jsxRuntime.jsx(DashReact.Tag3, {
|
|
31204
|
+
text: name
|
|
31205
|
+
}, name);
|
|
31206
|
+
})
|
|
31199
31207
|
})]
|
|
31200
31208
|
})]
|
|
31201
31209
|
})]
|
|
@@ -31267,12 +31275,22 @@ var PublishDashboardModal = function PublishDashboardModal(_ref) {
|
|
|
31267
31275
|
className: "text-xs text-amber-300/90",
|
|
31268
31276
|
children: "The following widgets are not currently on the registry. This may be intentional if they are private. Dashboards referencing these widgets can only be installed by users who already have them."
|
|
31269
31277
|
})]
|
|
31270
|
-
}), /*#__PURE__*/jsxRuntime.jsx("
|
|
31271
|
-
className: "
|
|
31278
|
+
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
31279
|
+
className: "space-y-2 mt-1",
|
|
31272
31280
|
children: result.warnings.map(function (w) {
|
|
31273
|
-
return /*#__PURE__*/jsxRuntime.
|
|
31274
|
-
children:
|
|
31275
|
-
|
|
31281
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
31282
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
31283
|
+
className: "text-xs font-semibold opacity-60",
|
|
31284
|
+
children: w["package"]
|
|
31285
|
+
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
31286
|
+
className: "flex flex-wrap gap-1 mt-1",
|
|
31287
|
+
children: w.widgets.map(function (name) {
|
|
31288
|
+
return /*#__PURE__*/jsxRuntime.jsx(DashReact.Tag3, {
|
|
31289
|
+
text: name
|
|
31290
|
+
}, name);
|
|
31291
|
+
})
|
|
31292
|
+
})]
|
|
31293
|
+
}, w["package"]);
|
|
31276
31294
|
})
|
|
31277
31295
|
})]
|
|
31278
31296
|
}), result.registryCheckFailed && /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
@@ -36385,6 +36403,23 @@ var RegistryPackageDetail = function RegistryPackageDetail(_ref) {
|
|
|
36385
36403
|
}, idx);
|
|
36386
36404
|
})
|
|
36387
36405
|
})]
|
|
36406
|
+
}), widget.appOrigin && /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
36407
|
+
className: "flex items-center gap-1.5 text-xs opacity-50",
|
|
36408
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.FontAwesomeIcon, {
|
|
36409
|
+
icon: "laptop",
|
|
36410
|
+
className: "h-3 w-3"
|
|
36411
|
+
}), /*#__PURE__*/jsxRuntime.jsxs("span", {
|
|
36412
|
+
children: ["Built for ", widget.appOrigin]
|
|
36413
|
+
})]
|
|
36414
|
+
}), widget.missingApis && widget.missingApis.length > 0 && /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
36415
|
+
className: "p-2 rounded bg-yellow-900/30 border border-yellow-700",
|
|
36416
|
+
children: /*#__PURE__*/jsxRuntime.jsxs("p", {
|
|
36417
|
+
className: "text-xs text-yellow-400",
|
|
36418
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.FontAwesomeIcon, {
|
|
36419
|
+
icon: "triangle-exclamation",
|
|
36420
|
+
className: "mr-1"
|
|
36421
|
+
}), "Incompatible \u2014 requires", " ", widget.missingApis.join(", "), " API", widget.missingApis.length !== 1 ? "s" : ""]
|
|
36422
|
+
})
|
|
36388
36423
|
}), widget.repository && /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
36389
36424
|
children: [/*#__PURE__*/jsxRuntime.jsx("span", {
|
|
36390
36425
|
className: "text-xs font-semibold opacity-50 mb-1 block",
|
|
@@ -36430,6 +36465,10 @@ function _arrayLikeToArray$2(r, a) { (null == a || a > r.length) && (a = r.lengt
|
|
|
36430
36465
|
* Extracted from EnhancedWidgetDropdown so the same logic can power the
|
|
36431
36466
|
* Discover tab inside AppSettingsModal (and anywhere else).
|
|
36432
36467
|
*
|
|
36468
|
+
* Options:
|
|
36469
|
+
* filterByCapabilities – if true (default), only show packages compatible
|
|
36470
|
+
* with the app's API capabilities
|
|
36471
|
+
*
|
|
36433
36472
|
* Returns:
|
|
36434
36473
|
* packages – raw package objects from the registry
|
|
36435
36474
|
* flatWidgets – flattened widget entries with `isRegistry: true`
|
|
@@ -36440,8 +36479,13 @@ function _arrayLikeToArray$2(r, a) { (null == a || a > r.length) && (a = r.lengt
|
|
|
36440
36479
|
* installError – install error string (or null)
|
|
36441
36480
|
* search() – manually trigger a search
|
|
36442
36481
|
* installPackage(widget) – install a specific registry widget
|
|
36482
|
+
* showAllPackages / setShowAllPackages – toggle to show incompatible packages
|
|
36483
|
+
* appCapabilities – the app's API namespaces
|
|
36443
36484
|
*/
|
|
36444
36485
|
var useRegistrySearch = function useRegistrySearch() {
|
|
36486
|
+
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
36487
|
+
_ref$filterByCapabili = _ref.filterByCapabilities,
|
|
36488
|
+
filterByCapabilities = _ref$filterByCapabili === void 0 ? true : _ref$filterByCapabili;
|
|
36445
36489
|
var _useState = React.useState(false),
|
|
36446
36490
|
_useState2 = _slicedToArray(_useState, 2),
|
|
36447
36491
|
isLoading = _useState2[0],
|
|
@@ -36470,10 +36514,22 @@ var useRegistrySearch = function useRegistrySearch() {
|
|
|
36470
36514
|
_useState12 = _slicedToArray(_useState11, 2),
|
|
36471
36515
|
installError = _useState12[0],
|
|
36472
36516
|
setInstallError = _useState12[1];
|
|
36517
|
+
var _useState13 = React.useState(false),
|
|
36518
|
+
_useState14 = _slicedToArray(_useState13, 2),
|
|
36519
|
+
showAllPackages = _useState14[0],
|
|
36520
|
+
setShowAllPackages = _useState14[1];
|
|
36521
|
+
|
|
36522
|
+
// Discover app capabilities from window.mainApi
|
|
36523
|
+
var appCapabilities = React.useMemo(function () {
|
|
36524
|
+
if (typeof window !== "undefined" && window.mainApi) {
|
|
36525
|
+
return Object.keys(window.mainApi);
|
|
36526
|
+
}
|
|
36527
|
+
return [];
|
|
36528
|
+
}, []);
|
|
36473
36529
|
var search = React.useCallback(/*#__PURE__*/function () {
|
|
36474
|
-
var
|
|
36530
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(query) {
|
|
36475
36531
|
var _window$mainApi;
|
|
36476
|
-
var result, pkgs, widgets, _iterator, _step, pkg, _iterator2, _step2, widget, _t;
|
|
36532
|
+
var filters, result, pkgs, capSet, widgets, _iterator, _step, pkg, allApiProviders, _iterator2, _step2, p, _iterator3, _step3, w, _iterator5, _step5, _p, missingApis, _iterator4, _step4, widget, _t;
|
|
36477
36533
|
return _regeneratorRuntime.wrap(function (_context) {
|
|
36478
36534
|
while (1) switch (_context.prev = _context.next) {
|
|
36479
36535
|
case 0:
|
|
@@ -36488,23 +36544,71 @@ var useRegistrySearch = function useRegistrySearch() {
|
|
|
36488
36544
|
setIsLoading(true);
|
|
36489
36545
|
setError(null);
|
|
36490
36546
|
_context.prev = 2;
|
|
36547
|
+
filters = {};
|
|
36548
|
+
if (filterByCapabilities && !showAllPackages && appCapabilities.length) {
|
|
36549
|
+
filters.appCapabilities = appCapabilities;
|
|
36550
|
+
}
|
|
36491
36551
|
_context.next = 3;
|
|
36492
|
-
return window.mainApi.registry.search(query !== null && query !== void 0 ? query : searchQuery,
|
|
36552
|
+
return window.mainApi.registry.search(query !== null && query !== void 0 ? query : searchQuery, filters);
|
|
36493
36553
|
case 3:
|
|
36494
36554
|
result = _context.sent;
|
|
36495
36555
|
pkgs = result.packages || [];
|
|
36496
36556
|
setPackages(pkgs);
|
|
36497
36557
|
|
|
36498
36558
|
// Flatten packages into widget entries
|
|
36559
|
+
capSet = new Set(appCapabilities.map(function (c) {
|
|
36560
|
+
return c.toLowerCase();
|
|
36561
|
+
}));
|
|
36499
36562
|
widgets = [];
|
|
36500
36563
|
_iterator = _createForOfIteratorHelper$2(pkgs);
|
|
36501
36564
|
try {
|
|
36502
36565
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
36503
36566
|
pkg = _step.value;
|
|
36504
|
-
|
|
36567
|
+
// Compute missing APIs for the entire package
|
|
36568
|
+
allApiProviders = [];
|
|
36569
|
+
_iterator2 = _createForOfIteratorHelper$2(pkg.providers || []);
|
|
36505
36570
|
try {
|
|
36506
36571
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
36507
|
-
|
|
36572
|
+
p = _step2.value;
|
|
36573
|
+
if (p.providerClass === "api" && p.required !== false) {
|
|
36574
|
+
allApiProviders.push(p.type);
|
|
36575
|
+
}
|
|
36576
|
+
}
|
|
36577
|
+
} catch (err) {
|
|
36578
|
+
_iterator2.e(err);
|
|
36579
|
+
} finally {
|
|
36580
|
+
_iterator2.f();
|
|
36581
|
+
}
|
|
36582
|
+
_iterator3 = _createForOfIteratorHelper$2(pkg.widgets || []);
|
|
36583
|
+
try {
|
|
36584
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
36585
|
+
w = _step3.value;
|
|
36586
|
+
_iterator5 = _createForOfIteratorHelper$2(w.providers || []);
|
|
36587
|
+
try {
|
|
36588
|
+
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
36589
|
+
_p = _step5.value;
|
|
36590
|
+
if (_p.providerClass === "api" && _p.required !== false) {
|
|
36591
|
+
allApiProviders.push(_p.type);
|
|
36592
|
+
}
|
|
36593
|
+
}
|
|
36594
|
+
} catch (err) {
|
|
36595
|
+
_iterator5.e(err);
|
|
36596
|
+
} finally {
|
|
36597
|
+
_iterator5.f();
|
|
36598
|
+
}
|
|
36599
|
+
}
|
|
36600
|
+
} catch (err) {
|
|
36601
|
+
_iterator3.e(err);
|
|
36602
|
+
} finally {
|
|
36603
|
+
_iterator3.f();
|
|
36604
|
+
}
|
|
36605
|
+
missingApis = _toConsumableArray(new Set(allApiProviders)).filter(function (api) {
|
|
36606
|
+
return !capSet.has(api.toLowerCase());
|
|
36607
|
+
});
|
|
36608
|
+
_iterator4 = _createForOfIteratorHelper$2(pkg.widgets || []);
|
|
36609
|
+
try {
|
|
36610
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
36611
|
+
widget = _step4.value;
|
|
36508
36612
|
widgets.push({
|
|
36509
36613
|
key: "".concat(pkg.name, "/").concat(widget.name),
|
|
36510
36614
|
name: widget.displayName || widget.name,
|
|
@@ -36522,13 +36626,16 @@ var useRegistrySearch = function useRegistrySearch() {
|
|
|
36522
36626
|
downloadUrl: pkg.downloadUrl || "",
|
|
36523
36627
|
repository: pkg.repository || "",
|
|
36524
36628
|
publishedAt: pkg.publishedAt || "",
|
|
36525
|
-
packageWidgets: pkg.widgets || []
|
|
36629
|
+
packageWidgets: pkg.widgets || [],
|
|
36630
|
+
appOrigin: pkg.appOrigin || null,
|
|
36631
|
+
packageProviders: pkg.providers || [],
|
|
36632
|
+
missingApis: missingApis
|
|
36526
36633
|
});
|
|
36527
36634
|
}
|
|
36528
36635
|
} catch (err) {
|
|
36529
|
-
|
|
36636
|
+
_iterator4.e(err);
|
|
36530
36637
|
} finally {
|
|
36531
|
-
|
|
36638
|
+
_iterator4.f();
|
|
36532
36639
|
}
|
|
36533
36640
|
}
|
|
36534
36641
|
} catch (err) {
|
|
@@ -36556,9 +36663,9 @@ var useRegistrySearch = function useRegistrySearch() {
|
|
|
36556
36663
|
}, _callee, null, [[2, 4, 5, 6]]);
|
|
36557
36664
|
}));
|
|
36558
36665
|
return function (_x) {
|
|
36559
|
-
return
|
|
36666
|
+
return _ref2.apply(this, arguments);
|
|
36560
36667
|
};
|
|
36561
|
-
}(), [searchQuery]);
|
|
36668
|
+
}(), [searchQuery, filterByCapabilities, showAllPackages, appCapabilities]);
|
|
36562
36669
|
|
|
36563
36670
|
// Debounce search on query changes (300ms)
|
|
36564
36671
|
React.useEffect(function () {
|
|
@@ -36569,9 +36676,9 @@ var useRegistrySearch = function useRegistrySearch() {
|
|
|
36569
36676
|
return clearTimeout(timer);
|
|
36570
36677
|
};
|
|
36571
36678
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
36572
|
-
}, [searchQuery]);
|
|
36679
|
+
}, [searchQuery, showAllPackages]);
|
|
36573
36680
|
var installPackage = React.useCallback(/*#__PURE__*/function () {
|
|
36574
|
-
var
|
|
36681
|
+
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(widget) {
|
|
36575
36682
|
var packageName, downloadUrl, packageVersion, resolvedUrl, _t2;
|
|
36576
36683
|
return _regeneratorRuntime.wrap(function (_context2) {
|
|
36577
36684
|
while (1) switch (_context2.prev = _context2.next) {
|
|
@@ -36607,7 +36714,7 @@ var useRegistrySearch = function useRegistrySearch() {
|
|
|
36607
36714
|
}, _callee2, null, [[2, 4, 5, 6]]);
|
|
36608
36715
|
}));
|
|
36609
36716
|
return function (_x2) {
|
|
36610
|
-
return
|
|
36717
|
+
return _ref3.apply(this, arguments);
|
|
36611
36718
|
};
|
|
36612
36719
|
}(), []);
|
|
36613
36720
|
var retry = React.useCallback(function () {
|
|
@@ -36624,7 +36731,10 @@ var useRegistrySearch = function useRegistrySearch() {
|
|
|
36624
36731
|
installError: installError,
|
|
36625
36732
|
search: search,
|
|
36626
36733
|
installPackage: installPackage,
|
|
36627
|
-
retry: retry
|
|
36734
|
+
retry: retry,
|
|
36735
|
+
showAllPackages: showAllPackages,
|
|
36736
|
+
setShowAllPackages: setShowAllPackages,
|
|
36737
|
+
appCapabilities: appCapabilities
|
|
36628
36738
|
};
|
|
36629
36739
|
};
|
|
36630
36740
|
|
|
@@ -36650,7 +36760,9 @@ var DiscoverWidgetsDetail = function DiscoverWidgetsDetail(_ref) {
|
|
|
36650
36760
|
isInstalling = _useRegistrySearch.isInstalling,
|
|
36651
36761
|
installError = _useRegistrySearch.installError,
|
|
36652
36762
|
installPackage = _useRegistrySearch.installPackage,
|
|
36653
|
-
retry = _useRegistrySearch.retry
|
|
36763
|
+
retry = _useRegistrySearch.retry,
|
|
36764
|
+
showAllPackages = _useRegistrySearch.showAllPackages,
|
|
36765
|
+
setShowAllPackages = _useRegistrySearch.setShowAllPackages;
|
|
36654
36766
|
var _useState = React.useState(null),
|
|
36655
36767
|
_useState2 = _slicedToArray(_useState, 2),
|
|
36656
36768
|
selectedPackageName = _useState2[0],
|
|
@@ -36815,10 +36927,15 @@ var DiscoverWidgetsDetail = function DiscoverWidgetsDetail(_ref) {
|
|
|
36815
36927
|
className: "space-y-1",
|
|
36816
36928
|
children: packages.map(function (pkg) {
|
|
36817
36929
|
var widgetCount = (pkg.widgets || []).length;
|
|
36930
|
+
// Check if this package has incompatible API dependencies
|
|
36931
|
+
var pkgWidget = flatWidgets.find(function (w) {
|
|
36932
|
+
return w.packageName === pkg.name;
|
|
36933
|
+
});
|
|
36934
|
+
var hasIncompatible = (pkgWidget === null || pkgWidget === void 0 ? void 0 : pkgWidget.missingApis) && pkgWidget.missingApis.length > 0;
|
|
36818
36935
|
return /*#__PURE__*/jsxRuntime.jsx(DashReact.Sidebar.Item, {
|
|
36819
36936
|
icon: /*#__PURE__*/jsxRuntime.jsx(DashReact.FontAwesomeIcon, {
|
|
36820
|
-
icon: "cube",
|
|
36821
|
-
className: "h-3.5 w-3.5"
|
|
36937
|
+
icon: hasIncompatible ? "triangle-exclamation" : "cube",
|
|
36938
|
+
className: "h-3.5 w-3.5 ".concat(hasIncompatible ? "text-yellow-500" : "")
|
|
36822
36939
|
}),
|
|
36823
36940
|
onClick: function onClick() {
|
|
36824
36941
|
return setSelectedPackageName(pkg.name);
|
|
@@ -36844,14 +36961,24 @@ var DiscoverWidgetsDetail = function DiscoverWidgetsDetail(_ref) {
|
|
|
36844
36961
|
children: "Back"
|
|
36845
36962
|
})]
|
|
36846
36963
|
})
|
|
36847
|
-
}), /*#__PURE__*/jsxRuntime.
|
|
36964
|
+
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
36848
36965
|
className: "flex-shrink-0 px-4 py-3",
|
|
36849
|
-
children: /*#__PURE__*/jsxRuntime.jsx(DashReact.SearchInput, {
|
|
36966
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.SearchInput, {
|
|
36850
36967
|
value: searchQuery,
|
|
36851
36968
|
onChange: setSearchQuery,
|
|
36852
36969
|
placeholder: "Search packages...",
|
|
36853
36970
|
inputClassName: "py-1.5 text-xs"
|
|
36854
|
-
})
|
|
36971
|
+
}), /*#__PURE__*/jsxRuntime.jsxs("label", {
|
|
36972
|
+
className: "flex items-center gap-1.5 mt-2 text-xs opacity-50 cursor-pointer select-none",
|
|
36973
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("input", {
|
|
36974
|
+
type: "checkbox",
|
|
36975
|
+
checked: showAllPackages,
|
|
36976
|
+
onChange: function onChange(e) {
|
|
36977
|
+
return setShowAllPackages(e.target.checked);
|
|
36978
|
+
},
|
|
36979
|
+
className: "rounded"
|
|
36980
|
+
}), "Show all packages"]
|
|
36981
|
+
})]
|
|
36855
36982
|
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
36856
36983
|
className: "flex-1 min-h-0 overflow-y-auto px-2",
|
|
36857
36984
|
children: listBody
|