@trops/dash-core 0.1.778 → 0.1.779
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 +53 -25
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +53 -25
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2798,6 +2798,30 @@ function useWidgetRegistryVersion() {
|
|
|
2798
2798
|
return version;
|
|
2799
2799
|
}
|
|
2800
2800
|
|
|
2801
|
+
/**
|
|
2802
|
+
* draftPackage.js — is a widget package a Widget Builder draft?
|
|
2803
|
+
*
|
|
2804
|
+
* Drafts are in-progress widgets the Widget Builder saves as it goes, in
|
|
2805
|
+
* `@ai-built/draft-<draft id>/` (older ones: `@ai-built/<name>-draft-<shortId>/`).
|
|
2806
|
+
* They're registered like any widget so they can preview, but they belong
|
|
2807
|
+
* in Manage › Widgets (Resume / Delete), not in the sidebar or pickers.
|
|
2808
|
+
*/
|
|
2809
|
+
|
|
2810
|
+
var DRAFT_DIR = /(?:^|\/)(draft-[A-Za-z0-9][A-Za-z0-9-]*)$/;
|
|
2811
|
+
var LEGACY_DRAFT_DIR = /-draft-[A-Za-z0-9]+$/;
|
|
2812
|
+
|
|
2813
|
+
/** @param {string} pkg a package name or its folder ("@ai-built/draft-…") */
|
|
2814
|
+
function isDraftPackage(pkg) {
|
|
2815
|
+
var name = String(pkg || "");
|
|
2816
|
+
return DRAFT_DIR.test(name) || LEGACY_DRAFT_DIR.test(name);
|
|
2817
|
+
}
|
|
2818
|
+
|
|
2819
|
+
/** The draft's id for an id-keyed draft package, else null. */
|
|
2820
|
+
function draftIdOf(pkg) {
|
|
2821
|
+
var m = String(pkg || "").match(DRAFT_DIR);
|
|
2822
|
+
return m ? m[1] : null;
|
|
2823
|
+
}
|
|
2824
|
+
|
|
2801
2825
|
function _createForOfIteratorHelper$1b(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray$1b(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
2802
2826
|
function _unsupportedIterableToArray$1b(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray$1b(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$1b(r, a) : void 0; } }
|
|
2803
2827
|
function _arrayLikeToArray$1b(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
@@ -2902,12 +2926,13 @@ var useInstalledWidgets = function useInstalledWidgets() {
|
|
|
2902
2926
|
draftId: draftsByPackageDir.get(path).id
|
|
2903
2927
|
};
|
|
2904
2928
|
}
|
|
2905
|
-
// 2. Fallback:
|
|
2906
|
-
//
|
|
2907
|
-
|
|
2908
|
-
if (
|
|
2909
|
-
var
|
|
2910
|
-
var
|
|
2929
|
+
// 2. Fallback: a draft folder by name — today's `draft-<id>`
|
|
2930
|
+
// is the draft's id; an older `<base>-draft-<shortId>` is
|
|
2931
|
+
// looked up by its shortId.
|
|
2932
|
+
if (isDraftPackage(name)) {
|
|
2933
|
+
var id = draftIdOf(name);
|
|
2934
|
+
var m = String(name).match(/-draft-([A-Za-z0-9]+)$/);
|
|
2935
|
+
var draftId = id ? id : m && draftShortIdToId.get(m[1].slice(0, 8)) || null;
|
|
2911
2936
|
return {
|
|
2912
2937
|
kind: "draft",
|
|
2913
2938
|
draftId: draftId
|
|
@@ -18749,16 +18774,11 @@ var EnhancedWidgetDropdown = function EnhancedWidgetDropdown(_ref) {
|
|
|
18749
18774
|
// Filter widgets based on search, author, and provider
|
|
18750
18775
|
var getFilteredWidgets = function getFilteredWidgets() {
|
|
18751
18776
|
var filtered = widgets.filter(function (widget) {
|
|
18752
|
-
// Drafts are in-progress widgets
|
|
18753
|
-
//
|
|
18754
|
-
//
|
|
18755
|
-
//
|
|
18756
|
-
|
|
18757
|
-
// matching backstop in useInstalledWidgets#classifyWidget).
|
|
18758
|
-
// useInstalledWidgets sets `widget.kind` for consumers that
|
|
18759
|
-
// go through that hook; check it too for forward-compat.
|
|
18760
|
-
var sourcePackage = widget._sourcePackage || "";
|
|
18761
|
-
if (widget.kind === "draft" || /-draft-[A-Za-z0-9]+$/.test(sourcePackage)) {
|
|
18777
|
+
// Drafts are in-progress widgets (`@ai-built/draft-<id>/`) and
|
|
18778
|
+
// shouldn't appear in the placement picker. This picker reads
|
|
18779
|
+
// ComponentManager, so drafts are found by their source package;
|
|
18780
|
+
// useInstalledWidgets' `kind` is checked too.
|
|
18781
|
+
if (widget.kind === "draft" || isDraftPackage(widget._sourcePackage)) {
|
|
18762
18782
|
return false;
|
|
18763
18783
|
}
|
|
18764
18784
|
|
|
@@ -64196,6 +64216,22 @@ var splitWords = function splitWords(s) {
|
|
|
64196
64216
|
return String(s).replace(/([a-z])([A-Z0-9])/g, "$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g, "$1 $2").replace(/([0-9])([A-Za-z])/g, "$1 $2");
|
|
64197
64217
|
};
|
|
64198
64218
|
|
|
64219
|
+
/**
|
|
64220
|
+
* The sidebar's widgets: every widget component, by key — not Widget Builder
|
|
64221
|
+
* drafts, which live in Manage › Widgets.
|
|
64222
|
+
*/
|
|
64223
|
+
function sidebarWidgets(componentMap) {
|
|
64224
|
+
var map = componentMap || {};
|
|
64225
|
+
return Object.keys(map).sort().filter(function (key) {
|
|
64226
|
+
return map[key] && map[key].type === "widget" && !isDraftPackage(map[key]._sourcePackage);
|
|
64227
|
+
}).map(function (key) {
|
|
64228
|
+
return {
|
|
64229
|
+
key: key,
|
|
64230
|
+
widget: map[key]
|
|
64231
|
+
};
|
|
64232
|
+
});
|
|
64233
|
+
}
|
|
64234
|
+
|
|
64199
64235
|
/**
|
|
64200
64236
|
* The title for a widget row: its displayName, else its own name (unless
|
|
64201
64237
|
* that's the model default), else its component name as words.
|
|
@@ -64752,15 +64788,7 @@ var WidgetSidebar = function WidgetSidebar(_ref4) {
|
|
|
64752
64788
|
|
|
64753
64789
|
// Flat list of all widgets
|
|
64754
64790
|
var allWidgets = React.useMemo(function () {
|
|
64755
|
-
|
|
64756
|
-
return Object.keys(componentMap).sort().filter(function (key) {
|
|
64757
|
-
return componentMap[key].type === "widget";
|
|
64758
|
-
}).map(function (key) {
|
|
64759
|
-
return {
|
|
64760
|
-
key: key,
|
|
64761
|
-
widget: componentMap[key]
|
|
64762
|
-
};
|
|
64763
|
-
});
|
|
64791
|
+
return sidebarWidgets(ComponentManager.map());
|
|
64764
64792
|
}, [widgetVersion]);
|
|
64765
64793
|
|
|
64766
64794
|
// Set of installed package identifiers for "Installed" badge in Discover tab.
|